User Manual

Programming made easy
6.3 Powerful instructions make programming easy
Easy Book
Manual, 03/2014, A5E02486774-AF
103
Table 6- 6 SCALE_X and NORM_X instructions
LAD / FBD
SCL
Description
out := SCALE_X(
min,:=_undef_in_
value:=_real_in_,
max:=undef_in_);
Scales the normalized real parameter VALUE where ( 0.0
<= VALUE <= 1.0 ) in the data type and value range
specified by the MIN and MAX parameters:
OUT = VALUE (MAX - MIN) + MIN
out := NORM_X(
min:=_,undef_in_
value:=_undef_in_,
max:=_undef_in_);
Normalizes the parameter VALUE inside the value range
specified by the MIN and MAX parameters:
OUT = (VALUE - MIN) / (MAX - MIN),
where ( 0.0 <= OUT <= 1.0 )
1
Equivalent SCL: out := value (max-min) + min;
2
Equivalent SCL: out := (value-min)/(max-min);
6.3.4
Math made easy with the Calculate instruction
Table 6- 7 CALCULATE instruction
LAD / FBD
SCL
Description
Use the
standard SCL
math
expressions to
create the
equation.
The CALCULATE instruction lets you create a math function that
operates on inputs (IN1, IN2, .. INn) and produces the result at OUT,
according to the equation that you define.
Select a data type first. All inputs and the output must be the same
data type.
To add another input, click the icon at the last input.
Table 6- 8 Data types for the parameters
Parameter
Data type
1
IN1, IN2, ..INn
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Byte, Word, DWord
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Byte, Word, DWord
1
The IN and OUT parameters must be the same data type (with implicit conversions of the input parameters). For
example: A SINT value for an input would be converted to an INT or a REAL value if OUT is an INT or REAL
Click the calculator icon to open the dialog and define your math function. You enter your
equation as inputs (such as IN1 and IN2) and operations. When you click "OK" to save the
function, the dialog automatically creates the inputs for the CALCULATE instruction.
An example and a list of possible math operations you can include is shown at the bottom of
the editor.