OPC UA Server References

If you want to use a predefined OPC UA node in your commissioning file, you can use a Node reference to achieve that. One use case of that is placing newly defined nodes at the certain point in the OPC UA server tree. The other possibility is to publish data of predefined nodes as MQTT capable nodes.

It is possible to create an instance of an object type by using the resource type Cybus::Node::OpcuaObject

Custom ReferenceNode Properties

Custom ObjectNode Properties

Service Commissioning File Example

---
description: Test for placing a ToolType inside a MachineTool instance

metadata:
  name: Tooltype placement test

resources:
  opcuaServer:
    type: Cybus::Server::Opcua
    properties:
      hostname: 192.168.178.46
      securityModes: ['None', 'SignAndEncrypt']
      securityPolicies: ['None', 'Basic256Sha256']
      nodesetFiles: ['di', 'machinery', 'machineTool']
      allowAnonymous: true
      port: 4841

  ######################################
  #
  # referencing the "Machines" folder
  # which got provided by the Machinery
  # nodeset file
  #
  ######################################
  machineRoot:
    type: Cybus::Node::OpcuaReference
    properties:
      parent: !ref opcuaServer
      referenceNodeId: 'i=1001'
      namespaceUrl: 'http://opcfoundation.org/UA/Machinery/'

  ######################################
  #
  # instantiating a MachineToolType
  # from the MachineTool type
  #
  ######################################
  testMachineToolType:
    type: Cybus::Node::OpcuaObject
    properties:
      parent: !ref machineRoot
      browseName: MyMachineToolTypeTest
      objectTypeName: MachineToolType
      sourceNamespaceUrl: 'http://opcfoundation.org/UA/MachineTool/'

  ######################################
  #
  # referencing the "Equipment" subfolder
  # of the instantiated toolType
  #
  ######################################
  EquipmentFolder:
    type: Cybus::Node::OpcuaReference
    properties:
      parent: !ref testMachineToolType
      relativeBrowsePath: '/4:Equipment'

  ######################################
  #
  # add a toolList type
  # of the instantiated toolType
  #
  ######################################
  toolList:
    type: Cybus::Node::OpcuaObject
    properties:
      parent: !ref EquipmentFolder
      browseName: Tools
      objectTypeName: ToolListType
      sourceNamespaceUrl: 'http://opcfoundation.org/UA/MachineTool/'

  #########################################
  #
  # instantiating a ToolType and placing it
  # into the tools list folder of the instance
  #
  ########################################
  demoToolInstance:
    type: Cybus::Node::OpcuaObject
    properties:
      parent: !ref toolList
      browseName: DemoTool
      objectTypeName: ToolType
      sourceNamespaceUrl: 'http://opcfoundation.org/UA/MachineTool/'

Preexisting nodeIds can be referenced using an absolute nodeId, e.g ns=1;s=1001. It is also possible to reference a nodeId by a browsePath from a certain start point that needs to be specified as well.

For more information on BNF, see the OPC Foundation Reference.

Last updated

Was this helpful?