OPC UA: a working guide to nodes, sessions and security

Catalin NegruPublished 4 min read

OPC UA (OPC Unified Architecture) is a client and server protocol for industrial data, published by the OPC Foundation and standardized as IEC 62541. A server presents its data as a tree of typed nodes that a client can browse. The client opens a session, usually signed and encrypted, and then reads, writes or subscribes to those nodes. Every value arrives with its data type, a status code and a timestamp, so the client does not need a register map to interpret it.

This guide covers what a NodeId means, what happens between the first TCP packet and the first value, which security settings have to match, and which mistakes produce which status codes. The protocol facts follow the OPC UA specification (OPC 10000), mainly Part 3 (Address Space Model), Part 4 (Services), Part 6 (Mappings) and Part 7 (Profiles).

Where OPC UA is found

In a plant, OPC UA usually sits one level above the fieldbus. Many current PLCs carry an OPC UA server in the controller itself, so a line’s tags can be read by name from the PLC’s Ethernet port. Where the controllers are older or mixed, a software server such as Kepware or Ignition polls them over Modbus, EtherNet/IP or a vendor protocol and republishes everything as one OPC UA address space. MES systems, historians, HMIs and data collectors connect to those servers as clients.

Machine builders use it for a second reason: the OPC Foundation and industry groups publish companion specifications that fix the node structure for a class of machine, so two packaging machines or two injection moulding machines from different vendors expose the same nodes.

The binary transport runs over TCP, by default on port 4840, and an endpoint address looks like opc.tcp://192.168.1.100:4840.

How the pages in this guide fit together

What is OPC UA? explains where the standard came from (OPC Classic and DCOM), the parts of the specification, the transports and the first two messages on the wire, what a DataValue contains, and how subscriptions replace polling.

The OPC UA address space is the reference page for nodes: the eight node classes, the four NodeId formats such as ns=2;s=Temperature and ns=3;i=1001, the attribute numbers (the Value attribute is 13), references, and the standard data types.

OPC UA client and server follows a connection step by step: endpoint discovery, the secure channel, the session, reads, writes and monitored items, and the limits a small embedded server imposes.

OPC UA security covers the three message security modes, the security policies and which are deprecated, application instance certificates and trust lists, and user identity tokens.

OPC UA vs Modbus compares the two on data model, discovery, timing and security, and describes the common arrangement where an OPC UA server sits in front of Modbus devices. The register-level detail is in the Modbus guide.

OPC UA vs MQTT compares a client and server protocol with a broker-based one, and explains where Sparkplug B and OPC UA PubSub fit. The MQTT guide covers that protocol on its own.

The problems that take the most time

SymptomUsual causeCovered in
BadNodeIdUnknown on a node that the browser showsWrong namespace index, or the index changed after the server was reconfiguredThe OPC UA address space
The client finds the server, then cannot connectThe endpoint the server returns uses a hostname the client cannot resolveOPC UA client and server
BadCertificateUntrusted or BadSecurityChecksFailedThe client’s certificate has not been moved to the server’s trust listOPC UA security
BadTooManySessionsAn embedded server’s session limit is used up by other clientsOPC UA client and server
A value reads, but as the wrong typeThe item was configured as a number and the node holds a string or a structureThe OPC UA address space

Reading OPC UA with ControlCom

ControlCom Connect is a hosted platform, so it does not open sessions to plant equipment itself. The on-site component, the ControlCom Edge Server, does. Its OPC UA client connects to an OPC UA server (Kepware, Ignition, Siemens, B&R or any other compliant server) and reads selected nodes into platform variables. The client is configured from the platform: an OPC Endpoint URL such as opc.tcp://192.168.1.100:4840, then one item per node with its Node ID, an Attribute ID that defaults to 13, and the variable that receives the value, with optional scale, offset and deadband. The Edge Server applies a saved configuration on its next restart.

The OPC UA client documentation  lists every field, the platform overview shows where the values go next, and the page for controls engineers describes the commissioning workflow.

The Edge Server reads nodes from an OPC UA server on site and maps each one to a variable in ControlCom Connect, where it can be trended, alarmed on and reported.

In this guide

  1. 1What is OPC UA?What OPC UA is and how it works: its origin in OPC Classic and DCOM, the specification parts, opc.tcp on port 4840, DataValues and subscriptions.
  2. 2The OPC UA address space: nodes, NodeIds, attributes and referencesThe OPC UA address space explained: the eight node classes, NodeId formats such as ns=2;s=Temperature, attribute IDs, references and built-in data types.
  3. 3OPC UA client and server: discovery, sessions and subscriptionsHow an OPC UA client connects to a server: endpoint discovery, secure channel and session, Read, Write and monitored items, and embedded server limits.
  4. 4OPC UA security: modes, policies, certificates and user identityOPC UA security explained: message security modes, current and deprecated security policies, certificates and trust lists, and user identity tokens.
  5. 5OPC UA vs Modbus: differences, trade-offs and when to use eachOPC UA vs Modbus compared: data model, addressing, discovery, polling and subscriptions, security, and how an OPC UA server fronts Modbus devices.
  6. 6OPC UA vs MQTT: architecture, data model and when to use eachOPC UA vs MQTT compared: client and server against publish and subscribe, data model, security and network direction, and where Sparkplug B fits.