Object: DUT
A DUT (Data Unit Type) declares a user-specific data type.
DUT
Enumeration with text list support
You can add this kind of object below the application or in the POUs view.
When the object is created, the Add DUT dialog opens. There you can configure the new data type and choose from the constructs (structure, enumeration, alias, and union).
| DUT construct A user-defined data type declaration is placed between the brackets |
| A structure encloses its members with |
| An enumeration is a comma-separated list of member names in round brackets. All members have the same data type. An enumeration can also have a text list assigned to it. This is used to localize the values of the enumeration. As a result, the object also has a localization view. |
| An alias is an alternative identifier. |
| A union encloses its members with |
Declaration of the structure S_POLYGONLINE
with partial initialization of members
TYPE S_POLYGONLINE : STRUCT aiStart : ARRAY[1..2] OF INT := [-99, -99]; aiPoint1 : ARRAY[1..2] OF INT; aiPoint2 : ARRAY[1..2] OF INT; aiPoint3 : ARRAY[1..2] OF INT; aiPoint4 : ARRAY[1..2] OF INT; aiEnd : ARRAY[1..2] OF INT := [99, 99]; END_STRUCT END_TYPE
Declaration of the structure S_PENTAGON
as an extension of S_POLYGONLINE
TYPE S_PENTAGON EXTENDS S_POLYGONLINE : STRUCT aiPoint5 : ARRAY[1..2] OF INT; END_STRUCT END_TYPE
Declaration of the enumeration E_TRAFFICSIGNAL
{attribute 'qualified_only'} {attribute 'strict'} TYPE E_TRAFFICSIGNAL : ( eRed, eYellow, eGreen := 10 ); END_TYPE
Enumeration with text list support in the localization view

The Textual View and
Localization View buttons are located on the right edge of the editor. Click the buttons to toggle between the views.
Declaration of an alias
TYPE A_MESSAGE : STRING[50]; END_TYPE
Declaration of a UNION
TYPE U_DATA : UNION lrA : LREAL; liA : LINT; dwA : DWORD; END_UNION END_TYPE
Dialog: Add DUT
Function: The dialog is used to configure a new DUT object (Data Unit Type).
Call: Project → Add Object → DUT menu; context menu of the application object
Name | Name of the new DUT data type Example: |
Structure | Creates an object which declares a structure that combines multiple variables with different data types into a logical unit The variables declared within the structure are called members. Example: |
Advanced |
In the input field, specify an existing structure. The members of the existing structure are automatically available in the new structure. Example: |
Enumeration | Creates an object which declares an enumeration that combines multiple integer constants into a logical unit The constants declared within an enumeration are also called enumeration values. Example: An enumeration can also have a text list. This is used to localize the values of the enumeration. As a result, the object also has a localization view. |
Add Text List Support |
The text list allows you to localize the names of the enumeration values. Example: Note: In the case of an existing enumeration type, text list support can be added or removed at any time. The commands in the context menu of the object are used for this: Hint: The localized texts can be displayed, for example, in a visualization. In this case, the text output of a visualization element displays the symbolic enumeration values in the current language instead of the numeric enumeration values. When an enumeration with text list support is specified in the Text variable property of a visualization element, it gets the following additional property:
Example: In a visualization, you use the variable
For more information, see also: Using Texts Hint: When you edit the enumeration type in the application, a prompt opens when you close the application and asks whether the affected visualizations should be updated automatically. |
Alias | Creates an object which declares an alias with which an alternative name is declared for a base type, data type, or function block Example: |
Union | Creates an object which declares a union that combines multiple members with mostly different data types into a logical unit All members have the same offset so that they are occupy the same memory. The memory requirement of a union is determined by the memory requirement of its "largest" member. Example: |
Add | Closes the dialog and creates the new object The object is displayed with the |