Skip to main content

VariableTypes

Defining Variable Type

Variable Types in OPC UA are used to define the data types of variables in the OPC UA server. They are defined within the variableTypes section the YAML file.

Here is an example of defining a Variable Type called MyVariableType:

variableTypes:
- browseName: MyVariableType
dataType: ua:Double
value: 0

inte

instantiating a Variable Type in a Object Type

Once a Variable Type has been defined, you can create an instance of it by using the properties or components property.

Here is an example of creating an instance of MyVariableType in an Object Type called MyObjectType:

objectTypes:
- browseName: MyObjectType
properties:
- browseName: MyVariable
typeDefinition: MyVariableType
modellingRule: Mandatory # or Optional

By default , the modeler will infer that MyVariable is a Variable by looking at the typeDefinition property.

exposing optional properties of a Variable Type

Variables can have intrinsic properties.

variableTypes:
- browseName: MyVariableType
dataType: ua:Double
value: 0
properties:
- browseName: Units
dataType: ua:String
modellingRule: Optional

instances:
- browseName: MyObject
components:
- browseName: MyVariable
typeDefinition: MyVariableType
optionals:
- Units