Data Exchange in OPC UA

Data Exchange OPC UA

In most industrial connectivity technologies, there are only limited ways for devices to move data from one node to another. In Modbus, there is a master message that reads or writes registers and coils. In EtherNet/IP and PROFINET IO, there are cyclic and acyclic messages. In EtherCAT, most users just move data by reading input bytes from the bus and putting other output bytes on the bus.

In OPC UA, there is more complexity. One of the more unique and complex ways for an OPC UA client and server to interact is through subscriptions, where a client subscribes to some data or event in a server. Servers can allow client devices to browse their address space and find data items of interest. If a client finds a data item of interest, it can request that data item to be added to the list of monitored items in the current communication session. When creating a monitored item, the client provides some data, the most important of which is the sampling interval.

The sampling interval indicates how often the server should check the data source. Each time the data source is interrogated, the data is put on the data queue for the monitored item. The maximum queue size varies by device, and it is cleared when the queue is published. If the sampling interval is faster than the publishing interval, the queue can fill and then the oldest data values are lost. The client device controls the sampling interval but not the queue size.

Once one or more of these monitored items is created, a client can request the server to create a subscription. A subscription controls when a monitored item or set of monitored items is published by the server to the client. The frequency that the server publishes the monitored items is the publishing interval. Clients can request multiple subscriptions from a server and choose the same or different publishing rates for each one. The number of monitored items and number of allowable subscriptions is usually not a configurable parameter. Those items are set by the designers of the OPC UA device.

Clients can subscribe to data changes of variables (the Value attribute of a Variable); clients can also subscribe to object events (EventNotifier attribute of an Object) and subscribe to aggregate Values. Aggregate values are calculated values that are recalculated using a time interval defined by the client.

A subscription and the monitored items identified by a client are all part of a secure session. No other client can have access to that data unless it creates its own set of monitored items and subscriptions.

Each time the publish request expires, a notification is sent by the server to the client with the monitored items included in that subscription. If there are no monitored items on the queue, an empty publish request is transmitted. That empty publish request can be used as a keep-alive signal to the client indicating to the client that the server is still active. If there are no clients with subscriptions and monitored items or all clients have deleted their subscriptions, the server does not publish anything.

The maximum sampling interval, the publishing interval, the maximum size of a monitored queue and other attributes are all specific to an individual server. Check your server to know the limits that are implemented.

OPC UA subscriptions are well suited to applications where there are a relatively low number of clients and subscribers. That is usually the case for most SCADA/HMI systems consuming data from a lot of devices. The major advantage of OPC UA subscriptions and monitored items is that the client has a lot of freedom to choose what variables to monitor, what frequency, etc. The client creates custom, fine-tuned publish requests that exactly meets its requirements.

Some devices also support services that allow a client to modify subscription or monitored item settings after creation, further increasing the control clients have over servers.

Unlike the technologies we’ve used in the past, OPC UA provides this much more sophisticated way for devices to interact on the factory floor.