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)

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.

>> 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_:INT, DINT, SINT, LINT, REAL, LREAL.

>> Back to LamaPLC main menu (SCL commands)

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)

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.

>> 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_: REAL, LREAL.

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

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

>> 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_: REAL, LREAL.

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

>> Back to LamaPLC main menu (SCL commands)

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)

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.

>> 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_: REAL, LREAL.

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

_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

>> 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: Integers, S7 Times, Date types, Floating-point numbers.

Example:

LIMIT

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

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

>> 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_: REAL, LREAL.

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

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

_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

>> 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_: Integers, S7 Times, Date types, Floating-point numbers

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

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

>> 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_: Integers, S7 Times, Date types, Floating-point numbers

>> Back to LamaPLC main menu (SCL commands)

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)

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.

>> 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_: REAL, LREAL.

>> Back to LamaPLC main menu (SCL commands)

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)

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.

>> 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_: REAL, LREAL.

>> Back to LamaPLC main menu (SCL commands)

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.

>> 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_: REAL, LREAL.

SQRT

>> Back to LamaPLC main menu (SCL commands)

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)

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.

>> 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_: REAL, LREAL.

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

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.

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

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.

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

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.

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

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.


This page has been accessed for: Today: 1, Until now: 152