Structure variables

Previous chapterNext chapter Show allShow all    Hide allHide all

As structure variables always are based on structure data types, a structure data type has to be created before.

Structure variables are variables based on a structure datatype. So as a matter of principle they get the structure of the basic datatype. On creating a structure variable a number of options can be defined:


It can be selected, whether the structure is created as a single structure variable or as an array. Up to three dimensions can be defined for a structure array.


The addressing of the structure variable can be defined manually or automatically. As a default addressing is defined automatically. The calculation of the addressing thereby depends on the granularity of the used driver object type and the used structure elements. Example below. The automatic addressing offers the option, that each data typs starts at a new offset. That means, that each structure variable starts at a new offset and does not follow the last used offset.

Activating structure variable elements

It can be set, whether all elements of the structure should be activated. Activating means, that all elements are set active. Active variables can be used in zenon at once. Inactive variables are not available to zenon, are not counted for the licensed I/Os and are not registered in the driver. The main idea is, that so in a structure reserve areas can be created, that can be activated lateron e.g. when expanding. All elements of a structure variable can be activated and deactivated at any time via the context menu. Please consider that deactivated structure variable elements are also accounted for by the address calculation. If thsi is not desired, the addresses have to be entered manually or the structure element has to be deleted in the data type.

Example for a structure variable based on the structure data type described above:

The variable Engine is based on the structure datatype Engine and therefore consists of all elements of that datatype. The variable Engine.Charging Rate is set inactive. So it cannot be used in a picture or in any other context. Nor does it not count for the licensed I/Os. The array Engine.Temperature is resolved and therefore all three variables for the temperature are available. Also the structure Engine Speed Control is resolved and the two variables Engine Speed Set and Engine Speed Actual are available.