Scaling Values FC105
Scaling Values FC105
Description
The SCALE function takes an integer value (IN) and converts it to a real value in engineering units
scaled between a low and a high limit (LO_LIM and HI_LIM). The result is written in OUT. The
SCALE function uses the equation:
OUT = [ ((FLOAT (IN) – K1)/(K2–K1)) ∗ (HI_LIM–LO_LIM)] + LO_LIM
The constants K1 and K2 are set based upon whether the input value is BIPOLAR or UNIPOLAR.
• BIPOLAR: The input integer value is assumed to be between –27648 and 27648, therefore, K1 =
–27648.0 and K2 = +27648.0
• UNIPOLAR: The input integer value is assumed to be between 0 and 27648, therefore, K1 = 0.0
and K2 = +27648.0
If the input integer value is greater than K2, the output (OUT) is clamped to HI_LIM, and an error is
returned. If the input integer value is less than K1, the output is clamped to LO_LIM, and an error is
returned.
Reverse scaling can be obtained by programming LO_LIM > HI_LIM. With reverse scaling, the value
of the output decreases as the value of the input increases.
FC105 Parameters
Error Information
If the input integer value is greater than K2, the output (OUT) is clamped to HI_LIM, and an error is
returned. If the input integer value is less than K1, the output is clamped to LO_LIM, and an error is
returned. The signal state of ENO is set to 0 and RET_VAL is equal to W#16#0008.
Example
If the signal state of input I0.0 is 1 (activated), the SCALE function is executed. In this example, the
integer value 22 will be converted to a real value scaled between 0.0 and 100.0 and written to OUT.
The input value is BIPOLAR, as indicated by the signal state of I2.0.
If the function is executed without error, the signal states of ENO and Q0.0 are set to 1 and RET_VAL
is set equal to W#16#0000.
SCALE
I0.0 FC105 Q0.0
EN ENO
MD30 LO_LIM
I2.0
BIPOLAR
Before execution:
IN MW10 = 22
After execution:
OUT MD40 = 50.03978588