Application description
05/2014
S7 Communication between S7 Station and PC Station OPC UA for access to tags of an “optimized data block”
http://support.automation.siemens.com/WW/view/en/67295801
Warranty and liability
Warranty and liability Note
The Application Examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility to use safe practices in application, installation, operation and maintenance. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority. We do not accept any liability for the information contained in this document.
Siemens AG 2014 All rights reserved
Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment. Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of Siemens Industry Sector. Security information
Siemens provides products and solutions with industrial security functions that support the secure operation of plants, solutions, machines, equipment and/or networks. They are important components in a holistic industrial security concept. With this in mind, Siemens’ products and solutions undergo continuous development. Siemens recommends strongly that you regularly check for product updates. For the secure operation of Siemens products and solutions, it is necessary to take suitable preventive action (e.g. cell protection concept) and integrate each component into a holistic, state-of-the-art industrial security concept. Third-party products that may be in use should also be considered. For more information about industrial security, visit http://www.siemens.com/industrialsecurity. To stay informed about product updates as they occur, sign up for a productspecific newsletter. For more information, visit http://support.automation.siemens.com.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
2
Table of contents
Table of contents Warranty and liability ............................................................................................... 2 1
Preliminary Remarks ...................................................................................... 4 1.1 1.2
2
Properties of the Service................................................................................ 7 2.1 2.2 2.2.1 2.2.2
3
Overview ......................................................................................... 12 Creating a PC station and an S7 station........................................... 12 Creating a PC station and an S7 station........................................... 12 Configuring the PC station ............................................................... 13 Configuring the S7 station and the PC station in STEP 7.................. 15 Defining S7 symbols ........................................................................ 20 Making S7 symbols known to the OPC server .................................. 22
Test Setup for the Service............................................................................ 23 4.1 4.2 4.3 4.3.1 4.3.2 4.3.3 4.4 4.4.1 4.4.2 4.4.3 4.4.4 4.5 4.5.1 4.5.2 4.6 4.6.1 4.6.2
Siemens AG 2014 All rights reserved
Characteristics................................................................................... 7 Functional model ............................................................................... 8 Overview ........................................................................................... 8 Symbolic access to the tags in the S7-CPU ....................................... 9
Configuration and Programming ................................................................. 12 3.1 3.1.1 3.2 3.2.1 3.2.2 3.2.3 3.2.4
4
Objective of the collection .................................................................. 4 Content and validity of this document ................................................. 6
Overview ......................................................................................... 23 Hardware and software used ........................................................... 23 Description of downloads ................................................................. 25 User program for S7 CPU ................................................................ 25 Test file ........................................................................................... 25 Watch table ..................................................................................... 26 Installation and startup..................................................................... 26 Loading downloads to PG/PC .......................................................... 26 Installing hardware .......................................................................... 27 Creating an initial state for the S7-CPU ............................................ 28 Loading the S7 station and the PC station........................................ 29 Test case 1: reading and monitoring the S7 tag ............................... 34 Overview ......................................................................................... 34 Operation ........................................................................................ 34 Test case 2: writing an S7 tag .......................................................... 39 Overview ......................................................................................... 39 Operation ........................................................................................ 41
5
Glossary........................................................................................................ 44
6
Related Literature ......................................................................................... 45
7
History .......................................................................................................... 46
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
3
1 Preliminary Remarks 1.1 Objective of the collection
1
Preliminary Remarks The document on hand is part of a collection of entries regarding the topic of SIMATIC NET OPC server. The collection can be found under the following link: \30\.
1.1
Objective of the collection The data exchange between a S7 station and a PC station is the core focus of the collection. The services of the SIMATIC NET OPC server are used for data communication in the PC station. In this context, the collection answers the following questions from the point of view of a SIMATIC user: What functionalities do the services have? How are the services used? Based on concrete examples, it will be illustrated what to do in a STEP 7 project (user program, configuration) in order to use a service. The following services of the SIMATIC NET OPC server are dealt with:
Siemens AG 2014 All rights reserved
Tag services Block-oriented services Block services Server functionality These services are provided for various boundary conditions. The table provides an overview on this matter. Table 1-1 Parameter OPC server type
Versions (D)COM (Data Access) UA
Communication function
S7 communication Open communication services (send/receive)
Network
PROFINET / Industrial Ethernet PROFIBUS
Note
Not all services are available for all variants. For example, the S7 block management service and the S7 server service are only provided for the S7 communication. Details can be found in the programming manual \2\.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
4
1 Preliminary Remarks 1.1 Objective of the collection Each entry of the collection deals with one service of the SIMATIC NET OPC server. An entry consists of the following downloads: Document STEP 7 project SIMATIC NET OPC Scout project The document on the entry contains a theoretical and a practical part: Theory: teaching of basics Practical: practical application on a simple test set up The following image shows the communication partner (test setup) used in the entries. Figure 1-1 PC station: SIMATIC field PG
S7 station: S7-300 / S7-1500
Engineering tool: STEP 7 Configuration tool: SIMATIC NET Station Configuration Editor
S7-CPU
Siemens AG 2014 All rights reserved
OPC client: SIMATIC NET OPC Scout
Data: M0.0, FB10, DB1, etc.
Data Integrated interface OPC server: SIMATIC NET OPC server
Services
Integrated interface
Note
The entries of the collection only give an introduction to the services. Details can be found in the SIMATIC NET manuals (\1\, \2\, \7\).
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
5
1 Preliminary Remarks 1.2 Content and validity of this document
1.2
Content and validity of this document
Content The following service is examined in the document: Tag service, for accessing the tags of a data block with optimized block access The service is used with the following boundary conditions: OPC server type:
UA
Communication function:
S7 communication
Network:
PROFINET / Industrial Ethernet
In the theoretical part (chapter 2 and chapter 3) the basics are explained and in the practical part (chapter 4) the basics are concretely applied on a simple test setup. Validity The statements in the document are valid for:
Siemens AG 2014 All rights reserved
SIMATIC NET, PC Software V12 STEP 7 Professional V12 SP1 Upd2 (TIA Portal)
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
6
2 Properties of the Service 2.1 Characteristics
2
Properties of the Service In this chapter, application, properties and function model of the S7 tag service are described.
2.1
Characteristics SIMATIC NET OPC UA server enables an OPC client in the PC station symbolic access (1*) to the data (tag) in the S7-CPU. The following data (tag) can be accessed by the OPC client in the S7-CPU: Data from data blocks (global data block, instance data block) Flags Inputs and outputs (process image, I/O) Times and counters (*1): When creating a STEP 7 project: Data blocks are created with optimized block access.
Siemens AG 2014 All rights reserved
Tags with symbolic names (S7 symbols) are defined in a tag table. For the automation systems S7-1500 and S7-1200, STEP 7 (TIA Portal) offers data blocks with different access options: Data blocks with optimized access Data blocks with standard access.
Data blocks with optimized access Data blocks with optimized access don’t have a predefined structure. The data elements only obtain a symbolic name in the declaration, no fixed address within the block. In the available memory area of the block, the elements are aligned automatically in such a way that there is no gap in the memory. This makes optimal use the storage capacity. Tags in this block are identified by their symbolic name. In order to address the tags, specify the symbolic name of the tags. The advantage of the optimized block access is that your engineering efficiency increases by mere symbolical programming and, due to the optimized block access, your automation system yield a higher performance.
Data blocks with standard access. Data blocks with standard access have a fixed structure. The data elements contain a symbolic name in the declaration as well as a fixed address within the block. The address is displayed in the “Offset” column. Symbolically, absolute addressing of tags in these data blocks is also possible.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
7
2 Properties of the Service 2.2 Functional model An OPC client can access data of the S7-CPU in different ways: Synchronous reading / writing The OPC client directs a read/write job to the OPC server. The OPC client waits until the OPC server has executed the job. Asynchronous reading / writing The OPC client directs a read/write job to the OPC server. The OPC client does not wait until the OPC server has executed the job. The OPC server reports to the OPC client when the job has been executed. Monitoring of tags When reading (see above) the OPC client transfers a job to the OPC server to find out the value of a tag. When monitoring, the OPC server continuously checks whether the value has changed.
Siemens AG 2014 All rights reserved
Monitoring of the tags does not put any load on the OPC client. The value is only transferred from the OPC server to the OPC client once a change is detected by the OPC server.
2.2
Functional model
2.2.1
Overview
OPC UA protocols According to the standard, the following options are available as protocol at the OPC UA user interface: simple XML/SOAP with http/https via port 80/443 binary TCP via port 4840 (and further ports such as 4845, for example, or port 5000, 6000 etc., if further servers are added) The protocol can be selected via the URL address of the UA server at the OPC user interface. The following two options are available here as an alternative: Examples: OPC UA XML web services, entering a relevant URL, for example: –
http://: 80
–
https://: 443
Mere (native) binary TCP protocol, entering: –
opc.tcp://:4840
On the application layer, the OPC UA function calls are identical. Not every OPC UA server does support all of the protocols.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
8
2 Properties of the Service 2.2 Functional model Access of the OPC client to items of the OPC server Using the S7 tag service, a PC station can access the data of an S7 station. For this purpose, a user program is only required in the PC station: Figure 2-1 PC station
S7 station
OPC client
S7-CPU Data
Tag
User program Access to items
Operating system
Siemens AG 2014 All rights reserved
SIMATIC NET OPC server Items for tag service
The following chapter shows the function model for the symbolic access to the tags in the S7-CPU.
2.2.2
Symbolic access to the tags in the S7-CPU The function models show on a concrete example of how symbolic access from an OPC client to a tag in the S7 CPU is performed. In this example, the following tags are used in the S7-CPU: Table 2-1 Tag in the S7-CPU Address
Symbolic name (S7 symbol)
Tag has no fixed address within the data block.
“DB_optimized”.BOOLVAR
Tag has no fixed address within the data block.
“DB_optimized”.BYTE_VAR
M10.5
Clock_1Hz
Sequence The following figure illustrates the sequence of the communication.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
9
2 Properties of the Service 2.2 Functional model Figure 2-2 PC station
S7 station: S7-1500 station_1 S7-CPU: PLC_1
OPC client Data
2
S7 Symbol: DB_optimized.BOOL_VAR DB_optimized.BYTE_VAR Clock_1Hz
User program Access to item: S7-1500-Station_1.PLC_1.DB_optimized.BOOL_VAR S7-1500-Station_1.PLC_1.DB_optimized.BYTE_VAR S7-1500-Station_1.PLC_1.Clock_1Hz
Operating system
OPC server: SIMATIC NET OPC S7OPT Items
Siemens AG 2014 All rights reserved
1
Explanation on the figure Table 2-2 No.
Action
1.
(1)
The OPC client accesses the tag in the S7-CPU via an item. For this purpose, the OPC client requests jobs from the OPC server. The OPC server executes these jobs. Possible jobs are: reading, writing or monitoring. Prerequisite is that the item was created in the OPC server (see \2\).
2.
(2)
For symbolic access, a data block (DB) or a tag table has to be created in STEP 7. As a standard, “optimized block access” has been activated for the DB. A user program is not required for the access.
Syntax item ID The item IDs in the example are: S7-1500-Station_1.PLC_1.DB_optimized.BOOL_VAR S7-1500-Station_1.PLC_1.DB_optimized.BYTE_VAR S7-1500-Station_1.PLC_1.Clock_1Hz
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
10
2 Properties of the Service 2.2 Functional model Figure 2-3 PC station
to 1
S7 station: S7-1500 station_1 to 2
S7-CPU: PLC_1
OPC client
S7 symbol: DB_optimized.BOOL_VAR DB_optimized.BYTE_VAR Clock_1Hz
Data
3
1
to 3
2 User program Access to item: S7-1500-Station_1.PLC_1.DB_optimized.BOOL_VAR S7-1500-Station_1.PLC_1.DB_optimized.BYTE_VAR S7-1500-Station_1.PLC_1.Clock_1Hz
Operating system
OPC server: SIMATIC NET OPC S7OPT
Siemens AG 2014 All rights reserved
Items
Table 2-3 No.
Part of the item ID
Meaning
(1)
S7-1500-Station_1
S7 station name
(2)
PLC_1
S7-CPU name
(3)
DB_optimized.BOOL_VAR DB_optimized.BYTE_VAR Clock_1Hz
Tag name
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
11
3 Configuration and Programming 3.1 Overview
3
Configuration and Programming
3.1
Overview Below, you find an overview of the required measures:
3.1.1
Creating a PC station and an S7 station
Configuring a PC station in the station configuration editor The PC station is configured with the station configuration editor (\2\): selecting the application (OPC server, ...) selecting the module interface
Creating STEP 7 project The following has to be done in the STEP 7 project: Configure S7 station and PC station
Siemens AG 2014 All rights reserved
Configure S7 connection between S7-CPU and OPC server Making S7 symbols known to the OPC server: –
for optimized block access, the tags are stored symbolically in the data block.
–
the tags defined in the tag table are accessed symbolically
Creating a user program for the S7-CPU Create a data block with optimized block access and appropriate tags. In the tag table you define each tag with a symbolic name (S7 symbol).
Creating a user program for the PC station In the OPC client, the symbolic access to the tag must be programmed (see \2\ chapter 2.6 and \1\ chapter 3.5).
3.2
Creating a PC station and an S7 station This chapter explains the most important operations that have been necessary for creating the STEP 7 project for this entry.
Note
These operations do not have to be executed anymore. They are already included in the download code.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
12
3 Configuration and Programming 3.2 Creating a PC station and an S7 station
3.2.1
Configuring the PC station Proceed as follows: Table 3-1 No.
Action Call up the Station Configuration Editor in Windows via the menu “Start > All Programs > Siemens Automation > Station Configuration Editor”.
2.
Mark index 1 of the PC station and click on the “Add” button.
3.
Enter the following for index 1 of the PC station: Type: OPC server Confirm the settings in the dialog with “OK”.
Siemens AG 2014 All rights reserved
1.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
13
3 Configuration and Programming 3.2 Creating a PC station and an S7 station
Siemens AG 2014 All rights reserved
No.
Action
4.
Component “OPC server” has been added to index 1. Mark index 2 of the PC station and click on the “Add” button.
5.
Enter the following for index 2 of the PC station (*1): Type: IE General Parameter: 82577LM Confirm the settings in the dialog with “OK”.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
14
3 Configuration and Programming 3.2 Creating a PC station and an S7 station No.
Siemens AG 2014 All rights reserved
6.
Action Component “IE General” has been added to index 2.
(*1): a SIMATIC field PG is used as PC station. The connection to the S7 station is performed via the integrated IE interface with the 82577LM card.
3.2.2
Configuring the S7 station and the PC station in STEP 7 Proceed as follows: Table 3-2 No.
Action
1.
Call up STEP 7 (TIA Portal) in Windows via the menu “Start > All Programs > Siemens Automation > TIA Portal V12”.
2.
Create a new project in or open an existing project.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
15
3 Configuration and Programming 3.2 Creating a PC station and an S7 station No.
Action In the project tree you double-click on the “Add new device” command. The “Add new device” dialog opens.
4.
Add a S7 station, for example, CPU 1516-3 PN/DP.
Siemens AG 2014 All rights reserved
3.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
16
3 Configuration and Programming 3.2 Creating a PC station and an S7 station No. 5.
Action Add a new PC station. (1) Select the device category “PC systems”. (2) From the hardware catalog you select the OPC server in “User applications”. (3) For the OPC server you set version “SW V12 …”.
3 2
Siemens AG 2014 All rights reserved
1
6.
In the project tree, you double-click on the “Devices & networks” command. The hardware and network editor opens.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
17
3 Configuration and Programming 3.2 Creating a PC station and an S7 station No. 7.
Action In the hardware and network editor you open the device view of CPU 1516-3 PN/DP. Select the CPU. The properties of the CPU are displayed in the inspector window. (1) In the “General” tab you navigate to the “PROFINET interface [X1]”. (2) Enter the following IP address and subnet mask for the PROFINET interface of the CPU: IP address: 192.168.0.15 Subnet mask: 255.255.0.0
1
Siemens AG 2014 All rights reserved
2
8.
In the hardware and network editor you open the device view of the PC station. Equip the PC station: (1) Application: “OPC server” (*1) (2) Communication module for PROFINET/Ethernet: “IE General”
1 2
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
18
3 Configuration and Programming 3.2 Creating a PC station and an S7 station No. 9.
Action Select the communication module for PROFINET/Ethernet. The properties of the communication module are displayed in the inspector window. (1) In the “General” tab you navigate to the “PROFINET interface [X1]”. (2) Enter the following IP address and subnet mask for the communication module of the PC station: IP address: 192.168.0.100 Subnet mask: 255.255.0.0
1
Siemens AG 2014 All rights reserved
2
10.
In the hardware and network editor you open the network view. Set up the PN/IE subnet.
11.
Add a connection: S7 connection (End points: OPC server / PLC_1)
(*1): In STEP 7 (TIA Portal) the same properties as in the station configuration editor (chapter 3.2.1) have to be configured: Name of the PC station Assignment of slots (index) in the PC station IP address of the PC station
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
19
3 Configuration and Programming 3.2 Creating a PC station and an S7 station
3.2.3
Defining S7 symbols
Adding a data block (DB) with optimized block access Proceed as follows: Table 3-3
Siemens AG 2014 All rights reserved
No.
Action
1.
In the project tree, program block folder of the S7 station, you double-click on the “Add new block” command. The “Add new block” dialog opens.
2.
(1) Select block type “Data block”. (2) Assign a meaningful name to the data block. (3) The data block number can be assigned automatically by STEP 7 (TIA Portal) or manually by the user. Apply the settings with “OK”.
2
3
1
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
20
3 Configuration and Programming 3.2 Creating a PC station and an S7 station No. 3.
Action (1) In project tree you double-click on the newly created data block. This block is opened in the workspace. (2) Add a tag, BOOL_VAR for example, of data type Bool.
1
In the properties of the DB, the “Optimized block” access option has been activated in “Attributes”. This saves the tags symbolically in the DB.
Siemens AG 2014 All rights reserved
4.
2
Defining S7 symbols in the tag table In tag table you define the tags with symbolic names which have not been defined in a data block (DB), such as flags, inputs and outputs, as well as times and counters. Proceed as follows: (1) Open the tag table in the project tree (2) Define the S7 symbol: “Clock_1Hz” In this example, memory byte MB10 has been activated as clock memory in the S7-CPU. A clock memory is automatically entered in the default tag table with a symbolic name.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
21
3 Configuration and Programming 3.2 Creating a PC station and an S7 station Figure 3-1
Siemens AG 2014 All rights reserved
2
1
3.2.4
Making S7 symbols known to the OPC server Proceed as follows: Open the device view of the PC station and select the OPC server. The properties of the OPC server are displayed in the inspector window. (1) In the “General” tab you navigate to “S7 > OPC tags”. (2) Activate the “All” option. This enables you to access to all symbolical S7 tags in the OPC server with the OPC Scout. Figure 3-2
1 2
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
22
4 Test Setup for the Service 4.1 Overview
4
Test Setup for the Service This chapter describes the test setup and the operation for the test cases.
4.1
Overview By means of a simple test setup, the services of the SIMATIC NET OPC server can be applied concretely. This is how experiences with the services can be gained via simple means. The test setup consists of: S7 station and PC station Code (STEP 7 project) Test file (OPC Scout project) The test is performed with: SIMATIC NET OPC Scout V10
Siemens AG 2014 All rights reserved
STEP 7 Professional V12 SP1 Upd2 (TIA Portal)
4.2
Hardware and software used The test setup consists of the following components.
Hardware Table 4-1 Component
Qty.
Article No.
Firmware
CPU1516-3PN/DP
1
6ES7516-3AN00-0AB0
V1.0
SIMATIC S7 MEMORY CARD, e.g. 24 MB
1
6ES7954-8Lx01-0AA0
---
SIMATIC field PG or PC (*1)
1
---
---
(*1): below, referred to as PG/PC. Software The following components have to be installed on the PG/PC. Table 4-2 Component
Type
Article No.
Note
STEP 7 Professional V12
SP1 Upd2
6ES7822-1A.02-..
---
SIMATIC NET PC Software
V12
6GK1704-1LW12-0AA0
SOFTNET-IE S7 LEAN V12 for up to 8 connections SOFTNET-IE S7 V12 for up to 64 connections
6GK1704-1CW12-0AA0
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
23
4 Test Setup for the Service 4.2 Hardware and software used Downloads The following table includes all downloads of the entry (\30\). Table 4-3 Download
File name
Content
67295801_opc_ua_ie_s7_variable_DOKU_V10_en.pdf
Document on hand
Code
67295801_opc_ua_ie_s7_variable_STEP7_V10.zip
STEP 7 project (V12 SP1 Upd2)
Test file
67295801_opc_ua_ie_s7_variable_SCOUT_V10.zip
OPC Scout project (V10)
Siemens AG 2014 All rights reserved
Documentation
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
24
4 Test Setup for the Service 4.3 Description of downloads
4.3
Description of downloads
4.3.1
User program for S7 CPU For access to the S7 tags a user program is not required.
4.3.2
Test file A test environment for the S7 tag services is prepared in the download test file (chapter 4.2). The test file is used by the SIMATIC NET OPC Scout. SIMATIC NET OPC Scout is a tool for commissioning and testing an OPC system. The following items are defined in the test file (Figure 4-1): For accessing the tag in the data block (DB) with optimized block access: –
BOOL_VAR
–
BYTE_VAR
For accessing the S7 symbols in the tag table
Siemens AG 2014 All rights reserved
–
Clock_1Hz
Figure 4-1
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
25
4 Test Setup for the Service 4.4 Installation and startup (1) The test file includes a DA view, in which you have access to the items. (2) Access options: monitoring, reading, writing Figure 4-2 2
4.3.3
1
Watch table For test purposes, the STEP 7 project includes a watch table. (1) Three S7 tags have been created in the watch table: (2) The S7 tags of the S7-CPU can be written and monitored there.
Figure 4-3
Siemens AG 2014 All rights reserved
1 2
4.4
Installation and startup The following steps are required for the installation of the test setup: Loading downloads to PG/PC Installing hardware Create a defined initial state for the S7-CPU Loading the S7 station and the PC station
4.4.1
Loading downloads to PG/PC The following downloads (chapter 4.2) are required: Code (STEP 7 project) Test file (OPC Scout project)
Code For the installation on the PG/PC, the following operations are required: Load the “67295801_opc_ua_ie_s7_variable_STEP7_V10.zip” file into any directory on the PG/PC. Unzip the file.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
26
4 Test Setup for the Service 4.4 Installation and startup Test file For the installation on the PG/PC, the following operations are required: Load the “67295801_opc_ua_ie_s7_variable_SCOUT_V10.zip” file into any directory on the PG/PC. Unzip the file.
4.4.2
Installing hardware The required components are listed in chapter 4.2. The following table shows the procedure for the configuration of the hardware.
Table 4-4 No.
Hardware
Action S7 station
1.
S7-CPU and memory card
Insert the memory card into the S7-CPU.
2.
S7-1500 mounting rail
Install the power supply and the S7-CPU onto the profile rail.
3.
Power supply
Establish all of the required connections.
Siemens AG 2014 All rights reserved
PC station 4.
PG/PC
---
5.
PROFINET / Ethernet cable
Connect the S7-CPU with the PG/PC (IE-2 interface).
The figure shows a schematic illustration of the test setup. Figure 4-4
S7 station CPU 1516-3 PN/DP
192.168.0.15 255.255.255.0
P1
PC station PG/PC
Integrated PROFINET interface
P2
2x Ethernet connection
IE-1
STEP 7 SIMATIC NET OPC
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
IE-2
192.168.0.100 255.255.255.0
27
4 Test Setup for the Service 4.4 Installation and startup
4.4.3
Creating an initial state for the S7-CPU In the initial state, the S7-CPU has the following properties: The memory card of the S7-CPU has been deleted. S7-CPU on factory settings Requirement: PG/PC is connected with the S7-CPU via the PROFINET interface. STEP 7 Professional V12 SP1 Upd2 is installed on the PG/PC, a STEP 7 project is opened.
Restoring the factory settings of the S7-CPU Proceed as follows: Table 4-5
Siemens AG 2014 All rights reserved
No.
Action
1.
In the project tree you select the created S7-CPU.
2.
Click on the “Accessible devices” button in the toolbar.
3.
In the “Accessible devices” window: Select the line with the CPU. Click on the “Show” button.
4.
In the project tree the “Online access” folder opens: There you open “Online & diagnostics”. Select: “Functions > Reset to factory settings” Activate the “Delete IP address” option and click on the “Reset” button.
Result: IP address and PROFINET device name have been deleted. Main memory, internal load memory and all the operand areas are deleted All parameters are reset to their default settings. The diagnostics buffer is deleted. The clock is reset. The I&M data is deleted with the exception of the I&M0 data. The operating hours counters are reset.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
28
4 Test Setup for the Service 4.4 Installation and startup Deleting the memory card of the S7-CPU Proceed as follows: Table 4-6 No.
Action
1.
In the project tree you select the created S7-CPU.
2.
Click on the “Accessible devices” button in the toolbar.
3.
In the “Accessible devices” window: Select the line with the CPU. Click on the “Show” button.
4.
In the project tree, the “Online access” folder opens: There you open “Online & diagnostics”. Select: “Functions > Format memory card”. Click on the “Format” button.
Result: The memory card is formatted.
Siemens AG 2014 All rights reserved
The S7-CPU is temporarily not accessible. The project data in the S7-CPU is deleted with the exception of the IP address.
4.4.4
Loading the S7 station and the PC station Requirement: The S7-CPU is in initial state (chapter 4.4.3). PG/PC is connected with the S7-CPU via the PROFINET interface. Preparation: Assign IP address and subnet mask of the S7-CPU Set IP address and subnet mask of the network card (82577LM) on the PG/PC
Assign IP address and subnet mask of the S7-CPU At the display of the S7-CPU, via menu “Settings > Addresses > X1 (PN/IE)”, you set IP address and the subnet mask you have entered in the configuration: IP address:
192.168.0.15
Subnet mask:
255.255.255.0
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
29
4 Test Setup for the Service 4.4 Installation and startup Set IP address and subnet mask of the network card (82577LM) on the PG/PC Proceed as follows: Table 4-7 No.
On your PG/PC you open the properties of the network card (82577LM) in Windows via which the PG/PC is connected with the S7-CPU: In Control Panel, go to “Control Panel > Network and Internet > Network & Sharing Center” Select the “Change Adapter Settings” function. Right-click on the respective network card (82577LM) and select the “Properties” context menu. Set IP Address and Subnet mask according to your configuration. – IP address: 192.168.0.100 – Subnet mask: 255.255.255.0
Siemens AG 2014 All rights reserved
1.
Action
Loading the S7 station and the PC station Proceed as follows: Table 4-8 No.
Action
1.
Start the TIA Portal.
2.
Open the project view.
3.
Open the STEP 7 project. OPC_UA.ap12
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
30
4 Test Setup for the Service 4.4 Installation and startup No.
Action
4.
In the project tree, you select the device folder of the S7-CPU.
5.
Select the “Online > Download and reset PLC program” menu to load the hardware configuration and software into the CPU.
6.
In the “Extended download to device” window: (1) Set the access to the destination subnet: Type of the PG/PC interface: PN/IE PG/PC interface: network card (82577LM) Connection to subnet: PN/IE_1 (2) Activate the “Show all compatible devices” option. (3) In the “Compatible devices in target subnet” table you activate the “S7-1500” line. (4) Click on the “Load” button.
Siemens AG 2014 All rights reserved
1
2
3
4
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
31
4 Test Setup for the Service 4.4 Installation and startup No. 7.
Action In the “Load preview” window: (1) Select the “Stop all” action for the “Stop modules” function. (2) Click on the “Load” button.
1
2
In the “Load results” window you click on the “Finish” button.
Siemens AG 2014 All rights reserved
8.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
32
4 Test Setup for the Service 4.4 Installation and startup No. 9.
Action In the hardware and network editor you open the device view of the PC station. Select the PC station. The properties of the PC station are displayed in the inspector window. (1) In the “General” tab you navigate to “SIMATIC PC Station”. (2) Activate the “Generate XDB file” option and set the path in which the XDB file is stored. 2
Siemens AG 2014 All rights reserved
1
10.
In the project tree, you select the device folder of the PC station. Click on the "Compile" button in the toolbar. The XDB file is generated and stored at the set path.
11.
Open the Station Configuration Editor. Load the configuration of the PC station by importing the XDB file: click on the “Import Station” button. After loading the configuration, the modules are in RUN mode and the configured S7 connection is loaded. This is displayed via the respective symbols in the “Run/Stop” and “Conn” columns.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
33
4 Test Setup for the Service 4.5 Test case 1: reading and monitoring the S7 tag
4.5
Test case 1: reading and monitoring the S7 tag
4.5.1
Overview The test is performed with the following on the PG/PC: SIMATIC NET OPC Scout V10 STEP 7 Professional V12 SP1 Upd2 (TIA Portal) Principle: (1) Write S7 tag in STEP 7 (TIA Portal) (2) Read/monitor S7 tag in OPC Scout Figure 4-5 PC station
S7 station
STEP 7 Professional V12 SP1 Upd2 Watch table Write
Siemens AG 2014 All rights reserved
1
SIMATIC NET OPC Scout V10 DA view 2
Read / monitor S7-CPU
SIMATIC NET OPC S7OPT Item
4.5.2
Data
S7 tag
Operation Sequence: Writing with STEP 7 (TIA Portal) Monitoring with OPC Scout Reading with OPC Scout
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
34
4 Test Setup for the Service 4.5 Test case 1: reading and monitoring the S7 tag Writing with STEP 7 Proceed as follows: Table 4-9 No.
Action
1.
Open the project in STEP 7 (TIA Portal): OPC_UA.ap12
2.
(1) Open the watch table: Watch_table_1. (2) Enter a value. (3) Click on the button for controlling.
3
Siemens AG 2014 All rights reserved
2
1
3.
Result: the S7 tag is set with the value in the S7-CPU.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
35
4 Test Setup for the Service 4.5 Test case 1: reading and monitoring the S7 tag Monitoring with OPC Scout Proceed as follows: Table 4-10 No.
Action Open the project below in the OPC Scout: OPC_DB_optimized.opf. Create a new project.
2.
Start the UA server: opc.tcp://User-PC:4850 [OPC.SimaticNET.S7OPT]
Siemens AG 2014 All rights reserved
1.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
36
4 Test Setup for the Service 4.5 Test case 1: reading and monitoring the S7 tag
Siemens AG 2014 All rights reserved
No.
Action
3.
In the server explorer, after you have created a new project, you navigate to: “UA server > opc.tcp://User-PC:4850 [OPC.SimaticNET.S7OPT] > Objects > SYM: > S7-1500-Station_1 > PLC_1” Add the desired S7 tag to the DA view of the OPC Scout via drag & drop.
4.
(1) Click on the “Monitoring” button. (2) Result: the S7 tags from the S7-CPU are displayed.
1
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
2
37
4 Test Setup for the Service 4.5 Test case 1: reading and monitoring the S7 tag Reading with the OPC Scout Proceed as follows: Table 4-11 No.
Action Open the project in the OPC Scout: OPC_DB_optimized.opf. Or create a new project.
2.
Start the UA server: opc.tcp://User-PC:4850 [OPC.SimaticNET.S7OPT]
Siemens AG 2014 All rights reserved
1.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
38
4 Test Setup for the Service 4.6 Test case 2: writing an S7 tag
Siemens AG 2014 All rights reserved
No.
Action
3.
In the server explorer, after you have created a new project, you navigate to: “UA server > opc.tcp://User-PC:4850 [OPC.SimaticNET.S7OPT] > Objects > SYM: > S7-1500-Station_1 > PLC_1” Add the desired S7 tag to the DA view of the OPC Scout via drag & drop.
4.
(1) Click on the “Read” button. (2) Result: the S7 tags from the S7-CPU are displayed. 1
4.6
Test case 2: writing an S7 tag
4.6.1
Overview
2
The test is performed with the following on the PG/PC: SIMATIC NET OPC Scout V10 STEP 7 Professional V12 SP1 Upd2 (TIA Portal)
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
39
4 Test Setup for the Service 4.6 Test case 2: writing an S7 tag Principle: (1) Write S7 tag in OPC Scout (2) Monitor S7 tag in STEP 7 (TIA Portal) PC station
S7 station
STEP 7 Professional V12 SP1 Upd2 Watch table 2
Monitor
SIMATIC NET OPC Scout V10 DA view S7-CPU 1
Write
SIMATIC NET OPC S7OPT Data
S7 tag
Siemens AG 2014 All rights reserved
Item
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
40
4 Test Setup for the Service 4.6 Test case 2: writing an S7 tag
4.6.2
Operation Sequence: Writing with OPC Scout Monitoring with STEP 7 (TIA Portal)
Writing with OPC Scout Proceed as follows: Table 4-12 No.
Action Open the project below in the OPC Scout: OPC_DB_optimized.opf. Or create a new project.
2.
Start the UA server: opc.tcp://User-PC:4850 [OPC.SimaticNET.S7OPT]
Siemens AG 2014 All rights reserved
1.
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
41
4 Test Setup for the Service 4.6 Test case 2: writing an S7 tag
Siemens AG 2014 All rights reserved
No.
Action
3.
In the server explorer, after you have created a new project, you navigate to: “UA server > opc.tcp://User-PC:4850 [OPC.SimaticNET.S7OPT] > Objects > SYM: > S7-1500-Station_1 > PLC_1” Add the desired S7 tag to the DA view of the OPC Scout via drag & drop.
4.
(1) Enter a new value for the S7 tag. (2) Click on the “Write” button. (3) Result: the S7 tag is written
2
3
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
1
42
4 Test Setup for the Service 4.6 Test case 2: writing an S7 tag Monitoring with STEP 7 Proceed as follows: Table 4-13 No.
Action
1.
Open the project in STEP 7 (TIA Portal): OPC_UA.ap12
2.
(1) Open the watch table: Watch_table_1. (2) Click on the button for monitoring. (3) Result: the tags from the S7-CPU are displayed.
2
Siemens AG 2014 All rights reserved
3
1
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
43
5 Glossary
5
Glossary
Table 5-1
Siemens AG 2014 All rights reserved
Abbreviation / term in the document
Meaning
OPC Scout V10
The OPC Scout V10 is an OPC client used as a tool for commissioning and checking an OPC system.
OPC UA
OPC unified architecture Completely revised and expanded version of the OPC standard (OPC (D)COM) so far.
PG/PC
SIMATIC Field PG or PC
PN/IE
PROFINET / Industrial Ethernet
Server / Client
Server: reacting process which edits requests and jobs Client: initiating process which sends requests and gives out jobs
Station Configuration Editor
The station configuration editor enables access to the station manager of the PC station. Components are: modules applications involved in communication tasks The station manager automatically recognizes the existing modules in the PC station and offers them to be accepted in the station configuration through the station configuration editor.
STEP 7 project
A STEP 7 project consists of: User program (OB1, ...)
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
44
6 Related Literature
6
Related Literature
Table 6-1 Topic
Link
\1\
SIMATIC NET Industrial communication with PG/PC Volume 1 Basics
http://support.automation.siemens.com/WW/view/en/42783968
\2\
SIMATIC NET Industrial communication with PG/PC Volume 2 Interface Programming Manual
http://support.automation.siemens.com/WW/view/en/42783660
\4\
Performance data SIMATIC NET OPC server
http://support.automation.siemens.com/WW/view/en/45351400
\5\
CP-CPU communication with SIMATIC controllers (compendium)
http://support.automation.siemens.com/WW/view/en/20982954
\6\
Sales / Delivery release SIMATIC NET DVD V12
http://support.automation.siemens.com/WW/view/en/78822814
\7\
SIMATIC NET Industrial Communication Commissioning PC Station – Manual and Quick Star
http://support.automation.siemens.com/WW/view/en/61630799
Siemens AG 2014 All rights reserved
General
OPC Applications \10\
Controlling with the PC The SIMATIC NET OPC Inproc Server as DP Master
http://support.automation.siemens.com/WW/view/en/21045282
\11\
Individually programmed signaling system based on the SIMATIC NET OPC alarm and event/OPC UA server
http://support.automation.siemens.com/WW/view/en/26548467
\12\
OPC: Individual Visualization with OPC Based on Microsoft®.NET and the Programming Language C#
http://support.automation.siemens.com/WW/view/en/21043779
\13\
Programming an OPC UA.NET Client with C# for the SIMATIC NET OPC UA Server
http://support.automation.siemens.com/WW/view/en/42014088
\14\
OPC DA Client for Simple Plant Visualization via Standard Web Browser
http://support.automation.siemens.com/WW/view/en/24272005
\15\
OPC Communication via the SEND/RECEIVE Protocol with a Visual Basic .NET OPC Client
http://support.automation.siemens.com/WW/view/en/21523291
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
45
7 History
\16\
Topic
Link
External Block Management with S7 Block Management Services of the SIMATIC NET OPC Server
http://support.automation.siemens.com/WW/view/en/21495347
Document on hand \30\
7
Collection of entries regarding the subject data communication with the SIMATIC NET OPC server
http://support.automation.siemens.com/WW/view/en/67295801
History Table 7-1 Date
V1.0
02/2014
Modifications First version
Siemens AG 2014 All rights reserved
Version
S7 Communication between S7 Station and PC Station Entry-ID: 67295801, V1.0, 05/2014
46