Tag Scaling Properties
Tag Scaling
Watch the videoConfiguring a Tag's scaling will condition the data for use within the Ignition Designer. Scaling will take the raw PLC value driving a Tag, do some math, and use the resulting value as the value of that Tag. Scaling works both ways. When you write to that Tag, Ignition will scale it in the opposite direction before writing to the PLC.
For example, if the capacity of a tank is 5250 gallons, but the tank's fill level is better represented in the Designer as percentage of 0 through 100, configuring the Tag's scaling property, will result in the Tag displaying 0 through 100, while the actual tank fill moving is between 0 and 5250 gallons. For this example, you can double-click on the Tag to open the Tag Editor, and expand Numeric Properties to configure the scaling of the Tag. When scaling between a Raw Low and and High, and Scaled Low and High, select the Linear Scale Mode. So what Ignition is actually doing, is setting up the calculations behind the scenes to scale the value appropriately.
The numbers and units don't have to match-up. Scaling is straight from one number to another number. It doesn't matter what the units are, and it doesn't matter what the conversion is. What is important, is that the data type of the Tag must match the data type of the scale value (i.e., dividing an integer in the PLC by 10 probably means your Ignition Tag should be a float).
Scaling is not available on Memory Tags: Memory Tags are not driven by an external source such as a PLC or SQL query, so scaling will never be applied. In these scenarios, it is recommended to scale the mechanism that is writing to the Memory Tag instead. Numerical properties of Tags can be scaled allowing automatic bi-directional conversion outside of the PLC. Scaling types include Linear scaling, Square Root scaling, and Exponential Filter scaling. The numerical properties are available to OPC, Expression, Database, and Client Tags whose data types are numeric. For a complete list of all of the Tag Scaling properties, see Tag Properties.
Linear Scaling
The value will be scaled linearly between the low and high values, and clamped as appropriate. The linear equation is:
ScaledValue = ΔS * (Value-RL)/ΔR + SL
Where:
ΔS = (ScaledHigh-ScaledLow)
ΔR = (RawHigh - RawLow)
RL = RawLow
SL = ScaledLow
Square Root Scaling
The equation for square root scaling is:
ScaledValue = ΔS * √((Value-RL)/ΔR) + SL
Where:
ΔS = (ScaledHigh-ScaledLow)
ΔR = (RawHigh - RawLow)
RL = RawLow
SL = ScaledLow
Exponential Filter Scaling
This mode implements a simple linear recursive filter to smooth values. The scale factor corresponds to the weight of the smoothing effect, and is a value between 0.0 and 1.0. The smaller the factor, the greater the degree of smoothing.
The equation for the filter is:
y(t) = (1-f)*y(t-1)+f*x(t)
Where:
y(t) = the output at time t
y(t-1) = the previous output
x(t) = the input value (current value)
f = the scale factor, with 0.0<=f<=1.0
Only good quality values are considered for the filter. Bad quality values are ignored.
Bit Inversion Scaling
This simple scaling mode will generate the complement of a binary value. If the current value is coming in as 0001_0101 (21), this will return a 1110_1010 (-22) instead. A popular use for this scale mode is that it can be used to invert modbus values if your device stores them in reverse bit order. Note that Bit Inversion Scaling uses a little-endian format.
Scaling Examples
Simple Divide by Ten
This is common when storing a single decimal point of precision as an Integer in the PLC. This is to save space by not using a Float type.
Raw Low: 0.0
Raw High: 100.0
Scaled Low: 0.0
Scaled High: 10.0
4-20 Milliamp Signal to Percent
This is common when using a simple pressure sensor. The sensor is calibrated to send 4 milliamps (minimum value) when the tank is empty, and 20 milliamps (maximum value) when the tank is full.
Raw Low: 4.0
Raw High: 20.0
Scaled Low: 0.0
Scaled High: 100.0
4-20 Milliamp Signal to Gallons
This is common when using a simple pressure sensor. The sensor is calibrated to send 4 milliamps (minimum value) when the tank is empty, and 20 milliamps (maximum value) when the tank is full (5000 gallons).
There is no direct conversion between amps and gallons. In scaling it doesn't matter.
Raw Low: 4.0
Raw High: 20.0
Scaled Low: 0.0
Scaled High: 5000.0