Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
Structure Types¶
A structure type defines a record with named fields of potentially different types.
IEC 61131-3 |
Section 2.3.3.1 |
Support |
Partial |
Syntax¶
TYPE
type_name : STRUCT
field_name : field_type ;
...
END_STRUCT ;
END_TYPE
Example¶
TYPE
Point : STRUCT
X : REAL;
Y : REAL;
END_STRUCT;
END_TYPE
PROGRAM main
VAR
origin : Point;
END_VAR
origin.X := 0.0;
origin.Y := 0.0;
END_PROGRAM
Fields are accessed using dot notation. Each field name must be unique within the structure.
See Also¶
Array Types — fixed-size indexed collection
Enumerated Types — named set of values