Skip to main content

the `instances` section

the instances: section in the configuration file allows you to define multiple instances of the OPC UA server. Each instance can have its own configuration, including endpoints, security policies, and other settings.

instantiation an object from its ObjectType

You can instantiate an object from its ObjectType by specifying the typeDefinition field in the instance configuration. This allows you to create a new instance of an ObjectType and expose it in the OPC UA address space.

The typeDefinition field should contain the Reference to the ObjectType you want to instantiate. The server will create a new instance of the ObjectType and expose it in the OPC UA address space.

example

Suppose you have an ObjectType defined in a NodeSet2.xml, such as DistanceSensorType, and you want to create an instance of this ObjectType in the OPC UA address space.

  1. Declare your external nodeset in the nodesets section of your configuration file.
  2. instantiate a a Distance sensor object in the instance section with a browseName.
  3. Set the typeDefinition to t1:DistanceSensorType indicating to the server that instance is based on the DistanceSensorType defined in the nodeset with alias t1.
  4. attached the newly created instance to it's parent node. In our case, we want to make the sensor a folder element of Device Integration DeviceSet folder. We use the organizedBy reference. We use the aliased browse path : /di:DeviceSet.
nodesets:
- di
- alias: t1
nodeset2: ./company.Nodeset2.xml
instances:
- browseName: DistanceSensor
typeDefinition: t1:DistanceSensorType
organizedBy: /di:DeviceSet
tip
  • Remember that instantate objects are automatically created in the instances namespace of the address space.
  • The instances namespace is a special namespace that is used to store the instances of the OPC UA server.
  • This is namespace 1 , and it has the alias own.
  • You'll be able to reference the instances in the address space using the own: prefix, such as own:DistanceSensor.
  • The alias browse path is /di:DeviceSet/own:DistanceSensor.

creating a simple variable

instances:
- browseName: TemperatureSensor
typeDefinition: ua:BaseObjectType
organizedBy: /di:DeviceSet
- browseName: Temperature
organizedBy: /di:DeviceSet/own:TemperatureSensor
properties:
- browseName: Temperature
dataType: ua:Double
value: 25.0