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. . For a complete list of all of the Tag Scaling properties, see Tag Properties.
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
|
The equation for square root scaling is:
ScaledValue = ΔS * √((Value - RL) / ΔR) + SL
|
Where:
ΔS = (ScaledHigh-ScaledLow)
ΔR = (RawHigh - RawLow)
RL = RawLow
SL = ScaledLow
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
Note: Only good quality values are considered for the filter. Bad quality values are ignored.
This simple scaling mode will 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.