~~NOCACHE~~
====== LamaPLC: Simatic S7 SCL commands: Trigonometric / math functions ======
=== ABS ===
The function returns the value of the "ABS" (absolute value) math function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **ABS** (Value);
Value: function input ([[:simatic:typedef#integers|integers]], [[:simatic:typedef#fpn|floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#integers|integers]], [[:simatic:typedef#fpn|floating-point numbers]])\\
{{:simatic:abs_example.png|ABS}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete. For [[:simatic:typedef#int|INT]], the conversion overflowed.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== ABS_x ===
On the TIA portal, you can specify the type of variable used for the function by entering ABS_:[[:simatic:typedef#int|INT]],
[[:simatic:typedef#dint|DINT]],
[[:simatic:typedef#sint|SINT]],
[[:simatic:typedef#lint|LINT]],
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== COS / ACOS ====
{{anchor:cos}}
{{anchor:acos}}
The function returns the value of the "COS" (cosie) or "ACOS" (arccosine) trigonometric function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **COS** (Value); \\
[[:simatic:tia_knowhow#fc|_FC_]] Result := **ACOS** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:cos_example.png|COS}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== COS_x / ACOS_x ===
On the TIA portal, you can specify the type of variable used for the function by entering COS_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== EXP ====
The function returns the value of the "EXP" (exponent from the base e (e = 2.718282)) math function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **EXP** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:exp_example.png|EXP}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== EXP_x ===
On the TIA portal, you can specify the type of variable used for the function by entering EXP_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
PLCs:
[[de:s7:plc#1500|S7-1500]],
[[de:s7:plc#1200|S7-1200]],
[[de:s7:plc#400|S7-400]],
[[de:s7:plc#300|S7-300]]
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== FRAC ====
The function returns the value of the "FRAC" (fraction) math function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **FRAC** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:frac_example.png|FRAC}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== FRAC_x ===
On the TIA portal, you can specify the type of variable used for the function by entering FRAC_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== 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.
[[:simatic:tia_knowhow#fc|_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.
([[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|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 ([[:simatic:typedef#bool|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:
{{:simatic:limit_example_1.png|LIMIT}}
In the example below, the maximum (44) is less than the minimum (55), so the operation is invalid (ENO = FALSE):
{{:simatic:limit_example_2.png|LIMIT}}
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== LIMIT_x ===
On the TIA portal, you can specify the types of variables used for limiting by entering LIMIT_x: [[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]].
Example:
{{:simatic:limit_example_3.png|LIMIT}}
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== LN ====
The function returns the value of the "LN" (natural logarithm to the base e (e = 2.718282)) math function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **LN** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:ln_example.png|LN}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== LN_x ===
On the TIA portal, you can specify the type of variable used for the function by entering LN_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
PLCs:
[[de:s7:plc#1500|S7-1500]],
[[de:s7:plc#1200|S7-1200]],
[[de:s7:plc#400|S7-400]],
[[de:s7:plc#300|S7-300]]
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== MAX ====
Get maximum
* A minimum of two and a maximum of 32 inputs can be specified at the instruction
[[:simatic:tia_knowhow#fc|_FC_]] Result := **MAX** (IN1 := input 1, IN2 := input 2, IN3 := input 3);
input [2..32]: input values ([[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: Get maximum ([[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:max_example_1.png|MAX}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
Example of [[:simatic:typedef#dt|DT]] type:
{{:simatic:max_example_2.png|MAX}}
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== MAX_x ===
On the TIA portal, you can specify the type of variable used for the function by entering MAX_:
[[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]]
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== MIN ====
Get minimum.
* A minimum of two and a maximum of 32 inputs can be specified at the instruction
[[:simatic:tia_knowhow#fc|_FC_]] Result := **MIN** (IN1 := input 1, IN2 := input 2, IN3 := input 3);
input [2..32]: input values ([[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: Get minimum ([[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:min_example_1.png|MIN}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== MIN_x ===
On the TIA portal, you can specify the type of variable used for the function by entering MIN_:
[[:simatic:typedef#integers|Integers]], [[:simatic:typedef#s7time|S7 Times]], [[:simatic:typedef#date_type|Date types]], [[:simatic:typedef#fpn|Floating-point numbers]]
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== SIN / ASIN ====
{{anchor:sin}}
{{anchor:asin}}
The function returns the value of the "SIN" (sinus) / "ASIN" (arcsine) trigonometric function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **SIN** (Value); \\
[[:simatic:tia_knowhow#fc|_FC_]] Result := **ASIN** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:sin_example.png|SIN}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== SIN_x / ASIN_x ===
On the TIA portal, you can specify the type of variable used for the function by entering SIN_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== SQR ====
The function returns the value of the "SQR" (square) math function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **SQR** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:sqr_example.png|SQR}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== SQR_x ===
On the TIA portal, you can specify the type of variable used for the function by entering SQR_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== SQRT ====
The function returns the value of the "SQRT" (square root) math function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **SQRT** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== SQRT_x ===
On the TIA portal, you can specify the type of variable used for the function by entering SQRT_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
{{:simatic:sqrt_example.png|SQRT}}
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== TAN / ATAN ====
{{anchor:tan}}
{{anchor:atan}}
The function returns the value of the "TAN" (tangent) / "ATAN" (arctangent) trigonometric function.
[[:simatic:tia_knowhow#fc|_FC_]] Result := **TAN** (Value); \\
[[:simatic:tia_knowhow#fc|_FC_]] Result := **ATAN** (Value);
Value: function input ([[:simatic:typedef#fpn|Floating-point numbers]])\\
Result: the return value of the function ([[:simatic:typedef#fpn|Floating-point numbers]])\\
{{:simatic:tan_example.png|TAN}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
=== TAN_x / ATAN_x ===
On the TIA portal, you can specify the type of variable used for the function by entering TAN_ / ATAN_:
[[:simatic:typedef#real|REAL]],
[[:simatic:typedef#lreal|LREAL]].
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== 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 \\
{{:simatic:exp_example.png|EXP}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== 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 \\
{{:simatic:cos_example.png|COS}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== 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 \\
{{:simatic:sin_example.png|SIN}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
[[simatic:scl_commands|>> Back to LamaPLC main menu (SCL commands)]]
==== 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 \\
{{:simatic:tan_example.png|TAN}}
A yellow underline in the code indicates that the result of the function is not completely accurate for [[:simatic:typedef#real|REAL]] and [[:simatic:typedef#int|INT]] types. For [[:simatic:typedef#lreal|LREAL]] type, precision is complete.
\\
\\
{{tag>Simatic SCL TIA Math ABS COS/ACOS ACOS EXP FRAC LIMIT LN MAX MIN SIN ASIN SQR SQRT TAN ATAN}}
\\
This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}