AddIns
Introduction
AddIns in OPC UA are a way to extend the functionality of an OPC UA server by adding custom components using aggregation.
This page will guide you through creating AddIn object types and their instances using the OPC UA Modeler. It also explains how to define AddIn ObjectTypes in the YAML configuration.
Creating AddIn ObjectTypes
An AddIn ObjectType must have a 0:DefaultInstanceBrowseName property that specifies the BrowseName of the default instance of the AddIn. For simplicity, we have added a defaultInstanceBrowseName property in the YAML configuration.
Example
objectTypes:
- browseName: MyComponentType
defaultInstanceBrowseName: MyComponent
This is equvalent to
objectTypes:
- browseName: MyComponentType
properties:
- name: ua:DefaultInstanceBrowseName
type: QualifiedName
value: MyComponent
Creating Instances of AddIn object types
Once an AddIn object type has been created, you can create an instance of it by using the addIns: property
Example
instances:
- browseName: MyDevice
type: di:DeviceType
addIns:
-typeDefinition: MyComponentType
By default, the AddIns instance name will be the same as the value stored in the defaultInstanceBrowseName property of the AddIn ObjectType.
Specifying Different Names for AddIn Instances
If you want to specify a different name for the AddIn instance or add multiple instances of the same component inside your object or object type, you can do so by using the browseName property
instances:
- browseName: MyDevice
type: di:DeviceType
addIns:
-typeDefinition: MyComponentType
-typeDefinition: MyComponentType
browseName: MyComponent1
-typeDefinition: MyComponentType
browseName: MyComponent2
Instantiating AddIn inside an object type Declaration
You can also instantiate AddIn inside an object type declaration in the same way. When doing this, you can add the modellingRule property to specify whether the AddIn is optional or mandatory.
example:
objectTypes:
- browseName: MyDeviceType
addIns:
- typeDefinition: MyComponentType
browseName: MyComponent1
# modellingRule: Mandatory # by default, the AddIn is mandatory, so you only need to specify modellingRule if the AddIn is optional
- typeDefinition: MyComponentType
browseName: MyComponent2
modellingRule: Optional # only specify modellingRule if the AddIn is optional, by default it is mandatory
In this example, MyComponentType is instantiated inside MyDeviceType. The modellingRule property is used to specify whether each AddIn is optional or mandatory.