DataTypes
The dataTypes section allows you to define new types for OPC UA Variables.
It is possible to define enumerations, custom structured structures (Extension Objects), or to overload one of the basic OPC UA dataTypes.
1. Enumeration
OPC UA Enumerations represent discrete sets of named values. In Sterfive OPCUA Modeler, you can define enums using three different styles:
A. Simple List of Strings
You can define an enumeration as a plain, compact list of strings. The compiler will automatically assign sequential integer values starting at 0:
dataTypes:
- browseName: SoftwareVersionFileType
enum: [Current, Pending, Fallback]
B. List of Structured Name Objects
Alternatively, you can define an enumeration by listing structured name elements:
dataTypes:
- browseName: MachineStatus
enum:
- name: Idle
- name: Running
- name: Error
C. Explicit Names & Values (Hex or Dec Support)
If you need non-sequential values or want to map specific numeric codes (e.g. for hardware flags or hex color codes), you can define explicit values:
dataTypes:
- browseName: ColorEnumType
enum:
- name: Red
value: 0xFF0000
- name: Blue
value: 0x0000FF
- name: Green
value: 0x00FF00
To follow standard OPC UA companion specification design patterns, it is a recommended practice to append the Enumeration suffix to your custom enum type names (for example, DeviceHealthEnumeration).
D. Option sets (bit masks)
An OptionSet is a set of flags held in one unsigned integer (OPC 10000-3 §5.8).
Set isOptionSet: true, base it on ua:Byte, ua:UInt16, ua:UInt32 (the default) or
ua:UInt64, and give each flag the mask of its bit, 1, 2, 4, 8, …, so flags combine with |:
dataTypes:
- browseName: PermissionsType
subtypeOf: ua:UInt32
isOptionSet: true
enum:
- name: Read
value: 1
- name: Write
value: 2
- name: Execute
value: 8
displayName: Run
Without values, the masks follow the order of the list (1, 2, 4, …). A value that is not a single
bit, two flags on the same bit, or a bit beyond the width of the base type is an error. An
enum on an unsigned integer without isOptionSet: true is an error too: it is always meant
as an OptionSet.
A value of an OptionSet is written with its flags, combined with |. A list of flags or the
number itself are accepted too, and so are the standard's own OptionSets
(ua:AccessLevelType: CurrentRead | CurrentWrite). An unknown flag, or a number setting a
bit no flag defines, is an error:
objectTypes:
- browseName: DoorType
components:
- browseName: Access
dataType: PermissionsType
value: Read | Write
In the generated NodeSet, each field's Value is the bit position (Execute, mask 8, is
Value="3"), and the OptionSetValues property names every bit, using displayName when
one is given: the same shape as the standard's own AccessLevelType.
2. DataType Overrides (Subtyping Basic Types)
You can overload or subtype basic OPC UA primitive data types (such as ua:String, ua:Double, etc.) to create semantic alias types.
For example, you can create a custom identifier type and then utilize it inside an ObjectType component:
dataTypes:
- browseName: MyIdentifierType
subtypeOf: ua:String
objectTypes:
- browseName: MyObjectType
subtypeOf: ua:BaseObjectType
components:
- browseName: Identifier
dataType: MyIdentifierType
3. Extension Objects (Custom Structured DataTypes)
Extension Objects represent complex structured data types in OPC UA. You can define a custom structured type under the dataTypes section.
The modeler automatically infers that a custom data type is an ExtensionObject if you include a list of properties under the fields keyword.
dataTypes:
- browseName: ThreeDVector
fields:
- name: X
dataType: ua:Float
description: the X value
- name: Y
dataType: ua:Float
description: the Y value
- name: Z
dataType: ua:Float
description: the Z value
Full example
📄 Full working example — data-types.model.yaml
namespaceUri: http://sterfive.com/UA/doc-examples/datatypes/
version: 1.0.0
publicationDate: "2026-05-26T00:00:00Z"
dataTypes:
- browseName: SoftwareVersionFileType
enum: [Current, Pending, Fallback]
- browseName: MachineStatus
enum:
- name: Idle
- name: Running
- name: Error
- browseName: ColorEnumType
enum:
- name: Red
value: 0xFF0000
- name: Blue
value: 0x0000FF
- name: Green
value: 0x00FF00
- browseName: PermissionsType
subtypeOf: ua:UInt32
isOptionSet: true
enum:
- name: Read
value: 1
- name: Write
value: 2
- name: Execute
value: 8
displayName: Run
- browseName: MyIdentifierType
subtypeOf: ua:String
- browseName: ThreeDVector
fields:
- name: X
dataType: ua:Float
description: the X value
- name: Y
dataType: ua:Float
description: the Y value
- name: Z
dataType: ua:Float
description: the Z value
- browseName: MotorInfoDataType
fields:
- name: Acceleration
dataType: ua:Float
description: the motor acceleration
- name: Velocity
dataType: ua:Float
description: the motor velocity
- name: Torque
dataType: ua:Float
description: the Z value
- browseName: ControllerDataType
fields:
- name: ControllerName
dataType: ua:String
description: Name of the controller
- browseName: NestedMotorInfoDataType
fields:
- name: Motor
dataType: ControllerDataType
description: the motor acceleration
objectTypes:
- browseName: MyObjectType
subtypeOf: ua:BaseObjectType
components:
- browseName: Identifier
dataType: MyIdentifierType
- browseName: DoorType
components:
- browseName: Access
dataType: PermissionsType
value: Read | Write
📄 Generated NodeSet2.xml — data-types.model.Nodeset2.xml
<?xml version="1.0"?>
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd" xmlns:ns1="http://sterfive.com/UA/doc-examples/datatypes/Type.xsd">
<NamespaceUris>
<Uri>http://sterfive.com/UA/doc-examples/datatypes/</Uri>
</NamespaceUris>
<Models>
<Model ModelUri="http://sterfive.com/UA/doc-examples/datatypes/" Version="1.0.0" PublicationDate="2026-05-26T00:00:00.000Z">
<RequiredModel ModelUri="http://opcfoundation.org/UA/" Version="1.05.06" PublicationDate="2025-11-08T00:00:00.000Z"/>
</Model>
</Models>
<Aliases>
<Alias Alias="1:MyIdentifierType">ns=1;i=1006</Alias>
<Alias Alias="EnumValueType">i=7594</Alias>
<Alias Alias="HasComponent">i=47</Alias>
<Alias Alias="HasEncoding">i=38</Alias>
<Alias Alias="HasModellingRule">i=37</Alias>
<Alias Alias="HasProperty">i=46</Alias>
<Alias Alias="HasSubtype">i=45</Alias>
<Alias Alias="HasTypeDefinition">i=40</Alias>
<Alias Alias="LocalizedText">i=21</Alias>
</Aliases>
<!--ReferenceTypes-->
<!--DataTypes-->
<UADataType NodeId="ns=1;i=1000" BrowseName="1:SoftwareVersionFileType">
<DisplayName>SoftwareVersionFileType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=29</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1001</Reference>
</References>
<Definition Name="1:SoftwareVersionFileType">
<Field Name="Current" Value="0"/>
<Field Name="Pending" Value="1"/>
<Field Name="Fallback" Value="2"/>
</Definition>
</UADataType>
<UAVariable NodeId="ns=1;i=1001" BrowseName="EnumStrings" ParentNodeId="ns=1;i=1000" AccessLevel="3" ValueRank="1" ArrayDimensions="3" DataType="LocalizedText">
<DisplayName>EnumStrings</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
</References>
<Value>
<ListOfLocalizedText xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<LocalizedText>
<Text>Current</Text>
</LocalizedText>
<LocalizedText>
<Text>Pending</Text>
</LocalizedText>
<LocalizedText>
<Text>Fallback</Text>
</LocalizedText>
</ListOfLocalizedText>
</Value>
</UAVariable>
<UADataType NodeId="ns=1;i=1002" BrowseName="1:MachineStatus">
<DisplayName>MachineStatus</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=29</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1003</Reference>
</References>
<Definition Name="1:MachineStatus">
<Field Name="Idle" Value="0"/>
<Field Name="Running" Value="1"/>
<Field Name="Error" Value="2"/>
</Definition>
</UADataType>
<UAVariable NodeId="ns=1;i=1003" BrowseName="EnumStrings" ParentNodeId="ns=1;i=1002" AccessLevel="3" ValueRank="1" ArrayDimensions="3" DataType="LocalizedText">
<DisplayName>EnumStrings</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
</References>
<Value>
<ListOfLocalizedText xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<LocalizedText>
<Text>Idle</Text>
</LocalizedText>
<LocalizedText>
<Text>Running</Text>
</LocalizedText>
<LocalizedText>
<Text>Error</Text>
</LocalizedText>
</ListOfLocalizedText>
</Value>
</UAVariable>
<UADataType NodeId="ns=1;i=1004" BrowseName="1:ColorEnumType">
<DisplayName>ColorEnumType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=29</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1005</Reference>
</References>
<Definition Name="1:ColorEnumType">
<Field Name="Red" Value="16711680"/>
<Field Name="Blue" Value="255"/>
<Field Name="Green" Value="65280"/>
</Definition>
</UADataType>
<UAVariable NodeId="ns=1;i=1005" BrowseName="EnumValues" ParentNodeId="ns=1;i=1004" AccessLevel="3" ValueRank="1" DataType="EnumValueType">
<DisplayName>EnumValues</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
</References>
<Value>
<ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<ExtensionObject>
<TypeId>
<Identifier>i=7616</Identifier>
</TypeId>
<Body>
<EnumValueType>
<Value>16711680</Value>
<DisplayName>
<Text>Red</Text>
</DisplayName>
<Description>
<Text/>
</Description>
</EnumValueType>
</Body>
</ExtensionObject>
<ExtensionObject>
<TypeId>
<Identifier>i=7616</Identifier>
</TypeId>
<Body>
<EnumValueType>
<Value>255</Value>
<DisplayName>
<Text>Blue</Text>
</DisplayName>
<Description>
<Text/>
</Description>
</EnumValueType>
</Body>
</ExtensionObject>
<ExtensionObject>
<TypeId>
<Identifier>i=7616</Identifier>
</TypeId>
<Body>
<EnumValueType>
<Value>65280</Value>
<DisplayName>
<Text>Green</Text>
</DisplayName>
<Description>
<Text/>
</Description>
</EnumValueType>
</Body>
</ExtensionObject>
</ListOfExtensionObject>
</Value>
</UAVariable>
<UADataType NodeId="ns=1;i=1006" BrowseName="1:MyIdentifierType">
<DisplayName>MyIdentifierType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=12</Reference>
</References>
</UADataType>
<UADataType NodeId="ns=1;i=1007" BrowseName="1:ThreeDVector">
<DisplayName>ThreeDVector</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1008</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1009</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1010</Reference>
</References>
<Definition Name="1:ThreeDVector">
<Field Name="X" DataType="i=10">
<Description>the X value</Description>
</Field>
<Field Name="Y" DataType="i=10">
<Description>the Y value</Description>
</Field>
<Field Name="Z" DataType="i=10">
<Description>the Z value</Description>
</Field>
</Definition>
</UADataType>
<UAObject NodeId="ns=1;i=1008" BrowseName="Default Binary">
<DisplayName>Default Binary</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1009" BrowseName="Default XML">
<DisplayName>Default XML</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1010" BrowseName="Default JSON">
<DisplayName>Default JSON</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UADataType NodeId="ns=1;i=1011" BrowseName="1:MotorInfoDataType">
<DisplayName>MotorInfoDataType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1012</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1013</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1014</Reference>
</References>
<Definition Name="1:MotorInfoDataType">
<Field Name="Acceleration" DataType="i=10">
<Description>the motor acceleration</Description>
</Field>
<Field Name="Velocity" DataType="i=10">
<Description>the motor velocity</Description>
</Field>
<Field Name="Torque" DataType="i=10">
<Description>the Z value</Description>
</Field>
</Definition>
</UADataType>
<UAObject NodeId="ns=1;i=1012" BrowseName="Default Binary">
<DisplayName>Default Binary</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1013" BrowseName="Default XML">
<DisplayName>Default XML</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1014" BrowseName="Default JSON">
<DisplayName>Default JSON</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UADataType NodeId="ns=1;i=1015" BrowseName="1:ControllerDataType">
<DisplayName>ControllerDataType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1016</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1017</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1018</Reference>
</References>
<Definition Name="1:ControllerDataType">
<Field Name="ControllerName" DataType="i=12">
<Description>Name of the controller</Description>
</Field>
</Definition>
</UADataType>
<UAObject NodeId="ns=1;i=1016" BrowseName="Default Binary">
<DisplayName>Default Binary</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1017" BrowseName="Default XML">
<DisplayName>Default XML</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1018" BrowseName="Default JSON">
<DisplayName>Default JSON</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UADataType NodeId="ns=1;i=1019" BrowseName="1:NestedMotorInfoDataType">
<DisplayName>NestedMotorInfoDataType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1020</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1021</Reference>
<Reference ReferenceType="HasEncoding">ns=1;i=1022</Reference>
</References>
<Definition Name="1:NestedMotorInfoDataType">
<Field Name="Motor" DataType="ns=1;i=1015">
<Description>the motor acceleration</Description>
</Field>
</Definition>
</UADataType>
<UAObject NodeId="ns=1;i=1020" BrowseName="Default Binary">
<DisplayName>Default Binary</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1021" BrowseName="Default XML">
<DisplayName>Default XML</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<UAObject NodeId="ns=1;i=1022" BrowseName="Default JSON">
<DisplayName>Default JSON</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=76</Reference>
</References>
</UAObject>
<!--ObjectTypes-->
<!--ObjectType - 1:MyObjectType {{{{ -->
<UAObjectType NodeId="ns=1;i=1023" BrowseName="1:MyObjectType">
<DisplayName>MyObjectType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=1024</Reference>
</References>
</UAObjectType>
<UAVariable NodeId="ns=1;i=1024" BrowseName="1:Identifier" ParentNodeId="ns=1;i=1023" AccessLevel="3" DataType="1:MyIdentifierType">
<DisplayName>Identifier</DisplayName>
<References>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
</References>
</UAVariable>
<!--ObjectType - 1:MyObjectType }}}}-->
<!--VariableTypes-->
<!--Other Nodes-->
</UANodeSet>