Standard functions
logiccloud provides a library of standard functions that can be called from any Structured Text body. Functions are stateless: they take their inputs, compute a result, and return — there is no instance to declare (unlike function blocks).
This reference is split by category. Each category page lists every function in that group with its signature and a short usage example.
Categories
Section titled “Categories”- Math and arithmetic —
ABS,SQRT, trigonometry,ADD/SUB/MUL/DIV,MOD,EXPT,MOVE. - Bit-string functions —
shifts/rotates (
SHL,SHR,ROL,ROR) and bitwise logic (AND,OR,XOR,NOT). - Selection and comparison —
SEL,MAX,MIN,LIMIT,MUX,GT,GE,EQ,LE,LT,NE. - String functions —
LEN,LEFT,RIGHT,MID,CONCAT,INSERT,DELETE,REPLACE,FIND. - Date and time —
duration/date arithmetic,
CONCAT_*/SPLIT_*,DAY_OF_WEEK, and theSYS_*_DATE_TIMEclock extensions. - Array bounds and validation —
LOWER_BOUND,UPPER_BOUND,IS_VALID,IS_VALID_BCD. - Conversion and endianness —
the generated
<FROM>_TO_<TO>family (cross-links to the type conversion rules) plusTO_BIG_ENDIAN/TO_LITTLE_ENDIAN/BIG_ENDIAN_TO/LITTLE_ENDIAN_TO.
result := SQRT(area); // mathboth := AND(statusA, statusB); // bit-stringchosen := SEL(useBackup, primary, backup); // selectionpos := FIND(line, 'ERROR'); // stringnowUtc := SYS_UTC_DATE_TIME(); // date/timeGeneric parameter types
Section titled “Generic parameter types”In the category tables the generic parameter types describe the family of concrete types accepted:
| Generic type | Accepts |
|---|---|
ANY | Any type |
ANY_NUM | SINT…ULINT, REAL, LREAL |
ANY_REAL | REAL, LREAL |
ANY_INT | SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT |
ANY_BIT | BOOL, BYTE, WORD, DWORD, LWORD |
ANY_ELEMENTARY | Any elementary (non-derived) type |
ANY_STRING | STRING, WSTRING |
ANY_CHARS | STRING, WSTRING, CHAR, WCHAR |
Type conversion functions
Section titled “Type conversion functions”Conversion between data types (e.g. INT_TO_REAL) is provided by a large,
rule-generated family of functions documented on the
conversion page
and, for the naming rules and type set, on the separate
type conversion page.
Remote procedure call
Section titled “Remote procedure call”| Function | Parameters | Returns / outputs |
|---|---|---|
RPC_CALL | TOPIC : STRING, COMMAND : STRING, PARAMS : ANY, TIMEOUT : TIME, FALLBACK_VALUE : ANY, ASYNC : BOOL | returns ANY; out RESULT : INT |
RPC_CALL is a logiccloud extension for invoking a remote service (for example a
REST-RPC connection) over the
platform’s messaging layer. It returns the remote result (typed from
FALLBACK_VALUE) and reports an INT status through its RESULT output. See
the dedicated RPC_CALL reference for the
full signature, sync/async semantics, result-code table and a worked example.