RETAIN / NON_RETAIN VAR RETAIN count : INT; END_VAR
|
The qualifier is consumed and does not change what the simulator does: RETAIN asks a variable to survive a warm restart, and there is no restart here: every run starts from the declared initial value, which is what a retentive variable is given on a cold start. A real target does have a restart, so the word still matters there. |
A variable named after a standard function (ADD, GT, LT, ...) VAR ADD : INT; lt : BOOL; END_VAR
ADD := 1;
|
IEC does not reserve these, so refusing them would invent a rule the standard lacks. But they are Instruction List OPERATORS, and a compiler sharing one lexer between the languages treats them as keywords in ST too. MATIEC refused VAR_OUTPUT lt : BOOL. Export warns about it. |
A POU touching a VAR_GLOBAL without declaring VAR_EXTERNAL VAR_GLOBAL Shared : INT; END_VAR
FUNCTION_BLOCK Reader
VAR_OUTPUT v : INT; END_VAR
v := Shared;
END_FUNCTION_BLOCK
VAR r : Reader; n : INT; END_VAR
r(v => n);
|
Semantically identical (the global resolves to the same image either way), but a block that touches a global without the declaration will not build on the target. Export warns about it. |
END_IF, END_CASE, END_FOR, END_WHILE, END_REPEAT and END_STRUCT without their ; TYPE Pt :
STRUCT
x : INT;
END_STRUCT
END_TYPE
TYPE Mode : (Idle, Run) END_TYPE
VAR n : INT; p : Pt; END_VAR
IF n > 0 THEN n := 1; END_IF
FOR n := 1 TO 3 DO p.x := n; END_FOR
|
Common in code written elsewhere. Strict IEC requires it and MATIEC refuses a program without, so an export writes each one back. |
An enumeration member written Mode.Idle TYPE Mode : (Idle, Run) END_TYPE
VAR m : Mode := Mode.Run; n : INT; END_VAR
CASE m OF
Mode.Idle: n := 0;
Mode.Run: n := 1;
END_CASE;
|
Read as IEC's Mode#Idle, which is what an export writes. A variable called Mode keeps its meaning: then Mode.Idle is its member. |
An argument named and given nothing: Q => , or IN := , VAR t : TON; et : TIME; END_VAR
t(IN := TRUE, PT := T#1s, Q => , ET => et);
|
What generated call templates leave behind. It reads as not there at all: an input keeps its value, an output goes nowhere. An export drops it. |
An interface base in the __SYSTEM namespace, and PUBLIC on an interface's method INTERFACE IDrive EXTENDS __SYSTEM.IRoot
METHOD PUBLIC Travel : INT
VAR_INPUT dist : INT; END_VAR
END_METHOD
END_INTERFACE
|
A base named in the __SYSTEM namespace is a runtime's own root interface, which no program declares. Neither it nor PUBLIC asks anything of an implementation (every method of an interface is public), so both are read as saying nothing, and an export leaves them out. |
Any library's namespace on a TYPE: JsonLib.Parser, EXTENDS MyLib.Base FUNCTION_BLOCK Parser
END_FUNCTION_BLOCK
VAR p : JsonLib.Parser; many : ARRAY [1..2] OF JsonLib.Parser; END_VAR
|
Where only a type can stand (a declaration, EXTENDS, IMPLEMENTS, ARRAY OF, REF_TO, a result), a dotted name is a library's type, so its namespace is read as saying nothing, whatever the library. An export keeps it: the name exists where the library does. Anywhere else a namespace is no namespace: the engine knows no library by name. |
An enumeration with a base type: (Idle, Run) UINT TYPE Mode :
(
Idle := 0,
Run := 10
) UINT;
END_TYPE
VAR m : Mode; END_VAR
|
A type for an enumeration's values. The values are held as INT here whatever it says, so a value INT cannot hold is refused; an export leaves the word out, since IEC's 2nd edition has no place for it. |
VAR PERSISTENT VAR PERSISTENT count : INT := 7; END_VAR
|
A value that survives a restart and a download; not an IEC word. Read here as retention: a run here has no restart, so it starts at its initial value. PLCopen carries persistent="true"; IEC text writes RETAIN, the nearest word. |
A STRING capacity written as a constant: STRING(MAX_LEN) VAR_GLOBAL CONSTANT MAX_LEN : INT := 20; END_VAR
VAR s : STRING(MAX_LEN); t : STRING[MAX_LEN * 2]; END_VAR
|
IEC writes a capacity as an integer. Folded here against the global integer CONSTANTs, the same rule as an array bound, wherever a capacity can be written, and an export writes the integer it folds to, in brackets (STRING(n) goes out as STRING[n] too). |
A variable linked in the I/O configuration: AT %I*, AT %Q* TYPE Io : STRUCT bIn AT %I* : BOOL; END_STRUCT END_TYPE
FUNCTION_BLOCK Cyl
VAR bExtended AT %I* : BOOL; bValve AT %Q* : BOOL; END_VAR
bValve := NOT bExtended;
END_FUNCTION_BLOCK
VAR start AT %I* : BOOL; END_VAR
|
A PLC project completes the address in its I/O configuration, which here is the scene's wiring: the variable is a plain one, in a program, a global, a block or a struct field alike, and a part wired to it by name drives or reads it. IEC completes one in a VAR_CONFIG, which no target here reads, so an export writes the variable plain. |