4.4.3.8
Libraries
External libraries approved by the manufacturer of the control system (i.e. implemented in the
firmware of the control system) may be used for safety applications.
Of the standard CODESYS libraries only the following are approved:
Library
Safety_Standard.lib (former
Standard.lib)
User libraries created by the manufacturer of the control system or the end user may be used.
On insert of a library, it has to be checked whether the selected library was actually inserted.
The respective information is shown when the library is inserted.
4.4.3.9
Expressions
4.4.3.9.1
General
The following general rules must be followed for programming of expressions in safety applica-
tions:
●
Mixing of different data types in an expression should be avoided. If mixing is unavoidable
explicit type conversion should be used instead.
●
The complexity of expressions should be minimized through the following measures:
–
–
–
–
4.4.3.9.2
Constants
In the interest of more transparent semantics constants should either be declared explicitly or
associated with explicit typification.
Bad:
VAR
size: REAL;
diameter: REAL;
END_VAR
size:= diameter * 3.14;
Good:
VAR CONSTANT
END_VAR
VAR
2020/06/19
CODESYS Safety programming guidelines > Language-specific programming guidelines
Description
Standard IEC 61131-3 functions:
●
Timer
●
Counter
●
Trigger
●
Flip-flops
●
String processing
Limitation of nesting depth (e.g., no more than 3 nesting levels) per expression
No more than 10 operators and 10 operands per expression
No application of expressions in array indices of array access
No application of expressions in function parameters, function block parameters or pro-
gram parameters.
PI: REAL := 3.14;
size: REAL;
diameter: REAL;
3ADR025091M0208, 12, en_US
Configuration and programming
Version (date)
2.3 (04.10.2005) or higher
177