SIMATIC NET OPC UA S7server DOC V2 0 en
SIMATIC NET OPC UA S7server DOC V2 0 en
SIMATIC NET OPC UA S7server DOC V2 0 en
Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-
binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.
Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
© Siemens AG 2020 All rights reserved
foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.
Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.
Security information
Siemens provides products and solutions with industrial security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary
to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.
Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the Internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: https://www.siemens.com/industrialsecurity.
Table of contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 5
1.1 Overview............................................................................................... 5
1.2 Plant configuration ................................................................................ 6
1.3 Principle of Operation ........................................................................... 8
1.3.1 S7 Server services ............................................................................... 8
1.3.2 As an S7 client, S7 CPU reads data from the PC station (S7
server) ................................................................................................ 11
1.3.3 S7 CPU, as S7 client, writes data to the PC station (S7 server) ........ 12
1.3.4 NodeId for access to the attributes of the data tags in S7 data
block DB1 ........................................................................................... 13
1.4 Components used .............................................................................. 14
2 Engineering ...................................................................................................... 15
2.1 Hardware setup .................................................................................. 15
2.2 Setting IP addresses and subnet mask .............................................. 16
2.2.1 IP address and subnet mask for the PC station ................................. 16
2.2.2 IP address and subnet mask for the S7 CPU .................................... 18
2.3 "Communication settings". ................................................................. 20
2.4 Overview............................................................................................. 24
2.5 Configuration ...................................................................................... 25
2.5.1 Create S7 CPU in STEP 7 (TIA Portal) .............................................. 25
© Siemens AG 2020 All rights reserved
1 Introduction
1.1 Overview
SIMATIC NET OPC server communication functions for OPC UA
The OPC server provides standardized access to the SIMATIC NET industrial
communications networks.
The SIMATIC NET OPC Server supports the interfacing of applications with any
automation components networked over PROFIBUS or Industrial Ethernet.
SIMATIC NET OPC server offers the following communication functions for
OPC UA:
• S7 communication
– S7 OPC UA server (see chapter 4.1.1)
– S7OPT OPC UA server (see chapter 4.1.2)
• Open communication services (SEND/RECEIVE)
– SR OPC UA server (see chapter 4.1.3)
• PROFIBUS DP
– DP OPC UA server (see chapter 4.1.4)
The SIMATIC NET OPC server communication functions for OPC UA support the
following services, among others:
• Variable services
• Buffer-oriented services
• Block services
• Server services
Note The server services only function over standard S7 connections to S7 CPUs.
This application example demonstrates how to use the server service to exchange
data between PC station and S7 CPU. This service is supported by the following
communication functions:
• S7 communication
Industrial Ethernet
Figure 1-1
PC station
Industrial Ethernet
© Siemens AG 2020 All rights reserved
S7-1500
CPU/CP/CM
S7-400 CPU/CP
Unrestricted
PROFIBUS
Figure 1-2
PC station
PROFIBUS
© Siemens AG 2020 All rights reserved
CM 1243-5
S7-300 CPU/CP
S7-1500
CPU/CP/CM
S7-400 CPU/CP
The PC station with an active OPC server for the S7 protocol (S7 OPC UA server)
provides the S7 data block DB1 for reading and writing, thereby becoming an S7
server. The S7 data block (DB 1) is 65535 bytes long. There are no symbolic
names nor structuring of the data block according to tags.
An S7 connection must be configured for reading and writing. As an S7 client, the
S7 CPU actively establishes the S7 connection. The PC station, as an S7 server, is
a passive participant while the S7 connection is established.
The following figure shows an overview of the application example.
Figure 1-3
DB1
S7 connection
S7 CPU
(S7 client)
Data:
- Memory byte: MB 0
- Data blocks: DB 3
- Process image: EB 0
- Temporary local data
Note The application example provides an introduction to using the S7 server service
with the SIMATIC NET S7 OPC UA server. Details are described in the SIMATIC
NET manuals (see \3\, \4\ and \5\).
Figure 1-4
PG/PC S7 CPU
OPC client
Data
Data
User program
Access to NodeId
User program
PUT/GET instruction call
S7 OPC UA server
Node
© Siemens AG 2020 All rights reserved
Attribute
NodeId
S7 connection
OPC UA accesses objects and their sub-objects. Data tags, for example, are sub-
objects of an S7 connection object.
The following S7 connection objects exist:
• Productive S7 connections
These are used for data exchange between S7 CPU and PC station and are
generally configured with STEP 7.
• DEMO connection
This is used only for testing.
• @LOCALSERVER connection
Unrestricted
This provides the local S7 data blocks for the S7 server functionality.
Attributes define the objects in greater detail. Each individual access to an object,
sub-object and attribute uses its NodeId.
1.3.2 As an S7 client, S7 CPU reads data from the PC station (S7 server)
The following figure shows how the S7 CPU, as an S7 client, reads data from the
PC station (S7 server).
Figure 1-5
PG/PC S7 CPU
OPC client
Byte 0
1 Byte 1
…
Byte 9 DB11:
Byte 0
Byte 1
Byte 2
User program …
Access to NodeId: Byte 99
S7:@LOCALSERVER.db1.0,b,10
3
© Siemens AG 2020 All rights reserved
User program
S7 OPC UA server
GET call with following
DB1: parameters:
NodeId of the Byte 0 • ID: 16#100
attributes for the Byte 1 • ADDR_1:
S7 server service Byte 2 2
p#DB1.DBX0.0 Byte 10
…
Byte 9 • RD_1:
p#DB11.DBX0.0 Byte 10
@LOCALSERVER connection
Table 1-1
No. Description
1. The OPC client writes to the attributes of the data tags in the S7 data block DB1.
The attributes are accessed via the NodeId.
2. The entire S7 block DB1 or parts of the S7 data block DB1 are mapped to the
NodeId.
3. The "GET" instruction is called in the S7 CPU user program.
The "GET" instruction reads data from the source range, specified at the
Unrestricted
parameter "ADDR_1":
• Source range: S7 data block DB1 in the PC station
The instruction enters the data into the target range, specified at parameter
"RD_1":
• Target range: DB11 in the S7 CPU
The following figure shows how the S7 CPU, as an S7 client, writes data to the PC
station (S7 server).
Figure 1-6
PG/PC S7 CPU
OPC client
Byte 0
3 Byte 1
…
Byte 9 DB10:
Byte 0
Byte 1
Byte 2
User program …
Access to NodeId: Byte 99
S7:@LOCALSERVER.db1.0,b,10
1
© Siemens AG 2020 All rights reserved
User program
S7 OPC UA server
PUT call with following
DB1: parameters:
NodeId of the Byte 0 • ID: 16#100
attributes for the Byte 1 • ADDR_1:
S7 server service Byte 2 2
p#DB1.DBX0.0 Byte 10
…
Byte 9 • SD_1:
p#DB10.DBX0.0 Byte 10
@LOCALSERVER connection
Table 1-2
No. Description
1. The "PUT" instruction is called in the S7 CPU user program.
The "PUT" instruction the data from the source range, specified at parameter
"SD_1".
• Source range: DB10 in the S7 CPU
The "PUT" instruction writes data to the target range, specified at parameter
"ADDR_1".
• Target range: S7 data block DB1 in the PC station
2. The entire S7 block DB1 or parts of the S7 data block DB1 are mapped to the
NodeId.
3. The OPC client reads the attributes of the data tags in the S7 data block DB1.
The attributes are accessed via the NodeId.
1.3.4 NodeId for access to the attributes of the data tags in S7 data block
DB1
The following figure shows the NodeId for access to the attributes of the data tags
in the S7 data block DB1.
Figure 1-7
PG/PC
OPC client
User program
NodeId:
1 2 3 4 5 6
Table 1-3
No. Description Value
1. Namespace URI S7
2. Local connection (within the PC station) @LOCALSERVER
3. Object DB1
4. Start address 0
5. Data type b (bytes)
6. Quantity 10
2 Engineering
2.1 Hardware setup
The following figure shows the structure of the application example.
Figure 2-1
SIMATIC Field PG
CPU 1513-1 PN
IP address: 192.168.178.35
Subnet mask: 255.255.255.0
IP address: 192.168.178.34
Subnet mask: 255.255.255.0
Industrial Ethernet
software is installed on the SIMATIC Field PG. The SIMATIC NET OPC server
provides the S7 data block DB1 on the PC station. Using the S7 server services
"PUT" and "GET", the S7 CPU access the S7 data block DB1 in the PC station.
In the Windows properties for the network adapter through which the PC station is
connected with the S7 CPU, set the IP address and subnet mask for the PC
station.
Figure 2-2
© Siemens AG 2020 All rights reserved
1. In the "Control Panel", open the "Network and Sharing Center" under "Network
and Internet".
2. Select the function "Change adapter settings".
3. Right-click on the corresponding network adapter and select the "Properties"
context menu.
The Properties dialog for network adapter opens.
4. Select the "Internet Protocol Version 4 (TCP/IPv4)" element and click the
"Properties" button.
The Properties dialog box for the "Internet Protocol Version 4 (TCP/IPv4)"
element will open.
5. Set the IP address and subnet mask and apply the settings with "OK".
– IP address: 192.168.178.34
– Subnet mask: 255.255.255.0
Note You will configure the IP address and subnet mask later during hardware
configuration for STEP 7.
© Siemens AG 2020 All rights reserved
1. In the "Project tree" under "Online access" click the arrow to the left of the
network adapter that is connected with your S7 CPU.
2. Double-click the "Update accessible devices" command.
All devices available to the network adapter will be shown.
3. Click the arrow to the left of the S7 CPU to which you wish to assign an IP
address and subnet mask.
4. Double-click the command "Online & diagnostics".
The "Online & diagnostics" dialog will open.
Note • You will enter the IP address and subnet mask later during configuration.
• If you have an S7-1500 CPU, you can also set the IP address and subnet
mask on the display.
1. Port settings:
– If the checkbox is selected, the default setting is used for the specified port.
– If the checkbox is not selected, you can edit the input field for the port.
2. Security policies:
– If the checkbox is selected, unsecured connections (none) to the OPC
server are allowed.
– If the checkbox is not selected, no unsecured connections (none) to the
OPC server will be allowed.
3. Define which connections to the OPC server will be allowed and determine
whether the messages will be signed (Sign) or signed and encrypted
(SignAndEncrypted):
– secured connections based on the security policy "Basic128Rsa15"
– secured connections based on the security policy "Basic256"
– secured connections based on the security policy "Basic256Sha256"
– secured connections based on the security policy
"Aes128_Sha256_RsaOaep"
– secured connections based on the security policy
"Aes256_Sha256_RsaPss"
4. Check of the client certificates
– Always check certificates
Enabled: The certificates will always be checked.
Disabled: The certificates will not be checked.
– No strict certificate check
Enabled: Certain certificate checks will be ignored, e.g.
CertificateRevocationUnknown, CertificateIssuerRevocationUnknown,
NonceLengthCheck, TokenPolicyIdCheck.
Disabled: The certificates will be fully checked.
– Accept expired certificates
Enabled: The certificates will be accepted even if the time stamp of the
certificate is invalid, i.e. the certificates are not yet valid or have already
© Siemens AG 2020 All rights reserved
expired.
Disabled: The certificates are only accepted if the time stamp is valid.
5. Login settings
– If the checkbox is selected, the SIMATIC NET OPC server allows
anonymous login of OPC UA clients.
– If the checkbox is not selected, anonymous logins are not allowed. User
authentication with Windows login and password is then required.
Note
The SIMATIC NET OPC server uses the Windows user management for
user authentication. In the OPC client, log in to the SIMATIC NET OPC
server with your Windows user name and password.
6. Test and auxiliary tools
– Provide templates for item definitions:
If the checkbox is selected, the OPC server creates templates for item
definitions in its namespace, which can be used to easily define a new
Item.
– Make virtual module (Demo) available for simulations:
The SIMATIC NET OPC server gives you the ability to use the OPC
interface for tests, presentations and development work without a
communication module. For this purpose, the OPC server provides a
virtual module or "DEMO" connection, depending on the protocol (CP
simulation). This option enables activation of the simulation function
depending on the protocol.
"OPC UA certificates"
Figure 2-7
Unrestricted
2.4 Overview
The following figure shows an overview of the steps performed during the
engineering stage.
• Configuration
• Configure the Station Configuration Editor
• Load PC station configuration data
• Load S7 CPU configuration data
There are multiple ways of performing the engineering step when configuring the
Station Configuration Editor and loading the PC station configuration data.
Performing either one of the options for the engineering step is sufficient.
This application example describes all possibilities for the engineering steps.
Figure 2-8
• S7 connection
• "PUT" and "GET" instruction
• Send data and receive data
2.5 Configuration
2.5.1 Create S7 CPU in STEP 7 (TIA Portal)
Requirements
• STEP 7 (TIA Portal) is open.
• A new project is created, or an existing project is opened.
Insert device
1. Double-click the command "Add new device" in the "Project tree".
© Siemens AG 2020 All rights reserved
Note If you enabled the option "Open device view", the "Device view" for the S7 CPU
will open automatically in the hardware and network editor.
Unrestricted
The "Device view" of the S7 CPU opens in the hardware and network editor.
© Siemens AG 2020 All rights reserved
Unrestricted
Unrestricted
Insert device
1. Double-click the command "Add new device" in the "Project tree".
© Siemens AG 2020 All rights reserved
Note If you enabled the option "Open device view", the "Device view" for the PC
Unrestricted
station will open automatically in the hardware and network editor.
The "Device view" of the PC station opens in the hardware and network editor.
Unrestricted
2. Insert a communications module, e.g. "IE general", into slot 1 of the PC station
by dragging and dropping.
The graphical area of the "Network view" opens in the hardware and network
editor.
© Siemens AG 2020 All rights reserved
Unrestricted
Result:
A specified S7 connection is created and is configured on both sides.
• The connection path is highlighted.
2. In the "General" tab under "Special connection properties", disable the function
"Active connection establishment".
4. In the connection table, select the S7 connection that uses the S7 CPU as
local endpoint.
The properties of the S7 connection are displayed in the Inspector window.
5. In the "General" tab under "Special connection properties", enable the function
"Active connection establishment".
6. The local ID of the S7 connection can be modified in the "General" tab under
"Local ID".
You will specify the local ID later at the "ID" input parameter for the instructions
"PUT" and "GET".
© Siemens AG 2020 All rights reserved
The graphical area of the "Network view" opens in the hardware and network
editor.
© Siemens AG 2020 All rights reserved
Result:
An unspecified S7 connection is created.
• The connection path is highlighted.
Note If the connection parameters are not yet fully set up, the S7 connection will be
shown with errors in the connection table.
3. In the "General" tab under "Special connection properties", disable the function
"Active connection establishment", as the PC station is a passive participant
when the connection is established.
4. In the "General" tab under "Address details", define the partner TSAP.
The partner TSAP is composed as follows:
– "Connection res. (hex)", e.g. 10.
– CPU slot, e.g.:
S7-1500 CPU / S7-1200 CPU: 1
S7-300 CPU: 2
S7-400 CPU: 3
Unrestricted
Note
For partner TSAP, use the local TSAP of the S7 CPU.
When configuring the connection in the S7 CPU, enter the local TSAP of the
SIMATIC NET OPC server as partner TSAP.
5. In the "General" tab under "OPC", the function "Maintain connection
permanently" is enabled.
© Siemens AG 2020 All rights reserved
The graphical area of the "Network view" opens in the hardware and network
editor.
© Siemens AG 2020 All rights reserved
Result:
An unspecified S7 connection is created.
• The connection path is highlighted.
Note If the connection parameters are not yet fully set up, the S7 connection will be
shown with errors in the connection table.
Note
When configuring the connection in the PC station, enter the local TSAP of the
S7 CPU as partner TSAP.
4. In the "General" tab under "Address details", enter the partner TSAP.
Note
For partner TSAP, use the local TSAP of the SIMATIC NET OPC server.
5. In the "General" tab under "Special connection properties", enable the function
"Active connection establishment" so that the S7 CPU will actively establish the
connection.
© Siemens AG 2020 All rights reserved
6. The local ID of the S7 connection can be modified in the "General" tab under
"Local ID".
You will specify the local ID later at the "ID" input parameter for the instructions
"PUT" and "GET".
2.5.4 Creating tags for the parameters of the instructions "PUT" and "GET"
Insert a data block (DB) with the following tags in order to enter parameters for the
instructions "PUT" and "GET".
1. Navigate in the "Project tree" to the device folder of the S7 CPU.
2. Open the "Program blocks" folder.
3. Double-click the "Add new block" command.
© Siemens AG 2020 All rights reserved
4. Make the following settings and then confirm your entries with the "OK" button.
© Siemens AG 2020 All rights reserved
7. Create the following tags to populate the input/output parameters of the "PUT"
and "GET" instructions. The following PLC data types are used.
Table 2-1
Tag PLC data type Description
put typePut Tags for parameter entry of the
"PUT" instruction
get typeGet Tags for parameter entry of the
"GET" instruction
diagnostic typeDiagnostic Tags to save the status of the
"PUT" and "GET" instructions in
the event of an error.
Overview
The following tags are created in the S7 CPU.
• Data block (DB) with standard access in order to save the data (receive data
area) that are read from the PC station
• Data block (DB) with standard access in which the data written to the PC
station are saved (send data area)
Add data block (DB) with standard access for send data
1. Navigate in the "Project tree" to the device folder of the S7 CPU.
2. Open the "Program blocks" folder.
3. Double-click the "Add new block" command.
© Siemens AG 2020 All rights reserved
4. Make the following settings and then confirm your entries with the "OK" button.
© Siemens AG 2020 All rights reserved
9. Select "Properties".
© Siemens AG 2020 All rights reserved
10. Make the following settings in the "General" tab under "Attributes" and then
apply the settings by clicking "OK".
© Siemens AG 2020 All rights reserved
Add data block (DB) with standard access for receive data
1. Navigate in the "Project tree" to the device folder of the S7 CPU.
2. Open the "Program blocks" folder.
3. Double-click the "Add new block" command.
© Siemens AG 2020 All rights reserved
4. Make the following settings and then confirm your entries with "OK".
© Siemens AG 2020 All rights reserved
9. Select "Properties".
© Siemens AG 2020 All rights reserved
10. Make the following settings in the "General" tab under "Attributes" and then
apply the settings by clicking "OK".
© Siemens AG 2020 All rights reserved
The following figure shows an overview of the user program in the S7 CPU.
Figure 2-12
DB10
OB 1 PUT
"SendData"
DB11
GET
"RecvData"
Fill the parameters of the "PUT" instruction with the tags created in chapter 2.5.4.
The following table lists the assignment of the parameters of the "put" tags to the
parameters of the "PUT" instruction.
Table 2-6
Parameters, Parameters of Start value Note
"PUT" instruction the "get" tags
REQ request false Set the "request" parameter to
"TRUE" in order to start a
request to write data. The
write request is started at a
rising edge. Reset the
"request" parameter to
"FALSE" if the write request
was completed with "DONE" =
"1" or "ERROR" = "1" in order
to be able to start a new write
request.
ID id 16#100 Enter the local ID of the
connection that you defined
when configuring the
connection.
ADDR_1 − P#DB1.DBX0.0 Pointer to the range in the
byte 10 communication partner that
should be written to.
Because the remote pointer
© Siemens AG 2020 All rights reserved
Parameter "GET"
In order to read data from S7 data block DB1 in the PC station, call the "GET"
instruction in the user program of the S7 CPU, e.g. in OB 1.
The following figure illustrates the call of the instruction "GET" in OB 1.
Figure 2-14
© Siemens AG 2020 All rights reserved
Fill the parameters of the "GET" instruction with the tags created in chapter 2.5.4.
The following table lists the assignment of the parameters of the "get" tags to the
parameters of the "GET" instruction.
Table 2-8
Parameters, Parameters of Start value Note
© Siemens AG 2020 All rights reserved
Note Insert the components in the same order as in the component image that you
created in TIA Portal in the PC station "Device view". If the configuration differs
from the list, the configuration data that you download from TIA Portal to the PC
station will not be adopted correctly.
When configuring for the first time it is necessary to enter the station name.
6. Make the following settings in order to add the "OPC server" user application.
– "Type": "OPC Server"
– Index: 1
7. Make the following settings in order to add the "IE General" component.
© Siemens AG 2020 All rights reserved
Result
The added components and the station name will be displayed in the "Station
Configuration Editor":
• Station name: "PC system"
• Index 1: "OPC server"
• Index 2: "IE General"
• Index 125: "Stationmanager"
"Stationmanager" will be automatically added at this index by the system.
Figure 2-15
© Siemens AG 2020 All rights reserved
The following status icons for the components show that the configuration data are
not yet loaded:
• The component exists in the current configuration of the PC station but it was
not created in the project engineering. Depending upon the intended
application, the component must still be configured in STEP 7 and the
configuration data must be loaded.
Once you have manually configured the "Station Configuration Editor", load the PC
station's configuration data (see chapter 2.7.1).
3. Select the network adapter via which the PC station communicates with the
S7 CPU, then click "Update".
4. Click "Configure" in order to transfer the configuration of the PC station to the
Station Configuration Editor.
5. The message "Transfer completed successfully" will appear once the transfer
has completed successfully.
6. Click "Close" to finish the dialog.
Result
In the "Station Configuration Editor", the components and the station name are
created according to the configuration in TIA Portal:
• Station name: "PC system"
• Index 1: "OPC server"
• Index 2: "IE General"
• Index 125: "Stationmanager"
"Stationmanager" will be automatically added at this index by the system.
Figure 2-16
© Siemens AG 2020 All rights reserved
The following status icons for the components show that the configuration data are
not yet loaded:
• The component exists in the current configuration of the PC station, but it was
not created in the project engineering. Depending upon the intended
application, the component must still be configured in STEP 7 and the
configuration data must be loaded.
Once you have configured the "Station Configuration Editor" in TIA Portal, load the
PC station's configuration data (see chapter 2.7.1).
Result
The XDB configuration file will be generated and saved in the directory that you set
when configuring the PC station.
For productive operation, you require not only the component configuration but
also the project engineering data for the communication connections and possibly
also for the tag symbols. You can load the configuration data to the PC station in
the following ways:
• Loading via TIA Portal in online mode
• XDB import: Importing XDB in the Station Configuration Editor
Note Loading via TIA Portal in online mode will only successfully install the
communication services on your PC station if the component layout in the project
engineering data is identical to the layout in the configuration data on the
PC station.
© Siemens AG 2020 All rights reserved
Requirements:
• Engineering PC and PC station are in the same subnet.
• You set the same IP address and subnet mask for the PC station network
adapter as you did in the hardware configuration (see chapter 2.2.1).
Compiling:
Figure 2-17
Unrestricted
Load:
1. Open the "Device view" of the PC station.
© Siemens AG 2020 All rights reserved
Result:
The PC station configuration data have been loaded successfully.
Figure 2-18
© Siemens AG 2020 All rights reserved
• The components are in "RUN" mode. This is shown with the icon in the
"Run/Stop" column.
• The following status icon for the component shows that the configuration data
have been loaded successfully.
Result:
The PC station configuration data have been loaded successfully.
Figure 2-19
© Siemens AG 2020 All rights reserved
• The station has the same name as in the component image that you generated
in TIA Portal in the "Device view" for the PC station.
• The components are in "RUN" mode. This is shown with the icon in the
"Run/Stop" column.
• The following status icon for the component shows that the configuration data
have been loaded successfully.
Requirements
• Engineering PC and S7 CPU are in the same subnet.
• You set the same IP address and subnet mask for the S7 CPU as you did in
the hardware configuration (see chapter 2.2.2).
Compiling
Figure 2-20
© Siemens AG 2020 All rights reserved
Downloading
1. Select the S7 CPU in the "Project tree".
© Siemens AG 2020 All rights reserved
Unrestricted
3 Operation
3.1 Setting up SIMATIC S7 communication
Note It is only possible to use the S7 server services via standard S7 connections to
S7 CPUs.
Using the S7 server services, the S7 CPU accesses the S7 data block DB1 in the
PC station over standard S7 connections.
In order to access the data that the S7 OPC UA server provides in the S7 data
block, you will need an OPC client. In this example, "OPC Scout V10" from
SIMATIC NET will be used as OPC client.
3.1.1 Establish connection to the S7 OPC UA server with OPC Scout V10
1. Start OPC Scout V10 from the Windows Start Menu item "Siemens Automation
> OPC Scout V10".
2. In the "Server explorer" under "UA server", right-click "Local UA server".
© Siemens AG 2020 All rights reserved
4. Right-click the S7 connection under "UA server > Local UA server >
OPC.SimaticNET.S7".
3.1.2 Setting up access to the data in S7 data block DB1 with OPC Scout
Use OPC Scout V10 to access the following nodes in the S7 OPC UA server:
• S7: @LOCALSERVER.db1.0,b,10
1. In the "Server explorer", navigate to "UA server > Local UA server >
OPC.SimaticNET.S7 > opc.tcp://<Computer name>:550101
[OPC.SimaticNET.S7] > Objects > S7: > @LOCALSERVER > blocks > db".
Templates for access to the S7 data block DB1 in the PC station will be
displayed here.
© Siemens AG 2020 All rights reserved
Unrestricted
2. Drag and drop the desired template into the DA view of OPC Scout V10 to
access the S7 data block DB1 in the PC station.
This application example uses the template "template byte array".
Note The S7 server services can only be used via standard S7 connections.
Overview
Figure 3-1
PC station S7 station
Source area
S7 UA server
Node DB1
© Siemens AG 2020 All rights reserved
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
Byte 9
Target area
Result
• The modify values are saved in DB10 "SendData" (source area). The values
are displayed in the "Monitor" column.
• The vales saved in DB10 "SendData" are written to the S7 data block DB1 in
the PC station (target area).
© Siemens AG 2020 All rights reserved
Note Reset the "REQ" input of the "PUT" instruction via the tag "InOut".put.request if
the write request was completed with "DONE" = "1" or "ERROR" = "1" so that
you can start a new write request.
Overview
Figure 3-4
PC station S7 station
1 Monitor
Write 2
S7 UA server
Node DB11
DB1 GET Byte 0
Byte 0 Byte 1
Byte 1 Byte 2
© Siemens AG 2020 All rights reserved
Byte 2 Byte 3
Byte 3 Byte 4
Byte 4 Byte 5
Byte 5 Byte 6
Byte 6 Byte 7
Byte 7 Byte 8
Byte 8 Byte 9
Byte 9
Target area
Source area
1. In the DA view of OPC Scout V10, enter new values for the node in the "New
Value" column.
2. Click "Write" to write the node's data with new values.
The values are written to the S7 data block DB1 in the PC station (source
area).
3. Click the "Monitoring ON" button.
Result
© Siemens AG 2020 All rights reserved
The values of the S7 data block DB1 (source area) are displayed in the "Value"
column.
Figure 3-6
Result
The values read from the S7 data block DB1 (source area) are stored in the
S7 CPU in DB11 "RecvData" (target area). The values are displayed in the "Modify
value" column.
Figure 3-8
Note Reset the "REQ" input of the "GET" instruction via the tag "InOut".get.request if
the read request was completed with "NDR" = "1" or "ERROR" = "1" so that you
can start a new read request.
4 Useful information
4.1 SIMATIC NET OPC server
4.1.1 S7 OPC UA server
Connection type
The S7 OPC UA server supports the following connection type:
• Standard S7 connection (see chapter 4.5.1).
Communication services
The S7 OPC UA server supports the following communication services:
Table 4-1
Communication service Description
Variable services Functions for reading and writing one or more S7 tags.
© Siemens AG 2020 All rights reserved
Note The S7 OPC UA server communication services listed in Table 4-1 are available
for Industrial Ethernet and PROFIBUS.
Connection type
The S7OPT OPC UA server supports the following connection type:
• Optimized S7 connection (see chapter 4.5.2).
Communication services
The S7OPT OPC UA server supports the following communication services:
Table 4-2
Communication service Description
Variable services Functions for reading and writing one or more S7 tags
via standard access and access to optimized data
blocks.
OPC UA events, conditions and Processing of PLC messages.
alarms
History data on OPC UA Access to history S7OPT data tags that are archived
© Siemens AG 2020 All rights reserved
Note The S7OPT OPC UA server communication services listed in Table 4-2 are only
available for Industrial Ethernet.
Connection type
The SR OPC UA server supports the following connection type:
• TCP Connection
• ISO-on-TCP connection
• ISO transport connection
Type of connection
The type of SR connection methods that is possible via an SR connection is set in
STEP 7. The connection can either:
• only Fetch
• only Write
•
© Siemens AG 2020 All rights reserved
only Send/Receive
Communication services
The SR OPC UA server supports the following communication services:
Table 4-3
Communication service Description
Tag service Reading and writing of data tags for S5 data blocks and
ranges (S5-compatible communication) requires that a
Fetch or Write connection first be configured.
The data tags on a Fetch connection are only read. On a
Write connection, the data tags are written only. If a
communication partner's data blocks must not only be read
but also written, then you must configure two corresponding
connections which will be managed fully independently by
the OPC UA server.
Buffer send/receive service Buffer-oriented services allow program-controlled transfer of
larger blocks of data. These services are also known as
SEND/RECEIVE services. Data transfer with the OPC UA
server is implemented with tags:
• Tags that receive blocks of data
• Tags that send blocks of data
A default size for the blocks of data is specified in the
configuration. When sending tags, the length can be
restricted. Partial access within the blocks of data is
possible.
1 Engineering
OPC
server
Configuration
Index 1 Index 2
Industrial Ethernet
Unrestricted
Engineering
In TIA Portal you will configure the PC station with the necessary components:
• Network adapter: e.g. "IE General"
• User application, e.g. "OPC Server"
Set all necessary addresses and parameters, such as IP address and subnet mask
for the network adapter.
Configuration
Using the "Station Configuration Editor" you will insert the components into the
virtual slots of the PC station and assign addresses and parameters to them.
To allow communication between the components in the PC station and to receive
project engineering data, each component is assigned a unique identification
number. The identification number for components in a PC station is the index. In
much the same way as the slot of a module in an S7 CPU, the index corresponds
to a virtual slot in a PC station.
You need the "Station Configuration Editor" for the initial configuration and project
engineering as well as maintenance of a PC station.
The "Station Configuration Editor" is the user interface for Station Manager.
Note The "Station Configuration Editor" is always available and running on the PC
station where you installed the "SIMATIC NET PC Software".
4.3.1 Overview
The following figure shows the layout of the "Station Configuration Editor".
Figure 4-2
1
© Siemens AG 2020 All rights reserved
1. Components:
The components are the modules and the applications involved in
communications in the PC station. These components require configuration
and project engineering data.
2. Station Manager:
The Station Manager holds the configuration and project engineering data for
the components in the component management (database).
Apart from component configuration, the "Station Configuration Editor" can also be
used for diagnostic purposes.
Unrestricted
In the "Components" tab, you will find the essential functions for configuring a PC
station.
• Assigning the station name
• Creating new components
• Applying the component configuration and project engineering data
• Checks and diagnostics
• Setting the operating mode
The current mode is displayed in the title bar of the "Station Configuration
Editor".
– Offline mode
In offline mode, you can make changes to the configuration only by
entering them directly or by importing the station (XDB file). The "Online
Mode" button is visible; you can press it in order to enter online mode.
© Siemens AG 2020 All rights reserved
– Online mode
In online mode, you have the ability to download project engineering data
directly to the PC station using TIA Portal. You can perform an XDB import
at any time. You can also specify (as an option) whether you want the
"offline mode" to be set following the import.
© Siemens AG 2020 All rights reserved
It is not possible to change the configuration data while the station is locked. The
following functions are locked:
• Station import (XDB file)
• Downloading the PC station via TIA Portal (local or remote)
• Modifying the PC station in the "Station Configuration Editor"
The S7-300 and S7-400 automation systems only support data blocks with
standard access.
Data blocks with optimized access have no predefined structure. In the declaration,
the data elements contain no fixed address within the data block but rather a
symbolic name. The elements are arranged in the block's available storage space
so that no gaps in the storage occur. This achieves optimal utilization of the
storage space.
The tags in this data block are identified by their symbolic names. Enter the
symbolic names of the tags in order to address them.
Optimized block access has the following advantages:
• Increase your engineering efficiency using purely symbolic addressing.
© Siemens AG 2020 All rights reserved
Data blocks with standard access have a fixed structure. In the declaration, the
data elements contain a fixed address within the data block as well as a symbolic
name. The address is shown in the "Offset" column.
The tags in this data block can be addressed symbolically and absolutely.
From version V12 onward, the SIMATIC NET OPC UA server can access
optimized data blocks of the S7-1200 CPU (firmware V4 or higher) and of the
S7-1500 CPU. Optimized data blocks no longer use absolute addresses. It is only
possible to access the tags using their symbolic names. This makes optimized data
blocks more generic, which reduces the possible sources of errors.
The optimized data blocks are located in the namespace of the
SIMATIC NET OPC UA server in the "SYM" folder of the S7-1200 station or
S7-1500 station.
Optimized data blocks are accessed over the network using the new "S7Opt"
protocol.
The default setting makes all S7 connections to S7-1200 CPUs (firmware V4 or
higher) and S7-1500 CPUs optimized S7 connections. S7 connections to S7-1200
CPUs and S7-1500 CPUs are configured in the same manner as with the S7-300
CPUs and S7-400 CPUs, but there are limitations:
• Optimized S7 connections and optimized data blocks can only be used via
OPC UA. DCOM-based clients cannot access optimized data blocks.
• The SIMATIC NET PC software must be V12 or higher.
• Smaller quantity structure for CP1613 A2. Only 40 optimized S7 connections
are possible for this CP.
© Siemens AG 2020 All rights reserved
The protocol can be selected using the URL address of the OPC UA server on the
OPC UA user interface. You have the following two options available.
• OPC UA XML web services by specifying a URL, for example:
– http://<hostname>:80
– https://<hostname>:443
• Pure (native) binary TCP protocol by specifying:
– opc.tcp://<hostname>:4840
XML can be used very easily with common development environments for OPC UA
applications.
The firewall is usually already set to enable port 80 for HTTP and port 443 for
HTTPS or these ports can be enabled easily in it. This means that Internet access
is usually possible for the use of XML Web services without extra configuration.
In OPC UA, the "OPC UA native binary" protocol has the highest transmission
speed because data is transmitted compressed and little packaging information
needs to be used. It requires the least additional effort. For example, no XML
parser is required as is necessary for SOAP and HTTP.
The format is standardized down to the binary level. This stabilizes the data
exchange between the OPC UA client and server since there are no degrees of
freedom (such as blanks or comments in XML) present.
The specially defined TCP port 4840 is used for communication in the "OPC UA
native binary" protocol, while SIMATIC NET OPC server still uses port 55101 to
port 55105, depending on the protocol. These ports can be enabled or disabled in
a firewall.
© Siemens AG 2020 All rights reserved
4.8.1 "Browse"
4.8.2 "Read"
This service is used to obtain one or more attributes of one or more nodes.
4.9.1 "Read"
This service is used to obtain one or more attributes of one or more nodes. With
structured attribute values, whose elements are indexed as in an array, clients can
read the entire set of indexed values, and they can read specific ranges or
individual elements.
How up-to-date the values are is decided by the "maxAge" parameter.
4.9.2 "Write"
This service is used to write values to one or more attributes of one or more nodes.
With structured attribute values, whose elements are indexed as in an array, clients
can write the entire set of indexed values, and they can write specific areas or
individual elements.
The service request remains pending until the values have been written or until it is
recognized that the values cannot be written.
Access for "Read" and "Write" uses the NodeId of the node or nodes. The NodeId
is the identifier of a node in the namespace of OPC UA.
© Siemens AG 2020 All rights reserved
5 Appendix
5.1 Service and support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
https://support.industry.siemens.com
Technical Support
The Technical Support of Siemens Industry provides you fast and competent
support regarding all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts. Please send queries
to Technical Support via Web form:
www.siemens.com/industry/supportrequest
© Siemens AG 2020 All rights reserved
Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
https://support.industry.siemens.com/cs/sc
Table 5-2
Version Date Change
V1.0 05/2014 First version
V2.0 06/2020 Complete revision