What is OPC UA
OPC stands for OLE for Process Control which clearly shows that it comes out of the Microsoft community, based on the OLE and DCOM technology. OPC UA (Unified Automation) is platform independent. It works in Microsoft Windows, Mac and Linux operating system.
OPC-UA servers: Servers provide the physical interface to the real world. Servers measure physical properties, indicate status, initiate physical actions and do all sorts of physical measurements and activation in the real world under the direction of a remote Client device. Servers read the real world data from sensors and devices and send back to OPC-UA clients. Server can pass the alarms and event generated by the devices which are under control of the servers. Servers are where the physical world meets the digital world.
OPC-UA Clients: Clients read and write data from/to servers. Clients can subscribe interesting data from the server. Server can notify the client that your interested data has been changed. Server can notify any alarm if it has been activated.
Platform Independence: Basically client and server are software that run independent of operating system in uniform way. Client can be written in for example in Windows C# language and Server can be implemented in Linux OS with Python. A C# client can be easily access the server data.
How OPC UA is used
OPC UA server reads all the data from actual devices and makes it available for the client. In the usual cases, say for example, we have an alarm in our valve, this is read by the OPC UA server and pass it to the client application, client application can be HMI/SCADA system. OPC Servers collect data from different sources so clients can access those data.
SCADA/HMI => display or process data by acquiring from the OPC server
PLC => Read data from server and use for processing data and react based on the data
OPC Server examples:
PLC => Acquire data from different devices and use it for making decisions based on the data, PLC can be a client and Server at the same time. It can have 2 different processes running in the PLC
Any HW/SW => Different applications running in an HW for collecting data from sensors and processes and making those available for OPC clients
Figure 01: General view OPC Server and Clients (image source internet)
We shall focus on our example with this background information. We shall design our OPC UA server that controls the lock, measure the temperature, open/close a valve and control a motor. We shall show how to develop the OPC Server that we can run in Windows and Linux. We shall create also C# OPC UA client and PLC client (PLC client will talk with OPC UA server.)
We shall show step by step what we need to do to create a model for our server.
OPC UA modeler
OPC UA modeler coming soon…
OPC UA Server Development
OPC UA Server development coming soon…
OPC UA client development in C#
How to connect a OPC Server.
EndpointDescription endpoint = null;
endpoint = new EndpointDescription(ConnectionUri);
session = new Session();
session.ConnectionStatusUpdate += OnConnectionChange;
RequestSettings req = new RequestSettings();
req.OperationTimeout = 10 * 1000;
session.DefaultRequestSettings = req;
session.Connect(endpoint, RetryInitialConnect.Yes, session.DefaultRequestSettings);
OPC UA client development in structured text
Coming more …
OPC AE => OPC Alarms and Events
=>Some reference related to OPC -> https://reference.opcfoundation.org/v104/
OPC UA Online Reference
Online versions of OPC UA specifications and information models.
=> open62541 Documentation -> https://open62541.org/doc/0.2/toc.html and https://manualzz.com/doc/29886981/open62541-documentation
open-source implementation of OPC UA
=> Personal OPC UA blog https://opcua.rocks/