21523291 opc sr demonstration doku v10 e

27
 Application for Communication OPC Communication via the SEND/RECEIVE Protocol with a Visual Basic .NET OPC Client Demonstration

Upload: venkiice

Post on 09-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 1/26

 

Application for Communication

OPC Communication via the SEND/RECEIVE

Protocol with a Visual Basic .NET OPC Client

Demonstration

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 2/26

 Warranty, Liability and Support

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 2/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

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 theuse of the examples, information, programs, engineering and performancedata etc., described in this document shall be excluded. Such an exclusionshall not apply in the case of mandatory liability, e.g. under the GermanProduct Liability Act (“Produkthaftungsgesetz”), in case of intent, grossnegligence, or injury of life, body or health, guarantee for the quality of aproduct, fraudulent concealment of a deficiency or breach of a conditionwhich goes to the root of the contract (“wesentliche Vertragspflichten”).

However, claims arising from a breach of a condition which goes to the rootof the contract shall be limited to the foreseeable damage which is intrinsicto the contract, unless caused by intent or gross negligence or based onmandatory liability for injury of life, body or health. The above provisions donot imply a change in the burden of proof to your detriment.

The Application Examples are not binding and do not claim to be completeregarding the circuits shown, equipping and any eventuality. They do notrepresent customer-specific solutions. They are only intended to providesupport for typical applications. You are responsible for ensuring that thedescribed products are used correctly. These Application Examples do notrelieve you of the responsibility in safely and professionally using, installing,

operating and servicing equipment. By using this application example youaccept that Siemens is not liable for any damages except for thosespecified in the above liability clause. We reserve the right to makechanges to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in thisapplication example and other Siemens publications – e.g. Catalogs – thecontents of the other documents have priority.

Copyright© 2005 Siemens A&D. It is not permissible to transfer or copy these Application Examples or excerpts of them without firsthaving prior authorization from Siemens A&D in writing.

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

mailto:[email protected] 

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 3/26

 Foreword

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 3/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Foreword

Objectives of the application

This example application discusses the application of the SEND/RECEIVEprotocol with the SIMATIC NET OPC server. The OPC server communicates with the controller via the block and variable services of theSEND/RECEIVE protocol.

It demonstrates how an OPC client, which is tailored to individualrequirements, is programmed in the programming language Visual Basic.NET. The configuration of the PC station for using the SIMATIC NET OPCserver with the SEND/RECEIVE protocol and Industrial Ethernet is alsoexplained. This enables transferring structured data via the OPC interface.

Main contents of this application

The following main points are discussed in this application:

• Dealing with the communication services of the SEND/RECEIVEprotocol with regards to program technology:

– Block services (AG_SEND / AG_RECEIVE)

– Variable services (FETCH / WRITE)

for enabling exchange of larger data volumes between PC and mixedautomation systems (i.e. SIMATIC S5 and SIMATICT S7).

• Configuring the SEND/RECEIVE protocol when using IndustrialEthernet

• Generating an OPC client with graphical user interface

• Demonstrating the handling of the Data Access interface of the OPCserver via the Custom Interface, and the integrating process into .NET-Framework using the OPC DA RC-Wrapper 

• Displaying the procedure for implementing an additionalacknowledgement mechanism (additional level 7 protocol).

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 4/26

 Foreword

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 4/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Structure of the document

The documentation of this application is divided into the following mainparts:

•  Introduction

•  Extension

•  Demonstration

Additionally, the STEP7 code and the Visual Basic .NET code areavailable.

This third document, the Demonstration part, is aimed at persons whowant to have a step-by-step instruction.

Part Description

Introduction

Application Descriptionand Function Principles

Provides a general overview of the contents. You willlearn about the components used (standardhardware and software components and the speciallycreated software).

Extension

Function Principles indetail and ProgramStructure 

Discusses the detailed function processes of theinvolved hardware and software components, thesolution structures, and where sensible the concreteimplementation of this application.

This part is necessary if you want to learn about theinteraction of the solution components, for example inorder to use them as the basis for own development.

Demonstration

Structure, Configurationand Operation of theApplication

This part leads you step by step through thestructure, important configuration steps,commissioning and operation of the application.

An additional component available is the S7 program code.

Part Description

S7 program codeThe S7 program code includes the code and a user interface which may also be used for demonstrationpurposes.

Visual Basic .NET CodeContains the program files of the OPC client and theVisual Studio .NET project.

Reference for Automation and Drives Service & Support

This entry originates from the internet application portal of the A&D Serviceand Support. The following link takes you directly to the download page of this document.

http://support.automation.siemens.com/WW/view/en/21523291 

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 5/26

 Foreword

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 5/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

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 2.4.1  Configuring the OPC server in HWConfig ...................................................... 15 2.4.2  Configuring the connection with the OPC server in NetPro ............................ 16 2.4.3  Check the settings .......................................................................................... 19 3  Operating the Application............................................................................ 21 Appendix and List of Further Literature................................................................... 24 4  Glossary ........................................................................................................ 24 5  Literature ....................................................................................................... 26 5.1  Bibliographic References................................................................................ 26 5.2  Internet links ................................................................................................... 26 

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 6/26

 Introduction

Document on Hand

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 6/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

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.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 7/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 7/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Setup and Operation of the Application

Content

This part leads you step by step through the structure, commissioning andoperation of the application.

2 Installation and Commissioning

Here you will find further information on …

the hardware and software to be installed, and the steps necessary for 

commissioning the example.

2.1 Installation of hardware and software

This chapter describes the hardware and software components to beinstalled. The description and manuals as well as delivery informationcontained in the delivery scope of the respective products, should befollowed in any case.

Installation of the hardware

For details on the hardware components, please refer to “Introduction”

document of this application. For the hardware setup, proceed inaccordance with the table below:

Table 2-1

No.

Instructions Note

Set up the S7station (power supply, CPU and CP).

Integrate the CP 1613 into your PG / PC.

Note

At the next start of the computer the card isautomatically recognized. The required software /

drivers are not installed during the installation of STEP7 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 across cable for a direct connection. 

Note The setup guidelines for SIMATIC S7 must generally be followed.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 8/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 8/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Installation of the standard software

A description of the installation procedure for STEP 7 and SIMATIC NET isnot part of this documentation. The installation takes place in the familiar Windows environment and is self-explanatory.

2.2 Installation of the application software

The executable example program is provided to you in form of a setup.exefile.

Note The .NET-Framework V1.1 required for this application is installed by theSIMATIC NET software V6.2 SP1.

If this is not the case, respective information are available on theMicrosoft page http://www.microsoft.com/.

For installing the operator user interface proceed as follows:

Table 2-2

No. Instructions Note

1 Extract the “21523291_OPC_SR_CODE_v10.zip“ file to adirectory on your hard disk.

Uninstall by deleting the files.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 9/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 9/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

2.3 Configuration of the automation stations

For a smooth operation procedure the following sequence should be kept:

Table 2-3

No. Instructions

1 Setting the IP addresses

2 Installation of the STEP 7 project

3 Importing the XDB file to the station manager 

The following chapters have been structured in this very sequence.

2.3.1 Setting the IP addresses

The STEP 7 project for this example uses the following IP addresses andsubnet masks. Should you make adjustments to the IP addresses, pleaseensure 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

Configuration of the PG/PC network card In order to commission the example, the network card in the PG/PC mustbe configured as follows:

Note For test purposes it is recommended to not install this example in anexisting network, but to set up a separate test network.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 10/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 10/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Table 2-5

No. Instructions Note

1 Open the “Local Area Connection Properties”dialog box via

Start Control Panel Network <Connectionname of network connection> Properties.

2 From the list “This connection uses thefollowing items:” you select the entry“Internet Protocol (TCP/IP)” and click “Properties”

The dialog InternetProtocol(TCP/IP)Properties  opens.

3 Change to Use the following IP

address: and set the IP address (e.g.192.168.1.10) as well as a subnet mask (e.g.255.255.255.0).

The field Default gateway can stay empty.

Acknowledge this and the previous dialog with

OK.

Configure the PG/PC interface

In order to be able to load the S7 program and the configuration to theS7-300 station via Industrial Ethernet the PG/PC interface must be setaccordingly. Please follow the instructions listed in the table: 

Table 2-6

No. Instructions Note

1 Start the SIMATIC manager.

2 Open the dialog “Set PG/PI Interface“ with

“OK“.

Options Set PG/PC interface

3 From the list Interface Parameter Assignment Used you select the entry

”CP1613(RFC1006)“.

4 Quit the dialog box with "OK".

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 11/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 11/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Assign IP address The S7-300 station can only be accessed with STEP 7 after an IP addresshas been assigned to the CP 343-1. Please follow the instructions listed inthe table:

Table 2-7

No. Instructions Note

1 In the SIMATIC Manager you open the dialog Assign Ethernet Address via the menu:

Target system Assign Ethernet Address...

2 Start the search for stations at the Ethernetnetwork with the Browse... button.

The Browse Network dialog isdisplayed in which all accessibleEthernet stations are listed.

3 Select the S7-300 CP from the list and close thedialog with OK.

4 In the IP Address field you specify an IPaddress for the CP 343-1 (e.g. 192.168.1.11).

In the field Subnet mask you enter the samesubnet mask as in the PG/PC (e.g.255.255.255.0; see “Configuration of the PG/PCnetwork card“)

Note

Please ensure, that the IP addresses of PG/PCand CP 343-1 correspond with each other. This isbest achieved if the last digit of both IP addressesonly differs by one.

5 Allocate the IP address set by you, to the CP 343-1 by pressing Assign IP Configuration.

The S7 station can now be reachedfrom the SIMATIC Manager viaEthernet.

6 Quit the dialog box with "OK".7 Switch the CP 343-1 to RUN mode by pressing

the mode switch.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 12/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 12/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

2.3.2 Installation of the STEP 7 project

Retrieving the project After the connection from PC to CP has been implemented successfully,please proceed as follows: 

Table 2-8

No. Instructions Note

2 Open the SIMATIC Manager.

3 Extract the project via the menu File -> Retrieve 

Use the browser to search the21523291_OPC_SR_STEP7_v10.zip projectand click OK to confirm.

4 Select a directory into which the projectfiles are to be retrieved and open theproject.

Adjust the hardware configuration in the STEP 7 project If using a hardware configuration which differs from that in this example(see “Introduction” document of this application), the example project onhand needs to be adjusted accordingly.

Adjusting the network configuration in the STEP 7 project In order to adjust the STEP 7 example project to your setup, perform the

following steps. 

Table 2-9

No. Instructions Note

1 Open the extracted STEP 7 project “App04” in theSIMATIC Manager.

2 Start the network configuration tool “NetPro” via

the button .

The network configuration on the right will bedisplayed.

3 Adjust the IP address of the PG/PC ”SIMATIC

PC-Station(1)“:

• Double-click “CP1613” in the PC station

• Change the IP address and the subnet maskto the values actually set on the PG/PC viathe Properties button.

• Click OK to confirm the properties dialogs.

IP address and subnet mask, see

“Configuration of the PG/PC networkcard”.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 13/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 13/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

No. Instructions Note

4 Adjust the IP addresses of the S7-300 station:

• Double-click “CP 343-1“ in the“SIMATIC 300(1)“ station

• Change the IP address and the subnet maskto the desired values by pressingProperties in the General tab.

• Click OK to confirm the properties dialogs.

Please ensure, that the same stationshave been set in the both stations andthat the IP addresses correspond.

IP address and subnet mask, see“Assign IP address”.

5Save and compile the configuration with thebutton.

6 Select the SIMATIC 300 station and load the

configuration data to the controller using thebutton.

7 Close NetPro.

Load blocks into the S7-300 station

Next, the blocks of the S7 program must be loaded to the S7-300 station.Follow the instructions of the table below. 

Table 2-10

No. Instructions Note

1 Select the block folder of the SIMATIC 300 stationin the STEP 7 project “App04“.

2Load the blocks to the controller via thebutton.

The system data needs not be loaded.

3 Switch the CPU 315-2 DP to RUN mode bypressing the mode switch.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 14/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 14/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

2.3.3 Importing the XDB file to the Station Configuration Editor 

In order to use the OPC server on the PG/PC the configuration must beloaded from the STEP 7 project to the Station Configuration Editor of thePG/PC. Please follow the instructions below: 

Table 2-11

No. Instructions Note

1 Open the Station Configuration Editor on thePG/PC via:

Start Station Configuration Editor 

2 Open the Import XDB-file dialog with theImport station... button.

Confirm the message with Yes.

3 Select the XDB-file “pcst_1.xdb“ of the STEP 7project ”App04“. It is located at:

<LW>\<Project directory>\ App04\XDBs\

This XDB file contains the completePG/PC configuration.

Example for project directory:

C:\Programs\Siemens\Step7\S7Proj\App04\XDBs

4 Open the Station Configuration Editor dialog with Open.

5 Start the import by pressing OK.

After a successful import the StationConfiguration Editor should display theconfiguration on the right.

Even if a warning is displayed in the“Station Configuration Editor“ dialog

( ), the import can be performed.

6 Adjust the station name of the PG/PC viaStation name.

The station name equals the name of the PCstation in the STEP 7 project. In this example:“GS_03_02“.

The station name in the StationConfiguration Editor is different to thecomputer name of the PG/PC (seeControl Panel   System).

7 Close the “Station Configuration Editor” dialogbox.

Note The application is now runnable! 

For operating the application you can continue with chapter 3 Operatingthe Application. 

The following explanation on configuration only becomes necessary if you wish to make adjustments or want to know which configurations weremade prior to this application.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 15/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 15/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

2.4 Configurations of the application

the configurations made in the course of this application.

There are several options for configuring the OPC server.Here, generating an XDB file with STEP 7 is illustrated which can then beloaded to the station manager.

Note You must first create the PG/PC interface according to chapter 2.3.1.

2.4.1 Configuring the OPC server in HWConfig Table 2-12

No. Instructions Note

1 Create a new station of thetype ”SIMATIC PC Station“in your STEP 7 project.

Below, it is assumed that the partner station (SIMATIC S7-300 station) has already been configured.

2 Open the created station bydouble-clickingConfiguration 

The hardware configuration opens.

3 Add a SIMATIC NET OPCserver to slot 1.

This application uses the SIMATIC NET OPC server V6.2.1.

4 Add a CP 1613 to slot 2. This application uses a CP 1613 V6.0 SP5. After adding theCP, the “Properties – Ethernet Interface” dialog opens.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 16/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 16/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

No. Instructions Note

5 Set the parameters as inthe screenshot on the right.

Note:

If no IE network has beenconfigured yet, yougenerate a new one withNew... and apply thestandard parameters.

6 Save and compile thehardware configuration with

.

Close the hardware

configuration.

2.4.2 Configuring the connection with the OPC server in NetPro

Table 2-13

No. Instructions Note

1Open NetPro with thebutton.

2 Select the OPC server.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 17/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 17/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

No. Instructions Note

3 Generate a new connectionwith a right-click.

4 Select CPU 315-2DP as

connection partner.

Select ISO-on-TCP

connection as the

connection type.

Acknowledge with OK.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 18/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 18/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

No. Instructions Note

5 In the Options tab of thefollowing dialog youdetermine the operatingmode of the connection.

Send/Recv, Fetch or Writecan be selected.

6 In the OPC tab you have toset the send buffer for theSend/Receive connection.

Note: 

It must correspond withthe data length enteredat the receive block inS7. 

7 This enables you toconfigure all requiredconnection.

Note:

Two SR connections andrespectively one Fetchand one Write connectionare required for thisproject.

8 Save and compile the

configuration with .

9 Close NetPro.

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.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 19/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 19/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

2.4.3 Check the settings

The settings can be checked with the configuration dialog for the OPCserver. 

The following settings should be considered: 

Table 2-14

No. Instructions Note

1 Open the configurationconsole “Set PCStation“ via the startmenu:

With: Start Simatic SIMATIC NET Set PCStation 

2 Check the set accesspoint.

3 Check the set IPaddress

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 20/26

 Setup and Operation of the Application

Installation and Commissioning

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 20/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

No. Instructions Note

4 Check the set protocols.

Note:

Activating the SRprotocol is sufficientfor this application.

5 If one of the settingsdoes not correspondwith the displayedimages, perform thepreceding configurationagain.

Close the configurationdialog box.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 21/26

 Setup and Operation of the Application

Operating the Application

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 21/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

3 Operating the Application

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

User interface The following figure shows the user interface of the example program. 

Figure 3-1 

Description of the user interface

In the following table, all interactive controls are described. No.

corresponds to the respective number in Figure 3-1. Table 3-1

No. Description

1 Establishing the connection with the OPC server specified in “Server name”(SIMATIC NET OPC server). This corresponds to the ProgID of the server.

2 Values for / from the memory bit double-words 200, 204 and 208 on thecontroller.

3 Enables reading and writing the values using the variable services. Here youcan either use Fetch or Write.

• When using Fetch the result data fetched from the controller are displayed

at (2).

• When using Write the data to be entered by you at (2) are used and sent

to the controller.

4 Enables entering data to be sent to the controller by means of block services.

5 Transfer of data from PC to S7 by means of block service using the data of (4).

6 Transfer of data from S7 to PC using a block service. Result in (7).

7 Data transfer result from (6).

8 Disconnection from the OPC server.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 22/26

 Setup and Operation of the Application

Operating the Application

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 22/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Operating sequence: Starting and operating the visualization

The following instructions specify the operating options for the exampleprogram in connection with the preceding table. 

Instructions

1 Start the Application04.exe file in the directory:

[Installation directory]\Application04\bin

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, allrequired OPC items are created.

Now you have the option of either using the variable services in Variables 

or the block services in Block. Using of either is not exclusive of the

respective other.

5 In Variables you can enter 

• enter values and send them to the controller with Write.

or 

• fetch the actual values from the controller using Fetch.

6 In Blocks you can either 

• send PC->S7 values to the controller,

or 

• receive S7->PC values from the controller.

7 With Disconnect you can interrupt the connection to the OPC server any

time.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 23/26

 Setup and Operation of the Application

Operating the Application

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 23/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Variable table The variables are available in the included STEP 7 project "App04". 

Figure 3-2 

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 24/26

 Appendix and List of Further Literature

Glossary

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 24/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

Appendix and List of Further Literature

4 Glossary

COM

Component Object Model: Software model for communication betweencomponents based on a standardized interface; DCOM

DCOM

Distributed Object Model: Software model for communicating beyondcomputer boundaries based on COM.

Eventhandler 

An Event handler processes occurring events or Windows messages.

Exception

An Exception is referred to as an exceptional situation.It can be generated either by the operating system (e.g. Division by zero) or by the user program.

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 definitionof function and parameter interfaces.

OPC

OLE for process control. A standardization for process control created for the automation sector. Maintained by the OPC - Foundation. Severalinterfaces with different tasks exist.

OPC client

A program which uses the services of an OPC server by sending requeststo the server via existing OPC interfaces.

OPC DA

OPC Data Access interface. The interface enables monitoring andchanging of process values.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 25/26

 Appendix and List of Further Literature

Glossary

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

V1.0 02.05.05 25/26 

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

OPC server 

A program which provides one of the OPC interfaces and responds torequests 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 Custominterface for the .NET Framework. The RCW enables accessing older COMports for the .NET Framework.

Sink interface

Using the sink interface, messages between components can be sent. Thesink interface is based on COM mechanisms.

Windows message

The standard Microsoft Windows operating systems exchange messagesto notify of events, e.g. the paint event.

Wrapper 

The term Wrapper normally refers to a class group which encapsulatesother class groups for data conversion or easier handling.It can be considered an “envelope” enclosing the “wrapped” classes,covering them from the outside.

8/8/2019 21523291 OPC SR Demonstration DOKU v10 e

http://slidepdf.com/reader/full/21523291-opc-sr-demonstration-doku-v10-e 26/26

 Appendix and List of Further Literature

Literature

OPC with SEND/RECEIVE Protocol, Entry-ID: 21523291

   C  o  p  y  r   i  g   h   t     ©    S

   i  e  m  e  n  s   A   G

    2   0   0   5   A   l   l  r   i  g   h   t  s  r  e  s  e  r  v  e   d

   2   1   5   2   3   2   9   1

_   O   P   C

_   S   R

_   D  e  m  o  n  s   t  r  a   t   i  o  n_

   D   O   K   U

_  v   1   0

_  e .   d  o  c

 

5 Literature

5.1 Bibliographic References

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

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,Industrialcommunication

SIMATIC NET, Industrial communication withPG/PC

Volume 1 – Basics, System Manual

(on SIMATIC NET CD)

/3/ SIMATIC NET,

Advanced PCConfiguration

SIMATIC NET Commissioning PC Stations -Manual / Quick Start

(on SIMATIC NET CD or in Product Support atentry-ID: 13542666).

/4/ Setting up S7-300 S7-300, CPU 31xC and CPU 31x: InstallationOperating Instructions

(available in the Product Support; Entry ID:13008499).

/5/ Power-PG manual SIMATIC Field PG P4, Manual

(available in the Product Support; Entry ID:17962811).

5.2 Internet links

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

Topic Title

\1\ Reference tothisdocumentation

http://support.automation.siemens.com/WW/view/en/21523291 

\2\ Siemens A&DCustomer Sup-port

http://support.automation.siemens.com