Documente Academic
Documente Profesional
Documente Cultură
Demonstration
Warranty, Liability and Support
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.
For questions about this document please use the following e-mail address:
mailto:csweb@ad.siemens.de
Foreword
Objectives of the application
This example application discusses the application of the SEND/RECEIVE
protocol with the SIMATIC NET OPC server. The OPC server
communicates with the controller via the block and variable services of the
SEND/RECEIVE protocol.
It demonstrates how an OPC client, which is tailored to individual
requirements, is programmed in the programming language Visual Basic
.NET. The configuration of the PC station for using the SIMATIC NET OPC
server with the SEND/RECEIVE protocol and Industrial Ethernet is also
explained. This enables transferring structured data via the OPC interface.
Application Description
and Function Principles hardware and software components and the specially
created software).
Extension Discusses the detailed function processes of the
Function Principles in involved hardware and software components, the
detail and Program solution structures, and where sensible the concrete
Structure 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
Table of Contents
Table of Contents ......................................................................................................... 5
Introduction................................................................................................................... 6
1 Document on Hand......................................................................................... 6
Setup and Operation of the Application ..................................................................... 7
2 Installation and Commissioning ................................................................... 7
2.1 Installation of hardware and software ............................................................... 7
2.2 Installation of the application software .............................................................. 8
2.3 Configuration of the automation stations .......................................................... 9
2.3.1 Setting the IP addresses................................................................................... 9
2.3.2 Installation of the STEP 7 project ................................................................... 12
2.3.3 Importing the XDB file to the Station Configuration Editor .............................. 14
2.4 Configurations of the application .................................................................... 15
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
Introduction
1 Document on Hand
This document is the setup and operating instruction for the application
“OPC Communication via SEND/RECEIVE Protocol with a Visual Basic
.NET OPC-Client”.
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.
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
Note
At the next start of the computer the card is
automatically recognized. The required software /
drivers are not installed during the installation of STEP
7 and SIMATIC NET. They must be explicitly installed.
Please connect the controller with the PC via hub.
Note
Instead of using a hub or a switch you can also use a
cross cable for a direct connection.
Note The .NET-Framework V1.1 required for this application is installed by the
SIMATIC NET software V6.2 SP1.
If this is not the case, respective information are available on the
Microsoft page http://www.microsoft.com/.
Table 2-2
No. Instructions Note
1 Extract the “21523291_OPC_SR_CODE_v10.zip“ file to a Uninstall by deleting the files.
directory on your hard disk.
The STEP 7 project for this example uses the following IP addresses and
subnet masks. Should you make adjustments to the IP addresses, please
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
ensure that the IP addresses fit with the set subnet masks.
Table 2-4
Focus Module IP address Sub-network mask
PG/PC CP 1613 192.168.1.10 255.255.255.0
Controller CP 343-1 192.168.1.11 255.255.255.0
Table 2-5
2 From the list “This connection uses the The dialog Internet
following items:” you select the entry Protocol(TCP/IP)Properties
“Internet Protocol (TCP/IP)” and click “Properties” opens.
3 Change to Use the following IP
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Assign IP address
The S7-300 station can only be accessed with STEP 7 after an IP address
has been assigned to the CP 343-1. Please follow the instructions listed in
the table:
Table 2-7
2 Start the search for stations at the Ethernet The Browse Network dialog is
network with the Browse... button. displayed in which all accessible
Ethernet stations are listed.
3 Select the S7-300 CP from the list and close the
dialog with OK.
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
the button .
The network configuration on the right will be
displayed.
3 Adjust the IP address of the PG/PC ”SIMATIC IP address and subnet mask, see
PC-Station(1)“: “Configuration of the PG/PC network
• Double-click “CP1613” in the PC station card”.
• Change the IP address and the subnet mask
to the values actually set on the PG/PC via
the Properties button.
• Click OK to confirm the properties dialogs.
In order to use the OPC server on the PG/PC the configuration must be
loaded from the STEP 7 project to the Station Configuration Editor of the
PG/PC. Please follow the instructions below:
Table 2-11
App04\XDBs
Copyright © Siemens AG 2005 All rights reserved
6 Adjust the station name of the PG/PC via The station name in the Station
Station name. Configuration Editor is different to the
The station name equals the name of the PC computer name of the PG/PC (see
station in the STEP 7 project. In this example: Control Panel Æ System).
“GS_03_02“.
7 Close the “Station Configuration Editor” dialog
box.
Note You must first create the PG/PC interface according to chapter 2.3.1.
Table 2-12
No. Instructions Note
1 Create a new station of the Below, it is assumed that the partner station (SIMATIC S7-
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
4 Add a CP 1613 to slot 2. This application uses a CP 1613 V6.0 SP5. After adding the
CP, the “Properties – Ethernet Interface” dialog opens.
Note:
If no IE network has been
configured yet, you
generate a new one with
New... and apply the
standard parameters.
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
Table 2-13
No. Instructions Note
1
Open NetPro with the
button.
2 Select the OPC server.
connection partner.
Copyright © Siemens AG 2005 All rights reserved
Select ISO-on-TCP
connection as the
connection type.
Note:
Two SR connections and
respectively one Fetch
and one Write connection
are required for this
project.
Note The created XDB file, automatically generated during compiling, can now
be loaded to the station manager via import.
Proceed analog to chapter 2.3.3.
The settings can be checked with the configuration dialog for the OPC
server.
The following settings should be considered:
Table 2-14
No. Instructions Note
1 Open the configuration With: Start Æ Simatic Æ SIMATIC NET Æ Set PC
console “Set PC Station
Station“ via the start
menu:
2 Check the set access
point.
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
Note:
Activating the SR
protocol is sufficient
for this application.
preceding configuration
again.
User interface
The following figure shows the user interface of the example program.
Figure 3-1
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
Note
Installation directory: see 2.2 Installation of the application software
2 After starting the application the user interface appears as in Figure 3-1.
3 The only option you have is pressing Connect. All actions are performed
which lead to establishing a connection with the OPC server. Furthermore, all
required OPC items are created.
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Now you have the option of either using the variable services in Variables
Copyright © Siemens AG 2005 All rights reserved
Variable table
The variables are available in the included STEP 7 project "App04".
Figure 3-2
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
4 Glossary
COM
Component Object Model: Software model for communication between
components based on a standardized interface;Æ DCOM
DCOM
Distributed Object Model: Software model for communicating beyond
computer boundaries based on Æ COM.
Eventhandler
An Event handler processes occurring events or Windows messages.
Exception
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved
Exception handler
An Exception handler processes occurring exceptional situations. Generally
a secured error behavior and/or a message to the user.
HRESULT
Return data type of COM objects.
IDL
Interface Definition Language: A Microsoft standard language for definition
of function and parameter interfaces.
OPC
OLE for process control. A standardization for process control created for
the automation sector. Maintained by the OPC - Foundation. Several
interfaces with different tasks exist.
OPC client
A program which uses the services of an OPC server by sending requests
to the server via existing OPC interfaces.
OPC DA
OPC Data Access interface. The interface enables monitoring and
changing of process values.
OPC server
A program which provides one of the OPC interfaces and responds to
requests of an OPC client.
Polling
Term referring to (mostly cyclical) polling of certain values or states.
RCW
Runtime Callable Wrapper. A wrapper which encapsulates a Custom
interface for the .NET Framework. The RCW enables accessing older COM
ports for the .NET Framework.
Sink interface
Using the sink interface, messages between components can be sent. The
sink interface is based on COM mechanisms.
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Windows message
Copyright © Siemens AG 2005 All rights reserved
Wrapper
The term Wrapper normally refers to a class group which encapsulates
other class groups for data conversion or easier handling.
It can be considered an “envelope” enclosing the “wrapped” classes,
covering them from the outside.
5 Literature
5.1 Bibliographic References
Table 5-1
Topic Title
/1/ STEP 7 Automatisieren mit STEP 7 in AWL und SCL
(Automating with STEP7 in STL and SCL)
Hans Berger
published by: Publicis MCD Verlag
ISBN 3-89578-113-4
/2/ SIMATIC NET, SIMATIC NET, Industrial communication with
Industrial PG/PC
21523291_OPC_SR_Demonstration_DOKU_v10_e.doc
Copyright © Siemens AG 2005 All rights reserved