Skip to content

OPC UA ​

OPC UA is a machine-to-machine communication protocol for industrial automation developed and maintained by the OPC Foundation. OPC UA provides a standardized way for different devices and systems to communicate with each other.

For the generic steps, see Create a Southbound Driver and Groups and Tags.

For measured tag counts and polling intervals, see OPC UA Driver Performance.

The EMQX Neuron OPC UA driver can be used as a client to access KEPServerEX, Industrial Gateway OPC Server, Prosys Simulation Server, Ignition, and other OPC UA servers. You can also directly access the built-in OPC UA Server of hardware equipment, such as the built-in Server of Siemens S7-1200 PLC, the built-in Server of Omron NJ series PLC, etc.

TIP

OPC UA servers currently support anonymous access, username/password authentication, certificate/key + anonymous access, and certificate/key + username/password authentication. For details, refer to OPC UA Connection Policy. OPC UA Part 9 Conditions and Alarms functionality must be used in Subscribe mode.

Add Driver ​

On Data Collection → South Devices, click Add Device.

  • Name: The name of this device node.
  • Driver: Select the OPC UA driver.

Connection Parameters ​

Click the driver card to open the Device Configuration page and fill in:

ParameterDescription
Endpoint URLTarget OPC UA Server URL, the default value is opc.tcp://127.0.0.1:4840/
UsernameUser name used to connect to the target OPC UA Server
PasswordPassword for connecting to the target OPC UA Server
CertClient certificate in DER format
KeyThe client key in DER format
Security ModeSet the security policy for the OPC UA connection: None/Sign/Sign&Encrypt, with the default being None.
Update ModeSet the data acquisition mode for OPC UA: Read/Subscribe/ Read&Subscribe, with the default being Read.
Publish IntervalThe minimum interval between two publish operations when configuring OPC UA to collect data in Subscribe/Read&Subscribe mode.
Event Root NodeThe OPC UA event root node for condition subscription (default: 0!2253 representing the Server node)

TIP

For details on Security Mode (Sign/Sign&Encrypt), encryption algorithms, and server-side certificate trust configuration, refer to OPC UA Connection Policy.

Update Mode ​

Read mode: EMQX Neuron polls the server with the OPC UA standard read service, on the interval of the collection group. This is the default.

Subscribe mode: EMQX Neuron uses the OPC UA standard subscription service. All subscribed values update once when the subscription is established, and after that only when the data on the server changes.

Read&Subscribe mode: EMQX Neuron uses the read service and the subscription service together.

Publish Interval defines the fastest rate at which the OPC UA server sends point update values to EMQX Neuron in a loop when the Update Mode is set to Subscribe or Read&Subscribe. If this parameter is set to 0, the fastest publish interval supported by the OPC UA server is used. The interval is expressed in milliseconds. The default value is 500 ms, meaning the fastest point update rate sent by the OPC UA server to EMQX Neuron is 500 ms.

TIP

The Update Mode is set in the global parameters of the southbound node and indicates that the southbound node obtains data via OPC UA subscription. Meanwhile, the Subscribe attribute in the EMQX Neuron tags settings means that when the value of this tag changes, it immediately triggers an upload report to the northbound application. Setting both together allows you to obtain real-time data change reports.

When the Update Mode is set to Subscribe or Read&Subscribe, and the tag attribute is configured as Subscribe, the Interval of the collection group does not take effect for this tag, meaning the tag will not report data periodically.

When the Update Mode is set to Subscribe or Read&Subscribe, and the tag attribute is configured as Read and Subscribe, the Interval of the collection group takes effect for this tag, meaning the tag will also report data periodically.

Tag Configuration ​

The data types and address formats supported by this driver are listed below.

TIP

Use UaExpert to find the Namespace Index (NamespaceIndex) and the Node ID (Identifier). For details, see UaExpert.

  • For an explanation of namespace indexes and node ids, refer to the OPC UA standard.
  • The data type you set in EMQX Neuron must match the data type on the server.

Data Types ​

  • INT8 (OPC UA SBYTE type)
  • INT16
  • INT32
  • INT64
  • UINT8 (OPC UA BYTE type)
  • UINT16
  • UINT32 (also used to indicate the OPC UA DATETIME type)
  • UINT64
  • FLOAT
  • DOUBLE
  • BOOL
  • BIT
  • STRING
  • ARRAY_CHAR
  • ARRAY_INT8
  • ARRAY_UINT8
  • ARRAY_INT16
  • ARRAY_UINT16
  • ARRAY_INT32
  • ARRAY_UINT32
  • ARRAY_INT64
  • ARRAY_UINT64
  • ARRAY_FLOAT
  • ARRAY_DOUBLE
  • ARRAY_BOOL
  • ARRAY_STRING
  • JSON

Data Type Conversion ​

OPC UA Data TypeEMQX Neuron Data Type
SByteINT8
Int16INT16
Int32INT32
Int64INT64
ByteUINT8
UInt16UINT16
UInt32UINT32
UInt64UINT64
FloatFLOAT
DoubleDOUBLE
BooleanBOOL (The value is true or false)
BooleanBIT (The value is 0 or 1)
StringSTRING
DatetimeUINT32
LocalizedText(Read Only)STRING
SByte ArrayARRAY_INT8
Int16 ArrayARRAY_INT16
Int32 ArrayARRAY_INT32
Int64 ArrayARRAY_INT64
Byte ArrayARRAY_UINT8, ARRAY_CHAR
UInt16 ArrayARRAY_UINT16
UInt32 ArrayARRAY_UINT32
UInt64 ArrayARRAY_UINT64
Float ArrayARRAY_FLOAT
Double ArrayARRAY_DOUBLE
Boolean ArrayARRAY_BOOL
String ArrayARRAY_STRING
OPC UA Extension ObjectJSON

ARRAY_CHAR displays and writes in the form of a string. JSON displays and writes in the form of a JSON string. OPC UA Extension Object supports arrays and nesting.

Address Format ​

(cond:|alarm:|method:)NS[x,y,z]!NODEID(Method-NS!Method-NODEID)(?para1=type1&para2=type2 ...)

cond:|alarm:|method: Special node flags for conditions, alarms, and methods.

NS Namespace index.

[x,y,z] Array index, when the data type is array, you can use the index to get to the value of a specific location, the dimension counts from 0, the dimension is not more than 2. x means one-dimensional index, y means two-dimensional index, z means three-dimensional index.

NODEID The node ID, which can be set as a number, a string, or a GUID.

Method-NS!Method-NODEID The namespace index and node ID of the method node.

para1=type1&para2=type2 The parameter names and types required for method invocation. Supported types include Boolean, Sbyte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float, Double, String, ByteString, Guid, and LocalizedText.

Example Addresses ​

AddressData typeDescription
0!2258UINT32Get the timestamp of the OPC UA server using the digital NODEID. The NS value is 0, and the NODEID is 2258
2!Device1.Module1.Tag1INT8Use the string NODEID to get the data point of type SBYTE. If NS is 2, NODEID is Device1.Module1.Tag1
0!c496578a-0dfe-4b8f-870a-745238c6ae00BOOLGet a data point of type BOOL using a NODEID of type GUID; NS is 0 and NODEID is c496578a-0dfe-4b8f-870a-745238c6ae00
1[2]!array1d[string]STRINGAccesses the 3rd element of the STRING array; NS is 1, NODEID is array1d[string], one-dimensional index is 2
1[2,3]!array2d[int]INT32Access the elements of row 3 and column 4 of the INT32 array; NS is 1, NODEID is array2d[int], one-dimensional index is 2, and two-dimensional index is 3.
1[2,3,4]!array3d[float]FLOATAccesses row 3, column 4, and element 5 of the FLOAT array; NS is 1, NODEID is array3d[float], one-dimensional index is 2, two-dimensional index is 3, three-dimensional index is 4
0!3D.PointJSONGet an extended object representing a 3D position, which contains three member elements: x, y, and z.
method:1!TemperatureAlarm(0!9027)?JSONMethod node
method:1!TemperatureAlarm(0!9111)?EventId=ByteString&Comment=LocalizedTextJSONMethod node

Conditions, alarms, and methods are all of type JSON.

Use Case ​

This chapter also provides practical examples to facilitate a quick start.