Warranty and Liability
OPC Client 1500
Entry-ID: 109737901, V1.3, 02/2018
2
Siemens AG 2017 All rights reserved
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.
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 the Siemens AG.
Security
informa-
tion
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 only form one element of such a
concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines
and networks. Systems, machines and components should only be connected to the
enterprise network or the internet if and to the extent necessary and with appropriate
security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and
to always use the latest product versions. Use of product versions that are no longer
supported, and failure to apply latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security
RSS Feed under http://www.siemens.com/industrialsecurity.
Table of Contents
OPC Client 1500
Entry-ID: 109737901, V1.3, 02/2018
3
Siemens AG 2017 All rights reserved
Table of Contents
Warranty and Liability ................................................................................................. 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Mode of operation ................................................................................ 5
1.3 Components used ................................................................................ 7
2 Engineering ........................................................................................................ 8
2.1 Configuring the OPC UA server of the S7-1500 .................................. 8
2.1.1 Enabling the OPC UA server ............................................................... 8
2.1.2 Enabling global security settings ........................................................ 10
2.1.3 Configuring OPC UA security policies (server endpoints) ................. 11
2.1.4 Security via certificate management (optional) .................................. 12
2.1.5 Creating user for the OPC UA server ................................................. 14
2.1.6 Enabling tags for the OPC UA communication .................................. 15
2.2 Programming the OPC UA client example ......................................... 16
2.2.1 OPC UA Client S7-1500 ..................................................................... 16
2.2.2 UAClientHelperAPI ............................................................................. 19
2.2.3 Sequence diagram for the client example .......................................... 22
2.3 Operation ............................................................................................ 28
2.3.1 Description of the user interface ........................................................ 28
2.3.2 Commissioning the OPC UA server of the S7-1500 .......................... 34
2.3.3 Commissioning the OPC UA Client S7-1500 ..................................... 34
2.3.4 Creating, exporting and loading client certificate into the S7-
1500 (optional) ................................................................................... 35
2.3.5 Establishing a connection to the OPC UA server .............................. 38
2.3.6 Browsing the address space of the OPC UA server .......................... 40
2.3.7 Reading/writing tags ........................................................................... 40
2.3.8 Subscriptions ...................................................................................... 42
2.3.9 Reading and writing structures/UDTs ................................................ 43
2.3.10 Calling methods .................................................................................. 43
3 Valuable Information ....................................................................................... 46
3.1 Basics ................................................................................................. 46
3.1.1 General OPC UA information ............................................................. 46
3.1.2 OPC UA address space ..................................................................... 47
3.1.3 OPC UA Security ................................................................................ 50
3.1.4 OPC UA server of the S7-1500 .......................................................... 52
3.2 TIA Portal project details .................................................................... 53
3.2.1 S7-1500 and OPC UA configuration .................................................. 53
3.2.2 S7 program ......................................................................................... 53
3.3 License model for OPC UA .NET stack/SDK ..................................... 54
4 Appendix .......................................................................................................... 55
4.1 Siemens services ............................................................................... 55
4.2 Links and literature ............................................................................. 56
4.3 Change documentation ...................................................................... 56
1 Introduction
OPC Client 1500
Entry-ID: 109737901, V1.3, 02/2018
4
Siemens AG 2017 All rights reserved
1 Introduction
1.1 Overview
OPC UA (Open Platform Communications Unified Architecture) is an M2M
communication protocol adopted in 2009 that was specified by the OPC
foundation. The OPC specification has been developed to create an interoperable,
secure and reliable communication protocol. Based on these properties OPC UA
increasingly prevails as standard in the industrial environment.
With the current firmware of SIMATIC S7-1500 an integrated OPC UA Server has
been added to the control system. This enables an additional option of direct
process data exchange of the SIMATIC S7-1500 with a wide variety of other
systems that support OPC UA.
Content of this application example
In order to exchange data with the server of the SIMATIC S7-1500 via OPC UA,
this application example will show you how to create a simple client in .Net.
Moreover, it explains step by step how to configure the OPC UA server of the
SIMATIC S7-1500.
Figure 1-1
SIMATIC S7-1500Windows PC/PG
OPC UA client example OPC UA server
OPC UA
Advantages of the application example
This application example offers you the following advantages:
Expandable TIA project with preconfigured OPC UA server for a SIMATIC S7-
1500
A simple and expandable OPC UA client, created in C# for .NET
A commented C# class that summarizes the OPC UA client basic functions
and guarantees easy implementation
1 Introduction
OPC Client 1500
Entry-ID: 109737901, V1.3, 02/2018
5
Siemens AG 2017 All rights reserved
Assumed knowledge
The following basic knowledge is required by the user:
Basics of programming in C#/.NET
Basics of configuring in the TIA Portal
Basics of OPC
Basics in software security and certificate handling
1.2 Mode of operation
Below, you will find an explanation of what components, functions and mode of
operations are used in the application example.
General function description
The following figure shows the most important components of this application
example:
Figure 1-2
SIMATIC S7-1500Windows PC/PG
Industrial Ethernet
OPC UA client example OPC UA server
OPC UA
UAClientHelperAPI
OPC UA .NET Stack
A simple OPC UA .NET client for Windows PCs/PGs communicates with the OPC
UA server of a SIMATIC S7-1500.
The client supports the following OPC UA service sets:
Searching and finding servers: Discovery Service Set (FindServers,
GetEndpoints)
Creating and ending sessions: Sessions Service Set (CreateSession,
CloseSession)
Navigating in the address space: View Service Set (Browse, RegisterNodes,
UnregisterNodes)
Reading and writing tags and attributes: Attribute Service Set (Read, Write)
Subscribing to tags: Subscription Service Set (CreateSubscription,
DeleteSubscription); MonitoredItem Service Set (CreateMonitoredItem,
DeleteMonitoredItem)
Calling methods: Method Service Set (GetMethodArguments, CallMethod)