~~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 ([[:automation:s7_var#integers|integers]], [[:automation:s7_var#fpn|floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#integers|integers]], [[:automation:s7_var#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 [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, precision is complete. For [[:automation:s7_var#int|INT]], the conversion overflowed. [[automation:s7_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_:[[:automation:s7_var#int|INT]], [[:automation:s7_var#dint|DINT]], [[:automation:s7_var#sint|SINT]], [[:automation:s7_var#lint|LINT]], [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== COS / ACOS ==== {{anchor:cos}} {{anchor:acos}} The function returns the value of the "COS" (cosine) or "ACOS" (arccosine) trigonometric function. [[:simatic:tia_knowhow#fc|_FC_]] Result := **COS** (Value); \\ [[:simatic:tia_knowhow#fc|_FC_]] Result := **ACOS** (Value); Value: function input ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#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 [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, precision is complete. [[automation:s7_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_: [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. [[automation:s7_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 ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:exp_example.png|EXP}} A yellow underline in the code indicates that the function's result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_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_: [[:automation:s7_var#real|REAL]], [[:automation:s7_var#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]] [[automation:s7_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 ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:frac_example.png|FRAC}} A yellow underline in the code indicates that the function's result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_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_: [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== LIMIT ==== The //"Set limit value"// instruction restricts the value of the parameter IN to the range specified by the parameters MN and MX. The value of MN must not be greater than the value of 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. ([[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#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 ([[:automation:s7_var#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}} [[automation:s7_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: [[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]]. Example: {{:simatic:limit_example_3.png|LIMIT}} [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== LN ==== The function returns the value of the //"LN"// (natural logarithm to the base e, where e = 2.718282) math function. [[:simatic:tia_knowhow#fc|_FC_]] Result := **LN** (Value); Value: function input ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:ln_example.png|LN}} A yellow underline in the code shows that the function's result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] === LN_x === On the TIA portal, you can specify the variable type used for the function by entering LN_. [[:automation:s7_var#real|REAL]], [[:automation:s7_var#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]] [[automation:s7_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 ([[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: Get maximum ([[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:max_example_1.png|MAX}} A yellow underline in the code indicates that the function's result is not entirely accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the accuracy is complete. Example of [[:automation:s7_var#dt|DT]] type: {{:simatic:max_example_2.png|MAX}} [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] === MAX_x === On the TIA portal, you can specify the variable type for the function by entering MAX_: [[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]] [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== MIN ==== Get the 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 ([[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: Get minimum ([[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:min_example_1.png|MIN}} A yellow underline in the code shows that the result is not entirely accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] === MIN_x === On the TIA portal, you can specify the variable type used for the function by entering MIN_. [[:automation:s7_var#integers|Integers]], [[:automation:s7_var#s7time|S7 Times]], [[:automation:s7_var#date_type|Date types]], [[:automation:s7_var#fpn|Floating-point numbers]] [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== SIN / ASIN ==== {{anchor:sin}} {{anchor:asin}} The function returns the value of the "SIN" (sine) / "ASIN" (arcsine) trigonometric functions. [[:simatic:tia_knowhow#fc|_FC_]] Result := **SIN** (Value); \\ [[:simatic:tia_knowhow#fc|_FC_]] Result := **ASIN** (Value); Value: function input ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:sin_example.png|SIN}} A yellow underline in the code indicates that the result for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types may not be entirely accurate. For [[:automation:s7_var#lreal|LREAL]] type, accuracy is complete. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] === SIN_x / ASIN_x === On the TIA portal, you can specify the variable type used for the function by entering SIN_. [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. [[automation:s7_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 ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:sqr_example.png|SQR}} A yellow underline in the code shows that the function's result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_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_: [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. [[automation:s7_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 ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ A yellow underline in the code shows that the result for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types is not entirely accurate. For [[:automation:s7_var#lreal|LREAL]] type, accuracy is complete. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] === SQRT_x === On the TIA portal, you can specify the variable type for the function by entering SQRT_. [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. {{:simatic:sqrt_example.png|SQRT}} [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== TAN / ATAN ==== {{anchor:tan}} {{anchor:atan}} The function returns the value of the "TAN" (tangent) or "ATAN" (arctangent) trigonometric function. [[:simatic:tia_knowhow#fc|_FC_]] Result := **TAN** (Value); \\ [[:simatic:tia_knowhow#fc|_FC_]] Result := **ATAN** (Value); Value: function input ([[:automation:s7_var#fpn|Floating-point numbers]])\\ Result: the return value of the function ([[:automation:s7_var#fpn|Floating-point numbers]])\\ {{:simatic:tan_example.png|TAN}} A yellow underline in the code shows that the function's result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] {{page>automation:tarhal}} === TAN_x / ATAN_x === On the TIA portal, you can specify the type of variable used for the function by entering TAN_ / ATAN_. [[:automation:s7_var#real|REAL]], [[:automation:s7_var#lreal|LREAL]]. [[automation:s7_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 shows that the function's result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_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 may not be fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, precision is complete. [[automation:s7_scl_commands|>> Back to LamaPLC main menu (SCL commands)]] ==== SIN ==== The function returns the value of the "SIN" (sine) 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 fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. [[automation:s7_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 shows that the result is not fully accurate for [[:automation:s7_var#real|REAL]] and [[:automation:s7_var#int|INT]] types. For [[:automation:s7_var#lreal|LREAL]] type, the precision is complete. \\ {{page>automation:s7_idx}} \\ {{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}}