Standard functions

Standard functions can be used in all programming languages (FUPLA, ST), some of them may be overloaded (they work over different types, e.g. addition) and some of them are extendable (may have variable number of inputs, e.g. logical AND).

Function name

Description

Example

…_TO_…

Conversion of first data type to second data type

A:=INT_TO_REAL(B);

TO_…

Overloaded data type conversion

A:=TO_REAL(B);

…_TRUNC_…

Truncating, or “cutting”, of ANY_REAL to ANY_INT

A:=REAL_TRUNC_INT(B);

…_BCD_TO_…

Conversion ANY_BIT to ANY_INT

A:=WORD_BCD_TO_INT(B);

Function nameI/O data typeDescription
ABS ANY_NUM Absolute value
SQRT ANY_REAL Square root
LN ANY_REAL Natural logarithm
LOG ANY_REAL Common logarithm
EXP ANY_REAL Natural exponential function\\
SIN ANY_REAL Sine (in rads)
COS ANY_REAL Cosine (in rads)
TAN ANY_REAL Tangent (in rads)
ASIN ANY_REAL Arcsin
ACOS ANY_REAL Arccos
ATAN ANY_REAL Arctan
ATAN2 ANY_REAL Arctan at a given point (x,y)
ADD ANY_NUM Addition
MUL ANY_NUM Multiplication
SUB ANY_NUM Subtraction
DIV ANY_NUM Division
MOD ANY_NUM Modulo
EXPT ANY_NUM Exponentiation
MOVE ANY_NUM Assignment
Function nameI/O data typeDescription
SHL ANY_BIT Shift to left (completed by zeros from the right)
SHR ANY_BIT Shift to right (completed by zeros from the left)
ROL ANY_BIT Rotate to left
ROR ANY_BIT Rotate to right
AND ANY_BIT Logical AND (like A:=AND(B,C,D); or A:=B&C&D;)
OR ANY_BIT Logical OR
XOR ANY_BIT Logical EXOR
NOT ANY_BIT Negation
Function nameI/O data typeDescription
MOVE ANY Assignment (Example: A:=B;)
SEL ANY Binary selection (Example.: OUT:=IN if G=0;)
MAX ANY Maximum
MIN ANY Minimum
LIMIT ANY Limiter
MUX ANY Multiplexer
Function nameSymbolDescription
GT > Decreasing sequence
GE >= Monotonous decreasing sequence\\
EQ = Equality
LE Monotonous increasing sequence\\
LT < Increasing sequence
NE <> Inequality
Function nameI/O data type Description
LEN ANY_STRING/ANY_INTString length
LEFT ANY_STRING/ANY_INTCopy given number of characters from left of the input string
RIGHT ANY_STRING/ANY_INTCopy given number of characters from right of the input string
MID ANY_STRING/ANY_INTCopy given number of characters from a given position of the input string (Example.: OUT:=MID(IN,10,3);)
CONCAT ANY_STRING Concatenation (linking) of strings
INSERT ANY_STRING/ANY_INTInsert a string at a given position
DELETE ANY_STRING/ANY_INTDelete a given number of characters at a given position
REPLACE ANY_STRING/ANY_INTReplace a given number of characters from a given position
FIND ANY_STRING/ANY_INTFind the position of first appearance of a substring
Function nameIN1 IN2 OUT
ADD TIMETIME TIME
ADD DT TIME DT
ADD_TIME TIMETIME TIME
ADD_TOD_TIME TOD TIME TOD
ADD_DT_TIME DT TIME DT
SUB TIMETIME TIME
SUB DATEDATE TIME
SUB TOD TIME TOD
SUB TOD TOD TIME
SUB DT TIME DT
SUB DT DT TIME
SUB_TIME TIMETIME TIME
SUB_DATE_DATEDATEDATE TIME
SUB_TOD_TIME TOD TIME TOD
SUB_TOD_TOD TOD TOD TIME
SUB_DT_TIME DT TIME DT
SUB_DT_DT DT DT TIME
MUL TIMEANY_NUMTIME
MUL_TIME TIMEANY_NUMTIME
DIV TIMEANY_NUMTIME
DIV_TIME TIMEANY_NUMTIME

The functions stated above are extended by the CONCAT and SPLIT functions, which link and cut parts of date and time variables. For example, the SPLIT_DATE function separates a date into three INT values (year, month, and day).

  • © Energocentrum Plus, s.r.o. 2017 - 2021