Glossary · PLC and control programming
Structure (data type)
Also known as: STRUCT, Structured data type, Record
German: Struktur
In IEC 61131-3 programming, a structure is a derived data type that combines several named elements, which may have different data types, into one unit.
- PLC programming
- Standards
In one sentence
A structure (STRUCT) combines named elements of different data types into one unit, such as all data of a motor.
Example
The structure ST_Motor contains the elements Command (BOOL), Speed (REAL), Current (REAL) and FaultCode (INT), and one variable of this type exists per motor.
How it applies
- Engineering: Structures group data that belongs together: all signals of a device, a recipe step, an HMI interface. They make interfaces between program parts and between PLC and HMI explicit and reduce the number of individual variables.
- Integration: HMI, SCADA and OPC UA servers can map structures to faceplates and object types. Changing a structure changes every interface that uses it, so structures used across systems need versioning.
- Maintenance: Adding elements at the end of a structure is often less disruptive than inserting them in the middle, but the effect on online changes and memory layout depends on the controller.
- Documentation: A structure used as an interface is a small Data model. Document every element with type, unit, direction and meaning, and keep the table with the software version.
Structure vs. array
A structure holds named elements of different types. An Array holds numbered elements of the same type. Arrays of structures are common for identical machine modules.