setting parent node when creating Object and Variable nodes.
When creating a object of variable node, you can now establish a reference
link with its parent node using the
organizedBy property of the
creating a new ObjectType
You can easily declare a new object type in your addressSpace. ObjectType are useful to help clients of your server to detect easily if the address space of the server contains objects of the given type.
By default, newly created type are sub type of “BaseObjectType”, unless you specify
a “subTypeOf” property in the
options object. For instance, we
could derive a new ObjectType from our TemperatureSensorType.
Note: the subTypeOf property could be given either a Node object, a nodeId object, or even a string matching the browsename of the node you wish to refer to.
enriching an ObjectType with components and properties
ObjetType are useful to provide a description of what components or properties are expected on object instance of this type.
For instance, we could specify that objects of type TemperatureSensorType are expected to have a mandatory “Temperature” component and a optional “IdentificationNumber” component.
The “Temperature” and “IdentificationNumber” variables will be linked with the main temperatureSensor instance
We can specify
modellingRule is missing,
"Mandatory" is assumed.
instantiating an Object node from its ObjectType.
A instance of our TemperatureSensor Type can now be easily created.
This newly created instance is already fitted with fresh instances of the mandatory components and propertiesthat are defined in the ObjectType. The temperatureSensor node created above has already a temperature component that can be set with a a value.
Conveniently, NodeOPCUA has automatically added new members to the temperatureSensor object so you can access OPCUA properties and components more easily.
The code above could be written this way:
By default, ObjectType#instantiate only instantiate components and properties
that have a “Mandatory” modelling rule.
Component or property marked as optional in the ObjectType definition will be
instatiated if their browseName appear in the