de:s7:scl_reference_math

Simatic S7 SCL reference: math

Back to reference overview: Simatic S7 SCL reference with examples

The function returns the value of the ABS (absolute value) math function.

See: trigonometric / math functions

_FC_ Result := ABS (Value);

Value: function input (integers, floating-point numbers)
Result: the return value of the function (integers, floating-point numbers)

ABS

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.

On the TIA portal, you can specify the type of variable used for the function by entering ABS_:INT, DINT, SINT, LINT, REAL, LREAL.

The function returns the value of the COS (cosie) or ACOS (arccosine) trigonometric function.

See: trigonometric / math functions

_FC_ Result := COS (Value);
_FC_ Result := ACOS (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

COS

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.

On the TIA portal, you can specify the type of variable used for the function by entering COS_: REAL, LREAL.

The function returns the value of the EXP (exponent from the base e (e = 2.718282)) math function.

See: trigonometric / math functions

_FC_ Result := EXP (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

EXP

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.

On the TIA portal, you can specify the type of variable used for the function by entering EXP_: REAL, LREAL.

PLCs: S7-1500, S7-1200, S7-400, S7-300

The function returns the value of the FRAC (fraction) math function.

See: trigonometric / math functions

_FC_ Result := FRAC (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

FRAC

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.

On the TIA portal, you can specify the type of variable used for the function by entering FRAC_: REAL, LREAL.

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.

See: trigonometric / math functions

_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:

LIMIT

In the example below, the maximum (44) is less than the minimum (55), so the operation is invalid (ENO = FALSE):

LIMIT

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:

LIMIT

The function returns the value of the LN (natural logarithm to the base e (e = 2.718282)) math function.

See: trigonometric / math functions

_FC_ Result := LN (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

LN

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.

On the TIA portal, you can specify the type of variable used for the function by entering LN_: REAL, LREAL.

PLCs: S7-1500, S7-1200, S7-400, S7-300

Get maximum

See: trigonometric / math functions

  • 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)

MAX

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

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

Get minimum.

See: trigonometric / math functions

  • 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)

MIN

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.

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

The function returns the value of the SIN (sinus) / ASIN (arcsine) trigonometric function.

See: trigonometric / math functions

_FC_ Result := SIN (Value);
_FC_ Result := ASIN (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

SIN

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.

On the TIA portal, you can specify the type of variable used for the function by entering SIN_: REAL, LREAL.

The function returns the value of the SQR (square) math function.

See: trigonometric / math functions

_FC_ Result := SQR (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

SQR

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.

On the TIA portal, you can specify the type of variable used for the function by entering SQR_: REAL, LREAL.

The function returns the value of the SQRT (square root) math function.

See: trigonometric / math functions

_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.

On the TIA portal, you can specify the type of variable used for the function by entering SQRT_: REAL, LREAL.

SQRT

The function returns the value of the TAN (tangent) / ATAN (arctangent) trigonometric function.

See: trigonometric / math functions

_FC_ Result := TAN (Value);
_FC_ Result := ATAN (Value);

Value: function input (Floating-point numbers)
Result: the return value of the function (Floating-point numbers)

TAN

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.

On the TIA portal, you can specify the type of variable used for the function by entering TAN_ / ATAN_: REAL, LREAL.

Post views: 496

Donate

2022/04/21 15:01
  • de/s7/scl_reference_math.txt
  • 2022/04/21 15:01
  • ()