Glossary · Automation fundamentals, platforms and components
Struct
Also known as: Structure, User-defined data type (UDT)
German: Struct
In IEC 61131-3, a struct (structure) is a derived data type declared with STRUCT … END_STRUCT that groups several named elements, possibly of different data types, into one unit.
- Automation components
In one sentence
A struct groups named elements of different data types into one derived data type, declared in IEC 61131-3 with STRUCT … END_STRUCT.
Example
A struct MotorData holds speed setpoint, actual speed, current, status word and fault code, and one instance exists for each of the 40 motors.
How it applies
- Engineering: Structs keep related data together and make function block interfaces cleaner. Libraries often define structs for devices (motor, valve) that map to HMI faceplates.
- Integration: When structs are exchanged with HMIs, OPC UA clients or other controllers, element order, alignment and padding can differ between platforms; a change to a struct breaks every consumer that relies on its layout.
- Documentation: Document each struct element with name, type, unit and meaning. Treat struct changes as interface changes and version them. Keep struct definitions in shared libraries rather than copying them between projects.
Struct vs. function block
A struct holds data only. A function block holds data and the code that works on it, with a defined interface of inputs, outputs and internal variables.