Vai al contenuto

IEC 61131-3 Standard Functions

This paragraph is a reference of all IEC 61131-3 standard functions available in GF_ProjectVX code, along with a few others, which may be considered as GF_ProjectVX code’s extensions to the standard.These functions are common to the whole set of programming languages and can therefore be used in any Programmable Organization Unit (POU).A function specified in this paragraph to be extensible (Ext.) is allowed to have a variable number of inputs.Type Conversion FunctionsAccording to the IEC 61131-3 standard, type conversion functions shall have the form *_TO_**, where “*” is the type of the input variable, and “**” the type of the output variable (for example, INT_TO_REAL). GF_ProjectVX code provides a more convenient set of overloaded type conversion functions, relieving the developer to specify the input variable type.
TO_BOOLTO_BOOL
DescriptionConversion to BOOL (Boolean)
Number of operands1
Input data typeAny numerical type
Output data typeBOOL
Examplesout := TO_BOOL( 0 ); (* out = FALSE *)out := TO_BOOL( 1 ); (* out = TRUE *)out := TO_BOOL( 1000 ); (* out = TRUE *)
TO_BYTETO_BYTE
DescriptionConversion to BYTE (8-bit string)
Number of operands1
Input data typeAny numerical type or STRING
Output data typeBYTE
Examplesout := TO_BYTE( -1 ); (* out = 16#FF *)out := TO_BYTE( 16#100 ); (* out = 16#00 *)
TO_DATETO_DATE
DescriptionConversion to DATE (32-bit signed integer)
Number of operands1
Input data typeDATE_AND_TIME, LDATE_AND_TIME, LDATE
Output data typeDATE
Examples
TO_DATE_AND_TIMETO_DATE_AND_TIME
DescriptionConversion to DATE_AND_TIME (32-bit signed integer)
Number of operands1
Input data typeLDATE_AND_TIME
Output data typeDATE_AND_TIME
Examples
TO_DINTTO_DINT
DescriptionConversion to DINT (32-bit signed integer)
Number of operands1
Input data typeAny numerical type
Output data typeDINT
Examplesout := TO_DINT( 10.0 ); (* out = 10 *)out := TO_DINT( 16#FFFFFFFF ); (* out = -1 *)
TO_DWORDTO_DWORD
DescriptionConversion to DWORD (32-bit string)
Number of operands1
Input data typeAny numerical type
Output data typeDWORD
Examplesout := TO_DWORD( 10.0 ); (* out = 16#0000000A *)out := TO_DWORD( -1 ); (* out = 16#FFFFFFFF *)
TO_INTTO_INTTO_INT
DescriptionConversion to INT (16-bit signed integer)
Number of operands1
Input data typeAny numerical type
Output data typeINT
Examplesout := TO_INT( -1000.0 ); (* out = -1000 *)out := TO_INT( 16#8000 ); (* out = -32768 *)
TO_LDATETO_LDATE
DescriptionConversion to LDATE (64-bit signed integer)
Number of operands1
Input data typeDATE_AND_TIME, LDATE_AND_TIME, DATE
Output data typeLDATE
Examples
TO_LDATE_AND_TIMETO_LDATE_AND_TIME
DescriptionConversion to LDATE_AND_TIME (64-bit signed integer)
Number of operands1
Input data typeDATE_AND_TIME
Output data typeLDATE_AND_TIME
Examples
TO_LINTTO_LINTTO_LINT
DescriptionConversion to LINT (64-bit signed integer)
Number of operands1
Input data typeAny numerical type or STRING
Output data typeLINT
Examplesout := TO_LINT( -1 ); (* out = -1 *)out := TO_LINT(16#FFFFFFFFFFFFFFFF); (* out = -1 *)
TO_LREALTO_LREALTO_LREAL
DescriptionConversion to LREAL (64-bit floating point)
Number of operands1
Input data typeAny numerical type or STRING
Output data typeLREAL
Examplesout := TO_LREAL( -1000 ); (* out = -1000.0 *)out := TO_LREAL( 16#8000 ); (* out = -32768.0 *)
TO_LTIMETO_LTIME
DescriptionConversion to LTIME (64-bit signed integer)
Number of operands1
Input data typeTIME
Output data typeLTIME
Examples
TO_LTIME_OF_DAYTO_LTIME_OF_DAY
DescriptionConversion to LTIME (64-bit signed integer)
Number of operands1
Input data typeTIME_OF_DAY, DATE_AND_TIME, LDATE_AND_TIME
Output data typeLTIME_OF_DAY
Examples
TO_LWORDTO_LWORD
DescriptionConversion to LWORD (64-bit unsigned integer)
Number of operands1
Input data typeAny numerical type or STRING
Output data typeLWORD
Examplesout := TO_LWORD( 10.0 ); (* out =16#000000000000000A *)out := TO_LWORD( -1 ); (* out = 16#FFFFFFFFFFFFFFFF*)
TO_POINTERTO_POINTER
DescriptionConversion to pointer
Number of operands1
Input data typeAny numerical type or STRING
Output data typeUNDEFINED
Examplesout := TO_POINTER( example_var );
TO_REALTO_REAL
DescriptionConversion to REAL (32-bit floating point)
Number of operands1
Input data typeAny numerical type
Output data typeREAL
Examplesout := TO_REAL( -1000 ); (* out = -1000.0 *)out := TO_REAL( 16#8000 ); (* out = -32768.0 *)
TO_SINTTO_SINT
DescriptionConversion to SINT (8-bit signed integer)
Number of operands1
Input data typeAny numerical type
Output data typeSINT
Examplesout := TO_SINT( -1 ); (* out = -1 *)out := TO_SINT( 16#100 ); (* out = 0 *)
TO_STRINGTO_STRING
DescriptionConversion to STRING
Number of operands1
Input data typeAny numerical type
Output data typeSTRING
Examplesstr := TO_STRING( 10.0 ); (* str = ‘10,0’ *)str := TO_STRING( -1 ); (* str = ‘-1’ *)
TO_TIMETO_TIME
DescriptionConversion to LTIME (32-bit signed integer)
Number of operands1
Input data typeLTIME
Output data typeTIME
Examples
TO_TIME_OF_DAYTO_TIME_OF_DAY
DescriptionConversion to TIME_OF_DAY (32-bit signed integer)
Number of operands1
Input data typeLTIME_OF_DAY, DATE_AND_TIME, LDATE_AND_TIME
Output data typeTIME_OF_DAY
Examples
TO_UDINTTO_UDINT
DescriptionConversion to UDINT (32-bit unsigned integer)
Number of operands1
Input data typeAny numerical type
Output data typeUDINT
Examplesout := TO_UDINT( 10.0 ); (* out = 10 *)out := TO_UDINT( 16#FFFFFFFF ); (* out = 4294967295 *)
TO_UINTTO_UINT
DescriptionConversion to UINT (16-bit unsigned integer)
Number of operands1
Input data typeAny numerical type
Output data typeUINT
Examplesout := TO_UINT( 1000.0 ); (* out = 1000 *)out := TO_UINT( 16#8000 ); (* out = 32768 *)
TO_ULINTTO_ULINT
DescriptionConversion to ULINT (64-bit unsigned integer)
Number of operands1
Input data typeAny numerical type or STRING
Output data typeULINT
Examplesout := TO_ULINT( 10.0 ); (* out = 10 *)out := TO_ULINT( 16#FFFFFFFFFFFFFFFF ); (* out = 18446744073709551615 *)
TO_USINTTO_USINT
DescriptionConversion to USINT (8-bit unsigned integer)
Number of operands1
Input data typeAny numerical type
Output data typeUSINT
Examplesout := TO_USINT( -1 ); (* out = 255 *)out := TO_USINT( 16#100 ); (* out = 0 *)
TO_WORDTO_WORD
DescriptionConversion to WORD (16-bit unsigned integer)
Number of operands1
Input data typeAny numerical type or STRING
Output data typeWORD
Examplesout := TO_WORD( 1000.0 ); (* out = 16#03E8 *)out := TO_WORD( -32768 ); (* out = 16#8000 *)
TO_WSTRINGTO_WSTRING
DescriptionConversion to WSTRING
Number of operands1
Input data typeAny numerical type
Output data typeWSTRING
Exampleswstr := TO_STRING( 10.0 ); (* wstr = “10,0” *)wstr := TO_STRING( -1 ); (* wstr = “-1” *)
Numerical FunctionsThe availability of the following functions depends on the target device. Please refer to your hardware supplier for details.
ABSABS
DescriptionAbsolute value. Computes the absolute value of input #0
Number of operands1
Input data typeAny numerical type
Output data typeSame as input
ExamplesOUT := ABS( -5 );(* OUT = 5 *)OUT := ABS( -1.618 );(* OUT = 1.618 *)OUT := ABS( 3.141592 );(* OUT = 3.141592 *)
ACOSACOS
DescriptionArc cosine. Computes the principal arc cosine of input #0; result is expressed in radians
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := ACOS( 1.0 ); (* OUT = 0.0 *)OUT := ACOS( -1.0 ); (* OUT = PI *)
ADDADD
DescriptionArithmetic addition. Computes the sum of the two inputs.
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Inputs
ExamplesOUT := ADD( 20, 40 ); (* OUT = 60 *)
ASINASIN
DescriptionArc sine. Computes the principal arc sine of input #0; result is expressed in radians
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := ASIN( 0.0 ); (* OUT = 0.0 *)OUT := ASIN( 1.0 ); (* OUT = PI / 2 *)
ATANATAN
DescriptionArc tangent. Computes the principal arc tangent of input #0; result is expressed in radians
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := ATAN( 0.0 ); (* OUT = 0.0 *)OUT := ATAN( 1.0 ); (* OUT = PI / 4 *)
ATAN2*ATAN2*
DescriptionArc tangent (with 2 parameters). Computes the principal arc tangent of Y/X; result is expressed in radians
Number of operands2
Input data typeLREAL where available, REAL otherwise;LREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := ATAN2( 0.0, 1.0 ); (* OUT = 0.0 *)OUT := ATAN2( 1.0, 1.0 ); (* OUT = PI / 4 *)OUT := ATAN2( -1.0, -1.0 ); (* OUT = ( -3/4 ) * PI *)OUT := ATAN2( 1.0, 0.0 ); (* OUT = PI / 2 *)
CEIL*CEIL*
DescriptionRounding up to integer. Returns the smallest integer that is greater than or equal to input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := CEIL( 1.95 ); (* OUT = 2.0 *)OUT := CEIL( -1.27 ); (* OUT = -1.0 *)
COSCOS
DescriptionCosine. Computes the cosine function of input #0 expressed in radians
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := COS( 0.0 ); (* OUT = 1.0 *)OUT := COS( -3.141592 ); (* OUT ~ -1.0 *)
COSH*COSH*
DescriptionHyperbolic cosine. Computes the hyperbolic cosine function of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := COSH( 0.0 ); (* OUT = 1.0 *)
DIVDIV
DescriptionArithmetic division. Divides input #0 by input #1
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Inputs
ExamplesOUT := DIV( 20, 2 ); (* OUT = 10 *)
EXPEXP
DescriptionNatural exponential. Computes the exponential function of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := EXP( 1.0 ); (* OUT ~ 2.718281 *)
FLOOR*FLOOR*
DescriptionRounding down to integer. Returns the largest integer that is less than or equal to input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := FLOOR( 1.95 ); (* OUT = 1.0 *)OUT := FLOOR( -1.27 ); (* OUT = -2.0 *)
LNLN
DescriptionNatural logarithm. Computes the logarithm with base e of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := LN( 2.718281 ); (* OUT = 1.0 *)
LOGLOG
DescriptionLogarithm. Computes the logarithm with base 10 of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := LOG( 100.0 );(* OUT = 2.0 *)
MODMOD
DescriptionModule. Computes input #0 module input #1
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Inputs
ExamplesOUT := MOD( 10, 3 ); (* OUT = 1 *)
MULMUL
DescriptionArithmetic multiplication. Multiplies the two inputs.
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Inputs
ExamplesOUT := MUL( 10, 10 ); (* OUT = 100 *)
POWPOW
DescriptionExponentiation. Raises Base to the power Expo
Number of operands2
Input data typeLREAL where available, REAL otherwiseLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := POW( 2.0, 3.0 ); (* OUT = 8.0 *)OUT := POW( -1.0, 5.0 ); (* OUT = -1.0 *)
SINSIN
DescriptionSine. Computes the sine function of input #0 expressed in radians
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := SIN( 0.0 ); (* OUT = 0.0 *)OUT := SIN( 2.5 * 3.141592 ); (* OUT ~ 1.0 *)
SINH*SINH*
DescriptionHyperbolic sine. Computes the hyperbolic sine function of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := SINH( 0.0 ); (* OUT = 0.0 *)
SQRTSQRT
DescriptionSquare root. Computes the square root of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := SQRT( 4.0 ); (* OUT = 2.0 *)
SUBSUB
DescriptionArithmetic subtraction. Subtracts input #1 from input #0
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Inputs
ExamplesOUT := SUB( 10, 3 ); (* OUT = 7 *)
TANTAN
DescriptionTangent. Computes the tangent function of input #0 expressed in radians
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := TAN( 0.0 ); (* OUT = 0.0 *)OUT := TAN( 3.141592 / 4.0 ); (* OUT ~ 1.0 *)
TANH*TANH*
DescriptionHyperbolic tangent. Computes the hyperbolic tangent function of input #0
Number of operands1
Input data typeLREAL where available, REAL otherwise
Output data typeLREAL where available, REAL otherwise
ExamplesOUT := TANH( 0.0 ); (* OUT = 0.0 *)
*: function provided as extension to the IEC 61131-3 standard.Bit String Functions
ANDAND
DescriptionLogical AND if both Input #0 and Input #1 are BOOL, otherwise bitwise AND.
Number of operands2
Input data typeAny but STRING, Any but STRING
Output data typeSame as Inputs
ExamplesOUT := TRUE AND FALSE; (* OUT = FALSE *)OUT := 16#1234 AND 16#5678; (* OUT = 16#1230 *)
NOTNOT
DescriptionLogical NOT if Input is BOOL, otherwise bitwise NOT.
Number of operands1
Input data typeAny but STRING
Output data typeSame as Inputs
ExamplesOUT := NOT FALSE; (* OUT = TRUE *)OUT := NOT 16#1234;(* OUT = 16#EDCB *)
OROR
DescriptionLogical OR if both Input #0 and Input #1 are BOOL, otherwise bitwise OR.
Number of operands2
Input data typeAny but STRING, Any but STRING
Output data typeSame as Inputs
ExamplesOUT := TRUE OR FALSE; (* OUT = FALSE *)OUT := 16#1234 OR 16#5678;(* OUT = 16#567C *)
RR
DescriptionReset operator: reset input to 0
Number of operands1
Input data typeBOOL
Output data typeSame as Inputs #0
Examples
ROLROL
DescriptionInput #0 left-shifted of Input #1 bits, circular.
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Input #0
ExamplesOUT := ROL( IN := 16#1000CAFE, 4 );(* OUT = 16#000CAFE1 *)
RORROR
DescriptionInput #0 right-shifted of Input #1 bits, circular.
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Input #0
ExamplesOUT := ROR( IN := 16#1000CAFE, 16 );(* OUT = 16#CAFE1000 *)
SS
DescriptionSet operator: set input to 1
Number of operands1
Input data typeBOOL
Output data typeSame as Inputs #0
Examples
SHLSHL
DescriptionInput#0 left-shifted of Input #1 bits, zero filled on the right.
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Input #0
ExamplesOUT := SHL( IN := 16#1000CAFE, 16 );(* OUT = 16#CAFE0000 *)
SHRSHR
DescriptionInput #0 right-shifted of Input #1 bits, zero filled on the left.
Number of operands2
Input data typeAny numerical type, Any numerical type
Output data typeSame as Input #0
ExamplesOUT := SHR( IN := 16#1000CAFE, 24 );(* OUT = 16#00000010 *)
XORXOR
DescriptionLogical XOR if both Input #0 and Input #1 are BOOL, otherwise bitwise XOR.
Number of operands2
Input data typeAny but STRING, Any but STRING
Output data typeSame as Inputs
ExamplesOUT := TRUE OR FALSE; (* OUT = TRUE *)OUT := 16#1234 OR 16#5678; (* OUT = 16#444C *)
Selection Functions
LIMITLIMIT
DescriptionLimits Input #0 to be equal or more than Input#1, and equal or less than Input #2.
Number of operands3
Input data typeAny numerical type, Any numerical type, Any numerical type
Output data typeSame as Inputs
ExamplesOUT := LIMIT( IN := 4, MN := 0, MX := 5 ); (* OUT = 4 *) OUT := LIMIT( IN := 88, MN := 0, MX := 5 );(* OUT = 5 *)OUT := LIMIT( IN := -1, MN := 0, MX := 5 );(* OUT = 0 *)
MAXMAX
DescriptionMaximum value selection
Number of operands2, extensible
Input data typeAny numerical type, Any numerical type, …, Any numerical type
Output data typeSame as max Input
ExamplesOUT := MAX( -8, 120, -1000 ); (* OUT = 120 *)
MINMIN
DescriptionMinimum value selection
Number of operands2, extensible
Input data typeAny numerical type, Any numerical type, …, Any numerical type
Output data typeSame as min Input
ExamplesOUT := MIN( -8, 120, -1000 ); (* OUT = -1000 *)
MUXMUX
DescriptionMultiplexer. Selects one of N inputs depending on input K
Number of operands3, extensible
Input data typeAny numerical type, Any numerical type, …, Any numerical type
Output data typeSame as selected Input
ExamplesOUT := MUX( 0, A, B, C ); (* OUT = A *)
SELSEL
DescriptionBinary selection
Number of operands3
Input data typeBOOL, Any, Any
Output data typeSame as selected Input
ExamplesOUT := SEL( G := FALSE, IN0 := X, IN1 := 5 );(* OUT = X *)
Comparison FunctionsComparison functions can be also used to compare strings if this feature is supported by target device.
EQEQ
DescriptionEqual to. Returns TRUE if Input #0 = Input #1, otherwise FALSE.
Number of operands2
Input data typeAny, Any
Output data typeBOOL
ExamplesOUT := EQ( TRUE, FALSE ); (* OUT = FALSE *)OUT := EQ( ‘goofy’, ‘pluto’ ); (* OUT = FALSE *)
GEGE
DescriptionGreater than or equal to. Returns TRUE if Input #0 >= Input #1, otherwise FALSE.
Number of operands2
Input data typeAny but BOOL, Any but BOOL
Output data typeBOOL
ExamplesOUT := GE( 20, 20 ); (* OUT = TRUE *)OUT := GE( ‘goofy’, ‘pluto’ ); (* OUT = FALSE *)
GTGT
DescriptionGreater than. Returns TRUE if Input #0 > Input #1, otherwise FALSE.
Number of operands2
Input data typeAny but BOOL, Any but BOOL
Output data typeBOOL
ExamplesOUT := GT( 0, 20 ); (* OUT = FALSE *)OUT := GT( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *)
LELE
DescriptionLess than or equal to. Returns TRUE if Input #0 <= Input #1, otherwise FALSE.
Number of operands2
Input data typeAny but BOOL, Any but BOOL
Output data typeBOOL
ExamplesOUT := LE( 20, 20 ); (* OUT = TRUE *)OUT := LE( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *)
LTLT
DescriptionLess than. Returns TRUE if Input #0 < Input #1, otherwise FALSE.
Number of operands2
Input data typeAny but BOOL, Any but BOOL
Output data typeBOOL
ExamplesOUT := LT( 0, 20 ); (* OUT = TRUE *)OUT := LT( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *)
NENE
DescriptionNot equal to. Returns TRUE if Input #0 != Input #1, otherwise FALSE.
Number of operands2
Input data typeAny, Any
Output data typeBOOL
ExamplesOUT := NE( TRUE, FALSE ); (* OUT = TRUE *)OUT := NE( ‘goofy’, ‘pluto’ ); (* OUT = TRUE *)
String FunctionsThe availability of the following functions depends on the target device. Please refer to your hardware supplier for details.
CONCATCONCAT
DescriptionCharacter string concatenation
Number of operands2
Input data typeSTRING, STRING
Output data typeSTRING
ExamplesOUT := CONCAT( ‘AB’, ‘CD’ ); (* OUT = ‘ABCD’ *)
DELETEDELETE
DescriptionDelete L characters of IN, beginning at the P-th character position
Number of operands3
Input data typeSTRING, UINT, UINT
Output data typeSTRING
ExamplesOUT := DELETE( IN := ‘ABXYC’, L := 2, P := 3 );(* OUT = ‘ABC’ *)
FINDFIND
DescriptionFind the character position of the beginning of the first occurrence of IN2 in IN1. If no occurrence of IN2 is found, then OUT := 0
Number of operands2
Input data typeSTRING, STRING
Output data typeUINT
ExamplesOUT := FIND( IN1 := ‘ABCBC’, IN2 := ‘BC’ ); (* OUT = 2 *)
INSERTINSERT
DescriptionInsert IN2 into IN1 after the P-th character position
Number of operands3
Input data typeSTRING, STRING, UINT
Output data typeSTRING
ExamplesOUT := INSERT( IN1 := ‘ABC’, IN2 := ‘XY’, P := 2 );(* OUT = ‘ABXYC’ *)
LEFTLEFT
DescriptionLeftmost L characters of IN
Number of operands2
Input data typeSTRING, UINT
Output data typeSTRING
ExamplesOUT := LEFT( IN := ‘ASTR’, L := 3 ); (* OUT = ‘AST’ *)
LENLEN
DescriptionString length function
Number of operands1
Input data typeSTRING
Output data typeUINT
ExamplesOUT := LEN( ‘ASTRING’ ); (* OUT = 7 *)
MIDMID
DescriptionL characters of IN, beginning at the P-th
Number of operands3
Input data typeSTRING, UINT, UINT
Output data typeSTRING
ExamplesOUT := MID( IN := ‘ASTR’, L := 2, P := 2 );(* OUT = ‘ST’ *)
REPLACEREPLACE
DescriptionReplace L characters of IN1 by IN2, starting at the P-th character position
Number of operands4
Input data typeSTRING, STRING, UINT, UINT
Output data typeSTRING
ExamplesOUT := REPLACE( IN1 := ‘ABCDE’, IN2 := ‘X’, L := 2, P := 3 ); (* OUT = ‘ABXE’ *)
RIGHTRIGHT
DescriptionRightmost L characters of IN
Number of operands2
Input data typeSTRING, UINT
Output data typeSTRING
ExamplesOUT := RIGHT( IN := ‘ASTR’, L := 3 ); (* OUT = ‘STR’ *)
TO_STRINGFORMATTO_STRINGFORMAT
DescriptionConversion to STRING, with format specifier
Number of operands2
Input data typeAny numerical type, STRING
Output data typeSTRING
Examplesstr := TO_STRINGFORMAT(10, ‘%04d’); (* str = ‘0010’*)
TO_WSTRINGFORMATTO_WSTRINGFORMAT
DescriptionConversion to WSTRING, with format specifier
Number of operands2
Input data typeAny numerical type, WSTRING
Output data typeWSTRING
Exampleswstr := TO_WSTRINGFORMAT(10, ‘%04d’); (* wstr = “0010” *)
Standard operators
ADRADR
DescriptionReturn the address of a variable
Number of operands1
Input data typeAny
Output data typeDWORD
Examples
IMOVEIMOVE
DescriptionValorize an interface using another interface and executing a query interface; checking if the class that implementthe source interface is also implementing the destination interface
Number of operands1
Input data typeInterface instance
Output data typeNULL if error, any if ok
Examples
JMPJMP
DescriptionJump to a specific label
Number of operands1
Input data typeSTRING
Output data type
Examples
MOVEMOVE
DescriptionAssign a value to a variable, equivalent of LD and ST
Number of operands2
Input data typeAny, Any
Output data type
Examples
REFREF
DescriptionReturn the reference to a variable
Number of operands1
Input data typeAny
Output data typeReference to the input variable
Examples
RETRET
DescriptionReturn
Number of operands0
Input data type
Output data type
Examples
SIZEOFSIZEOF
DescriptionReturn the size of a variable
Number of operands1
Input data typeAny
Output data typeUDINT
Examples
CONCAT_DATECONCAT_DATE
DescriptionCreate a valid DATE value given its single components (year, month and day).
Number of operands3
Input data typeINT, INT, INT
Output data typeDATE
Examplesout := CONCAT_DATE(2020, 6, 17); (* out = 2020-06-17 *)
CONCAT_DATE_LTODCONCAT_DATE_LTOD
DescriptionConcatenate a DATE and a LTIME_OF_DAY into a LDATE_ AND_TIME
Number of operands2
Input data typeDATE, LTIME_OF_DAY
Output data typeLDATE_AND_TIME
Examplesout := CONCAT_DATE_LTOD(2020-06-17,13:40:55.123456789); (* out = 2020-06-17-13:40:55.123456789 *)
CONCAT_DATE_TODCONCAT_DATE_TOD
DescriptionConcatenate a DATE and a TIME_OF_DAY into a DATE_AND_ TIME
Number of operands2
Input data typeDATE, TIME_OF_DAY
Output data typeDATE_AND_TIME
Examplesout := CONCAT_DATE_TOD(2020-06-17, 13:40:55.123); (* out = 2020-06-17-13:40:55.123 *)
CONCAT_DTCONCAT_DT
DescriptionCreate a valid DATE_AND_TIME value given its single components (year, month, day, hours, minutes, seconds).
Number of operands2
Input data typeINT, INT, INT, INT, INT, INT
Output data typeDATE_AND_TIME
Examplesout := CONCAT_DT(2020, 6, 17, 13, 40, 55); (* out =2020-06-17-13:40:55 *)
CONCAT_LDATECONCAT_LDATE
DescriptionCreate a valid LDATE value given its single components (year, month and day).
Number of operands3
Input data typeINT, INT, INT
Output data typeLDATE
Examplesout := CONCAT_LDATE(2020, 6, 17); (* out = 2020-06-17 *)
CONCAT_LDTCONCAT_LDT
DescriptionCreate a valid LDATE_AND_TIME value given its single components (year, month, day, hours, minutes, seconds, milliseconds, microseconds, nanoseconds).
Number of operands9
Input data typeINT, INT, INT, INT, INT, INT, INT, INT, INT
Output data typeLDATE_AND_TIME
Examplesout := CONCAT_LDATE_AND_TIME(2020, 6, 17, 13, 40,55, 123, 456, 789);(* out = 2020-06-17-13:40:55.123456789 *)
CONCAT_LTODCONCAT_LTOD
DescriptionCreate a valid LTIME_OF_DAY value given its single components (hours, minutes, seconds, milliseconds, microseconds and nanoseconds).
Number of operands6
Input data typeINT, INT, INT, INT, INT, INT
Output data typeLTIME_OF_DAY
Examplesout := CONCAT_LTOD(13, 40, 55, 123, 456, 789); (* out = 13:40:55.123456789 *)
CONCAT_TODCONCAT_TOD
DescriptionCreate a valid TIME_OF_DAY value given its single components (hours, minutes, seconds, milliseconds).
Number of operands4
Input data typeINT, INT, INT, INT
Output data typeTIME_OF_DAY
Examplesout := CONCAT_TOD(13, 40, 55, 123); (* out =13:40:55.123 *)
DAY_OF_WEEKDAY_OF_WEEK
DescriptionGet the day of week.It returns the day of the week represented in a range from 0 (Sunday) to 6 (Saturday).
Number of operands1
Input data typeLDATE
Output data typeSINT
Examplesout := DAY_OF_WEEK(2020-06-17); (* out = 3 *)
SPLIT_DATESPLIT_DATE
DescriptionSplit a LDATE into year, month and day integer pointer vabiables. The function returns TRUE in case of no errors.
Number of operands4
Input data typeDATE/LDATE, @INT, @INT, @INT
Output data typeBOOL
Examples
SPLIT_DTSPLIT_DT
DescriptionSplit a DATE_AND_TIME into year, month, day, hours, minutes and seconds integer pointer vabiables. The function returns TRUE in case of no errors.
Number of operands7
Input data typeDATE_AND_TIME, @INT, @INT, @INT, @INT, @INT, @INT
Output data typeBOOL
Examples
SPLIT_LDTSPLIT_LDT
DescriptionSplit a LDATE_AND_TIME into year, month, day, hours, minutes, seconds, milliseconds, microseconds and nanosecods integer pointer vabiables. The function returns TRUE in case of no errors.
Number of operands10
Input data typeDATE_AND_TIME, @INT, @INT, @INT, @INT, @INT, @INT, @ INT, @INT, @INT
Output data typeBOOL
Examples
SPLIT_LTODSPLIT_LTOD
DescriptionSplit a LTIME_OF_DAY into hours, minutes, seconds, milliseconds, microseconds and nanoseconds integer pointer vabiables. The function returns TRUE in case of no errors.
Number of operands7
Input data typeLTIME_OF_DAY, @INT, @INT, @INT, @INT, @INT, @INT
Output data typeBOOL
Examples
SPLIT_TODSPLIT_TOD
DescriptionSplit a TIME_OF_DAY into hours, minutes, seconds, milliseconds integer pointer vabiables. The function returns TRUE in case of no errors.
Number of operands5
Input data typeTIME_OF_DAY, @INT, @INT, @INT, @INT
Output data typeBOOL
Examples