ReferenceDriverOPC UARead Task

OPC UA Read Task

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

For task lifecycle management, see the Task Basics page.

Task Configuration Reference

ParameterTypeRequiredDefaultDescription
namestringYes-Human-readable task name
devicestringYes-Key of the OPC UA server device
sample_ratenumberYes-Samples per second (Hz)
stream_ratenumberNosample_rateRate 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
data_savingbooleanNofalseEnable permanent storage in Synnax
auto_startbooleanNofalseAutomatically start task after configuration
channelsarrayYes-List of input channel configurations

Channel Configuration Reference

OPC UA Read Service Specification

The task’s array_mode setting determines how all channels are read. When array_mode=false, channels are read individually at stream_rate. When array_mode=true, all channels read array_size samples in bulk.

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 sampling rate
  • Set array_size to an integer factor of the sampling 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

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

Important Rules

  • Sample rates: All channels in a task sample at the same rate. Create separate tasks for different rates.
  • Software timing: Synnax uses software timing with ~100μs precision. Under heavy load, timing precision may degrade.
  • One running task per channel: A channel can only receive live data from one task at a time.
  • Stream rate optimization: For low-rate tasks (< 50 Hz), set the stream rate to the sample rate. For high-rate tasks, keep the stream rate less than 50 Hz for better performance.
  • Array mode: Only use array mode for high-rate tasks (> 500 Hz). Requires tuning to avoid undersampling/oversampling.

How-To

Console

Python

TypeScript