Structure Variables

Movicon provides variables defined as Structures to simplify and slim down the employment of groups, containing a mixture of different type variables, in projects.

These type of variables therefore contain a series of information deriving from other variables of different types, grouped together by one variable known as Structure.

Let's take a tank as an example.  Its informative structure is always given by a analogic variable (word type) for the level and two digital variables (bit type) for the minimum and maximum limits.  A Structure variable can be composed of three member being a Level (word), HL (bit) and LL (bit). Together they can be called VAR0001, and will appear in the variable types list available for setting variables in the Real Time DB.

 

 

Using Structure type variables are very handy when managing repetitive objects made up of groups of data.

Once the Tank object's structure of variables has been setup, it can be inserted into the project many times, each time with a different name (Tank_1, Tank_2, Tank_3, etc.), all referring to the same data structure.

Each variable will refer to its own absolute address, starting from the initial byte, for the necessary number of bytes required by the members belonging to the same structure.

 

 

Before inserting a Structure variable into the Real Time DB, its Prototype needs to be set from the project's 'List Structure Prototypes'.

The Structure Prototypes allow you to setup the Type of structure you wish to create by declaring the Member Variables which will take part in it. After having done this, it will appear as variable Type in the Variable properties

It will then be possible to insert new variables as 'Type' being the name of one of the preset Structure Prototypes instead of bytes, words, floats, etc.

If you select the Input, Output or Flag area in the variable's 'Area' property, the starting byte address must be specified in the 'Address' property.

Movicon will always request, as for all the variables in the set shared areas in the project, the start byte address.

 

 

The bytes occupied by the structure variables in memory will depend on the types of variable members set in the structure prototype. Any editing of the members belonging to a Structure variable (changing the quantity of bytes) will always cause automatic compacting to take place within that structure variable.

 

WARNING! the "bit" members in structure variables occupy one memory byte. Therefore, if you create a structure prototype containing 8 bit members, the variable will occupy 8 Bytes and not 1 Byte only.

 

 

See Also