Sie sind auf Seite 1von 34

Application for Communication

Visual Basic .NET OPC Client for the XML-DA


Interface of the SIMATIC NET OPC Server

Demonstration
Warranty, Liability and Support

Data Exchange via XML-DA Entry-ID: 21402169

Warranty, Liability and Support

We accept no liability for 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 document 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”).
However, claims arising from a breach of a condition which goes to the root
of the contract shall be limited to the foreseeable damage which is intrinsic
to the contract, unless caused by intent or gross negligence or based on
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

mandatory liability for injury of life, body or health. The above provisions
does not imply a change in the burden of proof to your detriment.
Copyright © Siemens AG 2005 All rights reserved

The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. They 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 in safely and professionally using, installing,
operating and servicing equipment. By using this application example you
accept that Siemens is not liable for any damages except for those
specified in the above liability clause. 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 this
application example and other Siemens publications – e.g. Catalogs – the
contents of the other documents have priority.

Copyright© 2004 Siemens A&D. Any form of duplication or


distribution of these application examples or excerpts hereof is
prohibited without the expressed consent of Siemens Energy &
Automation, Inc.

For questions about this document please use the following e-mail address:

mailto:csweb@ad.siemens.de

V1.0 26.04.05 2/34


Foreword

Data Exchange via XML-DA Entry-ID: 21402169

Foreword
Objectives of the application
Exchanging process data between logic controllers and computers via OPC
is a core element of automation technology.
The application on hand shows a possible procedure for independently
generating individual OPC clients using the programming language Visual
Basic .NET by Microsoft.
A visualization of a mixed process is hereby realized in Visual Basic .NET.
The programming paradigm ".NET“ by Microsoft is used here.

Main contents of this application


The following teaching materials are provided with this application:
• Installation and configuration of a web server (in this example the web-
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

server of the internet information services of Windows). This web server


Copyright © Siemens AG 2005 All rights reserved

is used for accessing the OPC server.


• Highlighting safety aspects (authentication and authorization of clients)
for accessing the web-server and the OPC XML-DA web service.
• Demonstration in dealing with web services in .NET, especially the OPC
XML-DA web service.
• Demonstration of the most important OPC XML-DA methods for
accessing the process variables
• Demonstration of error handling with .NET
• Generating an OPC client as Windows application as well as ASP.NET
web application (for calling a web browser) with similar function range.

Delimitation
This application does not contain a complete description
• of network safety aspects (encoded communication via SSL, application
of firewalls, using VPNs)
• of the .NET framework,
• of the OPC specification as well as
• deeper level ASP.NET mechanisms
Therefore, basic knowledge in the area of object oriented programming is
required. Further knowledge in UML (Unified Modelling Language) is an
advantage.

V1.0 26.04.05 3/34


Foreword

Data Exchange via XML-DA Entry-ID: 21402169

Structure of the document


The documentation of this application is divided into the following main
parts:
• Introduction
• Extension
• Demonstration
In addition, two setup programs (for application in Windows and ASP.NET
respectively), which also contain the source code of the application, as well
as the STEP 7 code, are available.
This third document, the Demonstration part, is aimed at persons who
want to gain a quick overview.
Part Description
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Introduction Provides a general overview of the contents. You


Copyright © Siemens AG 2005 All rights reserved

Application Description will learn about the components used (standard


and Function Principles hardware and software components and the
specially created software).
Extension Function Principles in detail and Program Structure
Discusses the detailed function processes of
the involved hardware and software components,
the solution structures, and where sensible the
concrete implementation of this application.
This part is necessary if you want to learn about
the interaction of the solution components, for
example in order to use them as the basis for own
development.
Demonstration This part leads you step by step through the
Structure, Configuration structure, important configuration steps,
and Operation of the commissioning and operation of the application.
Application

An additional component available is the S7 program code.


Part Description
Installs the Windows application on your PC. The
Setup Program of the
source code of the application is available in the
Windows Application
program directory.
Installs the ASP.NET application on your PC. The
Setup Program of the
source code of the application is available in the
ASP.NET Application
program directory.
The S7 program code contains the code and a user
S7 program code
interface.

V1.0 26.04.05 4/34


Foreword

Data Exchange via XML-DA Entry-ID: 21402169

Reference for Automation and Drives Service & Support


This entry originates from the internet application portal of the A&D Service
and Support. The following link takes you directly to the download page of
this document.
http://support.automation.siemens.com/WW/view/en/21402169
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc
Copyright © Siemens AG 2005 All rights reserved

V1.0 26.04.05 5/34


Foreword

Data Exchange via XML-DA Entry-ID: 21402169

Table of Contents
Table of Contents ......................................................................................................... 6
Introduction................................................................................................................... 7
1 Document on Hand .................................................................................... 7
Setup and Operation of the Application ..................................................................... 8
2 Installation and Commissioning............................................................... 8
2.1 Setup of the hardware.................................................................................. 8
2.2 Installation of the standard software .......................................................... 11
2.3 Installation of the application software ....................................................... 13
2.4 Configuration of the Internet Information Services ..................................... 15
2.5 Configuring the access protection.............................................................. 17
2.6 SIMATIC side configuration of the stations ................................................ 22
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

3 Operating the Application ....................................................................... 26


Copyright © Siemens AG 2005 All rights reserved

3.1 Windows application .................................................................................. 26


3.2 The ASP.NET application .......................................................................... 30
Appendix and List of Further Literature ................................................................... 34
4 Literature................................................................................................... 34
4.1 Bibliographic References ........................................................................... 34
4.2 Internet links............................................................................................... 34

V1.0 26.04.05 6/34


Introduction
Document on Hand

Data Exchange via XML-DA Entry-ID: 21402169

Introduction

1 Document on Hand
This document is the setup and operating instruction for the application
"OPC Client for XML-DA interface of the SIMATIC NET OPC Server".
The documents Introduction and Extension describe the basic setup of
the application and the employed function components, as well as their
interaction within this application.
The document on hand only discusses setup and operation of the example
application.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc
Copyright © Siemens AG 2005 All rights reserved

V1.0 26.04.05 7/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

Setup and Operation of the Application


Content
This part leads you step by step through setup, commissioning and
operation of the Windows application and the ASP.NET application of this
application example.

2 Installation and Commissioning


Here you will find information on …
the hardware and software to be installed, and the steps necessary for
commissioning the example. Installing and configuring the software on the
head-end requires administrator rights.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

2.1 Setup of the hardware


Copyright © Siemens AG 2005 All rights reserved

Setting up the controller (S7 station)


The description and manuals as well as delivery information contained in
the delivery scope of the respective products, should be followed in any
case.
For commissioning the S7 hardware for this application please proceed as
follows:
Table 2-1
No. Instructions
1 Mount the
• PS 307 5A power supply
• central controller module CPU 315-2DP
• communications processor CP 343-1
on a mounting rail (connect CPU 315-2DP and CP 343-1 via bus connector)
2 Connect CPU 315-2DP to the power supply.
3 Connect the power supply to the corresponding supply voltage.

Note The setup guidelines for SIMATIC S7 must generally be followed. Please
see /4/.

V1.0 26.04.05 8/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

Bus cabling
For the demonstration of this application, the controller (S7 station), the
head-end station (Rack-PC) and the visualization station (PG/PC) must be
connected to a joint Ethernet network.
Proceed by connecting the Ethernet connections of the individual stations
to a hub via the standard Ethernet line (device for inter-connecting several
Ethernet stations).

Note It is not advised to connect the individual stations to an existing network


(e.g. office network) for demonstration purposes, as the operation of an
internet server (on the head-end) should never be performed without
permission of the respective network administrator.

Adjusting the IP addresses for visualization station and head-end


21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

As soon as the three stations of this application are interconnected with a


Copyright © Siemens AG 2005 All rights reserved

hub, the IP addresses must be adjusted so they can communicate with


each other. Proceed by performing the following steps (first for the
visualization station, then the same steps for the head-end).

Note When using the IP addresses, used in this example, for individual
stations, no adjustment needs to be made at the STEP 7 example project
later on.

Table 2-2
No. Instructions
1. Open the properties dialog of the LAN connection used by you via:
Start Æ Settings Æ Network Æ right mouse-click on LAN
Connection Æ Local Area Connection Properties

V1.0 26.04.05 9/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions
2. In the list you select the entry
Internet
Protocol(TCP/IP) and
press the Properties
button

Note
If the Internet
Protocol(TCP/IP) entry is
not contained in the list, it must
be added with Install...
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc
Copyright © Siemens AG 2005 All rights reserved

3. On both stations you select the


option Use the following
IP address

4. For visualization station and head-end you enter two different IP addresses,
which only differ in the far right digit, e.g. “10.0.0.1“ for the visualization
station and “10.0.0.2“ for the head-end.
Please ensure, that the IP addresses selected by you are unique in the
connected network, and that the addresses are located in the same subnet.
5. Please enter the same sub-net mask for both stations, e.g. “255.255.255.0“
6. Confirm the opened dialogs with OK.

V1.0 26.04.05 10/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

2.2 Installation of the standard software

Installation of the Internet Information Services


For installing the IIS on the head-end, please follow the following steps.
Please have your Windows installation CD ready for the installation. The IIS
must be installed before installing Microsoft .NET Frameworks 1.1. If .NET
Framework has already been installed beforehand, please observe the note
at the end of the following table.
Table 2-3
No. Instructions
1. Open the "Software" window by selecting:
Start Æ Settings Æ Control Panel Æ Software
2. Select Add/Remove Windows Components.
3. Select the components list Internet Information Services(IIS).
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

4. Click the Details... button to open the Internet Information


Services (IIS) dialog.
Copyright © Siemens AG 2005 All rights reserved

5. Select the following options from the list of subcomponents:


• Common Files
• Internet Information Services Snap-In
• WWW service (leave the default setting here)
Confirm your selection with "OK".
6. Click Next > to start installation and follow the instructions of the installation
program.
7. When using the head-end in live production, you must ensure, that the
current version of the Internet Information Services has been installed.
Using the link http://windowsupdate.microsoft.com/ you can check from the
head-end whether important updates for the IIS exist.
You can also download and install existing updates manually at
www.microsoft.com/technet/security/current.aspx or
www.microsoft.com/downloads.

Note If "Microsoft .NET Framework 1.1" was already installed before the
installation of IIS (Framework is listed in the "Software" dialog box of the
system controller, e.g. due to an installation of the SIMATIC NET
software V6.2), please proceed as follows:
1. Open the DOS prompt by selecting: Start Æ Run Æ enter „cmd“ Æ OK
2. Enter
"%systemroot%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis –i" and
press the Return key.
3. Reboot the PC.

V1.0 26.04.05 11/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

SIMATIC NET PC Software


The SIMATIC NET PC software (incl. SIMATIC NCM) as well as the license
for the IE SOFTNET-S7 will be installed on the head-end. The software
package includes all tools required to install and operate a PC station.
A description of the installation of the SIMATIC NET PC software is not
given here. The installation takes place in the familiar Windows
environment and is self-explanatory. Please follow the installation
instruction on the SIMATIC NET CD.
From SIMATIC NET V6.1 upward, the process “Advanced PC
Configuration” is used for the commissioning of PC stations. It enables the
configuration of PC stations directly in STEP 7. Prior to the use of
“Advanced PC Configuration” we strongly recommend to read manual /3/
“SIMATIC NET Commissioning PC Stations – Quick Start”.

Note The required Microsoft .NET Framework is automatically installed by the


21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

installation program of the SIMATIC NET PC software (from V6.2 SP1).


Copyright © Siemens AG 2005 All rights reserved

V1.0 26.04.05 12/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

2.3 Installation of the application software

Installation of the STEP 7 example project


To open the STEP 7 project and to adjust it to your specific system
configuration please follow the instructions given below: These steps are
performed on the PG/PC (of the visualization station).
Table 2-4
No. Instructions Note
1. Copy the archived STEP 7 project
“21402169_OPC_XML-DA_STEP7_v10.zip“ into a
temporary directory.
2. Open the SIMATIC Manager.
3. Extract the archive “21402169_OPC_XML- The STEP 7-Projekt
DA_STEP7_v10.zip“ via the menu File > "315_OPC" is extracted.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Retrieve...
Copyright © Siemens AG 2005 All rights reserved

4. Close the SIMATIC Manager

Installation of the Windows application


The installation of the Windows application occurs two times. For the local
visualization, the program is installed on the head-end as well as on the
visualization station for remote visualization.
If you wish to use the ASP.NET application only, you need not install the
Windows application and can continue with the next section. However, you
can also operate the Windows and the ASP.NET application parallel.
Table 2-5
No. Instructions Note
5. Copy the .zip-file contained in the delivery scope
"21402169_OPC_XML-DA_WIN_CODE_v10.zip " into
a directory on the respective PC.
6. Extract the contained files into a temporary directory.
7. Execute the "Setup.exe" file and follow the installation
instructions of the installation program.

Note
If .NET-Framework has not been installed yet, the
setup program will notify you of this and offer a link
where you can download .NET-Framework from the
internet.

V1.0 26.04.05 13/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

Installation of the ASP.NET application


The ASP.NET application is only installed on the head-end. An installation
on the visualization station is not necessary.
Table 2-6
No. Instructions Note
1. Copy the .zip-file contained in the delivery scope
"21402169_OPC_XML-DA_ASP_CODE_v10.zip" into
a directory on the respective head-end.
2. Extract the contained files into a temporary directory.
3. Execute the "Setup.exe" file and follow the installation After the ASP.NET
instructions of the installation program. application has been
installed, it is not yet
Note runnable. This requires
configuring the web server
If .NET-Framework has not been installed yet, the
accordingly first (see
setup program will notify you of this and offer a link
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

following chapter).
where you can download .NET-Framework from the
Copyright © Siemens AG 2005 All rights reserved

internet.

V1.0 26.04.05 14/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

2.4 Configuration of the Internet Information Services

The Internet Information Services (IIS) offer some specific functions for
access to web services. IIS is thus installed on the PC, on which the OPC
server is running – also i.e. the head-end.

Configuring the web service for the access to the OPC XML-DA interface
To enable access from applications to the SIMATIC NET OPC server via
OPC XML-DA, the Internet Information Services (IIS) must be set
accordingly. The table below explains how you can configure the IIS for this
access option.
For access protection the default settings initially remain unchanged. The
security settings are made in the next section.
Table 2-7
No. Instructions Note
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

1. Open the “Internet Information Services“ with:


Copyright © Siemens AG 2005 All rights reserved

Start Æ Control Panel Æ


Administrative Tools Æ Internet
Services Manager
Note
If the "Administrative Tools" item is not
available, select:
Start Æ Run... and enter the following
string:
%SystemRoot%\System32\Inetsrv\iis.msc
2. Select "Default Web Site" from the context
menu of this folder (click with the right mouse
button) and select Æ New Æ Virtual
Directory
3. Click the Virtual Directory Creation
Wizard and then the Next button.
4. Enter "OPC.Simatic.NET" in the Alias: field
and click Next>
Note
Please ensure that the name does not
contain any special characters or dots. The
access to virtual directories with special
characters in their names will be blocked
later on for security reasons (using the
"IISLockdown" tool).
5. Click the Browse.. button and select the
subdirectory "\opc2\binXML" from your
SIMATIC.NET installation directory. This
directory includes the file "sopcweb.asmx".
Press Next> to confirm your selection.

V1.0 26.04.05 15/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions Note


6. Checkmark the following items in the Access
Permissions dialog box:
• Read
• Run scripts (such as ASP)
Press Next> to confirm your selection.
7. Click Finish to close the Virtual Directory
Creation Wizard.
The Default Web Site folder should now
include OPC.Simatic.NET.
Note
After the ASP.NET application has been
installed, the virtual directory of the
"OPCXMLDANetClient" application appears
below the Default Web Site. This was
automatically generated by the setup
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

program.
Copyright © Siemens AG 2005 All rights reserved

8. Close the configuration window.

Automatic protection for the Web Server


The "IISLockdown" tool is used for protecting the web server of the IIS. This
tool can be obtained free of charge from www.microsoft.com, the Microsoft
Homepage, where you enter "download iislockdown" into the search field).
For executing the IISLockdown tool please perform the following steps.
Table 2-8
No. Instructions Note
1. Copy the "iislockd.exe" file into a temporary directory of
the head-end.
2. Start "iislockd.exe" file.
3. Click Next > on the start page
4. Select "I agree" on the second page in order to
accept the license conditions and click Next >.
5. In the Select Server Template window you The checkmark for View
select the Dynamic Web Server (ASP enabled) template settings
entry from the Server templates list. needs not be set.
Press Next> to confirm your selection.
6. Set the checkmark in the URLScan window at Now the security settings of
Install URLScan filter on the server. the web server are adjusted.
Press Next> twice to confirm your selection.
7. Close the tool with Next > and Finish.

V1.0 26.04.05 16/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

2.5 Configuring the access protection

General notes
Using this application requires access to the HTTP service of the internet
information services. The access is normally blocked by the integrated
Windows XP Firewall (or another firewall installed on the PC). Release this
service in your firewall or switch the firewall off.

Configuring the access protection to the IIS


In this application, the integrated Windows authentication of the IIS is used.
In order to activate it, please proceed as follows:
Table 2-9
No. Instructions Note
1. Open the “Internet Information Services“ with:
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Start Æ Control Panel Æ


Copyright © Siemens AG 2005 All rights reserved

Administrative Tools Æ Internet


Services Manager
Note
If the "Administrative Tools" item is not
available, select:
Start Æ Run... and enter the following
string:
%SystemRoot%\System32\Inetsrv\iis.msc
2. In the left structure tree you select the
Default Web Site and open the context
menu (with the right mouse button) and select
Properties.
3. In the properties dialog you change to the
Directory Security tab

4. In the Anonymous access and


authentication control you press the
Edit...button.

V1.0 26.04.05 17/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions Note


5. Remove the checkmark at Anonymous
access and set the checkmark at
Integrated Windows authentication.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc
Copyright © Siemens AG 2005 All rights reserved

6. Confirm all details and dialogs with OK.

Creating or configuring users for accessing the application


For accessing the OPC XML-DA web service and the ASP.NET application,
it is recommended to create one or several users. Other existing users can
also be used of course.
The following table explains how you can create users on the head-end and
assign them to the "Users" group. A prerequisite is that you have
administrator permission and the IISLockdown tool has already been
installed (see 2.4 Configuration of the Internet Information Services).
Table 2-10
No. Instructions Note
1. Open the Computer Management with:
Start Æ Settings Æ Control Panel Æ
Administrative Tools Æ Computer
Management
2. In the left structure tree you select:
Computer Management (Local) Æ System
Tools Æ Local Users and Groups Æ Users

V1.0 26.04.05 18/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions Note


3. In the Users context you select New User... .

4. In the New User dialog you fill in the following fields:


• User name, e.g. "OPC client"
• Full name, e.g. "OPC client"
• Description, e.g. "To access the OPC server"
• Password and Confirm password, e.g.
"Password_25!" (The password should always
include capital and lower case letters, special
characters and numbers)
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Remove checkmark at User must change


Copyright © Siemens AG 2005 All rights reserved

password at next logon and set the checkmark


at Password never expires.
5. Create the user by pressing the Create button and
close the dialog with Close.
6. Change to the Groups folder.
7. Open the group properties by double-clicking Users.
8. Click Add... to add a new user to the group.
9. In the field "Enter the object names to select" you enter
the user name of the above created user (e.g. "OPC
client")

10. Close the properties dialog of the "Users" group with


OK
Note
Also add the user currently logged on at the head-end,
e.g. "Administrator" to the "Users" group.
For the production mode of the head-end, you should
also create an additional user with restricted
permissions and as a member of the "Users" group,
used for local access. As described above, this user
should then also be included in the list of the users
authorized for accessing the OPC server.

V1.0 26.04.05 19/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

Configuring the access protection for the XML-DA interface


The access to the XML-DA interface of the SIMATIC NET OPC server is
adjusted in the "web.config" file of the interface. In this application, only
certain users (OPC client and ASPNET) are to be granted access to the
interface. These users have only restricted access to data of a PC.
To do this, please follow the steps below.
Table 2-11
No. Instructions Note
1. Change to the “\opc2\binXML“ directory in your
SIMATIC.NET installation directory, e.g.:
"C:\Programm\Siemens\SIMATIC.NET\opc2\binXML"
2. Open the "web.config" file contained in this directory
(e.g. notepad.exe).
3. In the file you search the tag
<authentication mode="Windows"/>
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

4. Add the following lines behind it in a new line. This Note


Copyright © Siemens AG 2005 All rights reserved

permits the users "OPC client" and "ASPNET" to The ASP.NET application
access the XML-DA interface of the OPC server. accesses the OPC server
Instead of [PC Name] you enter the computer name of with the name "ASPNET".
the head-end (see Start Æ Settings Æ
Control Panel Æ System Æ Computer name).

<authorization>
<allow users="[PC Name]\OPC-Client,
[PC Name]\ASPNET"/>
<deny users="*"/>
</authorization>
5. Save the file and close it with the Editor.

V1.0 26.04.05 20/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

Configuring the access protection for the ASP.NET application


If you wish to configure the ASP.NET application, you should configure the
access protection for the application here.
The access to the ASP.NET application is also set via a "web.config" file.
This only requires adjusting the computer name of the head-end in the
"web.config" file of the ASP.NET application.
Only certain users (OPC client) should have access to this application as
well. To do this, please follow the steps below.
Table 2-12
No. Instructions Note
1. On the head-end you change to the directory
”C:\Inetpub\wwwroot\OPCXMLDANetClient“
2. Open the "web.config" file contained in this directory
(e.g. notepad.exe).
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

3. Search for the term "Head-end" in this file.


Copyright © Siemens AG 2005 All rights reserved

4. Replace "Head-end" with the computer name of your Computer name: see Start Æ
head-end station. Settings Æ Control Panel Æ
Ensure, that the user used here has actually been System Æ (Computer name).
created.
5. Save the file and close it with the Editor.

V1.0 26.04.05 21/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

2.6 SIMATIC side configuration of the stations

Configuring the head-end using the Station Configuration Editor


The configuration of the head-end with the Station Configuration Editor
corresponds to plugging S7-400 hardware components to a rack. Thereby
components from the PC station (hardware and software components) are,
in software technology terms, allocated to a virtual slot.
Table 2-13
No. Instructions Note
1. Start the Station Configuration Editor by double-clicking
the icon in the toolbar or via: Start Æ Station
Configuration Editor
2. Set the Head-end name with the Station name
button.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Note
Copyright © Siemens AG 2005 All rights reserved

This name must be identical with the name of the


SIMATIC PC station in the STEP 7 project.
3. Slots 1 to 32 must be empty. Remove all existing
components by selecting the component and pressing
Delete... . Confirm the query with OK.
4. In the Station Configuration Editor you select the line
with the index 1
5. Open the Add component dialog with the Add...
button.
6. Select the OPC Server entry from the Type list.
7. Close the dialog with OK and also confirm the following
dialog with OK.
8. Select the line with the index 2.
9. Press the Add… button. This opens the Add
component dialog.
10. For Type you select the entry IE General.
11. If you have several Ethernet cards on the PC you must
select the card connected with the S7 station in
Parameter assig..
12. Confirm your selection and the query with OK.
The Component Properties dialog contains the
current IP address and subnet mask of the Ethernet
card.

V1.0 26.04.05 22/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions Note


13. The complete configuration in the Station
Configuration Editor now looks as follows:

Set PG/PC interface to Industrial Ethernet


The access from the PG/PC (also the visualization station) to the head-end
as well as the S7-300 station occurs via Industrial Ethernet. The PG/PC
interface of the PG must have been set accordingly.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Please follow the steps in the table.


Copyright © Siemens AG 2005 All rights reserved

Table 2-14
No. Instructions Note
1. Start the SIMATIC manager.
2. Open the extracted STEP 7 project “315_OPC” in the
SIMATIC Manager.
3. Open the context menu of the PG/PC object in the
STEP 7 project via the right mouse button.
4. Select: PLC Æ Assign PG/PC.
5. If your PG/PC has several Ethernet interfaces, you
select the correct interface in the Properties-PG/PC
dialog and press the Assign button and then close
the dialog with OK.

Deleting the Micro Memory Card CPU 315-2DP


Before loading a new configuration onto the CPU it is recommended to
delete the MMC of the CPU with the PG beforehand. To do this, please
follow the steps below.
Table 2-15
No. Instructions Note
1. Remove the MMC from the CPU. The power supply Please refer to /4/.
must be off!
2. Plug the MMC into the field PG See /5/
3. In the SIMATIC Manager you select the menu:
File Æ S7-Memory Card Æ Delete...
4. Confirm the query with Yes.

V1.0 26.04.05 23/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions Note


5. As soon as the message that deleting has been
completed appears, you can plug the MMC back into
the CPU.
6. Switch on the power supply of the S7 station. A memory reset of the CPU
is automatically performed.

Assigning an IP address to the CP 343-1


In order to access the S7 station via Industrial Ethernet, an IP address must
first be assigned to the Ethernet-CP (CP 343-1). This is performed via the
SIMATIC Manager. To do this, please follow the steps below.
Table 2-16
No. Instructions Note
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

1. In the SIMATIC Manager you select the menu:


PLC Æ Assign Ethernet Address...
Copyright © Siemens AG 2005 All rights reserved

Note
Please ensure, that the mode switch of the CP 343-1
has been set to "RUN".

2. In order to search the CP in the network, you click the The search for Ethernet
Browse... button. stations is started
automatically and may take
some time.
3. From the list you select the entry with the device type
S7-300 CP and confirm your selection with OK.

4. In the Set IP configuration section you select Note


IP address and subnet mask to be assigned. In this If you select different values,
application, the following values have been selected: you must also adjust the
• IP address: 10.0.0.3 STEP 7 project accordingly.
• Sub-network mask 255.255.255.0
5. Press Assign IP Configuration in order to This enables accessing the
transfer the IP address to the CP. entire S7 station with STEP 7
via the CP.

V1.0 26.04.05 24/34


Setup and Operation of the Application
Installation and Commissioning

Data Exchange via XML-DA Entry-ID: 21402169

No. Instructions Note


6. Close the dialog with the Close button.

Load the configuration into head-end and S7 station


For loading configuration and S7 program to the head-end and the S7
station, please perform the steps of the following table.
Table 2-17
No. Instructions Note
1. Open the extracted STEP 7 project “315_OPC” in the
SIMATIC Manager.
2. Start the “NetPro” tool with the button.
3. If you do not want to take on the data of the example
project (e.g. station name or subnet masks) you can
now change them.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

However, it is recommended to keep the example


Copyright © Siemens AG 2005 All rights reserved

configuration.
4. If an error should occur here,
Compile and save the entire configuration with the
it must be removed prior to
button. Select the selection box Compile and check
loading.
everything.
5. Select head-end and S7 station, and load the
configuration with the button.
Confirm the queries with OK.

6. Close the "NetPro" tool.


7. In the SIMATIC Manager you select the block folder of
the S7-300 station and load the blocks to the controller
by pressing the button.
8. Set the CPU 315-2DP to RUN mode.

Note For testing the OPC connection to the controller, the OPC Scout can be
used (included in the delivery scope of the SIMATIC NET PC software).

V1.0 26.04.05 25/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

3 Operating the Application


Here you will find information on …
how to operated all function of this application.

Description of the example process


The S7 control program simulates a mixing process. Liquids are hereby fed
into a tank via two inlet valves. As soon as the tank has been fill up, the
liquid is mixed and heated up. After the setpoint temperature has been
reached, the liquid is cooled down again and then drained via an outlet
valve.
The process variables for the data exchange with the OPC server are
saved to three different blocks.

3.1 Windows application


21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

User interface
Copyright © Siemens AG 2005 All rights reserved

The following figure shows the user interface of Window application. The
elements are described below.
Figure 3-1

V1.0 26.04.05 26/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

Description of user interface


The following table explains the individual elements of the user interface.
Table 3-1
No. Description
1 Buttons for starting and terminating the visualization process. This
establishes the connection to and disconnects from the OPC server.
2 Area for entering and writing the setpoint values:
• T in: inlet temperature
• T out: outlet temperature
• T max: maximum heating temperature
• Level 1: filling level for liquid 1
• Level 2: maximum filling level (liquid 1 + 2)
3 Display of process values (actual values):
• Level: actual filling level
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

• Temperature: actual temperature


Copyright © Siemens AG 2005 All rights reserved

• System time: system time of the S7-CPU


• Inlet valve 1: inlet valve for liquid 1
• Inlet valve 2: inlet valve for liquid 2
• Outlet valve: outlet valve of the tank
• Heater: heating
• Cooler: cooler
• Mixer: mixer
Button for direct reading of the process values:
• Read values
4 Buttons for starting and terminating the mixing process.
5 Graphic display of the mixing process.

Note Please ensure that the user, under which you are currently logged on at
the head-end or visualization station, has access to the XML-DA web
service of the SIMATIC NET OPC server. See 2.5 Configuring the access
protection

V1.0 26.04.05 27/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

Starting and configuring the visualization


For starting the Windows application on the head-end or visualization
station, please perform the steps in the table below.
Table 3-2
No. Instructions Note
1. Start the Windows application with:
Start Æ A&D Service and Support Æ OPC
XML-DA Client Æ OPC XML-DA Client

2. Open the Properties dialog via the menu:


Options Æ Customize...
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc
Copyright © Siemens AG 2005 All rights reserved

3. Depending on which PC you are running the


visualization application, check the field "URL of the
OPC server".
• Head-end:
"http://localhost/[virtual directory of the web
service]/sopcweb.asmx"
• Visualization station:
"http://[PC name of the head-end]/[virtual directory
of the web service]/sopcweb.asmx"
4. Press Connection test button. If the login box appears, you
If the message Connection successfully enter a user which has
established appears, the connection to the web access to the XML-DA
service was successfully established. interface, e.g. "OPC client".
5. In the OPC items section you can adjust the OPC For the demonstration of this
items to be displayed. example no adjustments
You can search the address space of the OPC server need to be made to the OPC
for OPC items with the Browse... button. items.
6. Click on OK to confirm the settings. The settings are permanently
saved in the "Options.xml"
file.

V1.0 26.04.05 28/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

Operating the visualization


The following table explains how to operate the Windows application and
impact the simulated mixing process.
Table 3-3
No. Instructions Note
1. Start the Windows application with:
Start Æ A&D Service and Support Æ OPC
XML-DA Client Æ OPC XML-DA Client

2. For connecting with the OPC server and starting the If the login box appears, you
visualization press the button. enter a user which has
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

access to the XML-DA


interface.
Copyright © Siemens AG 2005 All rights reserved

3. When starting the visualization and S7 program for the If the mixing process was
first time, you must first start the simulated mixing started successfully, the
process (the Stop process is red). Start process button
Press the Start process button. turns green.
4. Enter any setpoint values into the input fields and press
the Write setpoint values button.
5. Press the Read values button in order to read the The RX/TX diode of the CP
process values directly from the controller. indicates that the Read
request goes directly to the
controller.

V1.0 26.04.05 29/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

3.2 The ASP.NET application

User interface
The following figure shows the user interface of ASP.NET application. The
elements are described below.
Figure 3-2
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc
Copyright © Siemens AG 2005 All rights reserved

Description of user interface


The following table explains the individual elements of the user interface.
Table 3-4
No. Description
1. Buttons for starting and terminating the visualization process. This
establishes the connection to or disconnects from the OPC server.
2. Area for entering and writing the setpoint values:
• Tin: inlet temperature
• Tout: outlet temperature
• Tmax: maximum heating temperature
• Level 1: filling level for liquid 1
• Level 2: maximum filling level (liquid 1 + 2)
3. Display of process values (actual values)
• Level: actual filling level
• Temperature: actual temperature
• System time: system time of the S7-CPU
• Inlet valve 1: inlet valve for liquid 1
• Inlet valve 2: inlet valve for liquid 2
• Outlet valve: outlet valve of the tank
• Heater: heating
• Coole: cooler
• Mixer: mixer
4. Buttons for starting and terminating the mixing process.

V1.0 26.04.05 30/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

Note Please ensure, that the user under which you have just logged on at the
head-end or the visualization station, is member of the "Users" group.
See 2.5 Configuring the access protection

Start visualization locally (on the head-end)


For starting the ASP.NET application on the head-end, please perform the
steps in the table below.
Table 3-5
No. Instructions Note
1. Start the internet browser of the head-end (e.g.
Microsoft Internet Explorer or Mozilla Firefox)
2. Enter the URL of the ASP.NET application into the
address bar of the browser:
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

"http://localhost/OPCXMLDANetClient/mainform.aspx"
Copyright © Siemens AG 2005 All rights reserved

3. If a query appears after a user name and password,


enter a user of the user group "Users".
(e.g. the user "OPC-client" created at 2.5 Configuring
the access protection).

4. Check URL of the web service of the OPC XML-DA


interface in the field URL.
Here you should ensure that the specified virtual
directory (here: "OPCSimaticNET), corresponds to the
name assigned in 2.4 Configuration of the Internet
Information Services.

V1.0 26.04.05 31/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

Starting the visualization on the visualization station


For starting the ASP.NET application on the visualization station, please
perform the steps in the table below.
Table 3-6
No. Instructions Note
1. Start the internet browser of the head-end (e.g.
Microsoft Internet Explorer or Mozilla Firefox)
2. Enter the URL of the ASP.NET application into the Note
address bar of the browser: Should you have selected a
"http://head-end/OPCXMLDANetClient/mainform.aspx" different PC name for your
head-end, you must use it in
the URL (instead of "head-
end").
3. If a query appears after a user name and password,
enter a user of the user group "Users" in the head-end.
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

(e.g. the user "OPC-client" created at 2.5 Configuring


Copyright © Siemens AG 2005 All rights reserved

the access protection).

4. Check URL of the web service of the OPC XML-DA


interface in the field URL.
Here you should ensure that the specified virtual
directory (here: "OPCSimaticNET), corresponds to the
name assigned in 2.4 Configuration of the Internet
Information Services.

V1.0 26.04.05 32/34


Setup and Operation of the Application
Operating the Application

Data Exchange via XML-DA Entry-ID: 21402169

Operating the visualization user interface


Operation of the visualization user interface is the same all over,
irrespective of where it was started. The following table shows you which
operating options you have with this visualization user interface.
Table 3-7
No. Instructions Note
1. As soon as the visualization user interface was started Individually it may happen,
successfully in a web browser, you click the Connect that the actual values are
button. only displayed at the second
This establishes a connection with the OPC server of refreshing of the page.
the head-end, and an automatic, cyclic refreshing of
the values starts.
2. When starting the visualization and S7 program for the If the mixing process was
first time, you must first start the simulated mixing started successfully, the
process (the Stop process is red). Start process button
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Press the Start process button. turns green.


Copyright © Siemens AG 2005 All rights reserved

3. Enter any setpoint values into the input fields and press During the page refresh a
the Write setpoints button. write job for setpoint values
can be triggered.
4. Status information and errors are displayed at the
bottom edge of the page (e.g. limits of setpoint values
exceeded or communication problems).

Adjusting the configuration data


If you wish to change the configuration data of the visualization application,
(e.g. URL of the OPC XML-DA Web service or name of the OPC item),
please follow the instructions of the following table.
Table 3-8
No. Instructions Note
1. Open the Windows Explorer and change to the
following directory:
"C:\Inetpub\wwwroot\OPCXMLDANetClient\"
2. Open the contained "Options.xml" file in a text editor
(e.g. notepad.exe).
3. Process the desired values and save the file.
4. Restart the visualization application. The changed
values are accepted.

V1.0 26.04.05 33/34


Appendix and List of Further Literature
Literature

Data Exchange via XML-DA Entry-ID: 21402169

Appendix and List of Further Literature

4 Literature
4.1 Bibliographic References

This list is by no means exhaustive and only gives a selection of


appropriate sources. You can find most manuals, when you have installed
the corresponding product, under:
Start Æ Simatic Æ Documentation Æ English
Table 4-1
Topic Title
/1/ STEP 7 Automatisieren mit STEP 7 in AWL und SCL
(Automating with STEP7 in STL and SCL)
21402169_OPC_XML-DA_Demonstration_DOKU_V10_e.doc

Hans Berger
Copyright © Siemens AG 2005 All rights reserved

published by: Publicis MCD Verlag


ISBN 3-89578-113-4
/2/ SIMATIC NET, SIMATIC NET, Industrielle Kommunikation mit
Industrial PG/PC Band 1 – Grundlagen, Systemhandbuch
communication (on SIMATIC NET CD)
/3/ SIMATIC NET, SIMATIC NET, PC-Stationen in Betrieb nehmen –
Advanced PC Anleitung und Schnelleinstieg
Configuration (available on SIMATIC NET CD or in Product
Support at entry ID: 13542666.)
/4/ Setting up S7-300 S7-300, CPU 31xC und CPU 31x: Aufbauen
Betriebsanleitung
(available in Product Support at entry ID: 13008499.)
/5/ Field-PG manual SIMATIC Field PG P4, Handbuch
(available in Product Support at entry ID: 14957220.)

4.2 Internet links

This list is by no means exhaustive and only gives a selection of


appropriate sources.
Table 4-2
Topic Title
\1\ Reference to the http://support.automation.siemens.com/WW/view/en
documentation /21402169

\2\ Siemens A&D http://support.automation.siemens.com


Customer Support

V1.0 26.04.05 34/34

Das könnte Ihnen auch gefallen