meta data for this page
LamaPLC: Simatic S7 SCL commands: Trigonometric / math functions
ABS
The function returns the value of the “ABS” (absolute value) math function.
_FC_ Result := ABS (Value);
Value: function input (integers, floating-point numbers)
Result: the return value of the function (integers, floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete. For INT, the conversion overflowed.
ABS_x
On the TIA portal, you can specify the type of variable used for the function by entering ABS_:INT, DINT, SINT, LINT, REAL, LREAL.
COS / ACOS
The function returns the value of the “COS” (cosie) or “ACOS” (arccosine) trigonometric function.
_FC_ Result := COS (Value);
_FC_ Result := ACOS (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
COS_x / ACOS_x
On the TIA portal, you can specify the type of variable used for the function by entering COS_: REAL, LREAL.
EXP
The function returns the value of the “EXP” (exponent from the base e (e = 2.718282)) math function.
_FC_ Result := EXP (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
EXP_x
On the TIA portal, you can specify the type of variable used for the function by entering EXP_: REAL, LREAL.
FRAC
The function returns the value of the “FRAC” (fraction) math function.
_FC_ Result := FRAC (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
FRAC_x
On the TIA portal, you can specify the type of variable used for the function by entering FRAC_: REAL, LREAL.
LIMIT
The “Set limit value” instruction limits the value of the parameter IN to the values of the parameters MN and MX. The value of the parameter MN may not be greater than the value of the parameter MX.
_FC_ Result := LIMIT (MN := minimum, IN := input, MAX := maximum, ENO ⇒ operation enable );
MN, IN, MX, Result: If the value of the IN parameter fulfills the condition MN ⇐ IN ⇐ MX, it is returned as the result of the instruction. If the condition is not fulfilled and the IN input value is less than the MN low limit, the value of the MN parameter is returned as the result. If the high limit MX is exceeded, the value of the MX parameter is returned as the result.
(Integers, S7 Times, Date types, Floating-point numbers)
ENO: If the value at the MN input is greater than at the MX input, the result is the value specified at the IN parameter and the enable output ENO (BOOL) is “FALSE” (see 2nd example).
In the example below, the input (66) is greater than the maximum (44), so the result is the maximum:
In the example below, the maximum (44) is less than the minimum (55), so the operation is invalid (ENO = FALSE):
LIMIT_x
On the TIA portal, you can specify the types of variables used for limiting by entering LIMIT_x: Integers, S7 Times, Date types, Floating-point numbers.
Example:
LN
The function returns the value of the “LN” (natural logarithm to the base e (e = 2.718282)) math function.
_FC_ Result := LN (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
LN_x
On the TIA portal, you can specify the type of variable used for the function by entering LN_: REAL, LREAL.
MAX
Get maximum
- A minimum of two and a maximum of 32 inputs can be specified at the instruction
_FC_ Result := MAX (IN1 := input 1, IN2 := input 2, IN3 := input 3);
input [2..32]: input values (Integers, S7 Times, Date types, Floating-point numbers)
Result: Get maximum (Integers, S7 Times, Date types, Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
Example of DT type:
MAX_x
On the TIA portal, you can specify the type of variable used for the function by entering MAX_: Integers, S7 Times, Date types, Floating-point numbers
MIN
Get minimum.
- A minimum of two and a maximum of 32 inputs can be specified at the instruction
_FC_ Result := MIN (IN1 := input 1, IN2 := input 2, IN3 := input 3);
input [2..32]: input values (Integers, S7 Times, Date types, Floating-point numbers)
Result: Get minimum (Integers, S7 Times, Date types, Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
MIN_x
On the TIA portal, you can specify the type of variable used for the function by entering MIN_: Integers, S7 Times, Date types, Floating-point numbers
SIN / ASIN
The function returns the value of the “SIN” (sinus) / “ASIN” (arcsine) trigonometric function.
_FC_ Result := SIN (Value);
_FC_ Result := ASIN (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
SIN_x / ASIN_x
On the TIA portal, you can specify the type of variable used for the function by entering SIN_: REAL, LREAL.
SQR
The function returns the value of the “SQR” (square) math function.
_FC_ Result := SQR (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
SQR_x
On the TIA portal, you can specify the type of variable used for the function by entering SQR_: REAL, LREAL.
SQRT
The function returns the value of the “SQRT” (square root) math function.
_FC_ Result := SQRT (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
SQRT_x
On the TIA portal, you can specify the type of variable used for the function by entering SQRT_: REAL, LREAL.
TAN / ATAN
The function returns the value of the “TAN” (tangent) / “ATAN” (arctangent) trigonometric function.
_FC_ Result := TAN (Value);
_FC_ Result := ATAN (Value);
Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
TAN_x / ATAN_x
On the TIA portal, you can specify the type of variable used for the function by entering TAN_ / ATAN_: REAL, LREAL.
EXP
The function returns the value of the “EXP” (exponent from the base e (e = 2.718282)) math function.
Result := EXP(Value);
Result: the return value of the function
Value: function input
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
COS
The function returns the value of the “COS” (cosinus) trigonometric function.
Result := COS(Value);
Result: the return value of the function
Value: function input
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
SIN
The function returns the value of the “SIN” (sinus) trigonometric function.
Result := SIN(Value);
Result: the return value of the function
Value: function input
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
TAN
The function returns the value of the “TAN” (tangent) trigonometric function.
Result := TAN(Value);
Result: the return value of the function
Value: function input
A yellow underline in the code indicates that the result of the function is not completely accurate for REAL and INT types. For LREAL type, precision is complete.
This page has been accessed for: Today: 1, Until now: 152