OPC UA Server Communication in Siemens TIA Portal
Introduction
OPC Unified Architecture (UA) is an open-source communication protocol that has stood out as a cross-platform protocol in recent years. This is because OPC UA is now the go-to protocol for industrial control devices, embedded system devices, and other industrial equipment. It is a reliable mechanism as it offers better security of plant data and a complete information model than other traditional protocols. OPC UA has a similar Client-Server structure as Modbus TCP but it is more versatile and robust than it. This tutorial will teach you how to configure an S7-1500 PLC as an OPC UA server in TIA Portal.
Prerequisite
In order to follow along with this tutorial, you will need:
- A basic understanding of OPC UA protocol. You can look up our introductory course
- An installation of TIA Portal – Tia portal V16 is being used in this tutorial
- An installation of PLCSIM Advanced- V4.0 is being used in this tutorial
- UA Expert (a simulation software that serves as an OPC UA client)
Important notes
OPC UA will not work for S7-1200 PLCs that have below version 4.4 firmware and version 2.5 for S7-1500 PLCs. This is why OPC UA works best from TIA Portal V16. Also, from TIA V16, the certificate license for OPC UA has already been included in the software, so there is no need to purchase a separate license.
Simatic S7-1200 cannot act as an OPC UA client as the capability isn’t supported. S71500 can act as both client and Server.
Setting up a new project in TIA Portal
Let us start by creating a new project
Next, set the ethernet address of the PLC to be 192.168.0.10 by double-clicking on the ethernet port.
Activate the OPC UA server from the OPC UA navigation. The server address should be noted because the OPC UA client device will connect to the server through this address. The OPC server address contains the IP address and the port number. In this example, the port number is 4840.
In security navigation, TIA Portal automatically generates the server certificate for you; this certificate is a basic one and is self-signed. You can author new self-signed certificates if you wish; you can do that by clicking on the harbinger icon and generating new certificates.
There are security policies that help in enhancing data during transmission. To limit client access to a server, companies can send you their license information, and you would add them under trusted clients.
Next, create a new data block that will contain the OPC UA data.
Configuring the server interface
The server interface is used in configuring interfaces for the OPC UA server. There can be more than one interface configured for a particular server. This will help in orderly arrangement and simplicity.
After creating the interface, on the right-hand side, under OPC UA elements, you can see the program blocks and plc tags created in your program, same as technology objects. Navigating to program blocks, highlight your data block and drag it over to the left-hand side – Under OPC UA server interface.
Setting the IP address for a virtual adapter
On your workstation, assign an IP to the Siemens Ethernet Virtual adapter in the same IP class as your PLC. This can be accessed from Network and Internet settings on your Windows machine.
Configuring PLCSIM Advanced
Open the PLCSIM Advanced 4.0 software and under online access select PLCSIM Virtual Adapter
Now select Start Virtual S7-1500 PLC and configure it as shown in the image bellow. The IP address is the same as that of the PLC device we created. Then click on start to begin the simulation.
Go over to TIA Portal and head over to the project name under the project tree and select properties; then, under protection, tick the support simulation during block compilation. Finally, compile and download the program into the simulator.
In the extend to download screen, select Siemens PLCSIM Virtual Adapter as the PG/PC interface then search. After the PLC device is located load the program.Â
Go online with the PLC and select run in the PLCSIM advanced software.
Finally, Input some data in the OPC data block.
Configuring UA Expert
UA expert is a complete software package that can serve as an OPC UA client device for testing for OPC UA. It is robust enough to handle securities and certificate management. Launch UA expert.
UA Expert has different windows, and their description is given below.
Project: You can manage multiple server connections and documents in this window. You can load and save the server projects.
Data access View: In this window, the sheet displays values from UA variables transmitted via the UA publish mechanisms. You can drop multiple items from different servers onto this sheet.
Attributes: This window shows the attributes of the selected node. You can change the selection in the address space window.
References: This window shows the references of the currently selected node.
Address space: This window shows the address space of the currently selected server.
Adding a new UA server
Navigate to Server and click on add. A new window pops up that will take specific parameters. Give a configuration name.
Under custom discovery, double click to add server address. This address is the OPC UA server we created in TIA Portal. It looks like this opc.tcp://192.168.0.10:4840. We are using anonymous because there was no security configured for this certificate in TIA Portal. Select “OK” when done.
If your communication is successful, you will see your device under the custom delivery navigation.
The security is none because we are not currently using any security feature for the certificate. Navigate to the address space window, and your server parameters will be shown.
Highlight all the data registers and drag them onto the Data Access View window.
You can see the OPC UA server's values, server name, timestamps, and status. This is automatically updated as the register values changes. Apart from just the registered data, other information can be pulled out from the OPC UA server. Clicking on the PLC name in this example (PLC_1), you can see the manufacturer name undervalue in the Attribute window, same as the version of TIA Portal used in programming, the S7 CPU type, etc.
Other parameters of the UA server are available to the client by navigating through the various attributes and values.
Conclusion
OPC UA is a protocol actively used in the industrial internet of things (IIOT) and industry 4.0 trends due to its versatility in communicating with different devices. It is a protocol that manufacturers have adopted for system integration and connectivity purposes. More studies should be made in-depth into the OPC UA protocol as it has come to stay.