Scale REAL data
This instruction scales a REAL value between a lower and an upper limit to a REAL output value. Use WITHIN_LIMITS to check if the input value is within the specified limits.
Input
Input signal
Lower limit of the input range
Upper limit of the input range
Output value assigned to the lower limit of the input range (can be higher than rOutputUpperLimit)
Output value assigned to the upper limit of the input range (can be lower than rOutputLowerLimit)
Output
Scaled output signal
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
rInput4: REAL:=50.0e3;
rOutput4: REAL:=0.0;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_F,SCALE_REAL!,,15,0,26,7,,?DrInput?DrInputLowerLimit?DrInputUpperLimit?DrOutputLowerLimit?DrOutputUpperLimit?C);
B(B_VARIN,,rInput4,13,1,15,3,);
B(B_VARIN,,-100.0e3,13,2,15,4,);
B(B_VARIN,,+100.0e3,13,3,15,5,);
B(B_VARIN,,0,13,4,15,6,);
B(B_VARIN,,1000.0e4,13,5,15,7,);
B(B_VAROUT,,rOutput4,26,1,28,3,);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bScale) then
rOutput4 := SCALE_REAL(rInput := rInput4t,
rInputLowerLimit := -100.0e3,
rInputUpperLimit := 100.0e3,
rOutputLowerLimit := 0,
rOutputUpperLimit := 1000.0e4);
end_if;