Automancer docs

OPC-UA client

Introduction

This module adds partial support for servers implementing the OPC-UA protocol. It uses opcua-asyncio.

Usage

Each device configured generates a node for each entry in the nodes list, which can then be used by any node consumer.

# Example setting a node's value

PLC.FR_setpoint: 8 µl/min
actions:
  - ...
  - ...


# Example setting something else using a node's value

Something_else: {{ math.cos(PLC.FR_readout) }}

Device configuration

This module follows the standard definition of devices. In addition to the standard properties of a device, it requires the following. We distinguish between physical nodes which are those defined by the OPC-UA standard, and virtual nodes which are those used in Automancer. The configuration must match that of the OPC-UA server, otherwise the incorrectly-configured nodes will be marked as disconnected.

  • address (string, required) – The address of the device, such as opc.tcp://192.168.0.23:4840/a/b.
  • nodes (required) – A list that maps physical nodes to virtual nodes, with the following properties:
    • description (string) – A description of the virtual node.
    • label (string) – A label for the virtual node.
    • id (identifier, required) – The id of the virtual node.
    • location (string, required) – The location of the physical node, such as ns=3;i=2 or ns=3;s="Foo bar".S02.
    • max/min (quantity) – The maximum/minimum value of the virtual node, which must not exceed the acceptable range of the physical node. These are used for user input validation as well as display purposes. The unit must correspond to the unit attribute, if any. Only applies to writable nodes.
    • unit (quantity) – The unit of the virtual node, such as ml/min. When adding a magnitude to the unit, the virtual node's value is be scaled accordingly with respect to the physical node's value. A unit of 3 ml/min means that a value of 1.0 returned by the OPC-UA server corresponds to 3 ml/min.
    • type (string, required) – The type of the physical node, and thus of the virtual node. The following values are supported:
      • bool – Corresponds to OPC-UA's Boolean type.
      • i16Int16
      • i32Int32
      • i64Int64
      • u16UInt16
      • u32UInt32
      • u64UInt64
      • f32Float
      • f64Double
    • stable (boolean) – Whether the node is stable, meaning it's value never changes between two writes performed by this module. If an entity other than Automancer has control over the physical node, then it should be considered unstable for the module to regularly check that the written value is still active. Only applies to writable nodes. Defaults to true.
    • writable (boolean) – Whether the virtual node is writable, which is only possible if the physical node is writable. This attribute may be set to false even if the physical node is writable to use it in read-only mode. Defaults to false.

An example is shown below.

devices:
  - id: PLC
    address: opc.tcp://192.168.0.23:4840/a/b
    nodes:
      - id: FR_readout
        label: Flowrate readout
        location: ns=3;i=2
        type: bool
        unit: 0.01 µl/min
      - id: FR_setpoint
        label: Flowrate setpoint
        location: ns=3;i=3
        max: 10 µl/min
        min: 0 µl/min
        type: f32
        unit: 0.01 µl/min
        writable: true