Press ESC to close · Ctrl+K to open

Siemens S7-1500 OPC UA Server: TIA Portal V20 and PLCSIM

Objective and tools

The goal is to prepare a Siemens PLC to serve variables through OPC UA, simulate it with PLCSIM Advanced and check the connection from UA Expert.

For this example I use a CPU 1515-2 PN, network interface 1 and project IP address 192.168.1.188. The project stays deliberately simple: one DB with variables, one FC that changes the values and the PLC's own OPC UA server publishing that data.

Tools used:

  • TIA Portal V20: project development and configuration.
  • PLCSIM Advanced V7.0: PLC simulation over Ethernet.
  • UA Expert: OPC UA client used to validate the server.
  • Codex: support for generating the SCL block that simulates values.

OPC UA Activation

Inside the CPU properties, enable the OPC UA server functionality and assign it to the network interface that will be used. Siemens provides specific documentation for using the S7-1500 as an OPC UA server in TIA Portal. In this case the server runs through interface 1 of the CPU.

Enabling the OPC UA server on a Siemens S7-1500 CPU
Network interface configuration for OPC UA in TIA Portal

This prepares the server entry point. Two important parts are still required before downloading: the OPC UA license and the access permissions.

OPC UA License

This functionality requires the OPC UA license that matches the CPU type. The official Siemens OPC UA page summarizes Siemens' approach to OPC UA communications in industrial automation. In TIA Portal, the license is separated by controller size:

  • Small: entry-level CPUs such as 1511, 1512C, 1513 and distributed ET 200SP controllers.
  • Medium: mid-range CPUs such as 1515 and 1516. This is the license used in this example.
  • Large: higher-performance CPUs such as 1517 and 1518.
Selecting the OPC UA license for a Siemens S7-1500 PLC
OPC UA Medium license for a Siemens 1515 CPU

User Permissions

When compiling, TIA Portal may warn that user permissions are missing for OPC UA. The fix is to create a specific role, enable the matching Runtime right in the PLC and assign that role to the user that will access the OPC UA server.

TIA Portal compile warning related to OPC UA permissions

First, create the OPC UA role.

Creating a user role for OPC UA

Then create the Runtime right in the PLC and make it available for that role.

Runtime right configuration for OPC UA in the PLC

Finally, assign the role to the required users. In this case we assign it to the admin user, so the OPC UA connection requires a username and password and is protected by credentials.

This user must already exist with a password. That same password will be entered later in the OPC UA client when establishing the connection to the PLC.

Assigning the OPC UA role to the admin user in TIA Portal

Simulation FC and DB

To have changing data in the OPC UA client, I create a small simulation program. The base is a DB with variables and an SCL FC that updates their values.

FC and DB used to simulate variables in TIA Portal

First, create the variables that will be simulated.

DB variables that will be published through OPC UA

Then enable clock memory bits to use internal pulses and change values easily.

Enabling clock memory in a Siemens CPU

The simulation FC is prepared in SCL with help from Codex, so the test behavior can be generated quickly.

Prompt used to generate an SCL FC for variable simulation
Generated SCL code for simulating PLC values

PLC Simulation

With the program ready, enable simulation in the project and prepare the instance in PLCSIM Advanced.

Enabling PLC simulation from TIA Portal

In PLCSIM Advanced I use SingleAdapter and assign the project IP address: 192.168.1.188. This allows the OPC UA client to connect to that address.

PLCSIM Advanced instance with SingleAdapter and IP 192.168.1.188

OPC UA Server Interface

Once the variables are created, configure an OPC UA server interface in the project.

Creating an OPC UA server interface in TIA Portal

Then add the variables that should be served. Drag the DB or the variables into the OPC UA interface. When everything is ready, download the simulated PLC.

Variables dragged into the OPC UA server interface

Check with UA Expert

To validate the server I use UA Expert, the OPC UA client from Unified Automation. The endpoint URL for this test is:

opc.tcp://192.168.1.188:4840

In this article, the OPC UA channel security is left as No security (None). In other words, we use a username and password for access, but message signing and channel encryption are not enabled yet. The authenticated connection with security policies and encryption will be covered in a dedicated article.

UA Expert with No security None policy for the OPC UA connection

After discovering the server and selecting the connection, UA Expert asks for credentials. Here we enter the admin user and the password previously configured in TIA Portal.

Connection from UA Expert to the Siemens PLC OPC UA endpoint
UA Expert requests the admin username and password to connect to the OPC UA server

After connecting, open the ServerInterfaces folder. The DB published from TIA Portal is available there.

Published DB inside ServerInterfaces in UA Expert

This validates the full path: simulated PLC, active OPC UA server, served variables and an external client reading the published structure.