Symbol:
-
for a DUT without text list support
-
for an enumeration data type with text list support
A DUT (Data Unit Type) declares a user-specific data type.
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 select among the “Structure”, “Enumeration”, “Alias”, or “Union” data types.
Moreover, enumerations can have a text list stored to localize the enumeration values. Then the object also has a localization view.
Syntax
TYPE <identifier> : <data type declaration with optional initialization> END_TYPE
How the data type declaration has to be done syntactically depends in detail on the selected data type.
Examples
Declaration of a structure
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
Extension of a structure
TYPE S_PENTAGON EXTENDS S_POLYGONLINE : STRUCT aiPoint5 : ARRAY[1..2] OF INT; END_STRUCT END_TYPE
Declaration of an enumeration
{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 of components with different data types
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 (Data Unit Type).
Call: Menu bar: “Project Add Object DUT”; 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: |
“Extends” |
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: |
“Add Text List Support” |
Example: Note: In the case of an existing enumeration type, text list support can be added or removed at any time. As a result, the “Add Text List Support” and “Remove Text List Support” commands are provided in the context menu of the object. 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 additional property Example: In a visualization, you use the variable 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. See also: Help for "Enumerations" with information about the declaration syntax |
“Alias” |
Creates an object which declares an alias with which an alternative name is declared for a base type, data type, or function block |
“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" component. |
“Add” |
Closes the dialog and creates the new object The object is displayed with the |