Structures
Structured data types include several elements of the same or of different data types. Therefore, structures are especially suitable to reflect and handle several different properties of an object, e.g., characteristics of a machine.
In the following example, the structured data type 'machine' consists of the components x_pos, y_pos, depth and rpm. All components describe the characteristics of the machine.
The following simple example specifies a drilling machine which has to process several holes. For each hole to be drilled, the following information is required: position (x/y coordinates), depth and machine revolutions per minutes. The actual values vary for each hole but the used variables are always the same. A 'ready' flag indicates whether the machine is ready for operation.
Data type definition | ![]() |
Variable declaration ('Variables'/Data List) | ![]() |
Use in code | ![]() |
Initializing structures
Structures, or to be more precise, the individual elements contained in a structure, can be initialized as follows:
Further Info
|
Note
If you are using PLCnext Engineer in another user interface language and/or with another Windows system locale than English you must enter numeric values with a '.' as decimal separator (always according to the English standard). This applies, for example, when entering initial values in variables tables or REAL/LREAL literals in the code. |