Content of the page:

What is OPC UA

How it is used (in our example home automation and in industries)

Download necessary tool

OPC UA modeler

OPC UA server development

OPC UA client development in C#

OPC UA client development in structured text (For PLC)

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.

 Functional Equivalence:
OPC UA provides the following functionalities. 
Discovery: find the availability of OPC Servers on local PCs and/or networks
Address space: all data is represented hierarchically (e.g. files and folders) allowing for simple and complex structures to be discovered and utilized by OPC Clients
On-demand: read and write data/information based on access-permissions
Subscriptions: monitor data/information and report-by-exception when values change based on a client’s criteria
Events: notify important information based on client’s criteria
Methods: clients can execute programs, etc. based on methods defined on the server
How OPC UA is used

OPC UA server reads all the data from actual devices and make it available for the client. In usual case, 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.

Download necessary tools

We need to download the following software bundle from unified automation site, the address:

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

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.