Methods
Defining Object Methods in the Sterfive OPCUA Modeler YAML File
Methods in OPC UA are defined operations that are part of an Object or ObjectType node. They provide a way to define actions that can be executed, typically involving the object's variables. Methods in Sterfive OPCUA Modeler are defined within the methods section of an objectTypes element in the YAML file.
Let's explore the structure in detail:
Method Structure:
objectTypes:
- browseName: MyObjectType
methods:
- browseName: AddTwoValues
inputArguments:
- name: Operand1
dataType: ua:Double
description: The value of operand 1
- name: Operand2
dataType: ua:Double
description: The value of operand 2
outputArguments:
- name: Result
dataType: ua:Double
description: The result of the operation
Here, a method AddTwoValues is defined under an object type MyObjectType.
The browseName attribute of a method represents the method's normative name in the OPC UA node. This is used by OPC UA clients to browse through the tree of nodes via their access path. A node's path within the tree is made up of browseNames.
Methods can have inputArguments and outputArguments, which are defined as lists. Each argument in the list has a name, dataType, and description.
The inputArguments section defines the inputs that the method requires, with each argument having a name, dataType (e.g., ua:Double), and description. ua:Double means the argument is a floating-point number defined in the OPC UA namespace.
The outputArguments section describes the values returned by the method after execution. Like inputArguments, each outputArguments item includes a name, dataType, and description. If the method does not return any value, this section can be omitted.
Methods can return multiple values, and in such a case, the outputArguments section will have multiple elements.
Here's an example of a method returning multiple values:
objectTypes:
- browseName: MyAdvancedObjectType
methods:
- browseName: CalculateMeanAndStandardDeviation
inputArguments:
- name: ArrayOfValue
dataType: ua:Double
valueRank: 1
description: an array containing the values to transform
outputArguments:
- name: Mean
dataType: ua:Double
description: The mean value of the array
- name: StandardDeviation
dataType: ua:Double
description: The standard deviation value of the array
In this example, the CalculateMeanAndStandardDeviation method takes an array of doubles as input and returns two output values: the Mean and Standard Deviation of the array.
By defining methods in this way, users can outline various operations related to an ObjectType, providing a flexible and robust means to interact with objects in the OPC UA model.
Full example
📄 Full working example — methods.model.yaml
# yaml-language-server: $schema=../../../schemas/nodeset2.schema.json
namespaceUri: http://sterfive.com/UA/doc-examples/methods/
version: 1.0.0
publicationDate: "2026-05-26T00:00:00Z"
objectTypes:
- browseName: MyObjectType
methods:
- browseName: AddTwoValues
inputArguments:
- name: Operand1
dataType: ua:Double
description: The value of operand 1
- name: Operand2
dataType: ua:Double
description: The value of operand 2
outputArguments:
- name: Result
dataType: ua:Double
description: The result of the operation
- browseName: MyAdvancedObjectType
methods:
- browseName: CalculateMeanAndStandardDeviation
inputArguments:
- name: ArrayOfValue
dataType: ua:Double
valueRank: 1
description: an array containing the values to transform
outputArguments:
- name: Mean
dataType: ua:Double
description: The mean value of the array
- name: StandardDeviation
dataType: ua:Double
description: The standard deviation value of the array
📄 Generated NodeSet2.xml — methods.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/methods/Type.xsd">
<NamespaceUris>
<Uri>http://sterfive.com/UA/doc-examples/methods/</Uri>
</NamespaceUris>
<Models>
<Model ModelUri="http://sterfive.com/UA/doc-examples/methods/" 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="Argument">i=296</Alias>
<Alias Alias="HasComponent">i=47</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>
</Aliases>
<!--ReferenceTypes-->
<!--ObjectTypes-->
<!--ObjectType - 1:MyObjectType {{{{ -->
<UAObjectType NodeId="ns=1;i=1000" BrowseName="1:MyObjectType">
<DisplayName>MyObjectType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=1001</Reference>
</References>
</UAObjectType>
<UAMethod NodeId="ns=1;i=1001" BrowseName="1:AddTwoValues" ParentNodeId="ns=1;i=1000">
<DisplayName>AddTwoValues</DisplayName>
<References>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1002</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1003</Reference>
</References>
</UAMethod>
<UAVariable NodeId="ns=1;i=1002" BrowseName="InputArguments" ParentNodeId="ns=1;i=1001" ValueRank="1" ArrayDimensions="2" DataType="Argument">
<DisplayName>InputArguments</DisplayName>
<Description>the definition of the input argument of method 1:MyObjectType.1:AddTwoValues</Description>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
</References>
<Value>
<ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<ExtensionObject>
<TypeId>
<Identifier>i=297</Identifier>
</TypeId>
<Body>
<Argument>
<Name>Operand1</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>-1</ValueRank>
<ArrayDimensions/>
<Description>
<Text>The value of operand 1</Text>
</Description>
</Argument>
</Body>
</ExtensionObject>
<ExtensionObject>
<TypeId>
<Identifier>i=297</Identifier>
</TypeId>
<Body>
<Argument>
<Name>Operand2</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>-1</ValueRank>
<ArrayDimensions/>
<Description>
<Text>The value of operand 2</Text>
</Description>
</Argument>
</Body>
</ExtensionObject>
</ListOfExtensionObject>
</Value>
</UAVariable>
<UAVariable NodeId="ns=1;i=1003" BrowseName="OutputArguments" ParentNodeId="ns=1;i=1001" ValueRank="1" ArrayDimensions="1" DataType="Argument">
<DisplayName>OutputArguments</DisplayName>
<Description>the definition of the output arguments of method 1:MyObjectType.1:AddTwoValues</Description>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
</References>
<Value>
<ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<ExtensionObject>
<TypeId>
<Identifier>i=297</Identifier>
</TypeId>
<Body>
<Argument>
<Name>Result</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>-1</ValueRank>
<ArrayDimensions/>
<Description>
<Text>The result of the operation</Text>
</Description>
</Argument>
</Body>
</ExtensionObject>
</ListOfExtensionObject>
</Value>
</UAVariable>
<!--ObjectType - 1:MyObjectType }}}}-->
<!--ObjectType - 1:MyAdvancedObjectType {{{{ -->
<UAObjectType NodeId="ns=1;i=1004" BrowseName="1:MyAdvancedObjectType">
<DisplayName>MyAdvancedObjectType</DisplayName>
<References>
<Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=1005</Reference>
</References>
</UAObjectType>
<UAMethod NodeId="ns=1;i=1005" BrowseName="1:CalculateMeanAndStandardDeviation" ParentNodeId="ns=1;i=1004">
<DisplayName>CalculateMeanAndStandardDeviation</DisplayName>
<References>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1006</Reference>
<Reference ReferenceType="HasProperty">ns=1;i=1007</Reference>
</References>
</UAMethod>
<UAVariable NodeId="ns=1;i=1006" BrowseName="InputArguments" ParentNodeId="ns=1;i=1005" ValueRank="1" ArrayDimensions="1" DataType="Argument">
<DisplayName>InputArguments</DisplayName>
<Description>the definition of the input argument of method 1:MyAdvancedObjectType.1:CalculateMeanAndStandardDeviation</Description>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
</References>
<Value>
<ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<ExtensionObject>
<TypeId>
<Identifier>i=297</Identifier>
</TypeId>
<Body>
<Argument>
<Name>ArrayOfValue</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>1</ValueRank>
<ArrayDimensions>
<UInt32>0</UInt32>
</ArrayDimensions>
<Description>
<Text>an array containing the values to transform</Text>
</Description>
</Argument>
</Body>
</ExtensionObject>
</ListOfExtensionObject>
</Value>
</UAVariable>
<UAVariable NodeId="ns=1;i=1007" BrowseName="OutputArguments" ParentNodeId="ns=1;i=1005" ValueRank="1" ArrayDimensions="2" DataType="Argument">
<DisplayName>OutputArguments</DisplayName>
<Description>the definition of the output arguments of method 1:MyAdvancedObjectType.1:CalculateMeanAndStandardDeviation</Description>
<References>
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
<Reference ReferenceType="HasModellingRule">i=78</Reference>
</References>
<Value>
<ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
<ExtensionObject>
<TypeId>
<Identifier>i=297</Identifier>
</TypeId>
<Body>
<Argument>
<Name>Mean</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>-1</ValueRank>
<ArrayDimensions/>
<Description>
<Text>The mean value of the array</Text>
</Description>
</Argument>
</Body>
</ExtensionObject>
<ExtensionObject>
<TypeId>
<Identifier>i=297</Identifier>
</TypeId>
<Body>
<Argument>
<Name>StandardDeviation</Name>
<DataType>
<Identifier>i=11</Identifier>
</DataType>
<ValueRank>-1</ValueRank>
<ArrayDimensions/>
<Description>
<Text>The standard deviation value of the array</Text>
</Description>
</Argument>
</Body>
</ExtensionObject>
</ListOfExtensionObject>
</Value>
</UAVariable>
<!--ObjectType - 1:MyAdvancedObjectType }}}}-->
<!--VariableTypes-->
<!--Other Nodes-->
</UANodeSet>