Skip to main content

Defining Extension Objects

In the Sterfive OPCUA Modeler, Extension Objects are custom structured data types that represent complex types. You can define an extension object data type in the YAML file under the dataTypes section.


1. How the Modeler Identifies Extension Objects

The modeler automatically understands that a custom data type represents an ExtensionObject thanks to the presence of the fields property list. Simply put, if you include the fields keyword with a list of elements in a data type definition, the modeler will infer that this data type is an ExtensionObject.


2. Resolving Field DataTypes and Namespaces

If a field's dataType is presented in the format ua:Float, it signifies that the data type of that field is a Float as defined in the namespace ua (where ua is the alias of the primary OPC UA namespace 0).

  • Foreign Namespace Reference: Prefix with the alias of the imported namespace (e.g., ua:Float or di:DeviceHealthEnumeration).
  • Local Namespace Reference: There is no need to prefix the dataType with a namespace alias if the DataType is defined in the same YAML file (e.g., ControllerDataType).

3. Extension Object Examples

A. Simple Structured DataType

A structure containing simple scalar fields. In the example below, we define MotorInfoDataType containing three float fields:

MotorInfoDataType structure definition
dataTypes:
- 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

B. Nested Structured DataType

An ExtensionObject field can also reference another custom structured DataType defined within the same model file. Below, NestedMotorInfoDataType references the custom ControllerDataType structure:

ControllerDataType custom structure
dataTypes:
- browseName: ControllerDataType
fields:
- name: ControllerName
dataType: ua:String
description: Name of the controller
NestedMotorInfoDataType referencing ControllerDataType
dataTypes:
- browseName: NestedMotorInfoDataType
fields:
- name: Motor
dataType: ControllerDataType
description: the motor acceleration

Full example

📄 Full working example — data-types.model.yaml
data-types.model.yaml
# yaml-language-server: $schema=../../../schemas/nodeset2.schema.json
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: 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
📄 Generated NodeSet2.xml — data-types.model.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>