Configuring the OPC UA Server on a Siemens S7-1500 Series PLC
This guide details the steps to configure a Siemens S7-1500 PLC as an OPC UA server using TIA Portal.
Activate OPC UA Server
Open your project in TIA Portal.
Navigate to your PLC’s properties (e.g.,
PLC_1 [CPU 1518-4 PN/DP]).Go to
General>OPC UA>Server>General.Check the
Activate OPC UA serverbox.Ensure that one of the
Server addresses(opc.tcp://...) matches the IP address of your PLC on the network. The default OPC UA port is 4840.
Using OPC UA with a CP Module
OPC UA works using a CP module when respecting the following minimal requirements:
Feature |
Minimum Requirement |
|---|---|
Virtual interface (W1) |
CPU FW V2.8 |
Configuration in TIA |
TIA Portal V16 |
OPC UA via CP |
Supported via W1 |
Compatible CP |
CP 1543‑1 FW ≥ V2.2 (recommended ≥ V3.0) |
Configure OPC UA Server Options
In the PLC properties, navigate to
General>OPC UA>Server>Options.Port: Adjust the
Portnumber if a different port than the default 4840 is required.Minimum sampling interval: Defines the minimum rate (in ms) at which the server can check data sources for changes.
Minimum publishing interval: Defines the minimum rate (in ms) at which the server can send updated data to clients.
Hint
For S7-1500 PLCs, especially small or mid-size ones (e.g., S7-1516), starting with 250ms intervals and grouping variables into structures is a good practice for improving performance.
Configure OPC UA Server Security
In the PLC properties, navigate to
General>OPC UA>Server>Security.Security Policies: Select the desired security policy. For basic testing and development, you might select
No security. For production environments, stronger options likeBasic128Rsa15-Sign & Encryptare recommended.Guest Authentication: If no specific user authentication is required, check
Enable guest authentication.Attention
On the IOC, OPC UA Security is enabled by default. To connect to any OPC UA server without security, you must set the option
sec-mode=Nonefor the concerned session(s) in your EPICS IOC configuration.
Configure OPC UA Runtime License
In the PLC properties, navigate to
General>Runtime licenses>OPC UA.Ensure the
Type of purchased licenseis at least the same level as theType of required license(e.g.,SIMATIC OPC UA S7-1500 large).
Define Variables in PLC Data Structures
Organize your PLC variables into data blocks that will be exposed as OPC UA nodes.
Create Data Blocks: In TIA Portal, create new data blocks (e.g.,
DB1,DB2,DB3,DB4).Define Variables: Inside each data block, define the variables you want to expose. You can use structured user-defined data types, which will appear as structured data on OPC UA. Structured data is very efficient when using subscriptions. For structures, the server on the S7 always creates a node for the structure and separate nodes for each of its elements.
Example PLC Data Types and EPICS Record Type Compatibility
PLC data type |
EPICS Record type |
|---|---|
Real, LReal |
ai/ao |
Bool |
bi/bo |
Byte/Word/DWord, most *Int |
longin/longout, mbbi/mbbo, mbbiDirect/mbboDirect, bi/bo, ai/ao (RVAL) |
LInt/ULInt |
int64in/int64out |
String |
stringin/stringout, lsi/lso |
Array[m..n] of * |
aai/aao/waveform (with compatible FTVL) |
Struct (UDT) |
opcuaItem |
Arrays that start at a non-zero index on the PLC are shifted to start from zero over OPC UA.
Note
Structured items can only be handled
using the opcuaItem record type.