Appearance
Scaling, clamping and deadband
A device often reports a number in its own units: a 12-bit analog card reads 0 to 4095, a 4–20 mA input reads 4 to 20, a counter reads raw pulses. A device tag can convert that reading to engineering units before anything else sees it, and convert a written value back before it goes to the device. The same settings decide how much a reading has to change before Nexus stores it.
Scaling applies to device tags and expression tags: to a device's reading, and to an expression's result. A write to a device tag is converted back on its way to the device. A memory tag holds exactly the value written to it, so it has nothing to scale, and Nexus refuses scaling settings on one. DeadbandMode can be set on any tag, like Deadband.
Where to set them
In Studio, open Edit Tag… on a device or expression tag and go to the Numeric category. The Scaling section holds the scaling fields; DeadbandMode sits next to Deadband. Fields the chosen mode does not use are grayed out.
In ConfigHub, the same properties are on the Tags page.
A change applies to the next reading. Nexus does not need a restart.
Order of operations
Every reading from a device goes through the same steps, in this order:
- Scale. The raw reading is converted to engineering units, using
ScaleMode. - Clamp. If
ClampModeis set, a value beyond the ends of the scaled range is pulled back to the end it passed. - Deadband. The scaled value is compared with the value already stored. If the change is within the deadband, it is not stored and nothing is published. The deadband is always in engineering units, so you set it in the units the operator sees.
A value that is stored then goes on to alarms, history, scripts and screens.
A write goes the other way. An operator, script or REST write gives an engineering value. Nexus clamps it (if ClampMode is set), converts it back to the raw value, and sends that to the device. If the device register is an integer, the raw value is rounded to the nearest whole number.
Scale modes
ScaleMode | What it does | Uses |
|---|---|---|
Off (or not set) | Stores the reading unchanged. | — |
Linear | Maps RawLow…RawHigh onto ScaledLow…ScaledHigh in a straight line. | Raw and scaled ranges, ClampMode |
SquareRoot | Like Linear, but on the square root of the position in the raw range. Used for flow from a differential-pressure transmitter. | Raw and scaled ranges, ClampMode |
ExponentialFilter | Smooths a noisy reading. Each new reading moves the stored value part of the way toward it. | ScaleFactor |
BitInversion | Inverts a Boolean (true ↔ false) or every bit of an integer. | — |
When the raw or scaled range is left blank, Nexus uses 0 to 100 for the raw range and 0 to 10 for the scaled range. These are Ignition's defaults, so a tag brought over from Ignition behaves the same.
A scaled reading from an integer register is stored as a decimal number, so precision is not lost. A reading from a 32-bit float register stays a float.
Give a scaled tag the Float or Double data type. A write is converted to the tag's data type before it is scaled back, so a tag left as Int accepts only whole engineering units: a write of 25.5 % arrives as 25 %.
Linear: a 4–20 mA level transmitter
The card reports milliamps. The tank is 0 to 12 feet.
| Property | Value |
|---|---|
ScaleMode | Linear |
RawLow / RawHigh | 4 / 20 |
ScaledLow / ScaledHigh | 0 / 12 |
A reading of 12 mA is halfway along the raw range, so the tag shows 6 ft. A reading of 8 mA is a quarter of the way, so it shows 3 ft.
The calculation is:
scaled = ScaledLow + (raw − RawLow) / (RawHigh − RawLow) × (ScaledHigh − ScaledLow)If an operator writes 9 ft to this tag, Nexus sends 16 mA to the device.
A range can run backwards. With ScaledLow 100 and ScaledHigh 0, a valve that reads 0 when fully open shows 100 %.
Square root: flow from a DP transmitter
Flow is proportional to the square root of the differential pressure.
| Property | Value |
|---|---|
ScaleMode | SquareRoot |
RawLow / RawHigh | 0 / 4095 |
ScaledLow / ScaledHigh | 0 / 500 (gal/min) |
A reading of 1024 is a quarter of the raw range. The square root of 0.25 is 0.5, so the tag shows 250 gal/min.
A reading below RawLow gives a negative flow (the negative of the square root of its distance below the range) rather than an error, so a transmitter reading below zero is still visible. Set ClampMode to Clamp_Low to show 0 instead.
Exponential filter: smoothing a noisy reading
| Property | Value |
|---|---|
ScaleMode | ExponentialFilter |
ScaleFactor | 0.25 |
ScaleFactor is the weight of each new reading, greater than 0 and at most 1. The stored value becomes:
new value = (1 − ScaleFactor) × previous value + ScaleFactor × readingWith a factor of 0.25, a value of 10 followed by a reading of 20 stores 12.5, then 14.375, and so on toward 20. A factor of 1 means no smoothing.
The first reading is stored as it is. After that, every reading the device delivers goes into the average, whether or not it changed: on a polled device (Modbus, Allen-Bradley, S7 and the other polled drivers) that is every poll, so a value that steps and then holds still reaches it. An OPC UA device reports only changes, so there the average moves only when the value does, as in Ignition. A filtered value keeps changing a little on every poll while it closes in, so give the tag a small Deadband to stop storing changes too small to matter.
Only Good-quality readings are averaged; any other reading is stored unchanged and does not affect the average. The average is kept across a loss of communication: the first Good reading after a Bad gap is averaged with the value from before the gap, as in Ignition. Changing any scaling setting starts the average over.
A write to a filtered tag is sent to the device unchanged.
Bit inversion
BitInversion stores the opposite of a Boolean, which suits a normally-closed contact that should read true when it is made. On an integer it inverts every bit, so 5 is stored as −6. A write is inverted the same way before it reaches the device. A float reading is not changed.
Clamping
ClampMode keeps a Linear or SquareRoot value within the scaled range.
ClampMode | Effect |
|---|---|
No_Clamp (or not set) | Values outside the range are scaled along the same line. |
Clamp_Low | Nothing is shown beyond the ScaledLow end. |
Clamp_High | Nothing is shown beyond the ScaledHigh end. |
Clamp_Both | Both ends. |
With the 4–20 mA example and Clamp_Both, a reading of 2 mA (a broken loop) shows 0 ft rather than −1.5 ft. A clamped value keeps its quality; clamping does not mark a reading Bad. Use the tag's Quality checks to mark an out-of-range reading Bad.
Clamping also applies to writes. With Clamp_Both, a write of 15 ft to the example tag sends 20 mA. Nexus then reads the device back, so the tag shows 12 ft, the value the device actually received.
Deadband modes
Deadband sets how much a reading must change before it is stored. DeadbandMode says what the number means.
DeadbandMode | Deadband is |
|---|---|
Absolute (or not set) | A change in engineering units. |
Percent | A percent of the engineering range, EngHigh − EngLow. When both are blank, the range is 0 to 100. |
Off | Ignored. Every change is stored. |
A reading is stored when it differs from the stored value by more than the deadband. A change of exactly the deadband is not stored.
Example: EngLow 0, EngHigh 12, DeadbandMode Percent, Deadband 1. One percent of 12 ft is 0.12 ft. A level stored at 6.00 ft is not updated by a reading of 6.10 ft, and is updated by a reading of 6.15 ft.
Some readings are always stored, whatever the deadband: the first reading after the tag starts, a Boolean or text value, and a reading whose data type differs from the stored one. A write by an operator or a script is never held back by the deadband.
When Nexus refuses a setting
Saving one of these from Studio, ConfigHub or the REST API is refused, with the reason, when:
ScaleMode,ClampModeorDeadbandModeis not one of the names above (they are not case-sensitive);RawLowequalsRawHigh, orScaledLowequalsScaledHigh, withLinearorSquareRoot;ScaleFactoris not greater than 0 and at most 1 withExponentialFilter;EngLowequalsEngHighwith aPercentdeadband;- a range or factor is not a number;
- the tag is a memory tag (any setting except
DeadbandMode); EngLoworEngHighis changed so they are equal whileDeadbandModeisPercent.
Nothing is saved when a setting is refused, and the running tag keeps its previous settings.
If a project file edited by hand has one of these problems, Nexus stores the tag's readings unscaled (or with no deadband, for a deadband problem) and writes one warning to its log naming the tag and the setting.
In the project file
The properties are keys on the tag's entry under providers[].tags[], with the same names Ignition uses:
json
{
"path": "Tank/Level",
"type": "device",
"device": "PLC150",
"address": "HR100",
"dataType": "float",
"scaleMode": "Linear",
"rawLow": 4,
"rawHigh": 20,
"scaledLow": 0,
"scaledHigh": 12,
"clampMode": "Clamp_Both",
"deadbandMode": "Percent",
"deadband": 1,
"engLow": 0,
"engHigh": 12,
"engUnit": "ft"
}A binding or script can read any of them as a tag member, for example [DEFAULT]Tank/Level.ScaledHigh.
Differences from Ignition
The modes, names and defaults match Ignition 8.3. A few cases where Ignition's result is not usable work differently in Nexus:
- A backward scaled range with clamping. Nexus clamps at the ends of the range. Ignition compares against
ScaledLowandScaledHighas numbers, so a backward range with clamping shows one end for every reading. - Square root below
RawLow. Nexus gives a negative value. Ignition gives a value that is not a number, with Good quality. - Percent deadband with
EngHighbelowEngLow. Nexus uses the size of the range. In Ignition such a tag stops updating. - Data type. Ignition rounds a scaled value to the tag's data type. A Nexus device tag takes its type from the device, so a scaled integer reading is stored as a decimal number; a write is rounded back to the register's type.
- Boundary. A change of exactly the deadband is not stored in Nexus; in Ignition it is.
- Refusals. Ignition accepts
RawLowequal toRawHighand then just adds an offset. Nexus refuses it, since it is almost always a typing mistake. - Memory tags. Ignition applies scaling to a memory tag's written value and scales it back for display, which in practice only clamps or filters what is written. Nexus refuses scaling on a memory tag.
- Engineering limit mode. Ignition's separate
EngLimitMode(mark a value outsideEngLow…EngHighBad) is not a scaling setting in Nexus. Use the tag's Quality checks range instead.