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 name | I/O data type | Description |
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 name | I/O data type | Description |
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 name | I/O data type | Description |
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 name | Symbol | Description |
GT | > | Decreasing sequence |
GE | >= | Monotonous decreasing sequence |
EQ | = | Equality |
LE | ⇐ | Monotonous increasing sequence |
LT | < | Increasing sequence |
NE | <> | Inequality |
Function name | I/O data type | Description |
LEN | ANY_STRING/ANY_INT | String length |
LEFT | ANY_STRING/ANY_INT | Copy given number of characters from left of the input string |
RIGHT | ANY_STRING/ANY_INT | Copy given number of characters from right of the input string |
MID | ANY_STRING/ANY_INT | Copy 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_INT | Insert a string at a given position |
DELETE | ANY_STRING/ANY_INT | Delete a given number of characters at a given position |
REPLACE | ANY_STRING/ANY_INT | Replace a given number of characters from a given position |
FIND | ANY_STRING/ANY_INT | Find the position of first appearance of a substring |
Date and time functions
Function name | IN1 | IN2 | OUT |
ADD | TIME | TIME | TIME |
ADD | DT | TIME | DT |
ADD_TIME | TIME | TIME | TIME |
ADD_TOD_TIME | TOD | TIME | TOD |
ADD_DT_TIME | DT | TIME | DT |
SUB | TIME | TIME | TIME |
SUB | DATE | DATE | TIME |
SUB | TOD | TIME | TOD |
SUB | TOD | TOD | TIME |
SUB | DT | TIME | DT |
SUB | DT | DT | TIME |
SUB_TIME | TIME | TIME | TIME |
SUB_DATE_DATE | DATE | DATE | 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 | TIME | ANY_NUM | TIME |
MUL_TIME | TIME | ANY_NUM | TIME |
DIV | TIME | ANY_NUM | TIME |
DIV_TIME | TIME | ANY_NUM | TIME |
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).