Protocols 6 min read
What is OPC UA? Information model, subscriptions and security
OPC UA, the vendor- and platform-independent standard for industrial communication: clients and servers, the address space, subscriptions, security modes and certificates.
Published:
OPC UA (OPC Unified Architecture) is a communication standard for exchanging data between industrial devices and software, developed by the OPC Foundation and published as IEC 62541. It is independent of vendor and operating system. Next to each value, it carries an information model that says what the value is. Authentication, signing and encryption are part of the standard itself.
From classic OPC to OPC UA
The first OPC standards, OPC DA, HDA and A&E, now called “classic OPC”, were built on Microsoft’s COM/DCOM in the 1990s. They ran only on Windows, and getting DCOM through firewalls was hard. The OPC Foundation removed that dependency with OPC UA, first released in 2006. OPC UA runs on very different hardware and operating systems, from an embedded controller to a server.
Clients and servers
An OPC UA server publishes its data in an address space. A client connects, browses that address space, reads and writes values and subscribes to changes. Many PLCs now ship with a built-in OPC UA server. Software such as SCADA and MES can be both client and server: a SCADA system can read from the PLCs’ servers and expose its own data to higher-level systems as an OPC UA server.
A server is reached at an endpoint URL. With the binary TCP transport it looks like opc.tcp://server:4840. IANA assigned port 4840 to OPC UA and it is the default, though a server can use another. A client first asks for the endpoints (GetEndpoints), and the server lists each endpoint’s security mode, security policy and the user identity types it accepts.
Address space and information model
Everything in the address space is a node. Each node has an identifier (NodeId) made of a namespace index and an identifier, for example ns=2;s=Pump1.Speed. The standard defines eight node classes; the ones you meet most are objects (Object), variables (Variable) and methods (Method). Nodes are linked by references. A pump object, for example, contains speed and temperature variables and refers to a type definition that says what kind of object it is.
With Modbus TCP, a client sees a register number and a number in it. With OPC UA, the same value arrives as “Pump1’s speed”, with its data type and, if the server publishes it, its unit. Every value also comes with a status code (Good, Uncertain, Bad) and two time stamps: when the value was created at the source (SourceTimestamp) and when the server received it (ServerTimestamp).
There are shared information models for whole industries, too. Companion specifications define, for example, which nodes a machine tool or a robot publishes and under which names. When devices from different vendors use the same model, you do not have to map each one separately in the client.
Reading, writing and subscriptions
The services a client uses are defined in the standard:
- Browse walks the address space and lists nodes and their references.
- Read and Write read and write the values of one or more nodes.
- Call runs a method on the server.
- Subscription and MonitoredItem: the client adds the variables it wants to watch to a subscription. The server samples each variable at its sampling interval and sends only the changed values, batched at the publishing interval. With a deadband, small fluctuations are not reported.
With a subscription, the client does not have to keep polling every value, and it receives changes in order. The standard also has separate parts for events and alarms (Alarms and Conditions), access to past data (Historical Access) and a publish-subscribe model (PubSub).
Security
Security in OPC UA works at two levels.
Application level: Every OPC UA application has an X.509 application instance certificate. In the Sign and SignAndEncrypt modes, client and server check each other’s certificate when they connect, and the connection is refused if the certificate is not on the trust list. The security mode sets how the channel is protected. The standard defines three modes:
| Security mode | Meaning |
|---|---|
| None | No security is applied |
| Sign | All messages are signed but not encrypted |
| SignAndEncrypt | All messages are signed and encrypted |
The security policy sets the algorithms. Basic256Sha256 is one of the current policies in wide use; the older Basic128Rsa15 and Basic256 policies are deprecated.
User level: Once the channel is up, the client states the user identity for the session: anonymous, user name and password, an X.509 user certificate or an issued token from an identity service. The server decides which identity types it accepts.
Use None only in a test environment. In the field you choose Sign or SignAndEncrypt and keep the server on a network segment set aside for control systems.
The most common error on a first connection is an untrusted certificate: the server rejects the client’s certificate, or the client rejects the server’s. The fix is to add each side’s certificate to the other side’s trust list.
OPC UA and other protocols
Protocols such as Modbus TCP carry only an address and a value; both sides have to know separately what the value means. OPC UA builds the model and the security into the protocol. The price is a more complex implementation and more processing power on the device. In energy systems, sector protocols such as IEC 60870-5-104, DNP3 and IEC 61850 remain widespread, and OPC UA often serves there as the common language that brings different systems together.
Frequently asked questions
Is OPC UA a protocol?
It is a standard that includes protocols: it defines transports, services, an information model and security together. Its most used transport is the binary TCP protocol with opc.tcp addresses.
Which port does OPC UA use?
The default port for the binary TCP transport is 4840. A server can use a different port; the endpoint URL gives the right address.
What is the difference between OPC UA and OPC DA?
OPC DA is the classic OPC standard for reading and writing current values. It depends on COM/DCOM and runs only on Windows. OPC UA is platform independent and defines its information model and security within the standard.
In YTCC
YTCC uses OPC UA as both client and server. The client connects to OPC UA servers with the None, Sign or SignAndEncrypt security mode and opens a session anonymously or with a user name. Other systems can connect to YTCC’s OPC UA server and read from it; writes from outside are turned off on the server. Like every driver, the OPC UA client runs in its own operating system process.
The other protocols YTCC talks to are on the Platform page. For another way to read data from Siemens PLCs, see our article on PUT/GET access on S7-1200 and S7-1500.