0% found this document useful (0 votes)
11 views2 pages

Scaling Values FC105

Uploaded by

Apply Softtech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Scaling Values FC105

Uploaded by

Apply Softtech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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

Parameter Declaration Data type Memory area Description


EN Input BOOL I,Q,M,D,L Enable input with signal state
of 1 activates the box.
ENO Output BOOL I,Q,M,D,L Enable output has a signal
state of 1 if the function is
executed without error.
IN Input INT I,Q,M,D,L,P, The input value to be scaled
Constant to a real value in engineering
units.
HI_LIM Input REAL I,Q,M,D,L,P, Upper limit in engineering
Constant units.
LO_LIM Input REAL I,Q,M,D,L,P, Lower limit in engineering
Constant units.
BIPOLAR Input BOOL I,Q,M,D,L A signal state of 1 indicates
that the input value is bipolar.
A signal state of 0 indicates
that the input value is unipolar.
OUT Output REAL I,Q,M,D,L,P Result of the scale conversion.
RET_VAL Output WORD I,Q,M,D,L,P Returns a value of
W#16#0000 if the instruction
executes without error. See
Error Information for values
other than W#16#0000.

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

MW10 IN RET_VAL MW0

MD20 HI_LIM OUT MD40

MD30 LO_LIM
I2.0
BIPOLAR

Before execution:
IN MW10 = 22

HI_LIM MD20 = 100.0

LO_LIM MD30 = 0.0

OUT MD40 = 0.0

BIPOLAR I2.0 = TRUE

After execution:
OUT MD40 = 50.03978588

You might also like