ReferenceDriverOPC UARead Task

OPC UA Read Task

Learn how to acquire data from OPC UA servers with Synnax.

For the task lifecycle, see Task Basics.

Task Configuration Reference

ParameterTypeRequiredDefaultDescription
devicestringYes-Key of the OPC UA server device
sample_ratenumberNo50Samples per second (Hz)
stream_ratenumberNo25Rate data is streamed to Synnax (Hz), must be ≤ sample_rate. Used when array_mode=false
array_modebooleanNofalseEnable array sampling mode for high-rate tasks
array_sizenumberNo1Number of samples to read in bulk. Required when array_mode=true
channelsarrayYes-List of input channel configurations

Channel Configuration Reference

OPC UA Read Service Specification

Standard Mode (array_mode=false)

Reads scalar values from an OPC UA node at the specified sample rate. Suitable for most applications with standard data rates.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
node_idstringYes-OPC UA NodeId (e.g., ns=2;s=MyVariable)

NodeId Format Examples:

  • Numeric: ns=2;i=1000
  • String: ns=2;s=Temperature
  • GUID: ns=2;g=12345678-1234-1234-1234-123456789012
  • Opaque: ns=2;b=aGVsbG8=

Array Mode (array_mode=true)

Reads array data from an OPC UA node in bulk. Designed for high-frequency data (>500 Hz) where the server writes samples into arrays.

When array_mode=true, the task reads multiple samples in bulk from the OPC UA server. This is more efficient for high-rate tasks but requires careful configuration to avoid undersampling or oversampling.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
node_idstringYes-OPC UA NodeId pointing to an array variable

Array Sampling Guidelines:

  • Set sample_rate to match the OPC UA server’s sample rate
  • Set array_size to an integer factor of the sample rate
  • Oversampling occurs when the server doesn’t fully replace array values between reads
  • Undersampling occurs when the server writes faster than Synnax reads

Server Timestamp Read

Reads timestamps directly from the OPC UA server for high-precision timing instead of using Synnax-generated timestamps.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax index channel key (must be TIMESTAMP data type)
node_idstringYes-OPC UA NodeId containing server timestamps

If timestamp channels are not added to the task, Synnax automatically generates timestamps with ~100 µs precision using software timing.

Important Rules

  • Software timing -> Samples are timestamped in software with ~100 µs precision, which degrades under heavy load.
  • Array mode -> Use array mode only above 500 Hz. It needs tuning to avoid under- or oversampling.
  • Stream rate -> For sample rates under 50 Hz, set the stream rate equal to the sample rate. Above that, keep the stream rate under 50 Hz.

How-To