762
Preface, Contents General Information 1 Industrial Communication 2 Installation and Commissioning 3 Tools 4 Basics of the OPC Interface 5 OPC Process Variables for SIMATIC NET 6 Properties of the OPC Event Server for SIMATIC NET 7 Using the OPC Server 8 Examples 9 FAQs 10 Related Literature 11 Glossary Industrial Communication with PG/PC SIMATIC NET Manual 05/2003 C79000–G8976–C172 Edition 02 This manual is part of the documentation packages with the order numbers: 6GK1971–1GA00–0AA1 6GK1971–5DA00–0AA1

Industrial Communication With PG-PC

Embed Size (px)

DESCRIPTION

Industrial communications.

Citation preview

Page 1: Industrial Communication With PG-PC

Preface, Contents

General Information1

Industrial Communication2

Installation and Commissioning3

Tools4

Basics of the OPC Interface5

OPC Process Variables forSIMATIC NET

6

Properties of the OPC EventServer for SIMATIC NET

7

Using the OPC Server8

Examples9

FAQs10

Related Literature11

Glossary

Industrial Communication withPG/PC

SIMATIC NET

Manual

05/2003C79000–G8976–C172Edition 02

This manual is part of thedocumentation packages with the ordernumbers:

6GK1971–1GA00–0AA16GK1971–5DA00–0AA1

Page 2: Industrial Communication With PG-PC

2SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Classification of Safety-Related Notices

This manual contains notices which you should observe to ensure your own perso-nal safety, as well as to protect the product and connected equipment. These noti-ces are highlighted in the manual by a warning triangle and are marked as followsaccording to the level of danger:

!Danger

indicates that death or severe personal injury will result if proper precautions arenot taken.

!Warning

indicates that death or severe personal injury can result if proper precautions arenot taken.

!Caution

with warning triangle indicates that minor personal injury can result if proper pre-cautions are not taken.

Caution

without warning triangle indicates that damage to property can result if proper pre-cautions are not taken.

Notice

indicates that an undesirable result or status can result if the relevant notice isignored.

Note

highlights important information on the product, using the product, or part of thedocumentation that is of particular importance and that will be of benefit to theuser.

Page 3: Industrial Communication With PG-PC

3SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Trademarks

SIMATIC�, SIMATIC HMI� and SIMATIC NET� are registered trademarks ofSIEMENS AG.

Third parties using for their own purposes any other names in this document whichrefer to trademarks might infringe upon the rights of the trademark owners.

Safety Instructions Regarding your Product:

Before you use the product described here, read the safety instructions below tho-roughly.

Qualified Personnel

Only qualified personnel should be allowed to install and work on this equipment.Qualified persons are defined as persons who are authorized to commission, toground, and to tag circuits, equipment, and systems in accordance with establis-hed safety practices and standards.

Correct Usage of Hardware Products

Note the following:

!Warning

This device and its components may only be used for the applications described inthe catalog or the technical description, and only in connection with devices orcomponents from other manufacturers which have been approved or recommen-ded by Siemens.

This product can only function correctly and safely if it is transported, stored, setup, and installed correctly, and operated and maintained as recommended.

Before you use the supplied sample programs or programs you have written your-self, make certain that no injury to persons nor damage to equipment can result inyour plant or process.

EU Directive: Do not start up until you have established that the machine on whichyou intend to run this component complies with the directive 89/392/EEC.

Correct Usage of Software Products

Note the following:

!Warning

This software may only be used for the applications described in the catalog or thetechnical description, and only in connection with software products, devices, orcomponents from other manufacturers which have been approved or recommen-ded by Siemens.

Before you use the supplied sample programs or programs you have written your-self, make certain that no injury to persons nor damage to equipment can result inyour plant or process.

Page 4: Industrial Communication With PG-PC

4SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Prior to Startup

Prior to startup, note the following:

Caution

Prior to startup, note the information and follow the instructions in the latest docu-mentation. You will find the ordering data for this documentation in the relevantcatalogs or contact your local Siemens office.

We have checked the contents of this manual for agreement with the hard-ware and software described. Since deviations cannot be precluded entirely,we cannot guarantee full agreement. However, the data in this manual arereviewed regularly and any necessary corrections included in subsequenteditions. Suggestions for improvement are welcomed.

DisclaimerCopyright � Siemens AG 2003 All rights reserved

The reproduction, transmission or use of this document or its contents is notpermitted without express written authority. Offenders will be liable fordamages. All rights, including rights created by patent grant or registration ofa utility model or design, are reserved.

Siemens AGAutomation and DrivesIndustrial CommunicationPostfach 4848, D-90327 Nuernberg Technical data subject to change.

Siemens Aktiengesellschaft C79000–G8976–C172–02

Page 5: Industrial Communication With PG-PC

5SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Welcome to SIMATIC NETSIMATIC NET – The Right Decision

You know the advantages of distributed automation systems and want to makeoptimum use of industrial communication. You expect a strong partner andinnovative, reliable products. With SIMATIC NET, you’ve made the right choice.

SIMATIC NET – Pioneering successful solutions in black and white

Now that you have made your decision, we’ll be at your side. This documentationwill be your companion on your way to successful application of SIMATIC NET. Itwill provide you with a gradual and clear introduction to the topics and will showyou how to install components, how to configure your project and the individualcomponents, and how to create your own programs based on OPC. You will seethe opportunities that industrial communication with SIMATIC NET can open up foryou, for your automation solutions, and, above all, for the success of yourcompany.

SIMATIC NET – Professional solutions not only for professionals

To use SIMATIC NET successfully, you don’t need to be an expert. Thisdocumentation will build up your knowledge and let you profit from the know-howand expertise of the specialists.

Are you a beginner? Then you can familiarize yourself systematically. Start withthe introduction to industrial communication. Here, you will learn everything youneed to know about the principles of communication, the range of functions ofSIMATIC NET, the technical possibilities, and suitable functions for implementingyour automation tasks. When you have digested this information, you should turnyour attention to installation and commissioning. Here, of course, everythingrevolves around the OPC interface: Read the basic introduction to the OPCinterface, familiarize yourself with the OPC variables, and learn how to put theOPC Server from SIMATIC NET to the best possible use.

Are you a professional? Then you can get going straight away. Step-by-stepdescriptions, and comprehensive references will guide you over the shortestpossible way to installation, configuration, and operation of SIMATIC NET.

You find examples useful? The supplied sample programs will provide you with aflexible basis with which you can put your own ideas into practice.

Page 6: Industrial Communication With PG-PC

6SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 7: Industrial Communication With PG-PC

7SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Contents1 General Information 23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.1 Finding your Way through the Documentation 23. . . . . . . . . . . . . . . . . . . . 1.1.1 Where to Find Descriptions of the Various Products 23. . . . . . . . . . . . . . . 1.1.2 What’s New in the Product Documentation? 24. . . . . . . . . . . . . . . . . . . . . . 1.1.3 What’s the Latest Version of the Documentation? 25. . . . . . . . . . . . . . . . . 1.1.4 How to Work with the Documentation 25. . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2 Contacts and Training 26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3 Regulations 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 Legal Regulations 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 Safety–related Regulations 28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 Industrial Communication 29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.1 Introduction to Industrial Communication 29. . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Special Requirements of Industrial Communications Systems 30. . . . . . 2.1.2 Types and Categories of Networks 30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 Communications Functions in Automation Engineering 31. . . . . . . . . . . . 2.1.4 Terms Used in Industrial Communications Engineering 31. . . . . . . . . . . .

2.2 SIMATIC NET in Industrial Communications Engineering 34. . . . . . . . . . 2.2.1 SIMATIC NET for Industrial Communication 34. . . . . . . . . . . . . . . . . . . . . . 2.2.2 SIMATIC NET Communications Systems 35. . . . . . . . . . . . . . . . . . . . . . . .

2.3 Industrial Communication with PROFIBUS 37. . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Description of PROFIBUS 37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Protocols and Devices for SIMATIC NET PROFIBUS 38. . . . . . . . . . . . . 2.3.3 Bus Access Mechanism of PROFIBUS 40. . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.4 PROFIBUS in the ISO/OSI Reference Model 41. . . . . . . . . . . . . . . . . . . . .

2.4 S5–compatible Communication over FDL (SEND/RECEIVE protocol) 442.4.1 Typical System Configuration for S5–compatible Communication 44. . . 2.4.2 Principle of SEND/RECEIVE Communication 45. . . . . . . . . . . . . . . . . . . . 2.4.3 SEND/RECEIVE Configuration 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.4 SEND/RECEIVE Services 46. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.5 DP Protocol 47. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.1 The DP Protocol and its Expansions 48. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.2 Typical DP System Configuration 50. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.3 Principle of DP Communication 51. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.4 DP Configuration 53. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.5 Class 1 DP Master – Principle of Communication and Services 54. . . . . 2.5.6 DP Slaves – Principle of Communication and Services 56. . . . . . . . . . . . 2.5.7 Class 2 DP Master – Principle of Communication and Services 56. . . . . 2.5.8 DPC1 – Principle of Communication and Services 58. . . . . . . . . . . . . . . . 2.5.9 DPC2 – Principle of Communication and Services 60. . . . . . . . . . . . . . . .

2.6 PROFIDrive Bus Server Drives 61. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.7 FMS Protocol 62. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.1 Typical FMS System Configuration 62. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.2 Principle of FMS Communication 63. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.3 FMS Configuration 64. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.4 FMS Services 66. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 8: Industrial Communication With PG-PC

8SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.7.5 FMS Variable Services with a PC as FMS Client 67. . . . . . . . . . . . . . . . . . 2.7.6 FMS Variable Services with a PC as FMS Server 68. . . . . . . . . . . . . . . . .

2.8 S7 Protocol for PROFIBUS 69. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.1 Typical S7 System Configuration 70. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.2 Principle of S7 Communication 70. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.3 S7 Configuration 72. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.4 S7 Variable Services 74. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.5 S7 Buffer Send/Receive Services 75. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.6 S7 Block Management Services 76. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.7 S7 Event Services: Alarms 78. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.8 How to Program Alarms 79. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.9 S7 Security Services 81. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.10 S7 Information Services 81. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.9 Industrial Communication with Industrial Ethernet 82. . . . . . . . . . . . . . . . . 2.9.1 Description of Industrial Ethernet 82. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.9.2 Protocols and Devices for SIMATIC NET Industrial Ethernet 83. . . . . . . 2.9.3 Bus Access Methods of Industrial Ethernet 84. . . . . . . . . . . . . . . . . . . . . . 2.9.4 Fast Ethernet 85. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.9.5 Industrial Ethernet in the ISO/OSI Reference Model 86. . . . . . . . . . . . . . . 2.9.6 Transport Protocols for Industrial Ethernet 88. . . . . . . . . . . . . . . . . . . . . . .

2.10 S5–compatible Communication (SEND/RECEIVE) 89. . . . . . . . . . . . . . . . 2.10.1 Typical SEND/RECEIVE System Configuration 89. . . . . . . . . . . . . . . . . . . 2.10.2 Principle of SEND/RECEIVE Communication 90. . . . . . . . . . . . . . . . . . . . 2.10.3 SEND/RECEIVE Configuration 92. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.10.4 Buffer SEND/RECEIVE Services 92. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.10.5 SEND/RECEIVE Variable Services 93. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.11 S7 Protocol for Industrial Ethernet 95. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.11.1 Typical S7 System Configuration 95. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.11.2 Principle of S7 Communication 96. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.12 Fault–Tolerant S7 Connections 97. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.12.1 Properties of Fault–Tolerant S7 Connections 97. . . . . . . . . . . . . . . . . . . . . 2.12.2 Fault–Tolerant S7 Connections on two Paths 99. . . . . . . . . . . . . . . . . . . . . 2.12.3 Fault–Tolerant S7 Connections on Four Paths 100. . . . . . . . . . . . . . . . . . . . 2.12.4 Points to Note when Configuring Fault–Tolerant Connections 101. . . . . . .

2.13 SNMP Protocol 102. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.13.1 Typical System Configuration for the SNMP Protocol 102. . . . . . . . . . . . . . 2.13.2 Principle of Communication with the SNMP Protocol 103. . . . . . . . . . . . . . 2.13.3 Configuring 103. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.13.4 SNMP Traps 106. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.14 Buffer–Oriented Services with the OPC Interface 107. . . . . . . . . . . . . . . . . 2.14.1 Properties of Buffer–Oriented Communication 107. . . . . . . . . . . . . . . . . . . . 2.14.2 Mapping Data Buffers on OPC Variables 108. . . . . . . . . . . . . . . . . . . . . . . . 2.14.3 Using Buffer–Oriented Services 108. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.14.4 Points to Note When Using Buffer–Oriented Services with TCP/IP native

109. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 Installation and Commissioning 111. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.1 Step 1: Installing Software 111. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Possible Security Gaps with Standard IT Interfaces 112. . . . . . . . . . . . . . .

Page 9: Industrial Communication With PG-PC

9SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.1.2 Installing SNMP Services for Windows NT 4.0 113. . . . . . . . . . . . . . . . . . . . 3.1.3 Installing the SNMP Services for Windows 2000 / Windows XP 114. . . . .

3.2 Step 2: Installing Hardware 116. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.3 Step 3: Configuring a New Module 118. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Background Information on PC Stations 119. . . . . . . . . . . . . . . . . . . . . . . . . 3.3.2 Significance of the First Configuration of the Module 120. . . . . . . . . . . . . . 3.3.3 Adapting Mismatched Configurations 121. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.4 Support from the Commissioning Wizard 122. . . . . . . . . . . . . . . . . . . . . . . . 3.3.5 Special Features of SOFTNET Industrial Ethernet Modules 122. . . . . . . .

3.4 Step 4: Configuring the PC Station and Creating Networks (DefinedConfiguration) 124. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.4.1 Significance of Configured Communication 124. . . . . . . . . . . . . . . . . . . . . . 3.4.2 Support from the PC Station Wizard 125. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.3 Adopting the Configuration on the PC Station 126. . . . . . . . . . . . . . . . . . . .

3.5 Step 5: Entering / Creating Symbols 128. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 Background Information on Using Symbols 128. . . . . . . . . . . . . . . . . . . . . . 3.5.2 Working with the Symbol File Configurator 129. . . . . . . . . . . . . . . . . . . . . . . 3.5.3 Adopting the Symbols from PROFInet iMAP and SIMOTION Scout 130.

3.6 Step 6: Checking the Configuration and Diagnostics 131. . . . . . . . . . . . . .

3.7 Step 7: Testing with OPC Scout 132. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.1 Detecting Errors in Communication with the OPC Scout 132. . . . . . . . . . .

3.8 Advanced PC Configuration –Changing to the New SIMATIC NET CD 07/2001 134. . . . . . . . . . . . . . . . .

3.8.1 LDB and XDB Databases 135. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.2 Effects on Older Product Versions (CD 05/2000 and earlier) – Industrial

Ethernet 139. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.3 Effects on Older Product Versions (CD 05/2000 and earlier) – PROFIBUS

141. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.4 No Changes to the User Program Necessary 143. . . . . . . . . . . . . . . . . . . . 3.8.5 Simplification of OPC ItemIDs 143. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.9 Interaction of the “Configuration Console“ and the “Set PG/PC Interface“Configuration Program 145. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.10 Using Modules for PG Operation with STEP 5 and STEP 7 148. . . . . . . .

4 Tools 149. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.1 The Symbol File Configurator 150. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Description of the User Interface 151. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 The “File” Menu 152. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 The “Edit” Menu 153. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.4 How to Delete Elements and Blocks 154. . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.5 The “Insert” Menu 155. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.6 How to Insert a New Program / How to Delete a Program. 156. . . . . . . . . 4.1.7 How to Insert a New Block 158. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.8 How to Insert a New Symbol 159. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.9 How to Import and Export the Assignment List 160. . . . . . . . . . . . . . . . . . . 4.1.10 How to Browse the Address Space of the OPC Server 161. . . . . . . . . . . . 4.1.11 The “Window” Menu 163. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.12 The “Help” Menu 163. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 10: Industrial Communication With PG-PC

10SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1.13 Properties of Symbols 164. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.14 Entries in Symbol Files 166. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.15 Importing Symbol Files from STEP 7 167. . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.2 The Symbol File Configurator as of SIMATIC NET Version 6.1 168. . . . . . 4.2.1 Description of the User Interface 169. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 The “File” Menu 170. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3 The “Edit” Menu 171. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.4 The “Window” Menu 172. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.5 The “Help” Menu 172. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.6 How to Insert a New Symbol 172. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.7 How to Insert a New Folder 174. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.8 How to Delete Folders or Symbols 175. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.9 How to Import a Symbol File 175. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.10 How to Export a Symbol File 175. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.3 DCOM Settings 176. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 The dcomcnfg System Program 176. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 “Default Properties” Tab 177. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 “Default Security” Tab 179. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.4 “Applications” Tab 180. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.5 “Default Protocols” Tab 181. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.6 Configuration of the Server Computer 181. . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.7 “Location” Tab 182. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.8 “Identity” Tab 182. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.9 “Security” Tab 184. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.10 Configuration of the Client Computer 189. . . . . . . . . . . . . . . . . . . . . . . . . . . .

5 Basics of the OPC Interface 191. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.1 Basic Terminology 191. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 What are COM Objects? 191. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.2 How do COM Objects Appear? 193. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.3 What do COM Interfaces Provide? 193. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.4 What Types of Interface Exist? 194. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.5 What Does Object Control through Automation Mean? 194. . . . . . . . . . . .

5.2 Introduction to XML and SOAP 195. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Web Services 197. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.3 Introduction to OPC 198. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 What Does the OPC Interface Provide? 199. . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 What is an OPC Server? 201. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.3 What is an OPC Client? 202. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.4 How do the Server and Client Work Together? 203. . . . . . . . . . . . . . . . . . .

5.4 OPC Data Access 205. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 What Does the Class Model of OPC Data Access Provide? 206. . . . . . . . 5.4.2 OPC Server Class 206. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.3 OPC Group Class 207. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.4 OPC Item Class 207. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 Using the “Percent Deadband” Parameter 208. . . . . . . . . . . . . . . . . . . . . . . 5.4.6 Which interfaces are specified for OPC Data Access? 209. . . . . . . . . . . . .

5.5 OPC Alarms & Events 210. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.1 What are Events and Event Messages? 210. . . . . . . . . . . . . . . . . . . . . . . . . 5.5.2 What Does the Class Model of OPC Alarms & Events Provide? 211. . . .

Page 11: Industrial Communication With PG-PC

11SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.5.3 OPC Event Server Class 212. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.4 OPC Event Subscription Class 212. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5 OPC Event Area Browser Class 212. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.6 How are Messages Received? 213. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.7 Which Interfaces are Specified for Alarms & Events? 213. . . . . . . . . . . . . .

5.6 OPC XML Interface 214. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.1 Web Service OPC XML 216. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.2 Simple Read / Write Services 216. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.7 OPC in SIMATIC NET 218. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.1 What Does the OPC Server of SIMATIC NET Provide? 218. . . . . . . . . . . . 5.7.2 How is the OPC Server of SIMATIC NET Used in the World of Automation?

220. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.3 What are the Advantages of the OPC Server for SIMATIC NET? 221. . . 5.7.4 What is the Best Way to Access Process Data? 222. . . . . . . . . . . . . . . . . . 5.7.5 Using Group Operations 222. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.6 Examples of Group Operations 223. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.7 Accessing the OPC Cache 224. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.8 Examples of Services that Can Use the Cache 224. . . . . . . . . . . . . . . . . . . 5.7.9 Structuring Items 225. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.10 Example of Structuring Items 226. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.11 Using Buffer Send/Receive Services 226. . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.7.12 Example of Using Buffer Send/Receive Services 228. . . . . . . . . . . . . . . . . 5.7.13 Using Suitable OPC Methods 228. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6 OPC Process Variables for SIMATIC NET 233. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.1 Which Communication Functions Exist? 233. . . . . . . . . . . . . . . . . . . . . . . . .

6.2 What Are Process Variables? 234. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.3 How Are the ItemIDs of the Process Variables Formed? 235. . . . . . . . . . .

6.4 PROFIBUS-DP 236. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.1 Protocol ID 237. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.2 Connection Names 237. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.3 SIMATIC NET Inproc-Server for the PROFIBUS-DP Protocol 237. . . . . . 6.4.4 DPC1 and DPC2 Services 239. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.5 Process Variables for Services of a Class 1 Master 240. . . . . . . . . . . . . . . 6.4.6 Syntax of Process Variables for a Class 1 Master 241. . . . . . . . . . . . . . . . . 6.4.7 Examples of Process Variables for a Class 1 Master 243. . . . . . . . . . . . . . 6.4.8 DPC1 Services 244. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.9 Syntax of the Process Variables for DPC1 Services 244. . . . . . . . . . . . . . . 6.4.10 Examples of Process Variables for DPC1 Services 247. . . . . . . . . . . . . . . . 6.4.11 Fast Logic for the CP 5613 and CP 5614 (Master Only) 247. . . . . . . . . . . 6.4.12 Syntax of the control variables for Fast Logic 248. . . . . . . . . . . . . . . . . . . . . 6.4.13 DP-Specific Information Variables 250. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.14 Syntax of the DP-specific Information Variables 251. . . . . . . . . . . . . . . . . . 6.4.15 PROFIDrive 256. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.16 Protocol ID 256. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.17 Device Name 256. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.18 Addressing the Bus Node (Slave) 258. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.19 Syntax of the System-Specific Information Variables 263. . . . . . . . . . . . . . 6.4.20 DP Class 2 Master Services 264. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.21 Syntax of the DP Class 2 Master Services 264. . . . . . . . . . . . . . . . . . . . . . .

Page 12: Industrial Communication With PG-PC

12SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.4.22 Name of the CP 265. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.23 Addressing a Bus Node (DP Class 1 Master) 265. . . . . . . . . . . . . . . . . . . . . 6.4.24 Addressing the Bus Node (Slave) 267. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.25 Items for the CP 274. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.26 Special Parameters for all Items 275. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.27 Examples of DP–Specific Information Variables 276. . . . . . . . . . . . . . . . . . 6.4.28 Variable Services for Access to Local Slave Data 277. . . . . . . . . . . . . . . . . 6.4.29 Syntax of the process variables for the DP slave 278. . . . . . . . . . . . . . . . . . 6.4.30 Examples of Process Variables for the DP Slave 280. . . . . . . . . . . . . . . . . 6.4.31 DP Slave-Specific Information Variables 281. . . . . . . . . . . . . . . . . . . . . . . . . 6.4.32 Syntax of the DP Slave-Specific Information Variables 281. . . . . . . . . . . . .

6.5 S7 Communication 282. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.1 Protocol ID 282. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.2 Connection Names 283. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.3 Variable Services 283. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.4 Syntax of the Process Variables for S7 Variable Services 284. . . . . . . . . . 6.5.5 Examples of Process Variables for S7 Variable Services 287. . . . . . . . . . . 6.5.6 Buffer-oriented Services 287. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.7 Syntax of the Process Variables for Buffer-Oriented Services 288. . . . . . . 6.5.8 Examples of Process Variables for Buffer-oriented Services 290. . . . . . . . 6.5.9 S7-specific Information Variables 291. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.10 Syntax of the S7-specific Information Variables 291. . . . . . . . . . . . . . . . . . . 6.5.11 Examples of S7-specific Information Variables and Return Values 294. . . 6.5.12 Block Management Services 295. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.13 Syntax of the Control Variables for Block Management Services 296. . . . 6.5.14 Examples of Using the Block Management Services 299. . . . . . . . . . . . . . 6.5.15 Passwords 301. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5.16 Syntax of the Control Variables for Passwords 302. . . . . . . . . . . . . . . . . . . 6.5.17 Example of Using Passwords 303. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.6 PROFIBUS FMS 303. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.1 Protocol ID (FMS) 304. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.2 Connection Names 304. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.3 Data Types 304. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.4 Variable Services 306. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.5 Syntax of the Process Variables for FMS Variable Services 307. . . . . . . . 6.6.6 Examples of Process Variables for FMS Variable Services 307. . . . . . . . . 6.6.7 FMS-Specific Information Variables 308. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.8 Syntax of the FMS-specific Information Variables 308. . . . . . . . . . . . . . . . . 6.6.9 Examples of FMS-Specific Information Variables and Return Values 312. 6.6.10 FMS Server Variables 313. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.11 FMS Server Variables: ItemID 313. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.7 S5-compatible Communication 314. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.1 S5-compatible Communication over Industrial Ethernet 314. . . . . . . . . . . . 6.7.2 Protocol ID 314. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.3 Connection Names 315. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.4 Variable Services 315. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.5 Buffer-oriented Services 318. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.6 SEND/RECEIVE-Specific Information Variables 323. . . . . . . . . . . . . . . . . . 6.7.7 S5-compatible Communication over PROFIBUS 324. . . . . . . . . . . . . . . . . . 6.7.8 Protocol ID 325. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.9 Connection Names 325. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 13: Industrial Communication With PG-PC

13SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.7.10 Buffer-oriented Services 325. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7.11 FDL-specific Information Variables 331. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.8 SNMP Communication over Industrial Ethernet 335. . . . . . . . . . . . . . . . . . . 6.8.1 Protocol ID 335. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8.2 Data Types of the SNMP Protocol 335. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8.3 Process Variables for SNMP Variable Services 336. . . . . . . . . . . . . . . . . . . 6.8.4 SNMP-specific Information Variables 337. . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8.5 SNMP-specific Traps 340. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7 Properties of the OPC Event Server from SIMATIC NET 343. . . . . . . . . . . . . . . . .

7.1 S7 Communication 344. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7.2 Parameters for Events 345. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7.3 Event Attributes 346. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.1 EVENT_ATTR_S7_ACK_STATE 346. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.2 EVENT_ATTR_S7_DATA0n 347. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.3 EVENT_ATTR_S7_DATA0n_DATATYPE 348. . . . . . . . . . . . . . . . . . . . . . . . 7.3.4 EVENT_ATTR_S7_DATA0n_VALUE_LEN 349. . . . . . . . . . . . . . . . . . . . . . . 7.3.5 EVENT_ATTR_S7_EVENT_STATE 349. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.6 EVENT_ATTR_S7_NO_DATA 350. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.7 EVENT_ATTR_S7_PCTIME 350. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.8 EVENT_ATTR_S7_S7TIME 350. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.9 EVENT_ATTR_S7_STATE 350. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7.4 Simple Event Server for SNMP Communication 351. . . . . . . . . . . . . . . . . . 7.4.1 Packaging the Variables for a Trap 354. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8 Using the OPC Server 355. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8.1 SIMATIC Computing 355. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.1 What Are ActiveX Controls? 356. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.2 How Do Controls Access Process Data? 358. . . . . . . . . . . . . . . . . . . . . . . . 8.1.3 How Does Access with DCOM Work? 359. . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.4 How Are SIMATIC NET Controls Used in a Development Environment?

360. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.5 Configuring the SIMATIC NET OPC Data Control 361. . . . . . . . . . . . . . . . . 8.1.6 Opening the Properties Window for SIMATIC NET OPC Data

Control 362. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.7 Selecting the OPC Server 362. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.8 Connecting Display Controls and Process Variables 363. . . . . . . . . . . . . . . 8.1.9 Assigning an Event to a Process Variable 365. . . . . . . . . . . . . . . . . . . . . . . . 8.1.10 Optional Tasks 367. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.11 Configuring a Button Control 370. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.12 Properties of the Button Control 371. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.13 Opening the Properties Window for the Button Control 372. . . . . . . . . . . . 8.1.14 Specifying the Label 372. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.15 Specifying the Font of the Label 373. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.16 Specifying the Color of the Button Control 373. . . . . . . . . . . . . . . . . . . . . . . 8.1.17 Activating the Button Control 374. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.18 Connecting the Button Control with the Process Data 374. . . . . . . . . . . . . 8.1.19 Configuring a Number Control 375. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.20 Properties and Methods of the Number Control 376. . . . . . . . . . . . . . . . . . . 8.1.21 Opening the Properties Window for the Number Control 380. . . . . . . . . . . 8.1.22 Defining Data Display 381. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 14: Industrial Communication With PG-PC

14SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.23 Specifying the Appearance 383. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.24 Specifying the Label 383. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.25 Specifying the Scaling for the Display 385. . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.26 Specifying the Font of the Label 386. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.27 Specifying the Color of the Number Control 386. . . . . . . . . . . . . . . . . . . . . . 8.1.28 Activating the Number Control 387. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.29 Connecting the Number Control with the Process Data 387. . . . . . . . . . . . 8.1.30 Configuring a Slider Control 388. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.31 Properties of the Slider Control 388. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.32 Opening the Properties Window for the Slider Control 390. . . . . . . . . . . . . 8.1.33 Defining Data Display 390. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.34 Activating a Slider Control 391. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.35 Connecting the Slider Control with the Process Data 392. . . . . . . . . . . . . . 8.1.36 Using Other ActiveX Controls 392. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.37 What Are the Guidelines for Container Applications? 393. . . . . . . . . . . . . . 8.1.38 What Are the Guidelines for ActiveX Controls? 393. . . . . . . . . . . . . . . . . . . 8.1.39 How Does the Data Control Read Data? 394. . . . . . . . . . . . . . . . . . . . . . . . . 8.1.40 How Is Data Written to the Data Control? 394. . . . . . . . . . . . . . . . . . . . . . . . 8.1.41 Properties and Methods of the SIMATIC Controls 395. . . . . . . . . . . . . . . . . 8.1.42 Activated 398. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.43 Alignment 399. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.44 Appearance 400. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.45 AutoConnect 401. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.46 AutoConnectTimeout 401. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.47 BackColor 402. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.48 BorderStyle 402. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.49 Captionn 403. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.50 CaptionnAlignment 403. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.51 CaptionnBackColor 405. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.52 CaptionnFont 406. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.53 CaptionnForeColor 406. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.54 CaptionnSize 407. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.55 ConvertedValue 408. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.56 DataType 409. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.57 DefaultDeadband 410. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.58 DefaultUpdateRate 411. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.59 Direction 412. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.60 Enabled 412. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.61 Factor 413. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.62 FalseCaption 414. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.63 FalseColor 415. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.64 Font 416. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.65 ForeColor 416. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.66 LargeChange 417. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.67 LayoutType 418. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.68 LimitCheck 418. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.69 Locked 419. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.70 LowerLimit 420. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.71 Max 421. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.72 Min 421. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.73 NodeName 422. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.74 Offset 422. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 15: Industrial Communication With PG-PC

15SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.75 Precision 423. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.76 Radix 424. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.77 RangeRawMax 425. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.78 RangeRawMin 426. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.79 RangeScaledMax 427. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.80 RangeScaledMin 428. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.81 ScaleMode 429. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.82 ServerName 431. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.83 ShowButtons 431. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.84 ShowErrorBoxes 432. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.85 SmallChange 433. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.86 Ticks 433. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.87 TrueCaption 434. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.88 TrueColor 434. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.89 UpperLimit 435. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.90 Value 435. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.91 WriteMode 436. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.92 ZeroPad 437. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.93 AddNotification 438. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.94 Connect 439. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.95 Disconnect 439. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.96 GetItemProperties 440. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.97 QueryAvailableItemProperties 440. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.98 ReadMultiVariables 442. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.99 ReadVariable 443. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.100 Write 444. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.101 WriteMultiVariables 444. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.102 WriteVariable 445. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.103 Events of the SIMATIC Controls 445. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.104 Events of the Data Control 445. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.105 Events of the Button Control 446. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.106 Events of the Number Control 446. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.107 Events of the Slider Control 447. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.108 Error Messages of the SIMATIC Controls 447. . . . . . . . . . . . . . . . . . . . . . . . 8.1.109 Error Messages of the Data Control 448. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1.110 Error Messages of the Number Control 448. . . . . . . . . . . . . . . . . . . . . . . . . .

8.2 Programming the Automation Interface 450. . . . . . . . . . . . . . . . . . . . . . . . . . 8.2.1 Programming the Automation Interface for Data Access 450. . . . . . . . . . . 8.2.2 What Does the Object Model of OPC Data Access Provide? 450. . . . . . . 8.2.3 Points to Remember When Programming 451. . . . . . . . . . . . . . . . . . . . . . . . 8.2.4 Objects of the Automation Interface for Data Access 452. . . . . . . . . . . . . . 8.2.5 Programming the Automation Interface for Alarms & Events 467. . . . . . . . 8.2.6 What Does the Object Model of OPC Alarms & Events Provide? 467. . . . 8.2.7 Points to Remember When Programming 468. . . . . . . . . . . . . . . . . . . . . . . . 8.2.8 Objects of the Automation Interface for Alarms & Events 469. . . . . . . . . .

8.3 Programming the Custom Interface 484. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.1 Creating COM Objects and Querying the Status of the OPC Server 485. 8.3.2 Objects of the Custom Interface for Data Access 485. . . . . . . . . . . . . . . . . 8.3.3 OPCServer Object 486. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.4 OPCGroup Object 492. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.5 Objects of the Custom Interface for Alarms & Events 499. . . . . . . . . . . . . .

Page 16: Industrial Communication With PG-PC

16SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3.6 OPCEventServer Object 500. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.7 OPCEventSubscription Object 504. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.8 OPCEventAreaBrowser Object 507. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.9 Interfaces of the Client for Alarms and Events 508. . . . . . . . . . . . . . . . . . . . 8.3.10 IOPCEventSink Interface 509. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.11 IOPCShutdown Interface 510. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8.4 Programming the XML Interface 511. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.1 Description of the Elements 511. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.2 Basic Schemas 512. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.3 ItemProperty 513. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.4 ItemValue 514. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.5 OPCError 515. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.6 ReplyBase 516. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.7 RequestOptions 517. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.8 Read 518. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.9 ReadResponse 520. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.10 Write 522. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.11 WriteResponse 524. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.12 Using Subscriptions 526. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.13 Subscribe 528. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.14 SubscribeResponse 530. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.15 SubscriptionPolledRefresh 531. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.16 SubscriptionPolledRefreshResponse 533. . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.17 SubscriptionCancel 534. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.18 SubscriptionCancelResponse 535. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.19 Browse 535. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.20 BrowseResponse 538. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.21 GetProperties 540. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.22 GetPropertiesResponse 541. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.23 GetStatus 542. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.24 GetStatusResponse 544. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8.5 OPC Scout 546. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.1 Starting the OPC Scout 546. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.2 Connecting the OPC Scout to a Local Server 546. . . . . . . . . . . . . . . . . . . . 8.5.3 Connecting the OPC Scout to a Remote Server 547. . . . . . . . . . . . . . . . . . 8.5.4 Creating a Group 548. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.5 Browsing the Process Space 548. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.6 Creating New Variables 549. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.7 Adding and Monitoring Variables 549. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.8 Customizing the Display 550. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.9 Displaying Attributes 552. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.10 Changing Values 552. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.11 Working with the OPC Scout 552. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.12 The Main Window of OPC Scout 553. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.13 OPC Navigator 557. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9 Sample Programs 559. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9.1 Sample Program – Programming with ActiveX Controls 560. . . . . . . . . . . . 9.1.1 Running the Program 560. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.2 Description of the Program 561. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.3 Principle of Assigning Control Properties to OPC Process Variables 562. 9.1.4 Configuring the SIMATIC S7 Number Control 562. . . . . . . . . . . . . . . . . . . .

Page 17: Industrial Communication With PG-PC

17SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.1.5 Configuration of the SIMATIC NET OPC Data Control 564. . . . . . . . . . . . . 9.1.6 Implementing the Event Procedures 566. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1.7 Notes on Writing your own Programs 569. . . . . . . . . . . . . . . . . . . . . . . . . . .

9.2 Sample Program for the OPC Automation Interface (SynchronousCommunication) 570. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9.2.1 Activating the Simulation Connection 570. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.2 Working with the Sample Program 571. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.3 How the Program Runs 573. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.4 Description of the Program 574. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.5 Command_Start_Click 574. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.6 Command_Read_Click 576. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.7 Command_Write_Click 577. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.8 Command_Exit_Click 578. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.9 GetQualityText 579. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.10 Notes on Writing your own Programs 579. . . . . . . . . . . . . . . . . . . . . . . . . . .

9.3 Sample Program for the OPC Automation Interface (AsynchronousCommunication) 580. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9.3.1 Activating the Simulation Connection 580. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.2 Working with the Sample Program 581. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.3 Start Program 581. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.4 Read and Write Values 582. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.5 Activate Group 583. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.6 Stop the Program 583. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.7 How the Program Runs 584. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.8 Description of the Program 585. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.9 Command_Start_Click 586. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.10 The “Group Active” Check Box 588. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.11 Command_Read_Click 589. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.12 Command_Write_Click 590. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.13 Command_Exit_Click 592. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.14 GroupObj_AsyncReadComplete 593. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.15 GroupObj_AsyncWriteComplete 594. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.16 ObjGroup_DataChange 596. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.17 GetQualityText 597. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.18 GetErrorString 597. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.19 Notes on Writing your own Programs 598. . . . . . . . . . . . . . . . . . . . . . . . . . .

9.4 Sample Program for the OPC Custom Interface(Synchronous Communication) 599. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9.4.1 Activating the Simulation Connection 599. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.2 Working with the Sample Program 600. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.3 How the Program Runs 601. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.4 Description of the OPCDA_SyncDlg.cpp Program 605. . . . . . . . . . . . . . . . 9.4.5 OnInitDialog 606. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.6 OnStart 607. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.7 OnRead 617. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.8 OnWrite 620. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.9 OnStop 622. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.10 DestroyWindow 624. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.11 GetQualityText 625. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.12 Notes on Writing your own Programs 627. . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 18: Industrial Communication With PG-PC

18SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.5 Sample Program for the OPC Custom Interface(Asynchronous Communication) 628. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9.5.1 Activating the Simulation Connection 628. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.2 Working with the Sample Program 629. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.3 Start Program 629. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.4 Read and Write Values 630. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.5 Activate Group 631. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.6 Stop the Program 632. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.7 How the Program Runs 632. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.8 Description of the Program Structure 639. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.9 The OPCDA_AsyncDlg.cpp File 639. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.10 Callback.cpp and Callback.h 663. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.5.11 Notes on Writing your own Programs 670. . . . . . . . . . . . . . . . . . . . . . . . . . .

9.6 Sample Program for the OPC XML Interface 671. . . . . . . . . . . . . . . . . . . . . 9.6.1 Working with the Sample Program 671. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.2 Adding a Web Service to the Project 673. . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.3 The MainForm Class 674. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.4 The Constructor of MainForm and the Dispose Method 675. . . . . . . . . . . . 9.6.5 Creating the Dialog Box Elements 676. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.6 The Main Method 682. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.7 The Button_Start_Sample_Click Method 682. . . . . . . . . . . . . . . . . . . . . . . . 9.6.8 The Button_Stop_Sample_Click Method 685. . . . . . . . . . . . . . . . . . . . . . . . . 9.6.9 The Button_Read_Value_Click Method 686. . . . . . . . . . . . . . . . . . . . . . . . . . 9.6.10 The Button_Write_Value_Click Method 687. . . . . . . . . . . . . . . . . . . . . . . . . .

10 FAQs 689. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.1 FAQs in General 689. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.2 FAQs on the SIMATIC NET OPC Server 693. . . . . . . . . . . . . . . . . . . . . . . .

10.3 FAQs on the CP 1613 712. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.4 FAQs on SOFTNET Industrial Ethernet 717. . . . . . . . . . . . . . . . . . . . . . . . .

10.5 FAQs on SEND/RECEIVE for Industrial Ethernet 720. . . . . . . . . . . . . . . . .

10.6 FAQs on the CP 5613/CP 5614 722. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.7 FAQs on Converting from the CP 5412 to the CP 5613/CP 5614 and CP 5...11723. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.8 FAQs on SOFTNET PROFIBUS 724. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.9 FAQs on the CP 5511 725. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.10 FAQs on the CP 5611 729. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.11 FAQs on PROFIBUS SOFTNET S7 730. . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.12 FAQs on PROFIBUS SOFTNET DP 733. . . . . . . . . . . . . . . . . . . . . . . . . . . .

10.13 FAQs on the FDL Protocol in SOFTNET PROFIBUS 736. . . . . . . . . . . . . .

11 Related Literature 743. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11.1 Other Available Literature 743. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11.2 OPC Specifications 744. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Glossary 747. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 19: Industrial Communication With PG-PC

19SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Page 20: Industrial Communication With PG-PC

20SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 21: Industrial Communication With PG-PC

21SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Page 22: Industrial Communication With PG-PC

22SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 23: Industrial Communication With PG-PC

23SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

General Information

This chapter tells you about the contents, changes, and versions of thedocumentation and explains how you should use it. With the information here, youwill find the topics you want both quickly and easily.

The chapter also explains how to get support if you have technical questions.

At the end of the chapter, you will find the legal and safety regulations that apply toSIMATIC NET Products.

1.1 Finding your Way through the Documentation

1.1.1 Where to Find Descriptions of the Various Products

These products are described in this documentation:

� DP–5613/Windows V 6.0 and higher

� S7–5613/Windows V 6.0 and higher

� FMS–5613/Windows V 6.0 and higher

� SOFTNET–DP/Windows V 6.0 and higher

� SOFTNET–S7/Windows V 6.0 and higher

� SOFTNET–DP–Slave/Windows V 6.0 and higher

� CP 5613/CP 5614 Software V 6.0 and higher

� S7–1613/Windows V 6.0 and higher

� SOFTNET–S7/Windows V 6.0 and higher

� S7–REDCONNECT/Windows V 6.0 and higher

� PN OPC Server/Windows V 6.0 and higher

� SNMP OPC Server/Windows V 6.0 and higher

1

Page 24: Industrial Communication With PG-PC

General Information

24SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

1.1.2 What’s New in the Product Documentation?

The SIMATIC NET documentation previously took the form of separate manuals.To provide you with the information you require in a compact and user–friendlyform, we have integrated several manuals into this document. The table belowshows you where to find the topics covered by the previous manuals in thisdocumentation:

Topics in Previous Manuals Where to Find Them Now

S7 Programming Interface OPC Process Variables for SIMATICNET – “S7 Communication”

SEND/RECEIVE ProgrammingInterface

OPC Process Variables for SIMATICNET – “S5–compatibleCommunication over IndustrialEthernet”

Introduction to SOFTNET for Industrial Ethernet

“Industrial Communication withIndustrial Ethernet”

DP Programming Interface OPC Process Variables for SIMATICNET – “PROFIBUS –DP”

DPC1 Programming Interface OPC Process Variables for SIMATICNET – “DPC1 Services”

DP Slave “Variable Services for Access to LocalSlave Data”

FDL Programming Interface OPC Process Variables for SIMATICNET – “S5–compatibleCommunication over PROFIBUS”

FMS Programming Interface OPC Process Variables for SIMATICNET – “PROFIBUS –FMS”

COM PROFIBUS “NCM S7 for PROFIBUS” Manual

COML S7 COML S7 is no longer required and isnow replaced by the followingdocumentation:

“NCM S7 for PROFIBUS” or “NCM S7for Industrial Ethernet” Manual

Introduction to the OPC Server Many parts of this document

Page 25: Industrial Communication With PG-PC

General Information

25SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

1.1.3 What’s the Latest Version of the Documentation?

The table below shows the history and versions of this documentation:

Version CorrespondingSoftware Versions

Content/Changes

May 2003 V6.0 and V6.1 SIMATIC NET Softwarefor IndustrialCommunication withOPC

1.1.4 How to Work with the Documentation

To help you to work with the documentation, various conventions and symbolshave been used. These are intended to highlight different types of information andto speed up access to the information you require.

Conventions

The documentation uses a variety of conventions to highlight different types ofinformation and to allow you to locate specific types of information at a glance. Thetable below shows the conventions used.

Convention Meaning

“Typewriter font” This is program code.

Italics These are variable terms that must bereplaced by the currently relevantterm.

Bold In syntax descriptions: These arefixed syntactical elements.

In normal text: Words are highlighted to allow fastorientation.

{} Braces indicate optional information insyntax descriptions.

This indicates a warning.

Page 26: Industrial Communication With PG-PC

General Information

26SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

1.2 Contacts and Training

Contacts

If you have further questions about SIMATIC NET products, contact your localSiemens representative.

You will find the addresses:

� In our catalog IK PIavailable on the SIMATIC NET Documentation CD in “Catalog IK PI IndustrialCommunication and Field Devices“ (double–click on the file START.HTM in themain folder of the SIMATIC NET Documentation CD –> English –> selectionbox below “Industrial Communication SIMATIC NET“ Catalogs –> Catalog IKPI Industrial Communication and Field Devices).

� On the Internet http://www.ad.siemens.de

� In the interactive catalog CA01 http://www.siemens.de/automation/ca01

� On the Quick Start CD

Training Center

Courses are available to help you become familiar with the SIMATIC S7automation system and programmable controllers. Please contact your regionaltraining center or the central training center in D 90327 Nuremberg.

Course office information line:

Tel. 01805 / 23 56 11 (0.12 per minute in Germany)Fax. +49 / (0)1805 / 23 5612

Internet: http://www.siemens.de/sitrain

E–mail: [email protected]

A&D Technical Support

You will find information on A&D Technical Support at the end of this manual.

Page 27: Industrial Communication With PG-PC

General Information

27SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

1.3 Regulations

You must observe the following regulations relating to SIMATIC NET products:

1.3.1 Legal Regulations

We would point out that the contents of this document shall not become a part ofor modify any prior or existing agreement, commitment or legal relationship. ThePurchase Agreement contains the complete and exclusive obligations of Siemens.Any statements contained in this document do not create new warranties or restrictthe existing warranty.

We would further point out that, for reasons of clarity, this document cannot dealwith every possible problem arising from the use of the OPC Server. Should yourequire further information or if any special problems arise which are not sufficientlydealt with here, please contact your local Siemens representative.

Disclaimer

We have checked the contents of this document for agreement with the hardwareand software described. Since deviations cannot be precluded entirely, we cannotguarantee full agreement. However, the data in this document are reviewedregularly and any necessary corrections included in subsequent editions.Suggestions for improvement are welcomed.

Technical data subject to change.

The reproduction, transmission or use of this document or its contents is notpermitted without express written authority. Offenders will be liable for damages.All rights, including rights created by patent grant or registration of a utility ordesign, are reserved.

Siemens AG

Bereich Automatisierungs– und Antriebstechnik

Geschäftsgebiet Industrie–Automatisierung

Postfach 4848, D– 90327 Nürnberg

Siemens AG 2003

Page 28: Industrial Communication With PG-PC

General Information

28SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

1.3.2 Safety–related Regulations

Qualified Personnel

Only qualified personnel should be allowed to install and work with this product.Qualified persons are defined as persons who are authorized to commission, toground, and to tag circuits, equipment, and systems in accordance withestablished safety practices and standards.

Correct Usage

!Warning

This device and its components may only be used for the applications described inthe relevant catalog or the technical description, and only in connection with devi-ces or components from other manufacturers which have been approved or re-commended by Siemens.

This product can only function correctly and safely if it is transported, stored, setup, and installed correctly, and operated and maintained as recommended.

With the products described in this document, it is easy to access process dataand to modify process data. Modifying process data can lead to unforeseeablereactions in the process that can lead to death, serious injury to persons and/ordamage to equipment.

Proceed cautiously and make sure that you do not access data that could causeunexpected reactions from the controlled devices and equipment.

Page 29: Industrial Communication With PG-PC

29SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Industrial Communication

You want to get to know the principles of communication and the range of functionsof the individual protocols in industrial communication with SIMATIC NET. You areinterested in the technical options and when you have read through this sectionyou will be in a position to select the most suitable functions for solving yourautomation tasks.

Your Area of Interest Described in

You want to know what industrialcommunication actually involves.

Introduction to IndustrialCommunication

You want an overview of howSIMATIC NET fits into the overallconcept of Siemens industrialcommunication.

SIMATIC NET for IndustrialCommunication

You want to familiarize yourself withthe range of functions of the variousprotocols for industrial communicationon PROFIBUS.

Industrial Communication onPROFIBUS

You want to familiarize yourself withthe range of functions of the variousprotocols for industrial communica-tion on Industrial Ethernet.

Industrial Communication withIndustrial Ethernet

You want information on the use ofthe buffer–oriented services with theOPC interface.

Buffer–oriented Services with theOPC Interface

2.1 Introduction to Industrial Communication

Introduction

Communications networks are the backbone of modern automation solutions. Theyallow the interconnection and exchange of information between individualautomation components and devices.

This chapter contains general information about industrial communicationstechnology and engineering.

2

Page 30: Industrial Communication With PG-PC

Industrial Communication

30SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.1.1 Special Requirements of Industrial Communications Systems

Industrial Networks

Industrial networks must meet special requirements over and above those ofnormal networks. In the final analysis, the success or failure of a production plantdepends on the functionality and efficiency of the automation system.

� An industrial communications system must allow the connection of the simplestsensors and actuators to controllers and the connection of controllers to eachother and to computers.

� To ensure problem–free operation of processes and plants, availability must beguaranteed: The right information must be there where it is needed at the righttime.

� Certain factors common to an industrial environment such as electromagneticinterference, high levels of contamination, dampness or mechanical strain placehigh demands on the network structure and network components.

� A particularly important aspect is the integrity of the data. Problems affectingthe data transmitter or the transmission medium must be detected and signaledso that the user can rely on the information being correct.

� One automation solution is seldom the same as another. An industrialcommunications system must be flexible and capable of adaptation to theparticular situation on the shop–floor.

2.1.2 Types and Categories of Networks

Distinguishing Between Networks

To be able to categorize industrial communications networks, it is helpful to groupthem roughly according to the network span. Networks can be grouped as follows:

� Global Area Network (GAN): Networks spanning the entire world such as theInternet.

� Wide Area Network (WAN): Networks, for example spanning regions andcountries such as the Datex–P network of the German Post Office or theIntranets of large enterprises.

� Local Area Network (LAN): Communication within a restricted area, for examplein an office building. In a LAN, there is normally a homogeneous datatransmission structure.

Where do industrial networks fit in?

Industrial communications networks belong to the LAN group, although byinternetworking LANs, for example with the Internet, worldwide transmission ofselected information from the production area is nevertheless possible.

Page 31: Industrial Communication With PG-PC

Industrial Communication

31SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.1.3 Communications Functions in Automation Engineering

Industrial communications systems can perform various functions:

� Process or field communication: Direct connection of actuators and sensors toprogrammable logic controllers. Data exchange can be either cyclic using theprocess image or acyclic using control commands.

� Data communication: Data exchange between programmable controllers orbetween a programmable controller and intelligent partner (for example a PC)using protocols and interfaces from the industrial environment.

� IT communication: Programmable controllers can be linked to moderninformation technologies allowing worldwide data exchange using standardtools such as E–mail or Web browsers.

2.1.4 Terms Used in Industrial Communications Engineering

Introduction

This section explains some of the terms commonly used in communicationsengineering. You can skip this section and refer to the explanations later when youmeet them in a concrete context.

Terms and explanations

Protocol

A protocol is a convention for controlled transfer of data. Protocols specify, forexample, the data structure, the structure of data packets, and the coding.

Protocols can also specify control mechanisms as well as hardware and softwarerequirements.

Connection

A connection is a virtual channel between two communications partners.Communication using a connection–oriented protocol involves the following:

� Connection establishment

� Data exchange

� Connection termination

Connection–oriented communication can be compared with a phone call in whichthe connection is established after dialing the subscriber number, data isexchanged by the parties talking and the connection is then terminated by thesubscribers hanging up.

Page 32: Industrial Communication With PG-PC

Industrial Communication

32SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Client/server architecture

Using the client/server architecture, resources of several users can be shared. Theserver provides services to the clients. The clients use the services provided by theserver by sending a job to the server. The server processes the job and sends theresult back to the client. A server can normally service several clients at the sametime. The OPC interface is based on a client/server architecture.

Master/slave principle

If communication is based on the master/slave principle, there is a station knownas the master that can trigger communication with a slave on its own initiative. Theslave then responds to the master. The slave can transfer data in its response. Incontrast to the master, a slave never becomes active on its own initiative. ThePROFIBUS–DP protocol is an example of master/slave communication.

Synchronous/asynchronous

The terms synchronous/asynchronous are used to describe how a service isexecuted. If a service is executed synchronously, program control returns to thecaller only when the result of the service is returned.

If, on the other hand, a service is executed asynchronously, program controlreturns to the caller immediately after a service has been requested. The result ofthe service is returned to the caller at an unspecified time; in other words,asynchronously.

ISO/OSI reference model

The “Open Systems Interconnection” (OSI) layer model is a reference model fordata transmission in networks named after a working group of the InternationalStandardization Organization ISO. The model consists of seven layers: Twohardware–oriented layers (layers 1 and 2), two transmission–oriented layers(layers 3 and 4) and three application–oriented layers (layers 5, 6, and 7).

As a reference model, OSI is not a recognized standard. Many products intelecommunications and in networking use the ISO/OSI model as a foundation.

Page 33: Industrial Communication With PG-PC

Industrial Communication

33SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The 7 layers are as follows:

1. Physical layer (layer 1): The physical layer defines the bit transmission of datavia the network at the cable and connector level.

2. Data–link layer (layer 2): The data–link layer groups data into frames and addsinformation required for passing on the frames. Layer 2 is responsible fortransporting data frames from node to node and for error correction.

3. Network layer (layer 3): The network layer controls the routing of the frames inconjunction with layer 2. It handles the addressing of the frames and how theyare routed in the network. An example of this layer is the Internet protocol.

4. Transport layer (layer 4): Coordinates the transmission of data packets. Itchecks whether all packets have been received completely. A typical exampleof layer 4 is the Transmission Control Protocol (TCP).

5. Session layer (layer 5): The session layer establishes a connection between theprocesses running on different hosts. It is responsible for opening a “Session”and for a continuous dialog of requests and responses between the individualapplications.

6. Presentation layer (layer 6): The presentation layer is responsible for convertingdata into the format required for the specific application. This layer alsocompresses texts and converts various codes used by the partners.

7. Application layer (layer 7): The application layer is responsible for applicationsdirectly available to the user, such as file transfer or mail programs. The userrecognizes data transmission in the form of requests or responses.

Service Access Point (SAP)

The service access point is a point at which a layer of the ISO/OSI referencemodel provides its services to the next higher layer.

The entire exchange of information between two neighboring layers takes place viathe service access points. This is the interface between the higher and lower layer.If the SAP is between layer 3 (network layer) and layer 4 (transport layer), theservice access point is known as the NSAP, Network Service Access Point, and ifthe SAP is between layer 4 and layer 5 (session layer), it is known as the TSAP orTransport Service Access Point.

Normally, certain resources and communications partners are assigned to aservice access point and the SAPs required for communication are thereforeidentified with unique names and numbers.

Page 34: Industrial Communication With PG-PC

Industrial Communication

34SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.2 SIMATIC NET in Industrial Communications Engineering

Introduction

This section describes the possible applications of SIMATIC NET products.

2.2.1 SIMATIC NET for Industrial Communication

Properties of SIMATIC NET products

SIMATIC NET is the name of an entire family of communications networks andproducts from Siemens. The various networks meet the widest possible range ofperformance and application requirements in automation engineering:

� SIMATIC NET provides solutions meeting all the demands of industrialcommunication

� It is of central importance to the entire SIMATIC automation system

� It allows uniform interfacing between systems and to other automationcomponents

� Communication is comprehensive and fully integrated within the system

The communications networks from SIMATIC NET are a component of TotallyIntegrated Automation (TIA) from Siemens.

Page 35: Industrial Communication With PG-PC

Industrial Communication

35SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.2.2 SIMATIC NET Communications Systems

Introduction

The bus systems of SIMATIC NET and their functions fit into the automationpyramid model. This section describes the layers of this model:

Field level

At the field level, a higher–level, controlling node communicates with the fielddevices connected to its network. The field devices measure, signal, and pass onthe commands of the cell level to the higher level of the plant or process. At thislevel, the volume of data transferred is relatively small. A hierarchicalcommunication structure is typical here; in other words, several field devicescommunicate with one master.

At the field level, the signals acquired from the process by input and output devicesare sent to the programmable controller via a communications system. For processand field communication at this level, Siemens offers PROFIBUS–DP and theAS–Interface.

Page 36: Industrial Communication With PG-PC

Industrial Communication

36SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Cell level

This is the layer at which signals from the process acquired by the input and outputdevices are passed on to the programmable controller via a communicationssystem. At the cell level, programmable controllers, PCs, and devices for operatorcontrol and monitoring are interconnected.

At the cell level, programmable controllers exchange information allowing them toperform a common task or local operator control and monitoring systems areconnected to the programmable controllers. Data communication at the cell levelcan be implemented with components from Siemens both for Industrial Ethernetand PROFIBUS.

Management level

At this level, wider–ranging tasks are executed and processed that affect the entireproduction or process operation (management functions). These tasks includestorage of process values, running optimization and analysis functions, and loggingoperations. The required data can be collected, for example, from several processcells or factories and processed centrally. The number of nodes can run into thethousands.

At the management level, supervisory tasks involving the entire operation can behandled. Here, information about the entire plant comes together and commands(for example, recipes) can be transferred to underlying process cells. Forcommunication and data transmission at the management level, Industrial Ethernetfrom Siemens is the ideal communications system.

Note

Industrial Communication with the PC

As a component in an industrial automation system, the PC can handle bothcontrol tasks at the field level as well as operator control and monitoring functionsat the cell and management level. This documentation is restricted to industrialcommunication with a PC on PROFIBUS and Industrial Ethernet.

Page 37: Industrial Communication With PG-PC

Industrial Communication

37SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.3 Industrial Communication with PROFIBUS

Introduction

This section provides you with a general outline of the PROFIBUS bus system.

2.3.1 Description of PROFIBUS

Introduction

PROFIBUS is the open and internationally standardized bus system for processand field communication with field devices and for data communication within anautomation cell. Data transmission in PROFIBUS is either on cost–effectivetwisted–pair cables or on fiber–optic cables that are immune to electromagneticinterference.

This section describes the devices that can be used for communication with thePROFIBUS system. The section also describes the bus access mechanisms andexplains where PROFIBUS fits into the ISO/OSI reference model.

Page 38: Industrial Communication With PG-PC

Industrial Communication

38SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.3.2 Protocols and Devices for SIMATIC NET PROFIBUS

Process and Data Communication

SIMATIC NET provides the following PROFIBUS protocols and device types:

For process and field communication:

Protocol TypicalPC Module

Description Typical Sie-mens PartnerDevices

DP class 1master

CP 5613

CP 5614

CP 5511

CP 5611

Central device forreading the input andsetting the output dataof DP slaves. With theoptional DPV1extension, the mastercan also access datarecords of the DPV1slaves asynchronously.

ET 200B

ET 200X

ET 200L

ET 200LS

CP 5614

DP class 2master

CP 5611

CP 5511

CP 5613

Device for diagnosticsand commissioning aDP system. With theoptional DPV1extension, the mastercan also access datarecords of the DPV1slaves.

CP 5613

CP 342–5

CP 343–5

CP 443–5

and the slaveslisted above

DP slave CP 5611

CP 5511

CP 5614

Distributed I/O unit, forexample for acquiringand converting processsignals and transmittingoutput signals.

CP 5613

CP 5614

CP 5511

CP 5611

CP 342–5

CP 443–5

Page 39: Industrial Communication With PG-PC

Industrial Communication

39SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

For data communication:

Protocol Typical PCModule

Description Typical Sie-mens PartnerDevices

FMS CP 5613

CP 5614

Open protocol fornetworkingprogrammablecontrollers fromdifferent vendors at thecell level with few nodes

CP 5613

CP 343–5

CP 443–5

CP 5431 FMS/DP

S7Protocol

CP 5613

CP 5614

CP 5511

CP 5611

Integrated andoptimizedcommunicationsfunctionality of theSIMATIC S7/C7systems for a widerange of applications

CP 5611

CP 5613

CP 342–5,343–5

CP 443–5

S5–com-patiblecommuni-cation

CP 5613

CP 5614

CP 5511

CP 5611

Simple communicationservices based onPROFIBUS FDL forexchanging data withS5 and S7 devices.

CP 5431

CP 5434

CP 342–4,343–5

CP 443–5

Page 40: Industrial Communication With PG-PC

Industrial Communication

40SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.3.3 Bus Access Mechanism of PROFIBUS

Introduction

The PROFIBUS specification is flexible enough to allow the implementation ofvarious protocols optimized for specific tasks in different areas of application. TheFDL data–link layer (layer 2 of the OSI/ISO reference model) ensures uniformcontrol of access to the bus.

Token Passing

In PROFIBUS, access to the bus is controlled by a token–passing technique; inother words, only the station in possession of the token is allowed to transmit onthe network. After a fixed time, the token is passed to the next station. At the endof a cycle, the first station receives the token again.

Active and Passive Nodes

In a PROFIBUS network, there are two basic types of node:

� Active nodes control communication on the bus. Each active node receives thetoken once per cycle and can then exchange data with active and passivenodes. Once the token holding time has elapsed, the node passes the token onto the next master. DP masters and S7 servers, for example, are activestations.

� Passive nodes cannot initiate communication themselves. They do not receivethe token and respond only to polls from another station. A typical example of apassive station is a DP slave.

Page 41: Industrial Communication With PG-PC

Industrial Communication

41SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.3.4 PROFIBUS in the ISO/OSI Reference Model

Introduction

PROFIBUS is based on the ISO/OSI reference model but does not implement alllayers:

Layer 1

The physical layer (layer 1) of PROFIBUS uses the electrical and mechanicalcharacteristics of the widespread RS–485 interface. The PROFIBUS standarddefines a selection of bus parameters that can be adapted to meet the specialrequirements of a bus system.

Page 42: Industrial Communication With PG-PC

Industrial Communication

42SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Electrical Characteristics:

Maximum number of nodes 126

Standard transmission rates 9.6 / 19.2 / 45.45 / 93.75 / 187.5 / 500/ 1500 / 3000 / 6000 / 12000 Kbps

Cable length Depending on the transmission rateand medium, between 200 m and 90km

Topology BusStarRing (optical networks only)

LAN cable Shielded twisted pairFiber–optic cable

Termination Both ends of an electrical bus seg-ment must be terminated with a termi-nating resistor.

Mechanical Properties (Electrical Network):

Attachment 9–pin D–sub female connector on in-terfacing device with defined pin as-signment

Page 43: Industrial Communication With PG-PC

Industrial Communication

43SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Layer 2

The data–link layer (layer 2) defines the bus access method already mentionedand the basic services for data transmission. This layer is known as the fieldbusdata link (FDL). It ensures a uniform bus access protocol that specifies the basiccommunication properties for all specific implementations.

The FDL services can be divided into management services and productiveservices. The management services allow local settings to be made that arerequired to use the productive services. The productive services are responsiblefor the data transfer between the various PROFIBUS nodes.

The services for data transmission are as follows:

� SDN (Send Data with no Acknowledge)

� SDA (Send Data with Acknowledge)

� SRD (Send and Request Data with Reply)

Layers 3 to 7

Layers 3 to 6 are not explicitly implemented in the FMS and DP protocols specifiedin the PROFIBUS standard. In DP, layers 3 to 6 are omitted completely. Theadaptation is handled by the lower layer interface (LLI) assigned to layer 7 thatimplements subfunctions such as connection establishment, termination, andmonitoring.

S7 communication is the homogeneous extension of PROFIBUS in the SIMATICenvironment and also implements elements of the network layer (layer 3) and thetransport layer (layer 4).

Page 44: Industrial Communication With PG-PC

Industrial Communication

44SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.4 S5–compatible Communication over FDL(SEND/RECEIVE protocol)

Introduction

S5–compatible communication on PROFIBUS allows simple data exchange onPROFIBUS between SIMATIC S5 controllers, SIMATIC S7 controllers, and PCsand workstations.

This section describes the principle of communication and the services of theSEND/RECEIVE protocol. The section also describes the structure andconfiguration.

2.4.1 Typical System Configuration for S5–compatibleCommunication

Introduction

For data exchange using S5–compatible communication, communications modulesare available for controllers of the SIMATIC S5, SIMATIC 505 and SIMATIC S7families as well as for PCs and workstations.

Example of a Configuration

Page 45: Industrial Communication With PG-PC

Industrial Communication

45SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.4.2 Principle of SEND/RECEIVE Communication

General Description of the Principles

S5–compatible communication is based on the simple transmission of data in anFDL frame. During data transfer, the receiver provides a receive buffer to which thesender sends a data buffer. S5–compatible communication uses the services ofthe data–link layer of PROFIBUS, the fieldbus data link (FDL) directly.

Note

The OPC items used with the PC in S5–compatible communication on PROFIBUSare identified by the “FDL” prefix.

S5–compatible communication is possible only between active PROFIBUS nodes.Due to the length of FDL frames, the length of the user data is restricted to amaximum of 246 bytes per frame. Data is exchanged with the SDA (Send Datawith Acknowledge) and SDN (Send Data with No Acknowledge) services.

No connection establishment is necessary for communication. The sender andreceiver are assigned to each other by specifying the partner address and theservice access point (SAP). By selecting certain SAPs, it is also possible to send aframe to several nodes at the same time (broadcast/multicast).

2.4.3 SEND/RECEIVE Configuration

Address and Service Access Point

Before S5–compatible communication can be used on PROFIBUS, thecommunication relations must first be configured. A communication relation iscreated in the configuration by specifying a name, partner address and serviceaccess point.

Example

Page 46: Industrial Communication With PG-PC

Industrial Communication

46SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.4.4 SEND/RECEIVE Services

Introduction

This section provides you with an overview of the communication services that canbe used with S5–compatible communication.

Functions

S5–compatible communication on PROFIBUS provides the following function:

� Services for transferring data buffers (SEND / RECEIVE)

The following information services are also available on a PC:

� Obtaining the bus parameters and the local station address

� Obtaining the list of stations on the bus

� Identification of the local station and partner station

Note

In contrast to S5–compatible communication on Industrial Ethernet, the bufferservices on PROFIBUS do not provide the “Fetch” and “Write” variable services.

Description of the Services

S5–compatible communication provides services for transferring blocks of datausing the SDN and SDA FDL services. The transfer of a packet from the sender tothe receiver must be triggered explicitly by the sender. If the sender is, forexample, a SIMATIC S7 controller, this is done by calling the “AG_SEND” block,and if the sender is a PC with OPC, by calling a method for writing a “SEND”variable.

The receiver cannot initiate data transfer from the sender.

The size of the data buffer transferred is limited by the PROFIBUS frame lengthsof 244 bytes (or 246 bytes when using the default SAPs).

By using the broadcast SAP (63) and the broadcast address (127), it is possible tosend a frame to more than one station at the same time.

Since there is no connection and therefore no connection monitoring for thisprotocol, the receiver cannot detect the failure of a partner device. It is, however,possible to program cyclic send jobs on the controllers and PLCs and to have thereception of these jobs monitored by the partner and so achieve a form ofmonitoring.

Page 47: Industrial Communication With PG-PC

Industrial Communication

47SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

When using the OPC server, receive buffers are created by initializing a“RECEIVE” variable and send buffers by initializing a “SEND” variable.

When using the OPC server, it is possible to map the block of data or parts of it onindividual OPC variables and to assign these parts to data types. This structuringmakes the use of the buffer–oriented services much simpler for the OPC user.

Advantages / Disadvantages

S5–compatible communication on FDL has the following advantages anddisadvantages:

Advantages

� Larger blocks of data up to a size of 244 or 246 bytes.

� No network load when data is not being transferred.

� “Broadcast” frames to several nodes is possible.

� Structured access to blocks of data on the PC is possible with OPC.

� Communication with SIMATIC S5 and SIMATIC S7 devices is possible.

� Communication between two PCs/PGs is possible.

Disadvantages

� The receiver cannot initiate data transfer. It must wait until the data istransferred by the sender.

� No monitoring of the failure of a partner or break on the network provided forthe receiver by the protocol.

� No routing (forwarding a job to other networks).

2.5 DP Protocol

Introduction

This section describes the principle of communication and the services of the DPprotocol. The section also describes the structure and configuration.

Page 48: Industrial Communication With PG-PC

Industrial Communication

48SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.5.1 The DP Protocol and its Expansions

Description of the DP Protocol

The distributed peripheral I/O ( or simply DP) allows a large number of analog anddigital input and output modules to be used in a distributed structure in theimmediate vicinity of the process.

There can be large distances between the individual I/O devices bridged byPROFIBUS. Distributed I/O stations collect the input signals locally and these arethen fetched cyclically by the central controller. In the opposite direction, thecentral controller sends output data to the distributed I/O stations cyclically.

The DP protocol is intended for time–critical applications. The simple, optimizedtransmission protocol, the high transmission rates, and the use of a master–slavestructure achieve short cycle times.

As an open protocol, DP is based on the communications standard for the fieldarea (IEC 61158).

Example of a Configuration

Characteristics of the DP Protocol

The essential characteristics of the distributed I/O system are as follows:

� Central control by a master

� High data throughput with a simple transmission protocol

� Cyclic transmission of the process image in the input and output direction

� Detection of errors with online diagnostics

� Based on PROFIBUS FDL allowing operation along with other devices (mastersand slaves) on one bus.

Page 49: Industrial Communication With PG-PC

Industrial Communication

49SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

DPV1

The DPV1 standard represents an expansion of DP communication. Slavessupporting DPV1 have an additional memory area in which special, slave–specificdata records are stored. Using DPV1 functions, the data records can be read orwritten providing expanded functionality.

Characteristics of the DP Protocol and Expansions

Several expansions are available for the DP protocol with which specific propertiescan be implemented. The following table provides an overview of the various DPmasters and their expansions.

Description of the Protocols

Protocols Description

DP Class 1Master

Provides services for setting slave parameters and for cyclicdata exchange.

DP Class 2Master

Additional diagnostic options. A class 2 master can query thestatus of a class 1 master or a slave without interfering in theoperation of the network.

DPC1 DPV1 expansion for class 1 masters. This allows a C1master and the additional data areas of a DPV1 slave to bewritten to and read acyclically.

DPC2 DPV1 expansion for class 2 masters. Allows a C2 masterand the additional data areas of a DPV1 slave to be writtenand read acyclically.

Class 1 DP Master and DPC1:

Page 50: Industrial Communication With PG-PC

Industrial Communication

50SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Class 2 DP Master and DPC2:

2.5.2 Typical DP System Configuration

Example

The following graphic shows an example of a typical system configuration:

Page 51: Industrial Communication With PG-PC

Industrial Communication

51SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.5.3 Principle of DP Communication

Communication Partners

In the distributed I/O system, there are three types of communication partner:

Properties of DP Communication Partners

DP CommunicationPartners

Description

DP slaves Passive bus nodes, normally the I/O devices.

DP class 1 master Active node, central component for controlling theDP slaves.

DP class 2 master Active node that can be used for commissioning anddiagnostics parallel to a class 1 master.

Page 52: Industrial Communication With PG-PC

Industrial Communication

52SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Polling

Normal communication between the DP master and the distributed I/O stationstakes the form of polling. Polling means that the DP master sends cyclic pollingframes to the DP slaves assigned to it. A separate polling frame is sent for eachDP slave.

The polling frame contains the current output data that the DP slave will apply to itsoutput ports. If a DP slave does not have output ports, an “empty frame” is sentinstead.

The addressed DP slave must acknowledge that it has received a polling frame byreturning an acknowledgment frame. The acknowledgment frame contains thecurrent input data available at the input ports of the DP slave. If the DP slave doesnot have input ports, an “empty frame” is returned instead.

All the operational DP slaves are addressed in one polling cycle. The next pollingcycle starts immediately after the last slave has been addressed. This methodensures that the data is up–to–date. In every polling cycle, the DP master attemptsto include non–operational slaves in the cycle.

Note

The OPC items used with the PC during DP communication on PROFIBUS areidentified by the prefix “DP”.

Page 53: Industrial Communication With PG-PC

Industrial Communication

53SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

No Flow Control in DP

The DP protocol is optimized for fast data throughput between the master andslave and does not include flow control between the master and slave. Input andoutput data is exchanged cyclically between the master and slave. When writing aDP application, you should therefore bear the following points in mind:

� If the output data of the master changes more than once during the cycle time,some values will not be transferred to the slaves.

� If the input data of the master is not read within the cycle time, some valuechanges occurring on the slaves will be lost.

2.5.4 DP Configuration

Introduction

The DP master can only take part in productive data exchange with the DP slaveswhen it has previously set parameters for these slaves and configured them.

The master configures slaves and sets the parameters in the following situations:

� During the startup phase of the DP master.

� Following the temporary failure of a DP slave during the productive phase.

You specify and save the required configuration and parameter assignment dataduring configuration of the network.

Parameter Assignment Frame

The parameter assignment frame sets global operating parameters on the DPslave (for example the watchdog time).

Configuration Frame

The configuration frame is sent after the parameters of the DP slave have been setsuccessfully. This contains the current configuration of the DP slave. Theconfiguration includes the number and type of input/output ports.

The DP slave compares the received configuration frame with the values itobtained itself during the startup phase. If the values match, the DP slave confirmsthe configuration and changes to the productive phase.

Page 54: Industrial Communication With PG-PC

Industrial Communication

54SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.5.5 Class 1 DP Master – Principle of Communication and Services

The Modes of the DP Master

The DP master controls the status of the DP system. Each mode of the DP masteris characterized by defined actions between the DP master and the DP slaves:

Mode Meaning

OFFLINE There is no DP communication whatsoever between the DPmaster and DP slaves. This is the initial status of the DPmaster.

STOP In this mode, there is also no DP communication between theDP master and DP slaves. In contrast to the OFFLINE mode,a DP diagnostic station (DP class 2 master) can readdiagnostic information from the DP master.

CLEAR All DP slaves entered in the database and activated areassigned parameters and are configured. Following this, thevalue 0h is sent to all slaves with process output in theCLEAR mode; in other words, process output is deactivated.The input data of the slaves is known and can be read.

OPERATE In this mode, there is cyclic data exchange with the DP sla-ves. This is known as the productive phase. In this mode, theDP slaves are polled one after the other by the DP master.

Note

Starting from the current mode, the modes must be run through in the selectedorder (ascending or descending) OFFLINE –– STOP –– CLEAR –– OPERATE!

With the standard settings, the OPC server of SIMATIC NET controls the modesof the DP master automatically.

Page 55: Industrial Communication With PG-PC

Industrial Communication

55SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Description of the Services

Access to process variables by a user application of a class 1 master, is not directbut via a process image on the communications module. The process imagecontains the input data read in from all slaves in the last cycle and the output datato be written in the next cycle.

The process image includes three data areas for each DP slave:

� Input data from the DP slave

� Output data to the DP slave

� Diagnostic data from the DP slave

An application on a PC can use the following services via a class 1 DP master:

Variable services for the process image of the DP master

The following information services are also available:

� Mode of the DP master and the DP slaves

� Event messages from the DP master

� Activity monitoring by the DP module

� The type of a DP slave

Advantages / Disadvantages

Using a class 1 master has the following advantages and disadvantages:

Advantages

� Fast access to cyclic data

� Jobs from the applications can be processed extremely quickly because thedata can be obtained directly from the process image and do not lead explicitlyto communication.

� There are simple (and therefore cost–effective) communications modules.

Disadvantages

� High bus load due to the cyclic exchange of input and output data.

� Synchronization of access to process variables using OPC with the DP cycle isnot possible.

Page 56: Industrial Communication With PG-PC

Industrial Communication

56SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.5.6 DP Slaves – Principle of Communication and Services

Principle of Communication

A DP slave makes data communication available. It can set input data so that thiscan be fetched by the DP master in the next polling cycle and it can read and useoutput data sent by the DP master. The DP slave can also set diagnostic data thatis also fetched by the DP master in the next cycle.

Within DP communication, DP slaves are considered to be modular. Each slavecan be made up of several submodules each with their own input and outputareas.

A slave suitable for the DPV1 expansion, can contain additional data records foreach module. These data records contain slave–specific data that can be read andwritten by a DPV1 master. Up to 240 bytes of payload data are available per datarecord.

Configuring a DP Slave with STEP 7

2.5.7 Class 2 DP Master – Principle of Communication and Services

Principle of Communication

Along side devices belonging to the DP class 1 master, a DP system can alsoinclude devices belonging to DP class 2 master. Devices of this class are usedduring commissioning, configuration, and for diagnostics. They are normally usedin programming, configuration, or operator controlled devices.

Page 57: Industrial Communication With PG-PC

Industrial Communication

57SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

It is, for example, possible to connect a class 2 master to PROFIBUS fordiagnostic purposes. This can then query the status of slaves and class 1 mastersat any time without interfering with network operation. A class 2 master can alsochange the slave address if the slave permits this.

The inputs and outputs and diagnostic data of a slave can only be read; it is notpossible to write the outputs.

The essential functions of a class 2 master are as follows:

� Reading the slave data

� Reading the class 1 master data

Since these services are processed in addition to the cyclic services, a class 2master increases the network load.

Description of the Services

In much the same way as a class 1 master, the class 2 master can also access thecyclic input and output data and map information to variables. The data can,however, only be read and not written.

Other variables allow access to diagnostic data of the class 1 master and theslaves. By writing a special variable, the class 2 master can also set the address ofa slave.

Advantages / Disadvantages

Using a PC as a class 2 master has the following advantages and disadvantages:

Advantages

� Operation within the network is affected to only a very limited extent.

� The configuration of a slave can be modified (set slave address).

Page 58: Industrial Communication With PG-PC

Industrial Communication

58SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Disadvantages

� Inputs, outputs and diagnostic data of a slave can only be read.

� Synchronization of access to process variables using OPC with the DP cycle isnot possible.

2.5.8 DPC1 – Principle of Communication and Services

Principle of Communication

The DPV1 specification represents an expansion of DP communication both forclass 1 and class 2 masters. The functions specially for masters belonging toclass 1 are known as DPC1 services in SIMATIC NET.

With the DPC1 services, it is possible to poll data from the slaves acyclically inaddition to the cyclic polling by the DP master. Each DPV1 slave has an additionaldata area that can be read and written by the DPV1 master. This data areadepends on the specific slave and can contain, for example, parameter assignmentdata or alarm messages. The individual data records of the additional data areaare addressed by specifying the slot and index.

Page 59: Industrial Communication With PG-PC

Industrial Communication

59SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Description of the Services

The DPC1 services include the following:

� Acyclic reading and writing of data records

� Alarm servicing

Since the DPV1 services are handled with lower priority than the cyclic dataservices, the data throughput of DPV1 communication is lower. The round–triptime is also generally increased since the network is under additional load.

No communication connections to the slaves are necessary to use the DPC1functions since the polling cycle of the master is already initiated as an implicitconnection. As soon as a slave with DPC1 functionality has had parameters setand has been configured, it can be addressed by DPC1 functions.

It is only possible to access the data of a DPV1 slot in complete blocks. A read jobreturns the entire contents of a data record identified by the slot and index, a writejob overwrites the entire data record.

Note

When using the OPC server, it is possible to structure a data record. Parts of adata record can be separated, identified by a data type and used as a variable.Nevertheless, from a network point of view, the entire data record is always reador written.

Advantages / Disadvantages

Using the DPC1 services has the following advantages and disadvantages:

Advantages

� Asynchronous access to slaves is possible.

� Larger blocks of data can be transferred.

� Structured access to data fields is possible with OPC.

� Parallel use with variable services of the class 1 master is possible.

Disadvantages

� Additional load on the network.

� Lower data throughput compared with cyclic data transfer.

Page 60: Industrial Communication With PG-PC

Industrial Communication

60SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.5.9 DPC2 – Principle of Communication and Services

Principle of Communication

The DPV1 specification represents an expansion of DP communication both forclass 1 and class 2 masters.

The functions specially for masters belonging to class 2 are known as DPC2services in SIMATIC NET. With the DPC2 services, it is possible to poll data fromthe slaves acyclically from a class 2 master in addition to the cyclic polling by theDP master. Each DPV1 slave has an additional data area that can be read andwritten by the DPV1 master. This data area depends on the specific slave and cancontain, for example, parameter assignment data or alarm messages. Theindividual data records of the additional data area are addressed by specifying theslot and index.

The essential difference between this and the normal master–slave communicationis that a connection must first be established and then maintained until it isinterrupted by external influences or terminated by the master. As long as thisconnection is established, the master can communicate with the slave.

The most important DPC2 functions are as follows:

� Establishment and termination of a communication relation

� Reading the slave data

Description of the Services

Using DPC2 provides the user with the following services:

Buffer services via DPC2

Since the DPV1 services are handled with lower priority than the cyclic dataservices, the data throughput of DPV1 communication is lower. The round–triptime is also generally increased since the network is under additional load.

In the same way as a class 1 DP master (DPC1), a class 2 master can onlyaccess the data of a DPV1 slot as an entire block. A read job returns the entirecontents of a data record identified by the slot and index, a write job overwrites theentire data record.

Note

When using the OPC server, it is possible to structure a data record. Parts of adata record can be separated, identified by a data type and used as a variable.Nevertheless, from a network perspective, the entire data record is always read orwritten.

Page 61: Industrial Communication With PG-PC

Industrial Communication

61SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Advantages / Disadvantages

Using the DPC2 services has the following advantages and disadvantages:

Advantages

� Asynchronous access to slaves is possible.

� Larger blocks of data can be transferred.

� Structured access to data fields is possible.

� Parallel use with a class 1 master is possible.

Disadvantages

� Additional load on the network.

� Lower data throughput.

2.6 PROFIDrive Bus Server Drives

Introduction

The SIMATIC NET OPC PROFIDrive Bus Server maps the parameter items of ageneral OPC Profile Server to the SIMATIC NET DPC2 services. An OPCPROFIDrive client itself accesses only the OPC Profile Server. The OPC ProfileServer is not included on the SIMATIC NET CD.

Page 62: Industrial Communication With PG-PC

Industrial Communication

62SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.7 FMS Protocol

Introduction

This section describes the principle of communication and the services of the FMSprotocol. The section also describes the structure and configuration.

2.7.1 Typical FMS System Configuration

Introduction

The Fieldbus Message Specification (FMS) specifies a communications protocolstipulated in the EN 50170 standard at layer 7 of the ISO/OSI reference model.

FMS is therefore ideally suited for communication between heterogeneousautomation systems of different manufacturers. Due to the limited processingspeed resulting from the complex functionality, it is only useful in the cell area innetworks with few nodes.

Example of a Configuration

Page 63: Industrial Communication With PG-PC

Industrial Communication

63SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.7.2 Principle of FMS Communication

Communication Objects

The aim of the FMS communication model is to link distributed applicationprocesses to form an entire process. FMS uses an object–oriented representation:Real process objects, such as the temperature value of a thermal sensor aremapped on communication objects. The FMS specification describes the structureof the communication objects and the services that can be used with them.

Communication objects can be accessed in different ways:

� Object index: The most effective access makes use of an object index. Theindex is the address of an object in the form of a 16–bit counter.

� Symbolic access: The object is addressed using a unique symbolic name. Thisis a more convenient solution for the user since an object can be referenced, forexample, using a brief description of the data content.

A communication object is described by the following attributes:

� Index

� Symbolic name

� Data type

� Length

� Access rights/password

FMS devices contain an object dictionary (OD) that lists the objects provided bythe device. FMS allows an object dictionary to be read from a partner device toobtain information about the objects available. Depending on the configuration,object dictionaries can be very large. If an object dictionary is loaded each time aclient starts up, this can delay connection establishment considerably. To getround this problem, an FMS client can load the object dictionary of a partner atsome other time and store it locally, for example in a file. This functionality issupported by the SIMATIC NET OPC Server.

Note

The OPC items used with the PC during FMS communication on PROFIBUS areidentified by the prefix “FMS”.

Page 64: Industrial Communication With PG-PC

Industrial Communication

64SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Communication Relations

With few exceptions (broadcast/multicast), information is always exchangedbetween two communication partners. One partner adopts the client role and theother partner adopts the server role.

There is therefore a communication relation between the client and server. Theterm “communication relation” used in the FMS protocol corresponds to aconnection. Each node can maintain several communication relations with thesame and with different partners at the same time.

A communication relation is defined by a number of parameters in thecommunication reference. The parameters of a communication relation include theaddress of the partner station, the service access point, the type of connection andservices supported on the connection, and the size of the receive and sendbuffers.

Connection Type

The connection type describes the type of node involved in communication (masteror slave) and the type of transmission at layer 2 (cyclic or acyclic). The typicalconfiguration in the cell area is acyclic master–master communication.

Virtual Field Devices

A virtual field device (VFD) is an abstract object used to describe the data andbehavior of a device from the point of view of a communication partner. A VFDincludes all communication objects (for example communication relations) and theirproperties and statuses. Several VFDs can be assigned to a physical device and aVFD can include communication relations to several physical devices.

2.7.3 FMS Configuration

Introduction

For communication using the FMS protocol on PROFIBUS, the communicationobjects and communication connections must be specified in advance during theconfiguration phase.

The data specified in the communication are used by the communicationcomponents during run time and no longer need to be specified by a user program.If the system is physically reconfigured, the changes only need to be made in theconfiguration without needing to adapt the programs.

Page 65: Industrial Communication With PG-PC

Industrial Communication

65SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Objects and Connections

During configuration of FMS communication, the following elements are specified:

Virtual Field Devices (VFDs)

� Number and name of the virtual field device

� Vendor information

� Version

FMS Connections

� Name of the connection

� Addresses of the partner stations

� Service access points of the FDL layer (LSAPs)

� Communication type/connection type

� Services on this connection

� Access protection

Communication Objects

An object dictionary on an FMS server defines the objects that can be accessed byan OPC client. A communication object has the following properties:

� Index

� Symbolic name (optional)

� Data type

� Length

� Access rights

If the FMS server is an S7 device, the communication objects are specified in thesymbol table by defining additional properties.

If a PC with an OPC server is used as the FMS server, the communication objectsmust be defined within the definition of a VFD.

Page 66: Industrial Communication With PG-PC

Industrial Communication

66SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Example

2.7.4 FMS Services

Productive and Management Services

Due to the wide range of demands made of an FMS system, the FMS specificationdefines numerous services of which only a small part belong to the mandatoryservices.

A distinction is made between productive and management services:

Productive Services

� READ (read communication object)

� WRITE (write communication object)

Management Services

� INITIATE (start connection establishment)

� ABORT (terminate connection)

� STATUS (get the status of the partner)

� IDENTIFY (identify the communication partner)

� GET–OD (read out the object dictionary of the partner)

FMS Services for SIMATIC NET

� Variable services with the PC as FMS client

� Variable services with the PC as FMS server

� Identification and query of the attributes of a partner device

� Querying the status of a partner device

� Obtaining an overview of the nodes communicating on PROFIBUS

Page 67: Industrial Communication With PG-PC

Industrial Communication

67SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.7.5 FMS Variable Services with a PC as FMS Client

Description of the Services

A client (in this case a PC) can access the objects made available by an FMSserver as a variable. The client has two ways of addressing an object:

� The index of the communication object

� The symbolic name of the communication object

The client can obtain a list of the objects provided by a server and the properties ofa variable such as access rights and data type from the object dictionary of theserver.

When communication starts, the client (PC) can load this object dictionary toobtain all the information about the objects available for communication. Thevariables do not need to be configured at the client end. On the server, however,the object dictionary must be configured.

Once the object dictionary is available to the client, it can write or read variablesdepending on the access rights permitted by the server.

To enter into communication with the server, the connection between the twonodes must first be established. This is normally instigated by the client. Theconnection is established according to the characteristics specified in the list ofcommunication relations and confirmed by the server. From this point on, the otherFMS services can also be used. Either partner can terminate the connection at anytime.

Advantages / Disadvantages

Communication using FMS objects accessed by the PC has the followingadvantages and disadvantages:

Advantages

� As an open protocol, FMS can be used to access the widest range of FMSdevices.

� The server provides only the data configured by the user, unauthorized accessis not possible.

� A data type is defined for an object or variable on the server.

� The client can read the list of variables from the server so that variables do notneed to be configured on the client.

� Variables can be given a symbolic name and the client then reads the symbolicname from the object dictionary of the server.

Page 68: Industrial Communication With PG-PC

Industrial Communication

68SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Disadvantages

� The data throughput with this protocol is lower than with DP due to theuser–friendly characteristics listed above.

� To monitor a variable, this must be polled by the OPC server over thecommunication system. As a result, this leads to permanent network load.

2.7.6 FMS Variable Services with a PC as FMS Server

Description of the Services

On an FMS connection, the PC can also be used as the FMS server and providevariables. Other partner devices, for example programmable controllers, can readand write the variables available on the PC. An application running on the PC alsouses these variables in basically the same way as variables on a partner device:Write access sets the locally maintained variable. When the partner reads thevariable, the previously set value is read.

Variables are accessed

� using the index of a communication object or

� using the symbolic name of the communication object.

Which data is made available to which client is decided by the user duringconfiguration. An object dictionary must be created containing information aboutthe variables (type, initial value, access rights). This information is adopted in theobject dictionary of the FMS server (here, the PC).

Advantages / Disadvantages

The provision of variables by the PC acting as FMS server has the followingadvantages and disadvantages:

Advantages

� As an open protocol, FMS can be used to access the widest range of FMSdevices.

� No communication load when the partner is not reading or writing data.

� If variables on the server are written by a partner device, the changed valuesare reported on the OPC interface (if the variable is being monitored).

Page 69: Industrial Communication With PG-PC

Industrial Communication

69SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Disadvantages

� A program is required on the controller for reading or writing variables andplaces demands on the CPU of the controller.

� An object dictionary must be configured on the PC.

� The data throughput with this protocol is lower than with DP.

2.8 S7 Protocol for PROFIBUS

Introduction

This section describes the principle of communication and the services of the S7protocol. The section also describes the structure and configuration.

Communication Services

The S7 protocol supports the following communication services:

Service Description

Information services Information on the connection status.Display of the device/user status ofthe communication partner.

Variable services Functions for reading and writing oneor more variables.

Buffer send/receive services Program–controlled transfer of largeblocks of data.

Block management services These services allow the downloa-ding, uploading, deleting, and linkingof blocks in the program sequence ofa PLC during operation. This allowsdynamic modification of program se-quences and parameters.

Event services These services are used to receiveand process messages from SIMATICS7 programmable controllers, for ex-ample ALARMs.

Security services Setting passwords for access toSIMATIC S7 data objects.

Page 70: Industrial Communication With PG-PC

Industrial Communication

70SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.8.1 Typical S7 System Configuration

Introduction

The S7 protocol is used for communication with SIMATIC S7/M7 programmablecontrollers (PLCs). Its main features are as follows:

� Optimization for SIMATIC communication

� Adaptation of protocol elements to SIMATIC requirements

� Greater speed compared with other automation protocols for datacommunication.

� Availability for bus systems of the management and cell level such as IndustrialEthernet and the field level with PROFIBUS.

Example of a Configuration

2.8.2 Principle of S7 Communication

PC as Client or Server

The S7 protocol provides simple and powerful communication services on thebasis of a client–server model. Data is transmitted between an automationapplication on a SIMATIC PC station (client) and another automation application(server). Data is provided by the programmable controller and these stations aretherefore servers. The data is requested by an application running on a PC and thePC is therefore the client. During the connection establishment and in buffersend/receive services, the PC can also be the server.

Page 71: Industrial Communication With PG-PC

Industrial Communication

71SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

S7 Protocol with PROFIBUS

The implementation of the S7 protocol on PROFIBUS is based on the FDLservices (layer 2) and expands the protocol with the addition of Siemens–specificelements. Communication therefore provides the advantages of aconnection–oriented protocol, such as checking for the existence of a station withconnection monitoring.

S7 Connections

A connection for the S7 protocol is specified by the PROFIBUS addresses of thepartners and address details (for example service access points). These propertiesare specified for the S7 protocol in the configuration.

The S7 connection is identified on the PC by specifying the connection name, forexample, “S7_connection_1”.

S7 connections that are defined at both the client and server ends are known as“two–ended” connections. Connections defined only at the client end, for examplefrom a PC to an S7–300 station are known as “one–ended”.

On the programmable controller, a two–ended connection is identified by a localID, in the example, the value “1”. By specifying the local ID, S7 programs can usea communication connection with the aid of function blocks such asBRCV/BSEND.

Note

The OPC items used with the PC during S7 communication on PROFIBUS areidentified by the prefix “S7”.

Connection Establishment

During the connection establishment, the communication partners automaticallynegotiate the most important characteristics of the communication path. Thesettings used are those that can be achieved by both communication partners.

The following details are agreed upon:

� Size of the data packets at the transport level (PDU size)

� The number of send credits (number of send and receive resources used at thesame time)

Page 72: Industrial Communication With PG-PC

Industrial Communication

72SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.8.3 S7 Configuration

Introduction

For communication using the S7 protocol on PROFIBUS, the communicationconnections must be specified in advance during the configuration phase.

The data specified in the communication are used by the communicationcomponents during run time and no longer need to be specified by a user program.If the system is physically reconfigured, the changes only need to be made in theconfiguration without needing to adapt the programs.

Address and Service Access Point

The following is defined in the configuration for an S7 communication connection:

� Name of the connection

� Partner address

� Service access point of the transport layer (TSAP) for the local station

� Service access point of the transport layer (TSAP) for the remote station

� The way the connection is established

Example

Structure of the Service Access Point

The service access point for S7 communication (TSAP) is made up of 2 bytes:

Page 73: Industrial Communication With PG-PC

Industrial Communication

73SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Byte 1

Number of the communication resource reserved for this connection. The numberof the connection resource for the local and remote station is assigned by theconfiguration system (STEP 7). The configuration system makes sure that thereare not more resources assigned on the programmable controller than actuallyexist.

Some numbers are reserved for specific connection types and are not included inthe resource monitoring:

� 01: PG connection (reserved for the use of a programming device)

� 02: OS connection for operator control and monitoring devices that require nopermanent connection.

� 03: Other connections

Byte 2

Specifies the position of the CPU in the programmable controller:

� Bits 7 through 5: Rack

� Bits 4 through 0: Slot

(Special case: If the device attached to the network is addressed directly, the valueof byte 2 is zero)

Note

When using the OPC Server, further connection properties can be defined in theconfiguration:

– Time of connection establishment and termination by the OPC Server. – Use and configuration of alarm services on the connection. – Other detailed parameters.

Page 74: Industrial Communication With PG-PC

Industrial Communication

74SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.8.4 S7 Variable Services

Description of the Services

The S7 protocol allows simple access to S7 variables of a programmablecontroller.

S7 variables are normally parts of an S7 object starting at a specific memoryaddress of the object that are assigned a data type. For example, the variable withthe notation “DB 5,W10” accesses bytes 10 and 11 of data block 5 and representsthe content as a word. It is also possible to form array variables (several elementsof the same type in one variable).

The following are available as S7 objects on most S7 devices:

� Data blocks

� Instance data blocks

� Inputs/outputs

� Peripheral inputs/outputs

� Memory bits

� Timers

� Counters

Advantages / Disadvantages

Using the variable services has the following advantages and disadvantages:

Advantages

� Very simple access to the partner device without programming the partner.

� Reading and writing several variables and long arrays of variables is optimized.

� When using the OPC server, access rights can be assigned to protectsafety–related variables.

� With OPC, it is possible to use symbols from STEP 7.

� When using OPC, there is no limitation of the size of variables (particularlyarrays) to the size of a PDU.

� Data consistency over the entire length of the PDU when using the newerCPUs.

Page 75: Industrial Communication With PG-PC

Industrial Communication

75SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Disadvantages

� To monitor variable changes, the partner device must be accessed cyclically.

� Access at short intervals means a high network load.

� No guaranteed consistency of the data (data originate from several programcycles of the PLC) if the size of the variable exceeds the size of the PDU.

2.8.5 S7 Buffer Send/Receive Services

Description of the Services

Buffer–oriented services allow program–controlled transfer of larger blocks of data.Up to 65534 bytes of payload data can be transferred regardless of the size of thePDU.

For data exchange between a SIMATIC S7 PLC and a SIMATIC PC, theconnection must be configured at both ends. In contrast to the variable services,the connection configuration must be downloaded to the PLC.

To receive blocks of data, receive resources must be made available. The programof a programmable controller includes the “BRCV” function block for this purpose.

Note

When the OPC Server is used, the resources are made available by creating a“RECEIVE” variable.

When using the OPC server, it is possible to map the block of data or parts of it onindividual OPC variables and to assign these parts to data types. This structuringmakes the use of the buffer–oriented services much simpler for the OPC user.

Advantages / Disadvantages

Using the buffer–oriented services has the following advantages anddisadvantages:

Page 76: Industrial Communication With PG-PC

Industrial Communication

76SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Advantages

� Large (max. 64 Kbytes) blocks of data can also be transferred.

� A SIMATIC PC can be both client and server, in other words, with buffersend/receive services, data can also be transferred from PC to PC using the S7protocol.

� It is possible to structure the blocks of data in OPC items.

� All OPC variables defined within a receive buffer receive a change messagewhen a block of data arrives.

� Consistent data within a block of data (all data originate from one program cycleof the programmable controller)

� No network load from polling if no data are sent.

Disadvantages

� Send and receive blocks must be programmed on the PLC.

� The receiver cannot request data but must wait until data is sent.

� Buffer send/receive services are not available for all S7 programmablecontrollers.

2.8.6 S7 Block Management Services

Available Block Management Services

A block represents a loadable area on a programmable controller.

With the S7 protocol and using the OPC Server, the following block managementservices are possible and are started by the SIMATIC PG or PC:

� Downloading data from the PG/PC to the SIMATIC CPU.

� Uploading data from the SIMATIC CPU to the PG/PC.

� Linking of blocks in the program sequence of the SIMATIC CPU.

� Deleting blocks.

� Compressing the memory of the programmable controller.

Block Types

The block management services can be used with the following block types:

� Organization blocks (OB)

� Function blocks (FB)

� Functions (FC)

� Data blocks (DB)

Page 77: Industrial Communication With PG-PC

Industrial Communication

77SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Block Management

A block can be uploaded from a SIMATIC CPU to a PC by an S7–OPC applicationand vice versa. On the PC, the blocks are saved in files.

The block name must be unique on the S7–CPU. The maximum amount of data islimited depending on the specific CPU. The blocks are therefore divided intoseparate segments that are transferred sequentially.

Linking Blocks.

A block transferred to a programmable controller is stored in a buffer. This meansthat the block is not yet available for an S7 program. Although the block is visible inthe list of data blocks that can be viewed using the online functions of STEP 7, theblock cannot be opened. This is first possible after the block has linked into the listof active blocks.

Application of the Block Management Services Based on an Example

Blocks programmed or created with STEP 7 are transferred to a programmablecontroller from a programming device during commissioning. These blocks, in theexample DB_red_car.dbf, DB_green_car.dbf,... are stored as DB1, DB2, ... in theprogram memory. An S7–OPC application can upload these blocks duringoperation and save them locally as files DB_red_car.dbf, DB_green_car.dbf,.... APC controller can therefore download and delete blocks and influence theexecution of the program, for example by replacing DB1 (DB_red_car.dbf) withanother data block (DB_blue_car.dbf) that then becomes DB1.

Page 78: Industrial Communication With PG-PC

Industrial Communication

78SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

The block management services are mapped on OPC special variables. Writingthese variables triggers execution of a service. The values written are used as theparameters for the service.

2.8.7 S7 Event Services: Alarms

Description of the Services

Events can be signaled by alarms. Alarms must be programmed because they aretriggered by S7 blocks and not by a change in a process state.

Up to 10 associated values can be sent with an alarm. Alarms are exceptionalevents triggered by the partner device. Alarms are buffered and cannot be lost.

For the programmed messages, the user must include an ALARM, ALARM_8,ALARM_8P or NOTIFY S7 block in the S7 program. The block checks up to 8signals for changes and then sends a frame with the time and additional values.

Note

S7 alarms can be processed only by the OPC Server for Alarms & Events.Mapping of alarms on variables (OPC Data Access) is not planned.

Programming Alarms

Before you can use alarms as described here, you must first program them. Usingthe configured message number, you can access received alarms with OPCEvents.

Advantages / Disadvantages

Advantages

� Alarms are buffered and cannot be lost.

� Up to 10 associated values can be sent with an alarm. The size of theassociated values is restricted only by the PDU size.

Page 79: Industrial Communication With PG-PC

Industrial Communication

79SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Disadvantages

� To generate alarms, a program must be created on the controller.

� Only limited data types supported for associated values.

� Can only be used with OPC Alarms & Events.

2.8.8 How to Program Alarms

Introduction

The S7–OPC Server can receive the alarms sent by an S7 program. Alarms aretriggered by an S7 block. The following section describes how to program suchalarms. For more detailed information, refer to the STEP 7 user manual.

Page 80: Industrial Communication With PG-PC

Industrial Communication

80SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Procedure

Step Steps

1 Select the suitable message block.

2 Select the function block to which the message will be assignedand open it.

3 Complete the variable declaration table.

4 Program the message block call in the statement section of thefunction block.

5 Create the message type with texts, attributes, and display devi-ces in the FB.

6 Assign instance data blocks to the FB and modify them to meetyour requirements.

Page 81: Industrial Communication With PG-PC

Industrial Communication

81SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.8.9 S7 Security Services

Description of the Services

Write and read access to the CPU of a PLC can be made dependent on theknowledge of a password. The priority of the password is higher than that of thekeyswitch of the CPU.

Using the security services, the password for a connection can be sent tolegitimize access and cancel the level of protection. For an S7 programmablecontroller, three levels of protection can be activated for the block managementservices using the configuration tool STEP 7:

� Protection due to setting of the keyswitch

� Write protection

� Write and read protection

By transferring the correct password, all the protection levels listed above arecanceled for the connection on which the password was sent.

Note

On connections configured at both ends, all services can be executed even in theRUN key position.

2.8.10 S7 Information Services

Description of the Services

The S7 protocol provides services with which

� attributes of a virtual field device (VFD) can be queried.

� the status of a virtual field device can be read.

Note

The OPC server provides not only information variables for these services, butalso variables for specifying the connection status and for registering for eventservices.

Page 82: Industrial Communication With PG-PC

Industrial Communication

82SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.9 Industrial Communication with Industrial Ethernet

Introduction

This section provides you with general information on the Industrial Ethernetcommunications system.

2.9.1 Description of Industrial Ethernet

Introduction

Industrial Ethernet is a powerful communication network complying with theinternational standard IEEE 802.3 (Ethernet) and was designed for therequirements in an industrial environment.

Its main features are as follows:

� Networking of different areas of application such as office and plant floor.

� Robust design and electromagnetic immunity.

� High transmission performance even with large numbers of nodes thanks to thegeneral availability of network components capable of 100 Mbps complying withFast Ethernet.

� Various transmission media (for example, Industrial Twisted Pair, fiber–opticcables).

� Scalable performance with switching technology.

� High availability with redundant network topologies.

Page 83: Industrial Communication With PG-PC

Industrial Communication

83SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.9.2 Protocols and Devices for SIMATIC NET Industrial Ethernet

Data Communication:

The area of application of Industrial Ethernet is limited to data communication. Anumber of devices and protocols are available:

Protocol Description Typical SiemensPartner Device

S7 Communication Integrated andoptimizedcommunicationsfunctionality of theSIMATIC S7/M7systems for a widerange of applications(TCP/IP with RFC 1006or ISO).

CP 1512, CP 1612CP 1613CP 343–1CP 443–1CP 443–1 IT

S5–compatible Com-munication (SEND/RECEIVE)

Communicationservices based on thetransport protocol(TCP/IP with RFC 1006or ISO) for dataexchange with S5 andS7 devices.

Any PC EthernetadapterCP 1512, CP 1612CP 1613CP 343–1 (TCP)CP 443–1CP 443–1 IT

TCP/IP native Simple communicationservices based on TCP/IP for data exchangewith any device thatsupports the TCP/IPprotocol.

Any PC EthernetadapterCP 1512, CP 1612CP 1613CP 443–1

Page 84: Industrial Communication With PG-PC

Industrial Communication

84SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.9.3 Bus Access Methods of Industrial Ethernet

Collision Detection with CSMA/CD

Ethernet uses the CSMA/CD bus access mechanism. This acronym stands forCarrier Sense Multiple Access with Collision Detection. With this mechanism, astation wanting to send listens to the common bus cable (carrier sense) andtransmits if the cable is free. If the cable is currently being used by another station,the node withdraws its send request and attempts to send again later (multipleaccess).

If an attempt to access the bus fails, the sender listens constantly to the line andsends immediately after the current communication is completed. It is possible thattwo senders start transmission at the same time. As a result, the two framescollide and destroy each other. To detect such a collision, the nodes receive thesignals while they are sending. If the data sent differs from the data received therehas been a collision, the station backs off and waits a random time beforebeginning to transmit again. Using switching technology and full duplex throughouteliminates collisions.

This medium access control method functions correctly only when the timerequired to send a data packet is greater than twice the signal propagation time.For a specific transmission rate and packet size, the span of a network is thereforerestricted.

To implement networks with a larger span, switches with the Full Duplex functioncan be used.

Using this bus access method, it is clear that the effective data rate depends onthe bus load. If the bus load is too high, collisions will occur often. As a result, theproportion of data correctly transferred is reduced.

Modes

Two modes are possible:

Half Duplex: A node can either send or receive but not both at the same time.

Full Duplex: A node can send and receive at the same time. The basic requirementfor Full Duplex is a transmission medium with separate send and receive channels(for example fiber–optic cable or ITP).

Page 85: Industrial Communication With PG-PC

Industrial Communication

85SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.9.4 Fast Ethernet

Properties of Fast Ethernet

Fast Ethernet is the further development of the Ethernet technology. The FastEthernet standard IEEE 802.3u is based essentially on the classical Ethernetstandard with a transmission rate increased by a factor of 10 to 100 Mbps.

Ethernet and Fast Ethernet have the following common features:

� The data format

� CSMA/CD medium access control

They differ from each other in the following respects:

� The network span

� The rules for network design

� The automatic detection of the transmission rate

� Support of the duplex mode.

Page 86: Industrial Communication With PG-PC

Industrial Communication

86SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.9.5 Industrial Ethernet in the ISO/OSI Reference Model

Introduction

Based on the various layers of the reference model, Industrial Ethernet providesseveral user interfaces:

Symbol Protocol Description

A, E S7 Communication Uniform user interfacefor TCP/IP (A) and ISO(E) using S7 functions

B, D S5–compatibleCommunication(SEND/RECEIVE)

Communicationservices based on theISO transport interfacefor data exchange withS5 and S7 devices.With TCP/IP, anadapter (RFC 1006) isrequired. This makesthe SEND/RECEIVEuser interface forTCP/IP (B) and ISO (D)uniform.

C TCP/IP native Simple communicationservices based onTCP/IP (C) for dataexchange with anydevice that supports theTCP/IP protocol.

Page 87: Industrial Communication With PG-PC

Industrial Communication

87SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

All the user interfaces listed are mapped on the uniform OPC interface by the OPCserver on the PC.

Layer 1

Electrical Characteristics

Maximum number of nodes Unlimited, maximum of 1024 per net-work segment.

Transmission rate 10 Mbps or 100 Mbps

Network size Electrical network: 1.5 km Optical network at 10 Mbps: 4.5 km Switched Network: In principle unlimited

Topology Bus Tree Redundant ring Star

Transmission medium (Industrial) Twisted Pair Triaxial cable FO cable

Mechanical Characteristics

Attachment 15–pin D–sub female connector forattachment to AUI or IndustrialTwisted Pair RJ–45 attachment for 10BaseT,100BaseTX (twisted pair)

Page 88: Industrial Communication With PG-PC

Industrial Communication

88SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.9.6 Transport Protocols for Industrial Ethernet

ISO Transport Protocol

The international standard (ISO 8073 class 4) defines services for transmittingdata over connections. The ISO transport service corresponds to layer 4 of theISO reference model.

Due to the possibility of “data blocking” (user data can be segmented into severalframes at the ISO transport level), the ISO transport service can transfer largeamounts of data. The ISO transport service allows communication with anycommunication partner (for example SIMATIC S5 PLC or PC) that supportssending and receiving data in compliance with ISO transport.

Reliability, for example if cable problems occur

With the automatic repetition in ISO transport and additional block checkmechanisms (for example CRC check at layer 2), a high degree of reliability isachieved. Reception of the data is confirmed by the ISO transport service of thecommunication partner with a confirmation.

ISO on TCP (RFC1006)

The ISO–on–TCP service corresponds to the standard TCP/IP (TransmissionControl Protocol/Internet Protocol) with the RFC 1006 expansion according to layer4 of the ISO reference model. RFC 1006 is required since TCP provides datastream communication without blocking of the data in messages. This problem isavoided in the ISO protocol of layer 4 with an EOM code (End Of Message). EOMallows messages to be sent as blocks of data. TCP/IP does not recognize this.Protocol expansions are necessary to be able to send messages. RFC 1006describes how the services of ISO layer 4 can be mapped on TCP. RFC 1006 is anofficial standard and is used by many manufacturers.

The ISO–on–TCP service allows communication with any communication partner(for example PC or systems from other vendors) that supports the sending andreceiving of data complying with ISO–on–TCP.

Reliability, for example if cable problems occur

With automatic repetition and additional block check mechanisms (CRC check atlayer 2), a high degree of reliability is achieved. Reception of the data is confirmedby the communication partner with a confirmation.

Page 89: Industrial Communication With PG-PC

Industrial Communication

89SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

TCP/IP native (without RFC 1006)

The TCP/IP standard (Transmission Control Protocol/Internet Protocol) without theRFC 1006 expansion, allows access from any communication partner that usesTCP/IP to a SIMATIC S7 controller. Since the transport layer of TCP/IP providesan unstructured data stream, the task of blocking is left up to the user. Bothpartners on a communication connection must be informed of the size of thepacket to be transferred so that the correct packet can be picked out of the datastream.

Reliability, for example if cable problems occur

Using block check mechanisms (CRC check at layer 2), a high degree of reliabilityis achieved. Reception of the data is confirmed by the communication partner witha confirmation. Reliable communication is possible only if the buffer sizes arenegotiated between the communication partners.

Note

The OPC server provides communication functions based on RFC 1006, ISO andTCP uniformly as “SEND/RECEIVE” functions.

2.10 S5–compatible Communication (SEND/RECEIVE)

Introduction

S5–compatible communication on Industrial Ethernet allows data exchange onEthernet between SIMATIC S5 controllers, SIMATIC S7 controllers, and PCs andworkstations.

This section describes the principle of communication and the services of theSEND/RECEIVE protocol. The structure and configuration are also discussed.

2.10.1 Typical SEND/RECEIVE System Configuration

Introduction

For data exchange using S5–compatible communication, communications modulesare available for controllers of the SIMATIC S5, SIMATIC 505 and SIMATIC S7families as well as for PCs and workstations.

Page 90: Industrial Communication With PG-PC

Industrial Communication

90SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Example of a Configuration

2.10.2 Principle of SEND/RECEIVE Communication

Transport Protocols

In contrast to S5–compatible communication on PROFIBUS, S5–compatiblecommunication on Industrial Ethernet is based on the transport layer of theISO/OSI reference model. This provides the user with the functionality of thetransport layer in the form of connections, flow control, and data segmentation.

S5–compatible communication can be used on Industrial Ethernet with thefollowing transport protocols:

� ISO

� TCP/IP with RFC 1006

� TCP/IP without RFC 1006

S5–compatible communication is connection–oriented. Data can only betransferred after a transport connection is established to the partner device.Several connections to a partner device can be used at the same time.

Connection establishment is triggered by one of the communication partners. Ifconnection establishment is active from the perspective of partner A, this partnersends a request to establish the connection to the other device B. If connectionestablishment is passive, partner A waits for the arrival of a connectionestablishment request from device B. Which end is responsible for establishing theconnection is specified in the connection configuration.

Page 91: Industrial Communication With PG-PC

Industrial Communication

91SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Block Types/Job Types

S5–compatible communication via Industrial Ethernet makes use of handling orfunction blocks on the programmable controller. The following block types or jobtypes are available:

Name of the Block Type / JobType

Description

SEND (without WRITE function) Transfer of a data buffer to the part-ner

RECEIVE Reception of a data buffer from thepartner

SEND (with WRITE function) Writing to an object/variable on thepartner

FETCH Reading an object/variable on thepartner

Note

During communication with S5 devices, only one job type can be used on aconnection. Simultaneous use of a connection for SEND and RECEIVE or FETCHcauses the SIMATIC S5 controller to terminate the connection.

Apart from the services for transferring data buffers (SEND/RECEIVE),S5–compatible communication also provides the “Fetch” and “Write” services overIndustrial Ethernet with which direct access to objects on the partner is possible.

With SEND and RECEIVE, the data exchange is between the SEND block and theRECEIVE block. The SEND block always initiates communication. Forbi–directional communication, both a SEND and a RECEIVE block must be calledat both ends.

If FETCH is selected as the job type (corresponds to the READ function in S5),source parameters can be provided with a send job that are used by the S5communications processor to read data directly from the CPU and send it back.With this type of job, direct access to objects such as inputs, outputs, data blocks,memory bits (flags) and counters is possible.

Page 92: Industrial Communication With PG-PC

Industrial Communication

92SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.10.3 SEND/RECEIVE Configuration

Connection Parameters

Before S5–compatible communication can be used on Industrial Ethernet, thecommunication connections must first be configured. The following parameters areset for each connection:

� Connection name

� Connection type (job type)

� Addresses of the partner stations

� Identifier of the service access points at the transport layer (TSAPs)

� Control of connection establishment (active/passive)

2.10.4 Buffer SEND/RECEIVE Services

Description of the Services

S5–compatible communication provides services for transferring data buffers. Thetransfer of a packet from the sender to the receiver must be triggered explicitly bythe sender. On a SIMATIC S7 PLC, for example, this is achieved by calling the“AG_SEND” block.

The maximum size of the data buffer is 4 Kbytes.

The recipient cannot initiate data transfer from the sender. The recipient mustnevertheless be prepared to receive packets by making receive resourcesavailable.

Note

The sending of a packet by a PC is triggered by writing a “SEND” variable. Toreceive blocks of data, a “RECEIVE” variable must be set up on the relevantconnection.

When using the OPC server, it is possible to structure a block of data. Parts of theblock of data can be separated, identified by a data type, and used as a variable.Nevertheless, from a network point of view, the entire block of data is always reador written.

Advantages / Disadvantages

Communication with the buffer services of the SEND/RECEIVE protocol have thefollowing advantages and disadvantages:

Page 93: Industrial Communication With PG-PC

Industrial Communication

93SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Advantages

� With the OPC server, larger blocks of data up to 64 Kbytes can be transferred.

� No network load since there is no data transmission unless this is triggered bythe user program (no polling)

� Using the OPC server allows structured access to blocks of data.

� Communication with S5 and S7 devices as well as with PCs is possible.

Disadvantages

� The receiver cannot initiate data transfer. It must wait until the data istransferred by the sender.

� The data must be located in a buffer or copied to a buffer by a user program onthe partner device.

2.10.5 SEND/RECEIVE Variable Services

Description of the Services

Using S5–compatible communication on Industrial Ethernet, allows simple accessto symbolic variables of an S5 or S7 programmable controller. In this case, the“FETCH” and “WRITE with SEND function” services are used.

When the “FETCH” service is executed, a job is transferred to the partner devicethat contains the information on the requested variables as a source parameters.The recipient of the job evaluates the source parameter and returns the currentcontent of the requested variable with the confirmation of the job.

With a job for the “WRITE with SEND function” service, not only the sourceparameter but also the value to be written to the variable on the target device istransferred. The recipient evaluates the source parameter and sets the specifiedvariable. A job confirmation is then returned.

Page 94: Industrial Communication With PG-PC

Industrial Communication

94SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Variables are normally parts of an S7 or S6 object starting at a specific memoryaddress of the object that are assigned a specific data type. For example, thevariable with the notation “DB 5,B10” accesses byte 10 of data block 5 andrepresents the content as a word. It is also possible to form array variables(several elements of the same type in one variable).

The following are available as objects on most S5 and S7 devices:

� Data blocks

� Inputs/outputs

� Peripheral inputs/outputs

� Memory bits

� Timers

� Counters

� System area

� Extended I/Os

Advantages / Disadvantages

Communication with the variable services of the SEND/RECEIVE protocol havethe following advantages and disadvantages:

Advantages

� Flexible access

� Automatic optimization by the OPC server is possible

Disadvantages

� Lower data throughput compared with the buffer services with SEND/RECEIVE.

� To monitor variable changes, the partner device must be accessed cyclically.

Page 95: Industrial Communication With PG-PC

Industrial Communication

95SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.11 S7 Protocol for Industrial Ethernet

Introduction

The S7 protocol is used for communication with SIMATIC S7/M7 programmablecontrollers (PLCs).

This section describes the principle of communication and the services of the S7protocol. The section also describes the structure and configuration.

2.11.1 Typical S7 System Configuration

Introduction

The S7 protocol is used for communication with SIMATIC S7/M7 programmablecontrollers (PLCs). Its main features are as follows:

� Optimization for SIMATIC communication

� Adaptation of protocol elements to SIMATIC requirements

� Greater speed compared with other automation protocols for datacommunication.

� Availability for bus systems of the management and cell level such as IndustrialEthernet and the field level with PROFIBUS.

Example

Page 96: Industrial Communication With PG-PC

Industrial Communication

96SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.11.2 Principle of S7 Communication

Characteristics of the S7 Protocol

The S7 protocol is used for communication with SIMATIC S7/M7 programmablecontrollers (PLCs). Its major features are as follows:

� Optimization for SIMATIC communication

� Adaptation of protocol elements to SIMATIC requirements

� Greater speed compared with other automation protocols for datacommunication.

� Availability for bus systems of the management and cell level such as IndustrialEthernet and the field level with MPI/PROFIBUS.

The S7 protocol provides simple and powerful communication services on thebasis of a client–server model. Data is transmitted between an automationapplication on a SIMATIC PC station (client) and on SIMATIC programmablecontrollers (server). Data is provided by the programmable controller and thesestations are therefore servers. The data is requested by an application running ona PC and the PC is therefore the client. During the connection establishment andin buffer send/receive services, the PC can also be the server.

S7 Protocol with Industrial Ethernet

The implementation of the S7 protocol on Industrial Ethernet is based on anISO–compliant interface of layer 4 (transport layer) of the ISO/OSI referencemodel and adds Siemens–specific protocol elements to layers 5 through 7. Whenusing TCP/IP as the transport protocol, an adapter is therefore necessary (RFC1006).

Communication provides the advantages of a connection–oriented protocol, suchas checking for the existence of a station with connection monitoring.

S7 Connections

A connection for the S7 protocol is specified by the Ethernet MAC address or theTCP/IP addresses of the partners and address details (for example service accesspoints). These properties are specified for the S7 protocol in the configuration.

In the same way as the FMS protocol, the S7 protocol defines “Virtual FieldDevices” (VFDs). Only PC stations have this view of VFDs. Within a VFD,connections are grouped together that can be used by only one application. In theS7 protocol, a VFD is effectively an application. To be able to operate severalapplications with S7 communication on one PC station, several VFDs arenecessary.

The S7 connection is identified on the PC by specifying the connection name, forexample, “S7_connection_1”.

Page 97: Industrial Communication With PG-PC

Industrial Communication

97SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

Remember that the OPC server is an S7 application. If several OPC clientsaccess the OPC server, only one VFD is required!

S7 connections that are defined at both the client and server ends are known as“two–ended” connections. Connections defined only at the client end, for examplefrom a PC to an S7–300 station are known as “one–ended”.

On the programmable controller, an S7 connection is identified by a local ID, in theexample, the value “1”. By specifying the local ID, S7 programs can use acommunication connection with the aid of function blocks such as BRCV/BSEND.

During the connection establishment, the communication partners automaticallynegotiate the most important characteristics of the communication path. Thesettings used are those that can be achieved by both communication partners.

The following details are agreed upon:

� Size of the data packets at the transport level (PDU size)

� The number of send and receive credits (number of send and receive resourcesused at the same time)

2.12 Fault–Tolerant S7 Connections

Introduction

The availability of communication can be increased by medium redundancy,doubling up components (for example CPU, CP or network) or by doubling up allnetwork components.

This section describes the types of fault–tolerant connection and what toremember when configuring such connections.

2.12.1 Properties of Fault–Tolerant S7 Connections

How It Works

Standard S7 Connections

A standard S7 connection is established over a non–redundant connection path(CP–network–CP).

Page 98: Industrial Communication With PG-PC

Industrial Communication

98SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Fault–Tolerant Connections

A fault–tolerant connection, on the other hand, consists of at least two redundantconnection paths.

Monitoring and synchronization mechanisms ensure that if the active redundantconnection path fails, the passive (redundant) connection path takes over thecommunication automatically. The connection itself remains established.

Wire Break Detection

The time within which a wire break is detected is less than one second with activedata traffic on this connection path.

After a wire break is recognized, the sections of the protocol specifically designedfor fault–tolerant communication are executed. Depending on the number ofproductive connections established and used on the PC, this sequence can takelonger than one second.

Scalable Redundancy

The redundancy of the fault–tolerant connection can be increased by increasingthe number of CPs and the number of networks used.

The following redundant S7–REDCONNECT connections can be configured:

� Fault–tolerant connections on 2 paths

� Fault–tolerant connections on 4 paths (“Enable max. CP redundancy (with 4connection paths)”)

Page 99: Industrial Communication With PG-PC

Industrial Communication

99SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.12.2 Fault–Tolerant S7 Connections on two Paths

Properties

A fault–tolerant S7 connection has two communication paths. The failure of onecomponent leads to an automatic failover to the other redundant communicationpath.

Example

Two–path communication can, for example, be structured with the followingcomponents:

� SIMATIC H station, two racks each with a CP

� Two networks

� PC station with two CPs

Figure 2-1 Example of Two–Path Redundancy between a SIMATIC S7 Station and PC Station

Page 100: Industrial Communication With PG-PC

Industrial Communication

100SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.12.3 Fault–Tolerant S7 Connections on Four Paths

Properties

A fault–tolerant S7 connection has four communication paths. Now, for example,rack 0 can fail and network 2 can be down. Since four paths are available, rack 1and network 1 continue to operate automatically, refer to the example below.

Example

Fault–tolerant communication on four paths with increased redundancy can bestructured, for example, with the following components:

� SIMATIC H station, two racks each with two CPs

� Two networks

� PC station with two CPs

Figure 2-2 Example of Four–Path Redundancy between a SIMATIC S7 Station and PC Station

Page 101: Industrial Communication With PG-PC

Industrial Communication

101SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.12.4 Points to Note when Configuring Fault–Tolerant Connections

Requirements

Before your PC can use a connection to a fault–tolerant SIMATIC S7 system, itrequires specific information, for example, the addresses of the bus nodesinvolved, the network adapters used etc.

This information is generated automatically if the following three requirements aremet:

� You configured your S7 project with STEP 7 (version 5 or higher).

� You included your PC in the project as a “SIMATIC PC Station”.

� You connected the communication partners over the same subnets.

Configuring a Four–Path Connection

If you configure a network with STEP 7 and require the increased redundancy offour–path operation, you must select the check box “Enable max. CP redundancy(with 4 connection paths)” in “NetPro” (Properties – Fault–Tolerant S7 Connection).

Configuring a CP 443–1

When you configure a CP 443–1 with STEP 7, please remember the following:

!Caution

If you insert a CP 443–1 in a SIMATIC S7 station, the check box “Activate fastswitchover of the connections” must have a check mark entered (Properties CP443–1 dialog > Options > Ethernet Profile for Fault–Tolerant Connections >Activate fast switchover of the connections).

Page 102: Industrial Communication With PG-PC

Industrial Communication

102SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.13 SNMP Protocol

Introduction

SNMP (Simple Network Management Protocol) is a UDP–based, open protocol formanaging networks. With SNMP, you can collect data centrally from the entirenetwork and then evaluate it. With this protocol, you can also make parametersettings for the devices. The OPC SNMP Server of SIMATIC NET supportsSNMPv1 (SNMP Version 1.0).

Information on the properties of SNMP–compliant devices is stored in MIB files(MIB = Managed Information Base). The OPC Server cannot process this datadirectly and you require an MIB Compiler that is supplied with NCM. The MIBCompiler processes only MIBs complying with SMIv1 (SMI Version 1.0; SMI =Structure of Management Information).

For more detailed information on the topics of MIB and SMI, refer to the followingbook:

Internetworking with TCP/IP Douglas E. Comer Prentice Hall

2.13.1 Typical System Configuration for the SNMP Protocol

Example

The following graphic shows an example of a typical system configuration:

Page 103: Industrial Communication With PG-PC

Industrial Communication

103SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.13.2 Principle of Communication with the SNMP Protocol

Protocol

SNMP is based on the connectionless UDP protocol (User Datagram Protocol).

Reading out and Modifying Variables

With the variable services, the OPC Server sends requests to the partner devicesand the partner devices respond to them.

Traps

There are also messages that the device transfers event–triggered and withoutbeing requested by the SNMP OPC Server. These are known as traps and areused to allow a device to send status changes to the SNMP OPC Server.

2.13.3 Configuring

Introduction

If you want to use the SNMP protocol over Industrial Ethernet, you must create adefined configuration of the system. The section below describes the parametersyou will need to set.

To configure the SNMP protocol, the following dialog is available in the NCMprogram:

Page 104: Industrial Communication With PG-PC

Industrial Communication

104SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Parameters for the SNMP Protocol

Name

Enter a name for the device or subscriber that identifies it according to itstechnological function. The name can be a maximum of 255 characters long.

IP address

Enter the IP address of the subscriber here. The IP address consists of 4 decimalnumbers in the range from 0 to 255 separated from each other by a dot (forexample, 141.80.0.16).

Device profile:

The device profile describes the structure of the device information available overSNMP. You can either select an existing profile or, if necessary, create a new SNMPprofile.

For devices without SNMP capability, select “No SNMP”.

The device profiles contain the MIB objects selected by the MIB compiler withinformation on the OPC items corresponding to these MIB objects. Device profilesare text files. In the STEP 7 project, the profile files are managed in a special folder(s7data/Snmp/Profile).

Device profiles are available for the following modules on the SIMATIC NETSoftware CD:

CP 1613 ––> MIBII_V10.txt (supports only MIBII objects)

OSM ––> Profil_OSM_V10.txt

ELS ––> Profil_ELS_TP40_V10.txt

These files are stored in the following folder:

<installationdrive>\SIEMENS\SIMATIC.NCM\S7data\SNMP\Profile

“Create Profile” Button

Clicking this button starts the MIB compiler. For more detailed information onworking with this program, refer to the online help of the MIB Compiler.

Community

With this parameter, you specify the access rights. The normal (default) entries arePublic (read–only) or Private (read and write). During configuration, you specifycharacter strings that function in much the same way as passwords. Here, youmust specify a string that matches the community string stored on the SNMPagent.

There are two community strings, one for the read community and one for the Writecommunity. The OPC Server reads the string stored on the SNMP device andallows access only if the strings match.

Page 105: Industrial Communication With PG-PC

Industrial Communication

105SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

If you enter the string for the read community here, you can send read requestsfor the specified device. If you enter the string for the write community, you cansend both read and write requests for the specified device.

Timeout

With this parameter, you specify the maximum reaction time within which theSNMP OPC Server responds to a request from the OPC client.

– The entry is in milliseconds (ms)

– Range of values: 50 to 60000 ms

– Default: 9000 ms (9 s)

“Optimization of SNMP access” option

Here, you can see whether (read) access to the SNMP agent will be optimized. Tominimize the load on the network and to optimize the transmission time, accesscan be optimized so that as many values as possible are transferred.

This type of access is possible only if the SNMP agent supports this type oftransmission. This is the case with most SNMP–compliant devices and this istherefore the default setting.

sysContact

For this parameter, you can enter the name of a person to contact who isresponsible for managing the device. This entry should also include information onhow the person can be contacted. With SNMP–compliant devices, you cannotenter this parameter because it is specified with tools specifically for the device andis stored on the device itself.

The contact person entry can be up to 255 characters long.

sysLocation

This is intended for information identifying the location of the managed device, forexample a room number. With SNMP–compliant devices, you cannot enter thisparameter because it is specified with tools specifically for the device and is storedon the device itself.

The location entry can be up to 255 characters long.

sysName

This parameter contains the description of the device in text form. The entry shouldinclude the full name and version of the hardware, the operating system, orfirmware and the network software. With SNMP–compliant devices, you cannotenter this parameter because it is specified with tools specifically for the device andis stored on the device itself.

The description entry can be up to 255 characters long.

Page 106: Industrial Communication With PG-PC

Industrial Communication

106SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Comment

Here you can enter additional information on the device.

The comment can be up to 255 characters long.

2.13.4 SNMP Traps

Introduction

Traps are messages that can be sent to the OPC Server without it requestingthem. There are seven generic traps available on every SNMP–compliant device.There are also device–specific traps that are described in the MIB file.

Generic Traps

warmStart

This is sent after a warm restart on the device.

coldStart

This is sent after a cold restart on the device.

linkDown

This is sent when a connection from the device disconnects.

linkUp

This is sent when a connection from the device is established.

authenticationFailure

This is sent when there was unauthorized access to the device.

egpNeighborLoss

The EGP neighbor (EGP = Exterior Gateway Protocol) of the device is notoperational.

The Exterior Gateway Protocol is used to exchange routing information betweentwo neighboring gateway hosts.

enterpriseSpecific

This is sent when a device–specific trap was sent.

Page 107: Industrial Communication With PG-PC

Industrial Communication

107SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

2.14 Buffer–Oriented Services with the OPC Interface

Introduction

This section describes the use of buffer–oriented services with OPC. You will learnhow data buffers are mapped on OPC variables. The section also describes thespecial points to note when using TCP/IP native in conjunction with thebuffer–oriented services.

2.14.1 Properties of Buffer–Oriented Communication

Supported Services

In the buffer–oriented services, data buffers are transferred by the sender to areceiver using the communications system.

The following protocols support buffer–oriented services:

� S7 communication (BSEND/BRECEIVE)

� S5–compatible communication on Ethernet (SEND/RECEIVE)

� S5–compatible communication on PROFIBUS (SDA, SDN/Indication)

The distinguishing feature of the buffer–oriented services is that data is transferredonly when the sender initiates the transfer. The receiver cannot initiate datatransfer.

Activities of the sender and recipient when exchanging data buffers

Sender

� Puts together the send buffer and its content

� Sends the buffer on a connection to a communication partner

� Receives a confirmation of the result of the data transfer

Recipient

� Prepares a receive buffer for a connection

� Is informed when a partner sends a data buffer to it

� Evaluates the received data

Page 108: Industrial Communication With PG-PC

Industrial Communication

108SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2.14.2 Mapping Data Buffers on OPC Variables

Differences between Send and Receive Items

The OPC Data Access Interface recognizes only process variables. To allow theadvantages of buffer–oriented services to be used with OPC, the buffers must bemapped on OPC items:

Send item (S7 communication: “BSEND”, S5–compatible communication: “Send”)

� An OPC item represents a send buffer or part of a send buffer.

� When the OPC item is written (synchronous / asynchronous), a write job isinitiated on the network.

� If several items representing part of a buffer are written at once in a groupoperation, the entire send buffer made up of all parts is put together first andthen sent.

� The read returns the last data sent from the send buffer. If nothing was sent,the item may possibly be readable, however is has the quality “BAD”.

Receive item (S7 communication: “BRCV”, S5–compatible communication: “RECEIVE”)

� An OPC item represents a receive buffer

� If the OPC item is read from the device (synchronous/asynchronous), themodule is ready to receive. This state exists until a data packet is received orthe timeout for the specific connection elapses. If no data packet is receivedbefore the timeout, the quality of the OPC item is “BAD”.

� If the OPC item is monitored (active receive item in an active group), a receivebuffer is set up permanently on the communication module. When a datapacket is received, the OnDataChange callback signals this to the application ifthe data differ from the previous data received.

� Receive items cannot be written.

2.14.3 Using Buffer–Oriented Services

Handling Send and Receive Items

Send items should only be written; reading or monitoring send items returns onlythe previously written data.

Receive items should be monitored; in other words, the receive item should existas an active item in an active group. Regardless of the implementation of acallback function, the cache of the OPC server is then updated on the arrival ofevery data packet.

Page 109: Industrial Communication With PG-PC

Industrial Communication

109SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Reading from the cache and directly from the device

Read jobs both synchronous or asynchronous should read the cache. The cachecontains the last block of data received if the receive item is monitored. Using thecache also ensures that several clients reading the item at the same time obtainthe same value.

Reads to device (directly to the device) are not useful since there is only a receivebuffer available during the timeout interval of the connection (normally severalseconds). A sender must send within this time or the data buffer will not beaccepted by the receiver.

Update Rate

Make sure that the OPC Server fetches the receive buffer faster than the sendersends it. The rate at which the receive buffers are fetched is specified by the“Update Rate”, a group–specific OPC parameter.

Depending on the protocol, received blocks of data will otherwise be overwrittenwithout the OPC client being informed (S7, SEND/RECEIVE with ISO and RFC1006) or a backlog or packets will form and the receiver will only receive obsoletedata (SEND/RECEIVE with TCP/IP native).

2.14.4 Points to Note When Using Buffer–Oriented Services withTCP/IP native

Meaning of the Socket Interface

The SEND/RECEIVE protocol with TCP/IP native is based on the Windows Socketservices. No explicit buffers are transferred, but rather a continuous data stream istransmitted on the Socket interface. The protocol uses an interim buffer both at thesend and receive end and incoming and outgoing data is managed as in a FIFObuffer (First–In First–Out).

TCP/IP native and OPC Variables

This feature of the protocol also affects the application with OPC variables:

� Even if the partner does not accept any data, send jobs are acknowledgedpositively until the buffer at the sending end overflows.

� The interim buffer for receiving data is always available regardless of whetheror not a variable is monitored or a read job is sent.

� If the data is not fetched quickly enough at the receiver end, there will be a databacklog in the receive buffer. As a result, the receiver does not obtain the dataread last but data that is no longer up to date.

Page 110: Industrial Communication With PG-PC

Industrial Communication

110SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 111: Industrial Communication With PG-PC

111SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Installation and Commissioning

Introduction

This section covers 7 steps and explains how you put a PC station into operation inan industrial communications system. The new tools of Advanced PCConfiguration (APC) will be used.

You will also find useful information on migrating from older versions of theSIMATIC NET software.

3.1 Step 1: Installing Software

User Documentation for Software Installation

Installing the SIMATIC NET software for the PC station is the first step incommissioning. Before you start to install software from the SIMATIC NET CD, youshould read the documents listed below and follow the instructions they contain.

Installation Instructions for the PC Software

The valid brochure with the installation instructions for all products on the SIMATICNET CD:

Installation instructions for PC software

Readme File

Product-specific chapters with special information on your product in the readmefile in the main folder of the SIMATIC NET PC Product CD:

� S7-1613

� PG-1613

� TF-1613

� S7-REDCONNECT

� SOFTNET-S7 for Industrial Ethernet

� SOFTNET-PG for Industrial Ethernet

� S7-5613

� DP-5613

� FMS-5613

� SOFTNET-S7 for PROFIBUS

� SOFTNET-DP for PROFIBUS

� SOFTNET-DP Slave for PROFIBUS

� CP 5613 / CP 5613 FO / CP 5614 / CP 5614 FO software

3

Page 112: Industrial Communication With PG-PC

Installation and Commissioning

112SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

� PROFInet OPC Server

� SNMP OPC Server

Additional Information

Further instructions accompanying your product.

Extra Notes on the Documentation

Please note that the paper documentation supplied with your product may be moreup-to-date than the electronic version.

There may be additional service packs for the products that extend thefunctionality. You can obtain additional information from SIMATIC CustomerSupport.

3.1.1 Possible Security Gaps with Standard IT Interfaces

Preventing Unauthorized Access

In various SIMATIC NET components such as OSMs/ESMs, a wide range ofparameter assignment and diagnostic functions (for example Web Server,Network Management) are available over open protocols and interfaces. Thepossibility of unauthorized misuse of these open protocols and interfaces by thirdparties, for example to manipulate data, cannot be entirely excluded.

When using the functions listed above and these open interfaces and protocols (forexample, SNMP, HTTP, Telnet), you should take suitable security measures toprevent unauthorized access to the components and the network particularly fromwithin the WAN/Internet.

Note

We expressly point out that automation networks must be isolated from the rest ofthe company network by suitable gateways (for example using tried and testedfirewall systems). We do not accept any liability whatsoever, whatever the legaljustification, for damage resulting from non-adherence to this notice.

If you have questions on the use of firewall systems and IT security, please contactyour local Siemens office or representative. You will find the address in theSIMATIC NET Catalog IK PI or on the Internet athttp://www.siemens.de/simatic-net.

Page 113: Industrial Communication With PG-PC

Installation and Commissioning

113SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.1.2 Installing SNMP Services for Windows NT 4.0

Introduction

Following standard installation of Windows NT 4.0, the SNMP protocol stack is notyet available in the operating system. Without taking further measures, this meansthat you cannot request items and the SNMP traps do not work.

This section describes how to install the SNMP protocol stack under NT 4.0.

Step 1

Open the “Network” dialog from the Control Panel and select the “Services” tab.

Step 2

Click on the “Add” button and select the “SNMP Service”. After inserting theWindows NT installation CD, the necessary files are copied.

Step 3

Install Service Pack 6a for Windows NT again to update the files of the SNMPprotocol stack.

Note

Installation of Service Pack 6 aborts if the Internet Explorer Version 5.5 or higher ison your system. How to deal with this is described in the Microsoft KnowledgeBase Article Q250867:

� Copy all the files of the service pack to a temporary folder on your hard disk.

� Edit the section [CheckSecurity.System32.files] in the update.inf file. Put asemicolon in front of the following entries:

Schannel.dllSecurity.dllNtlmssps.dll

� Save the changes in update.inf and install the service pack from your hard disk.

Page 114: Industrial Communication With PG-PC

Installation and Commissioning

114SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Step 4

After you reboot the computer, the SNMP service can be configured on the server.When you install SNMP, not only the protocol but also an SNMP agent is installed.Make sure that you can check the access permissions for this program and, whennecessary, adapt them. You should also read the information in “Possible SecurityGaps with Standard IT Interfaces”.

3.1.3 Installing the SNMP Services for Windows 2000 / Windows XP

Introduction

Following standard installation of Windows 2000 or Windows XP the SNMPprotocol stack in the operating system is not complete. Without taking furthermeasures, this means that you cannot request items and the SNMP traps do notwork.

This section describes how to install the SNMP protocol stack under Windows2000 or Windows XP.

Steps

Note

You must be logged on as administrator or belong to the “Administrators” group tobe able to perform the steps outlined below. If the computer is connected to anetwork, the general network settings may prevent installation of the SNMPservices.

Step 1

Open the “Add/Remove Programs” dialog in the Control Panel and select“Add/Remove Windows Components”. The Windows Components Wizard starts.

Step 2

Select the “Management and Monitoring Tools” entry in the list box withoutchanging the check box.

Step 3

Click the “Details” button. The “Management and Monitoring Tools” dialog opens.

Page 115: Industrial Communication With PG-PC

Installation and Commissioning

115SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step 4

Activate the “Simple Network Management Protocol” check box and click “OK”.The “Managing and Monitoring Tools” dialog disappears.

Step 5

Click on the “Next” button in the Windows Components dialog box. After insertingthe operating system installation CD, the necessary files are copied. The SNMPservice is started automatically after installation.

Step 6

After installation, the SNMP service can be configured on the server. When youinstall SNMP, not only the protocol but also an SNMP agent is installed. Make surethat you check the access permissions for this program and, when necessary,adapt them. You should also read the information in “Possible Security Gaps withStandard IT Interfaces”.

Page 116: Industrial Communication With PG-PC

Installation and Commissioning

116SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.2 Step 2: Installing Hardware

User Documentation for Hardware Installation

Before you start to install software from the SIMATIC NET CD, you should read thedocuments listed below. You will find these documents on the SIMATIC NETElectronic Manuals CD. Then install the hardware in your computer as explained inthe appropriate installation instructions.

Installation Instructions for the Hardware

Brochures on the specific products with instructions on installing the hardware.

Additional Information

Further instructions accompanying your product.

Overview of the Installation Instructions for Industrial Ethernet Modules

CP 1512

PCMCIA card without microprocessor for attaching PCs, PGs, and notebooks toIndustrial Ethernet operating at 10/100 Mbps.

CP 1612

PCI card without microprocessor for attaching PCs and PGs to Industrial Ethernetoperating at 10/100 Mbps.

CP 1613

PCI card with microprocessor for attaching PCs and PGs to Industrial Ethernetoperating at 10/100 Mbps.

Overview of the Installation Instructions for PROFIBUS Modules

CP 5511/CP 5512

PCMCIA card without microprocessor for attaching PCs, PGs, and notebooks toelectrical PROFIBUS networks up to 12 Mbps.

CP 5613

PCI card with microprocessor for attaching PCs and PGs to electrical PROFIBUSnetworks up to 12 Mbps.

Page 117: Industrial Communication With PG-PC

Installation and Commissioning

117SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

CP 5613 FO

PCI card with microprocessor for attaching PCs and PGs to optical PROFIBUSnetworks up to 12 Mbps.

CP 5614

PCI card with microprocessor for attaching PCs and PGs to 2 electricalPROFIBUS networks up to 12 Mbps.

CP 5614 FO

PCI card with microprocessor for attaching PCs and PGs to an electrical and anoptical PROFIBUS network up to 12 Mbps.

Page 118: Industrial Communication With PG-PC

Installation and Commissioning

118SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.3 Step 3: Configuring a New Module

Introduction

When you start up the computer after installing the software and hardware, youmust decide where the module will obtain its configuration information from. Thisdecision also decides the operating mode of the module.

Two Alternative Modes

Using the Module Solely for PG Operation

In this mode, the network-related parameters of the module such as the stationaddress and transmission rate are set using the “Set PG/PC Interface”configuration tool. This configuration is possible only on the computer itself.

If you use this mode, PG functions (for example, SIMATIC STEP 7) can be usedwith the module. Communication functions requiring a configuration as defined in aproject or OPC operation are then not possible.

The description of the “Set PG/PC Interface” program is part of the documentationof STEP 7. The steps described below relating to the commissioning of the moduleare not relevant when using this mode.

Using the Module for Configured Communication

In this mode, all parameters of the module are specified in the definedconfiguration in the project for the automation solution and then transferred to themodule.

If you use this mode, you can use all the protocols available with SIMATIC NET aswell as the OPC Server. This remains possible even if you want to operate PGfunctions on the configured network.

Settings for the Local Software Application

The software applications that use communications services directly must also bespecified in the defined configuration. Direct use means calling theprotocol-specific function libraries. The OPC Server uses the communicationsservices directly and must be included in the defined configuration. Access by OPCclients is over the OPC Server indirectly and they are therefore not configured.

Page 119: Industrial Communication With PG-PC

Installation and Commissioning

119SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.3.1 Background Information on PC Stations

Introduction

A “PC station” is a PC acting as a component in an automation solution withSIMATIC.

The PC station is handled in exactly the same way by the configuration tool as anS7 controller. The data defined in the configuration in your project is downloaded tothe PC station at the click of a button. The hardware configuration of a PC stationcan also be compared with the configuration of an S7 controller: Modules areplugged into the slots of a rack. In the same way, components of a PC station, forexample modules, are assigned to a virtual slot per software.

Figure 3-1 Slots in the Rack of an S7-400

Software

A PC station contains SIMATIC NET communication modules and softwareapplications. One typical software application with which user programs cancommunicate is the SIMATIC NET OPC Server.

Hardware

During the hardware configuration of a PC station in your project, the componentsare inserted in a virtual rack. The virtual rack is implemented on the PC station bysoftware.

Page 120: Industrial Communication With PG-PC

Installation and Commissioning

120SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Index for each Component

To allow communication between the components in the PC station and to receiveconfiguration data, each component is assigned a unique identification number.The identification number for modules, applications, and other components in a PCstation is the index. Analogous to the slot of a module in an S7-400 controller, theindex corresponds to a virtual slot in a PC station.

Figure 3-2 Virtual Slots and a Virtual Rack of a PC Station

Note

Be careful not to confuse this “index” with a hardware slot, for example on the PCIbus of the computer. The slot on the PCI bus is not relevant for commissioningand is not used at any point.

3.3.2 Significance of the First Configuration of the Module

Default Values for Station Address and Bus Parameters

When a module is put into operation for the first time, it must be configured. Thisinitial configuration is done for all newly installed modules. During the initialconfiguration, the index (the “virtual slot number”) of the module is fixed.

To make the PC station ready to receive configuration data over the network, astation address and bus parameters can be set as defaults during the initialconfiguration. As defaults, PROFIBUS modules are given the address 2 on an MPInetwork at 187.5 Kbps.

Page 121: Industrial Communication With PG-PC

Installation and Commissioning

121SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Handling the Configuration Data

The parameters set during the initial configuration can be loaded into theconfiguration system at a later point in time.

After the initial configuration of the modules, the PC station is ready to receiveconfiguration data. This step can be compared with inserting components in therack of an S7-400 station.

To allow the configuration information to be transferred from the configurationsystem to the PC station, the local configuration must match the configuration asdefined in the project.

3.3.3 Adapting Mismatched Configurations

Station Configuration Editor

If you cannot download configuration information to the PC station, this may bedue to a mismatched configuration. The Station Configuration Editor will provideyou with an overview of the indexes allocated to the PC station. This is a tool forsetting up the components installed in the PC station.

The Station Configuration Editor is required in particular when you want to use anadditional PC-based or card-based controller with the PC station. When youcommission the SIMATIC NET software, you do not require the StationConfiguration Editor; the Commissioning Wizard handles all the tasks of this tool.

Note

A component uses the “configured operation” mode when the module is entered inthe Station Configuration Editor.

You start the Station Configuration Editor from the Start menu:

Start –> SIMATIC –> Station Configuration Editor

Adapting the Configuration

There are two ways of matching up the actual local configuration of the PC stationand the defined configuration as in your project.

Adapting the Sssignment in the Defined Configuration.

Change the assignment of the modules configured on the PC in the defined projectconfiguration using the STEP 7 “HW Config” program so that it matches theconfiguration reported by the Station Configuration Editor.

Page 122: Industrial Communication With PG-PC

Installation and Commissioning

122SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Changing the Configuration on the PC Station

Using the “Station Configuration Editor” program, you can assign a new index to acomponent and add components that are not set for operation as defined in theproject to the defined operating configuration. Refer also to the description of the“Station Configuration Editor” program.

3.3.4 Support from the Commissioning Wizard

Starting the Commissioning Wizard

When configuring the SIMATIC NET communications modules for the first time,you are supported by a Commissioning Wizard. This starts

� when you boot the computer station after inserting an additional module

� when you select the appropriate menu command in the “Configuration Console”tool

� when you select it in the Start menu. (Start –> SIMATIC –> SIMATIC NET –>Settings –> Commissioning Wizard)

The Commissioning Wizard takes you through the necessary steps forcommissioning modules and the further steps for commissioning a PC station withconfigured communication.

Settings

When you first configure the modules, all those that had not been detectedpreviously are detected. You must set the operating mode for each module. If youselect “Configured mode”, you must set the network-related parameters for initialconfiguration.

After the Commissioning Wizard has run through all the previously undetectedmodules, confirm the settings you made for the modules. After this, theconfiguration is finally adopted and the PC is ready for the next steps.

3.3.5 Special Features of SOFTNET Industrial Ethernet Modules

Introduction

Modules operated with the “SOFTNET Industrial Ethernet” software product areintegrated in Windows just like a standard network adapter and supplemented byadditional protocols. The station parameters for such modules can only be set withthe standard mechanisms of Windows.

Page 123: Industrial Communication With PG-PC

Installation and Commissioning

123SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter

The parameters to be set with Windows mechanisms are as follows:

� MAC address (if not already preset by the hardware)

� IP address

� Subnet mask

� Gateway address

Even when changing the station parameters during the initial configuration, theWindows configuration program must be used. During the initial configuration, youare prompted to start this tool.

Transferring the Configuration Data

Note

Make sure that the network parameters of the PC station match the informationentered in the configuration in your project. If this is not the case, it is not possibleto establish connections.

When a configuration is transferred from the configuration system to a PC stationand the transferred configuration contains different network parameters from thoseconfigured locally on the PC station, a warning is displayed. In this case, you mustadapt the defined configuration in your project or set the local parametersaccording to the defined configuration.

Page 124: Industrial Communication With PG-PC

Installation and Commissioning

124SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.4 Step 4: Configuring the PC Station and CreatingNetworks (Defined Configuration)

Introduction

You configure the PC station and the connected networks at a central point, inSIMATIC NCM PC or SIMATIC STEP 7. Creating data on a PC (engineeringsystem) to describe an automation system is called configuring. The resultingconfiguration or defined configuration is transferred to the component that willexecute it (run-time system).

Tools for Creating the Configuration of a SIMATIC Programmable Controller

SIMATIC NCM PC

A subset of SIMATIC STEP 7 functions for configuring PC stations and networks.

How to use the tools for creating a configuration for the PC station is part of thecomprehensive documentation on SIMATIC STEP 7 and SIMATIC NCM PC.Please refer to the documents listed in “Further Information” for more detailedinformation on handling the configuration tools.

SIMATIC STEP 7

Configuration of all SIMATIC S7 components, PC stations, networks and otherobjects and programming.

3.4.1 Significance of Configured Communication

Properties of the Communication System

In configured communication, all properties of the communication system of aninstallation are edited centrally in a project:

� Properties of the communication networks

� Properties of the PC station as a communication node

� Properties of other communication nodes

� Properties of the communication modules of the PC station

� Properties of the OPC Server

� Properties of the communicating applications

� Properties of the communication connections of all protocols for datacommunication (S7, FMS, S5-compatible communication over IE andPROFIBUS)

� Properties of the input/output modules for process communication with DP

Page 125: Industrial Communication With PG-PC

Installation and Commissioning

125SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Distribution of the Configuration

The configuration of an entire system can be created in a project on one computer(Engineering System, “ES”). This allows the elements of the system to besynchronized with each other and the overall consistency to be checked. At theclick of a button, the configuration can be distributed by the engineering system tothe components (programmable controllers or PC stations) over a network. Theuser has uniform tools with which all communications partners can be defined.

PC Station

The “SIMATIC PC station” is an object in a SIMATIC STEP 7 project. A typical PCstation for OPC operation consists of the following elements:

� One or more communication modules (CPs)

� An OPC server application and/or other applications

� Possibly also other controlling elements such as Soft-PLC or Slot-PLC

A CP is attached to a PROFIBUS or Ethernet network over which othercommunication partners can be reached.

Within the OPC Server application, connections are defined for the variousprotocols that describe the communication relations with the partner devices.

Apart from the initial configuration, no further configuration effort is necessary tomake settings for the PC station “on-site”.

3.4.2 Support from the PC Station Wizard

Starting the PC Station Wizard

When you create the configuration in your project, you can get support from awizard. The PC Station Wizard is part of SIMATIC NCM PC and SIMATIC STEP 7and is installed along with them.

You can start the Wizard as follows:

� from the Commissioning Wizard.

� when you select it in the Start menu. (Start –> SIMATIC –> SIMATIC NCM PCPC Station Wizard).

Page 126: Industrial Communication With PG-PC

Installation and Commissioning

126SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Range of Functions of the PC Station Wizard

The wizard supports you during the following tasks:

a) Changing local settings

If the configuration system is installed on the PC station you want to configure, thewizard can enter the configuration data directly in a project so that parametersettings can be edited immediately.

b) Editing a stored configuration

Open an existing project and compare the local configuration with the informationin the project.

c) Creating a new configuration

Create a new project and adopt the local PC station with the existing configurationin the project.

d) Configuring by creating a file to transfer to the system

The configuration data is taken from an XDB file created by the configurationsystem for the PC station.

3.4.3 Adopting the Configuration on the PC Station

Network, Loading Locally, and XDB File

There are three ways of transferring a defined configuration to the PC station:

a) Downloading over a network

Use this option if the following requirements are met:

� The PC station is not the same machine as the configuration station.

� The PC station is linked to the configuration station over a network. The PCstation is accessible as a communication node, for example as a result of theparameter settings made during the initial configuration.

� There is a connection (you can check this using the “Accessible Nodes”function).

You download to the PC station using the familiar mechanisms in SIMATIC STEP 7for accessing the PLC.

b) Loading locally

This situation occurs when the configuration system is installed on the PC station. The configuration data is then transferred directly over the internal PC connection. In the configuration system itself, you use the same mechanisms you would use toaccess the PLC as in situation a).

Page 127: Industrial Communication With PG-PC

Installation and Commissioning

127SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

c) Data transfer using an XDB file

If the PC station is a separate computer and is not accessible over a network, thecomplete configuration can be transported physically to the station in the form ofan XDB file. The configuration system always generates an XDB file. The storagelocation of the configuration file is displayed in the properties of the “PC station”object in the configuration system. On the PC station, the PC Station Wizard canuse this file, or it can be imported.

Note

To be able to identify the PC station, the station name in the defined configurationin your project must match the locally configured station name. If this is not thecase, it is not possible to adopt the defined configuration on the PC station!

Optional Steps

After the configuration has been adopted on the PC station, the station is readyfor operation. The following steps required for using symbols, for diagnostics, andfor calling the OPC Scout are optional. You should, however, check the operabilityof the module with the diagnostic functions.

Page 128: Industrial Communication With PG-PC

Installation and Commissioning

128SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.5 Step 5: Entering / Creating Symbols

Introduction

If you use the OPC Server of SIMATIC NET, you have the option of specifyingvariable names and a hierarchical structure of the name space or importing thename space of an S7 device defined in SIMATIC STEP 7. These names that areindependent of the protocol and device are known as symbols. In contrast, thevariable names that contain information on the communication path and type aspart of their syntax are known as run-time names.

Example of a symbol: Conveyor_1.drive_1.limswitch

Example of a run-time name: S7:[Connection_1]IX3.1

The use of a symbolic name is not mandatory. One exception is communicationover PROFInet or to a SIMOTION partner. Here, only symbols are used. You cando without your own defined symbols or add symbols at a later point in time. If youdo not require the use of symbols, skip to the next step.

3.5.1 Background Information on Using Symbols

Creating and Using Symbol Files

A symbolic name space is created using the Symbol File Configurator tool. Theresult is a file containing the symbolic, hierarchical name space and thecorresponding run-time names.

The file created by the Symbol File Configurator is either adopted using theCommissioning Wizard or is entered in the “Configuration Console” program.

A symbol file must match the configuration loaded on the PC station. To resolve asymbolic name, the symbol file uses the run-time name. As a result, if you changea connection name in the configuration, you must also adapt the symbol file.Otherwise, the OPC client cannot use the symbol.

Page 129: Industrial Communication With PG-PC

Installation and Commissioning

129SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.5.2 Working with the Symbol File Configurator

Starting the Symbol File Configurator and Its Range of Functions

You can start the Symbol File Configurator...

� from the Start menu

� from the Commissioning Wizard.

The Symbol File Configurator provides you with the following options:

� Adopting the symbols from the symbol table and the data blocks of SIMATICSTEP 7

� Creating your own hierarchical name space

� Setting the properties of a symbol:– Visibility in OPC browsing– Access rights (readable/writable) for OPC clients– Range of values of the variables to support the “Percent Deadband” OPC function – Selection of a communication connection (when there are several parallel connections to the communication partner)

If you use the Commissioning Wizard, this starts the Symbol File Configurator andthe adoption of the generated symbol file.

Page 130: Industrial Communication With PG-PC

Installation and Commissioning

130SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.5.3 Adopting the Symbols from PROFInet iMAP and SIMOTIONScout

Introduction

You can also use the symbols from PROFInet iMAP and SIMOTION Scout with theOPC Server. These symbol files contain not only the symbols but also furtherconfiguration information so that additional connection configuration for the PCstation is not necessary.

Steps

Start the appropriate export functions for SIMATIC NET OPC symbol files in therelevant PROFInet iMap or SIMOTION Scout engineering programs. Follow theinstructions in the documentation of these programs.

Transfer the created symbol file to your PC station. You can specify the requiredsymbol file in the Configuration Console or using the Commissioning Wizard.

If you use symbols for PROFInet iMap and SIMOTION Scout, you must also selectthe PC module and the subnet over which the PROFInet or partner stations areattached. You can do this in a further dialog when you select the symbol file in theConfiguration Console or in the Commissioning Wizard.

You can check the selected module with the Configuration Console using the“Access points” function:

� Fixed access point SIMOTION CP_SM_1: for example CP_SM_1: –>CP5613(PROFIBUS)

� Fixed access point PROFInet CP_PN_1: for example CP_PN_1: –>CP1613(RFC1006)

For further information on PROFInet and SIMOTION, refer to the documentationof the PROFInet iMap and/or SIMOTION Scout engineering programs.

Page 131: Industrial Communication With PG-PC

Installation and Commissioning

131SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.6 Step 6: Checking the Configuration and Diagnostics

Diagnostic Options

To check the operability of the PC station, you can use the following mechanism:

The “Configuration Console” tool

The “Configuration Console” tool starts immediately after you have completed workwith the Commissioning Wizard but can also be started from the Windows Startmenu.

For more detailed information on working with this tool, refer to the description inthe “Tools” section.

Page 132: Industrial Communication With PG-PC

Installation and Commissioning

132SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.7 Step 7: Testing with OPC Scout

If you use the OPC interface; in other words, you have used the OPC Server in thedefined configuration, you can test the functionality of your communication systemin a final step. Using the OPC Scout, you have access over the OPC Server to allthe process variables you want to access using the configured protocols andconnections.

With the OPC Scout, you can monitor the values of process variables, read valuesexplicitly, and write values. The OPC Scout shows you the name space of thevariables consisting of configured communication connections and symbolicnames.

3.7.1 Detecting Errors in Communication with the OPC Scout

Introduction

The OPC Scout shows you the status of the communication connections. This ispossible using the properties of process variables or using information variables.You can then recognize when a partner device is not accessible.

Connecting to the OPC Server: The remote OPC Server is not accessible

This can occur when using DCOM and can have various causes:

� The network connection is down.

� The DCOM configuration of the local and remote server is not correct.

� The remote server is not correctly installed or configured.

Connecting to the OPC Server: The locally installed OPC Server cannot be started

Possible causes for this include:

� The PC station is currently receiving a new configuration.

� By installing an OPC server of another manufacturer that has not kept to theguidelines laid down by the OPC Foundation common files have beencorrupted.

Page 133: Industrial Communication With PG-PC

Installation and Commissioning

133SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Inserting variables: Variable cannot be inserted

Inserting some or all variables is denied in the Navigator of the OPC Scout.Possible causes for this include:

� The variable name you entered does not have the correct syntax.

� When using symbolic variables: The symbol file does not match the definedconfiguration.

� The access rights for the variables are restricted: Neither read nor writepermissions.

Inserting variables: A protocol or connections are not visible

No protocols are visible in the left-hand window of the navigator or protocols orconnections are missing. Possible causes for this include:

� Some of the required connections were not created during configuration.

� A configured module does not exist or was not correctly initialized.

� The configuration data created in the defined configuration have not yet beentransferred or transfer was unsuccessful.

Displaying process variables: Quality of the variables is “bad”

In the table view of the process variables, the value “bad” is entered for some or allvariables in the “Quality” column. Possible reasons for this include:

� The network connection to the partner device is down.

� The partner device is not configured.

� The bus parameters of the PC station and partner device do not match.

Displaying process variables: The value of the information variable for the connectionstatus is “Down”

The information variable has the quality “good”, however, the value is not “Up”.

These variables are generated by the OPC Server and always have the quality“good”. The possible reasons for the value of the variable are identical to those forquality = “bad”.

Page 134: Industrial Communication With PG-PC

Installation and Commissioning

134SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.8 Advanced PC Configuration –Changing to the New SIMATIC NET CD 07/2001

Description of Advanced PC Configuration

Advanced PC Configuration is the new method with which you can commission aPC station as part of an industrial communication network. SIMATIC NET supportsthe option of using Advanced PC Configuration on a central engineering station toconfigure PC stations in the same way as programmable controllers. A networkedPC with SIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7 V5.1 ServicePack 2 or higher is used as the engineering station.

Features

Using Advanced PC Configuration means certain changes in the way youconfigure in your project:

� All settings are made and downloaded to the PC station with one tool duringconfiguration. This tool is SIMATIC NCM PC V5.1 Service Pack 2 or higher orSTEP 7 version 5.1 Service Pack 2 or higher.

� Properties that were previously configured using the “Set PG/PC Interface”configuration program are now part of the configuration and are downloaded tothe PC station. These include, for example, the station address and the busparameters. Creating several databases is no longer necessary.

� Properties that were previously specified in various configuration programs arenow configured in SIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7Version 5.1 Service Pack 2 or higher. Examples of such configuration toolsinclude COML S7, COM PROFIBUS.

� Configuration parameters for the OPC Server that were previously stored inTXT files are now configured in SIMATIC NCM PC V5.1 Service Pack 2 orhigher or STEP 7 Version 5.1 Service Pack 2 or higher and downloaded to thePC station.

Tools of Advanced PC Configuration

Advanced PC Configuration includes the following tools:

Commissioning Wizard

The Commissioning Wizard allows simple and consistent commissioning of allmodules and user programs supported by Advanced PC Configuration. It guidesthe user step by step through the installation and configuration of the PC station.

Page 135: Industrial Communication With PG-PC

Installation and Commissioning

135SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Configuration Console

The Configuration Console is a snap-in program embedded in the MicrosoftManagement Console (MMC) that provides a wide range of options for configuringPC hardware components and PC user programs as well as providing diagnosticfunctions. Settings for the OPC servers that ship with the communication softwareare also made in the Configuration Console.

SIMATIC NCM PC

With SIMATIC NCM PC V5.1, Service Pack 2 or higher, a new configuration toolfor STEP 7-compatible PC configuration is available.

Supported Modules

You will find a list of the modules supported and not supported by Advanced PCConfiguration in the “hinw_d.rtf” file in the cd-intern folder of the SIMATIC NETproduct CD.

Consequences

The following sections explain the effects of switching to Advanced PCConfiguration.

3.8.1 LDB and XDB Databases

Consequences of the New Central Configuration

As of the SIMATIC NET PC software CD 07/2001, all SIMATIC NET PC softwareproducts have central configuration and download mechanisms. The configurationdata is now stored in XDB databases.

The previously used LDB databases can no longer be used.

Existing XDB databases can continue to be used after importing them into thecentral data management of the PC station, the Station Configuration Editor.

Using the Databases and Central Data Management

The following graphics illustrate the new situation:

� Configurations in previous product versions and the use of databases

� New, totally integrated and uniform configuration with the Station ConfigurationEditor

The OPC server and its protocol-specific adapters are optional elements and areshown with broken lines.

Page 136: Industrial Communication With PG-PC

Installation and Commissioning

136SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Configurations up to SIMATIC NET CD 05/2000

Description

A configuration created with the tools of the SIMATIC NET products CDs up to andincluding SIMATIC NET CD 05/2000 will be called the “previous configuration” inthe description below.

Previous configuration with LDB databases

Each protocol of each module required its own database.

If the OPC server was used, it also required its own databases in TXT format foreach protocol:

Figure 3-3 Using LDB Databases

Previous configuration with LDB and XDB databases

Even when the entire communication of all modules for the S7 protocol was storedin the XDB, separate databases were required for DP and FMS.

An optional OPC server also had its own data storage:

Figure 3-4 Using LDB and XDB Databases

Page 137: Industrial Communication With PG-PC

Installation and Commissioning

137SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Configuration with Advanced PC Configuration

Description

Configuration with Advanced PC Configuration means configuring with the tools ofthe SIMATIC NET CD Version 07/2001 or higher.

Central data management for all components

The configuration information for all protocols, modules, and OPC is all maintainedin a central data management system.

The configuration data can be transferred to the central data management indifferent ways.

The following graphic illustrates an example of importing an XDB database createdby SIMATIC NCM PC V5.1 Service Pack 2/STEP 7 Version 5.1 Service Pack 2.

Figure 3-5 Central Data Management for all Components

Page 138: Industrial Communication With PG-PC

Installation and Commissioning

138SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Continued Use of Databases and Configuration Tools

The following table shows an overview of the previous database types and thecorresponding configurations and indicates whether continued use is possible:

Protocol Data-baseType

Configura-tion Tool

Continued Use

DP LDB COM PRO-FIBUS

No further use possible, a new confi-guration must be must be createdwith SIMATIC NCM PC V5.1 ServicePack 2 or higher or STEP 7 Version5.1 Service Pack 2 or higher.

FDL TXT Text Editor No further use possible, a new confi-guration must be must be createdwith SIMATIC NCM PC V5.1 ServicePack 2 or higher or STEP 7 Version5.1 Service Pack 2 or higher.

FMS LDB COM PRO-FIBUS

No further use possible, a new confi-guration must be must be createdwith SIMATIC NCM PC V5.1 ServicePack 2 or higher or STEP 7 Version5.1 Service Pack 2 or higher.

S7 LDB COML S7 No further use possible, a new confi-guration must be must be createdwith SIMATIC NCM PC V5.1 ServicePack 2 or higher or STEP 7 Version5.1 Service Pack 2 or higher.

S7 XDB STEP 7 Further use is possible, the XDB da-tabase must be imported.

SEND/RECEIVE

TXT Text Editor No further use possible, a new confi-guration must be must be createdwith SIMATIC NCM PC V5.1 ServicePack 2 or higher or STEP 7 Version5.1 Service Pack 2 or higher.

TF LDB COML TF Further use is possible by continuingto use COML TF.

Note

If you want to continue using the previous configuration tools, use the SIMATICNET CD 05/2000.

Page 139: Industrial Communication With PG-PC

Installation and Commissioning

139SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.8.2 Effects on Older Product Versions (CD 05/2000 and earlier) –Industrial Ethernet

Introduction

This section describes what changes are necessary in Industrial Ethernet systemsif you are already using a SIMATIC NET CD 05/2000 product or a previousversion.

TF-1413, S7-1413, PG-1413 up to Version 5.2 + Service Pack 2 for Windows 98 or NT 4.0

Situation:

� These products are not supported with the CD 7/01.

� Simultaneous installation of this product with the new CD 07/2001 is notpermitted and is prevented.

Steps to take:

Keep using the 5/2000 CD if you want to use a CP 1413 in the computer orreplace it with a CP 1613.

TF-1613 up to Version 2.1 for Windows NT 4.0 or 2000 Pro

Situation:

� Application associations are configured with COML TF as before.

� Support of this protocol by SIMATIC NCM PC or STEP 7 with OPC is notplanned.

� The SEND/RECEIVE programming interface included in the product TF-1613can continue to be used unchanged. If you use the OPC interface, it will bepossible, in future, to configure SEND/RECEIVE communication with SIMATICNCM PC or STEP 7!

Steps to take:

None necessary

S7-1613 up to Version 2.1 for Windows NT 4.0 or 2000 Pro

Situation:

An S7 configuration created with COML S7 cannot be used.

Page 140: Industrial Communication With PG-PC

Installation and Commissioning

140SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Steps to take:

� A configuration created with the COML S7 program must be recreated withSIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7 Version 5.1Service Pack 2 or higher.

� If the configuration was already created with STEP 7 (XDB), this STEP 7project can continue to be used. You only need to download the configuration tothe CP/PC station from STEP 7 Version 5.1 Service Pack 2 or higher.

PG-1613 up to Version 2.1 for Windows NT 4.0 or 2000 Pro

Situation:

PG operation possible as before.

Steps to take:

None necessary

SOFTNET S7 up to Version 3.3 for Windows 98, NT 4.0 or 2000 Pro

Situation:

� Windows 98 is not supported.

� An S7 configuration created with COML S7 cannot be used.

Steps to take:

� Use the 05/2000 CD for Windows 98.

� A configuration created with the COML S7 program must be recreated withSIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7 Version 5.1Service Pack 2 or higher.

� If the configuration was already created with STEP 7 (XDB), this STEP 7project can continue to be used. You only need to download the configuration tothe CP/PC station from STEP 7 Version 5.1 Service Pack 2 or higher.

SOFTNET PG up to Version 3.2 for Windows 98, NT 4.0 or 2000 Pro

Situation:

� Windows 98 is no longer supported.

� PG operation possible as before.

Steps to take:

Use the 05/2000 CD for Windows 98.

Page 141: Industrial Communication With PG-PC

Installation and Commissioning

141SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.8.3 Effects on Older Product Versions (CD 05/2000 and earlier) –PROFIBUS

Introduction

This section describes what changes are necessary in PROFIBUS systems if youare already using a SIMATIC NET CD 05/2000 product (or a previous version).

DP-5412, FMS-5412, PG-5412, S7-5412 up to Version 5.2 with Service Pack 2 for Windows 98 or NT 4.0

Situation:

� These products are not supported with the CD 7/01.

� Simultaneous installation of this product with the new CD 07/2001 is notpermitted and is prevented.

Steps to take:

Keep using the 05/2000 CD if you want to use a CP 5412 in the computer orreplace it with a CP 5613.

DP-5613 up to Version 2.1 for Windows NT 4.0 or 2000 Pro

Situation:

A DP configuration created with the COM PROFIBUS program cannot be used.

Steps to take:

� A DP configuration created with the COM PROFIBUS program must berecreated with SIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7Version 5.1 Service Pack 2 or higher.

� If the configuration was already created with STEP 7, this STEP 7 project cancontinue to be used. You only need to download the configuration to the CP/PCstation from STEP 7 Version 5.1 Service Pack 2 or higher.

FMS-5613 up to Version 2.1 for Windows NT 4.0 or 2000 Pro

Situation:

An FMS configuration created with the COM PROFIBUS program cannot beused.

Steps to take:

An FMS configuration created with the COM PROFIBUS program must berecreated with SIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7Version 5.1 Service Pack 2 or higher.

Page 142: Industrial Communication With PG-PC

Installation and Commissioning

142SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

S7-5613 up to Version 2.1 for Windows NT 4.0 or 2000 Pro

Situation:

An S7 configuration created with the COML S7 program cannot be used.

Steps to take:

� A configuration created with the COML S7 program must be recreated withSIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7 Version 5.1Service Pack 2 or higher.

� If the configuration was already created with STEP 7 (XDB), this STEP 7project can continue to be used. You only need to download the configuration tothe CP/PC station from STEP 7 Version 5.1 Service Pack 2 or higher.

SOFTNET-DP up to Version 5.3 for Windows 98, NT 4.0 or 2000 Pro

Situation:

� Windows 98 is not supported.

� A DP configuration created with the COM PROFIBUS program cannot be used.

� It will be possible to configure SEND/RECEIVE communication on the basis ofthe FDL interface over OPC with SIMATIC NCM PC or STEP 7 in the future!

Steps to take:

� Under Windows 98, use the SIMATIC NET CD 05/2000.

� A DP configuration created with the COM PROFIBUS program must berecreated with SIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7Version 5.1 Service Pack 2 or higher.

� If the configuration was already created with STEP 7, this STEP 7 project cancontinue to be used. You only need to download the configuration to the CP/PCstation from STEP 7 Version 5.1 Service Pack 2 or higher.

SOFTNET-S7 up to Version 5.3 for Windows 98, NT 4.0 or 2000 Pro

Situation:

� Windows 98 is not supported.

� An S7 configuration created with the COML S7 program cannot be used.

Page 143: Industrial Communication With PG-PC

Installation and Commissioning

143SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Steps to take:

� Under Windows 98, use the SIMATIC NET CD 05/2000.

� A configuration created with the COML S7 program must be recreated withSIMATIC NCM PC V5.1 Service Pack 2 or higher or STEP 7 Version 5.1Service Pack 2 or higher.

� If the configuration was already created with STEP 7 (XDB), this STEP 7project can continue to be used. You only need to download the configuration tothe CP/PC station from STEP 7 Version 5.1 Service Pack 2 or higher.

SOFTNET-DP slave up to Version 1.2 for Windows 98, NT 4.0 or 2000 Pro

Situation:

Windows 98 is no longer supported.

Steps to take:

Under Windows 98, use the SIMATIC NET CD 05/2000.

3.8.4 No Changes to the User Program Necessary

All programming interfaces are available as before.

Even so, we recommend you use the OPC interface. OPC offers you a powerfuland standardized interface, giving you the added benefits of ActiveX controls andsymbols.

3.8.5 Simplification of OPC ItemIDs

Introduction

This section describes the simplified structure of the ItemIDs

Comparison of the Old and New Syntax

The consistent configuration of the connections in one tool makes it possible tosimplify the ItemIDs of the OPC process variables. The names specified in theconfiguration can now be used as connection information in the OPC ItemIDs.

To avoid having to modify existing user programs, the OPC server neverthelesscontinues to accept the older syntax. Only the simplified names are displayed,however, in OPC Browsing.

Page 144: Industrial Communication With PG-PC

Installation and Commissioning

144SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Based on examples, the following table illustrates the simplification of theconnection part of the OPC ItemIDs:

Previously New Remarks

S7:[Conn1|VFD1|CP_L2_1:]

S7:[Connec-tion_1]

The name “Connection_1” is speci-fied as the unique local ID in STEP7 / Netpro.

DP:[CP_L2_1:] DP:[CP 5614] The symbolic name CP 5614 is as-signed in the configuration with HWConfig and used throughout. Theexisting default names CP_L2_1: toCP_L2_4: must not be used in theconfiguration. The reason for this isthat they are recognized by the DPOPC Server and will continue to beinterpreted as the logical names ofa CP.

DPS:[DPSON-LINE]

DPS:[CP 5611] The symbolic name CP 5611 is as-signed in the configuration with HWConfig and used throughout. Theexisting default names CP_L2_1: toCP_L2_4: and DPSONLINE mustnot be used in the configuration.These are recognized by the DPOPC server and will continue to beinterpreted as the logical name of aCP.

FMS:[Connec-tion_1|VFD|CP_L2_1:]

FMS:[VFD|Con-nection_1]

The name “Connection_1” is speci-fied as the unique connection namein STEP 7 / Netpro.

SR:[ Connec-tion_1||CP_L2_1:]

SR:[Connec-tion_1]

The name “Connection_1” is speci-fied as the unique connection namein STEP 7 / Netpro. It no longerneeds to be configured in a text file.

SR:[|&PC,...|] Unnamed connections are no longersupported.

FDL:[Connec-tion_1||CP_L2_1:]

FDL:[Connec-tion_1]

The name “Connection_1” is speci-fied as the unique connection namein STEP 7 / Netpro. It no longerneeds to be configured in a text file.

FDL:[|2,10,2|CP_L2_1:]

Unnamed connections are no longersupported.

Page 145: Industrial Communication With PG-PC

Installation and Commissioning

145SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

3.9 Interaction of the “Configuration Console“ and the “SetPG/PC Interface“ Configuration Program

Introduction

The “Set PG/PC Interface” configuration program still exists, but can now only beused for PG operation or special user applications.

The following section illustrates the interaction between the “ConfigurationConsole“ and the “Set PG/PC Interface“ configuration program based on varioususer scenarios:

User Scenario Description

PG operation only The user wants to use only one engineering station, forexample to use PG functions with STEP 7.

Configured mode only The user wants to operate a PC station with OPC orother applications (not STEP 7).

Mixed Operation 1:Configured mode andPG operation over aconfigured module:

The user wants to use a PC station in the configuredmode with OPC or other applications and at the sametime use one of the modules in the configured mode forSTEP 7 online access.

Mixed Operation 2:Configured mode andPG operation at thesame time over anunconfigured module

The user wants to use a PC station in the configuredmode and at the same time set up STEP 7 onlineaccess with an adapter that is not included in theconfiguration using the “Set PG/PC Interface”configuration program.

Each user scenario is described in detail below.

When configuring and installing a module, you decide whether it

� will be used with STEP 7/NCM PC in the defined configuration of the PCstation.

� will be operated without configuration.

If the module is operated without a defined configuration, its settings can be madeas normal using the “Set PG/PC Interface” configuration program. The setting foronline access can also be made here. If the PC Station Wizard was used the setting “PC internal (local)” is then selected.This allows the user scenarios outlined above to be implemented.

Page 146: Industrial Communication With PG-PC

Installation and Commissioning

146SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

PG operation only

In this case, pure PG operation or use of existing applications is possible providingthat they do not require a database. The modules are configured using the “SetPG/PC Interface” configuration program as with the SIMATIC NET PC SoftwareCD 05/2000.

� It is necessary to assign an access point to an interface parameter assignment.

� All the properties and diagnostics pages are available and the settings can bemade in the “Set PG/PC Interface” configuration program.

Configured mode only

All components are entered in the Station Configuration Editor and are part of aSTEP 7 project. A configured module uses a fixed interface parameter assignment.The configured parameters are entered in this interface parameter assignmentwhen you download or import an XDB.

Note

Before you import XDB files, you must make sure that no module that has startedin configured mode is communicating.

This interface parameter assignment is still entered in the “Set PG/PC Interface”configuration program, however, the usual properties and diagnostic options are nolonger displayed. Now, if you click the “Properties” button, a page is displayed withthe configured module names and information on their use.

Instead of the properties pages of the “Set PG/PC Interface” configuration programthat can no longer be used, a properties page with the reference to the“Configuration Console” is opened. All the properties and diagnostic pages of the“Set PG/PC Interface” configuration program relating to the database are no longerdisplayed and the “Configuration Console” is now used for configuration anddiagnostics.

Page 147: Industrial Communication With PG-PC

Installation and Commissioning

147SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Mixed Operation 1: Configured mode and PG operation over a configured module

This case basically represents pure configured operation. In an additional step, thePG interface (S7ONLINE) is set to the device parameter assignment of theconfigured module using the “Set PG/PC Interface” configuration program. Ifrouting information exists, it is also possible to use the “PC-Internal” deviceparameter assignment for routing over the PC station.

This means the following:

� The “S7ONLINE” access point of the online access of STEP 7 is eitherassigned to the “PC-Internal” (routing) interface parameter assignment or to theinterface parameter assignment of another configured module.

� Download of the configuration data to the Station Manager

� No separate module is necessary for PG operation.

� Parallel operation of PG functions and S7-5613 possible, for example over a CP5613.

� If the “PC-Internal” access point is used, an overview of the available stations isnot possible!

Mixed Operation 2: Configured mode and PG operation over an unconfigured module

This case basically represents pure configured operation. However, here a moduleis selected for PG operation in the Commissioning Wizard. This module is not partof the configuration. In this case, the access point must be set with the “Set PG/PCInterface“ configuration program.

This also applies to all products not supported by Advanced PC Configuration.These can continue to be operated separately using the “Set PG/PC Interface”configuration program.

Page 148: Industrial Communication With PG-PC

Installation and Commissioning

148SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

3.10 Using Modules for PG Operation with STEP 5 andSTEP 7

PG Operation with and without Configuration

The communications modules of SIMATIC NET for PCs and PGs can, of course,continue to be used in conjunction with STEP 7 and STEP 5. If a module isintended exclusively for use with STEP 7 and STEP 5, you can use it as usual; inother words it is not included in the configuration and is configured with the “SetPG/PC Interface” configuration program.

It is, however, possible to use PG operation with configured modules. This is apractical strategy when the PC is permanently connected to a configured networkand is not plugged in to different networks or programmable controllers. In thissituation, the “Set PG/PC Interface” configuration program of STEP 7 is used forconfiguration – a procedure familiar to STEP 7 users. In this program, a deviceparameter assignment is entered for the configured module but does not allowlocal settings or diagnostics. If this device parameter assignment is selected forSTEP 7, the configured module will be used by STEP 7 for PG communication.

Note

If the module is used in the configured mode, then– only one module parameter assignment is available– no MPI profile can be selected– the functions for preventing problems on active buses when the PG is attachedcannot be used.

You should also check the versions of STEP 7 and STEP 5 approved for operationwith SIMATIC NET modules!

Page 149: Industrial Communication With PG-PC

149SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Tools

Description of the Tools

You would like more information on the various tools available for working with theSIMATIC PC station. When you have read this chapter, you will know both therange of functions and how to work with the most important programs for planningand configuration.

4

Page 150: Industrial Communication With PG-PC

Tools

150SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1 The Symbol File Configurator

Introduction

An OPC client normally accesses process variables using ItemIDs that containaddress information. It is, however, also possible to access the variables usingsymbolic names that can be structured hierarchically.

Instead of working with standards dependent on protocols and devices, a symbolicname space can be created, for example, corresponding to the structure of a plant.The use of symbolic names is possible with any protocol.As well as creating your own name space, you can also take symbolic names fromSIMATIC STEP 7.

The Symbol File Configurator creates files for the SIMATIC NET OPC Server inwhich such symbol names are defined.

You require the Symbol File Configurator to create a symbolic name space and touse symbols from SIMATIC STEP 7.

Terminology

Several terms are used in conjunction with the Symbol File Configurator:

OPC ItemID

The OPC ItemID is the identifier of a process variable used by the OPC server. An ItemID is transferred by the OPC client to the OPC Server to identify a processvariable and is unique for the OPC Server. It is either a symbolic name or a runtime name.

Symbolic Name

A symbolic name is an OPC ItemID that was generated by the Symbol FileConfigurator. In a hierarchically structured name space, a symbolic name is madeup of the names of the hierarchical levels and the actual symbol.

Example: Plant_packing.conveyor1.limswitch

Runtime Name

A runtime name is an OPC ItemID that contains protocol and address informationto allow identification and that is accepted directly by the OPC Server without theuse of a symbol file. Using the Symbol File Configurator, a symbolic name isassigned to a runtime name.

Examples:

� DP:[CP.5613]Slave1M003_IB0

� FMS:[connection1]14

� S7:[S7_1.connection]MW5

Page 151: Industrial Communication With PG-PC

Tools

151SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.1.1 Description of the User Interface

Introduction

The Symbol File Configurator has very much the look and feel of the WindowsExplorer and therefore allows you to work intuitively. A symbol file has ahierarchical structure and can be viewed in the same way as the file system withthe Windows Explorer.

Layout of the Program Window

Analogous to the files and folders in the file system, the symbol file containssymbols and blocks of symbols. In the “Block Tree” on the left-hand side of thedocument you can navigate through the hierarchy and can view the content of aselected block of symbols on the right-hand side. The blocks of symbols are usedto structure your data. The symbols contain the actual information of the processvariable. These include, among other things, access rights, data types etc. butprimarily the name of the item and the runtime name.

Page 152: Industrial Communication With PG-PC

Tools

152SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1.2 The “File” Menu

Introduction

This menu contains standard commands for working with files (for example, toopen files and to save files etc.). All symbol files have the “wsd” extension. Thefollowing menu commands are available.

“New” Menu Command

Select this menu command to create a new symbol file.

As an alternative, you can also click the button:

“Open” Menu Command

Select this menu command to open an existing symbol file.

As an alternative, you can also click the button:

“Close” Menu Command

Select this menu command to close a currently open symbol file. Other open filesremain open and are unaffected by this menu command.

“Save” Menu Command

Select this menu command to save an open symbol file in the currently activefolder.

As an alternative, you can also click the button:

“Save As ...” Menu Command

Select this menu command to save a new or existing symbol file under a newname or in a different folder.

“Exit” Menu Command

Select this menu command to close the Symbol File Configurator and all openfiles.

Page 153: Industrial Communication With PG-PC

Tools

153SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.1.3 The “Edit” Menu

Introduction

This menu contains commands with which you can edit symbols and blocks ofsymbols.

“Select All” Menu Command

This menu command allows you to select several elements.

“Delete” Menu Command

Select this menu command to delete symbols in the structure view (left pane) or inthe table (right pane).

“Options” Menu

Here, you can activate the trace function to log any errors that occur. As default, the trace is saved in the “TFC_Trace.txt” file in the SIMATIC NETfolder for trace files:

If you want the startup events of the program to be logged, you can activate thetrace right from the start of the program by specifying “–debug <filename>” as thecommand line parameter. You can do this either in the Windows Start menu (Start> Run) or in the command prompt:

Page 154: Industrial Communication With PG-PC

Tools

154SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1.4 How to Delete Elements and Blocks

Deleting in the Structure View

In the structure view, you can delete blocks of symbols and their entire contents.Follow the steps below:

Step Steps

1 Select the block you want to delete.

2 Select “Delete” in the context-sensitive menu (right mouse but-ton) or select “Delete” in the “Edit” menu or press the “Delete” key.

Deleting in the Table

Within the table, you can also delete blocks of symbols, SIMATIC control engines,or individual symbols. Follow the steps below:

Step Steps

1 Move the mouse pointer over the line numbering of the tableuntil the mouse pointer changes to a black arrow.

2 Holding down the left mouse pointer, select one or more lines.

3 Select “Delete” in the context-sensitive menu (right mousebutton) or select “Delete” in the “Edit” menu or press the “Delete” key.

Page 155: Industrial Communication With PG-PC

Tools

155SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.1.5 The “Insert” Menu

Introduction

This menu contains commands with which you can insert programs, blocks ofsymbols, and symbols in a symbol file.

The “New Program” Menu Command

In SIMATIC STEP 7, the data in the symbol table and data blocks are managedwithin the framework of a STEP 7 program. When you insert a program, the Symbol File Configurator extracts the symbolsfrom the STEP 7 program. The following information is taken from the program:

� Content of the symbol table

� Content of the data blocks

� Content of the instance data blocks

Update of Existing Programs

You can re-insert a STEP 7 program that has already been extracted. In this case,only the differences are taken from the STEP 7 program. Adaptations made in thesymbol file are therefore retained.

If you insert an existing program a second time, you must confirm the updating ofthe program in a dialog.

The “New Block” Menu Command

By inserting new blocks of symbols, you can structure the name space. Newblocks cannot be inserted in trees if they were created by selecting a STEP 7program.

The “New Symbol” Menu Command

With this menu command, you can enter new symbols and assign runtime namesto the symbols.

Page 156: Industrial Communication With PG-PC

Tools

156SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1.6 How to Insert a New Program / How to Delete a Program.

Inserting a Program

Follow the steps outlined below to insert an S7 program:

Step Steps

1 Select the “New Program” command in the “Insert” menu or Select the “New Program” command in the context-sensitivemenu (right mouse button) or Click the following button:

The “SIMATIC Project Browser” dialog box opens.

2 Select the required program in the left window of the ProjectBrowser. You display the available programs by selecting theentries PROJECT > SIMATIC PC STATION > SIMATIC Station> CPU.

3 Add the selected program to the selection in the right-hand win-dow of the project browser by double-clicking on the programicon or Click the following button:

The name and path of the program appear in the right-hand window of the project browser.

4 Repeat steps 2 and 3 for all the programs you require in the pro-ject.

Page 157: Industrial Communication With PG-PC

Tools

157SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Deleting a Program

Follow the steps outlined below to delete a program:

Step Steps

1 Select one or more programs in the list box.

2 Click the “Delete Selection” button to remove a selected pro-gram from the list box. Click the “Delete All” button to remove all programs from the listbox.

Note

Before a SIMATIC station appears in the tree structure of the available projects,the PC station on which the OPC Server runs must exist in STEP 7.S7 connections must also be configured between this PC station and the S7station on which the STEP 7 program is located.It is not possible to select programs on different PC stations at the same timesince the symbols and the communications connections are always assigned toone PC station.If projects have the same name, you can display the file path in a tooltip.

Page 158: Industrial Communication With PG-PC

Tools

158SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1.7 How to Insert a New Block

The “New Block” Menu Command

Follow the steps outlined below to insert a block:

Step Steps

1 Select the “New Block” command in the “Insert” menu or Select the “New Block” command in the context-sensitive menu (rightmouse button) or Click the following button:

The following dialog box opens:

2 Enter the block name and click the “OK” button. The block appears in the window of the project browser.

Page 159: Industrial Communication With PG-PC

Tools

159SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.1.8 How to Insert a New Symbol

The “New Symbol” Menu Command

Follow the steps outlined below to insert a symbol:

Step Steps

1 Select a block you created previously.Please note that it is not possible to insert new symbols in blocks of aPC station adopted from STEP 7.

2 Select the “New Symbol” command in the “Insert” menu or select the“New Symbol” command in the context-sensitive menu (right mousebutton)or click the following button:

The following dialog box opens:

3 Enter the name of one or more symbols in the “Symbol Name”column in the table

Page 160: Industrial Communication With PG-PC

Tools

160SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Step Steps

4 Enter the runtime name belonging to the symbol in the “RuntimeName” column in the table.If the OPC Server is installed on the local computer, you can take theruntime names from the address space of the OPC Server by clickingthe “Browse” button.

5 Set the access rights for the symbols in the “Access Rights” column.You can set the access rights of several symbols at the same time byselecting the relevant rows and using the “Access Rights” optionbutton.

4.1.9 How to Import and Export the Assignment List

Introduction

In larger plants, it may be useful to include the assignment list of symbols, runtimenames, and access rights in another program or to import the list created by adifferent application.

The data is stored in the “CSV” format that can be read in by Excel. In the “CSV”format, the content is row by row in text format separated by commas.

Export

Follow the steps below to export an assignment list:

Step Steps

1 Select the “New Symbol” command in the “Insert” menu.

2 Click the “Export CSV” button in the “Insert Symbol” dialog.

3 Enter the file name under which the file will be stored.

4 Click the “Save” button.

Page 161: Industrial Communication With PG-PC

Tools

161SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Import

Follow the steps below to import an assignment list:

Step Steps

1 Select the “New Symbol” command in the “Insert” menu.

2 Click the “Import CSV” button in the “Insert Symbol” dialog.

3 Specify the file of the type “CSV” that will be read in.

4 Click the “Open” button.

4.1.10 How to Browse the Address Space of the OPC Server

Introduction

Here, you can browse the address space of an OPC Server to find runtime names.This address space is structured hierarchically and is displayed in the left part ofthe browser window as a tree structure.

Page 162: Industrial Communication With PG-PC

Tools

162SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Steps

Follow the steps outlined below to browse for runtime names:

Step Steps

1 Select the “New Symbol” command in the “Insert” menu or Select the “New Symbol” command in the context-sensitive menu(right mouse button) or Click the following button:

The “Insert Symbol” dialog box opens.

2 Click the “Browse” button. The browser window for OPC objectsopens:

3 The middle part of the browser window displays all items located atthe position in the address space that you selected in the treestructure. Click all the items in this window that you want to add tothe selection.

4 You can add the marked items to the selection by clicking the button:

Page 163: Industrial Communication With PG-PC

Tools

163SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step Steps

5 Select an item in the right-hand half of the browser and click the but-ton to remove an item from the selection:

6 After confirming the dialog with OK, the runtime names are enteredin the table in the “Insert Symbol” dialog.

4.1.11 The “Window” Menu

Window Arrangement

This menu provides commands with which you can change the arrangement of thewindows. All the currently open symbol files and their paths are displayed. Theactive window (symbol file) is selected.

4.1.12 The “Help” Menu

Online Help and Program Information

With the help menu, you can open the contents, index, or find view of the helpsystem. You can also display information on the program in this menu (version,build, copyright).

Page 164: Industrial Communication With PG-PC

Tools

164SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.1.13 Properties of Symbols

Displaying Symbols from STEP 7

If symbols were adopted from STEP 7, the main window of the Symbol FileConfigurator displays detailed information about the configured connection and thevariable address. The following columns are displayed:

Visible

Indicates whether or not a symbol is visible for OPC clients.

Variable Symbol

Name of the symbol.

Address

Address in an object on the S7 device to which the symbol refers.

Connection

Communication connection to the S7 device.

Access Rights

Indicates whether the data of the symbol can be read or written.

Data Type

Indicates the data type of the symbol.

Time Stamp

Indicates when a symbol was generated in STEP 7 or when the symbol wasinserted into the Symbol File Configurator.

EU Low

Indicates the low limit of the range of values of the variable (Engineering UnitsLow).

EU High

Indicates the high limit of the range of values of the variable (Engineering UnitsHigh). The information about a range of values is used for the “Percent Deadband” OPCfunctionality.

Page 165: Industrial Communication With PG-PC

Tools

165SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Example

Display of Self-Defined Symbols

You can create additional symbols for all protocols in the Symbol File Configurator.In this case, a symbolic name is assigned to a protocol- and plant-specific runtimename.

You do not need to remember these names, but you can browse for themafterwards in the OPC name space (in the “Insert Symbol” dialog box).

For self-defined symbols, the Symbol File Configurator displays the followingcolumns:

Visible

Indicates whether or not the symbol is visible for OPC clients.

Variable Symbol

Name of the symbol.

Runtime Name

The protocol and configuration-dependent name of an OPC item assigned to thesymbol.

Access Rights

Indicates whether the data of the symbol can be read or written.

Note

It is also possible to define access rights for variables when configuring withSIMATIC NCM PC or STEP 7. During configuration, it is only possible to defineaccess rights for runtime names. Note that the access rights defined with the Symbol File Configurator have priorityover settings made in the configuration defined in your project.

EU Low

Indicates the low limit of the range of values of the variable (Engineering UnitsLow).

Page 166: Industrial Communication With PG-PC

Tools

166SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

EU High

Indicates the high limit of the range of values of the variable (Engineering UnitsHigh). The information about a range of values is used for the “Percent Deadband” OPCfunctionality.

Example

4.1.14 Entries in Symbol Files

WSD and SSD Files

The information about all the symbols is stored by the Symbol File Configurator ina hierarchical database. When you save, two files are created. The file with the“wsd” extension contains the entire data that was edited in the Symbol FileConfigurator.

In the file with the “ssd” extension, all the additional information not required foroperation with the OPC Server is removed. In effect, this means that all symbolsand fields defined as “invisible” are omitted.

The Symbol File Configurator always opens and edits the wsd files. The ssd files are created when you save in the Symbol File Configurator and mustbe specified when you configure OPC operation.

Page 167: Industrial Communication With PG-PC

Tools

167SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.1.15 Importing Symbol Files from STEP 7

Requirements for Importing

Before symbolic names can be imported from STEP 7, the following requirementsmust be met:

� The Symbol File Configurator reads the list of STEP 7 projects from thedatabase of the SIMATIC Manager. It is therefore necessary to open a newproject at least once in the SIMATIC Manager before the data can be adoptedby the Symbol File Configurator.

� Using the Project Browser, you can select the STEP 7 project and the PCstation on which the OPC Server is configured. Starting from this PC station, allthe S7 stations and CPUs to which S7 connections are defined are displayed.The programs of these CPUs can then be added to the symbol file; in otherwords, the symbol tables and the symbolic names from the data blocks of theseprograms are adopted in the Symbol File Configurator.

Page 168: Industrial Communication With PG-PC

Tools

168SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.2 The Symbol File Configurator as of SIMATIC NETVersion 6.1

Introduction

An OPC client normally accesses process variables using ItemIDs that containaddress information. It is, however, also possible to access the variables usingsymbolic names that can be structured hierarchically.

Instead of working with standards dependent on protocols and devices, a symbolicname space can be created, for example, corresponding to the structure of a plant.The use of symbolic names is possible with any protocol. Apart from creating a separate name space, symbolic names can also be takenfrom SIMATIC STEP 7.

The Symbol File Configurator creates files for the SIMATIC NET OPC Server inwhich such symbol names are defined. You require the Symbol File Configurator tocreate a symbolic name space.

Note

In the previous version, you could also use the Symbol File Configurator todownload data blocks. This functionality is no longer included in the latest version.Use STEP 7 if you want to do this.

Terminology

Several terms are used in conjunction with the Symbol File Configurator:

OPC ItemID

The OPC ItemID is the identifier of a process variable used by the OPC server.

An ItemID is transferred by the OPC client to the OPC Server to identify a processvariable and is unique for the OPC Server.

It is either a symbolic name or a runtime name.

Symbolic name

A symbolic name is an OPC ItemID that was generated by the Symbol FileConfigurator. In a hierarchically structured name space, a symbolic name is madeup of the names of the hierarchical levels and the actual symbol.

Example: Plant_packing.conveyor1.limswitch

Page 169: Industrial Communication With PG-PC

Tools

169SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Runtime Name

A runtime name is an OPC ItemID that contains protocol and address informationto allow identification and that is accepted directly by the OPC Server without theuse of a symbol file. Using the Symbol File Configurator, a symbolic name isassigned to a runtime name.

Examples: DP:[CP.5613]Slave1M003_IB0

FMS:[connection1]14

S7:[S7_1.connection]MW5

4.2.1 Description of the User Interface

Introduction

The Symbol File Configurator has very much the look and feel of the WindowsExplorer and therefore allows you to work intuitively. A symbol file is structuredhierarchically and has a structure similar to a file system.

Layout of the Program Window

Analogous to the folder and files in the file system, the symbol file contains foldersand symbols. In the structure view in the left window, you can navigate through thehierarchy of the symbol file. When you click on a folder there, the right-hand sidedisplays its content. In the upper part, you can see the folders and below them thesymbols.

The folders are used to structure your data. The symbols contain the actualinformation of the process variables such as access rights, data types, and thename of the item and the runtime name.

Page 170: Industrial Communication With PG-PC

Tools

170SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of Symbols

The main window displays the following details of the symbols:

Symbol name

Name of the symbol.

Item ID

The names of the hierarchy levels and the symbolic name, separated by a period.

Runtime Name

An OPC Item ID with protocol and address information. This runtime name isaccepted directly by the OPC Server (in other words without the additionalinformation of a symbol file).

Data Type

Indicates the data type of the symbol.

Access Rights

Indicates whether the data of the symbol can be read or written.

EU Lo

Indicates the low limit of the range of values of the variable (Engineering UnitsLow). The information about a range of values is used for the “Percent Deadband”OPC functionality.

EU Hi

Indicates the high limit of the range of values of the variable (Engineering UnitsHigh). The information about a range of values is used for the “Percent Deadband”OPC functionality.

4.2.2 The “File” Menu

Introduction

This menu contains standard commands for working with files (for example, toopen files and to save files etc.). All symbols files have the extension “sti”(Siemens Tag Info). The following menu commands are available.

Page 171: Industrial Communication With PG-PC

Tools

171SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

“New” Menu Command

Select this menu command to create a new symbol file.

As an alternative, you can also click the button:

“Open” Menu Command

Select this menu command to open an existing symbol file.

As an alternative, you can also click the button:

“Save” Menu Command

Select this menu command to save an open symbol file in the currently activefolder.

As an alternative, you can also click the button:

“Save As ...” Menu Command

Select this menu command to save a symbol file under a new name or in adifferent folder.

“Close” Menu Command

Select this menu command to close a currently open symbol file. Other open filesremain open and are unaffected by this menu command.

“Exit” Menu Command

Select this menu command to close the Symbol File Configurator and all openfiles.

4.2.3 The “Edit” Menu

Introduction

This menu contains commands with which you can edit folders and symbols.

The “New Folder” Menu Command

With this menu command you can create a new folder. When you select thecommand, a dialog box “Add Folder” appears in which you enter the folder name.A new folder is always created below the icon selected in the left-hand area.

Page 172: Industrial Communication With PG-PC

Tools

172SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The “New Symbol” Menu Command

With this menu command, you create new symbols. After selecting the menucommand, the “Add Items ...” dialog opens

“Remove Element” Menu Command

Select this menu command to delete a folder selected in the left window area.

4.2.4 The “Window” Menu

Window Arrangement

This menu provides commands with which you can change the arrangement of thewindows. Here, you also see a list of the currently open symbol files with theirpaths. The active window (symbol file) is indicated by a check mark.

4.2.5 The “Help” Menu

Online Help and Program Information

With the help menu, you can open the contents, index, or find view of the helpsystem. You can also display the version number of the program with the “About”menu command.

4.2.6 How to Insert a New Symbol

Step 1

Select a folder in the left-hand area of the program window. The program alwayscreates new symbols below the selected folder.

Page 173: Industrial Communication With PG-PC

Tools

173SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step 2

Select “New Symbol” in the “Edit” menu

or

Select “New Symbol” in the context-sensitive menu (right mouse button)

The “Add symbols” dialog box appears:

Step 3

In the OPC address space area of the window, you can see the variables for allcurrently active protocols. Select the variable for which you want to assign asymbolic name and then click the button with the arrow pointing to the right (“Addselection”).

As an alternative, you enter the required values in the lower part of the window formanual input.

Step 4

The variable appears in the Selected symbols part of the window. Add a symbolname here.

Repeat steps 3 and 4 when necessary for other variables.

Step 5

Close the “Add new symbols” dialog by clicking the “OK” button.

Page 174: Industrial Communication With PG-PC

Tools

174SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.2.7 How to Insert a New Folder

Step 1

Select an element in the left-hand area of the program window. The programalways creates a new folder below the selected element.

Step 2

Select “New Folder” in the “Edit” menu. or Select “New Folder” in the context-sensitive menu (right mouse button) or Click the button below:

Step 3

The “Insert New Folder” dialog opens. Enter the name of the new folder andconfirm your entry with the “OK” button.

The new folder icon is integrated in the structure view.

Page 175: Industrial Communication With PG-PC

Tools

175SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.2.8 How to Delete Folders or Symbols

Step 1

Select the folder or symbol you want to delete in the structure view.

Step 2

Select “Remove Element” in the “Edit” menu

or

Select “Remove Element” in the context-sensitive menu (right mouse button)

Remember that when you delete a folder, you also delete all the elementscontained in the folder (subfolders and symbols).

4.2.9 How to Import a Symbol File

Step 1

In the OPC address space dialog, select the context-sensitive menu “Import fromCSV File”. A dialog appears in which you can select a file.

Step 2

Select the file you want to import and confirm your entries with the “OK” button.

4.2.10 How to Export a Symbol File

Step 1

In the OPC address space dialog, select the context-sensitive menu “Export toCSV File”. A dialog appears in which you can save a file.

Step 2

Select a folder and enter a file name. Confirm your entries by clicking the “OK”button.

Page 176: Industrial Communication With PG-PC

Tools

176SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.3 DCOM Settings

Introduction

Before a client can use a COM object on another computer, the properties of theCOM object must be configured on the client computer and on the remotecomputer.

The following section contains information on configuring the client computer andconfiguring the computer with the OPC Server.

4.3.1 The dcomcnfg System Program

Calling dcomcnfg

You configure DCOM and the required COM objects using the Windows systemprogram dcomcnfg. You will find this in the “Windows\System32” folder.

After starting the program, for example by entering “dcomcnfg” in the “Run” dialog(Start menu), four tabs are available for making settings for DCOM.

Note

If you lower the security settings, the system must be restarted to activate thechanges.

Caution!

The settings listed in this description guarantee simple installation and startup ofthe DCOM protocol. Some of the security settings of the operating system arereduced. To meet stricter security requirements, you must increase the settingsaccording to the DCOM guidelines.

Connecting to the OPC Server

This section describes the situation in which exactly one client connects to an OPCserver running on a different computer. If you want to use more than one OPCserver from a client, please refer to the DCOM documentation.

Page 177: Industrial Communication With PG-PC

Tools

177SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.3.2 “Default Properties” Tab

Description of the Settings

In the “Default Properties” tab, you specify basic properties of DCOM.

Operation on a Domain Server or in a Workgroup

The settings made in the DCOM configuration depend on whether the computerwith the OPC Server is logged on in a domain or is operated within a workgroup.

If it operates within a domain, the server computer can check the configured rightsof other accounts over the network (authentication). The is only possible when theaccounts of the user are registered with this domain.

Page 178: Industrial Communication With PG-PC

Tools

178SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Settings

For DCOM operation with the OPC server within a workgroup (no domain serveravailable for authentication), make the settings as shown.

When operating in a domain, the default authentication level can by set to“Connect” and the Default Impersonation Level to “Identify” for security reasons. Inthis case, the relevant accounts must be specified in the “Default Security” tab. Forsimpler commissioning, however, the settings shown below are also recommendedfor these modes.

Page 179: Industrial Communication With PG-PC

Tools

179SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.3.3 “Default Security” Tab

Description of the Settings

In the “Default Security” tab, you can specify the rights for DCOM operation. Theseproperties are used by all COM objects that do not have their own settings(settings made after selection in the “Applications” tab).

These settings make sure that only clients with the correct permissions can usethe server.

The following default permissions are relevant in conjunction with DCOM:

� Access permissions

� Launch permissions

� Configuration permissions

These permissions can be set individually for each object and the defaultproperties are then ignored.

Access Permissions

The default access permissions for all COM objects specify which accounts areallowed to access the object; in other words, call the methods and which accountsare explicitly denied access.

Launch Permissions

The default launch permissions for all COM objects specify which accounts havethe right to create the object and which accounts are explicitly denied thispermission.

Configuration Permissions

The default configuration permissions specify which accounts can modify theinformation in the registry about COM objects; in other words can also install newobjects on the computer.

Simple Commissioning

If you make the following settings for the user accounts “EVERYONE”,”INTERACTIVE”, ”NETWORK” and “SYSTEM” both at the client and server end,you will find it simple to commission DCOM:

� Access permissions: (Allow access)

� Launch permissions: (Allow launch)

� Configuration permissions: (Full control)

� When working in a domain, it is adequate to enter only the user accounts“SYSTEM” and the accounts of the authorized users in the lists for access,launch, and configuration rights on the client and server.

Page 180: Industrial Communication With PG-PC

Tools

180SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

These settings make commissioning straightforward but allow every user in thenetwork access to the computer. If you have security problems with these settings,the permissions must be restricted to individual user accounts.

4.3.4 “Applications” Tab

Description of the Settings

The “Applications” tab displays all the COM objects available on the computer.Here, you select a COM object you want to configure and open the configurationdialog by clicking the “Properties” button. The DCOM configuration of theproperties for the computer with the OPC client differs from that of the computerwith the OPC server. The OPC server for SIMATIC NET is listed as“OPC.SimaticNET”:

Page 181: Industrial Communication With PG-PC

Tools

181SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.3.5 “Default Protocols” Tab

Description of the Settings

In the “Default Protocols” tab, you specify the network protocols that are availablefor DCOM.

Note

The OPC Server of SIMATIC NET was tested with the protocols“Connection-oriented TCP/IP”.

Since the priority is decided by the order of the protocols in the dialog, DCOM usesthe highest protocol if it is available.

Notice:

To operate the PROFInet OPC Server, the “Connection-oriented TCP/IP” protocolmust be at the top of the list. This setting is also necessary when the OPC Serverruns on the same computer as the OPC client.

When communicating with a PROFInet partner (that is not normally a member ofthe domain), remember to use the workgroup settings!

4.3.6 Configuration of the Server Computer

Introduction

For the computer with the OPC server, you must set the accounts that have theright to use the server. In addition to the special permissions in conjunction withOPC, the account of the user of the OPC servers must also have userpermissions.

You can make the required settings in several tabs.

Page 182: Industrial Communication With PG-PC

Tools

182SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.3.7 “Location” Tab

Description of the Settings

The “Location” tab is used to specify the computer on which the server is started.Since the configuration of the computer with the OPC server is described in thissection, you must select the “Run application on this computer” setting.

4.3.8 “Identity” Tab

Description of the Settings

The settings made in the “Identity” tab specify the account to be accessed to checkthe permissions of the user of the object. Here, various settings are possible:

� “The Interactive user”

� “The launching user”

� “This user”

Page 183: Industrial Communication With PG-PC

Tools

183SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

“The interactive user” Setting

The account of the currently logged on user is used. If, however, no user uses thecomputer, there is no interactive user and the COM object cannot be created. Ifyou operate without a logged on user, use the “This user” setting. “Interactive user”is the default setting for the OPC Server for SIMATIC NET.

“The launching user” Setting

The account of the user that launched the OPC client is used. This user must thenalso have the required permissions; in other words, must be entered in the“Security” tab. The user must also have the default permissions entered for thegroup of users on this computer; in other words, must belong to the group of users.This mode must not be used with the OPC server for SIMATIC NET since the OPCserver would otherwise be started more than once by different user’s accounts andthis is not permitted.

“This user” Setting

The account of a specified user is used. This user must have the requiredpermissions; in other words, must be entered in the “Security” tab. The user mustalso have the default permissions entered for the group of users on this computer;in other words, must belong to the group of users. This setting must be used tooperate the OPC server for SIMATIC NET (logged on users).

Page 184: Industrial Communication With PG-PC

Tools

184SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

4.3.9 “Security” Tab

Introduction

You specify the access permissions for the OPC server in the “Security” tab. Forthe three aspects relevant to COM objects, you can either use the defaultpermissions or custom permissions for the selected COM object.

Note

If you select the default settings in the “Security” tab, you must make sure that thenecessary rights are available for the account entered in the “Identity” tab.

If you do not want a particular user to have all COM objects of the systemavailable, you must configure custom permissions. To operate the OPC server,only the access permission and the launch permission need to be configured.

Page 185: Industrial Communication With PG-PC

Tools

185SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Specifying Default Access Permissions

The users that are allowed to use the OPC server must be entered in the defaultaccess permissions, launch permissions, and configuration permissions. Severalusers have been entered in the following examples of the required permissions:

Both on the server and on the client computer, the logons and therefore theinformation about permissions of the logon must exist on the other computer.

Example: User “Alpha” is logged on at the computer with the server and “Beta” islogged on at the computer with the client user. For DCOM operation a “Beta”account is required on the server computer (with the same password as on theclient machine) and an “Alpha” account is required on the client computer (samepassword).

The use of a group with logons is advisable when using a domain. The informationabout permissions is then fetched from the domain server.

Note

The various OPC servers are implemented as services and therefore requireaccess permissions for the SYSTEM account.

Page 186: Industrial Communication With PG-PC

Tools

186SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Access Permission

After clicking the “Edit” button in the “Use custom access permissions” box, thefollowing dialog box appears:

Note

Add the account of the user under which the OPC Server will be started and, ifdifferent, the account under which the client runs.

Access by the SYSTEM account must be permitted to use SIMATIC NET systemservices.

Page 187: Industrial Communication With PG-PC

Tools

187SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Launch Permission

After clicking the “Edit” button in the “Use custom launch permissions” box, thefollowing dialog box appears:

Note

Add the account of the user under which the OPC Server will be started and, ifdifferent, the account under which the client runs.

Page 188: Industrial Communication With PG-PC

Tools

188SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Configuration Permission

After clicking the “Edit” button in the “Use custom configuration permissions” box,the following dialog box appears:

Note

Add the account of the user under which the OPC Server will be started and, ifdifferent, the account under which the client runs.

Page 189: Industrial Communication With PG-PC

Tools

189SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

4.3.10 Configuration of the Client Computer

Registering the OPC Server

The application that will use the OPC Server runs on the client computer. The OPCServer itself is started on another computer when using DCOM, which is why thereis no process for the OPC server visible in Windows NT Task Manager. The OPCServer must nevertheless be registered on the client computer so that the COMlibrary knows the required object and so that configuration is possible. The OPCProxy libraries provided by the OPC Foundation are also required on the clientcomputer. This library converts the COM calls into a data stream for transmissionover the network. You should also read the notes on client installation in theInstallation Instructions.

For the computer with the OPC client, you must set the computer in the network onwhich the server will be activated and the user account with which the OPC Serverwill be accessed.

“Location” Tab

The location of the server must be specified in this tab. For DCOM operation, onlythe check box “Run application on the following computer:” must be selected. Click“Browse” to locate the server computer.

Page 190: Industrial Communication With PG-PC

Tools

190SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 191: Industrial Communication With PG-PC

191SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Basics of the OPC Interface

This chapter will familiarize you with some of the basic terminology you will requireto understand OPC.

You will also learn the fundamental background to OPC and get to know the DataAccess and Alarms & Events OPC interfaces.

To complete the section, you will see how the OPC server of SIMATIC NET isimplemented.

5.1 Basic Terminology

Before you read the introduction to OPC or start to work with OPC, you may find ituseful to familiarize yourself with some of the basic terminology. You can also skipthis section for the meantime and refer to the explanations later as you requirethem.

5.1.1 What are COM Objects?

What is COM?

The basis of OPC mechanisms is COM, the Component Object Model fromMicrosoft.

COM defines a standard that allows objects to be defined as separate units inWindows and to access these units beyond the boundaries of a process.

Objects can be understood as extensions of the operating system. They are notdependent on programming languages and are available in principle to allapplications.

COM objects are components that are executable under Windows and that providea defined functionality for other components via their interfaces. A COM object canbe used simultaneously by several applications.

The data and code of the object are not transparent for the user of the COMobject.

Note

The term object in the context of COM does not correspond to the object definitionin object-oriented programming languages. A COM object must be seen as aself-contained software unit. Typical properties of object-oriented programminglanguages, such as inheriting, are not provided by COM.

5

Page 192: Industrial Communication With PG-PC

Basics of the OPC Interface

192SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Structure of COM Objects

The schematic below illustrates the structure of a COM object with 4 interfaces.The object is accessed only via the interfaces. Access is governed by variousmethods. It is not possible to access the actual object as a whole, nor the data orcode it contains.

Figure 5-1 Structure of a COM Object

Page 193: Industrial Communication With PG-PC

Basics of the OPC Interface

193SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.1.2 How do COM Objects Appear?

In documentation, COM objects are usually illustrated graphically. Theobject-specific interfaces are shown to the side of the object and the IUnknowninterface supplied with all objects is shown at the top edge of the object.

The methods underlying the interfaces are disguised by the interfaces.

Figure 5-2 Representation of a COM Object

5.1.3 What do COM Interfaces Provide?

A COM interface is a defined collection of methods for invoking the functionality ofthe COM object. It consists of a table of pointers that reference the methods. ACOM interface encapsulates the functionality of the COM object and ensures thatthe object can only be accessed in a defined way. COM interfaces are assigned aunique identifier so that an application that wants to access the COM object cancheck whether the object supports the interface prior to the access.

Interface Structure

The schematic shows the basic structure of an interface.

Figure 5-3 Structure of an Interface

Page 194: Industrial Communication With PG-PC

Basics of the OPC Interface

194SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.1.4 What Types of Interface Exist?

COM distinguishes the following types of interface:

� Automation Interface

� Custom Interface

The interfaces differ in the internal method call. For each interface, there areseparate interface specifications. They are nevertheless suitable for the widestpossible range of applications, such as access to variables or receiving messages.

OPC client applications based on a script language such as Visual Basic or VBAmust use the automation interface.

OPC client applications based on C or C++, can also use the automation interface.To achieve maximum performance, it is, however, advisable to use the custominterface.

Figure 5-4 Example of the Assignment between the Interface and the Application

5.1.5 What Does Object Control through Automation Mean?

Object control is used to control COM objects with the aid of script languages.

The custom interfaces are not suitable for the range of functions of developmenttools based on script languages. By extending the COM objects with theAutomation Interface distributor interface, the methods of the objects areaccessible for even simple script languages. The Automation Interface makes thecommands understood by the object visible to the outside.

Programmable access to COM automation servers is defined by properties andmethods. This allows the simple embedding of a COM object, for example indevelopment environments such as Visual Basic for Applications.

Page 195: Industrial Communication With PG-PC

Basics of the OPC Interface

195SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.2 Introduction to XML and SOAP

XML and OPC-XML

XML (eXtensible Markup Language) is a new standard for the Internet that has inthe meantime also become widespread in standard software in many areas. Justlike HTML, XML allows metainformation to be added to data. The difference beingwith XML, that you can define your own data structures and attributes.

Based on XML, a new specification was also defined for OPC known asOPC-XML, that describes the process data interface with XML data records.

Access to OPC over the Internet

Communication via the DCOM interfaces of OPC is usually limited to local areanetworks. COM interfaces are also normally defined on Windows-based systems.To ensure security, firewalls allow only restricted access from the Internet and tothe Internet. With OPC-XML, a standard is made available that allowscommunication using the cross-platform protocol SOAP (Simple Object AccessProtocol). Data access using OPC-XML has a range of functions based on OPCData Access.

Interface Description with XML

The data interfaces and methods are described by XML. The exact description ofthe methods is specified in a WSDL specification (WSDL = WebService DefinitionLanguage) supplied by the OPC Foundation along with the OPC-XML DAspecification. The methods are described using SOAP (XML protocol) and sentusing the HTTP protocol. In simple terms, we can say the following:

SOAP = HTTP + XML

The graphic below illustrates the relationships:

Page 196: Industrial Communication With PG-PC

Basics of the OPC Interface

196SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Data Transfer with the HTTP Protocol

Access to methods directly from the Internet represents a considerable securityrisk. SOAP therefore only uses the Internet HTTP channel (HTTP = HyperTextTransfer Protocol) for data transfer that is simple to administrate through a firewall:

Page 197: Industrial Communication With PG-PC

Basics of the OPC Interface

197SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.2.1 Web Services

Function Calls over the Internet

A Web service allows function calls to be sent to a server over the Internet. Thedescription of the methods and parameters made available by a Web service isstored in WSDL files in XML format. These can be requested from the Web serverby the client. To use Web services, effectively only the Internet address or URL ofthe Web service is required. Data is transferred over SOAP with HTTP frames.

Page 198: Industrial Communication With PG-PC

Basics of the OPC Interface

198SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.3 Introduction to OPC

What is OPC?

OPC is the acronym for OLE for Process Control.

With the introduction of OPC, the term OLE was used for the entire componentarchitecture of Microsoft. This has changed in the meantime. In its original form,OLE represented the mechanisms for embedding objects in compound documents.

Today, OPC should really be called COM for Process Control, since OPC is basedon the Component Object Model (COM). COM is the central component ofWindows operating systems and controls the interplay between multiple softwarecomponents.

By using COM, the OPC server becomes similar to part of the Windows operatingsystem and is therefore independent of file names, storage locations, and versions.

As a further development of COM, DCOM supports distributed applications andallows cooperation between software components on different computers within anetwork.

Page 199: Industrial Communication With PG-PC

Basics of the OPC Interface

199SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Before OPC, a lot of effort was necessary to control the hardware of differentvendors using software applications. There were numerous different systems andprotocols; for each vendor and each protocol, a user had to order special softwareto access the specific interfaces and drivers. User programs were thereforedependent on the vendor, protocol, or system. OPC on the basis of COM orDCOM has a uniform and non-proprietary software interface that hasrevolutionized data exchange in automation engineering.

Figure 5-5 Areas of Application of OPC

5.3.1 What Does the OPC Interface Provide?

As an industrial standard, OPC defines the exchange of information for a variety ofapplications in an industrial environment. Working at your PC, you can monitor,call, and process system data and events of the automation systems.

The OPC interface is part of the software running on a PC as the platform foroperator control and monitoring systems or other applications. It is thereforelocated below the application program.

Page 200: Industrial Communication With PG-PC

Basics of the OPC Interface

200SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Scope of the OPC Interface

The OPC Foundation has been creating specifications for the OPC interface since1996. The following specifications are currently available for automationengineering:

� For data exchange based on process variables: Data Access

� For servicing alarms and events: Alarms & Events

� For access to archived data: Historical Data Access

� For working with recipes: Batch

As the interface to the industrial communications systems, the OPC serverprovides the functionality of Data Access and Alarms & Events. Only thesespecifications are described in this documentation.

Applications of the OPC Interface

The applications of the OPC interface are based on the client-server model. Onecomponent provides its services to other components via interfaces. Anothercomponent makes use of these services. With OPC, another application canrecognize which OPC servers exist in a system. It can then address one or moreof these servers and query the services they provide. Since several different OPCclients can access the same OPC server at the same time, the same data sourcecan be used for any OPC-compliant application.

Manufacturers of modules that supply process data (communications systems,measuring devices etc.) provide an OPC server for their module that then handlesthe interfacing to the relevant data source.

Page 201: Industrial Communication With PG-PC

Basics of the OPC Interface

201SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.3.2 What is an OPC Server?

OPC components that deliver data are called OPC servers. They implement theinterfacing to existing communications systems. Apart from services, they provideinformation for the OPC client from any data source; this might be ahardware-driven data source or software component. The data is acquired, forexample, from interfaces, fieldbus cards, measuring devices, or controllers.

Server Names

Each OPC server is assigned a unique name by the vendor to identify it. Accordingto the COM standard, these names are known as ProgIDs. By specifying theProgID, you can address specific OPC servers.

Server Types

There are three types of OPC server. The type depends on how they are includedin the communications system:

� In-Process Server

� Local Server

� Remote Server

The vendor of an OPC server specifies whether the server is an in-process serveror a local server. Operation as a remote server is configured by the user.

In terms of the application, it is irrelevant which server is used, the syntax of themethod calls is the same for all.

The schematic below shows which components of the OPC server are accessedby various types of clients:

Figure 5-6 OPC Servers

Page 202: Industrial Communication With PG-PC

Basics of the OPC Interface

202SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.3.3 What is an OPC Client?

OPC components that use an OPC server as a data source are known as OPCclients. OPC clients can be obtained on the market as standard software. Softwaremodules are also available that you can put together to create your own clientfunctionality. To meet the individual requirements of your system and to achievethe best possible performance, you can write your own OPC clients in variousprogramming languages (for example, Visual Basic, C and C++).

Some properties of OPC servers (for example variable names) are not defined bythe OPC standard but depend, for example, on the properties of the automationsystem or the plant and are specified, for example by the vendor. To ensure thatOPC clients can work problem-free with various OPC servers, you should plan theconfiguration of the variables when programming. An application is then flexibleand can be reused.

Page 203: Industrial Communication With PG-PC

Basics of the OPC Interface

203SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.3.4 How do the Server and Client Work Together?

The server and client communicate on the basis of COM or DCOM. The clientdoes not access a server directly but uses the COM library. By specifying theProgID, the OPC client can address every OPC server it requires.

For the client, the access path (using COM or DCOM) is not transparent. Theschematics illustrate the possible access paths: Both local and between twodifferent machines.

Figure 5-7 COM on the Local Computer

Figure 5-8 COM on Another Computer

Page 204: Industrial Communication With PG-PC

Basics of the OPC Interface

204SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties and Methods

The functionality of OPC servers is determined by their interfaces. The OPC clienttherefore knows the server functionality to be expected and can use the availableservices specifically. From an object-oriented point of view, the services of theOPC server are represented by properties and methods. All OPC servers have abasic set of the same properties and methods. Certain interfaces are designatedas optional in the OPC specifications. If a server does not provide such optionalfunctionality, a client can recognize this and react accordingly. As a result,components of different vendors can work together without problems.

A client can create, use, and delete objects on the server via the OPC interfaces.The OPC client references server functions and uses the methods of the server forreading and writing data. Each server function corresponds with a call on the client.

Page 205: Industrial Communication With PG-PC

Basics of the OPC Interface

205SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.4 OPC Data Access

What is OPC Data Access?

Data Access is an OPC specification for accessing process data using variables.An OPC server for Data Access manages the process variables and the variousways in which the variables can be accessed. The server can do the following:

� Read the value of one or more process variables

� Modify the value of one or more process variables by writing a new value

� Monitor the value of one or more process variables.

The server checks whether the value of the process variable has changed. If thereis a new value, the server signals the new value to the client. The messages to theclient are, however, not faster than the “Update Rate” set for the client. If a valuechanges faster than specified in the “Update Rate”, the client is not informed oninterim values.

Process variables are placeholders for values that must be acquired in runtime.

Process Values

The source of the process values is not stipulated in the OPC specification and isvendor-specific. This means that any information can be provided by Data Access.

Page 206: Industrial Communication With PG-PC

Basics of the OPC Interface

206SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.4.1 What Does the Class Model of OPC Data Access Provide?

The hierarchical class model of Data Access helps to adapt the time taken and theobtained result to the current requirements of an application when the clientaccesses data. Data Access can be divided into three classes, as follows:

� OPC Server

� OPC Group

� OPC Item

Figure 5-9 Class Model of the Data Access Interface

The client application uses COM calls of the operating system only to create anobject of the OPC server class. The other objects are created by appropriate OPCmethods of the OPC server class or underlying classes.

The class model applies both to the automation interface as well as to the custominterface (with certain restrictions).

5.4.2 OPC Server Class

The highest class is the OPC server class. Each OPC server belongs to this class.This class represents the point of access for all further services of the OPC DataAccess server.

With the aid of class-specific attributes and methods, you can obtain informationabout the status, version, and as an option the name space of the availableprocess variables. An object of the OPC server class manages the instances of thenext lower class; in other words, the OPC group.

Page 207: Industrial Communication With PG-PC

Basics of the OPC Interface

207SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.4.3 OPC Group Class

The OPC group class is directly below the OPC server class and structures theprocess variables used by the OPC server. An OPC client can use several objectsof this class at the same time. Using the objects of an OPC group, a client canform meaningful units of process variables and execute operations with them. Asan example, it might be useful to put all the process variables of one screen pageof an operator control and monitoring system into one group.

The OPC group class defines methods with which the values of the processvariables can be read and written.

With some methods, several variables can be put together in one job andtransferred at the same time. In particular when using an OPC server over thenetwork, these group operations allow fast execution.

5.4.4 OPC Item Class

Objects of this class represent the actual process variables and allow specific datato be queried. Each variable is an element (item) in the name space of the OPCserver and is identified by an Item ID. The Item ID is specified by the vendor of theserver and must be unique within the name space of the server. The followingproperties are associated with each item:

� Value

Last acquired value of the variable.

� Quality

Reliability of the value. If the quality is good, the value was acquired withcertainty.

� Time stamp

The time at which the current value of the variable was first acquired. Each timea value change is signaled to the client, the time stamp is updated. If the valueof a variable does not change, the time stamp remains the same.

The Role of Variables

Variables must be specified in the OPC interface calls to obtain process values. Byspecifying variables, the client can request the required values from the server.The client must register each required variable with the server to specify whichvalues will be read and when. Variables can be read and written synchronously andasynchronously.

Page 208: Industrial Communication With PG-PC

Basics of the OPC Interface

208SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The client can delegate the monitoring of variables to the server. When the valueof a variable changes, the server sends a message to the client.

The variables provided by the OPC server can be grouped as follows:

� Process variables

Represent measured and controlled variables in a process such as provided byinput and output devices or

� Control variables

Using these variables triggers certain additional services, for example thetransfer of passwords.

� Information variables

These variables are provided by the communications system and provideinformation about the status of connections, devices etc.

A few examples of variables of an OPC Data Access server are shown below:

� Control variables of a programmable controller

� Data of a measured data acquisition system

� Status variables of the communications system

5.4.5 Using the “Percent Deadband” Parameter

This parameter is specified as a percentage and defines a range in which changesare not signaled for all items of a group. The absolute value of the range is thespecified percentage of the total value range of the process variable.

In the following example: Percent Deadband = 10% = 1 unit (where lower limit = 0and upper limit = 10).

Page 209: Industrial Communication With PG-PC

Basics of the OPC Interface

209SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Following each value change, a band is placed around the last changed value. Achange message is generated and sent to the client only when the value leavesthis band when it is read, following which a new band is set.

Note

Violating the upper or lower limits does not generate any special alarms accordingto the OPC Specification !

5.4.6 Which interfaces are specified for OPC Data Access?

Automation and Custom interface are specified for Data Access:

� Data Access Automation Interface, Standard, February 4, 1999, Version 2.02

� Data Access Custom Interface, Standard, October 14, 1998, Version 2.0

Page 210: Industrial Communication With PG-PC

Basics of the OPC Interface

210SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.5 OPC Alarms & Events

What Is Meant by Alarms & Events?

Alarms & Events is a specification for the transfer of process alarms and events. Itis structured flexibly and can therefore be used with a wide variety of eventsources. The spectrum ranges from simple events to complex events and evenincludes events that must be acknowledged.

The OPC specification defines the possible status changes for conditional eventsin a state diagram.

Access to the events is based on a class model.

5.5.1 What are Events and Event Messages?

Events are particular states in the process that need to be signaled to a receiver.Which events are signaled to which programs is decided by the OPC client usingfilters.

All events that correspond to the criteria set with the filter must be passed from theoriginator of the event to the user. This is a distinction between Alarms & Eventsand Data Access. When monitoring variables, only the value changes that fallwithin the specified time interval are signaled.

Message Content

The message contains the parameters defined in the OPC specification andpossibly also associated values specified by the vendor.

There are simple event messages and more complex status-linked messages.With the complex status-linked messages, the sender of the event can demand anacknowledgment by the user.

Page 211: Industrial Communication With PG-PC

Basics of the OPC Interface

211SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Event Types

The OPC specification defines three types of event:

� Condition-related events

These signal the status changes defined in the OPC status model and arerelated to defined conditions.

� Tracking events

These signal changes in the process if, for example, a user changes thesetpoint of a controller.

� Simple events

These signal all other events that do not involve a status, for example, thefailure of a system component.

The OPC specification defines the syntax of the interface for receiving messages.Which types of event a server provides is specified by the vendor of the OPCserver.

5.5.2 What Does the Class Model of OPC Alarms & Events Provide?

The class model of Alarms & Events allows the adaptation of the OPC client to therequirements of an automation solution. Alarms & Events distinguishes betweenthree classes:

� OPC Event Server

� OPC Event Subscription

� OPC Event Area Browser

Figure 5-10 Class Model of the Alarms & Events Interface

Note

The OPC Event Area Browser class is optional and is not supported by the OPCAlarms & Event server of SIMATIC NET.

Page 212: Industrial Communication With PG-PC

Basics of the OPC Interface

212SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.5.3 OPC Event Server Class

The highest class is the OPC Event Server class. Each OPC Alarms & Eventsserver belongs to this class. This class represents the access point for all furtherservices of the OPC Alarms & Events server.

The objects in the OPC Event server class mainly manage the registration of theclients for receiving events. They also provide information about the supportedevent categories and the attributes that can be delivered with an event.

A client application addresses the objects of the OPC Event server class usingCOM mechanisms and can receive the events provided by the event server.

5.5.4 OPC Event Subscription Class

Using objects of the OPC Event Server class, a client creates one or more objectsof the OPC Event Subscription class. An object of this class represents asubscription to a set of events. Objects of this class manage the filters andattributes required for a specific client. By filtering, a client can specify the events itwants to receive. The SelectReturnedAttributes method allows the user to specifywhich event attributes are transferred with each event message. Using the objectsof the OPC Event Subscription class, the client can form useful groups andexecute group operations.

5.5.5 OPC Event Area Browser Class

With Alarms & Events, you can divide extensive plants into areas. Areas can beused to filter events. The use of objects of the OPC Event Area Browser classallows the plant areas to be investigated.

Note

Objects of the OPC Event Area Browser class are optional and are not supportedby the OPC Alarms & Event server of SIMATIC NET.

Page 213: Industrial Communication With PG-PC

Basics of the OPC Interface

213SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.5.6 How are Messages Received?

An application registers itself for receiving messages in four steps:

Figure 5-11 Connection between Server and Client for Receiving Messages

5.5.7 Which Interfaces are Specified for Alarms & Events?

The Automation and Custom Interfaces are specified for Alarms & Events:

� Alarm & Events Automation Interface, Standard, December 15, 1999,Version 1.01

Description of the OPC Alarms & Events Server as well as the specification of the custom interface of this server.

� OPC Alarms & Events Custom Interface, June 2, 1999, Version 1.01

Specification of the automation interface of the OPC Alarms & Events Server.

Page 214: Industrial Communication With PG-PC

Basics of the OPC Interface

214SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.6 OPC XML Interface

Note

The OPC XML interface is available in the SIMATIC NET Software from Version6.1 onwards.

Internet Access for OPC

OPC-XML is a standard that allows communication with cross-platform protocolsover the Internet. A client is no longer restrcted to a Windows environment (COM).Other operating systems such as LINUX can monitor and exchange OPC data withthe HTTP protocol and the SOAP interface.

Data access with OPC XML has a range of functions based on OPC Data Access,however there are only simple write and read services available. Change-drivenmessages about data changes such as in DCOM OPC DA interfaces are notintended for OPC XML due to the loose Internet connection.

One possible disadvantage of this interface is that it requires an Internet server.Only low performance over the Internet can be expected.

Page 215: Industrial Communication With PG-PC

Basics of the OPC Interface

215SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Interfaces of the SIMATIC NET OPC Server

The following graphic shows the internal structure of the SIMATIC NET OPCServer and the available interfaces:

Page 216: Industrial Communication With PG-PC

Basics of the OPC Interface

216SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.6.1 Web Service OPC XML

Web Service of the Internet Information Server

The OPC XML specification is implemented in SIMATIC NET by a Web service ofthe Microsoft Internet Information Server (IIS). Remember that the InternetInformation Server is a component of the operating system that must be installedand configured separately.

The OPC XML component is largely transparent to the user. It is startedautomatically by the IIS when a Web client requests the relevant OPC-XMLservices. The graphic below illustrates the relationships:

5.6.2 Simple Read / Write Services

Available Methods

The following methods are implemented on the SIMATIC NET OPC XML server:

GetStatus

With GetStatus, the general status and vendor-specific information (version,product name) can be queried.

Read

With the Read service, the value of one (ore more) variables can be read.

Write

The Write service writes one (or more) variables. As an option, the OPC-XMLserver must then execute the Read method and integrate the values obtained inthe write job.

Page 217: Industrial Communication With PG-PC

Basics of the OPC Interface

217SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Subscription, SubscriptionPolledRefresh, SubscriptionCancel

With subscriptions, the variables are registered and any changes read (cyclically)with the SubscriptionPolledRefresh. A subscription can be canceled withSubscriptionCancel.

One special feature of SubscriptionPolledRefresh is the time window that isspecified with WaitTime and HoldTime. The call on the server is held until theWaitTime. The response to the call is then returned as soon as a value change isdetected or at the latest when HoldTime is reached.

Browse

The Browse service allows navigation through the hierarchical address space. Incontrast to the COM interface, a request can be used to read both branches andleaves.

It is also possible to specify which properties of an element the server shouldreturn.

GetProperties

As an alternative to Browse, properties of elements can also be read with theGetProperties service.

Synchronous / Asynchronous Use of the Methods

According to the OPC-XML DA specification, these methods are asynchronous.The request and response are separate parts of the protocol. The use of thesemethods by higher programming languages such as C# or Visual Basic etc. allowsthe request and response to be put together to form a synchronous method.

When creating a proxy class for the client program, a synchronous and anasynchronous variant are generated for each method. Both variants use the sameOPC-XML DA methods. The use of the asynchronous variant does, however, havebeneficial effects on the runtime response of the client program.

For more detailed information, refer to the following book, Chapter 9,Asynchronous Programming:

Professional ASP.NET Web ServicesWROX Press LtdISBN 1-861005-45-8

Page 218: Industrial Communication With PG-PC

Basics of the OPC Interface

218SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.7 OPC in SIMATIC NET

The open OPC interface is the central interface of the products on the PG/PC ofSIMATIC NET. The OPC Server of SIMATIC NET supports all communicationprotocols and services provided by the communication modules.

The OPC Server of SIMATIC NET supports the OPC Data Access interfacespecification for all protocols. For protocols with mechanisms for signaling events(S7 communication), OPC Alarms & Events is also supported.

In the following sections, you will see how the OPC Server of SIMATIC NET isused, the advantages of using the server, and its characteristics. You will also learnways of optimizing access to process data with the OPC server.

5.7.1 What Does the OPC Server of SIMATIC NET Provide?

The OPC Server of SIMATIC NET allows access to the industrial communicationsnetworks PROFIBUS and Industrial Ethernet of SIMATIC NET. It provides OPCclients with the values of process variables or signals events from the partnerdevice. It accesses the partner devices using the protocol software and thecommunications processor of SIMATIC NET over the communications network(see figure).

Figure 5-12 OPC Server for SIMATIC NET with OPC Client

Page 219: Industrial Communication With PG-PC

Basics of the OPC Interface

219SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Special Features

Since the OPC server is capable of distributing jobs to various communicationssystems, the OPC client can use several different protocols at the same time via asingle OPC server. If only one protocol is used in the configuration of the OPCserver, no distribution is necessary. This optimizes the data throughput.

Restrictions

The OPC Server of SIMATIC NET supports all the interfaces required by thespecification for OPC Data Access and OPC Alarms & Events. It also provides themost important optional interfaces such as the Browsing Interface for OPC DataAccess.

The following restrictions apply to the optional interfaces:

� The OPC Server for Data Access does not support “OPC Public Groups”.

� OPC Server for Alarms & Events

– No signaling of condition-related events

– Acknowledgment of events is not necessary

– Division of plants into areas is not possible

– Browsing areas is not possible.

The type of message and the content of messages is not specified by the OPCSpecification. The SIMATIC NET OPC Alarms & Events Server does not have anyconfiguration information for alarm or event handling in an operator control andmonitoring system. In this version, the OPC server only delivers simple events.

Page 220: Industrial Communication With PG-PC

Basics of the OPC Interface

220SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.7.2 How is the OPC Server of SIMATIC NET Used in the World ofAutomation?

The schematic shows how the OPC Server of SIMATIC NET is used. At the top,you can see a selection of possible clients that can access the OPC server.

The bottom half shows the communications networks with possiblecommunications partners.

Figure 5-13 The Role of the OPC Server in the World of Automation

Page 221: Industrial Communication With PG-PC

Basics of the OPC Interface

221SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.7.3 What are the Advantages of the OPC Server for SIMATIC NET?

With the numerous benefits of OPC, SIMATIC NET offers a series of generaladvantages and advantages in the programming and development of individualclients. Commissioning personnel has, however, not been left out.

Advantages for Commissioning

� You use an interface that is not protocol-specific; in other words, only oneinterface needs to be installed for several applications.

� You have simple access to the communications networks of SIMATIC NET.

� You can use your programmable controllers with numerous applications fromautomation engineering over the communications network of SIMATIC NET.

� You can integrate Microsoft Office products.

� Using DCOM, applications installed on other computers can access theservices of the OPC server over global or local area networks.

� The OPC client application “OPC Scout” of SIMATIC NET provides you with apowerful tool for simple access to process variables.

� With the aid of SIMATIC Computing, you can, for example, create simpleutilities in Visual Basic.

Advantages for Program Development

� You operate with a multi-vendor interface. This means the future of yourinvestment is safe. You can service a wider market and can reuse yourdevelopments.

� The applications you develop are not dependent on the communications systemof one vendor and can communicate unchanged with OPC servers from othervendors.

� The OPC interfaces provide applications with efficient access to OPC serversand the underlying communications networks.

� OPC has high-performance interfaces for the C and C++ programminglanguages.

� Convenient and simple access to process data is possible with developmentenvironments such as Visual Basic via the Data Control.

� You do not need to familiarize yourself with protocol– and vendor-specificinterfaces.

� The option of a trace output simplifies debugging and troubleshooting.

� Since a partner device can be simulated, a program can be developed withoutinstalling additional devices.

Page 222: Industrial Communication With PG-PC

Basics of the OPC Interface

222SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.7.4 What is the Best Way to Access Process Data?

With OPC Data Access, you can access various types of process data. Byselecting suitable methods, you can influence the data throughput of yourapplication.

With some protocols, you can also influence the performance of the OPC server byselecting a service and by structuring the variables in the name space.

Tips for Optimum Data Throughput

The following tips will help you to achieve the highest possible data throughput:

� Use group operations

� Access the OPC cache

� Structure items

� Use buffer send/receive services

Use Suitable Methods

There are various ways of accessing variables. Since they have differentproperties, you should note the advantages and disadvantages described belowand select the most suitable type of access for your situation.

� Use suitable OPC methods

5.7.5 Using Group Operations

With many methods, you can transfer multiple process variables as parameters inone array using one function call. The use of group operations improves the datathroughput since there are fewer function calls and process changes between theOPC client and OPC server. The OPC server can then optimize communicationover the network itself, for example by putting single jobs together.

If you work with a remote server using DCOM, the use of group operations isparticularly effective since in this case, a function call is transported over thenetwork.

Note

The OPC server also uses group operations when transferring change messagesto the client.

Page 223: Industrial Communication With PG-PC

Basics of the OPC Interface

223SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.7.6 Examples of Group Operations

Here, you can see examples of group operations on the OPC Custom interface:

IOPCItemMgt::AddItems (NumItems, pItems, ppResults, ppError)

Items defined in the pItemArray array are included in a group.

Note

Calling AddItems is faster if the group is not active. Activate the group only afteryou have added all the OPC items.

IOPCSyncIO::Read (Source, NumItems, pServerhandle, ppResults, ppError)

The value, time stamp, and quality of several OPC items defined by an array withserver handles are read synchronously.

IOPCSyncIO::Write (NumItems, pServerhandle, pItemValues, ppError)

Values are written synchronously to several OPC items defined by an array withserver handles. The values are transferred in an array.

Page 224: Industrial Communication With PG-PC

Basics of the OPC Interface

224SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.7.7 Accessing the OPC Cache

The OPC cache is an internal interim buffer of the OPC server in which the lastvalues of the OPC items to be acquired are entered. The OPC server updates allactive items inserted in active groups. The values in the cache are valid assumingthat the item was read successfully.

Reading a variable from the cache is significantly faster than access over thenetwork. If the values in the cache are updated at an interval that is short enoughfor the particular application, it is advisable to access the cache.

The update rate in the cache is specified by the UpdateRate parameter.

Note

Remember that a very high update rate (short interval) puts more load on theprocessor of the computer and the communications system.

5.7.8 Examples of Services that Can Use the Cache

Here, you can see examples of services that can make use of the cache:

IOPCSyncIO::Read(...,OPC_DS_CACHE,...)

The value, time stamp , and quality of several OPC items are read synchronouslyfrom the cache.

IOPCAsyncIO2::Refresh(...,OPC_DS_CACHE,...)

Regardless of the value, a callback is generated for all active OPC items. The valuecurrently stored in the cache is sent to the client.

Page 225: Industrial Communication With PG-PC

Basics of the OPC Interface

225SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

5.7.9 Structuring Items

The OPC Server for SIMATIC NET provides an optimization algorithm for thevariable services of the following protocols:

� S7 protocol

� S5-compatible communication over Industrial Ethernet

Several simultaneous jobs to access individual variables are converted internally toa single access to an array on the partner device. This reduces the number of datapackets transported over the network, improves the utilization of the packets, andincreases the payload of a packet.

This optimization is used for both read and write access and is activated as thedefault setting. For the OPC client this optimization algorithm is invisible.

Rules for Arranging the OPC Items in the Name Space

The optimization is only possible if you keep to the following rules for thearrangement of the OPC items in the name space:

� OPC items that are read or monitored simultaneously should be arrangedconsecutively in the name space of the partner device.Small gaps between the relevant sections are processed but make for a poorerdata throughput.

� OPC items that are written simultaneously must be arranged consecutively inthe name space.For optimum write access, there must be no gaps. The array formed during theoptimization is always transferred in its entirety to the partner device. Theaddress area of any gaps would be overwritten by undefined values. To avoidthis, the OPC server then sends individual access jobs without anyoptimization.

Note

If your OPC client does not need to use individual OPC items for processvariables, you can use arrays directly for accessing the relevant data and assignthe elements of the arrays read to individual process variables.

Page 226: Industrial Communication With PG-PC

Basics of the OPC Interface

226SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.7.10 Example of Structuring Items

Organization of a Data Block for Read Access

DB10,W10

DB10,B12

DB10,B13

DB10,DW14

DB10,W20

This is executed as a read access to DB10,B10,12 via the communicationssystem.

Despite the gap at byte 18 and byte 19, this is converted to a read job. The dataread unnecessarily is discarded. Instead of five single variable requests, only onerequest is transported over the network.

Organization of a Data Block for Write Access

DB10,W10

DB10,B12

DB10,B13

DB10,DW14

DB10,W20

This is executed via the communication system as two writes to the DB10,B10,8array and the individual variable DB10,W20.

5.7.11 Using Buffer Send/Receive Services

For the transfer of large data packets, S7 communication and S5-compatiblecommunication over Industrial Ethernet provide buffer send/receive services. Datapackets are sent between communications partners. The transfer of the data putsload on the network only when a partner explicitly initiates a send job.

Using the OPC Server for SIMATIC NET, you can structure blocks of data. Thisallows individual parts of a data packet to be assigned to OPC items.

Page 227: Industrial Communication With PG-PC

Basics of the OPC Interface

227SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

The S7 buffer send/receive services are currently available only for devices of theS7-400 and M7 series and PC stations. The S5 buffer send/receive services areavailable for practically all devices of the S5 and S7 series and PC stations. Notethe information on the communication partner relating to future support of thebuffer-oriented services in the readme file in the main folder of the SIMATIC NETSoftware Product CD.

Page 228: Industrial Communication With PG-PC

Basics of the OPC Interface

228SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

5.7.12 Example of Using Buffer Send/Receive Services

The following schematic illustrates how an S7-400 sends a data packet to a PCstation with the S7 OPC Server.

Figure 5-14 Sending a Data Packet

To allow the OPC server to receive data, one or more OPC items of the typeRECEIVE or BRCV are added to an active group on the PC.

On the S7-400, a user program starts the BSEND function block. BSEND startsthe transfer of the entire data area as a buffer to the PC.

On the PC, the received data is transferred to the OPC server. The OPC servernow maps the subareas of the block of data to the corresponding OPC items. Ifthese OPC items are monitored, the OPC server sends a callback to the OPCclient if the values change.

5.7.13 Using Suitable OPC Methods

For OPC Data Access, there are three ways of accessing data:

Synchronous Read or Write

Both reads and writes can be synchronous.

A program sends a synchronous function call to access process data. When thefunction is executed, the OPC server handles all the communication over thenetwork. The read values are transferred to the user program with the returnparameters of the function and the application can now continue to execute thenext instructions.

Page 229: Industrial Communication With PG-PC

Basics of the OPC Interface

229SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Applications of Synchronous Access

You should always use synchronous access when a longer interruption in the userprogram is acceptable, for example when using worker threads. Synchronousaccess is the fastest possible access to data on the partner device.

Note

The data throughput with synchronous jobs does not depend on the UpdateRateparameter and the cycle time specified in the configuration.

Advantages and Disadvantages of Synchronous Access

Advantages

� Simple programming

� High data throughput, since there is only one process change per job betweenthe OPC client and OPC server.

Disadvantage:

� The application is interrupted until the synchronous job has been completed.The application can only continue when all the data has been read. If thefunction is not called in a separate thread, the user interface, for example, of aninteractive application is blocked during the function call.

Asynchronous Read or Write

It is possible to read or write asynchronously.

A program sends an asynchronous function call to access process data. Thefunction returns to the program immediately indicating whether the job was sentsuccessfully to the OPC server. The program can then continue to run.

The OPC server assigns a TransactionID to the job with which the client can lateridentify the response to the job.

At a later, undefined point in time, the OPC server calls the AsyncReadCompleteor AsyncWriteComplete function of the OPC client. The results of the previousfunction call (read or write) and the TransactionID are sent to the client as callparameters.

The program execution of the OPC client in no way influences the time at whichthe data are sent over the network.

Page 230: Industrial Communication With PG-PC

Basics of the OPC Interface

230SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Applications for Asynchronous Access

Asynchronous access is useful when large amounts of data need to be read andwhen the application needs to be capable of reacting while the job is executed.

Asynchronous access to the cache of the OPC server serves no practical purpose.There is high processor utilization simply as a result of process changeoversbetween the OPC client and OPC server.

Note

The data throughput with asynchronous jobs does not depend on the UpdateRateparameter and the cycle time specified in the configuration.

Advantages and Disadvantages of Asynchronous Access

Advantages

The local application is interrupted only for a short time since the actualcommunication runs parallel to the application.

Disadvantages

� Writing the application is somewhat more complicated. A callback mechanismmust be implemented in the application that can receive the result of theprocessed job at any time.Standard Windows programs have asynchronous mechanisms to allow them toreact to user input.

� When transferring only a few variables in a job, there is a large load caused bythe process changes with the call and callback. There are twice as many as insynchronous access.

Monitoring Variables

When monitoring variables, the OPC server checks continuously whether the valueor the quality of variables has changed.

The OPC client therefore adds active OPC items to a group and activates thegroup. All the active OPC items in all active groups are then monitored.

The OPC client provides the DataChange function. The OPC server calls thisfunction when the values have changed. As the parameters of DataChange, theOPC server transfers the changed values, qualities and time stamp of the OPCitems.

The OPC client is put under no extra load by monitoring variables. The program ofthe client is executed only when a change is detected.

To make sure that the OPC client is not completely overloaded with messages ifprocess variables change very quickly, you can use the group-specific parameterUpdateRate to specify the minimum interval at which the client is called.

Page 231: Industrial Communication With PG-PC

Basics of the OPC Interface

231SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Analog values affected by noise would lead to flurries of change messages sincethe value changes slightly all the time. Noise can also be filtered out by using thegroup-specific parameter PercentDeadBand. Using this parameter, only signalchanges greater than a specific percentage of the value range of the variable aresignaled.

This is only possible when the range of values of the variables is defined in theSymbol File Configurator.

Applications of Variable Monitoring

Monitoring variables is an ideal solution when a program constantly requires thelatest data of the process or part of the process.

Note

The data throughput is decided by the UpdateRate parameter of the group and thecycle time specified in the configuration. The cycle time determines the smallestpossible update interval. The update rate should be specified in multiples of thecycle time.

Advantages and Disadvantages of Monitoring Variables

Advantages

� The application is only notified when the process data has changed.

� High data throughput since there are few process changes. Depending on theway in which the items are structured, good optimization is possible.

� Monitoring of variables can be activated and deactivated item-oriented andgroup-oriented by the client.

Disadvantages

� The reaction time from the change in a value in the process to the transfer ofthe new value to the client is greater than the update rate of the group.

� Writing the application is somewhat more complicated. The application requiresan asynchronous section for receiving changed values.

Standard Windows programs have asynchronous mechanisms to allow them toreact to user input.

Page 232: Industrial Communication With PG-PC

Basics of the OPC Interface

232SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Relationship between Cycle Time and Update Rate

The “UpdateRate” parameter that can be set in the user program specifies theshortest possible interval for checking the values of the OPC items of an activeOPC group. When this interval elapses, the server checks whether or not thevalues of the active OPC items have changed.

The update rates used by the OPC Server for SIMATIC NET are multiples of thecycle time specified here during configuration. The maximum update rate (shortestinterval) is the same as the cycle time.

Relationship between the Set Protocol-specific Cycle Times

Since the SIMATIC NET OPC Server can use variables of different protocols at thesame time, the maximum update rate of the OPC server is the highest value setfor the scan cycle time for the active protocols (those for which connections areconfigured).

Page 233: Industrial Communication With PG-PC

233SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

OPC Process Variables for SIMATIC NET

This chapter explains the syntax of the names of the process variables. The syntaxof the names of the process variables on the OPC interface specifies whichprocess variables are addressed. You specify the variable names when youprogram or configure an OPC client.

6.1 Which Communication Functions Exist?

The OPC server provides standardized access to the SIMATIC NET industrialcommunications networks via Data Access.

The SIMATIC NET OPC Server supports the interfacing of applications with anyautomation components networked over PROFIBUS or Industrial Ethernet. Itprovides the following communication functions:

� S7 communication

� S5-compatible communication

� PROFIBUS-DP

� PROFIBUS-FMS

Further communication functions are in development.

The communication functions are specially optimized for the various requirements.Several communication functions can be supported at the same time by the OPCserver.

6

Page 234: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

234SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.2 What Are Process Variables?

A process variable is a writable and/or readable data item of the process I/O suchas the temperature of a tank used as the input value of a programmable controller.

Process variables are represented in the OPC class model by the class OPC item.Only elements of this class represent a real value from the process in OPC.

ItemIDs

The ItemID is a string that identifies the process variable uniquely. It tells theserver which process variable is assigned to the OPC item. The process variablecan then be accessed via the OPC item.

The OPC Server of SIMATIC NET maps the various communication services ofthe protocols using OPC items by using parts of the ItemID as parameters forcalling the communication function.

Page 235: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

235SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.3 How Are the ItemIDs of the Process Variables Formed?

Process variables are identified on the OPC interface by a unique name, theItemID. The ItemID is made up as follows:

Syntax

<protocolID>:[<connectionname>]<variablename>

Explanations

<protocolID>

Specifies the protocol for access to the process variable.

The following protocol IDs exist:

DP DP protocol including DP master, DP slave, and DPC1S7 S7 functions over PROFIBUS and EthernetFMS FMS protocol over PROFIBUSSEND/RECEIVE

S5-compatible communication over Industrial Ethernet

FDL S5-compatible communication over PROFIBUS

<connectionname>

The connection name identifies the connection or communication module viawhich the partner (for example PLC, other PC station or DP slave) can beaccessed. This is specified in STEP 7 / SIMATIC NCM PC when configuring thehardware.

The connection name specified depends on the protocol being used. Theconnection name must be unique within a protocol.

<variablename>

Variable to be addressed.

The variable name must be unique for the connection specified in the connectionname. The structure of the variable name depends on the selected protocol.

Note

As of version 6.0 of the OPC server, the syntax of the ItemIDs has been simplified.The previous syntax is, however, still supported. Programs and configurations withthe older ItemIDs can continue to be used unchanged.

The older syntax is, however, no longer displayed in OPC Browsing of the OPCserver. In future applications, use the new simplified syntax.

Page 236: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

236SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.4 PROFIBUS-DP

Process Variables for the DP Master

The OPC Server of SIMATIC NET for the DP master mode provides processvariables for the following services:

� Services for a Class 1 Master

Access and monitoring of DP inputs and outputs

� DPC1 Services

Acyclic transmission of blocks of data

� Fast Logic for the CP 5613 and CP 5614 (DP Master Only)

Automatic monitoring of slave data

� Diagnostic Variables

Evaluation of static diagnostic information

Process Variables for the DP Slave

The OPC Server of SIMATIC NET for the DP slave mode provides processvariables for the following services:

� Variable Services for Access to the Local Slave Data

Access to the inputs and outputs of the slave

� Diagnostic Variables

Evaluation of static diagnostic information of the slave

Note

Parallel operation of the DP master and DP slave with the CP 5614 module ispossible only when the DP Base mode was set during configuration with SIMATICNCM PC or STEP 7.

Page 237: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

237SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.1 Protocol ID

The protocol ID for the DP protocol is DP.

6.4.2 Connection Names

The connection name specifies the communication access by specifying thecommunications processor attached to the PROFIBUS network.

In the DP protocol, the connection name is the configured name of thecommunications module.

Examples of Connection Names

Typical connection names are:

CP 5613

CP 5614

CP 5611

6.4.3 SIMATIC NET Inproc-Server for the PROFIBUS-DP Protocol

Since the PROFIBUS DP protocol maintains an image of the input and output datain the communications processor of the computer, access to process data takesplace only within the local computer. Particularly when using the SIMATIC NET CP5613 over the “DP-Base” interface, this makes access extremely fast.

In some situations, for example, when using PC-based controllers, extremely fastaccess to process data is necessary.

Using OPC as COM-based client-server architecture does involve certain internalexecution times depending on the implementation of the OPC server. These resultin the main when using a local server (also known as an “out-process server”; anEXE file with its own process space) due to process changeovers and transferringthe function parameters from the client to the server (marshaling).

If the OPC server is implemented as an in-process server, the overheads forchanging processes and marshaling are avoided since the OPC server takes theform of a dynamic-link library (DLL) and runs in the process of the client.

Page 238: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

238SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Using an in-process server does, however, have disadvantages that cannot beignored when selecting the server:

� Only one client can use the server at any one time.

The simultaneous use of the in-process OPC server by several clients wouldmean generating the server more than once in different process spaces andwould result in simultaneous but uncoordinated access to the same hardware.As a result, only the client that starts first has access to the process data whileaccess by other clients would be denied.

� The stability of the OPC server depends on the client.

If the OPC client behaves in an uncontrolled manner and, for example causesaccess violations, the OPC server will also be affected. As a result, thecommunications module cannot be reset by the OPC server as may sometimesbe necessary. Explicit closing of the OPC server using the configurationprograms would also not be possible.

For the extremely fast DP protocol, SIMATIC NET offers an in-process server thatprovides practically the full the performance of the DP protocol for OPC clients.

When using the other connection-oriented protocols, the access time dependsprimarily on the propagation times in the network required by the communicationservices so that an in-process server is provided only for DP.

Calling the In-process Server for DP

The in-process server for DP is addressed using a separate ProgID. The ProgIDis:

OPC.SimaticNET.DP

The ProgID is specified in function calls or in the OPC clients to select a server.

Examples of Function Calls

Visual Basic:

ServerObj.Connect (“OPC.SimaticNET.DP”)

Visual C++:

r1 = CLSIDFromProgID(L“OPC.SimaticNET.DP”, &clsid);

r1 = CoCreateInstance (clsid, NULL, CLSCTX_INPROC_SERVER,IID_IOPCServer, (void**)&m_pIOPCServer);

Page 239: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

239SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.4 DPC1 and DPC2 Services

DP class 1 master

The DP class 1 master communicates cyclically with the DP slaves. With DPC1, a master operating cyclically can handle additional acyclic data trafficand react to interrupts from slaves.

Communication includes central functions such as:

� Configuring and assigning parameter values to the slaves

� Cyclic data transfer with the DP slaves

� Monitoring the DP slaves

� Providing diagnostic information

DP class 2 master

With DPC2, a DP class 2 master can establish additional communication relationswith the DP slaves. The DP slaves must support the DP-V1 additional functions.The most important DPC2 additional functions are as follows:

� Connection establishment

� Connection termination

� Reading data records

� Writing data records

� Transferring data

Slaves with DP-V1 Additional Functions

Slaves with DP-V1 additional functions can communicate with class 1 and class 2DP masters.

Page 240: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

240SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Overview of the DP Protocol

The following figure illustrates the parts of the DP or DP-V1 protocol.

6.4.5 Process Variables for Services of a Class 1 Master

With the services for accessing cyclic data, you can access and monitor the inputsand outputs of the slaves.

Access is via:

� Slave number.This number corresponds the PROFIBUS address.

� Submodule number.DP slaves can include several submodules with different input/output areas.

� Input/output area.

Page 241: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

241SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.6 Syntax of Process Variables for a Class 1 Master

Syntax

Inputs:

DP:[<connectionname>]slave<address>{M<number>}_I{<format><offset>{.<bit>}{,<quantity>}}

Outputs:

DP:[<connectionname>]slave<address>{M<number>}_Q{<format><offset>{.<bit>}{,<quantity>}}

Explanations

DP

DP protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

slave

Indicates that a DP slave is addressed.

<address>

PROFIBUS address of the slave.

Range 0 through 126

M

Identifier for the number of the submodule that contains the input or output area.

<number>

Number of the submodule containing the input or output area.

_I

Identifier for the input. Inputs are read only.

_Q

Identifier for the output. Outputs can be read and written.

<format>

Format of the delivered data.

Specifying the format specifies the data type.

Page 242: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

242SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

In principle, all listed OLE data types can be read via the Automation and Custominterface of OPC. However, certain development tools such as Visual Basic onlyoffer a restricted number of data types.

The following table therefore lists the corresponding Visual Basic type in which thevariable value can be represented.

Format Identifier

Description OLE Data Type Visual Ba-sic Type

X Bit VT_BOOL Boolean

BYTE or B Byte (unsigned 8)

VT_UI1 Byte

CHAR Character (signed 8)

VT_I1 Integer

WORD or W Word (unsigned16)

VT_UI2 Long

INT Integer(signed 16)

VT_I2 Integer

DWORD or D Double word (unsigned 32)

VT_UI4 Double

DINT Double integer (unsigned 32)

VT_I4 Long

REAL Floating-pointnumber(IEEE 4 bytes)

VT_R4 Single

<offset>

Byte offset in the address space of the slave at which the element to be addressedis located. If a submodule is specified, the offset applies within the submodule. Ifno submodule is specified, the offset relates to the entire input/output area of theslave.

<bit>

Bit number in the addressed byte.

Specifying a bit is permitted only with the X format identifier, the range is between0 and 7.

<quantity>

Number of elements.

The data type (VT_ARRAY) of the variable is an array with elements of thespecified format. If quantity is omitted, the quantity 1 is assumed and the data typeof the variable is not an array.

Do not use the quantity parameter with the X format identifier.

Page 243: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

243SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

If no submodule is specified, the variable returns the entire input or output areaover all submodules. Structured access by specifying the format and quantity isalso possible.

6.4.7 Examples of Process Variables for a Class 1 Master

Here you will find examples illustrating the syntax of variable names for DPvariables.

Inputs

DP:[CP 5613]Slave005M003_IB0

Slave005M003_IB0

Input byte 0 of submodule 3 of slave 5.

DP:[CP 5613]Slave005M003_IB1,3

Slave005M003_IB1,3

Array with 3 bytes from input byte 1 of submodule 3 of slave 5.

DP:[CP 5613]Slave005M003_ID2

Slave005M003_ID2

Double word from input byte 2 of submodule 3 of slave 5

DP:[CP 5613]Slave004M003_IReal0

Slave004M003_IReal0

Floating point number in the input area of slave 4, submodule 3.

DP:[CP 5613]Slave004_IB0,8

Slave004_IB0,8

The first 8 bytes of the entire input area of slave 4 over all submodules.

Outputs

DP:[CP 5613]Slave005M007_QB1

Slave005M007_QB1

Output byte 1 of submodule 7

Page 244: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

244SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

DP:[CP 5613]Slave005M007_QX2.5

Slave005M007_QX2.5

Bit 5 in output byte 2 of slave 5, submodule 7

DP:[CP 5613]Slave004_QW0,8

Slave004_QW0,8

Array with 8 words from the output area of slave 4 over all submodules.

6.4.8 DPC1 Services

Using DPC1 services, you can access the data records of the DPC1 slaves. Thedata records are transferred acyclically.

The meaning of the data records is specified by the vendor of the slave. Theycould, for example, be used for the configuration data of a drive.

When a DPC1 variable is registered, the OPC server can only check that thesyntax is correct and not whether the variable is valid on the partner device and thesize of the data record is adequate based on the configuration of the DPC1 slave.

6.4.9 Syntax of the Process Variables for DPC1 Services

Syntax

DP:[<connectionname>]slave<address>S<slot>data<index>,<length>{,<subarea>}

Explanations

DP

DP protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

slave

Identifier for access to a slave over the DP protocol.

Page 245: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

245SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

address

PROFIBUS address of the slave.

Range 0 through 126

S

Identifier for the slot of the slave, typically a submodule.

<slot>

Slot in the extended memory area of a slave for acyclic services. The slot and indexidentify a data record.

data

Identifier for access to a data record.

<index>

Index within a slot in the extended memory area of a slave for acyclic services. Theslot and index identify a data record.

<length>

Length of the record. Range between 1 and 244.

<subarea>

The subarea is made up as follows:

formatoffset{.bit}{,quantity}

format

Format in which the data is delivered.

If no format is specified, the byte format is used.

Format Identifier

Description OLE DataType

Visual BasicType

X Bit VT_BOOL Boolean

BYTE or B Byte (unsigned 8)

VT_UI1 Byte

CHAR Character (signed 8)

VT_I1 Integer

WORD or W Word (unsigned16)

VT_UI2 Long

INT Integer(signed 16)

VT_I2 Integer

DWORD or D Double word(unsigned 32)

VT_UI4 Double

Page 246: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

246SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Format Identifier

Visual BasicType

OLE DataType

Description

DINT Double integer (unsigned 32)

VT_I4 Long

REAL Floating pointnumber

VT_R4 Single

offset

Byte address in the data record for the element to be addressed.

bit

Bit number in the addressed byte.

A bit can only be specified with the format identifier X .

quantity

Number of elements (not permitted with X format)

The data type VT_ARRAY of the variable is an array with elements of the specifiedformat. If this part of the name is omitted, the quantity 1 is assumed and the datatype of the variable is not an array.

Note

The data length resulting from the parameters quantity and format must notexceed the size of the data record on the slave. The size of a data record dependson the particular slave and cannot be checked by the OPC server.

Note

If you define subareas, remember the following point: If you read a data record,the partner device initially always reads the entire data record. The subarea is onlyevaluated afterwards.

When writing, the entire data record is also sent to the partner device. If severalsubareas are written using a group call, all the subareas are first entered in thedata record before the data record is sent.You should therefore put all OPC items with part access to a data record into onegroup and write the entire group.When writing, avoid overlaps and gaps since it is not possible to predict whichvalue is written.

Page 247: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

247SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.10 Examples of Process Variables for DPC1 Services

Here you will find examples illustrating the syntax of variable names for DPC1services.

Variable Names for DPC1DP:[CP 5613]Slave005S003Data2,120,DWORD7

Slave005S003Data2,120,DWORD7

Access to the double word from offset 7 in a data record with a length of 120 bytesin slot 3, index 2 of slave 5.

DP:[CP 5613]Slave005S003Data2,120,B8,4

Slave005S003Data2,120,B8,4

Access to an array with 4 bytes from offset 8 in a data record with a length of 120bytes in slot 3, index 2 of slave 5.

6.4.11 Fast Logic for the CP 5613 and CP 5614 (Master Only)

The CP 5613 and DP master section of the CP 5614 have the Fast Logic property.This means that you can set the CP parameters so that it writes values to otherslaves as a reaction to the data change of a slave. The user application is alsoinformed of the data change.

The CP 5613/5614 provides four Fast Logic triggers that can be configured andevaluated using the OPC control variables.

Advantages of Fast Logic

Using Fast Logic has the following advantages:

� There is less load on the OPC server and OPC client.

� The data transmission is faster because it is not dependent on the softwarerunning on the CP and takes place in the hardware of the CP.

� Since the data transmission is not dependent on the PC software, a fastreaction to a change in an input signal is guaranteed.

Note

The Fast Logic property can only be used when the DP Base mode was set for theCP 5613 or CP 5614 during configuration.

Page 248: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

248SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

After a fast logic trigger has been triggered, it is automatically deactivated againafterwards. You must then activate the trigger again using the FLActivate variable.

Fast logic functions correctly only when the DP master is in the OPERATE modeand the slaves involved are in the READY state. A fast logic trigger shouldtherefore only be activated by the DP application when the user program hasbrought the DP master to the OPERATE mode.

As long as fast logic triggers are active, no DP user program may write to theoutput bytes linked to input bytes with fast logic .

6.4.12 Syntax of the control variables for Fast Logic

Syntax

DP:[<connectionname>]FL<parameter><N>

Explanations

DP

DP protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

FL

Identifier for Fast Logic.

Page 249: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

249SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

<parameter>

Possible values are as follows:

� State

Returns the Fast Logic status.

Return values:

� CLEARED

Trigger N is not activated.

� ACTIVATED

Trigger N is activated.

� TRIGGERED

Trigger N has executed monitoring.

OLE Data Type Visual Basic Type

VT_BSTR String

Activate

Activate can only be written.

Writing a parameter field specifies the Fast Logic property for the trigger specifiedin the ItemID.

The parameter field that is written is an array with 8 bytes and has the followingstructure:

slave_addr_in_byte

Address of the slave whose inputs are selected for the trigger

index_in_byte

Offset of the input byte of the trigger

cmp_value_in_byte

Comparison value for the input byte

mask_in_byte

You can mask individual bits in the input byte so that they are ignored in thecomparison. A bit is masked by setting the value 1; this means that ifmask_in_byte==0x00 is set, all bits of cmp_value_in_byte are used for thecomparison. The trigger is triggered when all unmasked bits in the selectedinput byte match the bits in cmp_value_in_byte.

Page 250: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

250SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

slave_addr_out_byte

Selects the slave whose output byte will be changed when the trigger conditionoccurs

index_out_byte

Offset of the output byte

value_out_byte

Value of the output byte that will be written

mask_out_byte

Bits in the output byte can be masked individually so that they are not modifiedwhen the trigger condition arrives. A bit is masked by setting the value 1 ; thismeans that if mask_out_byte==0x00 is set, all bits of value_out_byte are writtento the selected output byte.

OLE Data Type Visual Basic Type

VT_ARRAY of VT_UI1 Byte()

Clear

Clear can only be written.

If the Boolean value TRUE is written, the Fast Logic trigger specified in the ItemIDis deactivated.

OLE Data Type Visual Basic Type

VT_BOOL Boolean

<N>

Number of the Fast Logic trigger being used. Value between 1 and 4.

6.4.13 DP-Specific Information Variables

The DP-specific information variables for the class 1 master are used to queryinformation on the DP master and the attached DP slaves.

You can query the following information:

� Mode of the DP master

� Event messages of the DP master

� Sign of life monitoring of the CP

� Mode of a DP slave

� The type of a DP slave

� Other information for more detailed diagnostics

Page 251: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

251SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.14 Syntax of the DP-specific Information Variables

Syntax

DP:[<connectionname>]<informationparameter>

Explanations

DP

DP protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<informationparameter>

Possible values are as follows:

� Masterstate

� EvAutoclear

� EvWatchdog

� EvClass2Master

� WatchdogTimeout

� SlavenSlvState

� SlavenSlvDiag

� SlavenMiscSlvType

� Other slave information

Masterstate

Current mode of the DP master.

The current mode can be both written and read. Setting the mode by writing one ofthe values shown below is only possible within the context of the DP applicationenvironment.

Input and return values::

OFFLINE

No communication between master and slave.

STOP

No communication between master and slave except for diagnostic data

CLEAR

Page 252: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

252SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Parameter assignment and configuration phase

AUTOCLEAR

Autoclear phase, the DP master can no longer access all slaves

OPERATE

Productive phase

OLE Data Type Visual Basic Type

VT_BSTR String

EvAutoclear

Signals an error during communication with DP slaves. The DP systemautomatically closes down and changes to the CLEAR mode.

Return values:

True

An error has occurred in communication with DP slaves and the system has closeddown and changed to the CLEAR mode

False

No error occurred

OLE Data Type Visual Basic Type

VT_BOOL Boolean

Note

You can only use EvAutoclear if AUTOCLEAR was set during configuration.

Note

If this information parameter is output, no reaction is necessary.

EvWatchdog

Signals that job monitoring timed out on the module. The OPC server has notmade a DP function call during the monitoring time. The OPC client or OPC servermay no longer be available.

You set this monitoring time in the configuration.

Page 253: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

253SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Return values:

� True

Monitoring timed out on the module

� False

Monitoring did not time out on the module

OLE Data Type Visual Basic Type

VT_BOOL Boolean

EvClass2Master

Signals access by a class 2 DP master.

Return values:

True

A class 2 DP master is participating in data traffic and accessing internal diagnosticlists of the class 1 DP master

False

No class 2 DP master is involved

OLE Data Type Visual Basic Type

VT_BOOL Boolean

Note

No reaction to the event by the user program is required.

WatchdogTimeout

Watchdog on the CP. If a value is written, the watchdog can be set. The defaultvalue is set in the configuration.

Return values:

� 0

Monitoring off

� 400 – 102000

Any value in ms. The value is rounded to a multiple of 400

� 6000

Default

Page 254: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

254SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OLE Data Type Visual Basic Type

VT_UI4 Double

SlavenSlvState

Current status of the DP slaves with address n.

Return values:

� OFFLINE

No communication between master and slave

� NOT_ACTIVE

DP slave is not activated

� READY

DP slave is in the data transfer phase

� READY_DIAG

DP slave is in the data transfer phase; diagnostic data also exist

� NOT_READY

DP slave is not in the data transfer phase

� NOT_READY_DIAG

DP slave is not in the data transfer phase; diagnostic data also exist

OLE Data Type Visual Basic Type

VT_BSTR String

Page 255: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

255SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

SlavenSlvDiag

Last diagnostic data of the DP slave with address n. The structure of the diagnosticdata is slave-specific and can be found in the documentation of the slave.

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Byte()

SlavenMiscSlvType

Type of the DP slave with address n.

Return values:

� NO_SLV

No DP slave

� NORM

Standard DP slave

� ET200_U

Non-standard slave: ET 200 U

� ET200K_B

Non-standard slave: ET 200 K/B

� ET200_SPM

Non-standard slave: General SPM station

� UNDEFINED

Unknown DP slave

OLE Data Type Visual Basic Type

VT_BSTR String

Other slave information

The following slave-specific information parameters are not intended for productivecommunication. If problems occur, it may, nevertheless, be useful to evaluate thevariables listed below.

All variables are generally assigned directly to low level DP services. Thesevariables are read in the same way as other information variables. The result of thecall is the byte dump of the particular low level DP service.

SlavenMiscReadSlvParCfgData

Configuration data of the slave at address n for describing the input and outputdata areas and the data consistency

SlavenMiscReadSlvParUserData

Application data of slave n (part of the parameter file)

Page 256: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

256SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

SlavenMiscReadSlvParPrmData

Parameter assignment data of slave n

SlavenMiscReadSlvParType

SI flag and type of slave n (slave-related flags, slave type and other reserveddata)

SlavenMiscSlvDiag

Diagnostic data of slave n

6.4.15 PROFIDrive

Introduction

The following section describes the variables of the SIMATIC NET PROFIDrivebus server. This server is used to link devices using the DP protocol.

6.4.16 Protocol ID

To comply with the profile server specification, all items begin with the prefix DP2://

Note

In contrast to the other protocols, no square brackets are used with PROFIDrive.

The item ID for PROFIDrive is made up as follows:

DP2://<Devicename>/<Variablename>

6.4.17 Device Name

The board number specifies the slot of the board in the in the Station ConfigurationEditor of the PC station (virtual slot). The board number is configured withSIMATIC NCM.

Page 257: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

257SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

SyntaxDP2://brd<n>.seg<s>/&lifelist()

Explanation

brd

Identifier indicating that a board will be addressed.

n

Number of the configured board. The board number is configured with SIMATIC NCM. The configured board number is made available by the Configuration Server usingthe CP name. Range: 1–32

seg

Identifier indicating that a segment will be addressed.

s

PROFIBUS segment number of the board. Currently always 0.

&lifelist()

Returns a list with all the connected bus nodes.

Data type: VT_ARRAY

Description: 127 array elements (0–126)

Access right: Read-only

OLE data type: VT_UI1

Each array element stands for a PROFIBUS station address and the array indexcorresponds to the PROFIBUS address. The values of the array elements have the following meaning:

Value Meaning

0x00 STATION_PASSIVE

0x10 STATION_NON_EXISTENT

0x20 STATION_ACTIVE_READY (ready to enter the logical ring)

0x30 STATION_ACTIVE (already in the logical ring)

This item is used for information and diagnostic purposes and is not used by theprofile server.

Page 258: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

258SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.4.18 Addressing the Bus Node (Slave)

Introduction

The following section describes the various forms of syntax with which you canaccess the data of a PROFIDrive device:

SyntaxDP2://brd<n>.seg<s>.dev<address>/

Explanation

dev

Identifier for the bus node (device).

address

Specifies the PROFIBUS station address of the bus node. The bus node does not necessarily need to be attached to PROFIBUS for the itemto be created and used (possibly with an access error). Range: 1–32

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_Vendor-Name

Explanation

DS_Vendor-Name

Item of the bus node. Service for recognition of a bus node by the profile server.

Data type: VT_BSTR

Access right: Read-only

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/Timeout

Explanation

DS_MSAC2_Parameter/Timeout

Items of the bus node (access control). DS_MSAC2_Parameter/Timeout monitoring in ms read or write access to MSAC2items.

Data type: VT_I4

Access right: Read-write

Page 259: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

259SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/ConnectionStatus

Explanation

DS_MSAC2_Parameter/Connection Status

Items of the bus node (access control). DS_MSAC2_Parameter/Timeout connection status MSAC2.

Data type: VT_I2

Access right: Read-only

Value Meaning

1 CONNECTED Connection is open

0 NO_CONNECTION Connection not yet established. The SIMATIC NET OPC Serverhas not yet made an unsuccessful attempt. The connectionstatus NO_CONNECTION is only achieved again when theIVar2 client has released all items with which there is productivecommunication, for example, items for MSAC2_Read/Write,MSAC2_DataTransport or drives.

–1 SLAVE_NOT_PRESENT Connection could not be established or is interrupted. Slavedoes not respond. Without read/write jobs for the slave, a pro-blem (for example, disconnecting from the cable) cannot be de-tected and initially has no effect on the item, in other words, theconnection status may remain “CONNECTED”.

–2 NO_RESOURCES Slave allows no more new connections (for example, no newSAPs are available).

–3 TIMEOUT Timeout accessing the slave.

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/SendTimeout

Explanation

DS_MSAC2_Parameter/SendTimeout

Items of the bus node (Initiate parameter of the master).These items are managed separately for each server object; in other words,different clients can have different settings for these parameters and each have

Page 260: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

260SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

their own MSAC2 connection to the addressed slaves. If a client creates severalserver objects, these items are also managed separately here. Time monitoring in ms for connection establishment to the slave. Evaluated insteps of 10 ms.

Data type: VT_I4

Access right: Read-write

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/MA_Features_Supported_1

Explanation

DS_MSAC2_Parameter/MA_Features_Supported_1

Items of the bus node (Initiate parameter of the master). These items are managed separately for each server object; in other words,different clients can have different values for these parameters and have their ownMSAC2 connection to the addressed slaves. If a client creates several serverobjects, these items are also managed separately here. Function parameter of the master in MSAC2_Initiate.

Data type: VT_UI1

Access right: Read-write

Default 1

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/MA_Features_Supported_2

DP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/MA_Profile_Features_Supported_1

DP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/MA_Profile_Features_Supported_2

Explanation

DS_MSAC2_Parameter/MA_Features_Supported_2 DS_MSAC2_Parameter/MA_Profile_Features_Supported_1 DS_MSAC2_Parameter/MA_Profile_Features_Supported_2

Items of the bus node (Initiate parameter of the master).These items are managed separately for each server object; in other words,different clients can have different values for these parameters and have their ownMSAC2 connection to the addressed slaves. If a client creates several serverobjects, these items are also managed separately here.Function parameter of the master in MSAC2_Initiate.

Page 261: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

261SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Data type: VT_UI1

Access right: Read-write

Default 0

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/MA_ProfileIdentNumber

Explanation

DS_MSAC2_Parameter/MA_ProfileIdentNumber

Items of the bus node (Initiate parameter of the master).These items are managed separately for each server object; in other words,different clients can have different values for these parameters and have their ownMSAC2 connection to the addressed slaves. If a client creates several serverobjects, these items are also managed separately here.Function parameter of the master in MSAC2_Initiate.

Data type: VT_UI2

Access right: Read-write

Default 0

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/SL_Features_Supported_1

DP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/SL_Features_Supported_2

DP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/SL_Profile_Features_Supported_1

DP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/SL_Profile_Features_Supported_2

Explanation

DS_MSAC2_Parameter/SL_Features_Supported_1DS_MSAC2_Parameter/SL_Features_Supported_2DS_MSAC2_Parameter/SL_Profile_Features_Supported_1DS_MSAC2_Parameter/SL_Profile_Features_Supported_2

Items of the bus node (Initiate parameter of the slave).These items are managed separately for each server object; in other words,different clients can have different values for these parameters and have their ownMSAC2 connection to the addressed slaves. If a client creates several serverobjects, these items are also managed separately here. These items have the

Page 262: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

262SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

quality OPC_QUALITY_GOOD only as long as the MSAC2 connection exists.Function parameter of the slave in MSAC2_Initiate.

Data type: VT_UI1

Access right: Read-only

SyntaxDP2://brd<n>.seg<s>.dev<address>/DS_MSAC2_Parameter/SL_ProfileIdentNumber

Explanation

DS_MSAC2_Parameter/SL_ProfileIdentNumber

Items of the bus node (Initiate parameter of the slave).These items are managed separately for each server object; in other words,different clients can have different values for these parameters and have their ownMSAC2 connection to the addressed slaves. If a client creates several serverobjects, these items are also managed separately here. These items have thequality OPC_QUALITY_GOOD only as long as the MSAC2 connection exists.Function parameter of the slave in MSAC2_Initiate.

Data type: VT_UI2

Access right: Read-only

SyntaxDP2://brd<n>.seg<s>.dev<address>/SlotI<slot>S<index>{D8209}

Explanation

Items for addressing MSAC2_Read/Write.

Data type: VT_ARRAY

OLE data type: VT_UI1

Specifying the format with D8209 is optional.

SlotI

Identifier for the slot of the slave, typically a submodule.

slot

Slot in the extended memory area of a slave. Slot and index identify a data record.To access PROFIDrive parameters, slot 0 is normally used. Range: 0 through 254

S

Identifier for the slot of the slave, typically a submodule.

Page 263: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

263SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

index

Index of the data in the slave slot. To access PROFIDrive parameters, index 47 isnormally used. Range: 0 through 254

SyntaxDP2://brd<n>.seg<s>.dev<address>/SlotI<slot>S<index>{D8209}xDT

Explanation

Items for addressing MSAC2_DataTransport.The DPC2 items have read/write access. New data is transferred and result datais received in the protocol acknowledgment. Read access of these items is localand returns the data record obtained with last write access.

The quality of the item only has the value “good” when valid data have beenreceived following a write.

Data type: VT_ARRAY

OLE data type: VT_UI1

Specifying the format with D8209 is optional.

6.4.19 Syntax of the System-Specific Information Variables

SyntaxDP2://&version()

Explanation

Returns a version ID for the PROFIDrive OPC Server, here, for example, the string

SIMATIC NET Core Server PD V 6.xxxx.yyyy.zzzz Copyright 2002

Data type: VT_BSTR

Access right: Read-only

Page 264: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

264SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.4.20 DP Class 2 Master Services

DP class 1 master

The DP class 1 master communicates cyclically with the DP slaves.Communication includes central functions such as:

� Configuring and assigning parameter values to the slaves

� Cyclic data transfer with the DP slaves

� Monitoring the DP slaves

� Providing diagnostic information

DP class 2 master

A DP class 2 master can handle configuration tasks and online diagnostics. Theessential DP class 2 master functions are:

� Reading the input and output data of a slave

� Reading the diagnostic data of a slave

� Reading the slave configuration

� Writing data records for a slave

� Reading the class 1 master diagnostic data

With the services for accessing cyclic data, you can read and monitor the inputsand outputs of the slaves and their diagnostic data. The DP slaves must supportthe DP-V1 additional functions. You can also access the data of a class 1 master.

Variables are accessed

� via the PROFIBUS address of the slave. Slave devices cannot initiatecommunication themselves. They do not receive the token and respond only topolls from the master. Slaves are therefore known as passive nodes. Thisnumber corresponds the PROFIBUS address.

� via the PROFIBUS address of the master Access to the data of a class 1master from a class 2 master.

to the required data of the slave or class 1 master.

6.4.21 Syntax of the DP Class 2 Master Services

Protocol ID

All items begin with the prefix: DP2:

Page 265: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

265SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.22 Name of the CP

The configured CP name specifies the communications processor used (CP).

SyntaxDP2:[<configuredCPname>]

Explanation

configuredCPname

The configured CP name is configured with SIMATIC NCM.

Example

DP:[CP5613]

6.4.23 Addressing a Bus Node (DP Class 1 Master)

Introduction

The following section describes the various forms of syntax with which you canaccess the data of a DP class 1 master:

DP2 Items of the Bus Node

master

Identifier for access to a master using the DP protocol.

masteraddress

PROFIBUS station address of the bus node.Range: 0 through 126

SyntaxDP2:[<configuredCPname>]master<masteraddress>MstDiag

ExplanationDP2 items of the bus node – Item for master diagnostics

MstDiag

Last system diagnostic data of the DP master

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_BOOL

Description: 126 elements

Page 266: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

266SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Each element in the array signals whether the assigned slave has sent diagnosticdata; the array index corresponds to the PROFIBUS address.

Value Meaning

FALSE The slave has not sent diagnostic data

TRUE The slave has sent diagnostic data

SyntaxDP2:[<configuredCPname>]master<masteraddress>MstState

ExplanationDP2 items of the bus node – Master diagnostic items

MstState

Status of the DP master. Contains the current status and some version information.

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_UI1

Description: 16 elements

Byte Description

1 Operating status 0x40 – STOP 0x80 – CLEAR 0xC0 – OPERATE

2 and 3 Ident number

4 Version of the hardware (DDLM/user interface)

5 Version of the software (DDLM/user interface)

6 Version of the hardware

7 Version of the software

8 to 16 Reserved

SyntaxDP2:[<configuredCPname>]master<masteraddress>DataTransferList

Explanation DP2 items of the bus node – Master diagnostic items

DataTransferList

Data transfer list of the DP master.

Data type: VT_ARRAY

Page 267: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

267SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Access right: Read-only

OLE data type: VT_BOOL

Description: 126 elements

Each element in the array signals whether the assigned slave is in the productivephase and has sent data; the array index corresponds to the PROFIBUS address.

Value Description

FALSE Slave is not in the data transfer phase

TRUE Slave is in the data transfer phase

SyntaxDP2:[<configuredCPname>]master<masteraddress>Slave<address>SlvDiag

ExplanationDP2 items of the bus node – Master diagnostic items

address

PROFIBUS station address of the bus node. The bus node does not necessarilyneed to be attached to PROFIBUS for the item to be created and used (possiblywith an access error).

Range: 0 through 126

The SIMATIC NET OPC Server can only recognize whether the addressed busnode is actually DP-compliant after a slave service has executed successfully.With critical bus nodes that may react incorrectly to such services, the creation ofthe corresponding items is responsibility of the user.

SlvDiag

Last diagnostic data of the DP slave stored on the DP master.

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_UI1

6.4.24 Addressing the Bus Node (Slave)

Introduction

The following section describes the various forms of syntax with which you canaccess the data of a master:

Page 268: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

268SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

DP2 Items of the Bus Node

slave

Identifier for access to a slave over the DP protocol.

address

PROFIBUS station address of the bus node. The bus node does not necessarilyneed to be attached to PROFIBUS for the item to be created and used (possiblywith an access error).

Range: 0 through 126

The SIMATIC NET OPC Server can only recognize whether the addressed busnode is actually DP-compliant after a slave service has executed successfully.With critical bus nodes that may react incorrectly to such services, the creation ofthe corresponding items is responsibility of the user.

SyntaxDP2:[<configuredCPname>]slave<address>S<slot>data<index>,<length>{,subarea}

Where subarea = <format><offset{.bit}>{,quantity}

Explanation DPC2 items of the bus node – DPC2 Read/Write

S

Identifier for the slot of the slave, typically a submodule.

slot

Slot in the extended memory area of a slave. Slot and index identify a data record.

Range: 0 through 254

data

Identifier for a data record.

index

Index of the data in the slave slot.

Range: 0 through 254

length

Length of the record.

Range: 1 through 240

Page 269: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

269SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

subarea

Identifier for a subarea.

format

The “format“ element specifies the format in which the data will be delivered.Specifying the format also specifies the data type.

Format identi-fier

Description OLEDataType

Visual Basicdata type

X Bit VT_BOOL

VT_BOOL

BYTE or B Byte (unsigned 8) VT_UI1 VT_UI1

CHAR Character (signed 8)

VT_I1 VT_I2

WORD or W Word (unsigned 16) VT_UI2 VT_I4

INT Integer (signed 16) VT_I2 VT_I2

DWORD or D Double word (unsigned 32)

VT_UI4 VT_CY

DINT Double integer (si-gned 32)

VT_I4 VT_I4

REAL Floating point num-ber

VT_R4 VT_R4

offset{.bit}

Offset in bytes of the element to be accessed. A bit can only be specified with thetype X .

Example: X2.3 returns the 3rd bit of the 2nd byte.

quantity

Number of elements. The data type of the variable is an array with elements (datatype VT_ARRAY) of the specified format. If this part of the name is omitted, or thenumber 1 is specified, the number 1 is assumed and the data type of the variableis not an array.

When a subarea of the data record is read, the partner device first reads the entiredata record and then evaluates the relevant subarea.

When a subarea is written, the entire data record is also transferred to the partnerdevice. If several subareas of the data record are written in a write job, the datarecord is only written to the partner device after all the subareas of the data recordhave been updated.

When using the OPC server, it makes sense to put all the items with partial accessto a particular data record together in one group and to write the entire group.

Page 270: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

270SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Overlaps or gaps resulting from subareas when writing should be avoided, thevalues actually written to the areas involved cannot be foreseen deterministically.

SyntaxDP2:[<configuredCPname>]slave<address>DTS<slot>data<index>,<length>{,subarea}

Where subarea = <format><offset{.bit}>{,quantity}

Explanation DPC2 items of the bus node – DPC2 data transport

The DPC2 data transport items have read/write access. If no subarea is specified,the data type is as follows:

Data type: VT_ARRAY

OLE data type: VT_UI1

This item implements a data exchange in the protocol. Read access of these itemsis local and returns the data record obtained with last write access.

DTS

Identifier for data transport.

slot

Slot in the extended memory area of a slave. Slot and index identify a data record.

Range: 0 through 254

offset{.bit}

Offset in bytes of the element to be accessed. A bit can only be specified with thetype X .

Example: X2.3 returns the 3rd bit of the 2nd byte.

quantity

Number of elements. The data type of the variable is an array with elements (datatype VT_ARRAY) of the specified format. If this part of the name is omitted, or thenumber 1 is specified, the number 1 is assumed and the data type of the variableis not an array.

When a subarea of the data record is read, the subarea of the last data recordreceived from the partner device is evaluated.

When a subarea is written, the entire data record is also transferred to the partnerdevice. If several subareas of the data record are written in a write job, the datarecord is only written to the partner device after all the subareas of the data recordhave been updated.

Page 271: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

271SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

When using the OPC server, it makes sense to put all the items with partial accessto a particular data record together in one group and to write the entire group.Overlaps or gaps resulting from subareas when writing should be avoided, thevalues actually written to the areas involved cannot be foreseen deterministically.

SyntaxDP2:[<configuredCPname>]slave<address>SlvDiag

Explanation DPMCL2 items of the bus node – Slave diagnostic items

SlvDiag

Last diagnostic data of the DP slave

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_UI1

SyntaxDP2:[<configuredCPname>]slave<address>SlvCFGData

Explanation DPMCL2 items of the bus node – Slave diagnostic items

SlvCFGData

Configuration data of the DP slave stored on the DP master

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_U I1

SyntaxDP2:[<configuredCPname>]slave<address>SetSlaveAddress

Explanation DPMCL2 items of the bus node – Slave diagnostic items

SetSlaveAddress

Sets a new PROFIBUS address for the slave

Data type: VT_ARRAY

Access right: Write-only

OLE data type: VT_VARIANT

When writing the item, the corresponding DPMCL2 service is executed. The valueto be written also contains an array with the parameters necessary for executingthe service.

Page 272: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

272SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Arrayelement

Data type Meaning

1 VT_UI1 New slave address to be assigned

2 VT_BOOL Flag indicating whether or not the DP slaveaddress can be changed again at a laterpoint in time.

3 VT_I4 Device type (PROFIBUS Ident number) ofthe node

4 VT_ARRAY |VT_UI1

User-specific data. An empty array can betransferred.

After writing the new slave address successfully, it may be necessary to create newitems for the slave. The items with the old slave address (for exampleDPMCL2_I/O Items) continue to access the slave at the old address and cantherefore no longer be read successfully.

SyntaxDP2:[<configuredCPname>]slave<address>_E{<format><offset{.bit}>{,quantity}}

or (English)DP2:[<configuredCPname>]slave<address>_I{<format><offset{.bit}>{,quantity}}

Explanation DPMCL2 items of the bus node – Slave I/O items

<address>_E <address>_I

The inputs and the outputs can only be read by the OPC client of the SIMATIC NETOPC server.

The submodules and the data size (byte or word) as assigned in the definedconfiguration and the consistency are ignored by the DP class 2 master. Thisdistinguishes it from a DP class 1 master. Although the DP class 2 master canquery the configuration of the slave during runtime, the slave and correspondingDP class 1 master can nevertheless change its configuration during runtimewithout informing the DP class 2 master. The result of this is inconsistentconfiguration data even if time-consuming polling of the configuration data isimplemented (not forgetting the considerable load on the network).

An I/O area is accessed by specifying the slave number <address> and the I/Oarea <I or Q>, as well as the format.

If the optional format information is omitted, the data will be returned as an arrayof bytes with the entire length of the inputs.

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_UI1

Page 273: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

273SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

format

The “format“ element specifies the format in which the data will be delivered. If noformat is specified, the “byte” format is used. Specifying the format also specifiesthe data type.

Format identi-fier

Description OLE datatype

Visual Basicdata type

X Bit VT_BOOL VT_BOOL

BYTE or B Byte (unsigned 8) VT_UI1 VT_UI1

CHAR Character (signed8)

VT_I1 VT_I2

WORD or W Word (unsigned16)

VT_UI2 VT_I4

INT Integer (signed 16) VT_I2 VT_I2

DWORD or D Double word (unsigned 32)

VT_UI4 VT_CY

DINT Double integer (si-gned 32)

VT_I4 VT_I4

REAL Floating pointnumber

VT_R4 VT_R4

offset{.bit}

Offset in bytes of the element to be accessed (offset addressing). A bit can onlybe specified with the type X . The offset is specified in bytes.

Example: X2.3 returns the 3rd bit of the 2nd byte.

quantity

Number of elements. The data type of the variable is an array with elements (datatype VT_ARRAY) of the specified format. It is not possible to specify the numberfor the format X.

If this part of the name is omitted, or the number 1 is specified, the number 1 isassumed and the data type of the variable is not an array.

Syntax

When accessing the outputs in the I/O area of a slave, the slave variable musthave the following syntax:

DP2:[<configuredCPname>]slave<address>_A{<format><offset{.bit}>{,quantity}}

or (English)DP2:[<configuredCPname>]slave<address>_Q{<format><offset{.bit}>{,quantity}

Page 274: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

274SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanation DPMCL2 items of the bus node – Slave I/O items

If the optional format information is omitted, the data will be returned as an arrayof bytes with the entire length of the outputs.

Data type: VT_ARRAY

Access right: Read-only

OLE data type: VT_UI1

6.4.25 Items for the CP

SyntaxDP2:[<configuredCPname>]&lifelist()

Explanation

&lifelist()

General Items

Returns a list with all the connected bus nodes.

Data type: VT_ARRAY

Description: 127 array elements (0–126)

Access right: Read-only

OLE data type: VT_UI1

Each array element stands for a PROFIBUS station address. The values of thearray elements have the following meaning:

Element Meaning

0x00 STATION_PASSIVE

0x10 STATION_NON_EXISTENT

0x20 STATION_ACTIVE_READY (ready to enter the logical ring)

0x30 STATION_ACTIVE (already in the logical ring)

Page 275: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

275SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.26 Special Parameters for all Items

Syntax_DP2:[...]item{{buffer:=nn}{|accessrights:=R}{|band:=low,high}}

Explanation

In some cases, it is practical when the IVar2 client can assign the parametervalues for the OPC item and activate special properties of the OPC item. To dothis, an additional block of parameters can be appended to the text of an OPCitem. This block of parameters is enclosed in braces “{}“ and initially contains theparameters “buffer“, “accessrights“ and “band“, it can, however, have furtherparameters added later. The parameters are separated from each other by thepipe character “|“.

buffer:=nn

Range: 0 <= nn < 2^31:

If the buffer parameter is set to nn >= 0, changes prior to an OnDataChangecallback for OPC items activated by ReadVarCyclic are buffered. If buffered valuesexist, these are reported to the IVar client as fast as possible regardless of theselected UpdateRate. If more than nn values are buffered, a callback with the errorcode E_FAIL is sent first and the buffer is then emptied completely. Following thisand assuming that the buffer does not overflow again during the “Error” callback,the last buffered value is reported. If there are no buffered values, changed valuesare reported at the selected UpdateRate.

nn = 0 does not represent a special situation with the response described above.With a time response in which value changes are occasionally faster than theselected UpdateRate, the client is notified of the overflow with an “Error” callbackbefore the last valid value is reported. nn = 0 is not the same as omitting the bufferparameter that informs the OPC client when value changes take place faster thanexpected. In this way, the OPC client can, for example, detect a malfunction of thedevice involved.

Although no practical upper limit has been specified for nn, no more than ten valuesshould be buffered since the buffering is intended only for brief peak loads. If a largebuffer (for example with 1000 values) is permanently filled to almost maximum dueto overload, there is a risk that old values will be permanently reported. In this case,the use of the buffering should be rethought.

accessrights:=xx

Range: xx = R or W or RW

The accessrights parameter is used solely by the tag file server and allows this torestrict the access rights for an OPC item. The accessrights parameter is acceptedonly when the underscore generated by the tagfile server precedes the protocolprefix; in other words, _DP2:[...]...{accessrights:=R}

Page 276: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

276SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

band:=low,high

The band parameter is used exclusively by the tag file server and allows it to specifythe bandwidth of the item value (minimum value, maximum value). From thedefined configuration, it is not normally possible to find out the bandwidth of aprocess input value. Intended to support the PercentDeadBand functionality on theIVar2 interface (ReadVarCyclic), this parameter allows an OnDataChange callback to be triggered when there are value changes of a certain percentage of thebandwidth. As a result, slight fluctuations in the process value do not lead to achange message. The band parameter is accepted only when the protocol prefixis preceded by the underscore generated by the tag file server; i.e_DP2:[...]...{band:=20,30}.

The bandwidth is evaluated only for items with the canonical data types VT_UI1,VT_I1, VT_UI2, VT_I2, VT_UI4, VT_I4, VT_R4 and VT_R8. With all other datatypes including array types the specified bandwidth is ignored. Theminimum/maximum values for low and high must be specified as a stringcorresponding to the double C data type. The period is used as the decimalseparator (.).

6.4.27 Examples of DP–Specific Information Variables

Here, you will find several examples of return values of DP-specific informationvariables.

DP Master ModeDP:[CP 5613]MasterState

MasterState

can, for example, return the following value:

OPERATE The DP master is in the productive phase.

Current Status of a SlaveDP:[CP 5613]Slave3SlvState

Slave3SlvState

can, for example, return the following value:

READY The DP slave with address 3 is in the data transfer phase.

Page 277: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

277SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Slave TypeDP:[CP 5613]Slave3MiscSlvType

Slave3MiscSlvType

can, for example, return the following value:

ET200_U Slave 3 is an ET 200 U.

6.4.28 Variable Services for Access to Local Slave Data

The OPC Server for SIMATIC NET can operate in a PROFIBUS DP network notonly as a DP master but also in the role of DP slave. The OPC server managesmemory areas for the inputs and outputs of the DP slave and maps them to OPCvariables. An OPC client can read the outputs set by the master and set values inthe inputs that will be fetched by the master in the next cycle.

DP slaves have a modular structure. A DP slave can include several submoduleswith different input/output areas. The submodules are assigned duringconfiguration.

The variable name identifies an input or output area in the submodule of a slave.The inputs and outputs of the slave are accessed by specifying the submodulenumber and the input or output area.

Status information of the slaves and the DP master can also be queried usingvariable names.

Note

Parallel operation of the DP master and DP slave with the CP 5614 module ispossible only when the DP Base mode was set during configuration.

Page 278: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

278SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.4.29 Syntax of the process variables for the DP slave

Syntax

Inputs

DP:[<connectionname>]slave{M<number>}_I{<format><offset>{.<bit>}{,<quantity>}}

Outputs

DP:[<connectionname>]slave{M<number>}_Q<format><offset>{.<bit>}{,<quantity>}

Explanations

DP

Protocol for access to the process variables.

<connectionname>

Name of the communications module specified in the configuration.

slave

Identifier for access to a slave over the DP protocol.

M

Identifier for the number of the submodule.

<number>

Number of the submodule containing the input or output area.

_I

Identifier for an input.

_Q

Identifier for an output.

<format>

Format in which the data is delivered.

Specifying the format also specifies the data type.

All specified OLE data types can be read via the automation interface of OPC.However, certain development tools (for example Visual Basic) only offer arestricted number of data types. The following table therefore lists thecorresponding Visual Basic type in which the variable value can be represented.

Page 279: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

279SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

FormatIdentifier

Description OLE data type Visual BasicType

X Bit VT_BOOL Boolean

BYTE or B Byte (unsigned8)

VT_UI1 Byte

CHAR Character (signed 8)

VT_I1 Integer

WORD or W Word (unsigned16)

VT_UI2 Long

INT Integer (signed16)

VT_I2 Integer

DWORD or D Double word(unsigned 32)

VT_UI4 Double

DINT Double integer (unsigned 32)

VT_I4 Long

REAL Floating pointnumber

VT_R4 Single

<offset>

Byte address in the address space of the slave at which the element to beaddressed is located.

<bit>

Bit number in the addressed byte. The range is between 0 and 7.

A bit can only be specified with the format identifier X.

<quantity>

Number of elements.

The data type (VT_ARRAY) of the variable is an array with elements of thespecified format.

If quantity is omitted, the quantity 1 is assumed and the data type of the variableis not an array.

Do not use the quantity parameter with the X format identifier.

Page 280: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

280SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.4.30 Examples of Process Variables for the DP Slave

Here you will find examples illustrating the syntax of variable names for DPSvariables.

Inputs

DP:[CP 5611]SlaveM003_IB0

SlaveM003_IB0

Input byte 0 (offset 0) in submodule 3 of the DP slave.

DP:[CP 5611]SlaveM003_IB1,3

SlaveM003_IB1,3

An array with 3 bytes starting at input byte 1 (offset 1) in submodule 3 of the DPslave.

DP:[CP 5614]SlaveM003_IX0.0

SlaveM003_IX0.0

Input bit 0 in byte 0 in submodule 3 of the DP slave.

DP:[CP 5614]SlaveM003_IB3,8

SlaveM003_IB3,8

An array with 8 input bytes starting at offset 3 in submodule 3 of the DP slave.

Outputs

DP:[CP 5611]SlaveM003_QW3

SlaveM004_QW3

An output word at address 3 in submodule 4 of the DP slave.

DP:[CP 5611]SlaveM003_QDWORD2

SlaveM003_QDWORD2

An output double word at address 2 in submodule 3 of the DP slave.

DP:[CP 5614]SlaveM003_QX3.7

Slave_QX3.7

An output bit 7 in byte 3 of the DP slave.

DP:[CP 5614]SlaveM001_QW0,4

SlaveM001_QW0,4

An array with 4 output words in submodule 1 of the DP slave.

Page 281: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

281SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.4.31 DP Slave-Specific Information Variables

For DP slave diagnostics, there are several predefined information variables.

6.4.32 Syntax of the DP Slave-Specific Information Variables

Syntax

You have two options:DP:[<connectionname>]&<diagnosticitem>

DP:[<connectionname>]<parameteritem>

Explanations

DP

Protocol for access to the process variables.

<connectionname>

Name specified in the configuration of the communications module.

<diagnosticitem>

Predefined item.

You have the following option:

devicestate

State of the module on which the DP slave is located.

The following states are possible:

� ONLINE

� OFFLINE

parameteritem

Predefined parameter items.

The available options are as follows:

SlaveMiscReadSlvParCfgData

Configuration data of the slave.

SlaveSlvState

State of the slave

Page 282: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

282SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The following states are possible:

� DATA_EXCHANGE

� NO_DATA_EXCHANGE

6.5 S7 Communication

The S7 protocol for PROFIBUS and Industrial Ethernet is used for communicationbetween system components within the SIMATIC S7 programmable controller andfor communication between SIMATIC S7 system components and programmingdevices or PCs.

Properties of S7 Communication with OPC

The OPC server from SIMATIC NET has the following characteristics:

� Variable services

Access to and monitoring of S7 variables.

� Buffer-oriented services

Program-controlled transfer of larger blocks of data.

� Server functionality

In buffer-oriented services, the PC can also be used as server.

� Block management services

Transfer of a loadable data area from and to S7.

� S7 password functions

Setting a password to access protected blocks.

� Events

Processing S7 messages (S7 alarms) as OPC Alarms & Events.

6.5.1 Protocol ID

The protocol ID for the S7 protocol is S7.

Page 283: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

283SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.5.2 Connection Names

The connection name is the name configured in STEP 7 to identify the connection.In STEP 7, this name is known as the local ID. The local ID is unique within theOPC server.

The OPC server supports the following connection types:

� S7 connection

� Fault-tolerant S7 connection

Note

Compatibility with version 2.2 and earlier – please note the following:

In older versions, the connection information was made up of the information forthe S7 connection, the VFDs, and the communications processor. These elementscontinue to be accepted in the ItemID of the variables but are no longer displayedin OPC Browsing. If several VFDs were used by the OPC server in aconfiguration, these can be configured in STEP 7 solely for reasons ofcompatibility.

Examples of Connection Names

Typical examples are:

S7-connection-1

S7-OPC-connection

my_connection

6.5.3 Variable Services

Variable services allow access to and monitoring of S7 variables on theprogrammable controller. S7 variables are addressed symbolically. The type ofaccess is oriented on the notation of the S7 tools.

Objects on the Programmable Controller

The OPC server supports the following objects:

� Data blocks

� Instance data blocks

� Inputs

� Outputs

� Peripheral inputs

Page 284: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

284SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

� Peripheral outputs

� Memory bits

� Timers

� Counters

Some S7 programmable controllers do not support all object types.

6.5.4 Syntax of the Process Variables for S7 Variable Services

Syntax

You have three options:

S7:[<connectionname>]DB<no>,{<type>}<address>{,<quantity>}

S7:[<connectionname>]DI<no>,{<type>}<address>{,<quantity>}

S7:[<connectionname>]<object>{<type>}<address>{,<quantity>}

Explanations

S7

S7 protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

DB

Data block

Identifier for an S7 variable from a data block.

DI

Instance data block

Identifier for an S7 variable from an instance data block.

<no>

Number of the data block or instance data block.

<object>

Specifies the block/area type on the S7 PLC.

Possible values are as follows:

I Input

Q Output

Page 285: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

285SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

PI |Peripheral input

PQ Peripheral output

M Memory bits

T Timers

C Counters

Explanation of the Value T:

The following table shows the significance of the individual bits in result data of thetype T.

Bit no. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Meaning 0 0 x x t t t t t t t t t t t t

Symbol ’0’: not relevant

Symbol ’x’: specifies the time base

Bits 13 and 12 Time base in seconds

00 0.01

01 0.1

10 1

11 10

Symbol ’t’: BCD-coded time value (0 through 999)

Explanation of the Value C:

The following table shows the significance of the individual bits of the results dataof the type C.

Bit no. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Meaning 0 0 0 0 c c c c c c c c c c c c

Symbol ’0’: not relevant

Symbol ’c’: BCD-coded value (0 through 999)

<type>

S7 Data Type

An S7 data type is converted to the corresponding OLE data type in the OPCserver.

All specified OLE data types can be read via the automation interface of OPC.However, certain development tools (for example Visual Basic) only offer arestricted number of data types. The following table therefore lists thecorresponding Visual Basic type in which the variable value can be represented.

Page 286: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

286SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

For objects of the types T and C, no type can be specified.

Format Identifier

Description OLE Data Type VisualBasicType

X Bit (bool).

You must spe-cify the bit num-ber (0 through7).

VT_BOOL Boolean

B Byte (unsigned) VT_UI1 Byte

W Word (unsigned) VT_UI2 Long

D Double word(unsigned)

VT_UI4 Double

CHAR Byte (signed) VT_I1 Integer

INT Word (signed) VT_I2 Integer

DINT Double word (si-gned)

VT_I4 Long

REAL Floating pointnumber

VT_R4 Single

STRING String.You must spe-cify the stringlength.

VT_BSTR String

DT Date and time, 8bytes BCD for-mat

VT_DATE Date

TIME Time value (si-gned), IEC for-mat, in ms

VT_I4 Long

TOD Time of day (un-signed),0 ... 86399999ms

VT_UI4 Double

The data types CHAR, INT, DINT, and REAL can be used only in a data block (DB)or in an instance data block (DI).

<address>

Address of the first variable to be addressed. Possible values are as follows:

� Byte offset

� Byte offset. Bit (only for data type X)

Page 287: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

287SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

� Byte offset. String length (only for data type string, string length 1 bytethrough 254 bytes)

<quantity>

Number of variables of a type to be addressed starting at the offset specified in theaddress parameter.

For data type X and the objects T and Z, it is not possible to enter a quantity.

6.5.5 Examples of Process Variables for S7 Variable Services

Here you will find examples illustrating the syntax of variable names for variableservices.

Data Block Parameter

S7:[S7-connection-1]DB5,B12

DB5,B12

identifies data byte 12 in data block 5.

Instance Data Block Parameter

S7:[S7-connection-1]DI5,W10,9

DI5,W10,9

identifies 9 data words starting at byte address 10 in instance data block 5.

Objects Parameter

S7:[S7-connection-1]IB0

IB0

identifies input byte 0.

6.5.6 Buffer-oriented Services

Buffer-oriented services allow program-controlled transfer of larger blocks of data.Data transfer is implemented with variables:

� Variables that send blocks of data

� Variables that receive blocks of data

Up to 65534 bytes of payload data can be transferred regardless of the size of thePDU. The segmentation of the data is handled by the functions themselves.

Page 288: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

288SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

Buffer-oriented services can only be used on two-ended connections. Theconnection configuration must be downloaded to the S7 programmable controller.

6.5.7 Syntax of the Process Variables for Buffer-Oriented Services

Syntax

You have two options:

S7:[<connectionname>]BRCV,<RID>{,{<type>}<address>{,<quantity>}}

S7:[<connectionname>]BSEND<length>,<RID>{{<type>}<address>{,<quantity>}}

Explanations

S7

S7 protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

BRCV

BRCV contains the last block of data received from the partner.

The content and length of the received data are specified by the sending partner.

The variable is read-only.

Use these variables for monitoring. The reception of a block of data by the OPCserver is then signaled to an OPC client application.

An explicit job to read these variables returns when the connection times out (timespecified in the configuration for the specific connection) or a block of data isreceived.

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Byte()

BSEND

BSEND contains the block of data to be sent to a partner device.

Page 289: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

289SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The block of data is sent to the partner only when the variable is written. A readgets the content of the last successfully transferred block of data.

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Byte()

<length>

Length in bytes of the block of data to be sent.

<RID>

ID of the addressing parameter. This set is for a block pair (BSEND/ BRCV) anduniquely defined within a connection.

You can send several BSEND blocks over a connection or receive several BRCVblocks but each must have a different ID. The same IDs can be used on otherconnections.

<type>

S7 data type

An S7 data type is converted to the corresponding OLE data type in the OPCserver.

All specified OLE data types can be read via the automation interface of OPC.However, certain development tools (for example Visual Basic) only offer arestricted number of data types. The following table therefore lists thecorresponding Visual Basic type in which the variable value can be represented.

Format Identifier

Description OLE DataType

Visual BasicType

X Bit (bool).

You must spe-cify the bit num-ber.

VT_BOOL Boolean

B Byte (unsigned) VT_UI1 Byte

W Word (unsigned) VT_UI2 Long

D Double word(unsigned)

VT_UI4 Double

CHAR Byte (signed) VT_I1 Integer

INT Word (signed) VT_I2 Integer

DINT Double word (si-gned)

VT_I4 Long

REAL Floating pointnumber

VT_R4 Single

Page 290: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

290SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<address>

Address of the first variable to be addressed.

Possible values are as follows:

byte number

byte number.bit (only for X format)

<quantity>

Number of variables of a type to be addressed starting at the address specified inthe address parameter.

For data type X , it is not possible to enter a quantity.

Note

By specifying the optional information type, address and quantity, you can definestructured access to subareas of blocks of data.

6.5.8 Examples of Process Variables for Buffer-oriented Services

Here you will find examples illustrating the syntax of variable names forbuffer-oriented services.

Block of data received in the entire bufferS7:[S7-OPC-1]BRCV,1

BRCV,1

A block of data is received in the receive buffer with RID 1. The complete buffer ismapped on an array of bytes.

Alternate access to received block of dataS7:[S7-OPC-1]BRCV,1,W2,4

BRCV,1,W2,4

From the received block of data, the content is mapped starting at offset 2 on anarray of 4 words. In total, 8 bytes of the block of data are relevant.

Page 291: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

291SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Double word transferredS7:[S7-OPC-1]BSEND16,1,D2

BSEND16,1,D2

A double word is addressed in a block of data with a length of 16 with RID 1starting at offset 2. If a write command is applied to the variable, the written valueis entered at the specified position in the block and the block of data is sent.

Floating-point numbers transferredS7:[S7-OPC-1]BSEND32,1,REAL20,2

BSEND32,1,REAL20,2

An array with floating-point numbers is addressed in a block of data with a lengthof 32 with RID 1 starting at offset 20. If a write command is applied to the variable,the written value is entered at the specified position in the block and the block ofdata is sent.

6.5.9 S7-specific Information Variables

There are S7-specific variables with which you can obtain information about the S7communication and the established connections.

The following information can be obtained:

� Attribute of virtual field device (VFD).

� Status of an S7 connection

� Status of a virtual device

� Status of the logon the messages.

6.5.10 Syntax of the S7-specific Information Variables

Syntax

S7:[<connectionname>]&<informationparameter>()

Explanations

S7

S7 protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

Page 292: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

292SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<informationparameter>

Possible values are as follows:

identify

Vendor attributes of a communication partner.

Return values (as elements of a string field):

� Vendor

� Model

� Revision

OLE Data Type Visual Basic Type

VT_ARRAY of VT_BSTR String()

&vfdstate()

State of a virtual field device

Data type: VT_ARRAY of VT_VARIANT with the following components:

Logical status

Supported services

Return Value:

S7_STATE_CHANGES_ALLOWED all services are permitted

OLE Data Type Visual Basic Type

VT_BSTR String

Physical status

Operability of the real device

Return values:

S7_OPERATIONAL the real device is operational.

S7 NEEDS COMMISSIONING the real device is only operational af-ter local settings have been made.

OLE Data Type Visual Basic Type

VT_BSTR String

Detailed Information on the local VFD state

The state is returned as an octet string. For more detailed information on themeaning of the return value, refer to the documentation of the partner device.

Page 293: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

293SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

OLE Data Type Visual Basic Type

VT_ARRAY of VT_BSTR String()

statepath

State of a communication connection to a partner device.

Return values:

� DOWN

Connection is not established

� UP

Connection is established

� RECOVERY

Connection being established

� ESTABLISH

(Reserved for future expansions)

OLE Data Type Visual Basic TypeVT_BSTR String

statepathval

State of a communication connection to a partner device.

Return values:

� 1

Connection is not established

� 2

Connection is established

� 3

Connection being established

� 4

(Reserved for future expansions)

OLE Data Type Visual Basic Type

VT_UI1 Byte

Page 294: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

294SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.5.11 Examples of S7-specific Information Variables and ReturnValues

Here you will find examples illustrating the syntax of variable names forbuffer-oriented services.

Information on the Vendor Attributes of a Virtual Field Device

S7:[S7-OPC-1]&identify()

&identify()

can, for example, return the following values:

� Vendor: “SIEMENS AG”

� Model of the virtual device: “GES7413-1AE0-0AB0”

� Revision: “V1.0”

State of a Device

S7:[S7-OPC-1]&vfdstate()

&vfdstate()

can, for example, return the following values:

� Logical status: “S7_STATE_CHANGES_ALLOWED”

� All services are allowed.

� Physical status: “S7_OPERATIONAL”

� The real device is operational.

� Detailed information: “02.00.00”

� Detailed Information on the Local VFD state

Status of a communication connection as string

S7:[S7-OPC-1]&statepath()

&statepath()

can, for example, return the following value:

� Connection status: “RECOVERY”

� The connection is currently being established.

Page 295: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

295SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Status of a communication connection as value

S7:[S7-OPC-1]&statepathval()

&statepathval()

can, for example, return the following value:

� Connection status: “2”

� The connection is established

6.5.12 Block Management Services

Block management services control the transfer and return of data and programelements between the PC and the programmable controller. On the PC, data andprogram elements are stored in files.

Block management services can be protected by a password.

Blocks

Data and program elements are stored on S7 programmable controllers in blocks.These blocks are compiled using STEP 7 and transferred to the S7 device. Thefollowing blocks can exist on S7 devices:

� Organization blocks

� Function blocks

� Data blocks (DB / DI)

Block Management Functions

You can execute the following functions via the SIMATIC NET OPC Server:

� Transfer blocks between PCs and programmable controllers

� Delete blocks

� Link blocks

� Compress the memory of the programmable controller

Note

It is not possible to create blocks with the OPC server, you must use STEP 7.

Page 296: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

296SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.5.13 Syntax of the Control Variables for Block Management Services

Syntax

S7:[<connectionname>]&<serviceparameter>()

Explanations

S7

S7 protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<serviceparameter>

These variables can only be written. The service is triggered by writing a value.

Possible values are as follows:

blockread

A block from a programmable controller is transferred to the PC and stored in afile.

The written value contains the parameter setting for the service. It is representedas an array of variants with the following elements:

Flags

The following hexadecimal numbers are possible:

0x0001 An unlinked block is read. If a target file exists, it is not overwrit-ten, an error message is displayed.

0x0040 A linked block is read. If a target file exists, it is not overwritten,an error message is displayed.

0x1001 An unlinked block is read. An existing target file is overwritten.

0x1040 A linked block is read. An existing target file is overwritten.

OLE Data Type Visual Basic Type

VT-BSTR String

Page 297: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

297SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Block

Block type and number

OB Organization block

FB Function block

FC Function

DB Data block

OLE Data Type Visual Basic Type

VT-BSTR String

File

Full path of the file in which the block will be stored

OLE Data Type Visual Basic Type

VT-BSTR String

blockwrite

Transfer a block from a PC to a programmable controller.

The written value contains the parameter setting for this service. It is representedas an array of variants with the following elements:

Flags

The following hexadecimal numbers are possible:

0x1000 A block of the same name on the programmable controller isto be overwritten

0x0000 A block of the same name on the programmable controller isnot to be overwritten

OLE Data Type Visual Basic Type

VT-BSTR String

File

Full path of the file in which the block is stored

OLE Data Type Visual Basic Type

VT-BSTR String

Page 298: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

298SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

blocklinkin

Link a block with the passive status into the program sequence of theprogrammable controller. The executable part of the block is copied to the workmemory of the programmable controller.

The block is then accessible to the program. By linking a block, an existing, activeblock is overwritten without an error message.

The written value contains the specification of the block to be linked as theparameter setting for the service.

Block

Block type and number

The following types are possible:

OB Organization block

FB Function block

FC Function

DB Data block

OLE Data Type Visual Basic Type

VT-BSTR String

blockdelete

Delete a block on the programmable controller. Both the passive blocks and thoselinked into the program sequence can be removed.

The written value contains the parameter setting for this service. It is representedas an array of variants with the following elements:

Flags

The following hexadecimal numbers are possible:

0x0001 An unlinked block is deleted

0x0040 A linked block is deleted

0x0041 The linked and the unlinked block are deleted

OLE Data Type Visual Basic Type

VT-BSTR String

Block

Block type and number

The following types are possible:

Page 299: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

299SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

OB Organization block

FB Function block

FC Function

DB Data block

OLE Data Type Visual Basic Type

VT-BSTR String

blockcompress

Compress the memory of the programmable controller.

Fragmented memory areas are moved together to create space for new blocks tobe transferred.

This variable can only be written. The service is triggered by writing an emptystring.

Note

The parameters of some of the block management services are set by the writtenvalue. Here, arrays are used as the data type. From the user’s point of view, itmay be advantageous to transfer the value parameters as a value of the data typeVT_BSTR. The OPC server converts the values into the required data typeautomatically. The representation of an array in a string is, for example:“{firstelement|secondelement|thirdelement}”. You should also refer to the examples.

6.5.14 Examples of Using the Block Management Services

Here you will find examples illustrating the syntax of variable names for blockmanagement services.

Reading a Block

S7:[S7-OPC-1]&blockread()&blockread()

For example, to read the block OB1 in a file c:\temp\ob1.blk , the item must bewritten with the following value:

{0x0040|OB1|c:\temp\ob1.blk}

Page 300: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

300SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

To specify the value as in this example, string must be requested as the data type.The value can then be specified in the converted representation for arrays.

Writing a Block

S7:[S7-OPC-1]&blockwrite()&blockwrite()

For example, to send the block in the file c:\temp\ob1.blk to the programmablecontroller, the item must be written with the following value:

{0x1000|c:\temp\ob1.blk}

Note

To specify the value as in this example, string must be requested as the data type.The value can then be specified in the converted representation for arrays.

Example of Linking a Block

S7:[S7-OPC-1]&blocklinkin()

&blocklinkin()

For example, to link the block DB1 into program execution on the programmablecontroller, the item must be written with the following value:

DB1

Example of Deleting a Block

S7:[S7-OPC-1]&blockdelete()&blockdelete()

To delete a linked block DB1, the item must be written with the following value:

{0x0040|DB1}

Example of Compressing the Memory of the Programmable Controller

S7:[S7-OPC-1]&blockcompress()&blockcompress()

To compress memory, the item must be written with an empty string.

Page 301: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

301SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.5.15 Passwords

Write and read access by block management services to the CPU can beprotected by a password during configuration. The password has higher prioritythan the keyswitch of the CPU.

Protection Levels

There are three protection levels for S7 programmable controllers. These areactivated with the aid of STEP 7.

� Protection due to the setting of the keyswitch

� Write protection

� Write and read protection

When the correct password is transferred, all the protection levels for thisconnection are revoked. When an empty string is transferred as the password, theconnection protection is reactivated.

A default protection level can be sent during configuration for two-endedconnections. If the protection for two-ended connections is not activated by theconfiguration, all services are possible on these connections even when thekeyswitch is set to “RUN”.

The following table shows the relationship between password transfer and theprotection level on connections configured at one end.

One-endedConfiguredConnections

Resulting Active Protection Level

Configured pro-tection level

Password was nottransferred

Correct password wastransferred

Keyswitch setting Keyswitch setting

RUN RUN-P

STOP

RUN RUN-P

STOP

Keyswitch set-ting RUN – canbe canceled bypassword

Read

All

All

All

Keyswitch RUN– cannot be can-celed by pass-word

Read

All

Read

All

Page 302: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

302SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

One-endedConfiguredConnections

Resulting Active Protection Level

Write protectionwith password

Read

Read

All

All

Write/read pro-tection

None

None

All

All

Figure 6-1 Relationship between Password Transfer and Protection Level

Key:“All” = all services possible; “Read” = only read block; “None” = no block services allowed

6.5.16 Syntax of the Control Variables for Passwords

Syntax

S7:[<connectionname>]&password()

Explanations

S7

S7 protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

&password()

Identifier for the password service.

The transfer of the password is triggered by writing a value.

Page 303: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

303SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The password can be transferred in the following representations:

� Octet string

String with the hexadecimal codes of the individual characters of thepassword separated by a period (maximum of 8 characters)

� String

Any alphanumeric string starting with the & character (maximum 8characters)

Writing the password returns the following values:

� OPC_E_BADRIGHTS

The password is invalid

� S_OK

The password is valid

OLE Data Type Visual Basic Type

String String

6.5.17 Example of Using Passwords

Here, you will find an example illustrating the transfer of passwords.

Example of Transferring a Password

S7:[S7-OPC-1]&password()&password()

To transfer the password SetMeFre to the programmable controller, the variablemust be written with the following value:

&SetMeFre

6.6 PROFIBUS FMS

Introduction

The FMS protocol for PROFIBUS is an open communications protocol belongingto layer 7 of the ISO/OSI reference model.

Using FMS, communication is possible with all programmable controllers that meetthe FMS standard. This applies in particular to the S5 and S7 programmablecontrollers from Siemens.

Page 304: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

304SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of PROFIBUS-FMS

The OPC server from SIMATIC NET has the following characteristics:

Reading and Writing FMS Variables

� FMS server functionality

� Support of arrays and structures, including alternate access

� Support of connections over which no object dictionary (OD), a short OD, orlong OD can be downloaded

� Support of the FMS services Identify and VfdState

� Support of the PROFIBUS service Lifelist

� Display and monitoring of the connection state

6.6.1 Protocol ID (FMS)

The protocol ID for the FMS protocol is FMS.

6.6.2 Connection Names

The connection name is the name configured in STEP 7 to identify the connection.During configuration, STEP 7 makes sure that the FMS connection name for theOPC server is unique.

Examples of Connection Names

Typical examples are:

Simocode

S5_5431

connection1

6.6.3 Data Types

The FMS protocol uses its own data types in the declaration of the FMS variables.The FMS data types must be mapped on the data types available on the OPCinterface.

* Default setting VT_BSTR

Page 305: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

305SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

FMS Data Type Canonical OLE DataType

VisualBasicType

Meaning

unsigned8 VT_UI1 Byte unsigned char (1 Byte)

unsigned16 VT_UI2 Long unsigned short (2 bytes)

unsigned32 VT_UI4 Double unsigned long (4 Byte)

integer8 VT_I1 Integer signed char (1 Byte)

integer16 VT_I2 Integer signed short (2 Byte)

integer32 VT_I4 Long signed long (4 Byte)

float VT_R4 Single real (4 bytes)

boolean VT_BOOL Boolean signed short (True = –1;False = 0)

vstringX VT_BSTR String Visible String X: Number of characters

bstringX VT_BSTR String Bit string X: Number of bits structure: b.b.b.b.b.bwhere b=0 or 1

ostringX VT_BSTR String Octet string X: number of octets structure:hh.hh.hh.hh.hh whereh=0..f

time_of_day VT_DATE Date Time of dayTimeOfDay4 (4 bytes)0 ... 86399999 ms(alternative VT_UI4)

The OPC date is always01.01.1984 and is ignoredwhen writing.

TimeOfDay6 (6 bytes)01.01.1984 00:00:00.000through31.12.2083 23:59:59.999

Page 306: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

306SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

FMS Data Type MeaningVisualBasicType

Canonical OLE DataType

date VT_DATE Date Date7 bytes01.01.1984 00:00:00.000through31.12.2083 23:59:59.999

time_difference VT_DATE Date Time DifferenceTimeDifference4 (4 by-tes)0 ... 86399999 ms(alternative VT_UI4)

The OPC date is always30.12.1899 and is ignoredwhen writing.

TimeDifference6 (6 by-tes)00:00:00.000 0 daysthrough 23:59:59.999 65535 days(alternative VT_UI8)The OPC date begins on30.12.1899.

array

( Data type[N] )

VT_ARRAYof elementtype

Array ofthe VBelemen-tary type

FMS array as safearraywith N elements of typeelement type.

struct

({Type1|Type2|Type3|Type4} )

VT_ARRAYof VT_VA-RIANT

Array withelementsof the re-spectiveelemen-tary types

FMS structure with 4 diffe-rent data typesType1...Type4.

6.6.4 Variable Services

FMS variables are the variables on the partner device. You access the variablesusing the object dictionary of the partner.

There are two types of object dictionaries on the partner device:

Page 307: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

307SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

� Short object dictionary

You can only access variables using indexes.

� Long object dictionary

You can use both the symbolic name stored in the object dictionary andindexes.

6.6.5 Syntax of the Process Variables for FMS Variable Services

Syntax

You have two options:

FMS:[<connectionname>]<index>{:<subindex>}

FMS:[<connectionname>]<objectname>{:<subindex>}

Explanations

FMS

FMS protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<index>

Index for the variable in the short object dictionary of the partner device.

<objectname>

Symbolic name of the variable in the long object dictionary of the partner device.

<subindex>

Alternate access to a structure element.

6.6.6 Examples of Process Variables for FMS Variable Services

Here you will find examples illustrating the syntax of variable names for FMSvariables.

Page 308: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

308SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Addressing Symbolic Names on a Demonstration Connection

FMS:[DEMO]Valve_In

Valve_In

Variable with the name Valve_In of the demo connection.

Addressing an Index on a normal Connection

FMS:[CR1]200

200

Variable with Index 200 of the CR1 connection

Addressing Symbolic Names on a normal Connection

FMS:[CR1]Count

Count

Count variable of the CR1 connection

Addressing a Structure Element on a normal Connection

FMS:[CR1]200:2

200:2

Access to the second structure element of the variable with index 200

6.6.7 FMS-Specific Information Variables

The OPC server provides variables with which information about the FMScommunication system and the connection states can be queried.

You can query the following information:

� Attributes of a virtual field device (VFD).

� Status of a virtual device

� Status of an FMS connection

� Station addresses of the obtainable nodes (lifeless)

6.6.8 Syntax of the FMS-specific Information Variables

Syntax

FMS:[<connectionname>]&<informationparameter>()

Page 309: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

309SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

FMS

FMS protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<informationparameter>

Possible values are as follows:

identify

Vendor attributes of a virtual device

A virtual field device is a model of a real device, also known as VFD.

Return values:

� Vendor

� Model

� Revision

OLE Data Type Visual Basic Type

VT_ARRAY of VT_BSTR String() with 3 elements

vfdstate

State of a virtual field device

Data type: VT_ARRAY of VT_VARIANT with the following components:

Logical status

Supported services

Return values:

FMS_STATE_CHANGES_ALLO-WED

all services are permitted

FMS_LIMITED_SERVICES_PER-MITTED

only the services Status virtual de-vice and Identify virtual device arepermitted

FMS_OD_LOADING_NON_INTER-ACTING

Loading an object dictionary is notpermitted.

FMS_OD_LOADING_INTERAC-TING

An object dictionary is currentlybeing loaded on the interface mo-dule.

Page 310: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

310SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OLE Data Type Visual Basic Type

VT_BSTR Array with three string elements

Physical status

Operability of the real device

Return values:

FMS_OPERATIONAL the real device is operational.

FMS_PARTIALLY_OPERATIONAL the real device is partially operational.

FMS NEEDS COMMISSIONING the real device is only operational af-ter local settings have been made.

FMS_INOPERABLE the real device is not operational.

OLE Data Type Visual Basic Type

VT_BSTR Array with three string elements

Detailed Information on the Local VFD State

Detailed local state as octet string with the structure hh.hh.hh where h = 0..f . Tointerpret this value, the description of the local VFD is required.

OLE Data Type Visual Basic Type

VT_BSTR Array with three string elements

statepath

State of a communication connection to a partner device.

Return values:

� DOWN

Connection is not established

� UP

Connection is established

� RECOVERY

Connection being established

� ESTABLISH

The object dictionary of the partner is read.

OLE Data Type Visual Basic Type

VT_BSTR String

Page 311: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

311SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

statepathval

State of a communication connection to a partner device.

Return values:

� 1

Connection is not established

� 2

Connection is established

� 3

Connection being established

� 4

The object dictionary of the partner device is read.

� Other

Connection is unknown

OLE Data Type Visual Basic Type

VT_UI1 Byte

livelist

Information on accessible nodes on the bus

The array with its 127 elements includes information about every possible stationaddress. Each station address is assigned an index of the array.

Return values of the array entries:

� FMS_STATION_NONEXISTENT

No node exists (value 0)

� FMS_STATION_PASSIVE

Passive node (value 1)

� FMS_STATION_READY_FOR_RING

Node ready for entry in the token ring of PROFIBUS (value 2).

� FMS_STATION_ACTIVE

Active node (value 3)

OLE Data Type Visual Basic Type

VT_ARRAY of VT_UI1 Array with 127 elements of the typebyte()

Page 312: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

312SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

6.6.9 Examples of FMS-Specific Information Variables and ReturnValues

Here, you will find examples of return values of FMS-specific information variables.

Information on the Vendor Attributes of a Virtual Field Device

FMS:[connection1]&identify()&identify

can, for example, return the following values:

SIEMENS AG Vendor

ET 200U-DP/FMS Model of the Virtual Device

V1.0 Revision

State of a Device

FMS:[connection1]&vfdstate()&vfdstate()

can, for example, return the following values:

FMS_STATE_CHANGES_ALLOWED all service are permitted.

FMS_OPERATIONAL the real device is operational.

00.00.00 local VFD status.

’State of a Communication Connection

FMS:[connection1]&statepath()&statepath()

can, for example, return the following value:

UP connection is established.

Information on Accessible Nodes on the Bus

FMS:[connection1]&livelist()&livelist()

can, for example, return the following value (shown with string data type):

{0|1|0|0|1|0|0|1|0|2|1|0|1|0|1|0|3|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|2|0|1|2|0|0|0|0|0|0|0|1|1|1|0|1|1|0|1|0|1|0|1|0|1|0|1|0|0|0|0|0|0|0|0|0|0|0|0|0|3|0|0|0|0|0|0|0|0|0|1|0|1|0|1|0|1|0|1|0|0|1|0|0|1|0|0|1|0|0|1|0|1|3|0|3|0|1|0|3|1|0|0|3|0|3|0|3|0|0|0|0|0|0|0|0|0}

Page 313: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

313SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.6.10 FMS Server Variables

The FMS-OPC server can itself be a server in the sense of the FMS protocol. Asan FMS server, it provides variables and an object dictionary that other FMSpartner devices can access. This allows FMS communication between PCs to beestablished.

The FMS server variables are created during configuration and managed by theOPC server.

Note

To make the PC acting as FMS server available for other devices, the OPC servermust be started by an OPC client.

6.6.11 FMS Server Variables: ItemID

Syntax

You have two options:

FMS:[<connectionname>]<index>{:<subindex>}

FMS:[<connectionname>]<symbolicname>{:<subindex>}

Explanations

FMS

FMS protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<index>

Index for the variable in the local short object dictionary.

<symbolicname>

Symbolic name of the variable in the local long object dictionary.

<subindex>

Alternate access to a structure element.

Page 314: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

314SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

From the perspective of an OPC client, these variables are local elementsmanaged by the OPC server. The data is transported over PROFIBUS only whenan FMS partner device accesses these variables.

6.7 S5-compatible Communication

Depending on the communications network, there are two versions ofS5-compatible communication:

� S5-compatible Communication over Industrial EthernetProtocol ID: SR

� S5-compatible Communication over PROFIBUSProtocol ID: FDL

6.7.1 S5-compatible Communication over Industrial Ethernet

S5-compatible communication over Industrial Ethernet is also known asSEND/RECEIVE protocol. Communication with S5 and S7 devices is possible.

Properties of S5-compatible Communication over Industrial Ethernet

� Communication using SIMATIC S5 handling blocks and S7 function blocks

� Link between two PC stations possible.

� Support of the WRITE and FETCH function for access to objects of the partnerdevice.

� Fast access to large data packets with the modes SEND and RECEIVE.

� Alternate access within a data packet.

� Display and monitoring of the connection state

6.7.2 Protocol ID

The protocol ID for the SEND/RECEIVE protocol is SR.

Page 315: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

315SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.7.3 Connection Names

The connection name is the name configured in STEP 7 to identify the connection.

The following connection types are supported by the OPC server:

� ISO transport connection

� ISO-on-TCP connection

� TCP connection

Examples of Connection Names

Typical examples are:

MyConnection

SR_Connection

6.7.4 Variable Services

Variable services allow direct access to and monitoring of variables on theprogrammable controller. The variables are addressed symbolically, the notation ofthe variable names is oriented on the programming tools. For direct read access,the OPC server transfers the required address information to the receiver and thissends the requested data back. During write access, the OPC server transfers theaddress information along with the value to be written.

Note

The requested variable must be consistent with the configuration of the partnerdevice. Otherwise, the access to certain areas leads to communication errors. TheOPC server can only check the syntax when a variable registers. Based on theconfiguration of the partner, it is not possible to determine whether the variable isvalid on the partner device.

Syntax of the Process Variables for SEND/RECEIVE Variable Services

Syntax

SR:[<connectionname>]<area>{,}<type><address>{,<quantity>}

Page 316: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

316SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanations

SR

SEND/RECEIVE protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<area>

Object to be addressed.

� DBnn,

Data block no. nn

� Q

Output

� I

Input

� M

Memory bits

� P

I/O (for S5 CPUs)

� PII

I/O (for S7 CPUs)

� C

Counters

� T

Timers

� RS

System area

� IA

Absolute start address

� DXnn,

Extended data block

� DEnn,

Data block in the external memory

� OY

Extended I/O

Page 317: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

317SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

<type>

Data type.

The data type is converted to the corresponding OLE data type in the OPC server.

Data type Description OLE DataType

Visual Ba-sic Type

X Bit (Boolean)

Only with theobjects I, Q, F,P, PII, and OY(read accessonly)

VT_BOOL Boolean

B or BYTEOnly availablefor the objects I,Q, F, P, PII, andOY

Byte (unsi-gned8)

VT_UI1 Byte

CHAROnly availablefor the objects I,Q, F, P, PII, andOY

Byte (signed8) VT_I1 Integer

W or WORD Word (unsi-gned16)

VT_UI2 Long

INT Word (signed16) VT_I2 Integer

D or DWORD Double word(unsigned 32)

VT_UI4 Double

DINT Double word (si-gned 32)

VT_I4 Long

REAL Floating-point,IEEE represen-tation

VT_R4 Single

S5REAL Floating-point,S5 representa-tion

VT_R4 Single

Page 318: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

318SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<address>

Address of the variables in the area:

Depending on the area, the address specified must be a byte or a word address.When accessing the following areas, the specified address is interpreted as a wordaddress: DBnn

� RS

� IA

� DXnn,

� DInn,

� C

� T

<quantity>

Number of variables of a type to be addressed starting at the address specified inthe address parameter.

6.7.5 Buffer-oriented Services

Buffer-oriented services allow program-controlled transfer of larger blocks of data.These services are also known as SEND/RECEIVE services. Data transfer withthe OPC server is implemented with variables:

� Variables that send blocks of data

� Variables that receive blocks of data

A default size for the blocks of data is specified in the configuration, when sendingvariables, the length can be restricted. Alternate access within the blocks of data ispossible.

Fixed Variable Names

The following fixed variable names are specified for each connection:

� RECEIVE

� SEND

Syntax of the Process Variables for Buffer-Oriented Services

Syntax

The available options are as follows:

SR:[<connectionname>]receive{,<type><address>{,<quantity>}}

SR:[<connectionname>]send{<n>}{,<type><address>{,<quantity>}}

Page 319: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

319SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

SR

SEND/RECEIVE protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

receive

Last data buffer received from partner.

The structure of the data buffer is not fixed. For this reason, the buffer is alwaysdelivered as an array of bytes.

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Byte

Note

The RECEIVE variable corresponds to a receive buffer. The variable can thereforeonly be read. With read access to the DEVICE, a receive buffer is preparedexplicitly in the communications system. If no data field is received for this bufferwithin a specified time, a timeout is reported. You should therefore only monitorthese variables or read them from the cache.

send

A send buffer that can be transferred to the connection partner.

A default value for the size of the send buffer is specified during configuration. Thebuffer is always delivered as an array of bytes.

Write access to these variables causes the send buffer to be transferred to thepartner.

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Byte

Page 320: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

320SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

This variable and variables derived from it must not be read and not activated.Read access to these variables may well result in the partner terminating theconnection.

<n>

Size of the send buffer

You can use n if send buffers of different sizes are used on a connection. If you omitn , the buffer size entered in the configuration is used.

If the miniprotocol is deactivated in TCP/IP native, (see SIMATIC STEP 7 orSIMATIC NCM PC configuration tool), it is not possible to specify the size of thesend buffer. In this case, the buffer size entered in the defined configuration is used.

Note

Variables for send buffers of different sizes have independent memory areas!

Page 321: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

321SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

<type>

Data type.

The data type is converted to the corresponding OLE data type in the OPC server.

Data type Description OLE DataType

Visual BasicType

X Bit (Boolean) VT_BOOL Boolean

B or BYTE Byte (unsi-gned8)

VT_UI1 Byte

CHAR Byte (signed8) VT_I1 Integer

W or WORD Word (unsi-gned16)

VT_UI2 Long

INT Word (signed16) VT_I2 Integer

D or DWORD Double word(unsigned 32)

VT_UI4 Double

DINT Double word (si-gned 32)

VT_I4 Long

REAL Floating-point,IEEE represen-tation

VT_R4 Single

S5REAL Floating-point,S5 representa-tion

VT_R4 Single

<address>

Byte address of the variables in the area byte number.

For the bit data type, the requested bit is addressed by

Byte number.bit number addressed.

<quantity>

Number of variables of a type to be addressed starting at the address specified inthe address parameter.

Bit arrays are not supported. For the data type X (Boolean) the specification of anumber is therefore omitted or must be 1.

Examples of Process Variables for Buffer-Oriented Services

Here you will find examples illustrating the syntax of variable names forbuffer-oriented services.

Page 322: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

322SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Receive Variables

SR:[MyConnection]receive,w4,6

receive,w4,6

6 data words starting at offset 4 in the receive buffer

SR:[MyConnection]receive,dword7

receive,dword7

A double word starting at offset 7 in the receive buffer

SR:[MyConnection]receive,REAL0,2

receive,REAL0,2

An array with 2 floating point values starting at offset 0 in the receive buffer.

Send Variables

SR:[MyConnection]send30,dword7

send30,dword7

A double word starting at byte 7 in a 30-byte long send buffer. If the default for thesize of the send buffer is not 30, the variable accesses a separate buffer.

SR:[MyConnection]send,B20,6

send,B20,6

An array with 20 bytes starting at offset 6 in a send buffer with default size. Thedefault size of the send buffer is specified in the configuration.

SR:[MyConnection]send8,DINT0

send8,DINT0

A signed double word starting at address 0 in a send buffer with the size 8.

Page 323: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

323SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.7.6 SEND/RECEIVE-Specific Information Variables

With the SEND/RECEIVE-specific information variables, you can query informationabout the connection state.

The following information can be obtained:

Status of a connection

Syntax of Information Variables for S5-compatible Communication (SEND/RECEIVE)

Syntax

SR:[<connectionname>]&<informationparameter>()

Explanations

SR

SEND/RECEIVE protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

<informationparameter>

The available options are as follows:

statepath

State of a communication connection to a partner device.

The result is represented as a string.

Return values:

� DOWN

Connection is not established

� UP

Connection is established

� RECOVERY

Connection being established

� ESTABLISH

Reserved for future expansions

OLE Data Type Visual Basic Type

VT_BSTR String

Page 324: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

324SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

statepathval

State of a communication connection to a partner device.

The result is represented as a number.

Return values:

� 1

Connection is not established

� 2

Connection is established

� 3

Connection being established

� 4

Reserved for future expansions

OLE Data Type Visual Basic Type

VT_UI1 Byte

Examples of SEND/RECEIVE-specific Information Variables

Here, you will find several examples of return values of information variables forS5-compatible communication (SEND/RECEIVE):

SR:[SR_CONNECTION]&statepath()

&statepath()

can, for example, return the following value:

UP The connection is established

SR:[SR_CONNECTION]&statepathval()

&statepathval()

can, for example, return the following value:

2 The connection is established

6.7.7 S5-compatible Communication over PROFIBUS

The ISO/OSI Reference Model

S5-compatible communication over PROFIBUS is a simple, frame-orientedprotocol for SIMATIC devices. It uses the services of the Fieldbus Data Link (FDL)of layer 2 of the ISO/OSI reference model in PROFIBUS.

Page 325: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

325SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Properties of S5-compatible Communication over PROFIBUS

The OPC server of SIMATIC NET has the following characteristics:

� Communication using SIMATIC S5 and SIMATIC S7 handling blocks on aprogrammable controller

� Link between two PC stations possible

� Fast transfer of data packets

� Structured access within a data packet

� Display and monitoring of the connection state

6.7.8 Protocol ID

The protocol ID for the FDL protocol is FDL.

6.7.9 Connection Names

The connection name is the name configured in STEP 7 to identify the connection.Select a unique FDL connection name for the OPC server.

Examples of Connection Names

A typical name might be:

FDL_Connection

6.7.10 Buffer-oriented Services

Buffer-oriented services allow program-controlled transfer of blocks of data. Thereceived data buffers and the data buffers to be sent are mapped on OPCvariables.

Fixed Variable Names

The following fixed variable names are specified for each connection:

� RECEIVE

� SEND

� SendSDA

� SendSDN

Page 326: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

326SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Syntax of the Process Variables for Buffer-Oriented Services (FDL)

Syntax:

You have two options:

FDL:[<connectionname>]receive{,}<type><address>{,<quantity>}

FDL:[<connectionname>]send{<n>}{,}<type><address>{,<quantity>}

Explanations:

FDL

FDL protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

receive

Last data buffer received from partner.

The structure of the data buffer is not fixed. For this reason, the buffer is alwaysdelivered as an array of bytes.

Note

The RECEIVE variable corresponds to a receive buffer. The variable can thereforeonly be read. With read access to the DEVICE, a receive buffer is preparedexplicitly in the communications system. If no block of data is received for thisbuffer within a specified time, a timeout is reported. You should therefore onlymonitor these variables or read them from the cache.

OLE Data Type Visual Basic Type

T_ARRAY|VT_UI1 Array with elements of the type byte

send

A send buffer that exists permanently and can be transferred to the connectionpartner.

A default value for the size of the send buffer is specified during configuration. Thebuffer is always delivered as an array of bytes.

Write access to these and derived variables causes the send buffer to betransferred to the partner.

This variable and variables derived from it must not be read and not activated.

Page 327: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

327SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Depending on the combination of the station address and the SAPs specified in theconnection configuration, a special FDL service is used when writing a send item:

Local SAP RemoteStation

RemoteSAP

Meaning / Ser-vice Used withSend

0..62, 255 0..126 0..62, 255 Sending and Re-ceiving / SDA

0..62, 255 0..126 63 Send only / SDA

63 0..126 0..62, 255 Receive only (nosend)

0..62, 255 127 63 Broadcast: Onlysend to all /SDN

63 127 0..62, 255 Broadcast Re-ceive

(no send)

0..62, 255 127 0..62, 255 Multicast: Onlysend to all thosethat activatedthe remote SAP/ SDN

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Array with elements of the typebyte

<n>

Size of the send buffer

With buffer-oriented services, you can send and receive data buffers. The receiveddata buffers and the data buffers to be sent are mapped on OPC variables. Asuitably large array can, for example, contain the entire receive buffer. It is alsopossible to assign subsections of the buffers to individual variables.

Page 328: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

328SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

Variables for send buffers of different sizes have independent memory areas!

<type>

Data type.

The data type is converted to the corresponding OLE data type in the OPC server.

Data Types Description OLE DataType

Visual BasicType

X Bit (Boolean) VT_BOOL Boolean

B or BYTE Byte (unsi-gned8)

VT_UI1 Byte

CHAR Byte (signed8) VT_I1 Integer

W or WORD Word (unsi-gned16)

VT_UI2 Long

INT Word (signed16) VT_I2 Integer

D or DWORD Double word(unsigned 32)

VT_UI4 Double

DINT Double word (si-gned 32)

VT_I4 Long

REAL Floating-point,IEEE represen-tation

VT_R4 Single

S5REAL Floating-point,S5 representa-tion

VT_R4 Single

<address>

Byte address of the variables in the area byte number.

For the bit data type, the requested bit is addressed by

Byte number.bit number addressed.

<quantity>

Number of variables of a type to be addressed starting at the address specified inthe address parameter.

Bit arrays are not supported. For the data type X (Boolean) the specification of anumber is therefore omitted or must be 1.

Page 329: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

329SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Syntax of the Process Variables for Buffer-oriented Services using SDA and SDN(FDL)

It can be an advantage when the service used is not dependent on thecombination of the address of the partner station and the SAPs.

By using the names SendSDA and SendSDN you can specify that only therelevant services SDA or SDN are used for sending. These special names are notdisplayed in the OPC Browser.

Syntax:

You have two options:

FDL:[<connectionname>]SendSDA{<n>}{,}<type><address>{,<quantity>}

FDL:[<connectionname>]SendSDN{<n>}{,}<type><address>{,<quantity>}

Explanations

FDL

FDL protocol for access to the process variable.

<connectionname>

Protocol-specific connection name. The connection name is specified in theconfiguration.

SendSDA

SendSDN

Only the services SDA or SDN are used to send.

<n>

Size of the send buffer

With buffer-oriented services, you can send and receive data buffers. The receiveddata buffers and the data buffers to be sent are mapped on OPC variables. Asuitably large array can, for example, contain the entire receive buffer. It is alsopossible to assign subsections of the buffers to individual variables.

Page 330: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

330SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<type>

Data type.

The data type is converted to the corresponding OLE data type in the OPC server.

Data Types Description OLE DataType

Visual BasicType

X Bit (Boolean) VT_BOOL Boolean

B or BYTE Byte (unsi-gned8)

VT_UI1 Byte

CHAR Byte (signed8) VT_I1 Integer

W or WORD Word (unsi-gned16)

VT_UI2 Long

INT Word (signed16) VT_I2 Integer

D or DWORD Double word(unsigned 32)

VT_UI4 Double

DINT Double word (si-gned 32)

VT_I4 Long

REAL Floating-point,IEEE represen-tation

VT_R4 Single

S5REAL Floating-point,S5 representa-tion

VT_R4 Single

<address>

Byte address of the variables in the area byte number.

For the bit data type, the requested bit is addressed by

Byte-number.bit number addressed.

<quantity>

Number of variables of a type to be addressed starting at the address specified inthe address parameter.

Bit arrays are not supported. For the data type X (Boolean) the specification of anumber is therefore omitted or must be 1.

Examples of Process Variables for Buffer-Oriented Services (FDL)

Here you will find examples illustrating the syntax of variable names for FDLvariables.

Page 331: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

331SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Read Variable

FDL:[MyConnection]receive,w0,6

6 data words starting at byte 0 in the receive buffer

FDL:[MyConnection]receive,dword7

A double word starting at byte 7

FDL:[MyConnection]Receive,REAL0,2

Two real values starting at byte 0 in the receive buffer

Write Variable

FDL:[MyConnection]send30,dword7

A double word starting at byte 7 in a 30-byte long send buffer.

FDL:[MyConnection]SendSDN,B5,20

An array with 20 bytes starting at offset 5 in a send buffer with default size. Thedefault size is set during configuration. Regardless of which SAP is specified in theconfiguration, the PROFIBUS-FDL SDN service is used.FDL:[MyConnection]Send8,DINT0

A signed double word from starting at address 0 in a send buffer with the size 8bytes.

6.7.11 FDL-specific Information Variables

The OPC server for SEND/RECEIVE over PROFIBUS (FDL) provides variableswith which information can be queried about the connection states. You can querythe status and extent of the communications network.

Page 332: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

332SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Syntax of FDL-specific Information Variables

FDL:[||<CPname>]&<informationparameter>()

Explanations

FDLFDL protocol for access to the process variable.

CPnameThe CP name is specified during configuration. Only those CP names aresupported over which an FDL connection is configured.

Information parametersThere are five options:

� busparameter

� defaultsap

� identify

� ts

� lifelist

These five options are described below.

busparameter

Gets the bus parameters of the PROFIBUS network operated on the specifiedconnection. The values are returned as a byte array and correspond to the resultsreturned by the FDL service FDL_READ_VALUE. For more detailed information,refer to the manual on the FDL programming interface.

Content Description Data type Length(bytes)

HSA Highest PROFIBUS addresson the bus, 2...126

BYTE 1

TS PROFIBUS address of thelocal station, 0...hsa or 126.

BYTE 1

Station_Type Type of local station INTEGER 2

Baudrate Transmission rate INTEGER 2

Medium_red Redundancy INTEGER 2

Retry_Ctr Number of repeated calls tonon-responding station (re-mote), 0...7.

UWORD 2

Default_SAP Number of the default SAPof the station (local), 0...63

BYTE 1

network_con_SAP

reserved BYTE 1

TSL SLOT time UWORD 2

Page 333: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

333SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Content Length(bytes)

Data typeDescription

TQUI Quiet time for modulator /repeater switchover time

UWORD 2

TSET Setup time UWORD 2

MIN_TSDR Minimum station delay re-sponder

UWORD 2

MAX TSDR Maximum station delay re-sponder

UWORD 2

TTR Target rotation time DWORD 4

GAP GAP update factor BYTE 1

in_Ring_desired

Request to enter ring BOO-LEAN

1

physical_layer Selectable physical bus cha-racteristics

INTEGER 2

ident Vendor name, controllertype, hardware and softwareversions

STRING 211

OLE Data Type Visual Basic Type

VT_ARRAY | VT_UI1 Byte()

defaultsap

Returns the value for the default SAP (SAP = Service Access Point). Whenever anSAP is not explicitly specified, the default SAP is used for addressing.

OLE Data Type Visual Basic Type

VT_UI1 Byte

identify

Gets the station identifier of the specified connection as an array with four strings:

Elements of the return value:

� Vendor

� Controller

� Hardware version

� Software version

OLE Data Type Visual Basic Type

VT_ARRAY | VT_BSTR String()

Page 334: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

334SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

ts

Returns the local station address of the specified module.

OLE Data Type Visual Basic Type

VT_UI1 Byte

lifelist

Information on accessible nodes on the bus

The array with its 127 elements includes information about every possible stationaddress. Each station address is assigned an index of the array.

Return values of the array entries:

� FDL_STATION_NON_EXISTENTNo node exists (value 0x10)

� FDL_STATION_PASSIVEPassive node (value 0x00)

� FDL_STATION_READY_FOR_RINGNode ready for entry in the token ring of PROFIBUS (value 0x30).

� FDL_STATION_ACTIVEActive node (value 0x20)

OLE Data Type Visual Basic Type

VT_ARRAY of VT_UI1 Array with 127 elements of the typebyte()

Note

This information is obtained using the FDL service“FDL_LIFE_LIST_CREATE_REMOTE”. This service creates a significant load onthe bus so that whenever possible this variable should not be monitored actively.

Page 335: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

335SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

6.8 SNMP Communication over Industrial Ethernet

Process Variables for SNMP

The SNMP OPC Server of SIMATIC NET provides the following variables:

� Process variables

� Information variables

� Trap variables

6.8.1 Protocol ID

Protocol ID

The protocol ID for the SNMP protocol is SNMP.

6.8.2 Data Types of the SNMP Protocol

Mapping on Available Data Types

In the declaration of the MIB objects, the SNMP protocol uses its own data types. TheSNMP OPC Server maps the data types of the SNMP protocol to the available data typeson the OPC interface as follows:

SNMP Data Type

Code

CanonicalOLE DataType

Visual BasicType

Meaning

ASN_INTEGER

02h

VT_I4 Long signed long (4 bytes)

ASN_INTEGER32<

02h

VT_I4 Long signed long (4 bytes)

ASN_UNSIGNED32

47h

VT_UI4 Double unsigned long (4 bytes)

ASN_OCTET-STRING

04h

VT_BSTR String If not a printablecharacter, notation: “os-tring:xx.xx.xx.xx”

ASN_OBJECTIDEN-TIFIER

06h

VT_BSTR String In MIB notation: .a.b.c.d.e.

Page 336: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

336SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

SNMP Data Type

Code

MeaningVisual BasicType

CanonicalOLE DataType

ASN_IPADDRESS

40h

VT_BSTR String In decimal notation: 129.168.0.4

ASN_COUNTER32

41h

VT_UI4 Double unsigned long (4 bytes)

ASN_GAUGE32

42h

VT_UI4 Double unsigned long (4 bytes)

ASN_TIMETICKS

43h

VT_UI4 Double unsigned long (4 bytes)

ASN_OPAQUE

44h

VT_ARRAYof VT_UI1

VT_ARRAY ofVT_UI1

unsigned byte

6.8.3 Process Variables for SNMP Variable Services

Variables and Device Profiles

SNMP variables are the variables on the partner device. These variables are made knownto the OPC server based on device profiles. These device profiles can be created withthe MIB compiler and the MIB files of the device. The defined configuration is thendownloaded to the PC with the OPC server so that the variables are available to the OPCserver.

Syntax

Note

In contrast to the syntax of the other protocols, the following syntax is used with SNMP.

SNMP:[<devicename>]<objectname>

Explanations

SNMP

SNMP protocol for access to the process variables (MIB objects) and trapvariables.

Page 337: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

337SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

<devicename>

The device name is specified during configuration of the system and is unique.

<objectname>

Symbolic name for the MIB object of the partner device.

Example

SNMP:[OSM]sysName

Queries the MIB object sysName. The device name was configured in the systemconfiguration in this example as OSM.

6.8.4 SNMP-specific Information Variables

Introduction

The following sections describe the variables provided by the SNMP OPC Server:

� Variables for the communications system and connection statuses

� Variables for the SNMP OPC Server

Information on the Communications System

The OPC server provides variables with which information you can get information on theSNMP communication system and the connection statuses.

You can query the following information:

� The comment entered during configuration

� The IP address of the partner device

� The status of the connection to the partner device

� Additional information for non SNMP-compliant devices

Syntax

SNMP:[<devicename>]<informationparameter>

Explanations

SNMP

SNMP protocol for access to the process variables (MIB objects) and trapvariables.

<devicename>

The device name is specified during configuration of the system.

Page 338: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

338SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<informationparameter>

The following information parameters are defined:

&description() The text entered in the comment field during configu-ration. VT_BSTR, Read-only

&ipaddress() The IP address of the partner device. VT_BSTR,Read-only.

&statepath() Status of the connection to the partner device. Valuein text form (VT_BSTR, read-only):

DOWNThe device cannot be reached with a ping or there areno active read or write jobs.

UPJobs could be executed successfully with this device.

RECOVERYThe device cannot be reached with a ping or the lastjob was terminated with an error that suggests a com-munication abort and there are still active jobs for thedevice.

&statepathval() Status of the connection to the partner device. Valuesas integers: VT_UI1, read-only.

1The device cannot be reached with a ping or there areno active read or write jobs.

2Jobs could be executed successfully with this device.

3The device cannot be reached with a ping or the lastjob was terminated with an error that suggests a com-munication abort and there are still active jobs for thedevice.

Page 339: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

339SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The following information parameters are visible only when you select “No SNMP” duringconfiguration because the device does not support SNMP but only the ping:

sysContact The text entered in the sysContact field during configuration;VT_BSTR, read-only.

sysLocation The text entered in the sysLocation field during configuration;VT_BSTR, read-only.

sysName The text entered in the sysName field during configuration;VT_BSTR, read-only.

Example

SNMP:[OSM]&ipaddress()

The configured IP address of the node name with the name OSM is returned.

Information on the SNMP OPC Server

The OPC server provides variables with which information about the SIMATIC NETSNMP OPC Server can be queried.

You can query the following information:

� Version of the SIMATIC NET SNMP OPC Server

� Version of the Winsocket

� Information on trap reception

Syntax

SNMP:[SYSTEM]&<informationparameter>()

Explanations

SNMP

SNMP protocol for access to the information variables for the local system.

SYSTEM

Identifier of the local system; the same is fixed.

Page 340: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

340SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<informationparameter>

The following information parameters are defined:

version Version identifier of the SIMATIC NET SNMP OPCServer. VT_BSTR, Read-only.

&winsockversion() Version identifier of the Winsocket. VT_BSTR,Read-only.

&traplists() Indicates whether the SIMATIC NET SNMP OPCServer was able to log on to receive traps.VT_BOOL; Read-only.

FALSEThe SNMP OPC Server could not log on to receivetraps.

TRUEThe SNMP OPC Server logged on successfully toreceive traps.

Example

SNMP:[SYSTEM]&version()

The version of the SIMATIC NET SNMP OPC Server is returned, for example “SIMATICNET Core Server SNMP V6.1.1000.2815 Copyright SIEMENS AG”

6.8.5 SNMP-specific Traps

How the OPC Server Handles Traps

Traps are events sent spontaneously by the device to the OPC SNMP Server. The OPCserver processes these events as described below:

� The trap is mapped as a simple event on the Alarms & Events interface.

� For each configured trap, two variables are created on the Data Accessinterface: One variable is incremented each time the relevant trap occurs, theother variable stores a description of the trap.

Syntax

First variable for the number of the occurrences of the event:

SNMP:[<devicename]<trapname>

Second variable for describing the trap:

SNMP:[<devicename>]<trapname>_description

Page 341: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

341SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

SNMP

SNMP protocol for access to the process variables (MIB objects) and trapvariables.

<devicename>

The device name is specified during configuration of the system.

<trapname>

Name of the trap.

Example

The first variable returns the number of cold start traps triggered by the partner device:

SNMP:[OSM]coldStart

The second variable returns a description of the trap:

SNMP:[OSM]coldStart_description

Page 342: Industrial Communication With PG-PC

OPC Process Variables for SIMATIC NET

342SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 343: Industrial Communication With PG-PC

343SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Properties of the OPC Event Server fromSIMATIC NET

This section describes the events returned by the OPC server and which additionalinformation is available in the form of attributes.

The OPC Event Server for SIMATIC NET is a Simple Event Server. It does nothave any configuration information relating to alarm/event handling in an operatorcontrol and monitoring system.

A Simple Event Server passes on only simple messages to the underlyingcomponents. A higher level Alarm/Event Management Server processes themessages of the lower level Simple Server taking into account configurationinformation.

Figure 7-1 The Simple Event Server in the System

7

Page 344: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

344SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

7.1 S7 Communication

The Simple Event Server can be used only within S7 communication.

S7 Protocol

The S7 protocol provides the protocol mechanism “Programmed Messages(ALARM)” for transferring events.

The message type is used by the Simple Event Server.

Alarm Category

According to the message type, the Simple Event Server provides the alarmcategory “S7_PROCESS_ALARM”.

Page 345: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

345SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

7.2 Parameters for Events

By calling the OnEvent callback function of the client, the client obtains a list ofevents. The OPC Event Server returns the following server-specific parameters:

The parameter has the following meaning

dwEventCategory The following value is possible as the event category:

S7_PROCESS_ALARM = 2

dwEventType The OPC Event server supports only the followingtype:

OPC_SIMPLE_EVENT

This constant has the value 0x0001.

dwNumEventAttrs The number of attributes supplied with the messagedepends on the number of supplied associated va-lues.

dwSeverity A predefined value is returned for the severity of theerror. This value can be modified for individual mes-sage numbers of a communication partner in the con-figuration database.

pEventAttributes This structure contains the attributes supplied with theevent. The attributes also include the associated va-lues of the message supplied by the partner device.

szMessage The name of a message is made up of the messagemechanism and the configured message number:ALARMmessagenumber

Examples:ALARM55

szSource As the source of the message, the OPC Event serverspecifies the connection information of the reportingS7 device. This is made up as follows:S7:\<connectionname>

Note

Other parameters are also supplied. These parameters contain information forconditional events or protocol events. These event types are not supported by theSimple Event Server and are therefore irrelevant.

Page 346: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

346SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

7.3 Event Attributes

An S7 station can send up to 10 associated values with a message or an alarm.These associated values are available in the event attributes via the OPC Alarms& Events interface.

Programmed messages (ALARM) provide the following attributes:

� EVENT_ATTR_S7_ACK_STATE

� EVENT_ATTR_S7_DATA0n

� EVENT_ATTR_S7_DATA0n_DATATYPE

� EVENT_ATTR_S7_DATA0n_VALUE_LEN

� EVENT_ATTR_S7_EVENT_STATE

� EVENT_ATTR_S7_NO_DATA

� EVENT_ATTR_S7_PCTIME

� EVENT_ATTR_S7_S7TIME

� EVENT_ATTR_S7_STATE

7.3.1 EVENT_ATTR_S7_ACK_STATE

Value: 6003

Data type: VT_UI2

Acknowledgment status of the alarm on the S7 programmable controller.

It is not possible to acknowledge messages using the OPC Event Server forSIMATIC NET. Messages can, however, be acknowledged by other user interfacesystems.

ALARM Messages

The bit indicates:

0 Acknowledgment 1 entered state

1 to 6 Acknowledgment 2 to 7 entered state

7 Acknowledgment 8 entered state

8 Acknowledgment 1 left state

9 to 14 Acknowledgment 2 to 7 left state

15 Acknowledgment 8 left state

Page 347: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

347SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

7.3.2 EVENT_ATTR_S7_DATA0n

Value: where n = 0

where n = 1

where n = 2

where n = 3

where n = 4

where n = 5

where n = 6

where n = 7

where n = 8

where n = 9

6008

6012

6016

6020

6024

6028

6032

6036

6040

6044

Data type: VT_ARRAY | VT_UI1

The relevant bytes of associated value no. n as array of bytes.

Page 348: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

348SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

7.3.3 EVENT_ATTR_S7_DATA0n_DATATYPE

Value: where n = 0

where n = 1

where n = 2

where n = 3

where n = 4

where n = 5

where n = 6

where n = 7

where n = 8

where n = 9

6006

6010

6014

6018

6022

6026

6030

6034

6038

6042

Data type: VT_UI2

Data type of the associated value no. n.

Parameter value Description

S7_DATATYPE_ERROR Error (0x0)

S7_DATATYPE_BOOLEAN Boolean (0x03)

S7_DATATYPE_INTEGER Integer (0x05)

S7_DATATYPE_FLOAT Float (0x07)

S7_DATATYPE_OCTET_STRING String (0x09)

S7_DATATYPE_BITSTRING Bit string (0x04)

Note: length specified in bytes insteadof bits

S7_DATATYPE_DATE Date (0x30)

Note: days since 01.01.1990

S7_DATATYPE_TIME_OF_DAY Time (0x31)

Note: ms since start of day

Page 349: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

349SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter value Description

S7_DATATYPE_TIME Time (0x32)

Note: ms

S7_DATATYPE_S5TIME Time (0x33)

Note: BCD coded

7.3.4 EVENT_ATTR_S7_DATA0n_VALUE_LEN

Value: where n = 0

where n = 1

where n = 2

where n = 3

where n = 4

where n = 5

where n = 6

where n = 7

where n = 8

where n = 9

6007

6011

6015

6019

6023

6027

6031

6035

6039

6043

Data type: VT_UI2

Number of relevant bytes of associated value no. n.

7.3.5 EVENT_ATTR_S7_EVENT_STATE

Value: 6004

Data type: VT_UI2

Event state

The bit indicates:

Bit 0 Current status (1 = active)

Remaining bits irrelevant

Page 350: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

350SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

7.3.6 EVENT_ATTR_S7_NO_DATA

Value: 6005

Data type: VT_UI2

Number of associated values

Range of values: 1 through 10

7.3.7 EVENT_ATTR_S7_PCTIME

Value: 6000

Data type: VT_DATE

Time at which the OPC Event Server received the message.

7.3.8 EVENT_ATTR_S7_S7TIME

Value: 6001

Data type: VT_DATE

Time at which the message was generated on the partner device.

7.3.9 EVENT_ATTR_S7_STATE

Value: 6002

Data type: VT_UI2

General status indicating whether or not a message exists.

ALARM Messages

The bit indicates:

0x00H The message exists

Bit 0 Initialization

Bit 1 Overflow signal

Bit 2 Overflow instance

Bit 3..5 0, reserved

Page 351: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

351SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The bit indicates:

Bit 6 Additional values cannot be ent-ered (size)

Bit 7 Additional values not obtainable

7.4 Simple Event Server for SNMP Communication

Forwarding Traps

Traps are forwarded as so-called simple events via the IEvent interface to the OPCA&E Server. In addition to this, the frequency of the occurrence and the descriptionof a trap are available as an OPC item.

Requirements

� The IP address of the PC with the OPC SNMP server must be entered as atrap recipient on the SNMP-compliant device and the traps must be activated.This is implemented by device-specific configuration tools (refer to theCommissioning PC Stations manual).

� The Windows SNMP service must be installed.

OPC Alarm Server Name: OPC.SimaticNetAlarmsSNMP

Alarms & Events Categories

The following Alarms & Events categories are available and are described ingreater detail below:

CategoryNumber

Name Description

20 GENERICTRAP SNMP trap event (generic trap)

21 SPECIFICTRAP SNMP trap event (specific trap)

Generic traps are specified by standards and have the same significance for alldevices. Specific traps are device-specific. The SNMP OPC Server is informedwhether or not a trap is generic or specific by the device profile file.

These categories “generic” or “specific” must be understood in the context of theterm “Category”. Alarms and events of every category can occur on any partnerdevice (“source”). Different alarms and the events of one and the same categoryfrom the same partner device are identified by their different EventIDs.

Page 352: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

352SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Traps are triggered by the communication partner and forwarded by the SNMPprotocol to the SIMATIC NET SNMP OPC Server. With high communication loads,traps can be discarded by the SNMP protocol so that the SIMATIC NET SNMPOPC Server does not necessarily receive all traps.

Traps do not have a status and are not acknowledged and consequently theSIMATIC NET SNMP OPC Server does not manage a state machine for the traps.

By calling the OnEvent callback function of the client, the client obtains a list ofevents. The SNMP Event Server returns the following server-specific parameters:

Parameter Meaning

dwEventCategory The following value is possible as the event category:

GENERICTRAP = 20

SPECIFICTRAP = 21

dwEventType The SNMP OPC Event server supports only the follo-wing type:

OPC_SIMPLE_EVENT

This constant has the value 0x0001.

dwNumEven-tAttrs

The number of attributes supplied with the messagedepends on the number of supplied associated values.

dwSeverity A predefined value is returned for the severity of theerror. This value can be modified for individual messagenumbers of a communication partner in the configura-tion database.

pEventAttributes This structure contains the attributes supplied with theevent. The attributes also include the associated valuesof the message supplied by the partner device.

szMessage Trap event name from the device profile file:

<nametext>

e.g. TrapPowerDown

szSource As the source of the notification, the SNMP OPC EventServer specifies the device information of the reportingSNMP device. This corresponds to the device name ofan SNMP variable for OPC Data Access:

SNMP:\<device>

e.g. SNMP:\Switch33

Page 353: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

353SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Along with this event, additional information in the form of attributes can also besent. SNMP traps provide the following attributes:

Attribute ID Attributes Meaning

ATTR_PCTIME6100

VT_DATE Time at which the OPCserver received themessage.

ATTR_TIMESTAMP6101

AsnTimeticks(VT_DATE)

Time at which themessage wasgenerated on thepartner device.

ATTR_EVENTID6102

LONG (VT_I4) Unique trap numberwithin the device

ATTR_ENTERPRISE6103

AsnObjectIdentifier(VT_BSTR)

Device-specific trap

ATTR_AGENTAD-DRESS6104

AsnNetworkAddress(VT_BSTR)

IP address of agent

ATTR_SOURCEAD-DRESS6105

AsnNetworkAddress(VT_BSTR)

IP address of trapsource

ATTR_VARBINDINGS6106

SnmpVarBindList(VT_ARRAY |VT_VARIANT)

Variable bindings of thesent trap

Page 354: Industrial Communication With PG-PC

Properties of the OPC Event Server from SIMATIC NET

354SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

7.4.1 Packaging the Variables for a Trap

List as Variant

The list of variables assigned to a trap has a flexible structure. This finds suitablerepresentation in a hierarchically structured variable of the type variant.

1st Level Snmp-Var-

BindList

2nd Level Snmp-Var-

Bind

3rd Level AsnObject- IdentifierAs-

nAny

VT_ARRAY |VT_VARIANT

One array element per variable

VT_ARRAY |VT_VARIANT

Each variable consists of4 descriptive elements. Thefirst two elements are based onan interpretation, the variablecan be reconstructed asSnmpVarBind again from thelast three elements.

VT_BSTR String representation of the ob-ject identifier, for example.1.2.3.4.5

VT_xx ASN any automation data typeaccording to the conversion ofASN data types

VT_UI1 ASN any data type

VT_ARRAY |VT_UI1

ASN any data according to thedata length

Page 355: Industrial Communication With PG-PC

355SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Using the OPC Server

This section explains the various options open to you when you work with the OPCserver.

8.1 SIMATIC Computing

With the SIMATIC Computing software as part of the SIMATIC NET PC software,you can create simple applications with which you can access process datawithout a lot of programming effort. The process data can be read and written overany SIMATIC NET communication system.

SIMATIC Computing provides you with various ActiveX controls. You can configureand interconnect these ActiveX controls to suit your task.

Compatibility with OPC

The ActiveX controls from SIMATIC NET use the OPC interface directly.

Applications created using the ActiveX controls of SIMATIC NET can also beoperated with OPC servers of other vendors. Check the licensing situation first.

Compatibility with Earlier Versions

Older versions of SIMATIC NET and SIMATIC Computing for WinAC and WinLCincluded the data control “S7Data” control. This version also includes the new,more convenient SIMATIC NET OPC Data control.

The functionality of the S7Data control continues to be supported, however, thecontrol will not be developed any further and is not described in thisdocumentation. In future, you should use the new SIMATIC NET OPC Datacontrol.

8

Page 356: Industrial Communication With PG-PC

Using the OPC Server

356SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

When you interconnect a process variable via the ActiveX controls, you establishaccess to process data. If you change the values of a process variable in anActiveX control, the values in the process can change as a direct result.

Changing process data can trigger unexpected reactions in the process that canlead to serious injury to persons or damage to equipment.

With this in mind, a degree of caution is necessary. You should, for example,restrict access rights for process variables. Install a physical emergency stopcircuit for the machine or process.

8.1.1 What Are ActiveX Controls?

SIMATIC Computing provides you with various ActiveX controls. You can work withthe SIMATIC display controls or connect other ActiveX controls (other vendors orcontrols you have developed yourself) with the SIMATIC NET OPC Data control.

SIMATIC NET OPC Data Control

The most important control is the SIMATIC NET OPC Data control. Without thiscontrol, no other SIMATIC control can access process data. This Data controlaccesses process data obtained by the OPC server.

Control Appearance Brief Description

SIMATIC NETOPC Data

Establishes the connection to theOPC server.

The data control is invisible while theprogram is running.

Page 357: Industrial Communication With PG-PC

Using the OPC Server

357SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Display Controls

The display controls are elements for visualizing process data. They receive theirdata via the SIMATIC NET OPC Data control and not directly by access to OPC oranother interface.

The following SIMATIC display controls are available:

Control Appearance Brief Description

Button Accesses individual bits stored on theOPC server. The button control ac-cesses only in the bit format andworks with two values:

Off = 0

On = 1

If you change the state of the buttoncontrol, the state of the variable assi-gned to the control also changes.

If you set up write protection for thebutton control, it more or less worksas a lamp or LED.

Number Accesses the process data via varia-bles. You can access in the byte,word, or double-word format andchange individual bits within the data.

When you enter a new value in thenumber control, the values change inthe process.

Slider Accesses the process data via varia-bles. You can access in the byte,word, and double-word format.

When you change a value in the slidercontrol, the values change in the pro-cess.

Page 358: Industrial Communication With PG-PC

Using the OPC Server

358SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.2 How Do Controls Access Process Data?

Before the SIMATIC Button, Number, and Slider controls or other controls canaccess process data, the following is required:

� The connection between the SIMATIC NET OPC Data control and an OPCserver.

� The interconnection between a property of a process variable of the OPCserver (value, quality, timestamp) with a property of a display control (forexample, value, background color etc.).

The Data control configures the OPC server so that the assigned variables aremonitored permanently. If a value changes, the new value is passed to the Datacontrol and written to the other controls by the Data control.

The graphic illustrates the relationship between the SIMATIC NET OPC Datacontrol and other SIMATIC controls.

Figure 8-1 Connection between the SIMATIC NET OPC Data Control and Module for ProcessInterfacing

Page 359: Industrial Communication With PG-PC

Using the OPC Server

359SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.3 How Does Access with DCOM Work?

With the SIMATIC NET OPC Data control, you can connect your program with anOPC server on another computer.

Figure 8-2 Connecting an OPC Server with DCOM

Page 360: Industrial Communication With PG-PC

Using the OPC Server

360SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.4 How Are SIMATIC NET Controls Used in a DevelopmentEnvironment?

Before you can use SIMATIC NET Controls in a development environment, theymust be made known in the development environment.

Below, we will describe the procedure for Visual Basic. If you use a differentapplication, you will need to adapt the steps to your application.

1. Start Visual Basic and create a new project.

2. Open the Project menu and select the Components command.

The Components window opens. The Controls tab displays all the ActiveXcontrols available on your computer.

3. Select the SIMATIC NET Controls.

SIMATIC NET Controls

4. Click the OK button.

The Components window closes, the SIMATIC NET Controls have beeninserted in your development environment.

Page 361: Industrial Communication With PG-PC

Using the OPC Server

361SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.5 Configuring the SIMATIC NET OPC Data Control

The SIMATIC NET OPC Data Control establishes the connection between ActiveXcontrols and the OPC server.

The Data control has properties that you can set in container applications (forexample Visual Basic).

Figure 8-3 Data Control

How does it work?

You configure the SIMATIC NET OPC Data control in the following steps:

� Open the Properties window for SIMATIC NET OPC Data Control

� Select OPC server

� There are two ways to continue from here:

� Connect the properties of display controls with the properties of the OPCprocess variables

� Assign OPC Process Variables to Events and to the Programmed Handlingof Change Messages

� Optional Tasks

Creating a Program

The SIMATIC NET OPC Data control is visible as an icon in the design phase. TheData control then only communicates with the OPC server to query the OPC namespace when the OPC server is available locally or on the target computer and isoperable.

The SIMATIC NET OPC Data control can be configured in the Property Pageswindow.

Program Execution

When the created program is running, the SIMATIC NET OPC Data control worksin the background. For the user of the application, it is not visible.

Page 362: Industrial Communication With PG-PC

Using the OPC Server

362SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.6 Opening the Properties Window for SIMATIC NET OPC DataControl

You configure the SIMATIC NET OPC Data control in the Properties Pageswindow that you open from your container application.

Below, we will describe the procedure for Visual Basic. If you use a differentapplication, you will need to adapt the steps to your application.

1. Click on the Data control with the right mouse button.

The context-sensitive menu opens.

2. Select the Properties menu.

The Property Pages window opens.

8.1.7 Selecting the OPC Server

The SIMATIC NET OPC Data control as an OPC client for the OPC Data Access2.0 interface can use any OPC server. The OPC server can be local or can beaccessed on a remote computer over the network.

1. Select the OPC server tab in the Property Pages window.

2. Enter the name of the OPC server in the “Server” field, for exampleOPC.SimaticNET.

You can also select the OPC server using the Browse button.

3. If you want to connect to an OPC server over a network using DCOM, enter thename of the target computer in the Computer box.

In this case, all the computers must be configured for DCOM.

4. Click the OK button.

Your settings are saved.

Page 363: Industrial Communication With PG-PC

Using the OPC Server

363SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.8 Connecting Display Controls and Process Variables

You can connect the properties of display controls with the properties of the OPCprocess variables.By configuring a connection between the display and the process variable, the dataof the variable is displayed while the program is running.

How does it work?

You connect display controls as shown below:

Select the property of a control for displaying or entering process information

You can also perform the following optional tasks:

� Delete the assignment of a property to a variable

� Filter the properties of an ActiveX control

� Configure general properties

Select the Property of a Control for Displaying or Entering Process Information

To be able to display or enter process data, you must connect the property ofanother ActiveX control with a property of an OPC variable via the SIMATIC NETOPC Data control.The properties of an OPC variable are value, quality, and timestamp.

Examples

� The Text property of a text box of Visual Basic is connected to the value ofmemory word 5.

The text box then displays the content of memory word 5.

� The BackColor property of the SIMATIC Number control is interconnected withthe quality of memory word 5. The color codes green, red, and yellow areassigned to the quality states GOOD, BAD and UNCERTAIN.

The background color of the Number control changes when the quality of theprocess variable changes, for example due to a wire break.

Page 364: Industrial Communication With PG-PC

Using the OPC Server

364SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

How to Select a Property of a Display Control

1. Select the Items tab in the Property Pages window.

2. Click the Assign New button.

The Assign Items window opens.

3. In the Controls list box, select the properties of the control you require.

4. Select the property you want to connect to a process variable.

5. From the upper box that displays the name space of the server, select theprocess variable you want to connect with the selected property.

The ItemID of the selected variable appears in the Assigned Item box.

You can also enter an ItemID directly in this box.

6. Specify the property of the OPC items that will be used for visualization.

The available options are as follows:

Page 365: Industrial Communication With PG-PC

Using the OPC Server

365SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Property of the Process Va-riable

Meaning

Value The value of the process variable willbe connected to the selected ActiveXcontrol property.

Timestamp The timestamp of the process varia-ble will be connected to the selectedActiveX control property.

The timestamp is transferred as astring. You can specify the format inwhich the timestamp is displayed.

Quality The quality of the process variable willbe connected to the selected ActiveXcontrol property.

You can specify which value is usedfor the quality. You can, for example,select a color code or a meaningfultext.

7. Repeat steps 3 through 6 until you have assigned all the required properties.

8. Click the OK button.

The Assign Items window closes.

The values of the selected properties are now set by the process variables.

8.1.9 Assigning an Event to a Process Variable

You can assign process variables to events. If the variable changes during runtime,the Data control generates an event whose parameter contains the event name.Your program can react to the event and therefore to the change in the variable.

Page 366: Industrial Communication With PG-PC

Using the OPC Server

366SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Assigning an Event to a Process Variable

You can configure events generated by the Data control by assigning a processvariable to each event.

1. Select the Events tab in the Property Pages window.

2. Select the Add... button.

The Add Events window opens.

3. Enter a name for the event in the User ID field.

4. From the upper box that displays the name space of the server, select theprocess variable you want to connect with the selected event.

The ItemID of the selected variable appears in the Item ID box.

You can also enter an ItemID directly in this box.

5. Click the Add... button.

The process variable is assigned to the event.

6. Repeat steps 4 through 7 until you have assigned all the required events.

7. Click the OK button.

The Add Events window closes.

Note

To be able to react to events configured as shown above in your program, youmust implement the ValueChanged method of the Data control.

Page 367: Industrial Communication With PG-PC

Using the OPC Server

367SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.10 Optional Tasks

As an option, you can also perform the following tasks on the Data control:

Delete the Assignment of a Property to a Variable

You can delete the assignment of a property to a variable in two ways:

� You delete the ActiveX control in the container application.

� You delete the assignment in the Property Pages window.

If you delete the display ActiveX control in the container application, the connectionremains configured in the Data control. The next time you insert a control in theapplication, this new control automatically receives the name of the deleted control.The configured connection properties of the deleted control are also adopted.

In the Property Pages window, you can remove the assignment completely.

1. Select the Items tab in the Property Pages window.

2. Click the Assign New button.

The Assign Items window opens.

3. Display the properties of the ActiveX control for which you want to delete theassignment.

4. Select the property whose assignment you want to delete.

5. Delete the value in Assigned Item.

The assignment of the process variable to the selected property is deleted.

6. Click the OK button.

The Assign Items window closes.

Note

You can only delete the connection when it is not used in the container application.

Page 368: Industrial Communication With PG-PC

Using the OPC Server

368SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Filter the Properties of an ActiveX Control

With a display control, you can edit selected properties only, for example Enabledor Value. To do this, you can filter the properties.

1. Select the Items tab in the Property Pages window.

2. Click the Assign New button.

The Assign Items window opens.

3. Select the Filter... button.

The Property Filter window opens.

4. Select the Add... button.

The Add window opens.

5. Specify the property to be selected.

6. Click the OK button.

The Add window closes.

7. In the Property Filter window, you can modify an entered property with theEdit button.

With the Delete button, you can delete a selected property from the filter.

8. Select the OK button.

The Property Filter window closes.

9. Select the Filter check box in the Assign Items window.

For all ActiveX controls, only the properties specified in the filter will now bedisplayed.

If you deactivate the Filter check box, all the properties will be displayed again.

Page 369: Industrial Communication With PG-PC

Using the OPC Server

369SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Configure General Properties

You can configure the following properties:

� Autoconnect (automatic connection)

If Autoconnect is activated, the data control is automatically connected to thevariables of the OPC server after configuration.

If Autoconnect is deactivated, the data control is only connected to the variablesas a result of instructions in the program code.

� AutoConnect Timeout

This property decides how many milliseconds the data control will wait afterconnecting to the OPC server before it writes data.

� Default Dead Band

This property decides how large changes must be before the OPC server writesa new value to the data control.

� Default Update Rate

This property specifies the time interval in milliseconds at which the OPC serverchecks the process variables for changes.

� Show Error Boxes

If Show Error Boxes is activated, standard error messages are displayed if usererrors occur.

SIMATIC Computing displays all error messages in English. If you want todisplay the messages in other languages, deactivate the Show Error Boxesoption and write an additional program for error messages.

1. Select the Options tab in the Property Pages window.

2. Enter the required values in the boxes.

3. Click the OK button.

You have now configured the properties.

Page 370: Industrial Communication With PG-PC

Using the OPC Server

370SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.11 Configuring a Button Control

With the Button control, you can create a button for working with Boolean processvariables. During runtime, the button control displays the variable state with itscolor and label. If you click this button during runtime, you can change the value ofthe Boolean process variable.

You connect the button with a process variable by assigning an OPC variable tothe Value property of the Button control.

With the Button control, there are two animation states:

� 0 or off

� 1 or on

Figure 8-4 Button Control

How does it work?

You can configure a Button control in the following steps:

Page 371: Industrial Communication With PG-PC

Using the OPC Server

371SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.12 Properties of the Button Control

The Button control has the following properties:

Pro-perty

Tab in theSiemens But-ton ControlPropertiesWindow

Brief Description Described in

Enabled General Specifies whether thecontrol passes onchanges to Value andtriggers events

Activating the But-ton Control

False-Caption

General Specifies the labelingof the control if Valuehas the value false, 0,or off

Specifying the Label

False-Color

Color Specifies the color ofthe control if Valuehas the value false, 0,or off

Specifying the Co-lor of the ButtonControl

Font Font Specifies the font forlabeling the control

Specifying theFont of the Label

True-Caption

General Specifies the labelingof the control if Valuehas the value true, 1or on

Specifying the La-bel

TrueCo-lor

Color Specifies the color ofthe control if Valuehas the value true, 1or on

Specifying the Co-lor of the ButtonControl

Value Value displayed or entered by the Buttoncontrol. This property is connected to aprocess variable via the Data control.

Connecting theButton Control withthe Process Data

Page 372: Industrial Communication With PG-PC

Using the OPC Server

372SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.13 Opening the Properties Window for the Button Control

You open the Property Pages window in the container application.

Here, we will show you the procedure in Visual Basic. If you use a differentapplication, you will need to adapt the steps accordingly.

1. Select the Button control you want to configure.

2. Right-click on the control.

The context-sensitive menu opens.

3. Select the Properties command.

The Property Pages window opens.

8.1.14 Specifying the Label

You can specify two different labels for the Button control:

� Label of the button when the bit has the value true, 1 or on.

� Label of the button when the bit has the value false, 0 or off.

1. Select the General tab in the Property Pages window.

2. Enter the label that the button will display when the bit has the value true, 1 oron in the TrueCaption box.

3. Enter the label that the button will display when the bit has the value false, 0 oroff in the FalseCaption box.

Page 373: Industrial Communication With PG-PC

Using the OPC Server

373SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.15 Specifying the Font of the Label

You can make the following settings for the font of the Button control:

� Font

� Font size

� Effects

1. Select the Font tab in the Property Pages window.

2. Select the font for the label in the Font list box.

3. Select the font size in the Size list box. You can also overwrite the displayedvalues.

4. Select the required effects in the Effects list box.

A sample text reflecting the settings you have made it is displayed in the Sample Text box.

8.1.16 Specifying the Color of the Button Control

You can specify colors for the two states of the Button control by selecting a colorfrom the color palette or defining a color yourself.

1. Select the Color tab in the Property Pages window.

2. If you want to define the off state, select FalseColor in the Properties box. Ifyou want to define the on state, select TrueColor.

3. Select the color palette you want to use in the Color Set list box.

The colors of the selected color palette appear in the Color Palette box.

You can define your own colors by clicking the Edit Custom Color... button.

4. Select the required color.

Page 374: Industrial Communication With PG-PC

Using the OPC Server

374SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.17 Activating the Button Control

As default, the Button control is activated following configuration. You candeactivate or reactivate the Button control in the Siemens Button ControlProperties window at any time:

1. Select the General tab in the Siemens Button Control Properties window.

The Button control is activated when the Enable check box is selected.

The Button control is deactivated when the check box is not selected.

2. If necessary, change the selection.

8.1.18 Connecting the Button Control with the Process Data

If you want to display or modify the value of a process variable with the Buttoncontrol, you connect the Value property of the Button control with a processvariable in the SIMATIC NET OPC Data control.

The Value property of the Button control can only be assigned to a bit. If variableswith data types other than Boolean are used, the values of the variables will beconverted to a Boolean value when possible by the OPC server.

Figure 8-5 Connecting the Button Control with the Process Data

Page 375: Industrial Communication With PG-PC

Using the OPC Server

375SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

After you have assigned a variable to the Button control, the control can accessprocess data. If you change the value displayed by the control, you also changethe value in the real process at the same time.

Changing process data can trigger unexpected reactions in the process that canlead to serious injury to persons or damage to equipment. Always install a physicalemergency stop circuit for the machine or process.

8.1.19 Configuring a Number Control

With the number control, you can display and modify process data in numericformat.

Figure 8-6 Number Control

During runtime, the value of the variable is displayed in the display area. Here, youcan enter a new value. Depending on the configuration, newly entered values aremodified immediately or only after clicking the button for input to the OPC server.

How does it work?

You can configure a number control in the following steps:

Page 376: Industrial Communication With PG-PC

Using the OPC Server

376SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.20 Properties and Methods of the Number Control

The Number control has the following properties and methods:

Property or Method

Tab in theSiemensNumberControl Pro-perties Win-dow

Brief Description

Described in

Alignment General Specifies thealignment of va-lues displayed inthe Number con-trol

Defining DataDisplay

Appearance Style Specifies three-or two-dimensio-nal display ofthe control

Specifying theAppearance

BackColor Color Specifies thebackground co-lor

Specifying theColor of theNumber Control

BorderStyle Style Specifies the ap-pearance of thecontrol borders

Specifying theAppearance

Captionn Label Specifies thedisplayed text ofthe first (n=1) orsecond (n=2)title

Specifying theLabel

CaptionnAlign-ment

Label Specifies thealignment of thefirst or secondtitle

Specifying theLabel

CaptionnBack-Color

Color Specifies thebackground co-lor of the first orsecond title

Specifying theColor of theNumber Control

CaptionFont Font Specifies thefont of the twotitles

Specifying theFont of the La-bel

CaptionnFore-Color

Color Specifies the fo-reground colorof the first or se-cond title

Specifying theColor of theNumber Control

Page 377: Industrial Communication With PG-PC

Using the OPC Server

377SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Property or Method

Described inBrief Description

Tab in theSiemensNumberControl Pro-perties Win-dow

CaptionnSize Label Specifies thefont size of thefirst or secondtitle

Specifying theLabel

ConvertedValue read-only Specifies the va-lue of the pro-cess variable

DataType General Specifies thedata type to beused for theconverted va-lues

Defining DataDisplay

Enabled Style Specifies whe-ther the controlpasses on chan-ges to Valueand triggersevents

Activating aNumber Control

Factor Scaling Specifies thescaling factor tobe used if thescale-by-for-mula option wasenabled

Specifying theScaling for theDisplay

Font Font Specifies thefont of the con-trol

Specifying theFont of the La-bel

ForeColor Color Specifies the fo-reground colorof the control

Specifying theColor of theNumber Control

LayoutType Label Specifies thelayout of the dis-played label

Specifying theLabel

Page 378: Industrial Communication With PG-PC

Using the OPC Server

378SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Property or Method

Described inBrief Description

Tab in theSiemensNumberControl Pro-perties Win-dow

LimitCheck General Specifies whe-ther or not thevalue should bewithin specific li-mits and definesthe range of vali-dity within the li-mit values

Defining DataDisplay

Locked Style Sets the read-only status

Activating aNumber Control

LowerLimit General Specifies the lo-wer limit valuefor access

Defining DataDisplay

Offset Scaling Specifies theoffset to beused with thescale-by-for-mula option

Specifying theScaling for theDisplay

Precision General Specifies theprecision of realnumbers

Defining DataDisplay

Radix General Specifies thebase for thenumber to bedisplayed: bi-nary, octal, deci-mal, or hexade-cimal

Defining DataDisplay

RangeRawMax Scaling Specifies themaximum valueof the sourcerange

Specifying theScaling for theDisplay

RangeRawMin Scaling Specifies the mi-nimum value ofthe sourcerange

Specifying theScaling for theDisplay

RangeScaled-Max

Scaling Specifies themaximum valueof the targetrange

Specifying theScaling for theDisplay

Page 379: Industrial Communication With PG-PC

Using the OPC Server

379SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Property or Method

Described inBrief Description

Tab in theSiemensNumberControl Pro-perties Win-dow

RangeScaled-Min

Scaling Specifies the mi-nimum value ofthe target range

Specifying theScaling for theDisplay

ScaleMode Scaling Specifies thescaling modeused to scalethe values

Specifying theScaling for theDisplay

ShowButtons General Specifies whe-ther or not thebuttons for ente-ring and deletingvalues are dis-played

Defining DataDisplay

ShowErrorBo-xes

General Specifies whe-ther or not thestandard errormessage is dis-played if a usererror occurs

Defining DataDisplay

UpperLimit General Specifies the up-per limit valuefor access

Defining DataDisplay

Value Value displayed by the Numbercontrol. This property is connectedto a process variable via the Datacontrol.

Connecting Dis-play Controlsand Process Va-riables

Write Writes the valueof Converted-Value to Value

Page 380: Industrial Communication With PG-PC

Using the OPC Server

380SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Property or Method

Described inBrief Description

Tab in theSiemensNumberControl Pro-perties Win-dow

WriteMode Style Specifies whe-ther new valuesare written auto-matically moremanually

Specifying theAppearance

ZeroPad General Specifies whetherthe numberdisplayed by thecontrol is paddedfrom the left withleading zeros untilthe maximumsize of the datatype is reached

Defining DataDisplay

8.1.21 Opening the Properties Window for the Number Control

You open the Property Pages window in the container application.

Here, we will show you the procedure in Visual Basic. If you use a differentapplication, you will need to adapt the steps accordingly.

1. Select the Number control you want to configure.

2. Right-click on the control.

The context-sensitive menu opens.

3. Select the Properties command.

The Property Pages window opens.

Page 381: Industrial Communication With PG-PC

Using the OPC Server

381SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.22 Defining Data Display

You can specify how the Number control displays the values of process variables.You can specify the following:

� Size and appearance of the data.

A table shows the size of the data types for the Number control.

Data Type Grade Size Description

Boolean 0 1 bit Boolean value

Byte 1 1 byte Unsigned singlebyte value

Word 2 2 bytes Unsigned two-byte value

Integer 3 2 bytes Signed two-byteinteger value

Double word 4 4 bytes Unsigned four-byte value

Double integer 5 4 bytes Signed four-bytevalue

Real 6 4 bytes Signed four-byteinteger value

� Specifies whether the value is displayed in binary, octal, decimal, orhexadecimal.

� Number of decimal places for real data types.

� Values displayed left-aligned, right-aligned, or centered in the Number control.

� Limit values.

� Display of leading zeros.

� Display of buttons for entering and deleting values.

� Display of error messages.

Page 382: Industrial Communication With PG-PC

Using the OPC Server

382SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

1. Select the General tab in the Property Pages window.

2. Select the data type in the Data type box. Select the data type to match thedata type of the process variable.

3. In the Radix box, select whether the value will be displayed in binary, decimal,octal, or hexadecimal.

4. If you have selected Real in the Data type box, enter the number of decimalplaces in the Precision box.

If you do not make an entry, the value 3 is set.

5. Using the Alignment buttons, decide whether the value will be displayedright-aligned, left-aligned or centered in the Number control.

6. If you want to display leading zeros, select the Zero Pad box.

As default, the box is not selected.

7. If you want to display the buttons for entering and deleting values, select theShow Buttons box.

If you display the buttons, you must confirm every new entry during runtime.

If you click the entry button, the value will be written to the OPC server.

If you click the delete button, the new value is deleted and replaced by theprevious value.

As default, the box is not selected.

If you have defined the buttons, you can use the following keys as alternativesduring runtime:

Button Key

Entry

Return key

Delete

Escape key

8. If you want to display standard error messages during runtime, select the ShowError Boxes box.

As default, the box is selected.

Page 383: Industrial Communication With PG-PC

Using the OPC Server

383SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.23 Specifying the Appearance

You can decide how the Number control appears:

� Two- or three-dimensional appearance

� Border of the control

� Whether changes to Value are automatically written to the OPC processvariable or by program code using Write

1. Select the Style tab in the Property Pages window.

2. Choose whether the control has a two- or three-dimensional appearance in theAppearance list box.

You can only set a three-dimensional appearance if the value Fixed Single isselected in the Border Style list box.

3. In the Border Style list box, you can select between a rectangular border or noborder for the control.

4. In the Write Mode list box, you decide whether the values of the Numbercontrol are written to the process variable automatically or by the program.

8.1.24 Specifying the Label

You can specify the label for the Number control:

� Horizontal or vertical alignment of the label

� Horizontal Alignment

Page 384: Industrial Communication With PG-PC

Using the OPC Server

384SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Vertical Alignment

� Left-aligned, right-aligned, or centered

� Width or height of the label

� Text for the label

� Color of the label

You specify the color in the Color tab.

� Font of the label

You specify the font for the label in the Font tab.

1. Select the Label tab in the Property Pages window.

2. In the Layout Type box, you can choose between horizontal and verticalalignment of the label.

3. If necessary, you can specify the width and height of the Number control in theSize 1 and Size 2 boxes.

If you have selected horizontal alignment, you specify the width of the Numbercontrol with the length of the first and second caption. If you have selectedvertical alignment, you specify the height of the Number control with the heightof the first and second caption.

As default, the value 1 is set. In this case, the size of the label is automaticallyadapted to the length of the text and the size of the font for the captions.

If, however, you want to set up several number controls, it is a good idea tospecify the size so that the number controls have a uniform appearance.

In this case, you enter the size of the captions in twips. A twip is approximately0.018 mm or 567 twips are 1 centimeter on the screen.

4. Enter the text for the first and second captions in the Caption 1 and Caption 2text boxes.

5. With the alignment buttons, you can specify whether the first and secondcaptions are left-aligned, right-aligned, or centered.

Page 385: Industrial Communication With PG-PC

Using the OPC Server

385SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.25 Specifying the Scaling for the Display

You can specify a scale for displaying the process variables with the numbercontrol. With the scaling function, the range of values of the process variables isconverted to a range for display. The scaling factor is used at runtime both forreading and writing the values.

You can select the following scaling options:

� No scaling

� Scale by formula

� Scale by range

1. Select the Scaling tab in the Property Pages window.

2. Select the scaling option in the Scale mode list box.

As default, No scaling is set.

3. If you have selected Scale by formula in the Scale mode box, you must alsoenter the formula.

Enter a scaling factor in the Scale box.

Enter a constant in the Offset box that will be added to the scaled result beforethis is displayed.

The scaled value is then calculated according to the following formula:

(PLC value x Scale) + Offset = Display

PLC value

Valu of the process variable

Scale

Scaling factor

Offset

Constant part

Display

Value displayed in the number control

4. If you have selected the value Scale by range transformation in the Scalemode box, you must specify an upper and lower limit for the value of theprocess variable and the value that will be displayed in the Number control.

Page 386: Industrial Communication With PG-PC

Using the OPC Server

386SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.26 Specifying the Font of the Label

You can make the following settings for the font of the Number control:

� Font

� Font size

� Effects

1. Select the Font tab in the Property Pages window.

2. Select the font for the label in the Font list box.

3. Select the font size in the Size box or overwrite the displayed value.

4. Select the required effects in the Effects list box.

A sample text reflecting the settings you have made it is displayed in the Sample Text box.

8.1.27 Specifying the Color of the Number Control

You can specify the following colors:

� Background and foreground color of the control

� Background and foreground color for the first and second title

You can select colors from a color palette or define them yourself.

1. Select the Color tab in the Property Pages window.

2. Select the entry in the list for which you want to define the color.

3. Select the color palette you want to use in the Color Set list box.

The colors of the selected color palette are displayed in the Color Palette box.

If you want to define your own Colors, click the Edit Custom Color... button.

4. Select the required color.

Page 387: Industrial Communication With PG-PC

Using the OPC Server

387SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.28 Activating the Number Control

As default, the Number control is activated following configuration and accessesthe process variable. You can deactivate or reactivate the Number control in theProperty Pages at any time:

1. Select the Style tab in the Property Pages window.

The Number control is activated when the Enabled check box is selected.Otherwise it is deactivated.

2. If necessary, change the selection.

3. If you want access to the process variables of the process interfacing module tobe read-only, select the Locked check box.

As default, the option is not activated.

8.1.29 Connecting the Number Control with the Process Data

If you want to display numeric process values or want to enter values, you mustconnect the Value property of the Number control in the SIMATIC NET OPC Datacontrol with a process variable.

You can also connect the BackColor property with the quality of a processvariable. In this case, the background color of the Number control shows thevalidity of the displayed value.

Figure 8-7 Connecting the Number Control with the Process Data

Page 388: Industrial Communication With PG-PC

Using the OPC Server

388SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

After you have assigned a variable to the Number control, the control can accessprocess data. If you change the value displayed by the control, you also changethe value in the real process at the same time.

Changing process data can trigger unexpected reactions in the process that canlead to serious injury to persons or damage to equipment. Always install a physicalemergency stop circuit for the machine or process.

8.1.30 Configuring a Slider Control

Using the Slider control, you can display and modify process data using a slider.When you move the slider, the process values change. As soon as thecorresponding variable changes, the slider adjusts its position automatically.

Figure 8-8 Slider Control

How does it work?

You can configure a slider control in the following steps:

8.1.31 Properties of the Slider Control

The Slider control has the following properties:

Property Tab in the Sie-mens SliderControl Proper-ties Window

Brief Descrip-tion

Described in

Direction General Specifies the di-rection: horizon-tal or vertical

Defining DataDisplay

Enabled General Specifies whe-ther or not thecontrol reacts tochanges in thevalue properties

Activating a Sli-der Control

Page 389: Industrial Communication With PG-PC

Using the OPC Server

389SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Property Described inBrief Descrip-tion

Tab in the Sie-mens SliderControl Proper-ties Window

LargeChange General Specifies howfar the slidermoves when thecontrol is activa-ted and youpress the pageup or page downkey

Defining DataDisplay

Max General Specifies the va-lue of the hig-hest position ofthe slider

Defining DataDisplay

Min General Specifies the va-lue of the lowestposition of theslider

Defining DataDisplay

SmallChange General Specifies howfar the slidermoves when thecontrol is activa-ted and youpress the up/down or right/leftarrow keys

Defining DataDisplay

Ticks General Specifies thenumber of ticks(scale marks)

Defining DataDisplay

Value Value set or displayed by the Slidercontrol. This property is connected toa process variable via the Data con-trol.

Connecting theSlider Controlwith the ProcessData

Page 390: Industrial Communication With PG-PC

Using the OPC Server

390SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.32 Opening the Properties Window for the Slider Control

You open the Property Pages window in the container application.

Here, we will show you the procedure in Visual Basic. If you use a differentapplication, you will need to adapt the steps accordingly.

1. Select the Slider control you want to configure.

2. Right-click on the control.

The context-sensitive menu opens.

3. Select the Properties command.

The Property Pages window opens.

8.1.33 Defining Data Display

You can specify how the Slider control displays the values of process variables.

� xHorizontal or vertical alignment of the control

Horizontal Alignment

Vertical Alignment

� Scale division between the minimum and maximum value

� Minimum and maximum displayed value

� Movement of the slider with the arrow keys

� Whether the minimum and maximum value are displayed

Page 391: Industrial Communication With PG-PC

Using the OPC Server

391SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

1. Open the Property Pages window.

2. In the Direction boxes, specify whether the Slider control should be alignedhorizontally or vertically.

3. If you want the Slider control to display the minimum and maximum value,select the Show Min and Max Value box.

4. In the Ticks box, specify the number of intermediate values between theminimum and maximum value. The intermediate values are shown as shortscale marks at runtime. The slider can only be moved to these marks.

5. Enter the minimum value and maximum value in the Min and Max boxes.

6. Enter how far the slider will move during runtime when the arrow keys or pageup and page down keys are pressed in the SmallChange and LargeChangeboxes.

8.1.34 Activating a Slider Control

As default, the Slider control is activated following configuration. You candeactivate or reactivate the Slider control in the Property Pages window at anytime:

1. Open the Property Pages window.

The slider control is activated when the Enable check box is selected.Otherwise it is deactivated.

2. If necessary, change the selection.

Page 392: Industrial Communication With PG-PC

Using the OPC Server

392SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.35 Connecting the Slider Control with the Process Data

If you want to display or modify the value of a process variable with the Slidercontrol, you connect the Value property of the Slider control with a processvariable in the SIMATIC NET OPC Data control.

Figure 8-9 Connecting the Slider Control with the Process Data

Note

After you have assigned a variable to the Slider control, the control can accessprocess data. If you change the value displayed by the control, you also changethe value in the real process at the same time.

Changing process data can trigger unexpected reactions in the process that canlead to serious injury to persons or damage to equipment. Always install a physicalemergency stop circuit for the machine or process.

8.1.36 Using Other ActiveX Controls

The SIMATIC NET OPC Data control can also be used with controls from othervendors or ActiveX controls you have developed yourself.

Your own ActiveX controls and controls from other vendors must provide a numberof methods that can react to the changes of the assigned variables.

As the container application, you can, for example, use Visual Basic. If you use adifferent container application, this must meet the requirements for ExtendedControls. Otherwise, you will need to enter program code that executes thesefunctions.

Page 393: Industrial Communication With PG-PC

Using the OPC Server

393SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.37 What Are the Guidelines for Container Applications?

Extended Controls

For the SIMATIC NET OPC Data control to work with a container application, theapplication must support the Data control function Property Browsing. Thecontainer application must also support the functions for extended controls as isthe case with the container applications from Microsoft.

An extended control is a subcontrol that contains another control to supportcontainer-specific properties, methods, and events. For more detailed information,read the Microsoft online help.

Properties and Methods for Extended Controls

To use the functions of the extended controls, the container application mustsupport the following methods:

� IOleClientSize::GetContainer

� IOleContainer::EnumObjects

� IOleControlSite::GetExtendedControl

The application must also recognize the Name property.

Absence of Extended Controls

Visual Basic supports extended controls. Container applications of other vendorsmay not support extended controls (for example, Borland’s Delphi Version 3.0).

If your container application does not support extended controls, you must write aprogram to handle the missing functions. The Siemens Customer Support Centerwill be happy to advise you on your specific container application. The SupportCenter will provide you with sample programs containing the additional functions.

8.1.38 What Are the Guidelines for ActiveX Controls?

You can create your own ActiveX controls and use these with the Data control fromSIMATIC. The created control must provide one property that corresponds to theValue property of the SIMATIC controls.

Page 394: Industrial Communication With PG-PC

Using the OPC Server

394SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.39 How Does the Data Control Read Data?

If the container application supports extended controls, the Data control will findyour newly created ActiveX control and its properties automatically.

Otherwise, assign the process variables to the property corresponding to Value (asnormal in the Items tab of the Property Pages) window. If the value of the variablein the module for process interfacing changes, the Data control automaticallyadapts the value of the property of the control used.

The control you develop yourself should have a subroutine for handling the data ofthe Data control.

8.1.40 How Is Data Written to the Data Control?

If you have developed your own ActiveX control, you will need a subroutine forhandling data.

The following example shows a subroutine for reading and writing the change tovalue of a property.

Visual Basic Code

Public Property Get Value() As Long Value = Object1.ValueEnd Property

Public Property Let Value(ByVal New_Value As Long) Object1.Value() = New_Value PropertyChanged “Value”End Property

Private Sub Value_Change() PropertyChanged “Value”End Sub

Page 395: Industrial Communication With PG-PC

Using the OPC Server

395SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.41 Properties and Methods of the SIMATIC Controls

Refer to this section if you require more detailed information on the properties andmethods of the SIMATIC Controls.

The following properties and methods exist with the SIMATIC Controls:

This property or method has the following function

Activated Specifies whether or not all intercon-nections are active

AddNotification Adds an event to the event table ofthe OPC Data control. When the va-riable passed with the call changes, afunction is called.

Alignment Specifies the alignment of parameters

Appearance Specifies the appearance of a control

AutoConnect Specifies whether the configured con-nections exist automatically duringruntime

AutoConnectTimeout Specifies the timeout value

BackColor Specifies the background color of anobject

BorderStyle Specifies whether or not an object isdisplayed with a rectangular border

Captionn Specifies the text of the first and se-cond title

CaptionnAlignment Specifies the alignment of the firstand second title

CaptionnBackColor Specifies the background colors of thetitles

CaptionnFont Specifies the font of the titles

CaptionnForeColor Specifies the foreground color of thetitles

CaptionnSize Specifies the width of the titles

Connect Establishes all configured connections

ConvertedValue Specifies the value for the Value pro-perty converted according to the sca-ling formula

DataType Specifies the data type for convertedvalues

DefaultDeadband Specifies the deadband used by theOPC server

Page 396: Industrial Communication With PG-PC

Using the OPC Server

396SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

This property or method has the following function

DefaultUpdateRate Specifies the update rate used by theSIMATIC Data control if no updaterate is defined

Direction Specifies the direction (horizontal orvertical)

Disconnect Disconnects all established connec-tions

Enabled Specifies whether or not the controlreacts to changes to the Value pro-perty

Factor Specifies the scaling factor if thescale-by-formula option was selec-ted

FalseCaption Specifies the text displayed in thecontrol if the Value property is set toFalse

FalseColor Specifies the color of the control if theValue property is set to False

Font Specifies the font

ForeColor Specifies the text color

GetItemProperties Returns the values of the propertiesof an OPC items specified at the me-thod call

LargeChange Specifies how far the slider of thecontrol moves when the control hasthe focus and the page up or pagedown key is pressed

LayoutType Specifies the layout of the titles in thedisplay part of the control

LimitCheck Specifies whether or not the valuerange of an entered value is checked

Locked Specifies that the control is permittedread access only

LowerLimit Specifies the lower limit value writtento the OPC server and returned bythe OPC server

Max Specifies the maximum value of theslider

Min Specifies the minimum value of theslider

Page 397: Industrial Communication With PG-PC

Using the OPC Server

397SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

This property or method has the following function

NodeName Specifies the network identification ofa remote computer (for connectionusing DCOM).

Offset Specifies the offset if the scale-by-formula option was selected.

Precision Specifies the precision of a number

QueryAvailableItemProperties Returns a list of all OPC propertiesincluding the description of the pro-perties of an OPC item.

Radix Specifies the base (binary, octal, deci-mal, or hexadecimal) for the numberto be displayed

RangeRawMax Specifies the maximum value of thesource range

RangeRawMin Specifies the minimum value of thesource range

RangeScaledMax Specifies the maximum value of thetarget range

RangeScaledMin Specifies the minimum value of thetarget range

ReadMultiVariables Reads the values of the specifiedOPC items from the partner device

ReadVariable Reads the value of a variable of theOPC server from the partner device

ScaleMode Specifies the scaling mode used toscale the values

ServerName Specifies the OPC server for processinterfacing

ShowButtons Specifies whether or not the buttonsfor entering and deleting are displayedfor the control

ShowErrorBoxes Specifies whether or not error messa-ges are displayed if a user-specific er-ror occurred

SmallChange Specifies how far the slider of thecontrol moves when the control hasthe focus and the up/down or right/leftarrow keys are pressed

Ticks Specifies the number of ticks or scalemarks of the control

TrueCaption Specifies the text displayed in thecontrol if the Value property is set toTrue

Page 398: Industrial Communication With PG-PC

Using the OPC Server

398SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

This property or method has the following function

TrueColor Specifies the color of the control if theValue property is set to True

UpperLimit Specifies the upper limit for value writ-ten to the OPC server

Value Connects the SIMATIC NET OPCData control with the OPC server

Write Writes the value of the ConvertedVa-lue property to the Value property

WriteMode Specifies how the control respondswhen the user enters a new value

WriteMultiVariables Writes new values to multiple varia-bles on the OPC server

WriteVariable Writes a new value to a specific varia-ble on the OPC server

ZeroPad Specifies whether the number dis-played by the control is padded fromthe left with leading zeros until themaximum size of the data type is re-ached

8.1.42 Activated

SIMATIC NET OPC Data Control

Activates or deactivates all interconnections with process variables. If the SIMATIC NET OPC Data Control is deactivated, the transfer of databetween display controls and SIMATIC OPC Data Control is deactivated.

Syntax

object.Activated [= value]

Page 399: Industrial Communication With PG-PC

Using the OPC Server

399SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

Boolean expression that specifies whether the object can react to eventsgenerated by the user.

The available options are as follows:

True All connections are activated (default).

False All connections are deactivated.

If you do not specify Activated all interconnections with process variables areactivated.

Note

The connections to process variables remain established even if they aredeactivated.

8.1.43 Alignment

SIMATIC Number Control

Specifies the alignment of the number displayed in the number control.

Syntax

object.Alignment [= value]

Page 400: Industrial Communication With PG-PC

Using the OPC Server

400SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

A value or a constant that specifies the alignment.

The available options are as follows:

0 or Left The number is aligned left in the box (default).

1 or Right The number is aligned right in the box.

2 or Center The number is centered in the box.

If you do not specify Alignment the number is aligned left in the box.

8.1.44 Appearance

SIMATIC Number Control

Specifies whether or not the number control is displayed with 3D effects.

Syntax

object.Appearance [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Value or constant that specifies the appearance of the control.

The available options are as follows:

0 or Flat The control is displayed without 3D effects.

1 or ThreeD The control is displayed with 3D effects (default).

Note

Appearance only has any effect when BorderStyle is set to FixedSingle.

Page 401: Industrial Communication With PG-PC

Using the OPC Server

401SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.45 AutoConnect

SIMATIC NET OPC Data Control

Specifies whether or not the configured interconnections to the OPC server areestablished automatically at runtime.

Syntax

object.AutoConnect [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

Boolean expression that specifies whether the object can react to eventsgenerated by the user.

The available options are as follows:

True All configured interconnections are established automaticallyat runtime (default).

False The interconnections are established only after the Connectmethod call.

If you do not specify AutoConnect, all interconnections are establishedautomatically at runtime.

8.1.46 AutoConnectTimeout

SIMATIC NET OPC Data Control

Specifies a timeout.

If the AutoConnect property is set to True, the SIMATIC NET OPC data controlcalls the Connect method after the specified time.

Syntax

object.AutoConnectTimeout [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

Value of the type long for the timeout.

Page 402: Industrial Communication With PG-PC

Using the OPC Server

402SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.47 BackColor

SIMATIC Number Control

Specifies the background color of the number control.

Syntax

object.BackColor [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Value or constant that specifies the background color of an object.

The available options are as follows:

Standard Colors Selection of colors using the RGB colorpalette.

Windows System Colors Selection of colors using system colors.The system colors depend on thecontainer.

8.1.48 BorderStyle

SIMATIC Number Control

Specifies whether or not the number control has a border.

Syntax

object.BorderStyle [= value]

Page 403: Industrial Communication With PG-PC

Using the OPC Server

403SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

Value or constant that specifies whether or not a border is used.

The available options are as follows:

0 or None No border.

1 or FixedSingle A border with a single line.

If you do not specify BorderStyle, the object does not have a border.

8.1.49 Captionn

SIMATIC Number Control

Specifies the text for the title.

Syntax

First title:

object.Caption1 [= value]

Second title:

object.Caption2 [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

String with the text of the title.

8.1.50 CaptionnAlignment

SIMATIC Number Control

Specifies the alignment of titles.

Page 404: Industrial Communication With PG-PC

Using the OPC Server

404SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Syntax

First title:

object.Caption1Alignment [= value]

Second title:

object.Caption2Alignment [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or a constant that specifies the alignment of the titles.

The available options are as follows:

0 or Left The title is aligned left (default).

1 or Right The title is aligned right (default).

2 or Center The title is centered.

Page 405: Industrial Communication With PG-PC

Using the OPC Server

405SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.51 CaptionnBackColor

SIMATIC Number Control

Specifies the color of the background for the titles.

Syntax

First title:

object.Caption1BackColor [= value]

Second title:

object.Caption2BackColor [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or a constant that specifies the background color of the title.

The available options are as follows:

Standard Colors Selection of colors using the RGB colorpalette.

Windows System Colors Selection of colors using system colors.The system colors depend on thecontainer.

Page 406: Industrial Communication With PG-PC

Using the OPC Server

406SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.52 CaptionnFont

SIMATIC Number Control

Specifies the font for the first or second title.

Syntax

First title:

object.Caption1Font [= value]

Second title:

object.Caption2Font [= value]

Explanation

object

Describes an object in the assignment list and identifies a specific SIMATICcontrol.

value

Value or constant that specifies a font.Remember the options provided by your development environment for defining afont.

8.1.53 CaptionnForeColor

SIMATIC Number Control

Specifies the color of the font for the titles.

Syntax

First title:

object.Caption1ForeColor [= value]

Second title:

object.Caption2ForeColor [= value]

Page 407: Industrial Communication With PG-PC

Using the OPC Server

407SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

A value or a constant that specifies the foreground color of the title.

The available options are as follows:

Standard Colors Selection of colors using the RGB colorpalette.

Windows System Colors Selection of colors using system colors.The system colors depend on thecontainer.

8.1.54 CaptionnSize

SIMATIC Number Control

For the horizontal layout this specifies the width and for the vertical layout theheight of titles. The height and width are specified in twips.

Syntax

First title:

object.Caption1Size [= value]

Second title:

object.Caption2Size [= value]

Page 408: Industrial Communication With PG-PC

Using the OPC Server

408SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

Value or constant with which you can specify the font size of a caption.

Possible Values:

–1 Automatic (default)

>=1 Values in twips

If you do not specify CaptionnSize, the value –1 is assumed. In this case, the sizeof the box is calculated based on the space required by the text.

8.1.55 ConvertedValue

SIMATIC Number Control

Saves the scaled value of the Value property. ConvertedValue is alreadyconverted to the data type specified by the DataType property.

Syntax

object.ConvertedValue [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Value of the type variant that specifies the value of the control.

Note

If Enabled is set to false, the bidirectional connection between Value andConvertedValue is disabled. Changes to ConvertedValue are not applied to theValue property.

Page 409: Industrial Communication With PG-PC

Using the OPC Server

409SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.56 DataType

SIMATIC Number Control

Defines the data type for converted values.

If the data type used is too long to display, the value is truncated. The data typespecified in the SIMATIC number control must match the data type in theAssigned Variable box of the SIMATIC NET OPC data controls.

Syntax

object.DataType [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or a constant that specifies the data type.

The available options are as follows:

Data type Value Size Description

Boolean 0 1 bit Single bit value

Byte 1 1 byte Unsigned single-byte value

Word 2 2 bytes Unsigned two-byte value

Integer 3 2 bytes Signed two-byteinteger value

Double word 4 4 bytes Unsigned four-byte value (de-fault)

Double integer 5 4 bytes Signed four-byteinteger value

Real 6 4 bytes Signed four-bytereal (floating-point) value

Timers 7 2 bytes Unsigned two-byte value

Counter 8 2 bytes Unsigned two-byte value

If you do not specify DataType, the data type double word is used.

Page 410: Industrial Communication With PG-PC

Using the OPC Server

410SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

With DataType, you specify whether Precision has any effects.

If the length of the data returned by the data control is greater than the length ofthe data displayed in the corresponding SIMATIC control or the length of the OPCprocess variable is greater than the data range of the data type set in the numbercontrol, the value is shown with three dots (...). If you want to change this value,you must delete the three dots.

8.1.57 DefaultDeadband

SIMATIC NET OPC Data Control

Specifies the percentage deadband used by the SIMATIC NET OPC server.

If DefaultDeadband is defined, the OPC server reports changes to the values ofthe process variables to the OPC data control only when the value change isgreater than the specified percentage of the value range.

Syntax

object.DefaultDeadBand [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

Value of the type single. The value must not be negative.

Note

Before you can use DefaultDeadband, a value range must be defined for thevariables involved using the Symbol File Configurator. DefaultDeadband applies toall the variables connected to the SIMATIC NET OPC data control. If you usedifferent DefaultDeadbands in an application for different display controls, youmust use multiple SIMATIC NET OPC data controls with differentDefaultDeadbands and assign the display controls accordingly.

Page 411: Industrial Communication With PG-PC

Using the OPC Server

411SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.58 DefaultUpdateRate

SIMATIC NET OPC Data Control

Specifies the interval at which the data is updated by the OPC server.

Syntax

object.DefaultUpdateRate [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

Value of the type long.

The available options are as follows:

0 The minimum update rate defined by the OPC server is used.

> 0 All changes to the connected variables are passed on at theearliest after this interval.

Note

For SIMATIC NET, the smallest permitted update rate is 50 ms. TheDefaultUpdateRate applies to all the variables connected to the SIMATIC NETOPC data control. If you use different DefaultUpdateRates in an application fordifferent display controls, you must use multiple SIMATIC NET OPC data controlswith different DefaultUpdateRates and assign the display controls accordingly.

Page 412: Industrial Communication With PG-PC

Using the OPC Server

412SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.59 Direction

SIMATIC Slider Control

Specifies the direction of the slider control:

� horizontal

� vertical

Syntax

object.Direction [= value]

Explanations

object

An instance of the SIMATIC Slider control.

value

A value or a constant that specifies the orientation.

The available options are as follows:

0 Horizontal

1 Vertical

8.1.60 Enabled

SIMATIC Button Control

SIMATIC Number Control

SIMATIC Slider Control

Specifies whether or not the control reacts to changes to the Value property andthen sends events.

Syntax

object.Enabled [= value]

Page 413: Industrial Communication With PG-PC

Using the OPC Server

413SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

object

An instance of a SIMATIC display control.

value

Boolean expression specifying whether or not the object responds to eventsgenerated by the user.

The available options are as follows:

True Object reacts to events.

False Object does not react to events. The exception is the errorevent.

If you do not specify Enabled, the object reacts to events.

8.1.61 Factor

SIMATIC Number Control

Specifies the scaling used when the ScaleByFormula option is selected. Forscaling, not only scaling factor but also the Offset must be specified.

You can use a formula to scale the value:

(PLC Value * Scale) + Offset = displayed value

PLC Value is the value of Value when the control is connected to the OPC server.

Scale is the value of Factor.

Offset is the value of Offset.

Displayed value is the content of the Text property.

Syntax

object.Factor [= value]

Page 414: Industrial Communication With PG-PC

Using the OPC Server

414SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

Value of the type Float that specifies the factor for the scaling formula.

If you do not specify Factor, the value 1.0 is assumed.

Note

The ScaleMode property must be set to ScaleByFormula otherwise Factor has noeffect.

8.1.62 FalseCaption

SIMATIC Button Control

Decides the text displayed in the control if Value is set to False.

Syntax

object.FalseCaption [= value]

Explanations

object

An instance of the SIMATIC Button control.

value

String with the text to be displayed.

Page 415: Industrial Communication With PG-PC

Using the OPC Server

415SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.63 FalseColor

SIMATIC Button Control

Specifies the color of the control if Value is set to False.

Syntax

object.FalseColor [= value]

Explanations

object

An instance of the SIMATIC Button control.

value

Value or constant that specifies the foreground or background color of an object.

The available options are as follows:

Standard Colors Selection of colors using the RGB colorpalette.

Windows System Colors Selection of colors using system colors.The system colors depend on thecontainer.

Page 416: Industrial Communication With PG-PC

Using the OPC Server

416SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.64 Font

SIMATIC Button Control

SIMATIC Number Control

Specifies a font for the control.

Syntax

object.Font

Explanations

object

An instance of the SIMATIC Button control or an instance of the SIMATIC Numbercontrol.

8.1.65 ForeColor

SIMATIC Number Control

Specifies the foreground color for text.

Syntax

object.ForeColor [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or constant that specifies the foreground color of objects.

The available options are as follows:

Standard Colors Selection of colors using the RGB colorpalette.

Windows System Colors Selection of colors using system colors.The system colors depend on thecontainer.

Page 417: Industrial Communication With PG-PC

Using the OPC Server

417SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.66 LargeChange

SIMATIC Slider Control

Specifies how far the slider of the slider control moves when the arrows of theslider control are clicked with the cursor.

Syntax

object.LargeChange [= value]

Explanations

object

An instance of the SIMATIC Slider control.

value

A value or constant that specifies the size of the change.

Note

Value is increased by the value of LargeChange when the page up key is pressedor when you click on the top right of the slider. Value is reduced by the value ofLargeChange when the page down key is pressed or when you click on the bottomleft of the slider.

Page 418: Industrial Communication With PG-PC

Using the OPC Server

418SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.67 LayoutType

SIMATIC Number Control

Specifies how the captions of the control are arranged.

Syntax

object.LayoutType [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or constant that specifies the layout type.

The available options are as follows:

Horizontal (0) Places the first caption to the left and the second caption tothe right of the display part of the control.

Vertical (1) Places the first caption above and the second caption belowthe display part of the control.

If you do not specify LayoutType, the captions are placed to the left and right ofthe display part of the control.

8.1.68 LimitCheck

SIMATIC Number Control

Specifies whether or not the value range of an entered value is checked. The valuerange is specified with UpperLimit and LowerLimit.

The check determines whether or not a value supplied by the control is within thespecified limits. A value passed from the OPC server to the number control is notchecked.

If a value is entered that is outside the value range, the control does not write avalue to the Value property. In this case, a LimitCheckFailed event is sent.

Syntax

object.LimitCheck [= value]

Page 419: Industrial Communication With PG-PC

Using the OPC Server

419SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

A value or constant that specifies the type of limit value check.

The available options are as follows:

CheckNone or 0 The entry is not checked.

Lower or 1 Only the lower limit of the entry is checked.

Upper or 2 Only the higher limit of the entry is checked.

Both or 3 Both limits of the entry are checked.

If you do not specify LimitCheck, the entry is not checked.

Note

LimitCheck must be activated otherwise UpperLimit and LowerLimit have noeffect.

8.1.69 Locked

SIMATIC Number Control

Sets the control to the Read-only status. You cannot change any values but onlydisplay the current value.

Syntax

object.Locked [= value]

Page 420: Industrial Communication With PG-PC

Using the OPC Server

420SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

Boolean expression that specifies whether or not values can be changed.

The available options are as follows:

True The text in the control can be read and selected but notedited. The program can modify the text by changing Value.These changes are displayed.

False The text in the control can be edited.

If you do not specify Locked, you can enter values.

8.1.70 LowerLimit

SIMATIC Number Control

Specifies the lower limit value for values entered by the user. The value is checkedby LimitCheck.

If a value lower than the limit value is entered, the control does not write this valueto the Value property. In this case, a LimitCheckFailed event is sent.

Syntax

object.LowerLimit [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Value of the type Float that specifies the lower limit used for the limit value check.

Note

LimitCheck must be set to Lower or Both otherwise LowerLimit has no effect.

Page 421: Industrial Communication With PG-PC

Using the OPC Server

421SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.71 Max

SIMATIC Slider Control

Specifies the highest value of the slider of the SIMATIC control. If Value is greaterthan or equal to Max, the slider is at its extreme right or extreme top position.

Syntax

object.Max [= value]

Explanations

object

An instance of the SIMATIC Slider control.

value

A value or constant that specifies the highest displayed number.

8.1.72 Min

SIMATIC Slider Control

Specifies the lowest value of the slider of the SIMATIC control. If Value is less thanor equal to Min, the slider is at its extreme left or extreme bottom position.

Syntax

object.Min [= value]

Explanations

object

An instance of the SIMATIC Slider control.

value

A value or constant that specifies the lowest displayed number.

Page 422: Industrial Communication With PG-PC

Using the OPC Server

422SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.73 NodeName

SIMATIC NET OPC Data Control

Specifies the name of a remote computer on which the OPC server is running. Byspecifying a node name, a connection can be established over a network usingDCOM.

Syntax

object.Node [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

String that specifies the path or the identifier of a remote computer (PC) for theconnection.

8.1.74 Offset

SIMATIC Number Control

Specifies the offset used when the ScaleByFormula option is selected. Forscaling, not only the offset but also the Factor of the scaling factor must bespecified.

You can use a formula to scale the value:

(PLC Value * Scale) + Offset = displayed value

PLC Value is the value of Value when the control is connected to the OPC server.

Scale is the value of Factor.

Offset is the value of Offset.

Displayed value is the content of the Text property.

Syntax

object.Offset [= value]

Page 423: Industrial Communication With PG-PC

Using the OPC Server

423SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Number control.

value

Value of the type Float that specifies the offset for the scaling formula.

If you do not specify Offset, the value 0.0 is assumed.

Note

ScaleMode must be set to ScaleByFormula (1) otherwise Offset has no effect.

8.1.75 Precision

SIMATIC Number Control

This changes the precision; in other words, the number of decimal places. Thenumber is rounded after the specified decimal place.

Syntax

object.Precision [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value of the type Integer that specifies the precision of the number.

If you do not specify Precision, the value 3 is used.

Page 424: Industrial Communication With PG-PC

Using the OPC Server

424SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.76 Radix

SIMATIC Number Control

Defines the base of the number to be displayed:

� binary

� octal

� decimal

� hexadecimal

Each value must be entered in keeping with the specified base.

Syntax

object.Radix [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or constant that specifies the base of the value to be displayed.

The available options are as follows:

Binary or 0 Binary mode.Valid entries: 0 and 1

Octal or 1 Octal mode.Valid entries: 0 through 7

Decimal or 2 Decimal mode:Valid entries: 0 through 9, ’+’, ’–’ and ’.’)

Hexadecimal or 3 Hexadecimal mode:Valid entries: 0 through 9, a through fand A through F)

If you do not specify Radix , the value Decimal is used.

Page 425: Industrial Communication With PG-PC

Using the OPC Server

425SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.77 RangeRawMax

SIMATIC Number Control

Together with RangeRawMin , this specifies the range for raw values. Raw valuesare the values supplied directly by the OPC server. The range of raw values canbe recalculated into displayed values by the number control. The value range ofthe displayed values is defined by RangeScaledMin and RangeScaledMax.

RangeRawMax specifies the upper value of the raw value range.

The conversion of value ranges by specifying range limits is known as rangetransformation. The following is specified:

� Raw value range

for the values supplied by the OPC server

� Target range

for the values to be displayed by the control and entered in it

The values of one range are automatically converted to the other value range.

Figure 8-10 Range Transformation

Syntax

object.RangeRawMax [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value of the type Float that specifies the range limits for the transformation.

If you do not specify RangeRawMax, the value 255.0 is used.

Note

ScaleMode must be set to ScaleByRange otherwise RangeRawMax has no effect.

Page 426: Industrial Communication With PG-PC

Using the OPC Server

426SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.78 RangeRawMin

SIMATIC Number Control

Together with RangeRawMax , this specifies the range for raw values. Raw valuesare the values supplied directly by the OPC server. The range of raw values canbe recalculated into displayed values by the number control. The value range ofthe displayed values is defined by RangeScaledMin and RangeScaledMax.

RangeRawMin specifies the lower value of the raw value range.

The conversion of value ranges by specifying range limits is known as rangetransformation. The following is specified:

� Raw value range

for the values supplied by the OPC server

� Target range

for the values to be displayed by the control and entered in it

The values of one range are automatically converted to the other value range.

Figure 8-11 Range Transformation

Syntax

object.RangeRawMin [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value of the type Float that specifies the range limits for the transformation.

If you do not specify RangeRawMin, the value 0.0 is used.

Note

ScaleMode must be set to ScaleByRange otherwise RangeRawMin has no effect.

Page 427: Industrial Communication With PG-PC

Using the OPC Server

427SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.79 RangeScaledMax

SIMATIC Number Control

Together with RangeScaledMin defines the value range of values displayed in thenumber control. The displayed values are calculated from the raw values suppliedby the OPC server.

RangeScaledMax specifies the upper value for the target range.

The conversion of value ranges by specifying range limits is known as rangetransformation. The following is specified:

� Raw value range

for the values supplied by the OPC server

� Target range

for the values to be displayed by the control and entered in it

The values of one range are automatically converted to the other value range.

Figure 8-12 Range Transformation

Syntax

object.RangeScaledMax [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value of the type Float that specifies the range limits for the transformation.

If you do not specify RangeScaledMax, the value 100.0 is used.

Note

ScaleMode must be set to ScaleByRange otherwise RangeScaledMax has noeffect.

Page 428: Industrial Communication With PG-PC

Using the OPC Server

428SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.80 RangeScaledMin

SIMATIC Number Control

Together with RangeScaledMax defines the value range of values displayed inthe number control. The displayed values are calculated from the raw valuessupplied by the OPC server.

RangeScaledMin specifies the lower value for the target range.

The conversion of value ranges by specifying range limits is known as rangetransformation. The following is specified:

� Raw value range

for the values supplied by the OPC server

� Target range

for the values to be displayed by the control and entered in it

The values of one range are automatically converted to the other value range.

Figure 8-13 Range Transformation

Syntax

object.RangeScaledMin [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value of the type Float that specifies the range limits for the transformation.

If you do not specify RangeScaledMin, the value 0.0 is used.

Note

ScaleMode must be set to ScaleByRange otherwise RangeScaledMin has noeffect.

Page 429: Industrial Communication With PG-PC

Using the OPC Server

429SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.81 ScaleMode

SIMATIC Number Control

Specifies the scaling mode used to scale the values. The value can also bespecified with ScaleProperty.

You can set the scaling mode as follows:

� Formula

� Range Transformation

Formula

(PLC Value * Scale) + Offset = displayed value

PLC Value is the value of Value when the control is connected to the OPC server.

Scale is the value of Factor.

Offset is the value of Offset.

Displayed value is the content of the Text property.

Range Transformation

You specify a source range of process values and a target range of displayedvalues. You can transform the values of one range into the other.

Syntax

object.ScaleMode [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

A value or constant that specifies the scaling mode.

The available options are as follows:

ScaleNone or 0 No scaling.

ByFormula or 1 The formula with Factor and Offset is used to scale thevalue.

ByRange or 2 The range transformation method is used to scale thevalue.

If you do not specify ScaleMode, no scaling takes place.

Page 430: Industrial Communication With PG-PC

Using the OPC Server

430SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

ScaleMode specifies whether or not Factor, Offset, RangeRawMax,RangeRawMin, RangeScaledMax, and RangeScaledMin have any effect.

Page 431: Industrial Communication With PG-PC

Using the OPC Server

431SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.82 ServerName

SIMATIC NET OPC Data Control

Specifies the name (ProgID) of the OPC server that provides the required processvariables.

Syntax

object.ServerName [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control.

value

String representing the ProgID of the OPC server that will be used by the object.

For SIMATIC NET, the value is, for example, OPC.SimaticNET.

8.1.83 ShowButtons

SIMATIC Number Control

Specifies whether or not the buttons for input deleting are displayed for the control.

Syntax

object.ShowButtons [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Boolean expression specifies whether the buttons are displayed.

The available options are as follows:

True The buttons are displayed to the right of the display field.When a new value is entered, the buttons are activated.If you write or modify a value, you must confirm the value withthe button for input.If you cancel a change, you must click the button for deleting.

False The buttons are not displayed.

Page 432: Industrial Communication With PG-PC

Using the OPC Server

432SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.84 ShowErrorBoxes

SIMATIC NET OPC Data Control

SIMATIC Number Control

Specifies whether the default error messages are displayed when a user erroroccurs. For each error, an Error event is generated.

All errors that affect connection establishment to the OPC server are notified with aConnectionError event.

Syntax

object.ShowErrorBoxes [= value]

Explanations

object

An instance of the SIMATIC NET OPC Data control or an instance of the SIMATICNumber control.

value

Boolean expression that specifies whether error messages are displayed.

The available options are as follows:

True The control displays the specified error messages.

False The error messages are deactivated.

If you do not specify ShowErrorBoxes, the control displays the default errormessages.

Note

SIMATIC Computing returns English error messages. If you want to display themessages in other languages, deactivate the ShowErrorBoxes option and writeprogram code for error handling.

Page 433: Industrial Communication With PG-PC

Using the OPC Server

433SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.85 SmallChange

SIMATIC Slider Control

Specifies how far the slider of the slider control is moved when the control isselected and the up/down or left/right arrow key is pressed.

Value is increased by SmallChange when the right or up arrow key is pressed. It isreduced by SmallChange when the left or down arrow key is pressed.

Syntax

object.SmallChange [= value]

Explanations

object

An instance of the SIMATIC Slider control.

value

A value or constant that specifies the extent of the change.

8.1.86 Ticks

SIMATIC Slider Control

Sets the number of ticks or scale marks of the control.

If, for example, Ticks has the value 10, the scale of the control is divided into 10parts.

Syntax

object.Ticks [= value]

Explanations

object

An instance of the SIMATIC Slider control.

value

Constant that specifies how many scale marks are displayed.

If you do not specify Ticks, the default value 10 is used.

Page 434: Industrial Communication With PG-PC

Using the OPC Server

434SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.87 TrueCaption

SIMATIC Button Control

Decides the text displayed in the control when Value is set to True.

Syntax

object.TrueCaption [= value]

Explanations

object

An instance of the SIMATIC Button control.

value

String containing the text.

8.1.88 TrueColor

SIMATIC Button Control

Specifies the color of the control if Value is set to True.

Syntax

object.TrueColor [= value]

Explanations

object

An instance of the SIMATIC Button control.

value

Value or constant that specifies the foreground or background color of the control.

The available options are as follows:

Standard Colors Selection of colors using the RGB colorpalette.

Windows System Colors Selection of colors using system colors.The system colors depend on thecontainer.

Page 435: Industrial Communication With PG-PC

Using the OPC Server

435SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.89 UpperLimit

SIMATIC Number Control

Specifies the upper limit value for values entered by the user. The value is checkedby LimitCheck.

If a value higher than the limit value is entered, the control does not write this valueto the property Value property. In this case, an Error event and aLimitCheckFailed event are generated. The condition for the Error event is thatShowErrorBoxes is activated.

Syntax

object.UpperLimit [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Value of the type Float that specifies the upper limit for the limit check.

If you do not specify UpperLimit, the value 100.0 is used.

Note

LimitCheck must be set to Upper or Both otherwise UpperLimit has no effect.

8.1.90 Value

SIMATIC Button Control

SIMATIC Number Control

SIMATIC Slider Control

This property connects the SIMATIC NET OPC Data Control with a processvariable of the OPC server.

Value can have values of different data types.

Syntax

object.Value [= value]

Page 436: Industrial Communication With PG-PC

Using the OPC Server

436SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Explanations

object

An instance of the SIMATIC Display control.

value

Value of the type variant that specifies the value of the control.

Note

If Enabled is set to false, the bidirectional connection between Value andConvertedValue is disabled. Changes to ConvertedValue are not applied to theValue property.

When Value changes, a ChangeEvent is generated.

8.1.91 WriteMode

SIMATIC Number Control

Specifies whether or not the Number control passes on entered valuesautomatically to the Value property and therefore also to the SIMATIC NET OPCData Control.

Syntax

object.WriteMode [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Value or constant that specifies whether or not the control passes the enteredvalues automatically to Value.

The available options are as follows:

Automatic or 0 The new value is automatically passed to Value andtherefore also to the OPC server (default).

Manual or 1 The new value is not passed on unless the Write methodis called in the program code.

If you do not specify WriteMode, the value is automatically passed to Value.

Page 437: Industrial Communication With PG-PC

Using the OPC Server

437SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.92 ZeroPad

SIMATIC Number Control

Specifies whether the number displayed by the control is padded from the left withleading zeros until the maximum size of the data type is reached

Syntax

object.ZeroPad [= value]

Explanations

object

An instance of the SIMATIC Number control.

value

Boolean expression that specifies whether or not the display number is paddedwith leading zeros.

The available options are as follows:

True Pads the number with leading zeros up to the maximumnumber of places for the specified data type.

False Does not pad the number with leading zeros.

If you do not specify ZeroPad, the number is not padded with leading zeros.

Page 438: Industrial Communication With PG-PC

Using the OPC Server

438SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.93 AddNotification

SIMATIC NET OPC Data Control

Adds an event notification in the event table of the OPC Data Control. If thetransferred process variable changes, the ValueChanged event is generated withthe notified ID.

Syntax

result=object.AddNotification(ItemIDs, UserIDs, Errors)

Explanations

result

Value of the type Long that indicates whether or not an error has occurred. If result= 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

ItemIDs

OPC ItemID of the type String() that specifies which process variables aremonitored for changes.

UserID

Freely selectable ID for every ItemID of the type String(). The ID is specified by theuser. It can be used by the user program to identify an event.

Errors

Return parameter of the type Variant that signals whether registration wassuccessful for each ItemID.

Page 439: Industrial Communication With PG-PC

Using the OPC Server

439SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.94 Connect

SIMATIC NET OPC Data Control

Establishes the configured connection to the OPC server.

Syntax

result = object.Connect

Explanations

result

Value of the type Long that indicates whether or not an error has occurred.

If result = 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

Note

If an error occurs during the connect phase, this can be detected with theConnectionError event and error handling started.

8.1.95 Disconnect

SIMATIC NET OPC Data Control

Terminates all connections.

Syntax

result = object.Disconnect

Explanations

result

Value of the type Long that indicates whether or not an error has occurred.

If result = 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

Page 440: Industrial Communication With PG-PC

Using the OPC Server

440SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.96 GetItemProperties

SIMATIC NET OPC Data Control

Returns the values of the properties of the specified OPC item.

Syntax

result = object.GetItemProperties(ItemID, Count, PropertyIDs,PropertyValues, Errors)

Explanations

result

Value of the type Long that indicates whether or not an error has occurred.

If result = 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

ItemID

OPC ItemID of the process variable of the type String for which the current valuesof the OPC properties will be queried.

Count

Parameter of the type Long that specifies the number of properties for whichvalues will be queried.

PropertyIDs

Parameter of the type Variant containing a list of the PropertyIDs to be queried.

PropertyValues

Return parameter of the type Variant containing a list of the requested values.

Errors

Return parameter of the type Variant that indicates whether registration wassuccessful for each PropertyID.

8.1.97 QueryAvailableItemProperties

SIMATIC NET OPC Data Control

Returns a list of OPC properties along with a description for the specified OPCitem.

Syntax

result=object.QueryAvailableItemProperties(ItemID,Count,PropertyIDs, Descriptions, DataTypes)

Page 441: Industrial Communication With PG-PC

Using the OPC Server

441SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Explanations

result

Value of the type Long that indicates whether or not an error has occurred. If result= 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

ItemID

OPC ItemID of the process variable as String for which information about its OPCproperties will be queried.

Count

Return parameter of the type Long that specifies how many properties exist for thespecified OPC item.

PropertyIDs

Return parameter of the type Variant that contains a list of the PropertyIDssupported by the specified item.

PropertyID is used as an input parameter in the GetItemProperties method toquery the current value of the property.

Descriptions

Return parameter of the type Variant containing a list of the descriptive texts for theindividual properties.

DataTypes

Return parameter of the type Variant containing a list of the data type codes for theindividual properties. The data type codes correspond to the codes defined forCOM.

Page 442: Industrial Communication With PG-PC

Using the OPC Server

442SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.98 ReadMultiVariables

SIMATIC NET OPC Data Control

Reads the values of the variables connected to the OPC server.

Syntax

result = object.ReadMultiVariables (VarItemIDs, VarValues,VarErrors {,VarQualities} {,VarTimeStamps})

Explanations

result

Value of the type Long that indicates whether or not an error has occurred.

If result = 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

VarItemIDs

Variable of the type Variant that specifies the array of OPC ItemIDs to identify thevariables to be read from the OPC server.

VarValues

Return variable of the type Variant containing the array of corresponding values ofthe specified variables of the OPC server.

VarErrors

Variable of the type Variant containing the array with the status Long of each returnvariable.

VarQualities

Return variable of the type Variant containing the array with corresponding qualityof the specified variables.

VarTimeStamps

Return variable of the type Variant containing the array with correspondingtimestamp of the specified variables.

Page 443: Industrial Communication With PG-PC

Using the OPC Server

443SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.99 ReadVariable

SIMATIC NET OPC Data Control

Reads the value of a specific variable from the OPC server.

Syntax

result = object.ReadVariable (ItemID, Value, Quality,Timestamp)

Explanations

result

Value of the type Long that indicates whether or not an error has occurred.

If result = 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

ItemID

String with the ItemID of the variable on the OPC server that will be read.

Value

Return variable of the type Variant containing the content of the specified variablein the OPC server.

Quality

Return value of the type Long containing the quality of the variable.

TimeStamp

Return variable of the type Date containing the OPC timestamp.

Page 444: Industrial Communication With PG-PC

Using the OPC Server

444SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.100 Write

SIMATIC Number Control

Writes the value of ConvertedValue to Value.

This method can only be used when WriteMode is set to Manual.

Syntax

object.Write

Explanation

object

An instance of the SIMATIC Number control.

8.1.101 WriteMultiVariables

SIMATIC NET OPC Data Control

Writes new values for several variables to the process variables made available bythe OPC server.

Syntax

result = object.WriteMultiVariables (VarItemIDs, VarValues,VarErrors)

Explanations

result

Value of the type Long that indicates whether or not an error has occurred. If result= 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

VarItemIDs

Variable of the type Variant that identifies the array of OPC ItemIDs for specifyingthe process variables.

VarValues

Variable of the type Variant containing an array of corresponding values to bewritten to the specified variables.

VarErrors

Variable of the type Variant containing the array with the status Long of eachvariable.

Page 445: Industrial Communication With PG-PC

Using the OPC Server

445SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.102 WriteVariable

SIMATIC NET OPC Data Control

Writes a new value to a specific process variable of the OPC server.

Syntax

result = object.WriteVariable (ItemID, Value)

Explanations

result

Value of the type Long that indicates whether or not an error has occurred.

If result = 0, no error occurred.

object

An instance of the SIMATIC NET OPC Data control.

ItemID

String specifying the OPC ItemID to identify an OPC process variable.

Value

Variable of the type Variant containing the value that will be written to the specifiedprocess variable.

8.1.103 Events of the SIMATIC Controls

There are fixed events for the controls to which the program can react duringruntime.

8.1.104 Events of the Data Control

The following events are available for the Data control:

Event occurs

ConnectionError An error occurred on the connection.

ValueChanged The value or the quality of a process variable registeredwith the AddNotification method has changed. By cal-ling the ValueChanged event, the user application isnotified of the change.

Page 446: Industrial Communication With PG-PC

Using the OPC Server

446SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.105 Events of the Button Control

The following events are available for the Button control:

Event occurs

ChangeEvent The value of a property has changed.

ClickEvent The control was clicked with the mouse.

8.1.106 Events of the Number Control

The following events are available for the Number control:

Event occurs

Change The value of the Value property has changed.

Click The mouse button was pressed and released over thecontrol.

DblClick The control was double-clicked.

Error The control has detected an error.

KeyDown A key was pressed while control was active.

KeyPress A key was pressed and released while the control wasactive.

KeyUp A key was released while control was active.

LimitCheckFai-led

The limit value check failed.

MouseDown The mouse button was pressed while the mouse cursorwas over the control.

MouseMove The mouse cursor was moved over the control.

MouseUp The mouse button was released while the cursor wasover the control.

Page 447: Industrial Communication With PG-PC

Using the OPC Server

447SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.1.107 Events of the Slider Control

The following events are available for the Slider control:

Event occurs

Change The value of the Value property has changed.

Click The mouse button was pressed and released over the con-trol.

DblClick The control was double-clicked.

KeyDown A key was pressed while control was active.

KeyPress A key was pressed and released while the control was ac-tive.

KeyUp A key was released while control was active.

MouseDown The mouse button was pressed while the mouse cursorwas over the control.

MouseMove The mouse cursor was moved over the control.

MouseUp The mouse button was released while the cursor was overthe control.

8.1.108 Error Messages of the SIMATIC Controls

The Data control and the Number control can generate error messages.

Error Messages of the Data Control

If an error occurs in the Data control, the control generates a ConnectionErrorevent. Your program can receive the ConnectionError event and react to it. TheConnectionError can recognize standard COM errors, for example E_FAIL orE_OUTOFMEM .

Error Message Tables

The tables list only the most important error messages.

Page 448: Industrial Communication With PG-PC

Using the OPC Server

448SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.1.109 Error Messages of the Data Control

The table below shows the most important error messages:

Error Code Meaning

0x80004005 General COM error.

0x8007000E Not enough free memory.

0x80070057 Invalid syntax of the variable.

0xC0040007 Invalid variable type.

0xC004000B Value to be written is too high.

8.1.110 Error Messages of the Number Control

The table below shows the most important error messages:

Error Code Meaning

C0040002 The scaling cannot be continued because the scaling for-mula is incorrect.

This error occurs when you specified a raw value range(RangeRawMin, RangeRawMax) with the length zero(Min equals Max). This would lead to division by zeroand scaling is therefore not possible.

Specify a raw value range in which RangeRawMin isless than RangeRawMax.

C0040003 The value setting of Value is invalid.

The value reported by the OPC server or by a script thataccesses Value cannot be interpreted.

Check the values you wrote to the OPC server.

C0040004 The value setting of an entered text (value) is invalid.

This error often occurs when a bad value is entered inthe control. Normally, this is caused by an illegal charac-ter.

The permitted characters depend on the number baseand data type used. For more information, read the des-cription of the basic value properties.

Enter a permitted value.

Page 449: Industrial Communication With PG-PC

Using the OPC Server

449SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Error Code Meaning

C0040005 The COM component was not found.

The SIMATIC product or Windows has been incorrectlyinstalled. The control cannot access other componentsrequired for correct operation with the software.

Check the installation.

C0040006 The Microsoft Standard Controls cannot be created.

The SIMATIC product or Windows has been incorrectlyinstalled. The control cannot access other componentsrequired for correct operation with the software.

Check the installation.

C0040010 The limit check cannot be continued because the lowerlimit is higher than the upper limit.

This error occurs when you check the limit values of theNumber control. In this case, the lower limit (LowerLi-mit) is higher than the upper limit (UpperLimit).

Set a valid range for the limit value check.

Page 450: Industrial Communication With PG-PC

Using the OPC Server

450SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.2 Programming the Automation Interface

The Automation Interface is a supplement to the Custom Interface. With theAutomation Interface, you have the convenience of modern development systemsand script languages when programming OPC. There is both an AutomationInterface for access to process variables (data access) and for processing eventsand alarms (Alarms & Events).

Application

You work with the Automation Interface when you want to create an applicationwith a reasonable number of variables and medium data throughput based on anoffice application or with Visual Basic.

8.2.1 Programming the Automation Interface for Data Access

For data access, there is a simple class model that groups the interfaces and theirmethods in classes.

The Automation Interface further refines the class model valid for the CustomInterface to provide the benefits and options available with structured developmentsystems such as Visual Basic.

8.2.2 What Does the Object Model of OPC Data Access Provide?

The classes of the class model of Data Access contain the following objects:

� OPCServer

� OPCGroup

� OPCItem

Additional objects can be added for the Automation Interface. To manage theOPCGroup and OPCItem objects, there are separate collection objects:OPCGroups and OPCItems. The collection objects provide functions for managingthe objects assigned to them.

There is also an OPCBrowser collection object that contains the browsingfunctions.

Page 451: Industrial Communication With PG-PC

Using the OPC Server

451SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Object Model

The following graphic illustrates the objects and the relationships between theobjects.

Figure 8-14 Object Model of OPC Data Access

8.2.3 Points to Remember When Programming

� With the Automation Interface, optional parameters must be passed asvariants. In Visual Basic, however, the optional parameters should be declaredwith the intended type of the optional variables. This ensures that the variantcontains the correct data type.

� Asynchronous Functions

The IsSubscribed group-specific property must be set to True to allow thevariables to be monitored.

� The objects that will receive events must be declared with the supplementwithEvents in Visual Basic.

Example:

Dim withEvents MyOPCGroup as OPCGroup

� According to the OPC Specification, arrays always begin with index 1. Definethis in your program as follows:

Option Base 1 ’ARRAYs are always Option Base 1

Page 452: Industrial Communication With PG-PC

Using the OPC Server

452SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.2.4 Objects of the Automation Interface for Data Access

Below, you will see a list of the properties, methods, and events for Data Access.Only the features specific to SIMATIC NET are described. For a detaileddescription of the properties, methods, and events, refer to the relevant OPCSpecifications.

Objects

The following objects exist for the Automation Interface for Data Access:

OPCServer Object

The OPCServer objects of the OPC server class are created by the client.

The properties of the OPCServer objects contain general information about theserver. When an object is created, an OPCGroups collection object is also createdas a property of the OPCServer object.

Page 453: Industrial Communication With PG-PC

Using the OPC Server

453SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Properties of OPCServer

Below, you will find a list of the properties for the OPCServer object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Property Meaning

Bandwidth Returns the bandwidth of the server. Bandwidth isnot supported by the OPC server for SIMATICNET.

BuildNumber Returns the build number of the server

ClientName Specifies the name of the client. ClientName isused primarily for test purposes.

CurrentTime Returns the current time in UTC.

LastUpdateTime Returns the time in UTC at which the server lastsent data to the client

LocaleID Specifies the language for displayed texts. ForSIMATIC NET, these are German and English.

MajorVersion Returns the main version number of the server

MinorVersion Returns the secondary version number of the ser-ver

OPCGroups Specifies the collection of OPCGroup objects

PublicGroupNames Returns the name of the public group of OPCserver. Optional public groups are not supportedby the OPC Server for SIMATIC NET.

ServerName Returns the name of the connected OPC server

ServerNode Returns the name of the network node on whichthe OPC server is executed

ServerState Returns the status of the server

StartTime Returns the time at which the server started inUTC

VendorInfo Returns vendor information. The OPC Server forSIMATIC NET returns SIMATIC NET OPC-Ser-ver as vendor information.

Page 454: Industrial Communication With PG-PC

Using the OPC Server

454SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Methods of OPCServer

The methods for the OPCServer object are listed below. Only the features specificto SIMATIC NET are described. You will find a description of the methods in thefollowing OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Method Meaning

Connect Establishes a connection to the OPC server. TheProgID for OPC server is, for example, OPC.Si-maticNET.

CreateBrowser Creates an OPCBrowser collection object

Disconnect Terminates a connection to the OPC server. TheOPC Server for SIMATIC NET terminates allcommunication connections to an OPC clientafter the last link has been deleted.

GetErrorString Gets an error message for an error code. TheOPC Server for SIMATIC NET supports Germanand English error messages. Error messagesfrom the Windows operating system are dis-played in the language of the operating systeminstallation.

GetItemProperties Returns a list with the values of the requestedproperties

GetOPCServers Returns the names of the registered OPC ser-vers. The name of the OPC server for SIMATICNET is, for example, OPC.SimaticNET.

LookupItemIDs Returns a list with ItemIDs that correspond to thePropertyIDs. The OPC Server for SIMATIC NETdoes not return PropertyIDs that could be dis-played as ItemIDs.

QueryAvailableLocaleIDs Returns the available language codes. The OPCServer for SIMATIC NET supports German andEnglish error messages. Error messages fromthe Windows operating system are displayed inthe language of the operating system installation.

QueryAvailableProperties Returns property codes and properties for anOPC item.

Page 455: Industrial Communication With PG-PC

Using the OPC Server

455SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Events of OPCServer

Below, you will find a description of the event for the OPCServer object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theevent in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Event Meaning

ServerShutDown This is triggered when the OPC server is shutdown. The OPC Server for SIMATIC NET trig-gers this event when the shutdown command issent by the configuration program or when thePC station receives new configuration data.

Collection Object OPCBrowser

Using the OPCBrowser collection object, you can browse through the name spaceof the OPC server.

An object of the OPCBrowser class is created by the CreateBrowser method ofthe OPCServer object. Several OPCBrowser objects can be created for oneserver.

Page 456: Industrial Communication With PG-PC

Using the OPC Server

456SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of OPCBrowser

Below, you will find a list of the properties for the OPCBrowser collection object.Only the features specific to SIMATIC NET are described. You will find adescription of the properties in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Property Meaning

AccessRights Decides the access rights for theShowLeafs method

Count Returns the number of entries

CurrentPosition Returns the current position in thename space tree

DataType Decides the data type for the Show-Leafs method

Filter Decides the filter for the ShowLeafsand ShowBranches methods

Organization Returns the organizational structure ofthe name space. The name space ofthe OPC Server for SIMATIC NET ishierarchically structured.

Page 457: Industrial Communication With PG-PC

Using the OPC Server

457SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Methods of OPCBrowser

Below, you will find a list of the methods for the OPCBrowser collection object.Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Method Meaning

GetAccessPaths Gets the access path of an ItemID.

For the OPC Server for SIMATIC NET, youshould not use the AccessPath parameter.

GetItemID When possible, this is returns the ItemID for anelement in the name space of the OPC server.

Item Specifies the name of an entry

MoveDown Moves the current position in the name spaceone level down

MoveTo Moves the current position in the name space tothe specified position

MoveToRoot Moves the current position in the name space tothe root

MoveUp Moves the current position in the name spaceone level up

ShowBranches Specifies the name of the branches at the cur-rent browse position

ShowLeafs Specifies the name of the leaves at the currentbrowse position

Page 458: Industrial Communication With PG-PC

Using the OPC Server

458SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Collection Object OPCGroups

The OPCGroups collection object is a collection of OPCGroup objects for creatingand managing OPC groups. The standard properties of OPCGroups specifystandard values for all newly created OPC groups.

If the OPC server object executes a Connect call successfully, an OPCGroupscollection object is created as a property of the OPC server object.

Note

The optional public groups are not supported by the OPC Server for SIMATICNET.

Properties of OPCGroups

Below, you will find a list of the properties for the OPCGroups collection object.Only the features specific to SIMATIC NET are described. You will find adescription of the properties in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Property Meaning

Count Returns the number of groups

DefaultGroupDeadband Specifies the initial value for Deadband fornewly generated OPCGroup objects

DefaultGroupIsActive Specifies the initial value for ActiveState fornewly generated OPCGroup objects

DefaultGroupLocaleID Specifies the initial value for LocaleID fornewly generated OPCGroup objects

DefaultGroupTimeBias Specifies the initial value for TimeBias fornewly generated OPCGroup objects

DefaultGroupUpdateRate Specifies the initial value for UpdateRate fornewly generated OPCGroup objects

Parent Returns the reference to the correspondingOPCServer object

Page 459: Industrial Communication With PG-PC

Using the OPC Server

459SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Methods of OPCGroups

Below, you will find a list of the methods for the OPCGroups collection object. Onlythe features specific to SIMATIC NET are described. You will find a description ofthe methods in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Method Meaning

Add Creates a new OPCGroup object and adds it tothe collection

GetOPCGroup Specifies the reference to the name or serverhandle of an OPCGroup object

Item Returns the reference to the indexed object ofthe collection

Remove Deletes a group of the server

RemoveAll Deletes all groups of the server

Events of OPCGroups

Below, you will find a description of the event for the OPCGroups collection object.Here, only the special features for SIMATIC NET are described. You will find adetailed description of the event in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Event Meaning

GlobalDataChange Notifies value changes and the status of the activeitems of all active groups

Page 460: Industrial Communication With PG-PC

Using the OPC Server

460SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OPCGroup Object

The OPC Group class manages the individual process variables, the OPC items.Using the OPCGroup object, a client can put OPC items into a group based onsemantic considerations and process the group as a single unit.

Monitoring variables and read and write access are group-specific. As an example,monitoring of all the OPC items in a group can be activated by calling a singlefunction.

You should therefore put all the process variables, for example, that are displayedtogether in one screen on an operator control and monitoring station into the samegroup and activate monitoring of the variables when the screen is opened.

Note

The optional public groups are not supported by the OPC Server for SIMATICNET.

Page 461: Industrial Communication With PG-PC

Using the OPC Server

461SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Properties of OPCGroup

Below, you will find a list of the properties for the OPCGroup object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Property Meaning

ClientHandle Specifies the handle for localizing data

DeadBand Specifies the band width in which value changes do notlead to a notification

IsActive Specifies the active status of the group.Make sure you set IsActive to True if you want to monitorthe variables of this group.

IsPublic Indicates whether or not the group is a public groupThe optional public groups are not supported by the OPCServer for SIMATIC NET.

IsSubscribed Indicates whether the variables of a group will be monito-red.Make sure you set IsSubscribed to True if you want tomonitor the variables of this group.

LocaleID Specifies the language for text string as returned by theserver

Name Specifies the name of the group

OPCItems Specifies the collection object for managing the items ofthe group

Parent Returns the reference to the corresponding OPCServerobject

ServerHandle Returns a unique handle for the group

TimeBias Specifies the time offset for converting the timestamp tolocal time

UpdateRate Specifies the interval at which a client is notified of changesto values or in the statuses of items

Page 462: Industrial Communication With PG-PC

Using the OPC Server

462SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Methods of OPCGroup

Below, you will find a list of the methods for the OPCGroup object. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Method Meaning

AsyncCancel Cancels an asynchronous job

AsyncRead Sends an asynchronous read command

AsyncRefresh Creates an event for every active OPC item withthe current value from the cache.

AsyncWrite Sends an asynchronous write command

SyncRead Starts synchronous reading of values, status in-formation, and timestamp of one or more itemsof a group.

SyncWrite Starts synchronous writing of values for one ormore items of a group

Events of OPCGroup

The OPC Automation Interface returns the changes to values of active items andthe results of asynchronous operations using events.

Objects in Visual Basic that are intended to receive events must be declared withwithEvents.

Below, you will find a list of the events for the OPCGroup object. Only the featuresspecific to SIMATIC NET are described. You will find a description of the events inthe following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Event Meaning

AsyncCancelComplete This is triggered when a cancel job is completed

AsyncReadComplete This is triggered when a read job is completed

AsyncWriteComplete This is triggered when a read job is completed

DataChange This is triggered when one or more items have achanged value or a changed quality.

Page 463: Industrial Communication With PG-PC

Using the OPC Server

463SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Collection Object OPCItems

The OPCItems collection object is a collection of OPCItem objects for creating andmanaging OPC items. The properties of OPCItems specify standard values for allnew OPC items that are created.

If an OPCGroup object is created, an OPCItems collection object is automaticallycreated. OPCItems always exists as a property of a group and is used to monitorthe OPC variables.

Page 464: Industrial Communication With PG-PC

Using the OPC Server

464SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of OPCItems

Below, you will find a list of the properties for the OPCItems object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Property Meaning

Count Returns the number of items in the group

DefaultAccessPath Specifies the initial value for AccessPath for newlyadded OPC items.

For the OPC Server for SIMATIC NET DefaultAc-cessPath should be empty.

DefaultIsActive Specifies the initial value for ActiveState for newlyadded OPC items

DefaultRequested-DataType

Specifies the initial value for RequestedDataTypefor newly added OPC items

Parent Returns the reference to the corresponding OPC-Group object

Methods of OPCItems

Below, you will find a list of the methods for the OPCItems object. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Method Meaning

AddItem Adds a new OPC item to the collection object.

AddItems Adds several OPC items to the collection object

GetOPCItem Specifies the reference to the server handlecreated by AddItem

Item Specifies the reference to an item of the collec-tion

Remove Deletes one or more items from a group

SetActive Sets the active status of one or more items of agroup

SetClientHandles Changes the client handle for one or more items

SetDataTypes Sets the data type for one or more items

Validate Checks the validity of one or more OPC items

Page 465: Industrial Communication With PG-PC

Using the OPC Server

465SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

OPCItem Object

An object of the OPC Item class represents a process variable, for example aninput module of a programmable controller. A process variable is a writable and/orreadable data item of the process I/O such as the temperature of a tank. Eachprocess variable is associated with a value, a quality and a timestamp.

Page 466: Industrial Communication With PG-PC

Using the OPC Server

466SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of OPCItem

Below, you will find a list of the properties for the OPCItem object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Property Meaning

AccessPath Returns the access path of the item. For theOPC Server for SIMATIC NET, Access Pathshould be empty.

AccessRights Returns the access rights of the variables.

CanonicalDataType Returns the original data type of the item

ClientHandle Specifies the handle for simpler assignment ofprocess variables to internal data structures ofthe client

EUInfo Returns information about the units of the value(optional). The OPC Server for SIMATIC NETdoes not support units (Engineering Units).

EUType Returns the unit of the returned value (optional).The OPC Server for SIMATIC NET does not sup-port units (Engineering Units).

IsActive Specifies whether notification events are genera-ted for the item

ItemID Returns the unique name of the item

Parent Returns the reference to the parent OPCGroupobject

Quality Returns the quality of the value read last.

RequestedDataType Specifies the requested data type for the value ofthe item

ServerHandle Returns the server handle to identify an item

TimeStamp Returns the time at which the last value was ac-quired

Value Returns the last valid value of an item

Page 467: Industrial Communication With PG-PC

Using the OPC Server

467SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Methods of OPCItem

Below, you will find a list of the methods for the OPCItem object. Only the featuresspecific to SIMATIC NET are described. You will find a description of the methodsin the following OPC Specification:

Data Access Automation InterfaceVersion 2.02February 4, 1999

Method Meaning

Read Reads value, quality and/or timestamp of the variable syn-chronously.

Write Sets the value of the variable synchronously

8.2.5 Programming the Automation Interface for Alarms & Events

For Alarms & Events, there is a simple class model, that groups the interfaces andtheir methods in classes.

The Automation Interface further refines the class model valid for the CustomInterface to provide the benefits and options available with structured developmentsystems such as Visual Basic.

8.2.6 What Does the Object Model of OPC Alarms & Events Provide?

The classes of the class model of Alarms & Events contain the following objects:

� OPCEventServer

� OPCEventSubscriptions

� OPCEventSubscription

� OPCEventAreaBrowsers

� OPCEventAreaBrowser

� OPCEvents

� OPCEvent

� OPCEventCondition

� OPCEventSubConditions

� OPCEventSubCondition

Additional objects can be added for the Automation Interface.

Page 468: Industrial Communication With PG-PC

Using the OPC Server

468SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Note

Since the Event Server of SIMATIC NET is a Simple Event Server, the followingobjects are not supported: OPCEventAreaBrowsers, OPCEventAreaBrowser,OPCEventCondition, OPCEventSubConditions, OPCEventSubCondition.

Object Model

The following graphic illustrates the objects and the relationships between theobjects.

Figure 8-15 Object Model of OPC Alarms & Events

8.2.7 Points to Remember When Programming

With the Automation Interface, optional parameters must be passed as variants. InVisual Basic, however, optional parameters should be declared with the targettype. This ensures that the variant contains the correct data type.

� Asynchronous Functions

The IsSubscribed group-specific property must be set to True to allow thevariables to be monitored.

� The objects that will receive events must be declared with the supplementwithEvents in Visual Basic.

Example:

Dim withEvents MyOPCGroup as OPCGroup

� According to the OPC Specification, arrays always begin with index 1. Definethis in your program as follows:Option Base 1 ’ARRAYs are always Option Base 1

Page 469: Industrial Communication With PG-PC

Using the OPC Server

469SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.2.8 Objects of the Automation Interface for Alarms & Events

Below, you will see a list of the properties, methods, and events for Alarms &Events. Only the features specific to SIMATIC NET are described. For a detaileddescription of the properties, methods, and events, refer to the relevant OPCSpecifications.

Objects

The following objects exist for the Automation Interface for Alarms & Events:

OPCEventServer Object

OPCEventServer objects of the OPC Event Server class are created by the client.OPCEventServer must be created before the client can access other objects ofAlarms & Events.

The properties of the OPCEventServer objects contain general information aboutthe event server. When an object is created, an OPCEventServerSubscriptioncollection object is also created.

OPCEventServer is connected to the event server by the Connect method.

Page 470: Industrial Communication With PG-PC

Using the OPC Server

470SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of OPCEventServer

Below, you will find a list of the properties for the OPCEventServer object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Property Meaning

BuildNumber Returns the build number of the server.

ClientName Specifies the name of the client.

CurrentTime Returns the current time in UTC.

FiltersByArea Indicates whether or not the server can filter ac-cording to areas. The OPC Event Server doesnot support areas.

FiltersByCategory Indicates whether or not the server can filter ac-cording to event categories.

FiltersByEventType Indicates whether or not the server can filter ac-cording to event types.

FiltersBySeverity Indicates whether or not the server can filter ac-cording to the severity of events.

FiltersBySource Indicates whether or not the server can filter ac-cording to sources.

LastUpdateTime Returns the time in UTC at which the server lastsent data to the client.

LocaleID Specifies the language for displayed texts.

MajorVersion Returns the main version number of the server

MinorVersion Returns the secondary version number of theserver

OPCEventAreaBrow-sers

Specifies the collection of OPCAutoEventArea-Browser objects.

OPC Event Server of SIMATIC NET does notsupport OPCEventAreaBrowsers.

OPCEventSubscriptions Specifies the collection of OPCEventSubscrip-tion objects.

ServerName Returns the name of the connected OPC server.

ServerNode Returns the name of the network node on whichthe OPC server is executed.

ServerState Returns the server status.

StartTime Returns the time at which the OPC server wasstarted.

VendorInfo Returns vendor information.

Page 471: Industrial Communication With PG-PC

Using the OPC Server

471SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Methods of OPCEventServer

Below, you will find a list of the methods for the OPCEventServer object. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Method Meaning

AckCondition Acknowledges one or more conditions on theevent server. OPC Event Server for SIMATICNET does not support conditions.

Connect Establishes the connection to the OPC server.

Disconnect Terminates the connection to the OPC server.

EnableConditionsByA-rea

Sets all conditions for all areas to a defined sta-tus. OPC Event Server for SIMATIC NET doesnot support conditions. E_NOTIMPL is returned.

EnableConditionBySrc Sets all conditions for all sources to a definedstatus. OPC Event Server for SIMATIC NETdoes not support conditions. E_NOTIMPL is re-turned.

GetConditionState Gets current status information for the condition.The OPC Event Server for SIMATIC NET doesnot support conditions. E_NOTIMPL is returned.

GetErrorString Converts an error code to an error text.

GetOPCEventServers Returns the names of all registered event ser-vers.

QueryAvailableLoca-leIDs

Returns the available language codes.

QueryConditionNames Returns the names of the conditions valid for aspecific event category. OPC Event Server forSIMATIC NET does not support conditions.

QueryEventAttributes Returns vendor-specific attributes

QueryEventCategories Returns the categories supported by the eventserver. The OPC Event Server for SIMATIC NETsupports the following category:

simple event: S7 alarm

QuerySourceConditions Returns the names of conditions linked to a spe-cific source. PC Event Server for SIMATIC NETdoes not support conditions.

QuerySubConditionNa-mes

Returns the names of subconditions linked to aspecific source. OPC Event Server for SIMATICNET does not support conditions.

Page 472: Industrial Communication With PG-PC

Using the OPC Server

472SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Events of OPCEventServer

Below, you will find a list of the events for the OPCEventServer object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theevent in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Event Meaning

EventServerShutDown This is triggered when the OPC server is shutdown. The OPC Server for SIMATIC NET trig-gers this event when the shutdown command issent by the configuration program or when thePC station receives new configuration data.

Collection Object OPCEventSubscriptions

The OPCEventSubscriptions collection object is a collection ofOPCEventSubscription objects and the methods with which to create, remove, andmanage them.

The properties of OPCEventSubscriptions specify standard values for all newlycreated OPCEventSubscription objects.

When the Connect call of the OPCEventServer object is successfully executed,an OPCEventSubscriptions collection object is created automatically.OPCEventSubscriptions always exists as a property of the OPCEventServer objectand is used to manage event messages.

Page 473: Industrial Communication With PG-PC

Using the OPC Server

473SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Properties of OPCEventSubscriptions

Below, you will find a list of the properties for the OPCEventSubscriptions object.Only the features specific to SIMATIC NET are described. You will find adescription of the properties in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Property Meaning

Count Returns the number of entries

DefaultIsActive Specifies the initial value for the active status fornewly generated OPCEventSubscription objects

DefaultbufferTime Specifies the initial value for how often event no-tifications are sent for newly generated OPCE-ventSubscription objects

DefaultMaxSize Specifies the initial value for the highest numberof events that can be sent with a single eventnotification for newly generated OPCEventSubs-cription objects

Methods of OPCEventSubscriptions

Below, you will find a list of the methods for the OPCEventSubscriptions object.Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Method Meaning

Add Creates a new OPCEventSubscription object and adds it tothe collection

Item Specifies the reference to the indexed object of the collec-tion

Remove Deletes an OPCEventSubscription object

RemoveAll Deletes all OPCEventSubscription objects

OPCEventSubscription Object

The OPCEventSubscription object represents a specific event subscription. Asubscription is a season ticket to a set of events. The client starts a job for theregular sending of events to the event server.

Page 474: Industrial Communication With PG-PC

Using the OPC Server

474SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Properties of OPCEventSubscription

Below, you will find a list of the properties for the OPCEventSubscription object.Only the features specific to SIMATIC NET are described. You will find adescription of the properties in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Property Meaning

bufferTime Decides how often event notifications are sentfor the OPCEventSubscription object

IsActive Specifies the active status of the OPCEvent-Subscription object

MaxSize Specifies the highest number of events that canbe sent with a single event notification

Name Specifies the name of the OPCEventSubscriptionobject

Page 475: Industrial Communication With PG-PC

Using the OPC Server

475SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Methods of OPCEventSubscription

Below, you will find a list of the methods for the OPCEventSubscription object.Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Method Meaning

GetFilter Returns the current filter for the OPCEventSubs-cription object. The parameters of the S7 OPCEvent Server for SIMATIC NET have the follo-wing significance:

EventTypeOnly the event type OPC_SIMPLE_EVENT issupported. There is therefore no point in makinga setting other than OPC_SIMPLE_EVENT.

EventCategoryS7_PROCESS_ALARM

LowSeverity

HighSeverity

AreasThe OPC Event Server does not support areas.

SourcesYou can enter a connection name as the source.

GetReturnedAttributes Returns attributes for every event category thatthe server sends with the event notifications.

Refresh Refreshes all conditions. OPC Event Server forSIMATIC NET does not support conditions.

RefreshCancel Cancels execution of the Refresh method. TheS7 OPC Event Server for SIMATIC NET doesnot support RefreshCancel.

Page 476: Industrial Communication With PG-PC

Using the OPC Server

476SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Method Meaning

SelectReturnedAttribu-tes

For each event category, this specifies the attri-butes that are returned with the event notifica-tions by the OnEvent method

SetFilter Sets all filters so that the filter properties matchthose of the created events. The parameters ofthe S7 OPC Event Server for SIMATIC NEThave the following significance:

EventTypeOnly the OPC_SIMPLE_EVENT (value 1) eventtype is supported. See GetFilter

EventCategoryS7_PROCESS_ALARM

LowSeverity

HighSeverity

AreasThe S7 OPC Event Server does not supportareas.

SourcesYou can enter a connection name as the source.

Page 477: Industrial Communication With PG-PC

Using the OPC Server

477SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Events of OPCEventSubscription

Below, you will find a list of the events for the OPCEventSubscription object. Onlythe features specific to SIMATIC NET are described. You will find a description ofthe event in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Event Meaning

ConditionEvent This occurs when condition events are sent bythe server.

The OPC Event Server for SIMATIC NET doesnot support ConditionEvent .

RefreshCancel This occurs when the Refresh method is inter-rupted.

The OPC Event Server for SIMATIC NET doesnot support RefreshCancel.

RefreshComplete This occurs when the Refresh method is com-pleted

The OPC Event Server for SIMATIC NET doesnot support RefreshComplete.

RefreshConditionEvent This occurs when events relating to the refres-hing of conditions are sent by the server.

The OPC Event Server for SIMATIC NET doesnot support RefreshConditionEvent .

SimpleEvent This occurs when a group of simple events aresent by the server.

The OPC Event Server for SIMATIC NET sup-ports only simple events.

TrackingEvent This occurs when tracking events are sent by theserver.

The OPC Event Server for SIMATIC NET doesnot support TrackingEvent.

Page 478: Industrial Communication With PG-PC

Using the OPC Server

478SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Collection Object OPCAutoEventAreaBrowsers

The OPCAutoEventAreaBrowsers collection object is a collection ofOPCAutoEventAreaBrowser objects and the methods with which to create,remove, and manage them.

Note

The OPC Event Server does not support OPCAutoEventAreaBrowsers.

OPCAutoEventAreaBrowser Object

With the OPCAutoEventAreaBrowser object, a client can browse through the areasand sources of the server. The areas are grouped together to formOPCEventAreas and the sources form OPCEventSources.

The areas and sources can be used to filter events.

Name Space of the Server

Servers have a flat or hierarchical name space. If the name space is flat,OPCEventAreas and OPCEventSources have the same areas and sources on theserver.

If the name space is hierarchical, the areas can be considered as branches in atree and the sources as leaves. The OPCAutoEventAreaBrowser object moves likea pointer along the areas. OPCEventAreas and OPCEventSources contain onlythe areas and sources in which the object exists.

Note

The OPC Event Server does not support OPCAutoEventAreaBrowser.

Page 479: Industrial Communication With PG-PC

Using the OPC Server

479SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Collection Object OPCEvents

The OPCEvents collection object is the transfer parameter of the methods forhandling events. It contains a collection of OPCEvent objects and the methodswith which to create, remove, and manage them.

OPCEvents is generated from the event notifications sent by the server andtherefore delivers the events that have occurred.

Properties of OPCEvents

Below, you will find a list of the properties for the OPCEvents object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Property Meaning

Count Returns the number of entries

LastRefresh Specifies that the OPCEvents collection object isthe last in a series of refresh notifications

Refresh Specifies that the OPCEvents collection objectbelongs to a refresh notification

Page 480: Industrial Communication With PG-PC

Using the OPC Server

480SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Methods of OPCEvents

Below, you will find a list of the methods for the OPCEvents object. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Method Meaning

Add Creates a new OPCEvent object and adds it tothe collection

Item Specifies the name of an entry

OPCEvent Object

The OPCEvent object contains the notification for a specific event.

Properties of OPCEvent

Below, you will find a list of the properties for the OPCEvent object. Only thefeatures specific to SIMATIC NET are described. You will find a description of theproperties in the following OPC Specification:

Alarm & Events Automation Interface StandardVersion 1.01December 15, 1999

Property Meaning

AckRequired Indicates that the condition requires an acknow-ledgment.

OPC Event Server for SIMATIC NET does notsupport AckRequired.

ActiveTime Returns the time at which the condition was acti-vated.

OPC Event Server for SIMATIC NET does notsupport ActiveTime.

ActorID Returns the tracking and condition events thatrequire acknowledgment.

Tracking events involve the ActorID of the eventnotification. Condition events are not supported.

ChangeAckState Returns the event notification for the change tothe Acknowledge property of a condition.

OPC Event Server for SIMATIC NET does notsupport ChangeAckState.

Page 481: Industrial Communication With PG-PC

Using the OPC Server

481SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Property Meaning

ChangeActiveState Returns the event notification for the change tothe ActiveState property of a condition.

OPC Event Server for SIMATIC NET does notsupport ChangeActiveState.

ChangeAttribute Returns the event notification for the change tothe Attribute property of a condition

OPC Event Server for SIMATIC NET does notsupport ChangeAttribute.

ChangeEnableState OPC Event Server for SIMATIC NET does notsupport Enable property of a condition

OPC Event Server for SIMATIC NET does notsupport ChangeEnableState.

ChangeMessage Returns the event notification for the change tothe Message property of a condition.

OPC Event Server for SIMATIC NET does notsupport ChangeMessage.

ChangeQuality Returns the event notification for the change tothe Quality property of a condition

OPC Event Server for SIMATIC NET does notsupport ChangeQuality.

ChangeSeverity Returns the event notification for the change tothe Severity property of a condition.

OPC Event Server for SIMATIC NET does notsupport ChangeSeverity.

ChangeSubCondition Returns the event notification for the change tothe SubCondition property of a condition.

OPC Event Server for SIMATIC NET does notsupport ChangeSubCondition .

ConditionAcknowledged Indicates that the new status of the condition isAcknowledged.

OPC Event Server for SIMATIC NET does notsupport ConditionAcknowledged .

ConditionActive Indicates that the new status of the condition isActive.

OPC Event Server for SIMATIC NET does notsupport ConditionActive .

Page 482: Industrial Communication With PG-PC

Using the OPC Server

482SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Property Meaning

ConditionName Returns the name of the condition that refers tothe event notification.

OPC Event Server for SIMATIC NET does notsupport ConditionName.

Cookie Returns a cookie defined by the server that islinked to the event notification.

OPC Event Server for SIMATIC NET does notsupport Cookie.

EventCategory Returns the code for the event category of theevent

Message Returns a text describing the notification

OPCEventAttributes Returns the vendor-specific event attributes re-turned by the event notification

Quality Returns the quality associated with the status ofthe condition.

OPC Event Server for SIMATIC NET does notsupport Quality.

Severity Returns the severity of the event.

Source Returns the source of the event notification.

SubConditionName Returns the name of the current subcondition.

OPC Event Server for SIMATIC NET does notsupport SubConditionName .

Time Returns the time in UTC at which an event oc-curred.

Page 483: Industrial Communication With PG-PC

Using the OPC Server

483SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

OPCEventCondition Object

The OPCEventCondition object describes the current status of a condition.

Note

The OPC Event Server does not support conditions.

Collection Object OPCEventSubConditions

The OPCEventSubConditions collection object is a collection ofOPCEventSubCondition objects. The collection represents the various statuses ofa condition on an OPC Event Server.

Note

The OPC Event Server does not support conditions.

OPCEventSubCondition Object

The OPCEventSubCondition object represents a specific subcondition of OPCEvent Server. OPCEventSubCondition contains the attributes of the subcondition.

Note

OPC Event Server for SIMATIC NET does not support conditions.

Page 484: Industrial Communication With PG-PC

Using the OPC Server

484SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3 Programming the Custom Interface

The Custom Interface is designed in such a way that it functions ideally to meet thegiven requirements. For access using script languages, it is not suitable. For thispurpose, there is the Automation Interface.

There is both a Custom Interface for access to process variables (data access)and for processing events and alarms (Alarms & Events).

Application

You program the Custom Interface if you want to create an application with a largenumber of variables and high data throughput with C++.

CLSID

Each COM class can be uniquely identified by an identification code. This is 128bits long and is called the CLSID. Using the CLSID, the operating system can findthe DLL or EXE in which the COM class is implemented. If the client wants to usean object of a class, it references it using the CLSID.

ProgID

To simplify identification of OPC servers, a readable ProgID is assigned to theCLSIDs. The CLSID and ProgID are specified by the vendor of the OPC server.

For the OPC Server of SIMATIC NET, the following points apply to all protocols:

Interface ProgID

Data Access OPC.SimaticNET(standard OPC server for multipleprotocol operation)

OPC.SimaticNET.DP(OPC server for efficient DP ac-cess)

OPC.SimaticNet.PD(bus server PROFIDrive)

Alarms & Events for S7 OPC.SimaticNetAlarms(A&E server for S7)

OPC.SimaticNetAlarmsSNMP(A&E server for SNMP)

Page 485: Industrial Communication With PG-PC

Using the OPC Server

485SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Steps

You create a COM object and call its methods.

Note

A Windows object is an instance of a COM class. The COM class differs from theC++ class. A class in C++ is a type definition. A COM class is an objectdescription and contains no types.

8.3.1 Creating COM Objects and Querying the Status of the OPCServer

You will find a detailed description of using the Custom Interface for OPC DataAccess in the description of the examples. The description below simply outlinesthe basic sequence and makes no attempt to deal with error handling.

You create a COM object and query the status in five steps.

For examples of creating a COM object in Visual C++, refer to Sections 9.4 and9.5.

8.3.2 Objects of the Custom Interface for Data Access

This section lists the interfaces of the objects and their methods. Only the featuresspecific to SIMATIC NET are described. For a detailed description of theinterfaces, refer to the relevant OPC Specifications.

Return Values of the Methods of the Interfaces

All methods return a result of the type HResult.

Objects

The following objects exist for the Custom Interface:

Page 486: Industrial Communication With PG-PC

Using the OPC Server

486SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3.3 OPCServer Object

An object of the OPC server class has various attributes that contain, for example,information on the status or the version of an OPCServer object. The class alsohas methods with which a client manages the objects of the OPC Group class.

A client application only uses the OPC server object directly using COMmechanisms. All other objects are created by the relevant OPC methods.

Interfaces of OPCServer

The graphic below shows the interfaces of the OPCServer object.

Figure 8-16 OPCServer Object

Page 487: Industrial Communication With PG-PC

Using the OPC Server

487SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IOPCServer Interface

The IOPCServer interface contains methods for managing the objects of the OPCGroup class. Information can also be obtained about the current status of theserver.

Below, you will find a list of the methods for the IOPCServer interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

AddGroup Generates a group in the server object.

The parameter LCID is not evaluated with theOPC Server for SIMATIC NET.

The pTimeBias parameter specifies the timedifference compared with the local time zone.

The update rates used by the OPC Server forSIMATIC NET are multiples of the cycle timespecified during configuration. The minimumupdate rate is the same as the cycle time.If szName is empty, a name is generated thatstarts with the tilde character (for example~GROUP_1). User-defined names shouldtherefore not begin with a tilde.

CreateGroupEnumera-tor

Creates various enumerators for the group.

The OPC Server for SIMATIC NET does not sup-port public groups. The return values of the me-thods should therefore be identical with the inputvalues ...PRIVATE and ...PUBLIC (for PublicGroups) for the parameter dwScope.

GetErrorString Gets an error message for an error code.

The OPC Server for SIMATIC NET supportsGerman and English error texts. Error messagesfrom the Windows operating system are dis-played in the language of the operating systeminstallation.

GetGroupByName Returns an additional interface pointer to thename of a private group; the reference counter isincremented.

Page 488: Industrial Communication With PG-PC

Using the OPC Server

488SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Method Meaning

GetStatus Returns status information on the server.

The return value is the name and the version ofthe OPC server.

RemoveGroup Deletes a group in the server.

The OPC Server for SIMATIC NET does not sup-port the use of bForce. You cannot deletegroups if references to them still exist.

IOPCServerPublicGroups Interface

The OPC Server for SIMATIC NET does not support public groups and thereforedoes not support the optional IOPCServerPublicGroups interface.

Page 489: Industrial Communication With PG-PC

Using the OPC Server

489SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IOPCBrowseServerAddressSpace Interface

Using the optional interface IOPCBrowseServerAddressSpace, you can browsethe name space of the server. The name space contains all the OPC items knownto the server.

Below, you will find a list of the methods for the IOPCBrowseServerAddressSpaceinterface. Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

BrowseAccessPaths Gets the access path of an ItemID. BrowseAc-cessPaths is not required with the OPC Serverfor SIMATIC NET.

BrowseOPCItemIDs Returns a string of the type IEnumString, whosecontent is specified by the parameters of the call.

If the input parameter dwBrowseFilterType isset to OPC-BRANCH, the parameters vtDataTy-peFilter and dwAccessRightsFilter have noeffect.

The rules for creating a filter are as follows:*any character string including empty strings+any character string, but there must be at leastone character?exactly one character[]exactly one character from the specified setIf you use a filter character, this must be precededby a backslash (\).

ChangeBrowsePosition Changes to the higher level or to a branch in thename space

GetItemID Gets a complete ItemID in the hierarchical namespace. The OPC Server for SIMATIC NET sup-ports GetItemID only for single leaves.

QueryOrganization Returns the structure of the name space. Thename space of the OPC Server for SIMATICNET is hierarchically structured.

Page 490: Industrial Communication With PG-PC

Using the OPC Server

490SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

IOPCItemProperties Interface

The IOPCItemProperties interface contains methods for querying server-specificinformation on an item.

Below, you will find a list of the methods for the IOPCItemProperties interface.Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

QueryAvailableProperties Returns a list of available properties for an item

GetItemProperties Returns the values of the properties of an itemtransferred in a list of PropertyIDs

LookupItemIDs Returns a list of ItemIDs for a list of Proper-tyIDs

IconnectionPointContainer Interface

The IConnectionPointContainer interface is a standard COM interface for reportingasynchronous events over connection points. For more detailed information on theuse of connection points, refer to the literature on COM.

Page 491: Industrial Communication With PG-PC

Using the OPC Server

491SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IOPCCommon Interface

The IOPCCommon interface contains methods to inform the server of thelanguage settings and the name of the client.

Below, you will find a list of the methods for the IOPCCommon interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

SetLocaleID Sets the language code of the server. The OPCServer for SIMATIC NET supports German andEnglish.

GetLocaleID Gets the language code of the server. The OPCServer for SIMATIC NET supports German andEnglish.

QueryAvailableLoca-leIDs

Returns all available language codes of the ser-ver. The OPC Server for SIMATIC NET supportsGerman and English.

GetErrorString Returns an error text for an error code

SetClientName Transfers a text describing the client to the ser-ver

IPersistFile Interface

The optional IPersistFile interface is not supported by the OPC Server for SIMATICNET.

Page 492: Industrial Communication With PG-PC

Using the OPC Server

492SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3.4 OPCGroup Object

An object of the OPC Group class manages the individual process variables, theOPC items. Using the OPCGroup objects, a client can form meaningful units ofOPC items and execute operations with them.

Interfaces of OPCGroup

The graphic below shows the interfaces of OPCGroups.

Figure 8-17 OPCGroup Object

Page 493: Industrial Communication With PG-PC

Using the OPC Server

493SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IOPCGroupStateMgt Interface

The IOPCGroupStateMgt interface provides methods for managing groups. Youcan edit group-specific parameters and copy groups.

Below, you will find a list of the methods for the IOPCGroupStateMgt interface.Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

CloneGroup Creates a copy of a group. The group attributesare copied with the exception of the following:

The active status is set to false.

A new server handle is assigned

szName can be empty. In this case, a uniquename is generated.

GetState Gets the status of the group.

The parameters pTimeBias and pLCID have nosignificance for the OPC Server for SIMATICNET.

SetName Changes the name of a group

SetState Changes the properties of the group.

The parameters pTimeBias and pLCID have nosignificance for the OPC Server for SIMATICNET.

The update rates used by the OPC Server forSIMATIC NET are multiples of the cycle timespecified during configuration. The minimumupdate rate is the same as the cycle time.

IOPCPublicGroupStateMgt Interface

The OPC Server for SIMATIC NET does not support public groups. For thisreason, the optional IOPCPublicGroupStateMgt interface has no significance.

Page 494: Industrial Communication With PG-PC

Using the OPC Server

494SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

IOPCAsyncIO2 Interface

The IOPCAsyncIO2 interface contains methods for asynchronous reading andwriting of items.

Asynchronous means that the client starts a read or write operation and thencontinues to execute. The interface uses connection points. This simplifiesprocessing of the transferred data.

With each value read, OPC provides a timestamp. Since the SIMATIC systems donot manage a timestamp, the time at which the value was received on the server isused as the timestamp.

Below, you will find a list of the methods for the IOPCAsyncIO2 interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

Read Sends an asynchronous read command.

The call is monitored for timeout on the server. Ifthe timeout set in the configuration elapses,there is a notification with the status E_ABORT.

Write Sends an asynchronous write command.

The call is monitored for timeout on the server. Ifthe timeout set in the configuration elapses,there is a notification with the status E_ABORT.

Cancel2 Cancels a pending job

Refresh Requests the current value from the cache foreach active item

SetEnable Allows deactivation of notification with OnData-Change

GetEnable Returns the current value for notification with On-DataChange

IOPCAsyncIO Interface

This interface contains methods for asynchronous reading and writing of items.Asynchronous means that the client starts a read or write operation and thencontinues to execute.

Asynchronous operations return a transaction ID. When the server has completedthe read or write operation, the client is notified by a message to its IAdviseSinkinterface.

Page 495: Industrial Communication With PG-PC

Using the OPC Server

495SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Note

In version 2, the IOPCAsyncIO interface was replaced by IOPCAsyncIO2.IOPCAsyncIO2 uses connection points and is easier to handle. In future projects,use IOPCAsyncIO2.

With each value read, OPC provides a timestamp. Since the SIMATIC systems donot manage a timestamp, the time at which the value was received on the server isused as the timestamp.

Below, you will find a list of the methods for the IOPCAsyncIO interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

Cancel Cancels a pending job.

Read Sends an asynchronous read command.

The call is monitored for timeout on the server.The configuration parameter is Read/Write Ti-meout. If this times out, there is a callback withthe status E_ABORT.

Refresh Requests a current value for every active OPCitem.

Write Sends an asynchronous write command.

The call is monitored for timeout on the server.The configuration parameter is Read/Write Ti-meout. If this times out, there is a callback withhrStatus=E_ABORT.

Page 496: Industrial Communication With PG-PC

Using the OPC Server

496SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

IOPCItemMgt Interface

The IOPCItemMgt interface contains methods for managing several items in agroup.

Below, you will find a list of the methods for the IOPCItemMgt interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

AddItems Adds one or more items to a group.

CreateEnumerator Creates an enumerator. This is the EnumOPCI-temAttributes object.

RemoveItems Deletes one or more items from a group.

SetActiveState Sets the active status of one or more items of thegroup.

SetClientHandles Sets the client handle of one or more items of thegroup.

SetDataTypes Sets the required data type of one or more itemsof the group.

ValidateItems Checks the validity of an OPC item.

Page 497: Industrial Communication With PG-PC

Using the OPC Server

497SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IOPCSyncIO Interface

The IOPCSyncIO interface contains methods for synchronous reading and writing.Synchronous means that the client waits until a read or write operation iscompleted before it continues. The client can use the result of the read or writeoperation for further processing.

Since the OPC Server for SIMATIC NET starts a separate thread for each client,other clients are not blocked while the client waits.

Below, you will find a list of the methods for the IOPCSyncIO interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

Read Reads the values, a status information and thetimestamp of one or more items of a group.

The call is monitored for timeout on the server.The corresponding timeout is set during configu-ration for each specific protocol.

Write Writes the value for one or more items of agroup.

The call is monitored for timeout on the server.The corresponding timeout is set during configu-ration for each specific protocol.

Page 498: Industrial Communication With PG-PC

Using the OPC Server

498SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

IDataObject Interface

The IDataObject interface is a standard COM interface for data transfer. It containsmethods for establishing a notification connection between client and a servergroup.

When the server sends the client a notification, it accesses the client over theIAdviseSink client interface by calling the OnDataChange method of IAdviseSink.

The following graphic illustrates the interaction of the interfaces IAdviseSink on theclient and IDataObject on the server.

Figure 8-18 Interaction of IAdviseSink and IDataObject

Note

IDataObject was used in version 1 of the Data Access interface for asynchronouscommunication. As of version 2, connection points are used and are both simplerand more flexible. In future projects, use version 2.

Below, you will find a list of the methods for the IDataObject interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

DAdvise Establishes a connection between server andclient

DUnadvise Terminates a connection between server andclient

Page 499: Industrial Communication With PG-PC

Using the OPC Server

499SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IEnumOPCItemAttributes Interface

The IEnumOPCItemAttributes interface is based on the standard IEnum interface.It returns the items of a group of. The interface is provided by theCreateEnumerator method of the IOPCItemMgt interface. It is not obtainable withQueryInterface.

Below, you will find a list of the methods for the IEnumOPCItemAttributes interface.Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Data Access Custom Interface StandardVersion 2.05December 17, 2001

Method Meaning

Clone Creates an identical copy of the IEnumOPCIte-mAttributes object

Next Fetches the next OPC item of the group.

Reset Resets the list to the first item of the group

Skip Skips a number of items in the list

8.3.5 Objects of the Custom Interface for Alarms & Events

The interfaces and their methods are listed below. Only the features specific toSIMATIC NET are described. For a detailed description of the interfaces, refer tothe relevant OPC Specifications.

Return Values of the Methods of the Interfaces

All methods return a result of the type HResult.

Objects

The following objects exist for the Custom Interface for Alarms & Events:

Page 500: Industrial Communication With PG-PC

Using the OPC Server

500SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3.6 OPCEventServer Object

An object of the OPC Event Server class is created by the client. The client thenuses this object when it requires the services of Alarms & Events.

The following tasks can be performed using the OPCEventServer object:

� Create message object

� Execute queries

� Activate events

� Set the language for display texts

� Register to receive server-specific events

Interfaces of OPCEventServer

The graphic below shows the interfaces of OPCEventServer.

Figure 8-19 OPCEventServer Object

Page 501: Industrial Communication With PG-PC

Using the OPC Server

501SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

IOPCCommon Interface

The IOPCCommon interface contains methods to inform the server of thelanguage settings and the name of the client.

Below, you will find a list of the methods for the IOPCCommon interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Alarms & Events Custom Interface StandardVersion 1.10October 2, 2002

Method Meaning

SetLocaleID Sets the language code of the server. TheOPC Server for SIMATIC NET supports Ger-man and English.

GetLocaleID Gets the language codes of the server. TheOPC Server for SIMATIC NET supports Ger-man and English.

QueryAvailableLocaleIDs Returns all available language codes of theserver. The OPC Server for SIMATIC NETsupports German and English.

GetErrorString Gets an error message for an error code

SetClientName Transfers a text describing the client to theserver

IOPCEventServer Interface

The IOPCEventServer interface is the central interface for Alarms & Events. It hasthe following tasks:

� Creating subscription objects

� Creating area browsers

� Browsing event categories

� Managing conditions

Note

SIMATIC NET supports the optional areas so that no area browser is created.

Page 502: Industrial Communication With PG-PC

Using the OPC Server

502SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Below, you will find a list of the methods for the IOPCEventServer interface. Onlythe features specific to SIMATIC NET are described. You will find a description ofthe methods in the following OPC Specification:

Alarms & Events Custom Interface StandardVersion 1.10October 2, 2002

Method Meaning

GetStatus Gets current status information about the OPCserver.

CreateEventSubscrip-tion

Creates a message object to notify a client. Themessage object is called subscription and is likea ticket to a set of events.

The interface required to access the messageobject is returned

QueryAvailableFilters Returns information about the filter options sup-ported by the event server.

OPC Event Server for SIMATIC NET does notsupport the following filters:

OPC_FILTER_BY_EVENTS: 0x01OPC_FILTER_BY_CATEGORY: 0x02OPC_FILTER_BY_SEVERITY: 0x04OPC_FILTER_BY_SOURCE: 0x16

QueryEventCategories Returns the event categories provided by theevent server.

The OPC Event Server for SIMATIC NET returnsevent categories only when the parameter dwE-ventType has the value OPC_SIMPLE_EVENT.

The OPC Event Server for SIMATIC NETsupports the event categoryS7_PROCESS_ALARM: 0x02

QueryConditionNames Returns the conditions provided by the event ser-ver for a specific event category.

OPC Event Server for SIMATIC NET does notsupport conditions.

QuerySubConditionNa-mes

Returns the subconditions provided by the eventserver for a specific event category.

The OPC Event Server for SIMATIC NET doesnot support subconditions.

Page 503: Industrial Communication With PG-PC

Using the OPC Server

503SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Method Meaning

QuerySourceConditions Returns the conditions provided by the OPCEvent Server for a specific source.

OPC Event Server for SIMATIC NET does notsupport conditions.

QueryEventAttributes Returns the attributes provided by the event ser-ver for a specific event category.

The OPC Event Server for SIMATIC NET provi-des special attributes. The attributes cannot beused as ItemIDs with Data Access.

TranslateToItemIDs Gets the OPCItems corresponding to an eventattribute to use with an associated OPC DataAccess Server.

The OPC Event Server for SIMATIC NET doesnot support TranslateToItemIDs.

GetConditionState Returns information about the state of a condi-tion of a source.

The OPC Event Server for SIMATIC NET doesnot support conditions. E_NOTIMPL is returned.

EnableConditionByArea Activates all conditions for all sources within thespecified area.

OPC Event Server for SIMATIC NET does notsupport conditions. E_NOTIMPL is returned.

EnableConditionBy-Source

Activates all conditions for all specified sources.

OPC Event Server for SIMATIC NET does notsupport conditions. E_NOTIMPL is returned.

DisableConditionByA-rea

Deactivates all conditions for all sources withinthe specified area.

OPC Event Server for SIMATIC NET does notsupport conditions. E_NOTIMPL is returned.

DisableConditionBy-Source

Deactivates all conditions for all specified sour-ces.

OPC Event Server for SIMATIC NET does notsupport conditions. E_NOTIMPL is returned.

Page 504: Industrial Communication With PG-PC

Using the OPC Server

504SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Method Meaning

AckCondition Transfers an event acknowledgment to the client.Only conditional events can be acknowledged

OPC Event Server for SIMATIC NET does notsupport conditions.

CreateAreaBrowser Creates an OPCEventAreaBrowser object tobrowse the process space

OPC Event Server for SIMATIC NET does notsupport areas. E_NOTIMPL is returned.

IconnectionPointContainer Interface

The IConnectionPointContainer interface is a standard COM interface for reportingasynchronous events over connection points. For more detailed information on theuse of connection points, refer to the literature on COM.

8.3.7 OPCEventSubscription Object

An object of the OPC Event Subscription class sends event messages to the clientthat uses the IConnectionPointContainer interface of this object.

A client can use several OPCEventSubscription objects. It can define differentfilters for the various objects.

An OPCEventSubscription corresponds to a ticket for defined events.

Page 505: Industrial Communication With PG-PC

Using the OPC Server

505SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Interfaces of OPCEventSubscription

The graphic below shows the interfaces of OPCEventSubscription.

Figure 8-20 OPCEventSubscription Object

Page 506: Industrial Communication With PG-PC

Using the OPC Server

506SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

IOPCEventSubscriptionMgt Interface

The IOPCEventSubscriptionMgt interface is the central interface for managing theinformation on a specific event subscription. Over the interface, for example, theevents relevant to the client can be selected.

Below, you will find a list of the methods for the IOPCEventSubscriptionMgtinterface. Only the features specific to SIMATIC NET are described. You will find adescription of the methods in the following OPC Specification:

Alarms & Events Custom Interface StandardVersion 1.10October 2, 2002

Method Meaning

SetFilter Sets the filter for selecting certain events for thisevent subscription. The filter parameters havethe following significance for the OPC EventServer for SIMATIC NET:

Event TypeThe OPC Event Server supports only the eventtype OPC_SIMPLE_EVENT. There is therefore nopoint in making a setting other thanOPC_SIMPLE_EVENT.

Event CategoriesThe following event categories exist:S7_PROCESS_ALARM

SeverityThe severity can be configured in STEP 7 orSIMATIC NCM PC/S7. The default is:S7_PROCESS_ALARM: 600

AreasOPC Event Server for SIMATIC NET does notsupport areas.

SourceYou can enter a connection name.

GetFilter Returns the currently used filters of the eventsubscription.

See SetFilter.

SelectReturnedAttribu-tes

Specifies the attributes returned with an eventmessage for an event category

GetReturnedAttributes Returns the list of attributes returned with anevent message for an event category.

Page 507: Industrial Communication With PG-PC

Using the OPC Server

507SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Method Meaning

Refresh Sends all active and all inactive, unacknowled-ged condition messages that match the currentfilter setting to the client.

The OPC Event Server for SIMATIC NET sup-ports only simple events. No event message isare therefore sent with Refresh.

CancelRefresh Cancels execution of a current refresh.

Since no event message is are sent with Re-fresh, CancelRefresh has no effect.

GetState Returns the current state of the event subscrip-tion.

SetState Sets various properties of an event subscription.

IconnectionPointContainer Interface

The IConnectionPointContainer interface is a standard COM interface for reportingasynchronous events over connection points. For more detailed information on theuse of connection points, refer to the literature on COM.

8.3.8 OPCEventAreaBrowser Object

The OPC Event Server does not support areas and as a result theOPCEventAreaBrowser object cannot be used.

Page 508: Industrial Communication With PG-PC

Using the OPC Server

508SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3.9 Interfaces of the Client for Alarms and Events

Informing the Client of Events

The client is informed of events over connection points. To allow this, the clientmust provide a COM object with the IUnknown interface and the call-specificIOPCEventSink interface to receive the calls. When it registers at a connectionpoint, the client passes a pointer to the IUnknown interface to the server.

Interfaces of the Client Object

The object that the client provides to receive messages must have the structureshown below:

Figure 8-21 Interfaces of the Client

Page 509: Industrial Communication With PG-PC

Using the OPC Server

509SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.3.10 IOPCEventSink Interface

The IOPCEventSink interface is the central interface of the client for receivingmessages. It contains one method that is called by the server to transfer events.

Below, you will find a list of the methods for the IOPCEventSink interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Alarms & Events Custom Interface StandardVersion 1.10October 2, 2002

Method Meaning

OnEvent Transfers one or more event messages to theclient.The *pEvents structure contains one or moreevents. The OPC Event Server enters specificvalues in the following structure elements:

SzSourceconnection information.The connection information cannot be convertedto an ItemID using TranslateToItemID and thenbe used by Data Access.

ftTimeTime at which the event happened on the partnerdevice. The time at which the message is recei-ved on the OPC Event Server is entered in theEVENT_ATTR_S7_PCTIME attribute.

szMessageALARM message number

dwEventTypeOPC_SIMPLE_EVENT

dwEventCategoryS7_PROCESS_ALARM

pEventAttributesThis structure contains the attributes deliveredwith the event. The attributes also include theassociated values of the message supplied bythe partner device.

All other structure elements are irrelevant.

Page 510: Industrial Communication With PG-PC

Using the OPC Server

510SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.3.11 IOPCShutdown Interface

Over this connection point-based call interface, the server can inform the clientsbefore it is shut down or before it shuts itself down. This allows the clients to reactand, if required, to shut down.

Below, you will find a list of the methods for the IOPCShutdown interface. Only thefeatures specific to SIMATIC NET are described. You will find a description of themethods in the following OPC Specification:

Alarms & Events Custom Interface StandardVersion 1.10October 2, 2002

Method Meaning

ShutdownRequest The server notifies its clients that it is shuttingdown

You can set the text for the reason for theshutdown (szReason) in the configurationprogram for the OPC server.

Page 511: Industrial Communication With PG-PC

Using the OPC Server

511SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.4 Programming the XML Interface

Note

The OPC XML interface is available in the SIMATIC NET Software from Version6.1 onwards.

Introduction

This section describes the methods of the XML DA interface. It introduces the tagstructure of the methods graphically and describes the individual elements andattributes.

First the syntax of the method description is shown. This is followed bydescriptions of the basic schemas. These are elements that occur more than oncein the schema definition of OPC XML-DA. Following this, we will then look at theindividual methods.

XML Schema Definition of the Data Types

In keeping with the XMLSchema2001 definition, the schema section of the WSDLof OPC XML-DA describes the complex data types that are used as theparameters of the individual methods. A precise description can be found in theOPC XML-DA Specification.

In the code of the Web service, a C# class is created for every complex data typefrom the XML schema. The methods of the Web service are described in aninterface.

8.4.1 Description of the Elements

Conventions Used in the Element Descriptions

The descriptions of the OPC-XML elements are preceded by a representation ofthe tag structure. Elements are indicated by bold type, attributes by italic type. Thenesting of the tags is reflected by the depth to which they are indented. Theattributes of a tag are also indented beyond the corresponding tag.

Page 512: Industrial Communication With PG-PC

Using the OPC Server

512SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Example

The tag structure might be as follows:

<tag1> <tag2 att1=”yes” att2=”no”>content of tag2 </tag2> <tag3>content of tag3 </tag3></tag1>

In the description of <tag1>, you would then find the structure represented asshown below:tag1

tag2

att1

att2

tag3

The elements tag2 and tag3 are indented further than the tag1 element becausethey are subelements of tag1. Immediately following tag2, you can also see theattributes att1 and att2 of this element in dark blue characters.

8.4.2 Basic Schemas

Schema Definition for OPC XML-DA

There is a schema definition for all elements of OPC-XML-DA. In thesedescriptions, we often refer to the definition of basic, commonly used elements.The section below describes some of these elements:

ItemProperty

An element used to define properties of an item.

ItemValue

An element with which the value of an item and any relevant additional information(for example, a timestamp) is specified.

OPCError

Contains the error code and description of an OPC error.

ReplyBase

An element with basic information on a server response (for example, time at whichthe response was sent).

RequestOptions

Contains information specifying a client request in greater detail.

Page 513: Industrial Communication With PG-PC

Using the OPC Server

513SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.4.3 ItemProperty

Tag StructureItemProperty

Name

ItemPath

ItemName

ErrorID

SuccessID

Value

Elements and Attributes

Name

Contains the name of the property

ItemPath

Information on the path of an element. An element can be identified uniquely in thename space of the server with the attributes ItemPath and ItemName.

ItemName

See ItemPath.

ErrorID

In the event of an error, this contains the name of an OPC error.

SuccessID

If this exists, it contains information on possible problems.

Value

The current value of the property.

Page 514: Industrial Communication With PG-PC

Using the OPC Server

514SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.4 ItemValue

Tag StructureItemValue

ValueType

ItemPath

ItemName

ClientItemHandle

Timestamp

Quality

LimitBits

VendorBits

ErrorID

SuccessID

Value

DiagnosticInfo

Elements and Attributes

ValueType

An attribute that can be accessed by the client and that contains the value type.

ItemPath

Allows access to the data. This attribute is server-specific.

ItemName

Identifies the data.

ClientItemHandle

A string assigned by the client. If this attribute is specified by the client, the servermust return it.

Timestamp

The time at which the values of the data were last obtained.

Quality

Information about the quality of the data. If the server does not return this attribute,the quality is “Good”. If the quality is “Bad” or “Uncertain”, the attribute is returned.

LimitBits

Specifies the limit bit. This attribute is returned for every limit status except “none”.

Page 515: Industrial Communication With PG-PC

Using the OPC Server

515SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

VendorBits

A numeric value for the “OPC Vendor Bit”.

ErrorID

In the event of an error, this contains the name of an OPC error.

SuccessID

If this exists, it contains information on possible problems.

Value

The value of the item. Since this attribute involves polymorphous information, theadditional attribute xsi:type is necessary (for example, xsi:type=“xsd:float”).

Diagnostic Info

Detailed server-specific diagnostic information.

8.4.5 OPCError

Tag StructureOPCError

ID

Text

Elements and Attributes

ID

Contains the name of the OPC error.

Text

A description of the error in text form. The content of the string depends of the“LocaleID” attribute.

Page 516: Industrial Communication With PG-PC

Using the OPC Server

516SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.6 ReplyBase

Tag StructureReplyBase

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

Elements and Attributes

RcvTime

Indicates the time at which the server received the request; a mandatory attribute.

ReplyTime

Indicates the time at which the server sent the reply; a mandatory attribute.

ClientRequestHandle

If this attribute was included in the client’s request, it is returned by the server withthe response.

RevisedLocaleID

If the client specifies a value for the “LocaleID” attribute that is supported by theserver, the server returns the default value for the “LocaleID” attribute with the“RevisedLocaleID” attribute.

ServerState

Specifies the status of the server and is always returned; a mandatory attribute.

Page 517: Industrial Communication With PG-PC

Using the OPC Server

517SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.4.7 RequestOptions

Tag StructureRequestOptions

ReturnErrorText

ReturnDiagnosticInfo

ReturnItemTime

ReturnItemName

ReturnItemPath

RequestTimeout

ClientRequestHandle

LocaleID

Elements and Attributes

ReturnErrorText

The default for this attribute is “TRUE”. In this case, the server returns detailederror descriptions.

ReturnDiagnosticInfo

The server returns detailed diagnostic information if the value of this attribute is“TRUE”.

ReturnItemTime

Specifies whether or not a timestamp is returned for each item. The default is“FALSE”, no value is returned.

ReturnItemName

Specifies whether or not the “ItemName” attribute is returned for each item. Thedefault is “FALSE”, no value is returned.

ReturnItemPath

Specifies whether or not the “ItemPath” attribute is returned for each item. Thedefault is “FALSE”, no value is returned.

RequestTimeout

Specifies the latest time that the client will wait for a response from the server. Datafor items that are not available at this time is returned as an error. If the specifiedtime is earlier than the current time on the server, the entire request fails.

Page 518: Industrial Communication With PG-PC

Using the OPC Server

518SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

ClientRequestHandle

If this attribute was included in the client’s request, it is returned by the server withthe response. In large and complex systems, this information helps the client torelate the responses to the requests. Specifying this attribute is optional.

LocaleID

An optional attribute with which the client specifies the language for certainreturned data.

8.4.8 Read

Tag StructureRead

Options

ReturnErrorText

ReturnDiagnosticInfo

ReturnItemTime

ReturnItemName

ReturnItemPath

RequestTimeout

ClientRequestHandle

LocaleID

ItemList

Items

ItemPath

ItemName

ReqType

ItemName

ClientItemHandle

MaxAge

Elements and Attributes

Read

The <Read> element contains all the information for a read job.

Options

The <Options> element contains options that are available for the XML-DArequests. This element is of the type RequestOptions. You will find information onthe attributes of this element in the relevant section of this documentation.

Page 519: Industrial Communication With PG-PC

Using the OPC Server

519SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

ItemList

The container element for the individual items. A request can contain severalitems.

Items

Element with which a single item is specified.

ItemPath

Allows access to the data. This attribute is server-specific.

ItemName

The name of the item.

ReqType

Specifies the data type for the value of the item requested by the client. All datatypes listed in the specification are supported.

ClientItemHandle

A string assigned by the client. If this attribute is specified by the client, the servermust return it.

MaxAge

A period of time for the type xsd:duration that specifies the maximum age of thedata. The data should not be older than the duration specified here.

Example

<?xml version=“1.0” encoding=“utf–8” ?><soap:Envelopexmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=“http://www.w3.org/2001/XMLSchema”><soap:Body> <Read xmlns=”http://opcfoundation.org/webservices/OPCDA/”> <Options ReturnDiagnosticInfo=“false” ReturnItemName=“true” ReturnItemPath=“true” RequestTimeout=“2002-04-29T10:30:44.9618750+02:00” ClientRequestHandle=“ReadReals” LocaleID=“en-US” /> <ItemList> <Items ItemPath=“/Reals” ItemName=“Float” ClientItemHandle=“Float” /> <Items ItemPath=“/Reals” ItemName=“Double” ClientItemHandle=“Double” />

Page 520: Industrial Communication With PG-PC

Using the OPC Server

520SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

<Items ItemPath=“/Reals” ItemName=“Decimal” ClientItemHandle=“Decimal” /> </ItemList> </Read></soap:Body></soap:Envelope>

C# Interface for the Synchronous Read Web Method

When using C# user programs, the following method is available for reading values. Onlysome of the parameters listed above need to be specified:

ReplyBase Read(RequestOptions Options, ReadRequestItemList[] ItemList, out ReplyItemList[] ItemValues, out OPCError[] Error);

8.4.9 ReadResponse

Tag StructureReadResponse

ReadResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

ItemValues

Items

ValueType

ItemPath

ItemName

ClientItemHandle

Timestamp

Quality

LimitBits

VendorBits

ErrorID

SuccessID

Value

DiagnosticInfo

Errors

ID

Text

Page 521: Industrial Communication With PG-PC

Using the OPC Server

521SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Elements and Attributes

Read

Using the <ReadResponse> element, the server returns the results of a read job.

ReadResults

The <ReadResults> element contains basic information on the response of theserver.

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

Item Values

The container element for the individual items of a response. A response cancontain several items.

Items

Element with which a single item is specified.

This element is of the type ItemValue. You will find information on the attributes ofthis element in the relevant section of this documentation.

Errors

An array of errors that occurred with this response.

This element is of the type OPCError. You will find information on the attributes ofthis element in the relevant section of this documentation.

Example

<ReadResponse xmlns=“http://opcfoundation.org/webservices/OPCDA/”> <ReadResult RcvTime=“2002-04-29T10:25:44.0712500+02:00” ReplyTime=“2002-04-29T10:25:44.0868750+02:00” ClientRequestHandle=“ReadReals” RevisedLocaleID=“en” ServerState=“running”/> <ItemValues> <Items ItemPath=“/Reals” ItemName=“Float” ClientItemHandle=“Float” ValueType=“xsd:float” Timestamp=“2002-04-29T10:25:44.9618750+02:00”> <Value xsi:type=”xsd:float”>0.7460189</Value> </Items> <Items ItemPath=“/Reals” ItemName=“Double” ClientItemHandle=“Double” ValueType=“xsd:double”

Page 522: Industrial Communication With PG-PC

Using the OPC Server

522SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Timestamp=“2002-04-29T10:25:44.1962500+02:00”> <Value xsi:type=”xsd:double”>0.7616785166619530</Value> </Items> <Items ItemPath=“/Reals” ItemName=“Decimal” ClientItemHandle=“Decimal” ValueType=“xsd:decimal” Timestamp=“2002-04-29T10:25:44.9618750+02:00”> <Value xsi:type=”xsd:decimal”>0.746018909356237</Value> </Items> </ItemValues></ReadResponse>

8.4.10 Write

Tag StructureWrite

ReturnValuesOnReply

Options

ReturnErrorText

ReturnDiagnosticInfo

ReturnItemTime

ReturnItemName

ReturnItemPath

RequestTimeout

ClientRequestHandle

LocaleID

ItemList

ItemPath

ReqType

Items

ValueType

ItemPath

ItemName

ClientItemHandle

Timestamp

Quality

LimitBits

VendorBits

ErrorID

SuccessID

Value

DiagnosticInfo

Page 523: Industrial Communication With PG-PC

Using the OPC Server

523SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Elements and Attributes

Write

The <Write> element contains all the information for a write job. The write job canbe performed for one or more items. As an option, values for the attributes “Time”,”Quality”, ”LimitBits”, and “VendorBits” can also be written.

Options

The <Options> element contains options that are available for the XML-DArequests. This element is of the type RequestOptions. You will find information onthe attributes of this element in the relevant section of this documentation.

ItemList

The container element for the individual items. A request can contain severalitems.

ItemPath

Allows access to the data. This attribute is server-specific.

ReqType

Specifies the data type for the value of the item required by the client. All data typeslisted in the specification are supported.

Items

Element with which a single item is specified.

This element is of the type ItemValue. You will find information on the attributes ofthis element in the relevant section of this documentation.

Example

<soap:Body> <Write ReturnValuesOnReply=“true” xmlns=“http://opcfoundation.org/webservices/OPCDA/”> <Options ReturnDiagnosticInfo=“false” ReturnItemName=“true” ReturnItemPath=“true” RequestTimeout=“2002-04-29T10:54:38.8837500+02:00” ClientRequestHandle=“WriteString” LocaleID=“en-US” /> <ItemList> <Items ItemPath=“” ItemName=“String” ClientItemHandle=“String” ValueType=“xsd:string”> <Value xsi:type=”xsd:string”>hello</Value> </Items> </ItemList>

Page 524: Industrial Communication With PG-PC

Using the OPC Server

524SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

</Write></soap:Body>

C# Interface for the Synchronous Write Web Method

When using C# user programs, the following method is available for writing values. Onlysome of the parameters listed above need to be specified:

ReplyBase Write(RequestOptions Options, bool ReturnItemVal, WriteRequestItemList[] ItemList, out ReplyItemList[] ItemValues, out OPCError[] Error);

8.4.11 WriteResponse

Tag StructureWriteResponse

WriteResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

ItemValues

Items

ValueType

ItemPath

ItemName

ClientItemHandle

Timestamp

Quality

LimitBits

VendorBits

ErrorID

SuccessID

Value

DiagnosticInfo

Errors

ID

Text

Page 525: Industrial Communication With PG-PC

Using the OPC Server

525SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Elements and Attributes

WriteResponse

Using the <WriteResponse> element, the server returns the results of a write job.

WriteResult

The <WriteResult> element contains basic information on the response of theserver.

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

Item Values

The container element for the individual items. A response can contain severalitems.

Items

Element with which a single item is specified.

This element is of the type ItemValue. You will find information on the attributes ofthis element in the relevant section of this documentation.

Errors

An array of errors that occurred with this response.

This element is of the type OPCError. You will find information on the attributes ofthis element in the relevant section of this documentation.

Example

<soap:Body> <WriteResponsexmlns=”http://opcfoundation.org/webservices/OPCDA/”> <WriteResultRcvTime=“2002-04-29T10:49:38.0712500+02:00” ReplyTime=“2002-04-29T10:49:38.0868750+02:00” ClientRequestHandle=“WriteString” RevisedLocaleID=“en” ServerState=“running”/> <ItemValues> <Items ItemPath=“” ItemName=“String” ValueType=“xsd:string” Timestamp=“2002-04-29T10:49:38.9150000+02:00”> <Value xsi:type=”xsd:string”>hello</Value> </Items> </ItemValues>

Page 526: Industrial Communication With PG-PC

Using the OPC Server

526SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

</WriteResponse></soap:Body>

8.4.12 Using Subscriptions

Contact Supported over Several Method Calls

In contrast to most other Web services, the OPC XML-DA Web services support loosecontact with a subscribed Web client over several method calls. This “loose” contact isknown as a polled subscription below. The values of items can be read cyclically with apolled subscription.

Client Logon and Logoff

The client logs on the subscription with the OPC XML-DA Web service. This then noteswhich items are of interest to the client and queries their values. When a polled requestarrives from the client, the current values are returned. The subscription is terminatedby the client.

Identification Using Handles

To identify the subscription, a handle assigned by the server is transferred as a parameterwith each future call. Is also possible to specify a list of handles so that severalsubscriptions are relevant per SubscriptionPolledRefresh. This increases the efficiencyof polling.

The address of the subscription object is returned to the client as the ItemListHandle sothat the subscription can be identified uniquely at the next SubscriptionPolledRefresh andSubscriptionCancel.

The following the graphic illustrates the use of a subscription:

Page 527: Industrial Communication With PG-PC

Using the OPC Server

527SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Period of Validity of the Monitored Items

The SubscriptionPolledResponse method returns the values of the client that wererequested with the polled subscription. When the SubscriptionCancel is received, theitem values are discarded. If no further SubscriptionPolledRefresh requests arrive fromthe client within a specified period (PingRate), the OPC DA Web service terminates thesubscription automatically in the same way as with the SubscriptionCancel method.

SubscriptionPingRate

Using the SubscriptionPingRate, the client can specify when the connection must beconsidered as being down. The OPC XML-DA Web service then starts an internal timer.If the client does not request any values before the timer elapses, the XML-DA Webservice deletes the data of the subscription in the same way as following theSubscriptionCancel method.

Page 528: Industrial Communication With PG-PC

Using the OPC Server

528SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.13 Subscribe

Tag StructureSubscribe

ReturnValuesOnReply

SubscriptionPingRate

Options

ReturnErrorText

ReturnDiagnosticInfo

ReturnItemTime

ReturnItemName

ReturnItemPath

RequestTimeout

ClientRequestHandle

LocaleID

ItemList

ItemPath

ReqType

ItemListHandle

Deadband

RequestedSamplingRate

EnableBuffering

Items

ItemPath

ReqType

ItemName

ClientItemHandle

Deadband

RequestedSamplingRate

EnableBuffering

Elements and Attributes

Subscribe

The <Subscribe> element contains all the information on a subscribe job.

ReturnValuesOnReply

If the value of this attribute is set to TRUE, the server returns values available fora SubscribeResponse. If the value is FALSE, the server returns no values with aSubscribeResponse.

SubscriptionPingRate

The value of this attribute specifies the interval at which the server checks theexistence of the client. If the client has not communicated with the server in the

Page 529: Industrial Communication With PG-PC

Using the OPC Server

529SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

specified period, the server can release all resources that were required for theclient’s subscription.

Options

The <Options> element contains options that are available for the XML-DArequests. This element is of the type RequestOptions. You will find information onthe attributes of this element in the relevant section of this documentation.

Item List

The container element for the individual items. A request can contain severalitems.

ItemPath

Allows access to the data. This attribute is server-specific.

ReqType

Specifies the data type for the value of the item requested by the client.

ItemListHandle

An ID assigned by the client to identify elements of the type SubscribeResponseand SubscriptionPolledRefreshResponse.

Deadband

This specifies a threshold value up to which value changes of an item do not triggera SubscriptionPolledRefresh. This is specified as a percentage of the maximumvalue range of the item. The value for this parameter should therefore be between0 and 100 percent and can only be used with items of the type integer and float.

RequestedSamplingRate

Frequency selected by the client at which the server is required to check changesin values.

Enablebuffering

If the value of this attribute is set to TRUE, the server saves all value changes ina buffer according to the RequestedSamplingRate parameter. The server returnsthe saved data to the client at the next PolledRequest.

Page 530: Industrial Communication With PG-PC

Using the OPC Server

530SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.14 SubscribeResponse

Tag StructureSubscribeResponse

ServerSubHandle

SubscribeResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

ItemValues

ItemListHandle

RevisedSamplingRate

Items

ValueType

Item Path

ItemName

ClientItemHandle

Timestamp

Quality

LimitBits

VendorBits

ErrorID

SuccessID

Value

DiagnosticInfo

Errors

ID

Text

Elements and Attributes

SubscribeResponse

The <SubscribeResponse> element contains all the information on aSubscribeResponse.

ServerSubHandle

The value specified by the server for this value must be used withSubscriptionPolledRefresh requests and SubscriptionCancel requests. Thisattribute identifies the client that sends the request.

SubscribeResult

The <SubscribeResult> element contains basic information on the response of theserver.

Page 531: Industrial Communication With PG-PC

Using the OPC Server

531SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

ItemValues

The available values for the items are only sent to the client when the client hasrequested them with a corresponding value for the ReturnValuesOnReply attribute(see Subscribe).

ItemListHandle

An ID assigned by the client to identify elements of the type SubscribeResponseand SubscriptionPolledRefreshResponse.

RevisedSamplingRate

The fastest update cycle supported by the server. This value is returned by theserver to the client.

Items

Element with which a single item is specified.

This element is of the type ItemValue. You will find information on the attributes ofthis element in the relevant section of this documentation.

Errors

An array of errors that occurred with this response.

This element is of the type OPCError. You will find information on the attributes ofthis element in the relevant section of this documentation.

8.4.15 SubscriptionPolledRefresh

Tag StructureSubscriptionPolledRefresh

HoldTime

WaitTime

ReturnAllItems

Options

ReturnErrorText

ReturnDiagnosticInfo

ReturnItemTime

ReturnItemName

ReturnItemPath

RequestTimeout

ClientItemHandle

LocaleID

ServerSubHandles

Page 532: Industrial Communication With PG-PC

Using the OPC Server

532SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Elements and Attributes

SubscriptionPolledRefresh

Using this element, the client requests the server to refresh the items that weredefined in a prior Subscription request.

HoldTime

This attribute instructs the server not to send any refreshed values to the client untilthe internal time of the server is equal to or greater than the value of this attribute.

WaitTime

After reaching the time specified in the HoldTime attribute, the server waits for thetime specified in WaitTime before returning the response. If the value of an itemchanges during the WaitTime, a response is sent immediately.

ReturnAllItems

If the value of this attribute is set to FALSE, the server returns only items that havechanges since the previous SubscriptionPolledRefresh request and the currentSubscriptionPolledRefresh request.

If this attribute is set to TRUE, the server returns all items that were defined in thecorresponding Subscription request.

Options

The <Options> element contains options that are available for the XML-DArequests. This element is of the type RequestOptions. You will find information onthe attributes of this element in the relevant section of this documentation.

ServerSubHandles

The value assigned for this attribute by the server identifies the client that sendsthe request.

Page 533: Industrial Communication With PG-PC

Using the OPC Server

533SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.4.16 SubscriptionPolledRefreshResponse

Tag StructureSubscriptionPolledRefreshResponse

DatabufferOverflow

SubscriptionPolledRefreshResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

InvalidServerSubHandles

ItemValues

Items

Item Path

ItemName

ClientItemHandle

ValueType

Timestamp

Quality

LimitBits

VendorBits

ErrorID

SuccessID

Value

DiagnosticInfo

Errors

ID

Text

Elements and Attributes

SubscriptionPolledRefreshResponse

This element contains all the information that the server sends to the client as theresponse to a SubscriptionPolledRefresh request.

DatabufferOverflow

If the value of this attribute is TRUE, there have been changes in the items thatcould not be saved due to lack of resources. The individual items indicate whetheror not they are affected by the lack of resources.

Page 534: Industrial Communication With PG-PC

Using the OPC Server

534SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

SubscriptionPolledRefreshResult

This element contains basic information on the response of the server.

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

InvalidServerSubHandles

ServerSubHandles recognized as being invalid by the server.

ItemValues

The <ItemValues> element contains values for all items if the client transferred theReturnAllItems attribute with the value TRUE with its SubscriptionPolledRefreshrequest. Otherwise the server returns only values that have changed.

Items

Element with which a single item is specified.

This element is of the type ItemValue. You will find information on the attributes ofthis element in the relevant section of this documentation.

Errors

An array of errors that occurred with this response.

This element is of the type OPCError. You will find information on the attributes ofthis element in the relevant section of this documentation.

8.4.17 SubscriptionCancel

Tag StructureSubscriptionCancel

ServerSubHandle

ClientRequestHandle

Elements and Attributes

SubscriptionCancel

Using the <SubscriptionCancel> element, the client ends a series ofSubscriptionPolledRefresh requests and the server can release the correspondingresources.

ServerSubHandle

The value assigned to this element by the server identifies the client that sends therequest.

Page 535: Industrial Communication With PG-PC

Using the OPC Server

535SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

ClientRequestHandle

If this attribute was included in the client’s request, it is returned by the server withthe SubscriptionCancelResponse. In large and complex systems, this informationhelps the client to relate the responses to the requests. Specifying this attribute isoptional.

8.4.18 SubscriptionCancelResponse

Tag StructureSubscriptionCancelResponse

ClientRequestHandle

Elements and Attributes

SubscriptionCancelResponse

Using this element, the server confirms a SubscriptionCancel request of the client.

ClientRequestHandle

If the client used this attribute in its request, the server returns it in its response.

8.4.19 Browse

Tag StructureBrowse

RequestTimeout

MaxElementsReturned

HasChildrenMask

IsItemMask

ElementNameFilter

VendorFilter

ReturnAllProperties

ReturnPropertyValues

ClientRequestHandle

LocaleID

Item Path

ItemName

ContinuationPoint

PropertyName

Page 536: Industrial Communication With PG-PC

Using the OPC Server

536SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Elements and Attributes

Browse

The <Browse> element contains all the information necessary for navigatingthrough a hierarchical address space.

RequestTimeout

Latest time by which the server must react to a request from the client.

MaxElementsReturned

Maximum number of return values.

HasChildrenMask

An element of the type tristate. This specifies how the server will set theHasChildren flag of return values:

no: The flag will be set to FALSE for all return elements.

yes: The flag will be set to TRUE for all return elements.

either: The flag can have either the value TRUE or FALSE for return elements.

IsItemMask

An element of the type tristate. This specifies how the server will set theIsItemMask flag of return values:

no: The flag will be set to FALSE for all return elements.

yes: The flag will be set to TRUE for all return elements.

either: The flag can have either the value TRUE or FALSE for return elements.

ElementNameFilter

A regular expression used to select elements.

VendorFilter

A vendor-specific expression used to select vendor-specific information. Theeffects on the ElementNameFilter element are not defined.

ReturnAllProperties

If the value TRUE is set for this attribute, the server returns all properties for eachreturned element. The value of the PropertyName attribute is then ignored in thiscase.

ReturnPropertyValues

If the value TRUE is set for this attribute, the server returns not only the names ofthe properties but also the values of the properties.

Page 537: Industrial Communication With PG-PC

Using the OPC Server

537SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

ClientRequestHandle

If this attribute was included in the client’s request, it is returned by the server withthe response. In large and complex systems, this information helps the client torelate the responses to the requests. Specifying this attribute is optional.

LocaleID

An optional attribute with which the client specifies the language for certainreturned data.

Item Path

The path to the item with which navigation through the address space starts. Ifthere is a second browse request, this attribute must have the same value as inthe previous request.

ItemName

The name of the item with which navigation through the address space starts. Ifthere is a second browse request, this attribute must have the same value as inthe previous request.

ContinuationPoint

If this is not an initial browse request, a point can be specified here from which thebrowse request is restarted.

PropertyName

Names of properties returned with each element. If the value of theReturnAllProperties attribute is set to TRUE, the server returns all propertiesregardless of PropertyName.

Page 538: Industrial Communication With PG-PC

Using the OPC Server

538SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.20 BrowseResponse

Tag StructureBrowseResponse

ContinuationPoint

MoreElements

BrowseResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

Elements

Name

Item Path

ItemName

IsItem

HasChildren

Properties

Name

ItemPath

ItemName

ErrorID

SuccessID

Value

Errors

ID

Text

Elements and Attributes

BrowseResponse

Contains all the information of a response to a Browse request

ContinuationPoint

Here, the server can specify a point from which a following Browse request can bestarted.

MoreElements

If the server does not support the ContinuationPoint attribute and the number ofreturned values exceeds the value of MaxItemsReturned, the server sets thisattribute to TRUE.

Page 539: Industrial Communication With PG-PC

Using the OPC Server

539SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

BrowseResult

The <BrowseResponse> element contains basic information on the response ofthe server.

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

Elements

Contains information on the parsed elements of the structure tree.

Name

Name of an element in the name space displayed to the user (for example, in astructure view).

Item Path

Information on the path of an element. An element can be identified uniquely in thename space of the server with the attributes ItemPath and ItemName.

ItemName

The name of an item, see ItemPath.

IsItem

If the value TRUE is set for this attribute, the item of this element can be used inRead, Write and Subscribe requests.

HasChildren

If the value TRUE is set for this attribute, the corresponding element has children.

Properties

The <Properties> element contains information on a property that can be madeaccessible using a Browse or GetProperty call.

This element is of the type ItemProperty. You will find information on the attributesof this element in the relevant section of this documentation.

Errors

An array of errors that occurred with this response.

This element is of the type OPCError. You will find information on the attributes ofthis element in the relevant section of this documentation.

Page 540: Industrial Communication With PG-PC

Using the OPC Server

540SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.21 GetProperties

Tag StructureGetProperties

ClientRequestHandle

RequestTimeout

ReturnAllProperties

ReturnPropertyValues

LocaleID

ItemPath

ItemIDs

ItemPath

ItemName

PropertyName

Elements and Attributes

GetProperties

Using the <GetProperties> element, you can query properties.

ClientRequestHandle

If this attribute was included in the client’s request, it is returned by the server withthe response. In large and complex systems, this information helps the client torelate the responses to the requests. Specifying this attribute is optional.

RequestTimeout

Specifies the latest time that the client will wait for a response from the server. Datafor items that are not available at this time is returned as an error. If the specifiedtime is earlier than the current time on the server, the entire request fails.

ReturnAllProperties

If the value TRUE is set for this attribute, the server returns all properties for eachreturned element. The value of the PropertyName attribute is then ignored in thiscase.

ReturnPropertyValues

If the value TRUE is set for this attribute, the server returns not only the names ofthe properties but also the values of the properties.

LocaleID

An optional attribute with which the client specifies the language for certainreturned data.

Page 541: Industrial Communication With PG-PC

Using the OPC Server

541SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

ItemPath

The path of an item. This element can be overwritten by the element of the samename in the <ItemIDs> tag.

ItemIDs

Contains a list of items whose properties will be queried.

ItemPath

The path of an item.

ItemName

The name of an item.

PropertyName

Names of properties returned with each element. If the value of theReturnAllProperties attribute is set to TRUE, the server returns all propertiesregardless of PropertyName.

8.4.22 GetPropertiesResponse

Tag StructureGetPropertiesResponse

GetPropertiesResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

PropertyList

ItemPath

ItemName

ErrorID

Properties

Name

ItemPath

ItemName

ErrorID

SuccessID

Errors

ID

Text

Page 542: Industrial Communication With PG-PC

Using the OPC Server

542SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Elements and Attributes

GetPropertiesResponse

The server responds to GetProperty requests with this element.

GetPropertiesResult

The <GetPropertiesResult> element contains basic information on the responseof the server.

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

PropertyList

An element of this type containing the requested properties of the item is returnedfor each item.

ItemPath

The path of the item

ItemName

The name of the item.

ErrorID

An error code with information on possible access problems.

Properties

This element is of the type ItemProperty. You will find information on the attributesof this element in the relevant section of this documentation.

Errors

An array of errors that occurred with this response.

This element is of the type OPCError. You will find information on the attributes ofthis element in the relevant section of this documentation.

8.4.23 GetStatus

Tag StructureGetStatus

ClientRequestHandle

LocaleID

Page 543: Industrial Communication With PG-PC

Using the OPC Server

543SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Elements and Attributes

GetStatus

A GetStatus request checks the Web service and obtains vendor-specificinformation that is not accessible to other OPC methods.

ClientRequestHandle

If this attribute was included in the client’s request, it is returned by the server withthe response. In large and complex systems, this information helps the client torelate the responses to the requests. Specifying this attribute is optional.

LocaleID

An optional attribute with which the client specifies the language for certainreturned data.

Example

<soap:Body> <GetStatus ClientRequestHandle=“” xmlns=“http://opcfoundation.org/webservices/OPCDA/”> <LocaleID>en-US</LocaleID> </GetStatus> </soap:Body>

C# Interface for the GetStatus Web Method

When using C# user programs, the following method is available for checking the Webservice:

ServerStatus GetStatus(string LocaleID, string ClientRequestHandle, out string OutClientRequestHandle);

Page 544: Industrial Communication With PG-PC

Using the OPC Server

544SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.4.24 GetStatusResponse

Tag StructureGetStatusResponse

GetStatusResult

RcvTime

ReplyTime

ClientRequestHandle

RevisedLocaleID

ServerState

Status

StartTime

ProductVersion

StatusInfo

VendorInfo

SupportedLocaleIDs

SupportedInterfaceVersions

Elements and Attributes

GetStatusResponse

Contains all the information of a response to a GetStatus request

GetStatusResult

The <GetStatusResult> element contains basic information on the response of theserver.

This element is of the type ReplyBase. You will find information on the attributesof this element in the relevant section of this documentation.

Status

The <Status> element contains information on the server status.

StartTime

Time at which the server was started in UTC format.

ProductVersion

Version number of the server made up of the major, minor, and build number.

StatusInfo

Contains additional information on the server status and may belanguage-dependent.

Page 545: Industrial Communication With PG-PC

Using the OPC Server

545SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

VendorInfo

Vendor-specific string with additional information on the server. The value of thisattribute should include the company name and information on the supporteddevices.

SupportedLocaleIDs

The locales supported by the server. A server does not need to support all localesfor all items.

SupportedInterfaceVersions

An array of strings containing the versions of the XML-DA specification supportedby the server.

Page 546: Industrial Communication With PG-PC

Using the OPC Server

546SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.5 OPC Scout

With the OPC Scout, you can test an application or commission the OPC server.

How does it work?

Follow the steps below:

Connecting the OPC Scout to a local server

Connecting the OPC Scout to a remote server

8.5.1 Starting the OPC Scout

You start the OPC Scout from the Windows operating system.

In the Windows Start menu, click the commands Programs SIMATIC NET PROFIBUS CP5613_5614 OPC Scout or in the part of the Start menu foryour product.

The OPC Scout opens.

8.5.2 Connecting the OPC Scout to a Local Server

Before you can work with the OPC Scout, you must connect the OPC Scout with aserver.

1. Open the Local Server entry in the server and group navigator.

2. Select one of the following entries:

� OPC.SimaticNET

� OPC.SimaticNET.DP

� OPC.SimaticNET.PD

3. Open the Server menu and select the Connect command.

The OPC Scout is connected to the local OPC Server for SIMATIC NET.

A dialog for creating a group opens.

Page 547: Industrial Communication With PG-PC

Using the OPC Server

547SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.5.3 Connecting the OPC Scout to a Remote Server

As an alternative to connecting to a local server, you can connect the OPC Scoutwith an OPC server running on a remote computer using DCOM.

1. Open the Remote Server entry in the server and group navigator.

2. Double-click the Add Remote Server entry.

A dialog box opens.

3. Enter the node name of the remote computer and the ProgID of the OPCservers, for example “OPC.SimaticNET” in the dialog.

4. Close the dialog with the OK button.

5. Select the remote server with which you want to connect the OPC Scout.

6. Open the Server menu and select the Connect command.

The OPC Scout is connected to the remote OPC server.

A dialog for creating a group opens.

Note

Remember that operation using DCOM must be configured.

Page 548: Industrial Communication With PG-PC

Using the OPC Server

548SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.5.4 Creating a Group

You create groups with which you can manage the items.

1. Open the Group menu and select the Add Group menu command or click on[New Group] in the Navigator window.

The Add Group opens.

2. Enter the new group name.

3. Select the Generate new active group box to activate the group.

4. In the Transmission interval in ms box, enter how often values of thevariables will be updated.

5. Click the OK button.

The Add Group window is closed, the group is inserted in the server andtherefore also in the Server and Group Navigator of the main window of theOPC Scout.

8.5.5 Browsing the Process Space

You can browse the process space of the OPC server in the OPC Navigatorwindow. In the OPC Navigator window, you can create new variables and specifywhich variables will be monitored.

1. Select the required group for which you want to browse the process space ofthe server in the Server and Group Navigator of the OPC Scout.

2. Open the Item menu and select the Add Item(s) command.

The OPC Navigator window opens.

The left-hand column of the window displays the hierarchical structure of theprocess space. You can double-click to open the lower levels.

3. Select the level you want to display for the variables.

All variables for the level displayed in the middle column.

Page 549: Industrial Communication With PG-PC

Using the OPC Server

549SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.5.6 Creating New Variables

You can create new variables using the OPC Navigator window.

1. In the left column of the OPC Navigator window, select the entry for which youwant to create a new variable.

All variables that have already been defined are displayed in the middle column.

2. Double-click the entry New Definition.

The Define New Variable window opens.

3. Enter the data type and the related information in the appropriate boxes.

4. Enter a name for the new variable (optional) in the Item Alias box.

5. Click the OK button.

The window is closed and the newly defined variable is displayed in the middlecolumn of the OPC Navigator window.

8.5.7 Adding and Monitoring Variables

The first step is to add the variable you want to monitor to the current group.

1. In the middle column of the OPC Navigator window, select one or morevariables you want to monitor.

2. Click the button with the arrow to the right ( ).

The selected variable is added to the right field.

3. Repeat steps 1 and 2 until all variables you want to add to the current group aredisplayed in the right-hand field of the OPC Navigator window.

4. Click the OK button.

The OPC Navigator window closes. The selected variables are displayed withtheir attributes in the main window of the OPC Scout.

Page 550: Industrial Communication With PG-PC

Using the OPC Server

550SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.5.8 Customizing the Display

You can decide what information is displayed for variables in the OPC Scoutwindow.

1. Open the View menu and click the Options menu command.

The Options window is displayed and the Columns to Display tab is visible.

2. Select the information you want to have displayed for the variables in the OPCScout.

3. If you want to set the default column width for the displayed information, selectthe Standard Width tab.

4. Select the information for which you want to specify the default width.

5. Click the OK button.

The Options window is closed and the selected information is displayed for thevariables.

Page 551: Industrial Communication With PG-PC

Using the OPC Server

551SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Meaning of the Columns:

Name Meaning

OPC ItemIDs Unique name of the OPC item

Value Value of the variable displayed in the format set in the For-mat column

Format Format: for integers, you can select between the originalformat, hexadecimal, or binary. The “original” format for in-tegers is decimal. All values that are not integers are al-ways displayed in the original format (for example, string,date, floating point). It is not possible to change the formatof these data types.

Type Canonical data type of the OPC item.

Access Access rights for the OPC item. ( “R”= read-only, “W”=write-only, “RW” = full access)

Quality Reliability of the value. If the quality is “good”, the valuewas acquired with certainty.

Timestamp(UTC)

Time at which the OPC server last detected a change in thevalue. The timestamp is displayed in UTC format (UniversalCoordinated Time). The UTC time corresponds to Green-wich Mean Time (GMT).

Write Result Result of the last write to this OPC item

Group Name of the group containing this OPC item

ClientHandle Handle assigned by the client for the OPC item.

Server Handle Handle assigned by the server

Errors Error messages involving the use of the OPC item that can-not be attributed to “Quality” or “Write Result”.

Page 552: Industrial Communication With PG-PC

Using the OPC Server

552SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

8.5.9 Displaying Attributes

You can display the attributes of individual OPC items.

1. Select the OPCItemIDs of the variables whose attributes you want to display inthe variable display.

2. Open the Item menu and select the Properties menu command.

A dialog opens displaying the basic properties.

3. Click the Query Available Properties button.

A dialog opens in which all the properties are displayed.

8.5.10 Changing Values

Using the OPC Scout you can modify the values of writable variables directly.

1. Select the variable whose value you want to change in the variable display inthe main window of the OPC Scout.

You can also select more than one variable and assign a common new value.

2. Open the Item menu and select the Enter Values command.

The Write Values of Items window opens.

3. Select the format of the value for the variable in the Format Conversion box.

4. Enter the required value in the Value box.

5. Close the window with the OK button.

The variable receives the new value. The new value is displayed in the OPCScout window.

8.5.11 Working with the OPC Scout

The most important windows of the OPC Scout are:

Page 553: Industrial Communication With PG-PC

Using the OPC Server

553SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.5.12 The Main Window of OPC Scout

The main window of the OPC Scout is structured as follows:

Main OPC Scout Window

Menus of the OPC Scout

Depending on the activities you perform during the session, the OPC Scout canhave the following menus:

Menu Commands Relating to the Topics

File You can load, save and print projects.

View You can modify the appearance of the OPC Scout user in-terface.

Server You can connect the OPC Scout to a server and displayserver properties.

Group You can add and delete groups and assign items.

Item You can add and delete OPC items and edit the values ofthe items.

? You can display online help.

The OPC Scout supports context-sensitive menus! Click on an object and then try out the right mouse button. You will then see amenu in which you can select the functions that are possible with the selectedobject.

Page 554: Industrial Communication With PG-PC

Using the OPC Server

554SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

File Menu

The File menu contains the following commands:

Menu Command has the following function

Open Project Opens an existing project.

A file list box is displayed in which you can selectthe required project.

Save Project Saves an existing project.

If you are saving the project for the first time, afile list box opens in which you can specify thename of the project.

Save Project As Saves the current project under a new name.

A file list box is displayed in which you can enterthe new name.

Load Items Adds the OPC items from the selected item fileto the current group. Items that were previouslyin the group are removed.

Load and Add Items Adds the OPC items from the selected item fileto the current group. Items that were previouslyin the group are retained.

Save Items Saves the OPC items shown in the variable dis-play regardless of the group and server.

Print Item List Prints the currently displayed items and all thevalues.

Print Item List to File Writes the currently displayed items and all va-lues to a file.

A file list box is displayed in which you can enterthe file name.

Print Project to File Writes information about servers, groups, and allitems of all groups to a file.

Exit Closes the OPC Scout.

You will be asked whether or not you want tosave the current project.

Page 555: Industrial Communication With PG-PC

Using the OPC Server

555SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

View Menu

The View menu contains the following commands:

Menu Command has the following function

Toolbar Toggles display of the toolbar on/off.

Status Bar Toggles display of the status bar on/off.

Refresh Refreshes the display on the screen.

Options Opens the Options window in which you candecide which attributes of the variables are dis-played in the OPC Scout window and can selectthe width of the columns.

Server Menu

The Server menu contains the following commands:

Menu Command has the following function

Connect Establishes the connection from the OPC Scoutto a local or remote server.

Disconnect Terminates the connection from the OPC Scoutto a server.

Properties A dialog box opens in which you can display thestandard properties of the OPC server.

Group Menu

The Group menu contains the following commands:

Menu Command has the following function

Add Group Adds a group.

The Add Group opens. You enter the name andproperties of the group in the window.

Remove Group Deletes the selected group

Add Item Adds an item to a group.

Activate Activates the group. Value changes for activeitems of the this group are displayed.

Deactivate Deactivates the group. Value changes for activeitems of the this group are no longer displayed.

Properties Opens a dialog box in which you can display thestandard properties of the group.

Page 556: Industrial Communication With PG-PC

Using the OPC Server

556SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Item Menu

The Item menu contains the following commands:

Menu Command has the following function

Add Item(s) Adds an OPC item to the active group.The OPC Navigator window opens in which youcan select the item.

Remove Item(s) Deletes an OPC item from the group.

Enter Value(s) Writes a value for an item.

The Write Values of the Items window opens inwhich you can enter the value.

Generate Values Creates simulated values for an item for test pur-poses.

The Generate Values window opens in whichyou can specify which values will be displayed.

Properties Opens a dialog box in which you can display thestandard properties of the items.

Activate Activates the item so that value updates are dis-played.

Deactivate Deactivates the item so that no value updatesare displayed.

? Menu

The ? menu contains the following commands:

Menu Command has the following function

Change Language Changes the display language of the OPC Scout.

About OPC Server Opens a dialog box with general information onthe OPC server and version.

About OPC Scout Opens a dialog box with general information onthe OPC Scout and version.

Page 557: Industrial Communication With PG-PC

Using the OPC Server

557SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

8.5.13 OPC Navigator

The OPC Navigator window is structured as follows:

Figure 8-22 OPC Navigator Window

Page 558: Industrial Communication With PG-PC

Using the OPC Server

558SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 559: Industrial Communication With PG-PC

559SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Sample Programs

This section contains sample programs that use the Custom or AutomationInterface.

After you have installed the SIMATIC NET software, you will find the samples in<installationpath>\SIEMENS\SIMATIC.NET\opc2\samples

9

Page 560: Industrial Communication With PG-PC

Sample Programs

560SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.1 Sample Program – Programming with ActiveX Controls

This sample in Visual Basic uses the ActiveX controls SIMATIC NET OPC DataControl and Siemens S7 Number Control to read and write process data.

The description is divided into the following sections:

Activating the Simulation Connection

Before you can run this program, you must activate a simulation connection thatmakes the demonstration variables used in the program available:

Step Description

1 Start the “Configuration Console” program in the Start menu:Start –> SIMATIC –> SIMATIC NET –> Settings > ConfigurationConsole

2 In the left-hand navigation window, open the property page for thesimulation module by expanding SIMATIC NET Configuration –> Modulesand click on the “CP Simulation” icon

3 Click the check box for the protocol you want to simulate.This example uses the S7 protocol. So you should click on “S7”.

4 Close the “Configuration Console” program.

Note

Before the changes take effect, you must first close all OPC clients!

9.1.1 Running the Program

Start Sample

The OPC_VB_OCX program is on your hard disk in <installationpath>\SIEMENS\SIMATIC.NET\opc2\samples\ocx

When you start the program, only the “Start Sample” button is enabled. When youclick this button, a connection is established to the configured server and you canthen use the other buttons.

Page 561: Industrial Communication With PG-PC

Sample Programs

561SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Read Value

After you click the “Read Value” button, the values that were read are displayed inthe relevant text boxes.

Number Control

To write or modify a value, you must enter the value in the input box of the numbercontrol which activates the buttons of the number control. The entered value isactually only written when you click the button with the green check mark.Afterwards, the buttons are disabled again until you enter the next value. To cancel a modification, click the delete button. The value you have just enteredin the input box of the number control is then replaced by the last written value.Following this, the buttons are disabled again.

Stop Sample

When you click the “Stop Sample” button, the connection to the OPC server isterminated and all the buttons except for the “Start Sample” button are disabled.

9.1.2 Description of the Program

For this sample program, it is not enough to simply describe the implementation ofthe event procedures since a large part of the work is handled by the ActiveXcontrols and depends on how they are configured. We will therefore first look atsome of the aspects relating to the configuration of selected controls and then lookat the source code in greater detail.

Page 562: Industrial Communication With PG-PC

Sample Programs

562SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.1.3 Principle of Assigning Control Properties to OPC ProcessVariables

When using the SIMATIC NET OPC Data Control, an OPC process variable canbe assigned to the properties of a control, for example the text to be displayed inan editor box.

These assignments are configured in the SIMATIC NET OPC Data Control.

Unseen by the user, the SIMATIC NET OPC Data Control makes all the calls tothe OPC server.

9.1.4 Configuring the SIMATIC S7 Number Control

With the number control, you can display and modify process data in numericformat.

During runtime, the value of a selected process variable is displayed in the displayarea if you have configured its display in the SIMATIC NET OPC Data Control.Here, you can enter a new value. Depending on the configuration, newly enteredvalues are modified immediately or only after clicking the button for input to theOPC server.

There are various configuration options for the number control depending onwhether you simply want to use it to display process data or also want to use it tomodify process data:

Page 563: Industrial Communication With PG-PC

Sample Programs

563SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Configuring the Number Control Simply as a Display Control

To use the number control simply to display process data without any operatorinput being possible, the following settings are recommended:

Step Description

1 Open the properties pages of the number control by right-clickingon it and selecting “S7Number Properties..” in the context-sensi-tive menu.

2 Deactivate the “Show Buttons” check box in the “General” tab.

3 In the “Appearance” tab, activate the “Locked (ReadOnly)” checkbox.

The “S7Number_Val1” number control that functions purely as a display control inthe “On Data Changed” frame is an example of such a configuration in thisprogram.

Configuring the Number Control for Writing Values

To be able to write process data using the number control, make the followingsettings for number control:

Step Description

1 Open the properties pages of the number control by right-clickingon it and selecting “S7Number Properties..” in the context-sensi-tive menu.

2 Deactivate the “Locked (ReadOnly)” check box in the “General”tab. As default, it is not activated.

3 With the “Show Buttons” check box In the “General” tab, you canalso decide whether or not an operator has to click to confirm wri-ting or whether the value is accepted immediately.

The number control “S7Number_Write” is an example of such a configuration.

Page 564: Industrial Communication With PG-PC

Sample Programs

564SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.1.5 Configuration of the SIMATIC NET OPC Data Control

The SIMATIC NET OPC Data Control establishes the connection between controlsfor display and the OPC server. If you want to simplify your programming tasks byusing ActiveX Controls for OPC, you must include the SIMATIC NET OPC DataControl in your project.

To benefit from the advantages of the SIMATIC NET OPC Data Control, it mustfirst be configured. Follow the steps outlined below:

Step Description

1 Open the Properties window for SIMATIC NET OPC Data Control

2 Select OPC server

3 Connect the properties of display controls with the properties ofthe OPC process variables

Opening the Properties Window

You configure the SIMATIC NET OPC Data Control in the “Properties Pages”window :

� Right-click the Data Control. The context-sensitive menu is opened.

� Select the “Properties” menu command. The “Properties Pages” window opens.

Select OPC server

To select an OPC server with which the Data Control will communicate:

� Select the “OPC Server” tab in the “Properties Pages” window.

� Enter the name of the OPC server in the “Server” box, for example“OPC.SimaticNET”. You can also select an OPC server using the “Browse...”button.

Connecting Display Controls and Process Variables

You must connect the properties of display controls with the properties of OPCprocess variables. The basic steps involved are illustrated below based on the example of a text boxand a Siemens S7 Number Control.

First, select the “Items” tab in the “Properties Pages” window and click the “AssignItems...” button. This opens a dialog in which you make the following settings:

Page 565: Industrial Communication With PG-PC

Sample Programs

565SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Filter Properties

To make it easier and clearer to connect the display controls to the properties ofthe process variables, it is advisable to start by selecting or filtering the propertiesof the display control that you want displaying in the user controls of the “AssignItems” dialog box.

Step Description

1 Click on the “Filter...” button. The “Property Filter” window opens.

2 Click the “Add” button and enter the “Text” property name in thewindow that then opens. Confirm with “OK”.

3 Repeat step 2 for the properties “BackColor” and “Value”.

4 Close the “Property Filter” window with “OK”.

5 If the “Filter” check box is not yet activated, select it now. In the user controls list, only the properties “Text”, ”BackColor”,and “Value” are visible for the user controls assuming that thecontrol has these properties.

Properties of the “Edit_QU_1” Text Box

You will now link the “BackColor” and “Text” properties of “Edit_QU_1” with the“Quality” property of a process variable:

Step Description

1 In the list of control elements, select the “BackColor” property ofthe “Edit_QU_1” text box by clicking the entry.

2 From the list of three possible properties of the process variables,select the “Quality” property.

3 You can now make further settings: For each value of the “Qua-lity” property, define a color that the box will adopt during runtimedepending on the quality value of the monitored process variable.

4 From the upper box that displays the name space of the server,select the process variable you want to link to the selected pro-perty.The ItemID of the selected variable appears in the linked variablebox.You can also enter an ItemID directly in this box.

5 Repeat steps 1 to 4 with the “Text” property of the text box butinstead of the color value in step 3, enter, for example, the values“GOOD”, ”BAD” and “UNCERTAIN”.

Page 566: Industrial Communication With PG-PC

Sample Programs

566SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Connecting Properties of the SIMATIC S7 Number Control

You will now connect the “Value” property of “S7Number_Val1” with the “Value”property of a process variable:

Step Description

1 In the list of control elements, select the “Value” property of the“S7Number_Val1” user control by clicking on the entry.

2 From the list of three possible properties of the process variables,select the “Value” property.

3 From the upper box that displays the name space of the server,select the process variable you want to link to the selected pro-perty.The ItemID of the selected variable appears in the linked variablebox.You can also enter an ItemID directly in this box.

4 Follow the same procedure for the other display controls that youwant to connect to properties of process variables. Once youhave made all the connections you require, close the “AssignItems” dialog with “OK”.

9.1.6 Implementing the Event Procedures

The main components of this module are the event procedures for the buttons ofthe dialog that are called by Visual Basic.

Page 567: Industrial Communication With PG-PC

Sample Programs

567SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Command_Start_Click

The “Start Sample” button is first disabled and then all other buttons enabled:

S7Number_Write.Enabled = TrueCommand_Start.Enabled = FalseCommand_Read.Enabled = TrueCommand_Exit.Enabled = True

After this, the “Connect” method of the SIMATIC NET OPC Data Control“DatCon1” establishes a connection to the OPC server that was specified in theconfiguration of the data control:

DatCon1.Connect

Command_Read_Click

After the declaration of several local variables, the “ReadVariable” function of theSIMATIC NET OPC Data Control is called.

Its return parameters are assigned to the text properties of the relevant text boxesand are therefore visible in the dialog.

Dim myValue As VariantDim myQuality As LongDim myTimeStamp As DateDim ErrorNr As LongDim ErrorString As String

ErrorNr = DatCon1.ReadVariable(”S7:[DEMO]MW0”, myValue, myQuality, myTimeStamp)

Edit_ReadVal = myValueEdit_ReadQu = GetQualityText(myQuality)Edit_ReadTS = myTimeStamp

Page 568: Industrial Communication With PG-PC

Sample Programs

568SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

ReadVariable

The ReadVariable function is declared as follows:

Function ReadVariable(ItemID As String, Value, Quality AsLong, TimeStamp As Date) As Long

Parameter Description

ItemID String with the ItemID of the variable on the OPC server that willbe read.

Value Return parameter of the type variant that contains the value ofthe specified variable.

Quality Return parameter of the type variant that contains the quality ofthe variable. The numeric value must first be converted to a stringwith the GetQualityText function before it can be assigned to therelevant text box.

Time-Stamp

Return parameter of the type Date containing the OPC timestamp.

Command_Exit_Click

First, the “Start Sample” button is enabled again and all other buttons disabled:

S7Number_Write.Enabled = FalseCommand_Start.Enabled = TrueCommand_Read.Enabled = FalseCommand_Exit.Enabled = False

Finally, the connection to the OPC server is terminated with the Disconnectmethod of the SIMATIC NET OPC Data Control:

DatCon1.Disconnect

Page 569: Industrial Communication With PG-PC

Sample Programs

569SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

GetQualityText

GetQualityText provides a string as an error message for a specified error code:

Private Function GetQualityText(Quality) As String Select Case Quality Case 0: GetQualityText = “BAD” Case 64: GetQualityText = “UNCERTAIN” Case 192: GetQualityText = “GOOD” Case 8: GetQualityText = “NOT_CONNECTED” Case 13: GetQualityText = “DEVICE_FAILURE” Case 16: GetQualityText = “SENSOR_FAILURE” Case 20: GetQualityText = “LAST_KNOWN” Case 24: GetQualityText = “COMM_FAILURE” Case 28: GetQualityText = “OUT_OF_SERVICE” Case 132: GetQualityText = “LAST_USABLE” Case 144: GetQualityText = “SENSOR_CAL” Case 148: GetQualityText = “EGU_EXCEEDED” Case 152: GetQualityText = “SUB_NORMAL” Case 216: GetQualityText = “LOCAL_OVERRIDE”

Case Else: GetQualityText = “UNKNOWN ERROR” End Select End Function

9.1.7 Notes on Writing your own Programs

Before programs you have written yourself can use the Automation Interface andthe SIMATIC Controls, certain requirements must be met. Follow the steps outlinedbelow:

Step Description

1 Start the Visual Basic development environment.

2 Create a project of the required type.

3 Go to the “Project” menu and select “Components..”. In the dialogthat opens, select the following entries from the list of availablecomponents:

x ”Siemens S7 Number Control”

x ”SIMATIC NET OPC Data”

4 Arrange the required operator interface elements in the main dia-log or create a suitable application window and program the cor-responding event procedures.

Page 570: Industrial Communication With PG-PC

Sample Programs

570SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.2 Sample Program for the OPC Automation Interface(Synchronous Communication)

This sample involves Visual Basic and uses the Automation Interface for DataAccess V2.0 of OPC to read and write data synchronously.

The description is divided into the following sections:

9.2.1 Activating the Simulation Connection

Before you can run this program, you must activate a simulation connection thatmakes the demonstration variables used in the program available:

Step Description

1 Start the “Configuration Console” program in the Start menu: Start –> SIMATIC –> SIMATIC NET –> Settings –> Configuration Console

2 In the left-hand navigation window, open the property page for thesimulation module by expanding SIMATIC NET Configuration –> Modulesand click on the “CP Simulation” icon

3 Click the check box for the protocol you want to simulate.This example uses the S7 protocol. So you should click on “S7”.

4 Close the “Configuration Console” program.

Note

Before the changes take effect, you must first close all OPC clients!

Page 571: Industrial Communication With PG-PC

Sample Programs

571SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.2.2 Working with the Sample Program

The program is on your hard disk in <installationpath>\SIEMENS\SIMATIC.NET\opc2\samples\automation\sync

When you start the program, only the “Start Sample” button is enabled.

After you have clicked this button, the program generates the required OPCobjects. You can then use the other buttons.

After you click the “Read Value” button, the values that were read are displayed inthe relevant text boxes.

As it stands, the sample program is designed to operate with a demonstrationconnection. If you want to run the sample program in a real environment, you mustchange the following line in the program code:

Set ItemObj = GroupObj.OPCItems.AddItem(”S7:[DEMO]MW1”, 1)

You should also refer to some of the samples and the section “OPC ProcessVariables for SIMATIC NET” for more information on the structure of the ItemIDs.

Page 572: Industrial Communication With PG-PC

Sample Programs

572SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

To write a value, this must be entered in the relevant text box. After clicking the“Write Value” button, the program displays a message about the result of thisoperation:

The “Stop Sample” button closes the program; in other words, all OPC objects aredeleted and the corresponding resources are released again.

Page 573: Industrial Communication With PG-PC

Sample Programs

573SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.2.3 How the Program Runs

Due to the class model of OPC, a specific order must be adhered to in the methodcalls of OPC objects. To be able to create an instance of the “OPCItem” class, anobject of the “OPCGroup” class is necessary. This is, however, only possible whenan instance of the “OPCServer” class exists and a connection to this server hasbeen established.

The basic sequence of instructions for creating and deleting OPC objects isillustrated in the following graphic. The variable names of the sample program areused.

The sample program contains all the components that would normally exist in atypical client application. These include establishing the connection to the OPCserver, creating a group with variables, and reading and writing values for an item.

Page 574: Industrial Communication With PG-PC

Sample Programs

574SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.2.4 Description of the Program

The program code in the opcsync.frm file can be divided into the followingsections:

Global Variables

At the start of this module, several global variables are declared:

Dim WithEvents ServerObj As OPCServerDim WithEvents GroupObj As OPCGroupDim ItemObj As OPCItem

Implementing the Event Procedures

The main components of this module are the event procedures for the buttons ofthe dialog that are called by MFC.

9.2.5 Command_Start_Click

The Command_Start_Click method is called when the button labeled “StartSample” is clicked and it can be divided into the following sections:

Enabling Buttons

The “Start Sample” button is first disabled and then all other buttons enabled:

Command_Start.Enabled = FalseCommand_Read.Enabled = TrueCommand_Write.Enabled = TrueCommand_Exit.Enabled = True

Generating an Object of the OPCServer Class

A new instance of the OPCServer class is now generated:

Set ServerObj = New OPCServer

Establishing a Connection to the OPC Server of SIMATIC NET

With the Connect method of the OPCServer class, a connection is established tothe OPC server of SIMATIC NET:

ServerObj.Connect (”OPC.SimaticNET”)

Connect

The Connect method of the OPCServer class is declared as follows:

Sub Connect(ProgID As String, [Node])

Page 575: Industrial Communication With PG-PC

Sample Programs

575SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter Description

ProgID Unique OPC server name assigned by the vendor.

Node Optional parameter of the Variant type that specifies the servercomputer when using DCOM.

Adding a Group

Each object of the OPCServer class has the collection object OPCGroups. Its Addfunction adds an object of the type OPCGroup to the collection:

Set GroupObj = ServerObj.OPCGroups.Add(”MyOPCGroup”)

Add

The Add function of the OPCGroups class is declared as follows:

Function Add([Name]) As OPCGroup

Parameter Description

Name Optional parameter as variant that specifies the name of the newgroup.

Adding Items

Each object of the OPCGroup class in turn has the collection object OPCItems asa member. Its AddItem function creates a new object of the class OPCItem andadds it to the collection:

Set ItemObj = GroupObj.OPCItems.AddItem(”S7:[DEMO]MW1”, 1)

AddItem

The AddItem function of the OPCItems class returns an object of the OPCItemtype and is declared as follows:

Function AddItem(ItemID As String, ClientHandle As Long) AsOPCItem

Parameter Description

ItemID Please refer to some of the samples and the manual for moreinformation on the structure of the ItemID.

Client-Handle

Handle assigned by the client for an item

Page 576: Industrial Communication With PG-PC

Sample Programs

576SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.2.6 Command_Read_Click

The Command_Read_Click event routine executes a synchronous read job. Thefollowing operations are executed:

Variable Declarations

At the start of the procedure, several local variables are declared that are passedas parameters for the subsequent method call.

Dim myValue As VariantDim myQuality As VariantDim myTimeStamp As Variant

Read Synchronously

To read values synchronously, the Read method of the OPCItem class is called:

ItemObj.Read OPCDevice, myValue, myQuality, myTimeStamp

Read

The Read method of the OPCItem class is declared as follows:

Sub Read(Source As Integer, [Value], [Quality], [TimeStamp])

Parameter Description

Source ”OPCDevice” is a defined constant and member of the OPCData-Source structure.

Value Optional return parameter that contains the value of the variableafter a successful read job.

Quality Optional return parameter that contains information on the inte-grity of the data after successful execution of the read.

Time-Stamp

Optional return parameter. Indicates when the value of the itemlast changed.

Display Values

The values of the local variables of the assigned to the Text property of therelevant control and therefore made visible in the dialog:

Edit_ReadVal = myValueEdit_ReadQu = GetQualityText(myQuality)Edit_ReadTS = myTimeStamp

Page 577: Industrial Communication With PG-PC

Sample Programs

577SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.2.7 Command_Write_Click

The Command_Write_Click event routine executes a synchronous write job. It isstructured as follows:

Declaration and Initialization of Local Variables

After the declaration of several local variables, the value of the ServerHandleproperty of the OPCItem object “ItemObj” is written to the only element of theServerhandles long array. The server handle is a handle assigned by the server forthe item that the client transfers to the server so that the server can access therelevant variables in its structures.

Dim Serverhandles(1) As LongDim MyValues(1) As VariantDim MyErrors() As

LongServerhandles(1) = ItemObj.ServerHandle

The value of the Text property of the text box for user input is then assigned to thefirst component of the MyValues box:

MyValues(1) = Edit_WriteVal

Write Synchronously

After all the required local variables have been declared and initialized, theSyncWrite method of the OPCGroup class is called:

GroupObj.SyncWrite 1, Serverhandles, MyValues, MyErrors

SyncWrite

The SyncWrite method of the OPCGroup class writes values of OPC itemssynchronously and is declared as follows:

Sub SyncWrite(NumItems As Long, ServerHandles() As Long, Values() As Variant, Errors() As Long)

Parameter Description

NumItems Number of items for which values are written

ServerHandles Array with server handles

Values Array with the values to be written

Errors Return parameters. Array with error codes.

Page 578: Industrial Communication With PG-PC

Sample Programs

578SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

GetErrorString

The GetErrorString function of the OPCServer class converts an error code into astring and is declared as shown below:

Function GetErrorString(ErrorCode As Long) As String

Parameter Description

ErrorCode Error code returned by the server

Display Values

GetErrorString converts the numeric error code in the MyErrors array into thecorresponding error text and it is then displayed by the Text property of theEdit_WriteRes text box:

Edit_WriteRes = ServerObj.GetErrorString(MyErrors(1))

9.2.8 Command_Exit_Click

The Command_Exit_Click procedure is called when the button labeled “StopSample” is clicked and it can be divided into the following sections:

Deactivating Buttons

First, the “Start Sample” button is enabled again and all other buttons disabled:

Command_Start.Enabled = TrueCommand_Read.Enabled = FalseCommand_Write.Enabled = FalseCommand_Exit.Enabled = False

Releasing Resources

First, the OPCItem object is released. With the RemoveAll method of theOPCGroups class, all groups and the items they contain are then removed.Afterwards, the “MyOPCGroup” OPCGroup object is released:

Set ItemObj = NothingServerObj.OPCGroups.RemoveAllSet GroupObj = Nothing

Finally, the Disconnect method of the OPCServer class disconnects from theserver and the Server object is released:

ServerObj.DisconnectSet ServerObj = Nothing

All OPC objects are deleted and all resources are released.

Page 579: Industrial Communication With PG-PC

Sample Programs

579SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.2.9 GetQualityText

GetQualityText provides a string as an error message for a specified error code:

Private Function GetQualityText(Quality) As String Select Case Quality Case 0: GetQualityText = “BAD” Case 64: GetQualityText = “UNCERTAIN” Case 192: GetQualityText = “GOOD” Case 8: GetQualityText = “NOT_CONNECTED” Case 13: GetQualityText = “DEVICE_FAILURE” Case 16: GetQualityText = “SENSOR_FAILURE” Case 20: GetQualityText = “LAST_KNOWN” Case 24: GetQualityText = “COMM_FAILURE” Case 28: GetQualityText = “OUT_OF_SERVICE” Case 132: GetQualityText = “LAST_USABLE” Case 144: GetQualityText = “SENSOR_CAL” Case 148: GetQualityText = “EGU_EXCEEDED” Case 152: GetQualityText = “SUB_NORMAL” Case 216: GetQualityText = “LOCAL_OVERRIDE” Case Else: GetQualityText = “UNKNOWN ERROR” End Select End Function

9.2.10 Notes on Writing your own Programs

Several requirements must be met before your own programs can use theAutomation interface. Follow the steps outlined below:

Step Description

1 Start the Visual Basic development environment.

2 Create a project of the required type.

3 Go to the “Project” menu and select “References..”. A dialog isopened listing the available references. Select the following entry: “Siemens OPC DAAutomation 2.0”. This makes the OPC objects available in your project.

4 Arrange the required operator interface elements in the main dialogor create a suitable application window and program thecorresponding event procedures.

Page 580: Industrial Communication With PG-PC

Sample Programs

580SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3 Sample Program for the OPC Automation Interface(Asynchronous Communication)

This sample involves Microsoft Visual Basic and uses the Automation Interface forData Access V2.0 of OPC to read and write data asynchronously.

The description is divided into the following sections:

� Activating the Simulation Connection

� Working with the Sample Program

� How the Program Runs

� Description of the Program

� Notes on Writing your own Programs

9.3.1 Activating the Simulation Connection

Before you can run this program, you must activate a simulation connection thatmakes the demonstration variables used in the program available:

Step Description

1 Start the “Configuration Console” program in the Start menu:Start –> SIMATIC –> SIMATIC NET –> Settings –> ConfigurationConsole

2 In the left-hand navigation window, open the property page for thesimulation module by expanding SIMATIC NET Configuration –> Modulesand click on the “CP Simulation” icon

3 Click the check box for the protocol you want to simulate.This example uses the S7 protocol. So you should click on “S7”.

4 Close the “Configuration Console” program.

Note

Before the changes take effect, you must first close all OPC clients!

Page 581: Industrial Communication With PG-PC

Sample Programs

581SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.3.2 Working with the Sample Program

The program includes several elements that the operator can use to trigger thefollowing actions:

Operator Element Effect

Start Sample Start program

Read or Write Value Read and write values

Group Active Activate or deactivate group

Stop Sample Stop the program

9.3.3 Start Program

The program is on your hard disk in <installationpath>\SIEMENS\SIMATIC.NET\opc2\samples\automation\async

When you start the program, only the “Start Sample” button is enabled. After youhave clicked this button, the program generates the required OPC objects. You canthen use the other buttons.

Page 582: Industrial Communication With PG-PC

Sample Programs

582SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3.4 Read and Write Values

After you click the “Read Value” button, the value that was read and statusinformation is displayed in the relevant text boxes. As it stands, the sampleprogram is designed to operate with a demonstration connection. If you want to runthe sample program in a real environment, you must change the following lines inthe code of the OPCDA_AsyncDlg.cpp file:

Set ItemObj1 = GroupObj.OPCItems.AddItem(”S7:[DEMO]MB1”, 1)

Set ItemObj2 = GroupObj.OPCItems.AddItem(”S7:[DEMO]MW3”, 2)

To write a value, you enter it in the “Value” text box and click the “Write Value”button. The program displays a message about the result of the write operation:

Page 583: Industrial Communication With PG-PC

Sample Programs

583SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.3.5 Activate Group

Asynchronous operations do not return a result directly (for example as a functionresult or return parameter) but make use of events.

You can activate the OPC group in the sample program by selecting the “GroupActive” check box. When changes occur, the “OnDataChange-Event” is thencreated. A procedure that executes when this event occurs, displays values andstatus information in the text boxes of “OnDataChanged”:

Events for completion of write or read operations are also generated for inactivegroups. This means that results can also be displayed for writes and reads even ifthis check box is not selected.

9.3.6 Stop the Program

The “Stop Sample” button stops the program. All OPC objects are deleted and thecorresponding resources are released.

Page 584: Industrial Communication With PG-PC

Sample Programs

584SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3.7 How the Program Runs

Due to the class model of OPC, a specific order must be adhered to in the methodcalls of OPC objects. To be able to create an instance of the “OPCItem” class, anobject of the “OPCGroup” class is necessary. This is, however, only possible whenan instance of the “OPCServer” class exists and a connection to this server hasbeen established.

The basic sequence of instructions for creating and deleting OPC objects isillustrated in the following graphic. The variable names of the sample program areused.

The sample program contains all the components that would normally exist in atypical client application. These include establishing the connection to the OPCserver, creating a group with variables, and reading and writing values for an item.

Page 585: Industrial Communication With PG-PC

Sample Programs

585SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.3.8 Description of the Program

The program code in the opcsync.frm file can be divided into the followingsections:

� Declaration of constants

� Declaration of global variables

� Implementing the event procedures

Constants

At the beginning of the module, three constants are declared that will be requiredlater in method calls and make the program easier to read:

Const WRITEASYNC_ID = 1 Const READASYNC_ID = 2 Const REFRESHASYNC_ID = 3

Global Variables

Several global variables are then declared. To allow the OPCServer andOPCGroup objects to process events, their declaration must be supplemented with“WithEvents”:

Public WithEvents ServerObj As OPCServerPublic WithEvents GroupObj As OPCGroupDim ItemObj1 As OPCItemDim ItemObj2 As OPCItemDim Serverhandle(2) As Long

Implementing the Event Procedures

The main components of this module are the event procedures for the buttons ofthe dialog that are called by Visual Basic.

� Command_Start_Click

� chkGroupActive_Click

� Command_Read_Click

� Command_Write_Click

� Command_Exit_Click

� GroupObj_AsyncReadComplete

� GroupObj_AsyncWriteComplete

� GroupObj_DataChange

The file also includes the auxiliary functions

� GetQualityText

� GetErrorString

Page 586: Industrial Communication With PG-PC

Sample Programs

586SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3.9 Command_Start_Click

The Command_Start_Click method is called when the button labeled “StartSample” is clicked and it can be divided into the following sections:

� Enabling Buttons

� Generating an Object of the OPCServer Class

� Establishing a Connection to the Server

� Adding a Group

� Setting the IsSubscribed Property

� Activating the Group

� Adding Items

� Initializing the Server Handles

Enabling Buttons

First, the “Start Sample” button is disabled and all other buttons enabled:

Command_Start.Enabled = FalseCommand_Read.Enabled = TrueCommand_Write.Enabled = TrueCommand_Exit.Enabled = TruechkGroupActive.Enabled = True

Generating an Object of the OPCServer Class

First, a new instance of the OPCServer class is generated:

Set ServerObj = New OPCServer

Establishing a Connection to the OPC Server of SIMATIC NET

With the Connect method of the OPCServer class, a connection is established tothe OPC Server of SIMATIC NET:

ServerObj.Connect (”OPC.SimaticNET”)

Connect

The Connect method of the OPCServer class is declared as follows:Sub Connect(ProgID As String, [Node])

Parameter Description

ProgID Unique OPC server name assigned by the vendor

Node Optional parameter of the Variant type that specifies the servercomputer when using DCOM.

Page 587: Industrial Communication With PG-PC

Sample Programs

587SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Adding a Group

Each object of the OPCServer class has the collection object OPCGroups. Its Addfunction adds an object of the type OPCGroup to the collection:

Set GroupObj = ServerObj.OPCGroups.Add(”MyOPCGroup”)

Add

The Add function of the OPCGroups class is declared as follows:

Function Add([Name]) As OPCGroup

Parameter Description

Name Optional parameter as variant that specifies the name of the newgroup.

Setting the IsSubscribed Property

The IsSubscribed property of the OPCGroup class must be set to true if the groupis to receive asynchronous data updates:

GroupObj.IsSubscribed = True

Activating a Group

The procedure chkGroupActive_Click is now called to adapt the status of the groupto the status of the “Group Active” check box:

chkGroupActive_Click

Adding Items

Each object of the OPCGroup class has the collection object OPCItems. ItsAddItem function creates a new object of the class OPCItem and adds it to thecollection:

Set ItemObj1 = GroupObj.OPCItems.AddItem(”S7:[DEMO]MB1”, 1)Set ItemObj2 = GroupObj.OPCItems.AddItem(”S7:[DEMO]MW3”, 2)

Page 588: Industrial Communication With PG-PC

Sample Programs

588SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

AddItem

The AddItem function of the OPCItems class returns an object of the OPCItemtype and is declared as follows:

Function AddItem(ItemID As String, ClientHandle As Long) AsOPCItem

Parameter Description

ItemID Please refer to some of the samples and the manual for moreinformation on the structure of the ItemID.

Client-Handle

Handle assigned by the client for an item

Initializing the Serverhandle Variable

The Serverhandle generated by the OPC server when AddItems is called isrequired later and is therefore saved. The value of the server handle is assigned to a component of the globalServerhandle array for each of the OPCItem objects:

Serverhandle(1) = ItemObj1.ServerhandleServerhandle(2) = ItemObj2.Serverhandle

9.3.10 The “Group Active” Check Box

The setting of the “Group Active” check box can addressed directly as shown hereusing the chkGroupActive variable that is assigned to the check box. It indicateswhether the box was activated or is inactive. Depending on the status of the checkbox, the “GroupObj” group is activated or deactivated when chkGroupActive_Clickis called:

If chkGroupActive = 1 ThenGroupObj.IsActive = TrueElseGroupObj.IsActive = FalseEnd If

Page 589: Industrial Communication With PG-PC

Sample Programs

589SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.3.11 Command_Read_Click

The Command_Read_Click event routine starts an asynchronous read job. Thefollowing operations are executed:

Variable Declarations

First, several local variables are declared some of which are passed as parametersfor the subsequent method call. The “ClientID” variable is also assigned the valueof the global constant READASYNC_ID:

Dim ClientID As LongDim ServerID As LongDim ErrorNr() As LongDim ErrorString As String

ClientID = READASYNC_ID

Asynchronous Read

The AsyncRead method of the OPCGroup class is called first so that anasynchronous read job is started.If AsyncRead method returns an error code other than 0, GetErrorString is used toget an error text that is displayed in the form of a message.The Erase function releases the memory that was allocated by the dynamicErrorNr array:

GroupObj.AsyncRead 1, Serverhandle, ErrorNr, ClientID,ServerID

If ErrorNr(1) <> 0 ThenErrorString = ServerObj.GetErrorString(ErrorNr(1))MsgBox ErrorString, vbCritical, “Error AsyncRead()”End If

Erase ErrorNr

Page 590: Industrial Communication With PG-PC

Sample Programs

590SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

AsyncRead

The Async Read method is defined as shown below:

Sub AsyncRead(NumItems As Long, ServerHandles() As Long, Errors() As Long, TransactionID As Long, CancelID As Long)

Parameter Description

NumItems Number of items for which values will be read.

ServerHandles Array with the server handles of the items for whichvalues will be read.

Errors Array with elements of the type Long. These varia-bles provide an error code if AsyncRead was not cal-led successfully or information indicating a successfulmethod call.

TransactionID A code number assigned by the client to identify theasynchronous transaction. This is returned by theserver with AsyncReadComplete calls.

CancelID A code number generated by the server that must bespecified if the transaction is to be canceled.

9.3.12 Command_Write_Click

The Command_Write_Click event routine starts an asynchronous write job. Thefollowing operations are executed:

Variable Declarations

First, several local variables are declared some of which are passed as parametersfor the subsequent method call. The first component of the MyValues variable is then assigned the value of the textproperty of the Edit_WriteVal text box.

Dim Serverhandles(1) As LongDim MyValues(1) As VariantDim ErrorNr() As LongDim ErrorString As StringDim Cancel_id As Long

MyValues(1) = Edit_WriteVal

Page 591: Industrial Communication With PG-PC

Sample Programs

591SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Write Asynchronous

The AsyncWrite method of the OPCGroup class is called first so that anasynchronous write job is started.If the AsyncWrite method returns an error code other than 0, GetErrorString isused to get an error text that is displayed in the form of a message.The Erase function releases the memory that was allocated by the dynamicErrorNr array:

GroupObj.AsyncWrite 1, Serverhandle, MyValues, ErrorNr,WRITEASYNC_ID, Cancel_id

If ErrorNr(1) <> 0 ThenErrorString = ServerObj.GetErrorString(ErrorNr(1))MsgBox ErrorString, vbCritical, “Error AsyncRead()”End If

Erase ErrorNr

AsyncWrite

The AsyncWrite method is declared as follows:

Sub AsyncWrite(NumItems As Long, ServerHandles() As Long, Values() As Variant, Errors() As Long, TransactionID As Long, CancelID As Long)

Parameter Description

NumItems Number of items for which values are written.

ServerHandles Array with the server handles of the items for whichvalues are written.

Values Array with the values to be written.

Errors Array with elements of the type Long. These varia-bles provide an error code if AsyncWrite was not cal-led successfully or information indicating a successfulmethod call.

TransactionID A code number assigned by the client to identify theasynchronous transaction.

CancelID A code number generated by the server that must bespecified if the transaction is to be canceled.

Page 592: Industrial Communication With PG-PC

Sample Programs

592SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3.13 Command_Exit_Click

The Command_Exit_Click procedure is called when the button labeled “StopSample” is clicked and it can be divided into the following sections:

Deactivating Buttons

First, the “Start Sample” button is enabled again and all other buttons disabled:

Command_Start.Enabled = TrueCommand_Read.Enabled = FalseCommand_Write.Enabled = FalseCommand_Exit.Enabled = FalsechkGroupActive.Enabled = False

Releasing Resources

First, the OPCItem objects are released. With the RemoveAll method of theOPCGroups class, all groups and the items they contain are then removed.Afterwards, the “MyOPCGroup” OPCGroup object is released:

Set ItemObj1 = NothingSet ItemObj2 = NothingServerObj.OPCGroups.RemoveAllSet GroupObj = Nothing

Finally, the Disconnect method of the OPCServer class disconnects from theserver and the Server object is released:

ServerObj.DisconnectSet ServerObj = Nothing

All OPC objects are deleted and all resources are released.

Page 593: Industrial Communication With PG-PC

Sample Programs

593SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.3.14 GroupObj_AsyncReadComplete

To be able to receive reply messages from the server to the AsyncRead calls, youmust implement the AsyncReadComplete event of the OPCGroup object. TheOPCGroup object must also be declared with the “With Events” attribute.

The AsyncReadComplete event is generated by the Automation Server when anAsyncRead call has been executed completely. When the AsyncReadCompleteclient method is called, it transfers the results of the read operation as parameters.

The AsyncReadComplete method and its implementation are described in greaterdetail below:

Declaration of AsyncReadComplete

The AsyncReadComplete event of the OPCGroup class is declared as shownbelow:

Event AsyncReadComplete(TransactionID As Long, NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date, Errors() As Long)

Parameter Description

TransactionID A code number for the asynchronous write operationspecified with the AsyncRead call.

NumItems Number of items for which values exist.

ClientHandles Array with the client handles of the items whose va-lues have changed.

ItemValues Array of the type variant that contains the values ofthe items that have changed.

Qualities Array with information about the integrity of the va-lues of the individual items.

TimeStamps Array with time information for the individual items.

Errors Array with error messages for the items.

Page 594: Industrial Communication With PG-PC

Sample Programs

594SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Implementation of the AsyncReadComplete Method

Dim ErrorString As String

If (TransactionID = READASYNC_ID) Then If Errors(1) = 0 Then Edit_ReadVal = ItemValues(1) Edit_ReadQu = GetQualityText(Qualities(1)) Edit_ReadTS = TimeStamps(1) Else ErrorString = ServerObj.GetErrorString(Errors(1)) MsgBox ErrorString, vbCritical, “Error AsyncReadComplete()” End IfEnd If

After the declaration of the ErrorString variable, there is a query to check whetherthe TransactionID matches the value READASYNC_ID specified with theAsyncRead call; in other words whether this return message actually belongs tothe asynchronous read job.

If this is the case, and if no errors occurred during execution of the read operation,the read values are assigned to the text properties of the relevant text boxes.

If errors occurred during the read, the resulting error code is converted withGetErrorString and displayed in the form of a message.

If the TransactionID does not match the READASYNC_ID, the method isterminated immediately.

9.3.15 GroupObj_AsyncWriteComplete

To be able to receive reply messages from the server to the AsyncWrite calls, youmust implement the AsyncWriteComplete event of the OPCGroup object. TheOPCGroup object must also be declared with the “With Events” attribute.

The AsyncWriteComplete event is generated by the Automation Server when anAsyncWrite call has been executed completely. When the AsyncWriteCompleteclient method is called, it transfers the results of the read operation as parameters.

The AsyncWriteComplete method and its implementation are described in greaterdetail below:

Declaration of AsyncWriteComplete

The AsyncWriteComplete event of the OPCGroup class is declared as shownbelow:

Event AsyncWriteComplete(TransactionID As Long,NumItems As Long, ClientHandles() As Long, Errors() As Long)

Page 595: Industrial Communication With PG-PC

Sample Programs

595SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter Description

TransactionID A code number for the asynchronous write operationtransferred when the AsyncWrite call is made.

NumItems Number of items for which values were written.

ClientHandles Array with the client handles of the items for which va-lues were written.

Errors Array with error messages for the items.

Implementation of the AsyncWriteComplete Method

Dim ErrorString As String

-If (TransactionID = WRITEASYNC_ID) ThenIf Errors(1) = 0 Then Edit_WriteRes = ServerObj.GetErrorString(Errors(1))Else ErrorString = ServerObj.GetErrorString(Errors(1)) MsgBox ErrorString, vbCritical, ”Error AsyncWriteComplete()”End IfEnd If

After the declaration of the ErrorString variable, there is a query to check whetherthe TransactionID matches the value WRITEASYNC_ID specified with theAsyncWrite call, in other words whether this return message actually belongs tothe asynchronous write job that transferred the value of WRITEASYNC_ID as theTransactionID.

If this is the case, and if no errors occurred during the write operation, the value ofthe first component of “Errors” that then contains a message about the success ofthe write operation is converted by GetErrorString and assigned to the textproperty of the Edit_WriteRes text box.

If errors occurred during asynchronous writing, the returned error code isconverted with GetErrorString and displayed as a message.

If the TransactionID does not match the READASYNC_ID, the method isterminated immediately.

Page 596: Industrial Communication With PG-PC

Sample Programs

596SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3.16 ObjGroup_DataChange

When monitoring variables, the OPC server continuously checks whether the valueor the quality of variables has changed.

To be able to react to return messages, the client must provide the DataChangemethod that is then called by the server when the data of an active item within anactive group changes. The “IsSubscribed” property of the group must also be setto true.

As the parameters of DataChange, the OPC server transfers the changed values,qualities, and time stamp of the OPC items.

Declaration of DataChange

The DataChange event of the OPCGroup class is declared as shown below:

Event DataChange(TransactionID As Long, NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date)

Parameter Description

TransactionID The code number for the type of method call is zero if avalue change was the cause of the method call, if thecode number is not zero, the method call was triggeredby a refresh.

NumItems Number of items for which values exist.

ClientHandles Array with the client handles of the items whose valueshave changed.

ItemValues Array of the type variant that contains the values of theitems that have changed.

Qualities Array with information about the integrity of the values ofthe individual items

TimeStamps Array with time information for the individual items

Implementation of DataChange

Dim i As Long For i = 1 To NumItems Edit_OnDataVal(i – 1) = ItemValues(i) Edit_OnDataQu(i – 1) = GetQualityText(Qualities(i)) Edit_OnDataTS(i – 1) = TimeStamps(i) Next i

In the loop, the values of the items whose data has changed are assigned to thetext properties of the text boxes in the OnDataChanged dialog group.

Page 597: Industrial Communication With PG-PC

Sample Programs

597SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.3.17 GetQualityText

GetQualityText provides a string as an error message for a specified error code:

Private Function GetQualityText(Quality) As String Select Case Quality Case 0: GetQualityText = “BAD” Case 64: GetQualityText = “UNCERTAIN” Case 192: GetQualityText = “GOOD” Case 8: GetQualityText = “NOT_CONNECTED” Case 13: GetQualityText = “DEVICE_FAILURE” Case 16: GetQualityText = “SENSOR_FAILURE” Case 20: GetQualityText = “LAST_KNOWN” Case 24: GetQualityText = “COMM_FAILURE” Case 28: GetQualityText = “OUT_OF_SERVICE” Case 132: GetQualityText = “LAST_USABLE” Case 144: GetQualityText = “SENSOR_CAL” Case 148: GetQualityText = “EGU_EXCEEDED” Case 152: GetQualityText = “SUB_NORMAL” Case 216: GetQualityText = “LOCAL_OVERRIDE” Case Else: GetQualityText = “UNKNOWN ERROR” End Select End Function

9.3.18 GetErrorString

The GetErrorString function of the OPCServer class converts an error code into astring and is declared as shown below:

Function GetErrorString(ErrorCode As Long) As String

Parameter Description

ErrorCode Error code returned by the server

Page 598: Industrial Communication With PG-PC

Sample Programs

598SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.3.19 Notes on Writing your own Programs

Several requirements must be met before your own programs can use theAutomation interface. Follow the steps outlined below:

Step Description

1 Start the Visual Basic development environment.

2 Create a project of the required type.

3 Go to the “Project” menu and select “References..”. A dialog isopened listing the available references. Select the following entry: “Siemens OPC DAAutomation 2.0”. This makes the OPC objects available in your project.

4 Arrange the required operator interface elements in the main dialogor create a suitable application window and program thecorresponding event procedures.

Page 599: Industrial Communication With PG-PC

Sample Programs

599SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.4 Sample Program for the OPC Custom Interface(Synchronous Communication)

This sample in Visual C++ uses the Microsoft Foundation Classes (MFC) and theCustom interface for Data Access V2.0 of OPC to read and write datasynchronously.

The description is divided into the following sections:

� Activating the Simulation Connection

� Working with the Sample Program

� How the Program Runs

� Description of the Program

� Notes on Writing your own Programs

9.4.1 Activating the Simulation Connection

Before you can run this program, you must activate a simulation connection thatmakes the demonstration variables used in the program available:

Step Description

1 Start the “Configuration Console” program in the Start menu:Start –> SIMATIC –> SIMATIC NET –> Settings –> ConfigurationConsole

2 In the left-hand navigation window, open the property page for thesimulation module by expanding SIMATIC NET Configuration –> Modulesand click on the “CP Simulation” icon

3 Click the check box for the protocol you want to simulate.This example uses the S7 protocol. So you should click on “S7”.

4 Close the “Configuration Console” program.

Note

Before the changes take effect, you must first close all OPC clients!

Page 600: Industrial Communication With PG-PC

Sample Programs

600SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.4.2 Working with the Sample Program

When you start the program, only the “Start Sample” button is enabled. After youhave clicked this button, the program generates the required OPC objects. You canthen use the other buttons.

After you click the “Read Value” button, the values that were read are displayed inthe relevant text boxes. As it stands, the sample program is designed to operatewith a demonstration connection. If you want to run the sample program in a realenvironment, you must change the following line in the OpcSyncDlg.cpp file:

LPWSTR szItemID = L”S7:[DEMO]MW1”;

Page 601: Industrial Communication With PG-PC

Sample Programs

601SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

To write a value, this must be entered in the relevant text box. After clicking the“Write Value” button, the program displays a message about the result of thisoperation:

The “Stop Sample” button closes the program; in other words, all objects aredeleted and the corresponding resources are released again.

9.4.3 How the Program Runs

Due to the class model of OPC, a specific order must be adhered to in the methodcalls of OPC objects. To be able to create an instance of the “OPCItem” class, anobject of the “OPCGroup” class is necessary. This is, however, only possible whenan instance of the “OPCServer” class exists and a connection to this server hasbeen established.

The basic sequence of instructions for creating and deleting OPC objects isillustrated in the following graphic. The variable names of the sample program areused.

Page 602: Industrial Communication With PG-PC

Sample Programs

602SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The sample program contains all the components that would normally exist in atypical client application. These include establishing the connection to the OPCserver, creating a group with variables, and reading and writing values for an item.Before describing the source code in detail, we will therefore have a look at thebasic structure of an OPC application.

Step Description

1 Register with COM

2 Convert the ProgID to a CLSID

3 Establish connection to the OPC server

4 Create an OPC group

5 Adding Items

6 Request an interface pointer for IOPCSyncIO

7 Delete objects and release memory

Step 1: Registering with COM

Each program that wants to use functions of the COM library must first registeritself with COM. This is the purpose of the CoInitialize() function:

HRESULT r1; r1 = CoInitialize(NULL);

Step 2: Converting the ProgID to a CLSID

To identify it, each COM server has a “ProgID” that is assigned to a worldwideunique “CLSID” (128 bits code). Since the CLSID is required as a parameter forthe later functions it must be obtained from the ProgID with theCLSIDFromProgID() function. The “ProgID” of the OPC Server of SIMATIC NET isL”OPC.SimaticNET”:

r1 = CLSIDFromProgID(L”OPC.SimaticNET”, &clsid);

Page 603: Industrial Communication With PG-PC

Sample Programs

603SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step 3: Establishing the Connection to the OPC Server

The CoCreateInstance() function creates an instance of the class whose “CLSID”was specified.

r1 = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER,IID_IOPCServer, (void**)&m_pIOPCServer);

The result of this program section is an object of the OPC server class.CoCreateInstance also provides a pointer to the IOPCServer interface of theserver object (m_pIOPCServer variable):

Step 4: Creating an OPC Group

The IOPCServer interface has the AddGroup() method for creating groups:

r1 = m_pIOPCServer–>AddGroup(L”grp1”, TRUE, 500, 1, &TimeBias, &PercentDeadband, LOCALE_ID, &m_GrpSrvHandle, &RevisedUpdateRate, IID_IOPCItemMgt, (LPUNKNOWN*)&m_pIOPCItemMgt);

The result of this program section is a group with the specified name and therequired properties. In addition, a pointer to the requested interface of the groupobject exists as a return parameter, in this case, IOPCItemMgt (m_pIOPCItemMgtvariable):

Page 604: Industrial Communication With PG-PC

Sample Programs

604SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Step 5: Adding Items

The IOPCItemMgt interface has the AddItems() method for creating OPC items:

r1 = pItemMgt–>AddItems(1, m_Items, &m_pItemResult,&m_pErrors);

The result of this step is the required number of items with the specified properties.The variables of the result structure m_pItemResult (server handle, data type ofthe item on the target system etc.) are initialized.

Step 6: Requesting an Interface Pointer for IOPCSyncIO

A pointer to the IOPCSyncIO interface is necessary to allow use of the methods forsynchronous reads and writes. It is requested using the already existing pointer tothe IOPCItemMgt interface:

r1 = m_pIOPCItemMgt–>QueryInterface(IID_IOPCSyncIO,(void**)&m_pIOPCSyncIO);

Using the Read() and Write() methods of this interface, values for items can beread or written:

Page 605: Industrial Communication With PG-PC

Sample Programs

605SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step 7: Deleting Objects and Releasing Memory

Before exiting the program, the OPC objects that have been created must bedeleted and the memory reserved for them must be released. The relevantfunctions are integral parts of the previously used interfaces.

r1 = m_pIOPCItemMgt–>RemoveItems(1, phServer, &pErrors);CoTaskMemFree(m_pItemResult);m_pItemResult=NULL;CoTaskMemFree(m_pErrors);m_pErrors = NULL;m_pIOPCSyncIO–>Release();m_pIOPCSyncIO = NULL;m_pIOPCItemMgt–>Release();m_pIOPCItemMgt = NULL;r1 = m_pIOPCServer–>RemoveGroup(m_GrpSrvHandle, TRUE);m_GrpSrvHandle = NULL;m_pIOPCServer–>Release();m_pIOPCServer = NULL;CoUninitialize();

9.4.4 Description of the OPCDA_SyncDlg.cpp Program

The OPCDA_SyncDlg.cpp file can be divided into the following sections:

� Declaration of Global Variable

� Methods of the COPCDA_SyncDlg Class

Global Variable

At the start of this module, a global variable is initialized with the item identifier. Toensure that the sample program functions correctly, this variable must be readableand writable.

const LPWSTR szItemID = L”S7:[DEMO]MW1”;

You can refer to several examples and the manual for more information on thestructure of the item IDs.

Page 606: Industrial Communication With PG-PC

Sample Programs

606SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Methods of the COPCDA_SyncDlg Class

The main components of this module are the event procedures for the buttons ofthe main dialog that are called by MFC. Some settings must also be made in theOnInitDialog method:

� OnInitDialog

� OnStart

� OnRead

� OnWrite

� OnStop

� DestroyWindow

9.4.5 OnInitDialog

There are several class variables available for access to COM mechanisms thatare initialized when the main dialog box is initialized. These variables can be put tothe following uses:

� m_pIOPCServer is a pointer to the IOPCServer interface of the OPC serverclass.

� m_pIOPCItemMgt is a pointer to the IOPCItemMgt interface of the OPC groupclass.

� m_pIOPCSyncIO is a pointer to the IOPCSyncIO interface of the OPC groupclass.

m_pIOPCServer = NULL;m_pIOPCItemMgt = NULL;m_pIOPCSyncIO = NULL;

At the start of the program, the user can only click the “Start Sample” button. Allother buttons are disabled. This makes sure that all required OPC objects are setup correctly before write or read operations are executed. This is achieved with thefollowing program section:

m_CtrlStop.EnableWindow(FALSE);m_CtrlRead.EnableWindow(FALSE);m_CtrlWrite.EnableWindow(FALSE);

Page 607: Industrial Communication With PG-PC

Sample Programs

607SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.4.6 OnStart

OnStart sets up the OPC objects required for running the program. First, localvariables are declared and initialized that are required for the methods of the OPCobjects.

void COpcSyncDlg::OnStart(){ HRESULT r1; CLSID clsid; LONG TimeBias = 0; FLOAT PercentDeadband = 0.0; DWORD RevisedUpdateRate; LPWSTR ErrorStr; char str[100]; Cstring szErrorText;

Then the following operations are executed:

CoInitialize

CoInitialize() initializes the COM library. The input parameter must always be“NULL”.

r1 = CoInitialize(NULL);if (r1 != S_OK){ if (r1 == S_FALSE) { MessageBox(”COM Library already initialized”, ”Error CoInitialize()”, MB_OK+MB_ICONEXCLAMATION); } else { szErrorText.Format( ”Initialisation of COM Library failed. \ Error Code= %4x”, r1); MessageBox(szErrorText, ”Error CoInitialize()”, MB_OK+MB_ICONERROR); SendMessage(WM_CLOSE); return; } }

Page 608: Industrial Communication With PG-PC

Sample Programs

608SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

CLSIDFromProgID

CLSIDFromProgID() retrieves a worldwide unique class identifier or CLSID from aspecified ProgID. This is required for the CoCreateInstance function.

This method is declared as follows:

HRESULT CLSIDFormProgID(LPCOLESTR lpszProgID, LPCLSIDpclsid);

Parameter Description

lpszProgID Pointer to the ProgID [input parameter]

pclsid Pointer to the retrieved class identifier [return value]

In the sample program, this method retrieves the class identifier of the OPC Serverof SIMATIC NET:

r1 = CLSIDFromProgID(L”OPC.SimaticNET”, &clsid); if (r1 != S_OK) { MessageBox(”Retrieval of CLSID failed”, “Error CLSIDFromProgID()”, MB_OK+MB_ICONERROR); CoUninitialize(); SendMessage(WM_CLOSE); return; }

Page 609: Industrial Communication With PG-PC

Sample Programs

609SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

CoCreateInstance

CoCreateInstance() creates an instance of the class whose class identifier wasspecified. This method is declared as follows:

STDAPI CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv);

Parameter Description

rclsid The class identifier of the required object

pUnkOuter NULL pointer if the object to be created is not part of anaggregated object. A pointer that is not a NULL pointeris interpreted as a pointer to the IUnknown interface ofthe aggregated object.

dwClsContext Describes the runtime environment of the object to becreated. This specifies whether or not the executablecode that creates and manages objects of this classruns on the local machine and whether a separate pro-cess will be created for it. The constants that can beused for this are specified in the CLSCTX enumerateddata type. In the sample, CLSCTX_LOCAL_SERVER isused; in other words, the executable code for managingthe server objects runs on the same computer as thesample program but in its own process.

riid Identifier of the interface over which communication withthe object will take place, in the sample program “IOPC-Server”.

ppv Address of the pointer variable containing the requiredinterface pointer if the method call is successful.

The following method call creates an object of the OPC server class and returns apointer to the IOPCServer interface:

r1 = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER,IID_IOPCServer, (void**)&m_pIOPCServer);if (r1 != S_OK){ MessageBox(”Creation of IOPCServer–Object failed”, “Error CoCreateInstance()”, MB_OK+MB_ICONERROR); m_pIOPCServer = NULL; CoUninitialize(); SendMessage(WM_CLOSE); return;}

Page 610: Industrial Communication With PG-PC

Sample Programs

610SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

AddGroup

The AddGroup() method of the IOPCServer creates an OPC group and is declaredas follows:

HRESULT AddGroup (LPWCSTR szName, BOOL bActive, DWORD dwRequestedUpdateRate, OPCHANDLE hClientGroup, LONG *pTimeBias, FLOAT *pPercentDeadband, DWORD dwLCID, OPCHANDLE *phServerGroup, DWORD *pRevisedUpdateRate, REFIID riid, LPUNKNOWN *ppUnk);

Parameter Description

szName Group name that can be assigned freely by theclient but must be unique within the client.

bActive FALSE if the group is to be inactive when it iscreated.TRUE if the group is to be active when it iscreated.

dwRequestedUpdateRate Specifies the shortest interval after which a clientwill be informed of changes to values or states ofitems. Specifying a suitable interval prevents infor-mation being sent to a client more quickly than itcan process it.

hClientGroup Code number that can be selected freely by theclient and that is returned by the server with cer-tain notifications. This allows the client to identifyits data. The client identifies the group with thishandle.

pTimeBias Deviation of the server time from UTC (UniversalTime Convention)

pPercentDeadband Specifies the percentage of the band width inwhich value changes do not lead to a notification.The upper and lower limit values of a value mustbe known to be able to calculate the band width.Inthis sample program, this is not the case (seeOPC Data Access Spec. 1.1, Section 4.4.1.6.).

dwLCID Selects the language to be used by the serverwhen returning texts.

phServerGroup Handle assigned by the server that must be speci-fied as a parameter with certain function calls (forexample, “RemoveGroup”). The server requiresthis to identify this group.

Page 611: Industrial Communication With PG-PC

Sample Programs

611SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

szName Group name that can be assigned freely by theclient but must be unique within the client.

pRevisedUpdateRate Shortest interval returned by the server after whicha client will be informed of changes to values orstates of items.

riid Pointer to the identifier of one of the interfaces ofthe OPC group object that will be available afterthe group is created. This parameter saves callingthe “QueryInterface” method extra.

ppUnk Pointer to the required interface.

When AddGroup is called in the sample program, the following settings are made:

� The bActive parameter is set to the value FALSE. Directly after it is created, thegroup is inactive; in other words, no OnDataChange callbacks are generated forthis group.

� The duration of the required update interval is 500 milliseconds.

� Any client handle can be specified since only one group is being used.

� In the sample program, there is no provision for suppressing notification ofvalue changes within a specific range. The value “0.0” is therefore entered forthe pPercentDeadband parameter.

� AddGroup will return a pointer to the IOPCItemMgt interface as the returnvalue.

r1 = m_pIOPCServer–>AddGroup(L”grp1”, TRUE, 500, 1, &TimBias, &PercentDeadband, LOCALE_ID, &m_GrpSrvHandle, &RevisedUpdateRate, IID_IOPCItemMgt, (LPUNKNOWN*)&m_pIOPCItemMgt); if (r1 == OPC_S_UNSUPPORTEDRATE) { szErrorText.Format (”Revised Update Rate %d is \ different from Requested Update Rate 500”, RevisedUpdateRate ); AfxMessageBox(szErrorText); } else if (FAILED(r1)) { MessageBox(”Can’t add Group to Server!”, ”Error AddGroup()”, MB_OK+MB_ICONERROR); m_pIOPCServer–>Release(); m_pIOPCServer = NULL;

Page 612: Industrial Communication With PG-PC

Sample Programs

612SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

CoUninitialize(); SendMessage(WM_CLOSE); return; }

Page 613: Industrial Communication With PG-PC

Sample Programs

613SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

AddItems

The AddItems() method of the IOPCItemMgt interface creates OPC items and isdeclared as follows:

HRESULT AddItems (DWORD dwNumItems, OPCITEMDEF *pItemArray, OPCITEMRESULT **ppAddResults, HRESULT **ppErrors);

Parameter Description

dwNumItems Number of items to be inserted.

pItemArray Array with elements of the type OPCITEMDEF. Structurevariables of this type contain all the information required bythe server to create items.

ppAddResults Array with elements of the type OPCITEMRESULT. Thereturn values delivered by the OPC server are structurevariables of this type.

ppErrors Array with elements of the type HRESULT. These variablesreturn an error code if items could not be created success-fully or information about the successful method call.

Before calling AddItems, an array with elements of the type OPCITEMDEF mustbe created and initialized with valid values. When doing this, the followingsituations must be taken into account:

� An access path for the item is not necessary in the sample and an empty stringis specified here.

� The item identifier was specified at the start of the moduleOPCDA_SyncDlg.cpp and assigned to the variable szItemID.

� The item will be activated after it is created.

� The sample program uses a client handle of 1.

� The OPC Server for SIMATIC NET does not require “BinaryLargeObjects” andthe structure component dwBlobSize therefore has the value “0”.

� For the item, the server must deliver the return value in a type corresponding tothe original data type of the item.

m_Items[0].szAccessPath = L””;m_Items[0].szItemID = szItemID;m_Items[0].bActive = TRUE; m_Items[0].hClient = 1;m_Items[0].dwBlobSize = 0; m_Items[0].pBlob = NULL;m_Items[0].vtRequestedDataType = vtDataTypeItem;

Page 614: Industrial Communication With PG-PC

Sample Programs

614SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The m_pItemResult pointer exists as a property of the COPCDA_SyncDlg class.The results returned by the server can be accessed using this variable. m_pErrorsis a pointer to the error code:

r1 = m_pIOPCItemMgt–>AddItems(1, m_Items, &m_pItemResult,&m_pErrors);

If the AddItems call was not successful, the program is aborted. First, however, theprogram must release the resources it is using:

if ( (r1 != S_OK) && (r1 != S_FALSE) ){ MessageBox(”AddItems failed!”, ”Error AddItems()”, MB_OK+MB_ICONERROR); m_pIOPCItemMgt–>Release(); m_pIOPCItemMgt = NULL; m_GrpSrvHandle = NULL; m_pIOPCServer–>Release(); m_pIOPCServer = NULL; CoUninitialize(); SendMessage(WM_CLOSE); return;}

GetErrorString

If the return value of AddItems() indicates that an error has occurred, theGetErrorString() method of the “IOPCServer” interface gets the correspondingerror message. This method is declared as follows:

HRESULT GetErrorString (HRESULT dwError, LCID dwLocale, LPWSTR *ppString);

Parameter Description

dwError Error code returned by the server

dwLocale The language identifier for the error message

ppString Double pointer to a null-terminated string to which GetEr-rorString returns the error message

else{ m_pIOPCServer –>GetErrorString(m_pErrors[0], LOCALE_ID, &ErrorStr); sprintf(str, ”%ls\n”, ErrorStr); MessageBox(str, “Result AddItems()”, MB_OK+MB_ICONEXCLAMATION);}

Page 615: Industrial Communication With PG-PC

Sample Programs

615SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

QueryInterface

The QueryInterface() method of the “IUnknown” interface returns a pointer to aninterface whose identifier is specified as the input parameter. QueryInterface() isdeclared as follows:

HRESULT QueryInterface (REFIID iid, void **ppvObject);

Parameter Description

iid Identifier of the required interface

ppvObjekt Address of the pointer variable containing the required in-terface pointer if the method call is successful. If the objectdoes not support this interface, an error code and the NULLpointer are returned.

QueryInterface gets a pointer to the IOPCSyncIO interface that provides methodsfor synchronous reading and writing:

r1 = m_pIOPCItemMgt–>QueryInterface(IID_IOPCSyncIO, (void**)&m_pIOPCSyncIO);if (r1 < 0){ MessageBox(”No IOPCSyncIO found!”, ”Error QueryInterface()”, MB_OK+MB_ICONERROR); CoTaskMemFree(m_pItemResult); m_pIOPCItemMgt–>Release(); m_pIOPCItemMgt = NULL; m_GrpSrvHandle = NULL; m_pIOPCServer–>Release(); m_pIOPCServer = NULL; CoUninitialize(); SendMessage(WM_CLOSE); return;}

Enabling Buttons

Once OnButtonStart() has set up all necessary OPC objects, it disables the “StartSample” button. All other buttons are enabled. This strategy ensures thatOnButtonStart() is executed once only. This saves additional queries in theprogram.

m_CtrlStop.EnableWindow(TRUE);m_CtrlRead.EnableWindow(TRUE);m_CtrlWrite.EnableWindow(TRUE);m_CtrlStart.EnableWindow(FALSE);

Page 616: Industrial Communication With PG-PC

Sample Programs

616SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The OPCITEMDEF Structure

OPCITEMDEF has the following structure:

typdef struct { LPWSTR szAccessPath; LPWSTR szItemID; BOOL bActive; OPCHANDLE hClient; DWORD dwBlobSize; BYTE *pBlob; VARTYP vtRequestedDataType; Word wReserved;} OPCITEMDEF;

Variables of OPCITEMDEF

szAccessPath Optional access path for the items (not required by SIMATIC NET)

szItemID ItemID assigned by the client

bActive TRUE if the client will be notified if there is a valuechange of the item in an active group; FALSE if theclient will not be notified.

hClient Handle for an item assigned by the client. The ser-ver transfers the client handle with calls to the client(for example, OnDataChange) so that the client canaccess the relevant variables in its structures.

dwBlobSize Size of a memory area on the server in which addi-tional information for faster access to the data of anitem is stored.

pBlob Pointer to the memory area described above

vtRequestedDataType Data type requested by the client

The OPCITEMRESULT Structure

OPCITEMRESULT has the following structure:

typdef struct { OPCHANDLE hServer; VARTYPE vtCanonicalDataType; WORD wReserved; DWORD dwAccessRights; DWORD dwBlobSize; BYTE *pBlob;} OPCITEMRESULT;

Page 617: Industrial Communication With PG-PC

Sample Programs

617SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Variables of OPCITEMRESULT

hServer A handle for an item assigned by the server. Theclient transfers the server handle with calls to theserver so that the server can access the relevantvariables in its structures.

vtCanonicalDataType The data type used by the server for an itemdwAccessRights Information about whether an item can only be read,

only be written, or read and written.dwBlobSize Size of a memory area on the server in which addi-

tional information for faster access to the data of anitem is stored.

pBlob Pointer to the memory area described above

9.4.7 OnRead

OnRead executes a synchronous read job. The following operations are executed:

Variable Declaration

First, several local variables are declared:

void COpcSyncDlg::OnRead() { OPCHANDLE *phServer; OPCITEMSTATE *pItemValue; HRESULT *pErrors; HRESULT r1; LPWSTR ErrorStr; char str[100]; UINT qnr;

The server handle of the item for which the value will be read is required as aparameter for the Read() method. This identification number assigned by theserver exists in the “hServer” component of the pItemResult[0] global variable. TheAddItem() method enters its return values in this structure variable of the typeOPCITEMRESULT.

phServer = new OPCHANDLE[1];phServer[0] = m_pItemResult[0].hServer;

Page 618: Industrial Communication With PG-PC

Sample Programs

618SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Read

Read reads values for OPC items synchronously. This method is declared asfollows:

HRESULT Read (OPCDATASOURCE dwSource, DWORD dwNumItems, OPCHANDLE *phServer, OPCITEMSTATE **ppItemValues, HRESULT **ppErrors);

Parameter Description

dwSource Data source. If you use OPC_DS_CACHE, the data is readfrom the cache of the OPC server; with OPC_DS_DEVICE,a read job is executed over the network.

dwNumItems Number of items for which values are read.

phServer Array with server handles

ppItemValues Array with elements of the type “OPCITEMSTATE” for theread values and additional information about the read job.

ppErrors Array with elements of the type HRESULT. These variablesreturn an error code if Read() could not be called success-fully or information about the successful method call.

Read is called with the previously initialized variables as parameters:

r1 = m_pIOPCSyncIO–>Read(OPC_DS_DEVICE, 1, phServer,&pItemValue, &pErrors);

The Read method provides the values that were read and additional information inthe pItemValue array. If the read is successful, these data are displayed in therelevant text boxes of the main dialog box:

if (r1 == S_OK){ m_ReadValue = pItemValue[0].vDataValue.lVal; qnr = pItemValue[0].wQuality; m_szReadQuality = GetQualityText(qnr); m_szTimeStamp = COleDateTime(pItemValue[0].ftTimeStamp).Format(); UpdateData(FALSE);}

Page 619: Industrial Communication With PG-PC

Sample Programs

619SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The return value S_FALSE indicates that an error code was entered in the pErrorsarray. GetErrorString gets the corresponding error message that is displayed in adialog box:

if (r1 == S_FALSE){ m_pIOPCServer–>GetErrorString(pErrors[0], LOCALE_ID, &ErrorStr); sprintf(str, ”%S\n”, ErrorStr); MessageBox(str, ”Error Read()”, MB_OK+MB_ICONERROR);}

If there are no error messages and the method call was not successful, a suitabledialog box is displayed. Finally, the resources used by Read are released:

if (FAILED(r1)){ MessageBox(”Read failed!”, ”Error Read()”, MB_OK+MB_ICONERROR);}else{ CoTaskMemFree(pErrors); CoTaskMemFree(pItemValue);}

The OPCITEMSTATE Structure

typdef struct { OPCHANDLE hClient; FILETIME ftTimeStamp; WORD wQuality; WORD wReserved; VARIANT vDataValue; } OPCITEMSTATE;

Variables of OPCITEMSTATE

hClient The client handle of the item

ftTimeStamp Time stamp (time at which the data were received from theOPC server)

wQuality Information on the integrity of the data

vDataValue The value read for the item

Page 620: Industrial Communication With PG-PC

Sample Programs

620SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.4.8 OnWrite

OnWrite executes a synchronous write job. The following operations are executed:

Variable Declaration

First, several local variables are declared:

void COpcSyncDlg::OnWrite() { OPCHANDLE *phServer; HRESULT *pErrors; VARIANT values[1]; HRESULT r1; LPWSTR ErrorStr; CString szOut;

The server handle of the item for which the value will be written is required as aparameter for the Write method. This identification number assigned by the serverexists in the “hServer” component of the m_pItemResult[0] global variable. TheAddItems method enters its return values in this structure variable of the typeOPCITEMRESULT:

phServer = new OPCHANDLE[1];phServer[0] = m_pItemResult[0].hServer;

The values variable is intended for storing the value to be written. The UpdateDatamethod of the CWnd class transfers the content of all controls to the relevantmember variables. This initializes the iVal component of the values structurevariable. ”2-byte integer” is specified as the data type:

UpdateData(TRUE);values[0].vt = VT_I2;values[0].iVal = m_WriteValue;

Write

Write writes values for OPC items synchronously. This method is declared asfollows:

HRESULT Write (DWORD dwNumItems, OPCHANDLE *phServer, VARIANT *pItemValues, HRESULT **ppErrors);

Page 621: Industrial Communication With PG-PC

Sample Programs

621SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter Description

dwNumItems Number of items for which values are written.

phServer Array with server handles

pItemValues Array with the values to be written

ppErrors Array with elements of the type HRESULT. These variablesreturn an error code if Write() could not be called successfullyor information about the successful method call.

Write is called with the previously initialized variables as parameters:

r1 = m_pIOPCSyncIO–>Write(1, phServer, values, &pErrors);

GetErrorString gets the error message belonging to the pErrors return value that isassigned to the member variable m_WriteRes. GetErrorString, however, adds twospecial characters for the line break that must be removed before display in a textbox.

Finally, the resources used by Write are released:

delete [] phServer;if (FAILED(r1)){ szOut.Format(”Method call IOPCSyncIO::Write \ failed with error code %x”, r1); MessageBox(szOut, ”Error Writing Item”, MB_OK+MB_ICONERROR); } else { m_pIOPCServer–>GetErrorString(pErrors[0], LOCALE_ID, &ErrorStr); m_szWriteResult = ErrorStr; m_szWriteResult.Remove(’\r’); m_szWriteResult.Remove(’\n’); UpdateData(FALSE); CoTaskMemFree(pErrors); }

Page 622: Industrial Communication With PG-PC

Sample Programs

622SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.4.9 OnStop

OnStop removes the OPC objects used in the program and releases thecorresponding resources. This method is called when the “Stop Sample” button isclicked, the OnDestroy method is executed or the WM_CLOSE message is sent(after clicking the button to close the dialog box or explicitly by callingSendMessage).

The resources are released in several steps:

� RemoveItems

� RemoveGroup

� Release

� CoUninitialize

RemoveItems

The RemoveItems method of the IOPCItemMgt interface removes OPC items andis declared as follows:

HRESULT RemoveItems (DWORD dwCount, OPCHANDLE *phServer, HRESULT **ppErrors);

Parameter Description

dwCount Number of items to be removed

phServer Array with the server handles of the items to be removed

ppErrors Array with elements of the type HRESULT. These variablesreturn an error code if “RemoveItems()” could not be calledsuccessfully or information about the successful methodcall.

Page 623: Industrial Communication With PG-PC

Sample Programs

623SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

void COpcSyncDlg::OnStop() { HRESULT r1; OPCHANDLE *phServer; HRESULT *pErrors; LPWSTR ErrorStr; char str[100];

phServer = new OPCHANDLE[1]; phServer[0] = m_pItemResult[0].hServer; r1 = m_pIOPCItemMgt–>RemoveItems(1, phServer, &pErrors); if ( (r1 != S_OK) && (r1 != S_FALSE) ) { MessageBox(”RemoveItems failed!”, ”Error RemoveItems()”, MB_OK+MB_ICONERROR); } else { m_pIOPCServer–>GetErrorString(pErrors[0], LOCALE_ID, &ErrorStr); sprintf(str, ”%ls\n”, ErrorStr); MessageBox(str, ”Result RemoveItems()”, MB_OK+MB_ICONEXCLAMATION); }

RemoveGroup

RemoveGroup() removes a group from the server and is declared as follows:

HRESULT RemoveGroup (OPCHANDLE hServerGroup, BOOL bForce );

Parameter Description

hServerGroup Server handle of the group to be removed.

bForce Specifies whether or not a group can be removed whenthere is still a reference to it.

r1=m_pIOPCServer–>RemoveGroup(m_GrpSrvHandle, TRUE);if (r1 != S_OK){ MessageBox(”RemoveGroup failed!”, ”Error Remove Group()”, MB_OK+MB_ICONERROR);}

Page 624: Industrial Communication With PG-PC

Sample Programs

624SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Release

The IOPCServer and IMalloc interfaces have the Release method with which theyrelease the resources used by the interface:

m_pIOPCSyncIO–>Release();m_pIOPCSyncIO = NULL;m_pIOPCItemMgt–>Release();m_pIOPCItemMgt = NULL;m_pIOPCServer–>Release();m_pIOPCServer = NULL;

In addition to this, all other requested resources must be released again:

delete[] phServer; CoTaskMemFree(pErrors);CoTaskMemFree(m_pItemResult);m_pItemResult=NULL;CoTaskMemFree(m_pErrors);m_pErrors = NULL;m_GrpSrvHandle = NULL;

All buttons apart from “Start Sample” are made inactive:

m_CtrlStart.EnableWindow(TRUE);m_CtrlRead.EnableWindow(FALSE);m_CtrlStop.EnableWindow(FALSE);m_CtrlWrite.EnableWindow(FALSE);

CoUninitialize

The CoUninitialize method closes the COM library and releases all resources ofthe thread:

CoUninitialize(); }

9.4.10 DestroyWindow

This method of the CWnd class is overwritten so that all the clean up jobs can bedone when the dialog window is closed. OnButtonStop() deletes all the OPCobjects and releases the corresponding resources. Following this, DestroyWindowof the parent class is called to release the memory used by the window object:

BOOL COPCDA_SyncDlg::DestroyWindow(){ if (m_pIOPCServer) OnStop(); return CDialog::DestroyWindow();}

Page 625: Industrial Communication With PG-PC

Sample Programs

625SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.4.11 GetQualityText

GetQualityText provides a CString object as an error message for a specified errorcode:

CString GetQualityText(UINT qnr){ CString qstr; switch(qnr) { case OPC_QUALITY_BAD: qstr = ”BAD”; break; case OPC_QUALITY_UNCERTAIN: qstr = ”UNCERTAIN”; break; case OPC_QUALITY_GOOD: qstr = ”GOOD”; break; case OPC_QUALITY_NOT_CONNECTED: qstr = ”NOT_CONNECTED”; break; case OPC_QUALITY_DEVICE_FAILURE: qstr = ”DEVICE_FAILURE”; break; case OPC_QUALITY_SENSOR_FAILURE: qstr = ”SENSOR_FAILURE”; break; case OPC_QUALITY_LAST_KNOWN: qstr = ”LAST_KNOWN”; break; case OPC_QUALITY_COMM_FAILURE: qstr = ”COMM_FAILURE”; break; case OPC_QUALITY_OUT_OF_SERVICE: qstr = ”OUT_OF_SERVICE”; break; case OPC_QUALITY_LAST_USABLE: qstr = ”LAST_USABLE”; break; case OPC_QUALITY_SENSOR_CAL: qstr = ”SENSOR_CAL”; break; case OPC_QUALITY_EGU_EXCEEDED: qstr = ”EGU_EXCEEDED”; break; case OPC_QUALITY_SUB_NORMAL: qstr = ”SUB_NORMAL”; break; case OPC_QUALITY_LOCAL_OVERRIDE: qstr = ”LOCAL_OVERRIDE”;

Page 626: Industrial Communication With PG-PC

Sample Programs

626SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

break; default: qstr = ”UNKNOWN ERROR”; } return qstr; }

Page 627: Industrial Communication With PG-PC

Sample Programs

627SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.4.12 Notes on Writing your own Programs

Several requirements must be met before your own programs can use the Custominterface. Follow the steps outlined below:

Step Description

1 Start the Visual C++ development environment.

2 Create a project of the required type using the MFC Class Wizard.

3 Copy the files pre_opc.h and pre_opc.cpp from the sample programinto your project folder and add these files to the project (Projectmenu > Add To Project > Files ...). These files contain OPC-specificdefinitions and include statements.

4 Add the statement #include “pre_opc.h” to all the implementationfiles of your project (extension .cpp):

5 In the implementation files (extension .cpp) that use theAddGroup() or GetErrorString() methods, add the followingstatement:#define LOCALE_ID 0x409

6 Arrange the required operator interface elements in the main dialogor create a suitable application window and program thecorresponding event procedures.

Page 628: Industrial Communication With PG-PC

Sample Programs

628SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.5 Sample Program for the OPC Custom Interface(Asynchronous Communication)

This sample uses the Custom Interface for Data Access V2.0 from OPC.

9.5.1 Activating the Simulation Connection

Before you can run this program, you must activate a simulation connection thatmakes the demonstration variables used in the program available:

Step Description

1 Start the “Configuration Console” program in the Start menu:Start –> SIMATIC –> SIMATIC NET –> Settings –> Configura-tion Console

2 In the left-hand navigation window, open the property page forthe simulation module by expanding SIMATIC NET Configuration –> Modulesand click on the “CP Simulation” icon

3 Click the check box for the protocol you want to simulate.This example uses the S7 protocol. So you should click on “S7”.

4 Close the “Configuration Console” program.

Note

Before the changes take effect, you must first close all OPC clients!

Page 629: Industrial Communication With PG-PC

Sample Programs

629SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.5.2 Working with the Sample Program

The program includes several elements that the operator can use to trigger thefollowing actions:

Operator Element Effect

Start Sample Start program

Read or Write Item 0 Read and write values

Group Active Activate or deactivate group

Stop Sample Stop the program

9.5.3 Start Program

The program is on your hard disk in <installationpath>\SIEMENS\SIMATIC.NET\opc2\samples\custom\async.

When you start the program, only the “Start Sample” button is enabled. After youhave clicked this button, the program generates the required OPC objects. You canthen use the other buttons.

Page 630: Industrial Communication With PG-PC

Sample Programs

630SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.5.4 Read and Write Values

After you click the “Read Item 0” button, the value that was read and statusinformation is displayed in the relevant text boxes. As it stands, the sampleprogram is designed to operate with a demonstration connection. If you want to runthe sample program in a real environment, you must change the following lines inthe OPCDA_AsyncDlg.cpp program:

const LPWSTR szItemID0 = L”S7:[DEMO]MB1”;

const LPWSTR szItemID1 = L”S7:[DEMO]MW1”;

To write a value, you enter it in the “Value” text box and click the “Write Item 0”button. The program displays a message about the result of the write operation:

Page 631: Industrial Communication With PG-PC

Sample Programs

631SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.5.5 Activate Group

Asynchronous operations do not return a result directly (for example as a functionresult or return parameter) but make use of events.

You can activate the OPC group in the sample program by selecting the “GroupActive” check box. Among other things, the “OnDataChange” event is generated. Aprocedure that executes when this event occurs, displays values and statusinformation in the text boxes of “OnDataChanged”:

Events for completion of write or read operations are also generated by inactivegroups. This means that results can also be displayed for writes and reads even ifthis check box is not selected.

Page 632: Industrial Communication With PG-PC

Sample Programs

632SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.5.6 Stop the Program

The “Stop Sample” button stops the program. All OPC objects are deleted and thecorresponding resources are released.

9.5.7 How the Program Runs

Due to the class model of OPC, a specific order must be adhered to in the methodcalls of OPC objects. To be able to create an instance of the “OPCItem” class, anobject of the “OPCGroup” class is necessary. This is, however, only possible whenan instance of the “OPCServer” class exists and a connection to this server hasbeen established.

The basic sequence of instructions for creating and deleting OPC objects isillustrated in the following graphic. The variable names of the sample program areused:

Page 633: Industrial Communication With PG-PC

Sample Programs

633SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The sample program contains all the components that would normally exist in atypical client application. These include establishing the connection to the OPCserver, creating a group with variables, and reading and writing values for an item.Before describing the source code in detail, we will first have a look at the basicstructure of an OPC application.

Step Description

1 Register with COM

2 Convert the ProgID to a CLSID

3 Establish connection to the OPC server

4 Create an OPC group

5 Adding Items

6 Request an interface pointer for IOPCGroupStateMgt

7 Request an interface pointer for IOPCAsyncIO2

8 Create callback object

9 Connect OPC server and callback object of the client

10 Execute required write and read operations

11 Receive notifications of the OPC server

12 Delete objects and release memory

Step 1: Registering with COM

Each program that wants to use functions of the COM library must first registeritself with COM. This is the purpose of the CoInitialize function:

HRESULT r1;r1 = CoInitialize(NULL);

Step 2: Converting the ProgID to a CLSID

To identify it, each COM server has a “ProgID” that is assigned to a worldwideunique “CLSID”. This is obtained with the CLSIDFromProgID() function. TheProgID of the OPC Server of SIMATIC NET is L”OPC.SimaticNET”:

r1 = CLSIDFromProgID(L”OPC.SimaticNET”, &clsid);

Page 634: Industrial Communication With PG-PC

Sample Programs

634SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Step 3: Establishing the Connection to the OPC Server

The CoCreateInstance() function creates an instance of the class whose “CLSID”was specified.

r1 = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER,IID_IOPCServer, (void**)&m_pIOPCServer);

The result of this program section is an object of the OPC server class.CoCreateInstance also provides a pointer to the IOPCServer interface of theserver object (m_pIOPCServer variable):

Step 4: Creating an OPC Group

The IOPCServer interface has the AddGroup() method for creating groups:

HRESULT r1;r1 = m_pIOPCServer –>AddGroup(L”grp1”, FALSE, 500, 1,&TimBias, &PercentDeadband, LOCALE_ID, &m_GrpSrvHandle,&RevisedUpdateRate, IID_IOPCItemMgt,(LPUNKNOWN*)&m_pIOPCItemMgt);

The result of this program section is a group with the specified name and therequired properties. AddGroup also returns a pointer to a requested interface of thegroup object as a return parameter, in this case, IOPCItemMgt (m_pIOPCItemMgtvariable):

Page 635: Industrial Communication With PG-PC

Sample Programs

635SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step 5: Adding Items

The IOPCItemMgt interface has the AddItems() method for creating OPC items:

HRESULT r1;r1 = m_pIOPCItemMgt–>AddItems(2, m_Items, &m_pItemResult, &m_pErrors);

The result of this program section is that the server adds two items with theproperties specified in the m_Items parameter. The variables of the result structurem_pItemResult (server handle, data type of the item on the target system etc.) areinitialized.

Step 6: Requesting an Interface Pointer for IOPCGroupStateMgt

A pointer to the IOPCGroupStateMgt interface is necessary to allow use of theSetState methods. The SetState method is required later to activate anddeactivate a group. This interface pointer is also required as a parameter for theAtlAdvise and AtlUnadvise methods:

HRESULT r1; r1 = m_pIOPCItemMgt–>QueryInterface(IID_IOPCGroupeStateMgt, (void**) &m_pIOPCGroupStateMgt);

The result of this program section is a pointer to the IOPCGroupStateMgt interface(m_pIOPCGroupStateMgt variable) of the group object:

Step 7: Requesting an Interface Pointer for IOPCAsyncIO2

In the same way, the program also requests the pointer to the IOPCAsyncIO2interface(m_pIOPCAsyncIO2 variable). This interface provides methods forasynchronous reading and writing of values:

r1 = m_pIOPCItemMgt –>QueryInterface(IID_IOPCAsyncIO2,(void**) &m_pIOPCAsyncIO2);

Page 636: Industrial Communication With PG-PC

Sample Programs

636SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Step 8: Creating a Callback Object

To allow the OPC server to return a result of asynchronous operations, theIOPCDataCallback interface must be implemented on the client. In the sampleprogram, this is handled by the COPCDataCallback class that is derived fromIOPCDataCallback and CComObjectRoot.

The CreateInstance method creates an object of the CComObject template class:

CComObject<COPCDataCallback>* pCOPCDataCallback;CComObject<COPCDataCallback>::CreateInstance&pCOPCDataCallback);

Step 9: Connecting the OPC Server and Callback Object of the Client

The AtlAdvise() method creates a connection between the OPC server and thecallback object. The GetUnknown() method first gets a pointer to the IUnknowninterface of the callback object: AtlAdvise requires this pointer as an inputparameter:

LPUNKNOWN pCbUnk;pCbUnk = pCOPCDataCallback–>GetUnknown();HRESULT hRes = AtlAdvise(m_pIOPCGroupStateMgt, pCbUnk,IID_IOPCDataCallback, &m_dwAdvise);

Page 637: Industrial Communication With PG-PC

Sample Programs

637SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Step 10: Executing the Required Write or Read OperationRead Operation

The Read() and Write() methods of the IOPCAsyncIO2 interface can be accessedvia the m_pIOPCAsyncIO2 pointer that was created in step 7:

r1 = m_pIOPCAsyncIO2–>Read(1, phServer, 1, &dwCancelID, &pErrors);

Step 11: Receiving Notifications of the OPC Server

If the data of an active item in an active group change, the server calls theOnDataChange method of the callback object. On completion of a read operation,the server calls the method OnReadComplete() etc. The server transfers the returnvalues as a parameter to the relevant method.

STDMETHODIMP COPCDataCallback:: OnDataChange(WORD dwTransid,OPCHANDLE hGroup,HRESULT hrMasterquality,RESULT hrMastererror,DWORD dwCount,OPCHANDLE __RPC_FAR *phClientItems,VARIANT __RPC_FAR *pvValues,WORD __RPC_FAR *pwQualities,FILETIME __RPC_FAR *pftTimeStamps,HRESULT __RPC_FAR *pErrors)

Page 638: Industrial Communication With PG-PC

Sample Programs

638SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Step 12: Deleting Objects and Releasing Memory

Before exiting the program, the OPC objects that have been created must bedeleted and the memory reserved for them must be released. The relevantfunctions are integral parts of the previously used interfaces. AtlUnadviseterminates the connection between the OPC server and the callback object:

HRESULT hRes = AtlUnadvise(m_pIOPCGroupStateMgt,IID_IOPCData–Callback, m_dwAdvise);m_pIOPCGroupStateMgt–>Release();. . .r1 = m_pIOPCItemMgt–>RemoveItems(2, phServer, &pErrors);. . .CoTaskMemFree(pErrors);CoTaskMemFree(m_pItemResult);m_pItemResult=NULL;. . .. . .

Releasing Memory

When using COM, it is sometimes necessary for the client to release memory thatwasrequested by the server.

The rules for this are as follows:

� [out]: The memory for a parameter with this attribute will be requested from theserver.

� [in, out]: The memory for such a parameter will be requested from the client.The server can release the memory again and reallocate it.

� [in]: The client will request the memory. The server is not responsible forreleasingthe memory.

In all three cases, the reserved memory will effectively be released by the client.

Page 639: Industrial Communication With PG-PC

Sample Programs

639SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.5.8 Description of the Program Structure

This description explains the content of the following two files:

� OPCDA_AsyncDlg.cpp is the implementation file of the program-specific dialogbox class. Here, you will find the event procedures for the various buttons. Theirbodies may have been created by the MFC Class Wizard. The methods forinitializing the dialog box and for displaying the data are also defined here.

� Callback.cpp is the implementation file of the program-specific callback class.All the methods that must be provided by a client so that it can receivenotifications from an OPC server are defined in this module.

9.5.9 The OPCDA_AsyncDlg.cpp File

The OPCDA_AsyncDlg.cpp file can be divided into the following sections:

� Declaration of Global Variables

� The CAboutDlg Class

� Methods of the COPCDA_AsyncDlg.cpp Class

Declaration of the Global Variables for Storing the Item IDs

At the start of this module, two variables are initialized with the item identifiers:

const LPWSTR szItemID0 = L”S7:[DEMO]MB1”;const LPWSTR szItemID1 = L”S7:[DEMO]MW1”;

For the functionality of the program, it is important that the first variable can beboth read and written, whereas it is adequate if the second variable can be read.

You can refer to several examples and the manual for more information on thestructure of the item IDs.

If you select two variables that overlap in the memory map, both variables willchange when you write to one of them.

The CAboutDlg Class

Following this, the CAboutDlg class is defined that displays an information box.Since there is no OPC-specific code in this class, it will not be described in anydetail.

Page 640: Industrial Communication With PG-PC

Sample Programs

640SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Methods of the COPCDA_AsyncDlg Class

The COPCDA_AsyncDlg class has the following methods in addition to theconstructor and destructor:

� DoDataExchange

� OnInitDialog

� OnSysCommand

� OnPaint

� OnQueryDragIcon

� OnButtonStart()

� OnButtonRead()

� OnButtonWrite()

� OnCheckActivategroup()

� OnButtonStop()

� OnDestroy

� DisplayData

� UpdateData

OnInitDialog

There are several class variables available for access to COM mechanisms thatare initialized when the main dialog box is initialized. These variables can be put tothe following uses:

� m_pIOPCServer is a pointer to the IOPCServer interface of the OPC serverclass.

� m_pIOPCItemMgt is a pointer to the IOPCItemMgt interface of the OPC groupclass.

� m_pIOPCGroupStateMgt is a pointer to the IOPCGroupStateMgt interface ofthe OPC group class.

m_pIOPCServer = NULL;m_pIOPCItemMgt = NULL;m_pIOPCGroupStateMgt = NULL;

At the start of the program, the user can only click the “Start Sample” button. Allother buttons and the check box are disabled. This makes sure that all requiredOPC objects are set up correctly before write or read operations are executed.

A member variable was assigned to the relevant controls with which the status canbe changed:

m_CtrlStop.EnableWindow(FALSE);m_CtrlRead.EnableWindow(FALSE);m_CtrlWrite.EnableWindow(FALSE);m_CtrlChkActive.EnableWindow(FALSE);

Page 641: Industrial Communication With PG-PC

Sample Programs

641SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

OnButtonStart()

OnButtonStart() sets up the OPC objects required for running the program. First,several local variables are declared that are required for the methods of the OPCobjects.

void COPCDA_AsyncDlg::OnButtonStart() { HRESULT r1; CLSID clsid; LONG TimBias = 0; FLOAT PercentDeadband = 0.0; DWORD RevisedUpdateRate; LPWSTR ErrorStr1,ErrorStr2; Cstring szErrorText; m_pItemResult = NULL; ...

Then the following operations are executed:

CoInitialize

CoInitialize() initializes the COM library. The input parameter must always be“NULL”.

r1 = CoInitialize(NULL);if (r1 != S_OK){ if (r1 == S_FALSE) { MessageBox(”COM Library already initialized”, ”Error CoInitialize()”, MB_OK+MB_ICONEXCLAMATION); } else { szErrorText.Format(”Initialisation of COM Library \ failed. ErrorCode= %4x”, r1); MessageBox(szErrorText, ”Error CoInitialize()”, MB_OK+MB_ICONERROR); SendMessage(WM_CLOSE); return; }}

CLSIDFromProgID

CLSIDFromProgID() retrieves a worldwide unique class identifier or CLSID from aspecified ProgID. This is required for the CoCreateInstance function.

This method is declared as follows:

HRESULT CLSIDFormProgID(LPCOLESTR lpszProgID, LPCLSID pclsid);

Page 642: Industrial Communication With PG-PC

Sample Programs

642SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Parameter Description

lpszProgID Pointer to the ProgID [input parameter]

pclsid Pointer to the retrieved class identifier [return value]

In the sample program, this method retrieves the class identifier of the OPC Serverof SIMATIC NET:

r1 = CLSIDFromProgID(L”OPC.SimaticNET”, &clsid);if (r1 != S_OK){ MessageBox(”Retrival of CLSID failed”, ”Error CLSIDFromProgID()”, MB_OK+MB_ICONERROR); CoUninitialize(); SendMessage(WM_CLOSE); return;}

CoCreateInstance

CoCreateInstance() creates an instance of the class whose class identifier wasspecified. This method is declared as follows:

STDAPI CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv);

Parameter Description

rclsid The class identifier of the required object

pUnkOuter NULL pointer if the object to be created is not part of an ag-gregated object. A pointer that is not a NULL pointer is in-terpreted as a pointer to the IUnknown interface of the ag-gregated object.

dwClsContext Describes the runtime environment of the object to be crea-ted. This specifies whether or not the executable code thatcreates and manages objects of this class runs on the localmachine and whether a separate process will be created forit. The constants that can be used for this are specified inthe CLSCTX enumerated data type. In the sample,CLSCTX_LOCAL_SERVER is used; in other words, theexecutable code for managing the server objects runs onthe same computer as the sample program but in its ownprocess.

Page 643: Industrial Communication With PG-PC

Sample Programs

643SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

riid Identifier of the interface over which communication with theobject will take place, in the sample program “IOPCServer”.

ppv Address of the pointer variable containing the required inter-face pointer if the method call is successful.

The following method call creates an object of the OPC server class and returns apointer to the IOPCServer interface:

r1 = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IOPCServer, (void**)&m_pIOPCServer);if (r1 != S_OK){ MessageBox(”Creation of IOPCServer–Object failed”, ”Error CoCreateInstance()”, MB_OK+MB_ICONERROR); m_pIOPCServer = NULL; CoUninitialize(); SendMessage(WM_CLOSE); return;}

AddGroup

The AddGroup() method of the IOPCServer creates an OPC group and is declaredas follows:

HRESULT AddGroup (LPWCSTR szName, BOOL bActive, DWORD dwRequestedUpdateRate, OPCHANDLE hClientGroup, LONG *pTimeBias, FLOAT *pPercentDeadband, DWORD dwLCID, OPCHANDLE *phServerGroup, DWORD *pRevisedUpdateRate, REFIID riid, LPUNKNOWN *ppUnk);

Parameter Description

szName Group name that can be assigned freely by theclient but must be unique within the client.

bActive FALSE if the group is to be inactive when it iscreated.TRUE if the group is to be active when itis created.

dwRequestedUpdateRate Specifies the shortest interval after which a clientwill be informed of changes to values or states ofitems. Specifying a suitable interval prevents in-formation being sent to a client more quickly thanit can process it.

Page 644: Industrial Communication With PG-PC

Sample Programs

644SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

hClientGroup Code number that can be selected freely by theclient and that is returned by the server with cer-tain notifications. This allows the client to identifyits data. The client identifies the group with thishandle.

pTimeBias Deviation of the server time from UTC (UniversalTime Convention)

pPercentDeadband Specifies the deadband within which value chan-ges do not lead to notification. This property is,however, only effective when you use analog va-lues. The high and low limits of a value must alsobe known.In this sample program, this is not thecase (see OPC Data Access Spec. 1.1, Section4.4.1.6.)

dwLCID Selects the language to be used by the serverwhen returning texts.

phServerGroup Handle assigned by the server that must be spe-cified as a parameter with certain function calls(for example, “RemoveGroup”). The server requi-res this to identify this group.

pRevisedUpdateRate Shortest interval returned by the server afterwhich a client will be informed of changes to va-lues or states of items.

riid Pointer to the identifier of one of the interfaces ofthe OPC group object that will be available afterthe group is created. This parameter saves callingthe “QueryInterface” method extra.

ppUnk Pointer to the required interface.

Page 645: Industrial Communication With PG-PC

Sample Programs

645SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

When AddGroup is called in the sample program, the following settings are made:

� The bActive parameter is set to the value FALSE. Directly after it is created, thegroup is inactive; in other words, no OnDataChange callbacks are generated forthis group.

� The duration of the required update interval is 500 milliseconds.

� Any client handle can be specified since only one group is being used.

� In the sample program, there is no provision for suppressing notification ofvalue changes within a specific range. The value “0.0” is therefore entered forthe pPercentDeadband parameter.

� AddGroup will return a pointer to the IOPCItemMgt interface as the returnvalue.

r1 = m_pIOPCServer–>AddGroup(L”grp1”, FALSE, 500, 1, &TimBias, &PercentDeadband, LOCALE_ID, &m_GrpSrvHandle, &RevisedUpdateRate, IID_IOPCItemMgt, (LPUNKNOWN*)&m_pIOPCItemMgt);

AddItems

The AddItems() method of the IOPCItemMgt interface creates OPC items and isdeclared as follows:

HRESULT AddItems (DWORD dwNumItems, OPCITEMDEF *pItemArray, OPCITEMRESULT **ppAddResults, HRESULT **ppErrors);

Parameter Description

dwNumItems Number of items to be inserted.

pItemArray Array with elements of the type OPCITEMDEF. Structurevariables of this type contain all the information required bythe server to create items.

Page 646: Industrial Communication With PG-PC

Sample Programs

646SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

ppAddResults Array with elements of the type OPCITEMRESULT. Thereturn values delivered by the OPC server are structurevariables of this type.

ppErrors Array with elements of the type HRESULT. These variablesreturn an error code if items could not be created success-fully or information about the successful method call.

Before calling AddItems, an array with elements of the type OPCITEMDEF mustbe created and initialized with valid values. When doing this, the followingsituations must be taken into account:

� An access path for the item is not necessary in the sample and an empty stringis specified here.

� The item identifiers were specified at the start of the moduleOPCDA_AsyncDlg.cpp and assigned to the variables szItemID1 andszItemID2.

� The item will be activated after it is created.

� The sample program uses a client handle of 0 and 1.

� The OPC Server for SIMATIC NET does not require “BinaryLargeObjects” andthe structure component dwBlobSize therefore has the value “0”.

� For the first item, the server must deliver the return value in a typecorresponding to the original data type of the item.

� For the second item, the server must deliver the return value as a two-byteinteger.

m_Items[0].szAccessPath = L””; m_Items[0].szItemID = szItemID1; m_Items[0].bActive = TRUE; m_Items[0].hClient = 0; m_Items[0].dwBlobSize = 0; m_Items[0].pBlob = NULL; m_Items[0].vtRequestedDataType = 0; m_Items[1].szAccessPath = L””; m_Items[1].szItemID = szItemID2; m_Items[1].bActive = TRUE; m_Items[1].hClient = 1; m_Items[1].dwBlobSize = 0; m_Items[1].pBlob = NULL; m_Items[1].vtRequestedDataType = VT_I2;

The m_pItemResult pointer exists as a property of the COPCDA_AsyncDlg class.The results returned by the server can be accessed using this variable. m_pErrorsis a pointer to the error code:

Page 647: Industrial Communication With PG-PC

Sample Programs

647SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

r1 = m_pIOPCItemMgt–>AddItems(2, m_Items, &m_pItemResult,&m_pErrors);

If the AddItems call was not successful, the program is aborted. First, however, theprogram must release the resources it is using:

if ( (r1 != S_OK) && (r1 != S_FALSE) ){ MessageBox(”AddItems failed!”, ”Error AddItems()”, MB_OK+MB_ICONERROR); m_pIOPCItemMgt–>Release(); m_pIOPCItemMgt = NULL; m_GrpSrvHandle = 0; m_pIOPCServer–>Release(); m_pIOPCServer = NULL; CoUninitialize(); SendMessage(WM_CLOSE); return;}

GetErrorString

If the return value of AddItems() indicates that an error has occurred, theGetErrorString() method of the “IOPCServer” interface gets the correspondingerror message. This method is declared as follows:

HRESULT GetErrorString (HRESULT dwError, LCID dwLocale, LPWSTR *ppString);

Parameter Description

dwError Error code returned by the server

dwLocale The language identifier for the error message

ppString Double pointer to a null-terminated string to which GetEr-rorString returns the error message

else{ m_pIOPCServer –>GetErrorString(m_pErrors[0], LOCALE_ID, &ErrorStr1); m_pIOPCServer –>GetErrorString(m_pErrors[1], LOCALE_ID, &ErrorStr2); CString szOut; szOut.Format(”Item %ls :\n %ls\n\nItem %ls :\n %ls\n”, szItemID0, ErrorStr1, szItemID1, ErrorStr2); MessageBox(szOut, ”Result AddItems()”, MB_OK+MB_ICONEXCLAMATION);}

Page 648: Industrial Communication With PG-PC

Sample Programs

648SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

QueryInterface

The QueryInterface() method of the “IUnknown” interface returns a pointer to aninterface whose identifier is specified as the input parameter. QueryInterface() isdeclared as follows:

HRESULT QueryInterface (REFIID iid, void **ppvObject);

Parameter Description

iid Identifier of the required interface

ppvObjekt Address of the pointer variable containing the required in-terface pointer if the method call is successful. If the objectdoes not support this interface, an error code and the NULLpointer are returned.

QueryInterface gets a pointer to the IOPCAsyncIO2 interface that providesmethods for asynchronous reading and writing:

r1 = m_pIOPCItemMgt –>QueryInterface(IID_IOPCAsyncIO2, (void**)& m_pIOPCAsyncIO2);if (r1 < 0){ MessageBox(”No IOPCAsyncIO found!”, ”Error QueryInterface()”, MB_OK+MB_ICONERROR); . . . return;}

Create Callback Object

The IOPCDataCallback interface must be implemented in the client program sothat notifications from the OPC server can be received. In the sample program, theimplementation makes use of the Active Template Library (ATL). TheCOPCDataCallback class specific to the sample is used as a parameter for theCComObject template class.

The CreateInstance method creates an object of the CComObject class that isaccessed via the pOPCDataCallback pointer:

CComObject<COPCDataCallback>* pCOPCDataCallback;CComObject<COPCDataCallback>::CreateInstance &pCOPCDataCallback);

Page 649: Industrial Communication With PG-PC

Sample Programs

649SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Establish Connection between Dialog Box and Callback Object

OnButtonStart() calls the InformAboutDialog method of the dialog box class andpasses a pointer to the current dialog box to it (the this pointer). InformAboutDialog(in the Callback.cpp module) stores this pointer in the m_pCDlgClass membervariable.

OnReadComplete(), OnWriteComplete() and OnDataChange use this pointer tocall the DisplayData method of the dialog box. Without the information inm_pCDlgClass, there would be no reference to indicate the dialog box in which thedata are to be displayed.

pCOPCDataCallback->InformAboutDialog(this);

The relationship between the class methods of COPCDA_AsyncDlg andIOPCDataCallback is illustrated in the following graphic:

Connect OPC Server and Callback Object of the Client

The GetUnknown() method gets a pointer to the IUnknown interface of the callbackobject:

LPUNKNOWN pCbUnk; pCbUnk = pCOPCDataCallback->GetUnknown();

The AtlAdvise() method creates a connection between the OPC server and thecallback object. AtlAdvise is declared as follows:

HRESULT AtlAdvise (IUnknown *pUnkCP, IUnknown *pUnk, const IID& iid, LPDWORD pdw)

Parameter Description

pUnkCP Pointer to the IUnknown interface to which the client wantsto establish a connection.

pUnk Pointer to the IUnknown interface of the callback object

Page 650: Industrial Communication With PG-PC

Sample Programs

650SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

iid The identifier of the connection point. Normally the identifierof the interface that implements the callback functionalityon the client is specified.

pdw Return parameters. Pointer to a code number to identify theconnection. This value is required if the connection is termi-nated with AtlUnadvise.

If AtlAdvise could not execute successfully, this is displayed in the dialog box:

HRESULT hRes = AtlAdvise(m_pIOPCGroupStateMgt, pCbUnk, IID_IOPCDataCallback, &m_dwAdvise);if (hRes != S_OK) { AfxMessageBox(”Advise failed!”); . . . return;}

Enabling Buttons

Once OnButtonStart() has set up all necessary OPC objects, it disables the “StartSample” button. All other buttons are enabled. This strategy ensures thatOnButtonStart() is executed once only. This saves additional queries in theprogram.

m_CtrlStop.EnableWindow(TRUE);m_CtrlRead.EnableWindow(TRUE);m_CtrlWrite.EnableWindow(TRUE);m_CtrlChkActive.EnableWindow(TRUE);m_CtrlStart.EnableWindow(FALSE);

The OPCITEMDEF Structure

OPCITEMDEF has the following structure:

typdef struct { LPWSTR szAccessPath; LPWSTR szItemID; BOOL bActive; OPCHANDLE hClient; DWORD dwBlobSize; BYTE *pBlob; VARTYP vtRequestedDataType; Word wReserved; } OPCITEMDEF;

Page 651: Industrial Communication With PG-PC

Sample Programs

651SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Variables of OPCITEMDEF

szAccessPath Optional access path for the items (not required bySIMATIC NET)

szItemID ItemID assigned by the client

bActive TRUE if the client will be notified if there is a valuechange of the item in an active group; FALSE if theclient will not be notified.

hClient Handle for an item assigned by the client. The ser-ver transfers the client handle with calls to the client(for example, OnDataChange) so that the client canaccess the relevant variables in its structures.

dwBlobSize Size of a memory area on the server in which addi-tional information for faster access to the data of anitem is stored.

pBlob Pointer to the memory area described above

vtRequestedData-Type

Data type requested by the client

The OPCITEMRESULT Structure

OPCITEMRESULT has the following structure:

typdef struct { OPCHANDLE hServer; VARTYPE vtCanonicalDataType; WORD wReserved; DWORD dwAccessRights; DWORD dwBlobSize; BYTE *pBlob; } OPCITEMRESULT;

Variables of OPCITEMRESULT

hServer A handle for an item assigned by the server. Theclient transfers the server handle with calls to theserver so that the server can access the relevantvariables in its structures.

vtCanonicalDataType The data type used by the server for an item

dwAccessRights Information about whether an item can only beread, only be written, or read and written.

dwBlobSize Size of a memory area on the server in whichadditional information for faster access to thedata of an item is stored.

pBlob Pointer to the memory area described above

Page 652: Industrial Communication With PG-PC

Sample Programs

652SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OnButtonRead()

OnButtonRead() starts an asynchronous read job. The following operations areexecuted:

Variable Declaration and Plausibility Check

After the declaration of several local variables, the program checks whether anitem exists. After successfully calling AddItems in the OnButtonStart() method, them_pItemResult variable is initialized. The m_pErrors[0] array component musthave the value S_OK, otherwise the item was not created correctly:

void COPCDA_AsyncDlg::OnButtonRead(){ OPCHANDLE *phServer; DWORD dwCancelID; HRESULT *pErrors; HRESULT r1; LPWSTR ErrorStr; CString szOut

if (m_pErrors[0] != S_OK) { MessageBox(”OPC Item0 not available!”, ”Error Read async”, MB_OK+MB_ICONERROR); return; }}

Read

Read reads values for OPC items asynchronously and is declared as follows:

HRESULT Read (DWORD dwCount, OPCHANDLE * phServer, DWORD dwTransactionID, DWORD *pdwCancelID, HRESULT ** ppErrors);

Page 653: Industrial Communication With PG-PC

Sample Programs

653SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter Description

dwCount Number of items for which values are read

phServer Array with the server handles of the items for which va-lues are read

dwTransactionID A code number assigned by the client to identify theasynchronous transaction. This is returned by the ser-ver withOnReadComplete() calls.

pdwCancelID A code number generated by the server that must bespecified if the transaction is to be canceled.

ppErrors Array Array with elements of the type HRESULT. These varia-bles return an error code if Read() could not be calledsuccessfully or information about the successful methodcall.

The program sets up memory for an array with an element of the typeOPCHANDLE and initializes the only array element with the structure componenthServer of the m_pItemResult variable. The OPC server entered a server handlethere for the item when AddItems was called:

phServer = new OPCHANDLE[1];phServer[0] = m_pItemResult [0].hServer;r1 = m_pIOPCAsyncIO2 –>Read(1, phServer, 1, &dwCancelID, &pErrors);

The return value S_FALSE indicates that one or more items could not be read. Inthis case, the GetErrorString method gets the corresponding error message anddisplays it in a dialog box:

if (r1 == S_FALSE){ m_pIOPCServer –>GetErrorString(pErrors[0], LOCALE_ID, &ErrorStr); szOut.Format (”%s”,ErrorStr); MessageBox(szOut, ” Error Reading Item0”, MB_OK+MB_ICONERROR);}

Before the end of the program, the memory reserved by OnButtonRead() isreleased again. With Array phServer, this is done with delete because the memorywas created with new. The memory area of the pErrors array was organized byCoTaskMemAlloc and is therefore released with CoTaskMemFree:

delete[] phServer;CoTaskMemFree(pErrors);}

Page 654: Industrial Communication With PG-PC

Sample Programs

654SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OnButtonWrite()

OnButtonWrite() starts an asynchronous write job. The following operations areexecuted:

Variable Declaration and Plausibility Check

The variable declaration corresponds to the OnButtonRead() method. In addition,an array of the type VARIANT is declared for the result of the read operation. Tocheck whether an item exists, the content of the hServer structure component isused as in OnButtonRead():

void COPCDA_AsyncDlg::OnButtonWrite(){ OPCHANDLE *phServer; DWORD dwCancelID; VARIANT values[1]; HRESULT *pErrors; HRESULT r1; LPWSTR ErrorStr; CString szOut; if (m_pErrors[0] != S_OK) { MessageBox(”OPC Item not available!”, “Error Write async”, MB_OK+MB_ICONERROR); return; } phServer = new OPCHANDLE[1]; phServer[0] = m_pItemResult[0].hServer; ...

Write

Write writes values for OPC items asynchronously and is declared as follows:

HRESULT Write (DWORD dwCount, OPCHANDLE *phServer, VARIANT *pItemValues, DWORD dwTransactionID, DWORD *pdwCancelID HRESULT **ppErrors);

Page 655: Industrial Communication With PG-PC

Sample Programs

655SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter Description

dwCount Number of items for which values are written.

phServer Array with the server handles of the items for which va-lues are written.

pItemValues Array with the values to be written

dwTransactionID A code number assigned by the client to identify theasynchronous transaction.

pdwCancelID A code number generated by the server that must bespecified if the transaction is to be canceled.

ppErrors Array with elements of the type HRESULT. These varia-bles return an error code if Write() could not be calledsuccessfully or information about the successful methodcall.

The sample does not use the dwTransactionID parameter, so any value is set:

r1 = m_pIOPCAsyncIO2 ->Write(1, phServer, values, 2,&dwCancelID, &pErrors);

If Write returns “S_FALSE” an error occurred. The program gets the correspondingerror message. If Write could not be executed, an error message to this effect isdisplayed in a dialog box. delete[] phServer releases the memory reserved by OnButtonWrite():

delete[] phServer;if (r1 == S_FALSE){ m_pIOPCServer–>GetErrorString(pErrors[0], LOCALE_ID, &ErrorStr); m_WriteResult = ErrorStr; UpdateData(FALSE);}if (FAILED(r1)){ szOut.Format(”Method call IOPCAsyncIO2::Write failed \ with error code %x”, r1); MessageBox(szOut, ”Error Writing Item0”, MB_OK+MB_ICONERROR);}else{ CoTaskMemFree(pErrors);}

Page 656: Industrial Communication With PG-PC

Sample Programs

656SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Apply Values from Dialog Box

The UpdateData method call with the TRUE parameter transfers the content of allcontrol variables to the relevant member variables: The value of the m_WriteValmember variable of the IDC_EDIT_WRITEVAL text box is stored in the iValcomponent of the only element of values[]. The vt component is assigned theVT_I2 type; in other words, iVal is to be interpreted as an integer with the lengthtwo bytes:

UpdateData(TRUE);values[0].vt = VT_I2;values[0].iVal = m_WriteVal;

OnCheckActivategroup()

OnCheckActivategroup() is called when the “Group Active” check box is clicked. Itactivates and deactivates the group dependent on the status of the check box.

The following operations are executed:

Apply Value from Dialog Box

The UpdateData method call with the TRUE parameter transfers the content of allcontrols to the relevant member variables:

void COPCDA_AsyncDlg::OnCheckActivategroup() { UpdateData(TRUE);

SetState

SetState specifies several properties of a group and is declared as follows:

HRESULT SetState (DWORD * pRequestedUpdateRate, DWORD * pRevisedUpdateRate, BOOL *pActive, LONG * pTimeBias, FLOAT * pPercentDeadband DWORD * pLCID, OPCHANDLE *phClientGroup);

Page 657: Industrial Communication With PG-PC

Sample Programs

657SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Parameter Description

pRequestedUpdateRate Update interval required by the client for dataand state changes of items

pRevisedUpdateRate The shortest update interval that can be imple-mented for the group by the server

pActive Status of the group: TRUE to activate thegroup. FALSE to deactivate the group.

pTimeBias Deviation of the server time from UTC (Univer-sal Time Convention)

pPercentDeadband Specifies the deadband within which valuechanges do not lead to notification. This pro-perty is, however, only effective when you useanalog values. The high and low limits of a va-lue must also be known. In this sample pro-gram, this is not the case (see OPC Data Ac-cess Spec. 1.1, Section 4.4.1.6.)

pLCID Identification number for the local adaptation ofthe group (language etc.)

phClientGroup New client handle for the group

We only want to activate the group so only the pActive parameter is given a value.A suitable variable must also be available for the pRevisedUpdateRate returnparameter:

DWORD dwRevUpdateRate;HRESULT r1= m_pIOPCGroupStateMgt ->SetState (NULL, &dwRevUpdateRate, &m_bChkActivateGroup, NULL, NULL, NULL, NULL);if (FAILED(r1)){ MessageBox(”Set State failed”, ”Error”, MB_OK+MB_ICONERROR); return;}

Page 658: Industrial Communication With PG-PC

Sample Programs

658SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OnButtonStop()

OnButtonStop() removes the OPC objects used in the program and releases thecorresponding resources. This method is called when the “Stop Sample” button isclicked, the OnDestroy method is executed or the WM_CLOSE message is sent(after clicking the button to close the dialog box or explicitly by callingSendMessage).

The following operations are executed:

AtlUnadvise

AtlUnadvise terminates the connection between the OPC server and the callbackobject and is declared as follows:

HRESULT AtlUnadvise (IUnknown*pUnkCP, const IID &iid, DWORD dw);

Parameter Description

pUnkCP Pointer to the IUnknown interface of the object with whichthe client is connected.

iid The identifier of the connection point. Normally the identifierof the interface that implements the callback functionalityon the client is specified.

dw Identification number with which the connection can beidentified.

void COPCDA_AsyncDlg::OnButtonStop() { HRESULT r1; OPCHANDLE *phServer; HRESULT *pErrors; HRESULT hRes = AtlUnadvise(m_pIOPCGroupStateMgt, IID_IOPCDataCallback, m_dwAdvise);

Release

Each COM interface has the Release method with which it releases the resourcesused by the interface. In actual fact, Release does not remove any objects frommemory, but simply decrements the reference counter of the interface. The objectsare actually deleted only when the interface is no longer referenced.

m_pIOPCGroupStateMgt ->Release();

Page 659: Industrial Communication With PG-PC

Sample Programs

659SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

RemoveItems

The RemoveItems method of the IOPCItemMgt interface removes OPC items andis declared as follows:

HRESULT RemoveItems (DWORD dwCount, OPCHANDLE *phServer, HRESULT **ppErrors);

Parameter Description

dwCount Number of items to be removed

phServer Array with the server handles of the items to be removed

ppErrors Array with elements of the type HRESULT. These variablesreturn an error code if “RemoveItems()” could not be calledsuccessfully or information about the successful methodcall.

This program section sets up memory for an array with an element of the typeOPCHANDLE and initializes the array elements with the structure componenthServer of the m_pItemResult variable. The OPC server entered the serverhandles there for the items when AddItems was called. After the RemoveItemscall, the memory for this array is released again:

phServer = new OPCHANDLE[2];phServer[0] = m_pItemResult[0].hServer;phServer[1] = m_pItemResult[1].hServer;r1 = m_pIOPCItemMgt –>RemoveItems(2, phServer, &pErrors);if ( (r1 != S_OK) && (r1 != S_FALSE) ){ MessageBox(”RemoveItems failed!”, ”Error RemoveItems()”, MB_OK+MB_ICONERROR);}delete[] phServer;

The memory areas for pErrors and m_pItemResult are released with theCoTaskMemFree method because they were obtained with COM mechanisms.The resources of m_pIOPCItemMgt and m_pIOPCAsyncIO2 are released byRelease:

CoTaskMemFree(pErrors);CoTaskMemFree(m_pItemResult);m_pItemResult =NULL;CoTaskMemFree(m_pErrors);m_pErrors =NULL;m_pIOPCAsyncIO2–>Release();m_pIOPCAsyncIO2 = NULL;m_pIOPCItemMgt–>Release();m_pIOPCItemMgt = NULL;

Page 660: Industrial Communication With PG-PC

Sample Programs

660SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

RemoveGroup

RemoveGroup() removes a group from the server and is declared as follows:

HRESULT RemoveGroup (OPCHANDLE hServerGroup, BOOL bForce);

Parameter Description

hServerGroup Server handle of the group to be removed.

bForce Specifies whether or not a group can be removed whenthere is still a reference to it.

r1 = m_pIOPCServer–>RemoveGroup(m_GrpSrvHandle, TRUE);if (r1 != S_OK){ MessageBox(”RemoveGroup failed!”, ”Error RemoveGroup()”, MB_OK+MB_ICONERROR);}m_GrpSrvHandle = NULL;

The resources of the OPC server object are released with Release, CoUninitializecloses the COM library:

m_pIOPCServer->Release();m_pIOPCServer = NULL;CoUninitialize();

Finally, the program disables all controls apart from the “Start Sample” button:

m_CtrlStart.EnableWindow(TRUE);m_CtrlStop.EnableWindow(FALSE);m_CtrlRead.EnableWindow(FALSE);m_CtrlWrite.EnableWindow(FALSE);m_CtrlChkActive.EnableWindow(FALSE);}

OnDestroy

This method of the CWnd class is overwritten so that all the clean up jobs can bedone when the dialog window is closed. OnButtonStop() deletes all the OPCobjects and releases the corresponding resources. Following this, OnDestroy ofthe parent class is called to release the memory used by the window object:

void COPCDA_AsyncDlg::OnDestroy() { if (m_pIOPCServer) OnButtonStop(); CDialog::OnDestroy();}

Page 661: Industrial Communication With PG-PC

Sample Programs

661SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

DisplayData

The dialog box class has three methods to display data after a message from theOPC server. Different methods are necessary because the various notificationsfrom the server return different data.

The following methods are available:

� After data have changed (one method per item):

void DisplayData0 (CString ReadVal, CString ReadQuality, CString ReadTS)void DisplayData1 (CString ReadVal, CString ReadQuality, CString ReadTS)

� On completion of a read operation:

void DisplayData (long Value, CString Quality, CString TimeStamp)

� On completion of a write operation:

void DisplayData (HRESULT ErrorCode)

DisplayData0 (CString ReadVal, CString ReadQuality, CString ReadTS)

This version of DisplayData is called by the OnDataChange method of theCallback class and updates the display in the text boxes in the “On Data Changed”frame.

Note

In this case, the text boxes of Item0 are updated. To update the text boxes ofItem1, the analogous DisplayData1 method is implemented.

void COPCDA_AsyncDlg::DisplayData0(CString ReadVal, CString ReadQuality, CString ReadTS)

Parameter Description

ReadVal Value that was read

ReadQuality Information on the integrity of the data

ReadTS Time stamp (time at which the data were received from theOPC server)

The parameter values are assigned to the member variables of the dialog box.UpdateData transfers the new data from the member variables to thecorresponding controls:

{ m_Quality0 = ReadQuality; m_TimeStamp0 = ReadTS; m_Value0 = ReadVal; UpdateData(FALSE);}

Page 662: Industrial Communication With PG-PC

Sample Programs

662SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

DisplayData (long Value, CString Quality, CString TimeStamp)

The OnReadComplete() method of the Callback class calls this method to updatethe display in the text boxes to the right of the “Read Value” button:

void COPCDA_AsyncDlg::DisplayData(long Value, CString Quality, CString TimeStamp)

Parameter Description

Value The value that was read

Quality Information on the integrity of the data

TimeStamp The time at which the data were received from the OPCserver.

The parameters are assigned to the relevant member variables of the dialog box.UpdateData transfers the new data from the member variables to thecorresponding controls:

{ m_ReadValue = Value; m_QualityRead = Quality; m_TimeStampRead = TimeStamp; UpdateData(FALSE);}

DisplayData (HRESULT ErrorCode)

The OnWriteComplete() method of the Callback class calls this method to display astatus message about the result of a write operation in text box to the right of the“Write Value” button:

void COPCDA_AsyncDlg::DisplayData(HRESULT ErrorCode)

Parameter Description

ErrorCode The error code returned by the OPC server

The GetErrorString() method of the “IOPCServer” interface gets the error messagebelonging to the error code. This message is assigned to the member variablem_WriteResult. Before UpdateData displays this message in the text box, the linebreak characters must be removed with Remove():

{ LPWSTR ErrorStr; m_pIOPCServer–>GetErrorString(ErrorCode, LOCALE_ID, &ErrorStr); m_WriteResult = ErrorStr; m_WriteResult.Remove(’\r’); m_WriteResult.Remove(’\n’); UpdateData(FALSE);}

Page 663: Industrial Communication With PG-PC

Sample Programs

663SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

UpdateData

In certain situations, changing threads during access to a resource can lead toinconsistent data or undefined states. In such cases, a thread change must beprevented explicitly. The CCriticalSection class is available for this purpose. Aftercreating an object of this class, it is only possible to change threads again whenthe Unlock() method is called.

The sample program uses this mechanism to update the controls without errorsoccurring. An object of the CCriticalSection class is created after the programstarts. Immediately following the UpdateData method call of the parent class,Unlock releases the resources again for other threads:

BOOL COPCDA_AsyncDlg::UpdateData( BOOL bSaveAndValidate ){ BOOL bRes; m_cCritSec.Lock(); bRes = CDialog::UpdateData( bSaveAndValidate ); m_cCritSec.Unlock(); return bRes;}

9.5.10 Callback.cpp and Callback.h

In the sample program, the COPCDataCallback class is the implementation of theIOPCDataCallback interface. This class provides the following methods whichnotifications can be received from the OPC server:

� OnDataChange

� OnReadComplete()

� OnWriteComplete()

� InformAboutDialog

The file also includes the auxiliary functions

GetQualityText

Page 664: Industrial Communication With PG-PC

Sample Programs

664SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OnDataChange

The OPC server calls this method when data changes:

STDMETHODIMP COPCDataCallback::OnDataChange( DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMasterquality, HRESULT hrMastererror, DWORD dwCount, OPCHANDLE __RPC_FAR *phClientItems, VARIANT __RPC_FAR *pvValues, WORD __RPC_FAR *pwQualities, FILETIME __RPC_FAR *pftTimeStamps, HRESULT __RPC_FAR *pErrors)

Parameter Description

dwTransid The code number for the type of method call is zero if avalue change was the cause of the method call, if thecode number is not zero, the method call was triggeredby a refresh.

hGroup The client handle of the group to allow the client to iden-tify the group

hrMasterquality Information on the integrity of the data: S_OK, ifOPC_QUALITY_MASK for all items has the valueOPC_QUALITY_GOOD, otherwise S_FALSE.

hrMastererror S_OK, if the error message for all items is S_OK, other-wise S_FALSE.

dwCount Number of items for which values exist.

phClientItems Array with the client handles of the items whose valueshave changed.

pvValues Array of the type VARIANT containing the values of theitems that have changed.

pwQualities Array with information about the integrity of the valuesof the individual items

pftTimeStamps Array with time information for the individual items

pErrors Array with error messages for the items

The task of this method is to convert the values transferred by the OPC server asparameters into objects of the type CString. The DisplayData method expects inputparameters of this type.

Page 665: Industrial Communication With PG-PC

Sample Programs

665SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The program creates three arrays for CString objects to store the values of theitems, information on the quality of the values, and time information:

{ CString szReadVal; CString szReadQuality; CString szReadTS;

CComVariant is a wrapper class for the VARIANT data type. A CComVariant objectis created for each item in a loop. For this, the constructor is used that contains aVARIANT value as parameter:

CComVariant *pvarOut; DWORD i; for (i = 0; i<dwCount; i++) { pvarOut = new CComVariant(pvValues[i]);

In the next step, the ChangeType method converts the value that was read into astring. Since this is still an object of the CComVariant class, it is possible to accessthe string via the bstrVal component of pvarOut. The result of the Format methodis the required CString object:

pvarOut->ChangeType(VT_BSTR); szReadVal.Format(”%ls”, pvarOut->bstrVal);

Since we are interested only in the szReadVal variable, the pvarOut object isdeleted immediately after it has been used:

delete pvarOut;

GetQualityText returns quality information on the value that was read as a CStringobject. The parameter for this method is an identification number of the OPCserver:

szReadQuality = GetQualityText(pwQualities[i]);

The OPC server returns the time stamps of the items as a variable of the typeFILETIME. The result of the Format method of the COleDateTime class is the timeas a CString object:

szReadTS = COleDateTime(pftTimeStamps[i]).Format(); }

Page 666: Industrial Communication With PG-PC

Sample Programs

666SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Once all the results have been converted to CString objects, the program callseither DisplayData0 method or the DisplayData1 method of theCOPCDA_AsyncDlg class:

switch (phClientItems[i]) { case 0: m_pCDlgClass–>DisplayData0(szReadVal, szReadQuality, szReadTS); break; case 1: m_pCDlgClass–>DisplayData1(szReadVal, szReadQuality, szReadTS); break; default: ASSERT(0); }}return S_OK;};

OnReadComplete()

The OPC server calls this method when an asynchronous read is completed. Theparameters of OnReadComplete() match those of OnDataChange:

STDMETHODIMP COPCDataCallback::OnReadComplete( DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMasterquality, HRESULT hrMastererror, DWORD dwCount, OPCHANDLE __RPC_FAR *phClientItems, VARIANT __RPC_FAR *pvValues, WORD __RPC_FAR *pwQualities, FILETIME __RPC_FAR *pftTimeStamps, HRESULT __RPC_FAR *pErrors )

Parameter Description

dwTransid The code number for the type of method call is zero if avalue change was the cause of the method call, if thecode number is not zero, the method call was triggeredby a refresh.

hGroup The client handle of the group to allow the client to iden-tify the group

hrMasterquality Information on the integrity of the data: S_OK, ifOPC_QUALITY_MASK for all items has the valueOPC_QUALITY_GOOD, otherwise S_FALSE.

Page 667: Industrial Communication With PG-PC

Sample Programs

667SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

hrMastererror S_OK, if the error message for all items is S_OK, other-wise S_FALSE.

dwCount Number of items for which values exist.

phClientItems Array with the client handles of the items whose valueshave changed.

pvValues Array of the type VARIANT containing the values of theitems that have changed.

pwQualities Array with information about the integrity of the valuesof the individual items

pftTimeStamps Array with time information for the individual items

pErrors Array with error messages for the items

Before processing the data delivered by the OPC server, the program checks thepErrors variable. If the read was error-free, the data is evaluated as in theOnDataChange program. In this case, however, the value of the item is convertedto the “Long Integer” type:

if (pErrors[0] == S_OK){ CComVariant * pvarOut; pvarOut = new CComVariant(pvValues[0]); pvarOut–>ChangeType(VT_I4); CString readQuality = GetQualityText(pwQualities[0]); CString readTS = COleDateTime(pftTimeStamps[0] ).Format(); m_pCDlgClass–>DisplayData(pvarOut–>intVal,readQuality, readTS); delete pvarOut;}

If an error occurred, the GetQualityText method returns the message belonging tothe error code:

else{ CString readQuality = GetQualityText(pErrors[0]); m_pCDlgClass–>DisplayData(0,readQuality,””);}return S_OK;};

Page 668: Industrial Communication With PG-PC

Sample Programs

668SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OnWriteComplete()

The OPC server calls this method when an asynchronous write is completed.

STDMETHODIMP COPCDataCallback::OnWriteComplete( DWORD dwTransid, OPCHANDLE hGroup, HRESULT hrMastererr, DWORD dwCount, OPCHANDLE __RPC_FAR *pClienthandles, HRESULT __RPC_FAR *pErrors )

Parameter Description

dwTransid An identification number for the asynchronous write

hGroup The client handle of the group

hrMastererr S_OK, if the error message for all items is S_OK, otherwiseS_FALSE.

dwCount Number of items for which values were written.

pClienthandles Array with the client handles of the items for which valueswere written.

pErrors Array with error messages for the items

OnWriteComplete() calls the DisplayData method of the COPCDA_AsyncDlg classto display the error message of the OPC server:

{ m_pCDlgClass–>DisplayData(pErrors[0]); return S_OK; };

InformAboutDialog

InformAboutDialog returns a reference to the dialog box:

void InformAboutDialog (COPCDA_AsyncDlg *pCDlgClass){ m_pCDlgClass = pCDlgClass;}

GetQualityText

GetQualityText provides a CString object as an error message for a specified errorcode:

CString GetQualityText(UINT qnr){ CString qstr; switch(qnr) { case OPC_QUALITY_BAD: qstr = ”BAD”; break; case OPC_QUALITY_UNCERTAIN:

Page 669: Industrial Communication With PG-PC

Sample Programs

669SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

qstr = ”UNCERTAIN”; break; case OPC_QUALITY_GOOD: qstr = “GOOD”; break; case OPC_QUALITY_NOT_CONNECTED: qstr = “NOT_CONNECTED”; break; case OPC_QUALITY_DEVICE_FAILURE: qstr = “DEVICE_FAILURE”; break; case OPC_QUALITY_SENSOR_FAILURE: qstr = “SENSOR_FAILURE”; break; case OPC_QUALITY_LAST_KNOWN: qstr = “LAST_KNOWN”; break; case OPC_QUALITY_COMM_FAILURE: qstr = “COMM_FAILURE”; break; case OPC_QUALITY_OUT_OF_SERVICE: qstr = “OUT_OF_SERVICE”; break; case OPC_QUALITY_LAST_USABLE: qstr = “LAST_USABLE”; break; case OPC_QUALITY_SENSOR_CAL: qstr = “SENSOR_CAL”; break; case OPC_QUALITY_EGU_EXCEEDED: qstr = “EGU_EXCEEDED”; break; case OPC_QUALITY_SUB_NORMAL: qstr = “SUB_NORMAL”; break; case OPC_QUALITY_LOCAL_OVERRIDE: qstr = “LOCAL_OVERRIDE”; break; default: qstr = “UNKNOWN ERROR”; } return qstr;}

Page 670: Industrial Communication With PG-PC

Sample Programs

670SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.5.11 Notes on Writing your own Programs

Several requirements must be met before your own programs can use the Custominterface. Follow the steps outlined below:

Step Description

1 Start the Visual C++ development environment.

2 Create a project of the required type using the MFC Class Wizard.

3 Copy the files pre_opc.h and pre_opc.cpp from the sample programinto your project folder and add these files to the project (Projectmenu > Add To Project > Files ...). These files containOPC–specific definitions and include statements.

4 Add the statement #include “pre_opc.h” to all the implementationfiles of your project (extension .cpp):

5 In the implementation files (extension .cpp) that use theAddGroup() or GetErrorString() methods, add the followingstatement:#define LOCALE_ID 0x409

6 Arrange the required operator interface elements in the main dialogor create a suitable application window and program thecorresponding event procedures.

7 Implement a callback object if you want to use asynchronousoperations over ATL. The best course is to define your own classwith the required methods.

Page 671: Industrial Communication With PG-PC

Sample Programs

671SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.6 Sample Program for the OPC XML Interface

This sample in the C# language uses the XML interface for OPC data access. Itcontains methods to establish a connection to a Web service and to execute readand write jobs.

9.6.1 Working with the Sample Program

Start program

After starting the program, all the buttons except for “Start Sample” are disabled.Click on this button to establish a connection to the OPC XML Web service. If theWeb service is available, a dialog box displays information about the server.Otherwise, an error message is displayed.

Page 672: Industrial Communication With PG-PC

Sample Programs

672SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Read Values

Click the “Read Value” button to read the value of the “S7:[DEMO]MW1” item. Ifthe read job executed successfully, the program displays the value of the item,information on the quality, and a time stamp in the text boxes beside the “ReadValue” button:

Writing Values

Enter the value you want to be written in the text box beside the “Write Value”button and then click the “Write Value” button. If the write job executes correctly,the program displays information on the quality of the value in the “Quality/WriteResult” text box and the time stamp in the “Time Stamp” text box.

Page 673: Industrial Communication With PG-PC

Sample Programs

673SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Stop the program

Close the program by clicking the “Stop Sample” button. This disables the “ReadValue”, “Write Value”, and “Stop Sample” buttons. The “Start Sample” button andthe text box for the URL are enabled again.

9.6.2 Adding a Web Service to the Project

Settings in Visual Studio .NET

To allow the sample program to use the Web service of the OPC XML interface, a“Web Reference” was included in the project in Visual Studio .NET.

If you want to create programs yourself with an OPC XML interface, you will needto take the following steps:

� Open the menu Project > Add Web Reference.

� Enter the URL of the SIMATIC NET OPC XML Web service in the “Address”text box. This URL is as follows: http://<Computer address>/<Name of theOPC SIMATIC NET Web service>/SOPCWeb.asmx?wsdl

� Click on the “Add Reference” button. All the methods defined in the WSDL arethen available.

Page 674: Industrial Communication With PG-PC

Sample Programs

674SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.6.3 The MainForm Class

Program Code

All the methods of the sample program are defined in the “MainForm” class. At thebeginning, the elements of the dialog box are declared.

using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Net;namespace opcxml_da_sync{ using localhost; /// <summary> /// Summary description for Form1. /// </summary> public class MainForm : System.Windows.Forms.Form { private System.Windows.Forms.Button Button_Start_Sample; private System.Windows.Forms.Button Button_Stop_Sample; private System.Windows.Forms.Button Button_Read_Value; private System.Windows.Forms.Button Button_Write_Value; private System.Windows.Forms.TextBox Edit_URL; private System.Windows.Forms.Label Label_URL; private System.Windows.Forms.Label Label_Item0; private System.Windows.Forms.Label Lable_Item_Value; private System.Windows.Forms.Label Label_Siemens; private System.Windows.Forms.Label Label_Value; private System.Windows.Forms.Label Label_Quality; private System.Windows.Forms.Label Label_Timestamp; private System.Windows.Forms.TextBox Edit_Read_Value; private System.Windows.Forms.TextBox Edit_Write_Value; private System.Windows.Forms.TextBox Edit_Read_Quality; private System.Windows.Forms.TextBox Edit_Write_Quality; private System.Windows.Forms.TextBox Edit_Read_TimeStamp; private System.Windows.Forms. TextBox Edit_Write_TimeStamp; private System.Windows.Forms.GroupBox GroupBox_URL; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null;

Page 675: Industrial Communication With PG-PC

Sample Programs

675SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The Web service is an instance of the OPCXML_DataAccess class:

// proxy class for the web service private OPCXML_DataAccess m_OPCXML_DataAcess;

The name of the item is stored in the m_strItemName variable:

// ItemID used in this sample private string m_strItemName = “S7:[DEMO]MW1”;

9.6.4 The Constructor of MainForm and the Dispose Method

Program Code

The constructor of the dialog box class calls the method InitializeComponent() . Allthe elements of the dialog box are created here. The content ofInitializeComponent() is created by Visual Studio .NET automatically when thedialog box is created with the Form Designer.

public MainForm(){ // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after // InitializeComponent call

The item name appears in the dialog box because an instance of the classSystem.Windows.Forms.Label is initialized with the content of the m_strItamNamevariable:

Label_Item_Value.Text = m_strItemName; }

The Dispose() method releases all used resources at the end of the program:

/// <summary> /// Clean up any resources being used. /// </summary>

protected override void Dispose( bool disposing ){ if( disposing ) { if (components != null) { components.Dispose(); } }

Page 676: Industrial Communication With PG-PC

Sample Programs

676SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

base.Dispose( disposing );}

9.6.5 Creating the Dialog Box Elements

Program Code

The following section is created automatically by Visual Studio .NET when the usercreates the main dialog box of the application with the Form Designer. Thiscontains information on all elements of the dialog box, such as size, location, andlabeling of buttons. This section also specifies which events procedures areexecuted when a button is clicked.

#region Windows Form Designer generated code/// <summary>/// Required method for Designer support – do not modify/// the contents of this method with the code editor./// </summary>private void InitializeComponent(){ this.Button_Start_Sample = new System.Windows.Forms. Button(); this.Button_Stop_Sample = new System.Windows.Forms. Button(); this.Button_Read_Value = new System.Windows.Forms.Button(); this.Button_Write_Value = new System.Windows.Forms. Button(); this.Edit_URL = new System.Windows.Forms.TextBox(); this.Label_URL = new System.Windows.Forms.Label(); this.Label_Item0 = new System.Windows.Forms.Label(); this.Lable_Item_Value = new System.Windows.Forms.Label(); this.Label_Siemens = new System.Windows.Forms.Label(); this.Label_Value = new System.Windows.Forms.Label(); this.Label_Quality = new System.Windows.Forms.Label(); this.Label_Timestamp = new System.Windows.Forms.Label(); this.Edit_Read_Value = new System.Windows.Forms.TextBox(); this.Edit_Write_Value = new System.Windows.Forms.TextBox(); this.Edit_Read_Quality = new System.Windows.Forms. TextBox(); this.Edit_Write_Quality = new System.Windows.Forms. TextBox(); this.Edit_Read_TimeStamp = new System.Windows.Forms. TextBox(); this.GroupBox_URL = new System.Windows.Forms.GroupBox(); this.Edit_Write_TimeStamp = new System.Windows.Forms. TextBox(); this.SuspendLayout(); //

Page 677: Industrial Communication With PG-PC

Sample Programs

677SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

// Button_Start_Sample // this.Button_Start_Sample.Location = new System.Drawing. Point(24,88); this.Button_Start_Sample.Name = “Button_Start_Sample”; this.Button_Start_Sample.Size = new System.Drawing. Size(96, 24); this.Button_Start_Sample.TabIndex = 0; this.Button_Start_Sample.Text = “Start Sample”; this.Button_Start_Sample.Click += new System.EventHandler( this.Button_Start_Sample_Click); // // Button_Stop_Sample // this.Button_Stop_Sample.Enabled = false; this.Button_Stop_Sample.Location = new System.Drawing. Point(24, 256); this.Button_Stop_Sample.Name = “Button_Stop_Sample”; this.Button_Stop_Sample.Size = new System.Drawing. Size(96, 23); this.Button_Stop_Sample.TabIndex = 1; this.Button_Stop_Sample.Text = “Stop Sample”; this.Button_Stop_Sample.Click += new System.EventHandler( this.Button_Stop_Sample_Click); // // Button_Read_Value // this.Button_Read_Value.Enabled = false; this.Button_Read_Value.Location = new System.Drawing. Point(24, 144); this.Button_Read_Value.Name = “Button_Read_Value”; this.Button_Read_Value.Size = new System.Drawing. Size(96, 23); this.Button_Read_Value.TabIndex = 2; this.Button_Read_Value.Text = “Read Value”; this.Button_Read_Value.Click += new System.EventHandler( this.Button_Read_Value_Click); // // Button_Write_Value // this.Button_Write_Value.Enabled = false; this.Button_Write_Value.Location = new System.Drawing. Point(24, 200); this.Button_Write_Value.Name = “Button_Write_Value”; this.Button_Write_Value.Size = new System.Drawing. Size(96, 23); this.Button_Write_Value.TabIndex = 3; this.Button_Write_Value.Text = “Write Value”;

Page 678: Industrial Communication With PG-PC

Sample Programs

678SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

this.Button_Write_Value.Click += new System.EventHandler( this.Button_Write_Value_Click); // // Edit_URL // this.Edit_URL.Location = new System.Drawing.Point(144, 32); this.Edit_URL.Name = “Edit_URL”; this.Edit_URL.Size = new System.Drawing.Size(328, 20); this.Edit_URL.TabIndex = 4; this.Edit_URL.Text = “http://localhost/OPC.Simatic.NET/SOPCWeb.asmx”; // // Label_URL // this.Label_URL.Location = new System.Drawing.Point(40, 35); this.Label_URL.Name = “Label_URL”; this.Label_URL.Size = new System.Drawing.Size(96, 24); this.Label_URL.TabIndex = 5; this.Label_URL.Text = “Input the URL:”; // // Label_Item0 // this.Label_Item0.Location = new System.Drawing. Point(144, 94); this.Label_Item0.Name = “Label_Item0”; this.Label_Item0.Size = new System.Drawing.Size(48, 23); this.Label_Item0.TabIndex = 6; this.Label_Item0.Text = “Item0 = “; // // Lable_Item_Value // this.Lable_Item_Value.Location = new System.Drawing. Point(192, 94); this.Lable_Item_Value.Name = “Lable_Item_Value”; this.Lable_Item_Value.Size = new System.Drawing. Size(296, 23); this.Lable_Item_Value.TabIndex = 7; // // Label_Siemens // this.Label_Siemens.Location = new System.Drawing. Point(384, 262); this.Label_Siemens.Name = “Label_Siemens”; this.Label_Siemens.Size = new System.Drawing.Size(120, 16); this.Label_Siemens.TabIndex = 8; this.Label_Siemens.Text = “(c) Siemens AG 2002”; // // Label_Value

Page 679: Industrial Communication With PG-PC

Sample Programs

679SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

// this.Label_Value.Location = new System.Drawing. Point(144, 120); this.Label_Value.Name = “Label_Value”; this.Label_Value.Size = new System.Drawing.Size(40, 16); this.Label_Value.TabIndex = 9; this.Label_Value.Text = “Value”; // // Label_Quality // this.Label_Quality.Location = new System.Drawing. Point(256, 120); this.Label_Quality.Name = “Label_Quality”; this.Label_Quality.Size = new System.Drawing.Size(104, 23); this.Label_Quality.TabIndex = 10; this.Label_Quality.Text = “Quality/Write Result”; // // Label_Timestamp // this.Label_Timestamp.Location = new System.Drawing. Point(374, 120); this.Label_Timestamp.Name = “Label_Timestamp”; this.Label_Timestamp.TabIndex = 11; this.Label_Timestamp.Text = “Time Stamp”; // // Edit_Read_Value // this.Edit_Read_Value.Enabled = false; this.Edit_Read_Value.Location = new System.Drawing. Point(144, 144); this.Edit_Read_Value.Name = “Edit_Read_Value”; this.Edit_Read_Value.Size = new System.Drawing. Size(88, 20); this.Edit_Read_Value.TabIndex = 12; this.Edit_Read_Value.Text = “0”; // // Edit_Write_Value // this.Edit_Write_Value.Enabled = false; this.Edit_Write_Value.Location = new System.Drawing. Point(144, 200); this.Edit_Write_Value.Name = “Edit_Write_Value”; this.Edit_Write_Value.Size = new System.Drawing. Size(88, 20); this.Edit_Write_Value.TabIndex = 13; this.Edit_Write_Value.Text = “0”; // // Edit_Read_Quality

Page 680: Industrial Communication With PG-PC

Sample Programs

680SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

// this.Edit_Read_Quality.Enabled = false; this.Edit_Read_Quality.Location = new System.Drawing. Point(256, 144); this.Edit_Read_Quality.Name = “Edit_Read_Quality”; this.Edit_Read_Quality.Size = new System.Drawing. Size(96, 20); this.Edit_Read_Quality.TabIndex = 14; this.Edit_Read_Quality.Text = “”; // // Edit_Write_Quality // this.Edit_Write_Quality.Enabled = false; this.Edit_Write_Quality.Location = new System.Drawing. Point(256, 200); this.Edit_Write_Quality.Name = “Edit_Write_Quality”; this.Edit_Write_Quality.Size = new System.Drawing. Size(96, 20); this.Edit_Write_Quality.TabIndex = 15; this.Edit_Write_Quality.Text = “”; // // Edit_Read_TimeStamp // this.Edit_Read_TimeStamp.Enabled = false; this.Edit_Read_TimeStamp.Location = new System.Drawing. Point(376, 144); this.Edit_Read_TimeStamp.Name = “Edit_Read_TimeStamp”; this.Edit_Read_TimeStamp.Size = new System.Drawing. Size(112, 20); this.Edit_Read_TimeStamp.TabIndex = 16; this.Edit_Read_TimeStamp.Text = “”; // // GroupBox_URL // this.GroupBox_URL.Location = new System.Drawing. Point(24, 8); this.GroupBox_URL.Name = “GroupBox_URL”; this.GroupBox_URL.Size = new System.Drawing.Size(464, 56); this.GroupBox_URL.TabIndex = 17; this.GroupBox_URL.TabStop = false; this.GroupBox_URL.Text = “OPC XML-DA WebService”; // // Edit_Write_TimeStamp // this.Edit_Write_TimeStamp.Enabled = false; this.Edit_Write_TimeStamp.Location = new System.Drawing. Point(376, 200); this.Edit_Write_TimeStamp.Name = “Edit_Write_TimeStamp”;

Page 681: Industrial Communication With PG-PC

Sample Programs

681SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

this.Edit_Write_TimeStamp.Size = new System. Drawing.Size(112, 20); this.Edit_Write_TimeStamp.TabIndex = 18; this.Edit_Write_TimeStamp.Text = “”; // // MainForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(506, 293); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.Edit_Write_TimeStamp, this.Edit_Read_TimeStamp, this.Edit_Write_Quality, this.Edit_Read_Quality, this.Edit_Write_Value, this.Edit_Read_Value, this.Label_Timestamp, this.Label_Quality, this.Label_Value, this.Label_Siemens, this.Lable_Item_Value, this.Label_Item0, this.Label_URL, this.Edit_URL, this.Button_Write_Value, this.Button_Read_Value, this.Button_Stop_Sample, this.Button_Start_Sample, this.GroupBox_URL}); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = “MainForm”; this.Text = “OPC XML-DA Synchron Sample C#”; this.ResumeLayout(false);}#endregion

Page 682: Industrial Communication With PG-PC

Sample Programs

682SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.6.6 The Main Method

Program Code

The Main method is the starting point for the sample program. An instance of thedialog box classes generated and started by calling Application.Run.

/// <summary>/// The main entry point for the application./// </summary> [STAThread] static void Main() { Application.Run(new MainForm()); }

9.6.7 The Button_Start_Sample_Click Method

Program Code

This method is executed when you click the “Start Sample” button. The OPC XMLWeb service is represented by an instance of the OPCXML_DataAccess class.

/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– | Name: Button_Start_Sample_Click | Desc: Handler is being called, when button “Start Sample” | has been pressed | Notes: Create an instance of the proxy class of the | webservice –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/private void Button_Start_Sample_Click(object sender, System.EventArgs e){ try { if (m_OPCXML_DataAcess == null) { m_OPCXML_DataAcess = new OPCXML_DataAccess (); m_OPCXML_DataAcess.Timeout = 10000; //Timeout 10 sec. }

Page 683: Industrial Communication With PG-PC

Sample Programs

683SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The program checks the connection to the Web service by calling methods of theWebRequest class. If the Web service is not available, an exception is triggered.

// Checking the connection to the WebService // The WebRequest class throws a WebException when // errors occur while accessing an Internet resource WebRequest myRequest = WebRequest.Create(Edit_URL.Text); WebResponse myResponse = myRequest.GetResponse(); myResponse.Close();

Using the GetStatus method, the program queries the server status. This is thefirst time that a method of the XML interface is used.

// Assigning the url to the proxy class for the // web service m_OPCXML_DataAcess.Url = Edit_URL.Text;

//Checking the webservice status ServerStatus Status; ReplyBase replay = m_OPCXML_DataAcess.GetStatus (”en”, “1”, out Status);

If the server is running correctly, the program displays a dialog box with a variety ofinformation:

if (replay.ServerState == serverState.running) { string strText = “The operation completed successfully.\n\n”; if (Status.StatusInfo != null) { strText+= “\nStatusInfo\t: “ + Status.StatusInfo; } if (Status.VendorInfo != null) { strText+= “\nVendorInfo\t: ” + Status.VendorInfo; } strText+= “\nStartTime\t\t: ” + Status.StartTime.ToString(); if (Status.ProductVersion != null) { strText+= “\nProductVersion\t:” + Status.ProductVersion; }

Page 684: Industrial Communication With PG-PC

Sample Programs

684SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

MessageBox.Show (this, strText, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

The text box for entering the URL and the “Start Sample” button are disabled. Allremaining buttons are enabled.

Edit_URL.Enabled = false; Button_Start_Sample.Enabled = false; Edit_Write_Value.Enabled = true; Button_Read_Value.Enabled = true; Button_Write_Value.Enabled = true; Button_Stop_Sample.Enabled = true; }

If an error has occurred in the Web service, this is displayed in a dialog box:

else { string strText = “The operation is not completedsuccessfully.\n\n”; MessageBox.Show (this, strText, this.Text,MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }

If an error has occurred during execution of the program, this is handled within acatch block.

catch(Exception excep) { MessageBox.Show (this, excep.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }}

Page 685: Industrial Communication With PG-PC

Sample Programs

685SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

9.6.8 The Button_Stop_Sample_Click Method

Program Code

This method executes when you click the “Stop Sample” button. Only theappearance of the dialog box changes, the text box for the URL can be editedagain and the “Start Sample” button can be clicked. All other buttons are disabled.

/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– | Name: Button_Stop_Sample_Click | Desc: Handler is being called, when button “Stop Sample”has been pressed |–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/ private void Button_Stop_Sample_Click(object sender,System.EventArgs e) { Edit_URL.Enabled = true; Button_Start_Sample.Enabled = true; Edit_Write_Value.Enabled = false; Button_Read_Value.Enabled = false; Button_Write_Value.Enabled = false; Button_Stop_Sample.Enabled = false; }

Page 686: Industrial Communication With PG-PC

Sample Programs

686SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

9.6.9 The Button_Read_Value_Click Method

Program Code

This method executes when you click the “Read Value” button. The program firstgenerates all the objects necessary for the read job, an array of the typeReadRequestItemLists and an array of the type ReadRequestItem each with oneelement. In addition to this, an instance of the RequestOptions class and theOPCError class are required as return parameters.

/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––––| Name: Button_Read_Value_Click| Desc: Handler is being called, when button “Read Value”| has been pressed| Notes: initiates an sync read request –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/private void Button_Read_Value_Click(object sender, System.EventArgs e){ try { Edit_Read_Value.Text = “0”; Edit_Read_Quality.Text = “”; Edit_Read_TimeStamp.Text = “”; ReadRequestItemList[] ItemLists = new ReadRequestItemList[1]; ItemLists[0] = new ReadRequestItemList(); ItemLists[0].Items = new ReadRequestItem[1]; ItemLists[0].Items[0] = new ReadRequestItem(); ItemLists[0].Items[0].ItemPath = “”; ItemLists[0].Items[0].ItemName = m_strItemName; RequestOptions opt = new RequestOptions(); ReplyItemList[] ItemValues; OPCError[] Errors;

The Read method of the XML interface is called with previously definedparameters. If a value could be read, the dialog box displays this in the “Value” textbox. Otherwise, “0” is displayed.

m_OPCXML_DataAcess.Read (opt, ItemLists, out ItemValues,out Errors); if(ItemValues[0].Items[0].Value != null) { Edit_Read_Value.Text =ItemValues[0].Items[0].Value.ToString(); } else { Edit_Read_Value.Text = “0”; }

The values for the timestamp and the quality of the values are also displayed in theappropriate text boxes.

Page 687: Industrial Communication With PG-PC

Sample Programs

687SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Edit_Read_TimeStamp.Text = ItemValues[0].Items[0].Timestamp.ToString(); Edit_Read_Quality.Text = ItemValues[0].Items[0].Quality.ToString(); }

Program errors are handled in a catch block.

catch(Exception excep) { MessageBox.Show (this, excep.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }}

9.6.10 The Button_Write_Value_Click Method

Program Code

This method executes when you click the “Write Value” button. The program firstgenerates all the objects necessary for the write job, an array of the typeWriteRequestItemList and an array of the type ItemValue each with one element.The read value is returned in a parameter of the type ReplyItemList. In addition tothis, an instance of the RequestOptions class and the OPCError class are requiredas return parameters.

/*–––––––––––––––––––––––––––––––––––––––––––––––––––––––––– | Name: Button_Write_Value_Click | Desc: Handler is being called, when button ”Write Value” | has been pressed | Notes: initiates an sync read request ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/private void Button_Write_Value_Click(object sender, System.EventArgs e){ try { Edit_Write_Quality.Text = ””; WriteRequestItemList[] ItemLists = new WriteRequestItemList[1]; ItemLists[0] = new WriteRequestItemList(); ItemLists[0].Items = new ItemValue[1]; ItemLists[0].Items[0] = new ItemValue(); ItemLists[0].Items[0].ItemPath = ””; ItemLists[0].Items[0].ItemName = m_strItemName; ItemLists[0].Items[0].Value = Edit_Write_Value.Text; ItemLists[0].Items[0].QualitySpecified = false; RequestOptions opt = new RequestOptions(); ReplyItemList[] ItemValues; OPCError[] Errors;

Page 688: Industrial Communication With PG-PC

Sample Programs

688SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The Write method of the XML interface is called with previously definedparameters. If a value could be written, the dialog box displays this in the “Value”text box. Otherwise, “0” is displayed.

ReplyBase replay = m_OPCXML_DataAcess.Write(opt, ItemLists, true, out ItemValues, out s); if(ItemValues[0].Items[0].Value != null) { Edit_Write_Value.Text = ItemValues[0].Items[0].Value. ToString(); } else { Edit_Write_Value.Text = “0”; }

The returned values for the timestamp and the quality of the values are alsodisplayed in the appropriate text boxes.

Edit_Write_TimeStamp.Text = ItemValues[0].Items[0].Timestamp.ToString(); Edit_Write_Quality.Text = ItemValues[0].Items[0].Quality.ToString(); }

Program errors are handled in a catch block.

catch(Exception excep) { MessageBox.Show (this, excep.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }}

Page 689: Industrial Communication With PG-PC

689SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

FAQs

Here, you will find the most common questions asked about the following topics.

� General FAQs

� OPC Server

� CP 1613

� Softnet Industrial Ethernet

� SEND/RECEIVE for Industrial Ethernet

� CP 5613/5614

� Changing from the CP 5412 to the CP 5613/14

� Softnet PROFIBUS (general)

� CP 5511

� CP 5512

� CP 5611

� Softnet S7

� Softnet DP

� Softnet FDL

10.1 FAQs in General

Administrator Privileges – Which privileges are necessary under Windows NT, 2000?

To install products and software, you require administrator privileges (you must bea member of the local “Administrators” group); for operation, you require thestandard permissions of a main user.

Without Administrator Privileges – What can I do without administrator privileges?

Without administrator privileges, you can run the applications for the variousprotocols (DP, FMS, S7, FDL, TF or SEND/RECEIVE). You do, however, require atleast the standard permissions of a main user.

10

Page 690: Industrial Communication With PG-PC

FAQs

690SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

With Administrator Privileges – What can I do with administrator privileges?

You require administrator privileges to install the software and to start and stopdrivers. This means that you can only execute the operations of the “Set PG/PCInterface” and “Configuration Console” that require restarting the moduleparameter assignment when you have administrator privileges. As a user without administrator privileges, a message is displayed to tell you thatyou do not have permission to restart the CP. You must reboot the computer or log on with administrator privileges. If youanswer the “Restart computer?” prompt with “Yes”, Windows NT or Windows 2000is restarted. If you answer with “No”, you have the option of logging off and loggingon again with administrator privileges without restarting Windows NT or Windows2000.

How can I remove the license from my computer?

The license can be installed and removed without the installation program on theCD. For this purpose, there is a program called ‘authorsw.exe’. Start this programfrom the Start menu and specify the drive on which the license is located. Selectthe relevant license, insert the original license diskette and press the F7 key toreturn the license to the license diskette. It can take several minutes for the license to be written back to the diskette. DO NOT INTERRUPT THE TRANSFER OF THE LICENSE – !!! OTHERWISEYOU MAY LOSE THE LICENSE ALTOGETHER !!!!

Somehow I managed to lose the license. What do I do now?

As long as you can prove that you obtained the product legally, you will receive areplacement for the license. Your Siemens contact will help you.

I installed SIMATIC NET on a compressed drive. An error message was displayed when Itried to install the license. Can’t I install the software on a compressed drive?

You can install product files on a compressed drive, but not the license. When youinstall the license, specify, for example, the host drive of the compressed drive.

Is the license removed when I uninstall the software?

When you uninstall the software with the uninstaller, you will be asked whether ornot you want to remove the license as well and return it to the license diskette. Asan alternative, you can also return the license to the key diskette beforeuninstalling a product. In this case, you use the “authorsw.exe” program that isinstalled on your hard disk.

Page 691: Industrial Communication With PG-PC

FAQs

691SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

How real-time capable is Windows NT/Windows 2000?

Windows NT and Windows 2000 are not real-time operating systems. This meansthat when programs are starting up, when files are being read, or when accessingthe LAN, your application may not be executed for several 100 ms. You canimprove the reaction times of Windows for real-time applications in the followingways:

� Make sure that the computer you are using has enough memory so thatWindows NT/ Windows 2000 seldom needs to access the page file.

� Avoid intensive access to diskettes, hard disks, or CDs as is the case whenstarting up large programs.

Where can I get service packs for Windows NT/Windows 2000?

From the Microsoft Web site: http://www.microsoft.com

Which version of Windows NT/2000 do I need to operate SIMATIC NET?

The readme file in the main folder of the CD lists the Windows NT/2000 servicepacks with which this version of the CD was tested and released.

NTFS File System – What do I need to remember when using the NTFS file system?

If you use the NTFS file system of Windows NT, 2000 you can assign individual,user-specific rights for each individual file. To run some functions, files must be accessed and the required result is onlyachieved when the user of the function has adequate rights to access the file andfolder. If, for example, you do not have write permission for the folder in which you wantto save a database, you will not be able to save a database in that folder. A tracefunctions only when you have write permission for the trace file. The same appliesto other log files that can be created by diagnostic tools.

Rights for the Registry – Which rights are necessary for the registry of Windows NT, 2000?

The user requires permission to read entries under“HKEY_LOCAL_MACHINE\SOFTWARE\Siemens”. Modifications by the configuration tools are only permitted when the user also haswrite permission for the “SINEC” subkey and its subkeys. Without the requiredrights, a warning is displayed. In the default setting, all users have read and write permissions for the keys under“HKEY_LOCAL_MACHINE\SOFTWARE\Siemens”.

Page 692: Industrial Communication With PG-PC

FAQs

692SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Can I use a screensaver?

Remember that if you use a screensaver, it also requires CPU time and can lead tosystem overload. Some screen savers do not release memory resources again.This means that usable main memory is continually reduced.

Can I use virus scanners?

Using a virus scanner during operation can cause problems with hardwareexpansions (for example, SIMATIC NET communication modules). It is advisable to run virus tests only when no applications are active. Following avirus test, the computer should be rebooted.

Where can I get information about other SIMATIC NET products?

You will find information about other SIMATIC NET products and current softwareversions in the following sources:

� On the CD shipped with the product

� In the “IK PI” SIMATIC NET product catalog

� On the Internet (http://www.ad.siemens.de/net)

How can I find out the product version of SIMATIC NET products?

Open “Add/Remove Programs” in the Control Panel: Start > Settings > ControlPanel > Add/Remove Programs.

When you install SIMATIC NET under Windows NT/Windows 2000, various services are setup and are always started automatically. Are these services necessary?

These services are absolutely necessary for running SIMATIC NET. Under nocircumstances remove or deactivate these services. SIMATIC NET cannot runcorrectly without these services.

How can I check whether my hardware was installed correctly?

Use the diagnostic options provided by the “Configuration Console” program or usethe supplied sample programs to test your hardware. You will find a detaileddescription of the samples in this documentation.

Page 693: Industrial Communication With PG-PC

FAQs

693SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

10.2 FAQs on the SIMATIC NET OPC Server

Is parallel operation of more than one protocol possible with the OPC Server of SIMATICNET?

Yes! To do this, you must configure the required protocols.

I have developed a program in C++ using the Custom Interface. How can I check whetherall OLE interfaces are released again after my program closes?

If your program releases all interfaces correctly, the OPC Server automaticallyremoves itself from memory after you close your program. Start the Task Managerof Windows NT/2000 (for example with CTRL-ALT-Del, ’Task Manager’ button) andclick on the “Processes” tab. If the OPC Server is still running, you will see aprocess with the name “SOPCSRVR.EXE” in the list.

How can I close down the OPC Server if it remains in memory due to an error after closingall the clients?

Open the page “Close OPC Server” in the “Configuration Console” and click the“Close OPC Server” button. You should NOT close the OPC Server using the TaskManager!

What do I need to remember if I abort an application with OPC or the DataOCX in thedevelopment environment with the debugger?

If an application is aborted, the chances are that it will not be able to tidy upinternal references to the OPC Server. As a result, the OPC Server continues torun and communication is not shut down. To close down the OPC server, open thepage “Close OPC Server” in the “Configuration Console” and click the “Close OPCServer” button.

Which header files do I need to include to be able to use the Custom Interface of the OPCServer?

Include all the header files from the “Simatic Net\opc2\inc” folder. You will also findthe C file “opc_i.c” in this folder. This file defines classes containing the interfacemethods. If you include this file in your project, you can access the interfacemethods directly.

You should also have a look at the sample programs!

How should I design my program for the OPC Custom interface so that communication overOPC is as efficient as possible?

Use the OPC concept of monitoring the items in groups. Use the CACHE for readcommands and activate the groups only when you really want to read values. Yourapplication is then only involved in communication tasks when values actuallychange.

Page 694: Industrial Communication With PG-PC

FAQs

694SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

What errors does the SIMATIC NET OPC Server return when AddItem is called if I have a badpath section in the ItemID? (for example DP:[CP_WRONG])

Although the path causes the error, the ItemID parameter is wrong. As a result, theOPC_E_UNKNOWNITEMID error is returned.

Which return values need to be checked with group operations over the OPC AutomationInterface in Visual Basic?

in the function result, Visual Basic does not distinguish between a fully successfulfunction (i.e. for all elements of a group operation) or only partly successful result.You should therefore check the arrays with the return values of the individualelements when using group operations in Visual Basic. (Example: Errors withSyncRead)

What information is used by the OPC Server if a different path section is specified in theAccessPath parameter compared with the path in the ItemID parameter?

The OPC Server puts together the full name of the variable from the AccessPathand ItemID. If an ItemID is used in the AccessPath, this must NOT be included inthe ItemID as well. Otherwise, the item cannot be inserted in a group.

What does a time stamp with the value “1.1.1601 12:00” mean?

This date is the initialization value 0 of a time specified in Windows. The OPCServer returns this time stamp if no variable has been read up to now. Variablesthat can only be written have this time stamp.

Does an older time stamp mean that the value may be out of date?

No. An older time stamp says that the value has not changed since the timeindicated by the time stamp. The validity of the value is monitored constantly bythe server. A new time stamp is entered only when the value changes. TheSIMATIC NET OPC Server enters the time at which the OPC Server receives theprocess variable as the time stamp. You obtain an older time stamp, of course,only when you read from the cache. If you read from the device, the time at whichthe value is received is used as the time stamp, regardless of whether or not thevalue has changed.

How can I tell whether or not a variable is valid?

Evaluate the quality flag.

Page 695: Industrial Communication With PG-PC

FAQs

695SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

When is the “OnDataChange” callback called by the OPC Server? (Version 1.0 of the OPCSpecification)

The OnDataChange callback can be called before the function that triggers thecallback is completed. This does not include callbacks without transaction ID. If an OPC client requires synchronization of the callback, this could beimplemented as follows:

� Copy the data to their own global process buffer in OnDataChange.

� PostMessage to the local address with the buffer as parameter.

� Use the connection points of the OPC Custom Interface 2.0

The OPC Server returns some error codes that are not described in the supplied OPCspecifications. What do the error codes mean?

Internal communications problems are coded by the SIMATIC NET OPC Serverusing specific error keys (HRESULT). These are as follows:

� C0048003 (hex): Timeout, for example due to aborted connection

� C0048004 (hex): An external server has not started

� C0048006 (hex): Unexpected communication error

As with other errors, applications can call the IOPCServer::GetErrorString methodto get a textual description of the problem.

How does the OPC Server check the syntax of transferred numeric values?

The OPC Server tolerates certain errors in transferred numeric values. An integer“123.45” is accepted without error as “123”. The real value “1,22” is accepted as“1” if the period is set as the separator in the Windows System.

I have set 200 ms as the value for the scan cycle. The update rate of the group should be500 ms. in reality, however, some update times are 700 ms.

In some situations, the update times of the protocol and the group are addedtogether. This conforms with the OPC Specification that stipulates that a groupmust not be reported faster the specified update rate. If necessary, reduce theupdate time of the group.

How should symbolic variable names be defined with the OPC Server of SIMATIC NET?

There are two basic ways of defining symbolic names:

1. Entry in the protocol-specific configuration file by using OPC Scout

Page 696: Industrial Communication With PG-PC

FAQs

696SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

2. Taking symbols from STEP 7 and creating new symbols with the Symbol FileConfigurator

These two different procedures have the following features:

Alias Defini-tions

Simple and fast entry of symbolic names

Only the part of the ItemID containing the variable namecan be replaced by an alias. The protocol ID and the con-nection name cannot be replaced

The startup phase of the OPC Server is longer when alarge number of alias names is defined.

Symbol FileConfigurator

The Symbol File Configurator simplifies the entry of largenumbers of symbols by entering them in table form.

The symbols can be hierarchically structured.

Symbols are not dependent on the structure of the ItemIDsor the protocol.

The startup phase of the OPC Server does not depend onthe number of variables.

To retain expandability and independence from protocol properties, the use of theSymbol File Configurator is advised.

If the FDL protocol is activated alongside the DP protocol in the configuration of the OPCServer, a slight loss of performance can result.

If two protocols are activated at the same time, a multiplexer is startedautomatically. This can also cause a slight loss in performance. You should onlyactivate the protocol you require.

In the SEND/RECEIVE and FDL protocols, there are read-only variables (for exampleReceive). When I enter these variables in the Symbol File Configurator, it ispossible to declare these variables as write-only. Why isn’t it possible to insertthese variables in a group?

When specifying the access rights with the Symbol File Configurator, the rights canbe restricted but not expanded. As a result, it is not possible to declare an item thatis read-only by virtue of its properties (such as the Receive buffer) as writableusing the Symbol File Configurator. By specifying access rights in the Symbol FileConfigurator, it would, on the other hand, be possible to further restrict the readrights of a previously read-only item. Such an item that can neither be read norwritten cannot be entered in a group with AddItem.

Page 697: Industrial Communication With PG-PC

FAQs

697SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

An OPC client uses the OPC Server continuously, other OPC clients start and close againcontinuously. A slight loss of memory can be observed in the OPC Server.

The memory losses resulting from the configuration described above cannot beinfluenced by the OPC client or OPC Server and have been observed on verydiffering servers. The reason for this is the internal memory handling of MicrosoftCOM. In this case, it is advisable to close down the OPC Server when necessaryand then to restart it.

How is the MinimumUpdateRate of the OPC Server obtained?

Since the SIMATIC NET OPC Server can use variables of different protocols at thesame time, the MinimumUpdateRate of the OPC Server is the highest value set forthe scan cycle time for the active protocols.

Example

A scan cycle time of 100 ms is configured for DP. No other protocol is being used.100 ms is used by the OPC server as the MinimumUpdateRate. The S7 protocol isnow activated and the scan cycle time configured for this protocol is 500 ms.Result: The OPC Server now uses the value 500 ms as the MinimumUpdateRatefor all protocols.

Why is it sometimes not possible to establish an asymmetrical FMS connection?

The main feature of asymmetrical FMS connections is that only one partner canestablish the connection actively. Typical connection attributes are I–D, I–O, orD–O. If the OPC Server is the active partner and with the normal configuration, thetime interval within which the server attempts to establish the connection isrestricted. If the partner does not respond within this interval, connectionestablishment is aborted. In this case, the following configuration for theconnection can be helpful:

Option “The connection is maintained permanently”

With this setting, the active end attempts to establish the connection without timerestrictions. If the active end only had a predefined interval available to establishthe connection (as in the default setting), the connection would only be establishedwhen the passive end responded within this time. This is generally only guaranteedwhen the passive end has already been started. The default setting that does notinclude this entry does not solve the problem of asymmetrical connections butdoes limit the extra load on the network resulting from connection establishmentattempts to a specific time. This is generally the better option for the much morecommon situation involving symmetrical connections.

Establishing the FMS connection to partners with a large object dictionary takes such along time that the startup of the system is delayed considerably. Is there a wayto avoid this?

Depending on the partner device, loading an object dictionary can take aconsiderable amount of time. If high indexes were configured within an objectdictionary, the connection establishment can be considerably delayed. The extraload on the network is by no means insignificant. The situation is made worse

Page 698: Industrial Communication With PG-PC

FAQs

698SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

since the communication software cannot query the object dictionaries of differentdevices at the same time.

If the system consists of several FMS servers, that are accessed by the PC as anFMS client, the startup phase of the system can take a considerable time andreliable connection establishment may not be possible. For this reason, the OPCserver provides the option of using an object dictionary loaded at a different timeand maintained in local storage.

To create a local object dictionary, you require the ODUPLOAD.EXE program. Thisis installed in the following folder:

<Installationpath>\SIEMENS\SIMATIC.NET\opc2\binFMS\ODUPLOAD.EXE

To start the program, open a DOS box and change to the relevant folder with “cd<installationpath>\SIEMENS\SIMATIC.NET\opc2\binFMS”.

Start the program with the following syntax:

odupload “conn|vfd|cp” filename [odformat [timeout]]

The “conn” parameter identifies the connection, “vfd” and “cp” specify the VFD andthe active interface profile of the communications processor via which the objectdictionary will be loaded. You can find out the interface parameter assignment byopening the “General” properties page of the module in the Configuration Console.The “filename” parameter specifies the path and file name of the local objectdictionary to be created. The optional parameter “odformat” decides whether a long(value 1) or a short (0) object dictionary is requested. The standard value for thisparameter is 0. With the “timeout” parameter, the time is specified in millisecondsafter which an error is detected. The standard value is 120000 for 2 minutes.

Example: odupload “FMS connection1|VFD 2|CP 5613 (PROFIBUS)”“c:\MyOD\OD_Conn1.od” 1 240000

Use To use the local object dictionary for a connection, two configuration steps arenecessary:

1. Configuration Configure an FMS connection between the PC station and partner device. Openthe “Partner Variables” tab in the “Properties – FMS Connection: Options” dialog.Activate the “Use locally stored object dictionary” option button. Transfer theconfiguration to the PC station as normal.

2. Local settings on the PC station The path of the generated local object dictionary on the PC station must bespecified. To do this, you must edit the configuration file for FMS. The configurationfile for FMS is located in<installationpath>\siemens\simatic.net\opc2\binFMS\ScoreFMS.txt.

Look for the configuration file in the section [LOCAL_FMS_OD]. If you do not find itthere, make the following entry for every connection with a local object dictionary inthis section: <VFDname>|<connectionname>=<pathODfile>

Page 699: Industrial Communication With PG-PC

FAQs

699SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Example: [LOCAL_FMS_OD] VFD 2|FMS connection1=c:\MyOD\LocalOD_Conn1.od

Which slaves can be addressed with the OPC Server for SIMATIC NET?

All the standard slaves supported by the configuration tools SIMATIC STEP 7 orSIMATIC NCM PC can be addressed by the OPC Server. Non-standard slaves canbe addressed, however, no structured access to the inputs and outputs of theseslaves is possible.

How does the OPC Server optimize access with S7 functions? Is the optimization of the S7variable access active following installation? If it is not, how can I activate it?

The OPC Server collects the communications jobs (read/write jobs, variablemonitoring jobs) from all active clients in a central queue. The individual jobs arethen grouped together:

1. If individual jobs on a connection represent a contiguous memory area (forexample all bytes from 1 to 100 of a data block), these jobs are put together toform one job accessing an array. This optimization is active as default but canbe deactivated since it puts load on the CPU of the PC. To deactivate theoptimization, the connection-specific option “Optimize read access” or“Optimize write access” must be deactivated in the configuration.

2. Jobs to access the non-contiguous areas or different data types are groupedtogether for the specific connection. The number of jobs that can be puttogether depends on the PDU size and the length of the requested data. Thisoptimization is always active.

3. Credits are used; in other words, the number of jobs processed at the sametime on one connection depends on the number of available credits.

4. Jobs on different connections are handled at the same time.

When I browse the S7 items, I only see the connection names. The blocks and variables arenot displayed. Why is this?

To allow browsing, the OPC Server must already have established communicationconnections to the S7 partners. If this is not possible (for example because the S7PLC is not ready for communication), the browser displays only the connectionnames. Make sure that the S7 partner is ready for communication.

Is it possible for two PCs to communicate using the S7 protocol?

The buffer send/receive services of the S7 protocol also allow a PC-PC link usingthe S7 protocol. A connection for the server functionality must be configured onone PC. The following settings must be made for this connection in theconfiguration:

Page 700: Industrial Communication With PG-PC

FAQs

700SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Deactivate “Active connection establishment”

On the server PC, the S7 OPC Server must be started by a client (for exampleOPC Scout) and suitable BSEND/BRECEIVE variables must be set up for theconnection.

For the client PC, a suitable connection must be configured as follows:

Activate “Active connection establishment”

Select “Always establish connection”

What consistency is guaranteed in communication with an S7 partner?

The S7 devices guarantee that data records up to a certain size are consistentwithin the controller (depending on the type of controller). With larger data packets,it is possible that the program of the controller will be interrupted and that anotherprogram section will change the data.

When accessing arrays over the OPC Server that are longer than the length of aPDU, the data transfer must be distributed over several jobs. As a result ofhandling the job over several cycles, not only changes to the data by the programof the controller are possible but also changes resulting from a write job over thenetwork. When you design your system, you should take such possibleinconsistencies into account.

For more detailed information on consistency, refer to the S7 communicationsmanual supplied with STEP 7.

Why does the S5 partner station terminate the connection to the OPC Server when the OPCScout is used to monitor a write connection?

Just like other OPC clients, OPC Scout continuously sends read jobs to the partnerdevice. An S5 controller reacts to a read job on a write connection by terminatingthe connection. This is also the reaction to a write job on a fetch connection.Configure the mode of the SEND/RECEIVE connection accordingly.

If write jobs are sent to a communications partner in quick succession (for example withGenerate Values in OPC Scout), some of these jobs are rejected. What is thecause and how can I get round the problem?

Write jobs to a partner device can only be accepted when a receive resource(Await indication) is prepared on the partner device. This receive resource is filledwith data when it is received and then passed to the processing application. Thisapplication is then responsible for preparing a new receive resource. In thesituation described here, the receiving station cannot prepare receive resourcesquickly enough. With the connection-specific “Maximum retries” parameter, thenumber of repetitions in case of “No resource” can be set for the FDL OPC Server.

Page 701: Industrial Communication With PG-PC

FAQs

701SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

How do you use the “csv” file created by OPC Scout as a result of the print command?

These files contain the stored table in a form separated by commas (hence theacronym CSV = “comma separated values”). This can be imported into Excel.

The OPC Scout displays a different time from the actual local time as the time stamp. Why?

To allow time information to be compared in automation systems distributedworldwide, the OPC standard stipulates the display of the time stamp in UTCformat (Universal Coordinated Time). UTC is a standard world time previouslyknown as Greenwich Mean Time. The OPC Scout displays this time.

OPC Scout monitors values. If the communication connection breaks down, OPC Scoutsometimes displays a random value, for example, “1\\0\\0\\0”. Why does it dothis?

In the OPC Automation interface for Data Access, there is no parameter fortransferring errors in the definition of the OnDataChange function, while this existsin the OPC Custom interface for Data Access. As a result, the OPC Scout as anOPC Automation client cannot recognize when an error has occurred during dataacquisition. The OPC Scout displays the transfer values even if the values areundefined according to the specification of the Custom interface.

How do I specify decimal numbers in the OPC Scout when writing values?

The OPC Scout transfers the values entered in the “Write values of items” dialogunchanged to the OPC Server. Here, string is used as the data type. The OPCServer makes the type conversion using operating system functions.

When you make entries in the OPC Scout, you therefore use the separatorspecified in the Windows Control Panel as the decimal symbol (Regional Settings).If you use the wrong decimal symbol, this might be ignored during the typeconversion. In an English Windows installation, the decimal symbol is the period,whereas in a German installation it is the comma.

When entering values with the OPC Scout, it is the responsibility of the user tomake sure that the values are correctly represented for the data type of the item.As an example, no rounding strategy is defined when entering numbers withdecimal places for variables of an integer type such as bytes. The individualelements within arrays are also not handled in exactly the same way as singularvariables of the element type by the conversion routines of the operating system.

Page 702: Industrial Communication With PG-PC

FAQs

702SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

After the DCOM configuration of the OPC Server using the Microsoft tool “dcomcnfg.exe”,the properties pages of the network adapters are missing in the Control Panelof Windows 2000. (“Network and Dial-Up Connections”).

This problem occurs with other COM servers and is not peculiar to SIMATIC NETsoftware. This must be counted as a characteristic of Windows 2000.

How can I prevent overflow of the Event Viewer?

If there are no PROFInet partners, the Windows Event Viewer displays a warning.This warning is displayed each time an attempt is made to access this DCOMconnection. In Windows 2000, this occurs at intervals of approximately 10 secondswhereas the intervals are significantly longer in Windows NT 4.0. As a result, theEvent Viewer can overflow and it is possible that other system events areoverwritten.

Remedy:You can configure the Event Viewer in Windows:

� Set filters for DCOM

� Change the setting for “overwriting events older than” (default 7 days)

� Select “do not overwrite events”, no event is lost

� Increase the maximum log size (default 512 Kbytes).

Errors occur during communication or the wrong process variables are accessed. Whydoes this happen?

If you use the S7 and PROFInet protocols with S7 extended variables at the sametime, the names of the S7 connections configured in SIMATIC STEP 7 must not beidentical to the device names specified in iMAP (displayed in the plant view).

Otherwise, the connections configured in SIMATIC STEP 7 are used for thePROFInet S7 extended variables. This results in communication errors or accessto the wrong process variables.

Note

If you use the S7 protocol and PROFInet at the same time, you can open the sym-bol file created for PROFInet with the Symbol File Configurator and check the con-nection names.

Page 703: Industrial Communication With PG-PC

FAQs

703SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Is it possible to read out the values of the configured variables?

When monitoring OPC PROFInet variables (active OPC PROFInet items in anactive OPC group), the PROFInet OPC Server establishes a connection to thesevariables on the PROFInet partner device. On this interconnection, only datachanges are reported to the OPC Server, constant reading out of the value isunnecessary. This strategy reduces bus load and greatly improves performance.

The disadvantage is the restricted number of possible connections to PROFInetcomponents since an interconnection is required for each OPC item beingmonitored. You should take this into account when configuring your system. Makesure that you also read the instructions on the SIMATIC iMap PROFInetengineering tool.

Re-establishing a connection takes several minutes; what factors influence the time takento re-establish a connection?

The connection monitoring of the PROFInet OPC Server allows it to detect thebreakdown of a connection.

The time taken to re-establish the connection and the associated change in thequality of the items from “BAD” to “GOOD” can take up to several minutes. Theactual time required depends, on other things, on the restart response of thepartner.

Page 704: Industrial Communication With PG-PC

FAQs

704SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

How are the cycle time and update quality of the partner device related?

QualityOfStateValueThe “QualityOfStateValue” value describes the required update quality of the data.Process values on the partner device are updated at this scan rate and if there is achange compared with the previous value, this is reported to the PROFInet OPCServer.

The time at which the change message arrives at the OPC server decides thetimestamp of the variable; the default value for QualityOfStateValue on aPROFInet OPC server is 100 ms.

Cycle TimeThe CycleTime parameter is set in ms, and specifies how often the PROFInet OPCServer reads or writes OPC items on the partner. If items are active in active groups, the PROFInet OPC Server checks whetherthere are any data changes. This is the internal scan time of the PROFInet OPC server; the default value forCycle Time on a PROFInet OPC server is 100 ms.

The times set for the cycle time and the update quality can be different. We,however, recommend that you use the same time settings for the cycle time andthe update quality. The message about data changes of active items in activegroups of an OPC client is, however, sent according to the selected OPC updaterate (default value in the OPC Scout: 500 ms).

The following selectable times determine (in the order shown) the data changesthat can be monitored:

Parameter Default

QualityOfStateValue 100 ms

Cycle Time 100 ms

UpdateRate; OPC Scout 500 ms

This allows data changes to be recorded, for example with the OPC Scout, at leastevery 500 ms.

On completion of the OPC client installation, the error message “rundll32 cannot beinitialized” appears. Why?

If the OPC client installation is started while the hardware detection is running, theerror message “rundll32 cannot be initialized” appears on completion of theinstallation.

Wait for the hardware detection to complete before installing the OPC client or stopthe hardware detection and then install the OPC client.

Page 705: Industrial Communication With PG-PC

FAQs

705SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Why are incorrect error messages displayed when there is more than one active protocol?

A write call via the IOPCSyncIO OPC Interface with an invalid server handlereturns the incorrect error code S_OK instead of S_FALSE.

Asynchronous writing to a symbolic OPC item that was assigned write permissionsby the Symbol File Configurator but actually only has read permissions does notdeliver a correct write return value (Write Result). The return value is “Unknownerror” instead of “inadequate access rights”.

Adding nonexistent OPC items with the OPC Scout or with the “AddItem” OPCfunction results in the error message “An internally used service has completed”instead of “Invalid item”.

Workaround: Use only one active protocol and no symbols.

Why is the DP communication system blocked?

If an OPC client terminates unexpectedly, without previously releasing the OPCserver in the DP-Inproc variant, the DP communication system remains blockedeven after the end of the program. You must reboot your computer to cancel thisinterlock. If an OPC client is not yet stable, for example during the developmentphase, you should use the Outproc variant of the OPC Server.

How do I start the OPC Server in Windows NT Server?

To start the OPC Server in Windows NT Server, the administrator or a user mustbe logged in on the server.

The workstation should be protected from unauthorized access using ascreensaver. “Interactive user” must also be set for the access permissions in the“DCOMCNFG” program.

Why does the OPC Server not keep to the set delay time after the “Close OPC Server” callis sent?

Using the SIMATIC NET Configuration Console, you can set a delay after whichthe OPC Server closes down. The OPC server does not keep to this delay time.The server shuts down immediately.

Wide-ranging tests have shown that after a request from an OPC client to closedown the server no further calls should be made since this can lead to extremelyserious disturbances. For this reason, the OPC Server shuts down immediatelydespite any delay time you may have set.

Page 706: Industrial Communication With PG-PC

FAQs

706SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Can the “Configuration Console” program be started more than once?

There are several ways of starting the “Configuration Console” a second time(direct insertion in the Microsoft Management Console, starting the msc. file in theExplorer etc.).

If the program is started more than once, consistency problems must be expectedso that it is not advisable to make use of these possibilities.

Why does the OPC Server not always obtain the actual value of a SEND/RECEIVE variablecorrectly?

The SEND variable has the access right “RW“. This variable can be written and read although the SEND/RECEIVE partner doesnot provide for the item being read back.

When this item is read back, the OPC Server returns the last successfully writtenvalue.If no value has yet been written successfully for this item, the quality “bad” isreturned. The actual value of the variable cannot therefore be obtained by the OPC Server.

What do I need to remember when using XDB files with older software versions?

If you use the version of the SIMATIC NCM PC program from the CD 07/2001 tocreate XDB files for software of an older SIMATIC NET CD, there are two pointsyou should note:

� The “S7RTM is installed” option must be deactivated in the properties page ofthe PC station in the Configuration tab.

� A MAC address must be configured for all Ethernet modules (the “Set MACaddress / use ISO protocol” option must be activated).

Can symbols and Percent Deadband be used with the DP-Inproc variant?

The DP-Inproc variant does not support the use of a symbol file for reasons ofperformance. The use of symbols and the “Percent Deadband” OPC property istherefore not possible when using the DP-Inproc variant.

Is it possible to import BOOL arrays?

Arrays of BOOL variables defined in the STEP 7 project cannot be used by theOPC symbols.

The import function in the Symbol File Editor is performed without an errormessage being displayed, however the AddItem OPC function, for example in theOPC Scout, rejects use of the variables with the error message “Item definitiondoes not exist in the name space of the server”.

Page 707: Industrial Communication With PG-PC

FAQs

707SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Flat browsing with the OPC Server

Hierarchical BrowsingAll items of the currently selected level are returned.

Flat BrowsingAll items of the selected level and all items of the levels below are returned.The elements of the individual levels are separated by a backslash (“\”). Theresulting string represents the item. This separator can, however, differ from serverto server; the SIMATIC NET OPC Server always returns the backslash asseparator.

Is it possible to use iMAP and the OPC Symbol File Configurator at the same time?

OPC symbol files can be created and processed by the iMAP PROFInetengineering tool or using the OPC Symbol File Configurator. With a suitable configuration, the symbol file is also accessed during run time; inother words, when this file is activated in the Configuration Console and anapplication accesses the symbols.

You should avoid simultaneous access by these programs to avoidinconsistencies. Please close the relevant applications before accessing the samefile with a different application!

How can I change the access rights of OPC variables?

Local OPC information variables (such as “&statepath()”, see manual) have fixedaccess rights, normally only read rights. This can be extended or restricted bycreating and assigning a symbol to an information variable in the Symbol FileConfigurator.

Regardless of this setting, the correct access rights will be used for this local OPCinformation variable and displayed in the OPC Scout.

This does not apply to remote communication variables, the access rightsconfigured for these variables with the Symbol File Configurator are displayed inthe OPC Scout. The actual rights are checked only during run time.

What is the maximum permitted length for the path of a symbol file?

The path including the drive and file name of a symbol file must not exceed 180characters.

Otherwise, the symbol file is not accepted by the OPC Server; the symbolic namespace cannot be investigated and it is not possible to insert symbolic names.

Page 708: Industrial Communication With PG-PC

FAQs

708SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

How can I access the component management of the PC station?

The Station Configuration Editor is the user interface of the Station Manager. Itallows access to the component management of the PC station.

The Station Configuration Editor is started automatically after logging on with theoperating system. It enters itself as a separate icon at the far right of the task bar(system tray). Double-clicking on the icon opens the Station Configuration Editor. The Station Configuration Editor can, however, also be started manually using the“Station Configuration Editor” shortcut on the desktop.

Which settings do I need to make for the OPC Alarms & Events server and DP-Inproc serverfor OPC Data Access?

The DCOM configuration settings described in this documentation applyanalogously to the OPC Alarms & Events server and the DP-Inproc variant of theOPC server for Data Access.

In the “Applications” tab, however, the name of the relevant server must beselected instead of the “OPC.SimaticNet” server, as follows:

� OPC.SimaticNET.DP for the DP-Inproc variant of the OPC Data Access server

� OPC.SimaticNetAlarms for the OPC Alarms&Events server.

What is a maximum length of a variable value in the OPC Scout?

In the OPC Scout, the input and output of values is restricted to a displayablelength of 2048 bytes per variable.

This means, for example, that you can only use a send buffer reliably for a BSENDvariable with a length of 511 bytes.

As soon as the displayable length exceeds 2048 bytes, no more data is displayed.

How many variables can be used per project?

The OPC Scout V2.2 can utilize up to 100 percent of the CPU depending on thenumber of variables to be monitored.

You should therefore plan the number of variables in the project based on theupdate rate and the frequency of changes in the variables if you want to use theOPC Scout.

Date-and-time variables are displayed without the time. Why?

When displaying the value 00:00:00 (midnight) of variables of the Date-and-Timetype, the OPC Scout displays only the day but not the time. All other times aredisplayed correctly.

Page 709: Industrial Communication With PG-PC

FAQs

709SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

What do I need to remember about the “New Definition” function when using theSEND/RECEIVE protocol?

If you make entries in the form “SR:[connection]send,Bxx,yy“, note the following:The information entered in the input dialog box for the address range and numberof values is not correct.

To make a correct entry for these items, you must know the default size of thesend buffer. The default size of the send buffer is specified when configuring thedatabase using STEP 7 or NCM PC. When you enter the address, remember that this can only have a value between 0and the default size of the send buffer minus 1. If 25 was configured as the size of the send buffer, addresses between 0 and 24are possible.

The maximum value for the number of values is calculated as follows:

(size of the send buffer – address) / (size of the selected data type), rounded down

Why can some variables not be entered with the “New Definition” function?

The “New Definition” is used to enter items. In the following situations, itemscannot be entered with this function:

Items in the form “SR:[connection]sendXXXX,range” cannot be entered with thisfunction (where XXXX represents the size of the send buffer). In such situations,insert any item and then move the item to the right-hand pane of the dialog. Afterselecting the item, the “Modify variable” menu command is available in thecontext-sensitive menu. You can then change the variable name to the requiredformat.

Items in the following forms cannot be entered with this function:

� SR:[connection]fetch,range

� SR:[connection]write,range

Can the local server be configured as an external server?

The documentation for the OPC Scout describes that either the local OPC Serveris used or the client communicates with an external server by remote access.

Please remember that by configuring the (D)COM properties of the OPC server(for example OPC.SimaticNet, modifications made with the DCOMCNFG operatingsystem application) the local server (Server –> Local server) can be addressed asan external server. This entry therefore makes both variants possible in the GroupNavigator.

Page 710: Industrial Communication With PG-PC

FAQs

710SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

When using the “Generate values” function, the connection aborts and the OPC Scout nolonger reacts. How can I get control of the program again?

If the OPC Scout writes cyclic values using the “Generate values” function, and ifthere is an interruption on the connection, the OPC Scout can no longer becontrolled by the operator because the write operation uses synchronous calls. It isnot even possible to close the program.

You will only be able to work with the program either when the connection isre-established or after the OPC server shuts down (Configuration Console –>Close OPC Server). Please note that in the latter case all other communication viathe OPC Server will be aborted.

Why is no event message output on connection establishment?

When using the “Automatic connect” property (default setting) of the DataOCX, thetime at which the OPC server establishes the connections to the communicationpartner and the time at which the VB application is ready to receive an eventmessage on the connection establishment are not synchronized.

It is possible that the connection establishment takes place before the applicationis ready to receive events so that an event message on the connectionestablishment cannot be received.

RemedyDeactivate the “Automatic connect” property in the DataOCX and call the“Connect” method in the program when the application is initialized.

Out-of-date values are displayed in the visualization control. Why?

When you interconnect process variables with controls for visualization, theValue_Changed callback is not synchronized with the transfer of the data value tothe control for visualization. It is therefore possible that when the value is read outin the visualization control within the Value_Changed_Callback, an out-of-datevalue is read.

RemedyUse the current value transferred in Value_Changed.

Page 711: Industrial Communication With PG-PC

FAQs

711SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Is it possible to read and write SEND/RECEIVE OPC items simultaneously?

SEND/RECEIVE OPC servers always require two items for reading and writing.This is a system characteristic of the SEND/RECEIVE protocol. This can lead todisplay problems on the visualization clients that often have only one field fordisplaying and setting a value. In this case, it is advisable to use the S7 protocolfor displaying values.

Page 712: Industrial Communication With PG-PC

FAQs

712SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

10.3 FAQs on the CP 1613

Entry Missing in “Bindings” in Windows NT – What do I do when there is an entry in “Adapters” in the Control Panel ofWindows NT after installing the CP 1613 but there is no entry in “Bindings”?

The entry in “Bindings” (Start –> Settings –> Control Panel –> Network –>Bindings) was prevented because you selected “Bindings”.

Remedy

If the CP 1613 is not entered in “Bindings”, follow the steps outlined below toobtain a correct installation:

1. Uninstall the CP 1613.

2. Install the CP 1613 again after booting your computer. Caution: Under nocircumstances open the “Bindings” tab before you exit the “Network” dialog box(taskbar Start \ Settings \ Control Panel \ Network).

Avoiding Incorrect Installation – How do I avoid problems in Windows NT if I want to install anothercommunications processor in addition to the CP 1613?

When you install the second network adapter in Windows NT, the followingsituation can arise: If you select the “Bindings” tab ( Start \ Settings \ Control Panel \ Network \Bindings) when setting the network parameters after installing the second networkadapter, and then set the TCP/IP address in the “Protocols” tab and then exit the“Network” “Dr. Watson” may display the following error message: rundll32.exe Application Error – The installation of the CP 1613 is now incorrect.

Remedy

Exit “Network” immediately after installation. When you close the dialog box, youwill be prompted to enter a TCP/IP address.

BIOS Settings under Windows NT – Which BIOS settings are relevant?

If the BIOS of your computer has a setting “Plug & Play O/S”, set this option to“[NO]” if you use Windows NT. After installing a CP, it is advisable to set theparameter “Reset Configuration Data” in the BIOS to [YES] to reset thePlug-and-Play configuration. This parameter is normally located close to the “Plug& Play O/S” parameter.

Important: Under Windows 2000, the “Plug & Play O/S” must be set to [YES]!

Page 713: Industrial Communication With PG-PC

FAQs

713SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

The installation of the “Siemens CP 1613 NDIS Adapter” driver was rejected by the systembecause no CP 1613 module is inserted — What can I do?

If you have not plugged in a CP 1613 module, it is not possible to install the“Siemens CP 1613 NDIS Adapter” driver.

Remedy

Install a CP 1613 module in your computer and install the “Siemens CP 1613 NDISAdapter” driver again. Follow the instructions in the installation manual of the CP1613 while installing the module and driver.

The computer no longer boots after installation – What should I do if the computer no longer boots after installing a CP 1613along with an ISA module?

In some computers there is sometimes a resource conflict involving the interrupts(IRQ) when the PCI IRQs in the BIOS are set to “Auto Select”. The computereither does not boot at all or the drivers are not started.

Remedy

Reserve IRQs for the ISA cards in the BIOS. These IRQs are then no longer usedfor PCI modules by the BIOS and a resource conflict is avoided.

Installing a CP 1613 along with other network adapters – What do I need to remember?

When, for example, you install the drivers of a 3COM PCI network adapter 3C905,their network monitor “Smartagent” is also installed.If you install a CP 1613 as well, not only all the previously installed protocols butalso the “Smartagent” is bound to the CP 1613. Deactivate this entry, since the CP1613 does not support this network monitor. Follow the steps outlined below.

Remedy

1. Navigate to the “Bindings” dialog box (taskbar Start \ Settings \ Control Panel \Network \ Bindings).

2. In the list box “Show bindings for:”, select “All adapters”.

3. Display all the protocols of the “Siemens CP 1613 NDIS Adapters” in the listbox below. Reaction: For example, the entry “3COM dRMON Smartagent PCSoftware” appears.

4. Click the “Disable” button.

Page 714: Industrial Communication With PG-PC

FAQs

714SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Why can you specify two TCP/IP addresses when configuring the CP 1613?

On the one hand, the CP 1613 communications processor is designed foroperation with office communications protocols, for example, TCP/IP. In this case,the CP 1613 NDIS adapter must be installed and office communications protocolswill be assigned to it. The office communications protocols run on the PC. On the other hand, the CP 1613 can also be used for automation with theSIEMENS industrial protocols, for example SEND/RECEIVE, SAPI S7, STEP 7and TF. With the exception of TF, these protocols can be handled either over thetransport protocol ISO or TCP/IP. Both transport protocols run in the firmware ofthe CP 1613. The adapter between the TCP/IP transport protocol and theSIEMENS industrial protocols is implemented according to RFC 1006.On the CP 1613, a total of two TCP/IP transport protocol functions can beoperated at the same time:

� The office communications adapter

� The adapter of the SIEMENS industrial protocols

Both adapters must be assigned different TCP/IP addresses to identify themuniquely.

The driver for the CP 1613 does not start up after turning the computer off and on again.

What is the reason and what can I do?

When a computer has to be restarted, a reproducible restart is only possible whenall volatile information was actually deleted prior to turning off. Some computers simply change to standby mode when the operating system isclosed down and some information is retained.

Remedy

To ensure a reproducible restart on the computer with new data from non-volatilememory, follow the steps below:

1. Close down your operating system. Reaction The computer changes to thestandby mode.

2. Turn off the power to your computer for at least one minute. Reaction Allunnecessary data now disappears.

3. Turn on the power to your computer again and boot it again.

Ping Function – Why does the CP 1613 not respond?

You enter a “ping” for a CP 1613 installed in your own computer, and the CP doesnot respond. This function is not implemented. Only CPs outside the local system can be addressed with “Ping”.

Page 715: Industrial Communication With PG-PC

FAQs

715SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

During communication with an OSM V1.0 (or other device capable of autonegotiation), theCP 1613 sporadically sends bad frames – What causes these transmission errors?

The bad frames (truncated frames, CRC errors etc.) occur when the OSM V1.0 isset to full duplex mode.

Since the OSM V1.0 does not operate with autonegotiation, its ports can be setpermanently to half or full duplex mode by DIP switches. Its data transmission rateis also set internally to 10 Mbps.

The CP 1613, on the other hand, always works with autonegotiation even if theduplex mode and data transmission rate are fixed.

Every device (in this case the CP 1613) that works with autonegotiation andcommunicates with a partner that does not have autonegotiation (in this case theOSM V1.0) can recognize its data transmission rate, however not its duplex mode.The CP 1613 then automatically assumes that the partner operates in half duplexmode. If, on the other hand, the partner device is in full duplex mode, thesetransmission problems occur.

This problem can be observed not only with an OSM V1.0 but with every devicethat does not use autonegotiation.

Remedy

If a partner device that does not have autonegotiation (for example the OSM V1.0)communicates with the CP 1613, the partner device must be set to half duplexmode. In this respect, the settings on the CP 1613 are irrelevant.

It is worth mentioning that the OSM V2.0 does provide autonegotiation and theproblem outlined above no longer occurs with this version.

Time-of-day frames and intervals – Which intervals are approved for receiving time-of-day frames?

� 1 s and

� 10 s

What do I need to remember when starting an application?

Do not start an application with the AUTOSTART program group, otherwiseproblems with the license server may occur. When you boot, the license servertakes some time to start.

What do I need to remember when using a TF database?

Every CP 1613 module has a default MAC address that can be edited manually. Ifyou activate a TF database, the address is taken from the database. This MACaddress is retained even after you deactivate TF. Prior to activating TF, you shouldtherefore note the original MAC address so that you can use it again whennecessary.

Page 716: Industrial Communication With PG-PC

FAQs

716SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Plugging in different connecting cables (TP, ITP or AUI) – What do I need to remember when plugging in different connecting cables?

If all the options for network parameters in the “Set PG/PC Interface” or“Configuration Console” programs are set to automatic, the card will adapt itselfautomatically to the attached network.Only one network cable can be connected to a CP 1613 at any one time.

What are the time limits for removing and plugging in the Ethernet cable without existingISO connections being terminated?

For ISO data exchange,16 repetitions at intervals of one second are set on the CP1613; in other words, if the cable is disconnected for longer than 16 seconds, theISO connections will terminate. If the time is kept below 16 seconds, no problemswill occur.

If there is no data exchange on an established connection, a “sign of life” is sent atintervals of 10 seconds. If there is no response to this ten times in succession, theconnection is automatically terminated. In the case of such a “quiet” connection,the cable can therefore be removed for up to 100 seconds without the connectionbeing terminated.

The information above applies, as already mentioned, to the data transfer phase.In the connection establishment phase, the connection establishment request issent every two seconds and up to 32 attempts are made. The interruption cantherefore be up to approximately 64 seconds during the connection establishmentphase. If this is exceeded, the connection establishment is aborted and noconnection will result.

CAUTION: The information above does not apply to fault-tolerant connections (Hconnections) !

Page 717: Industrial Communication With PG-PC

FAQs

717SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

10.4 FAQs on SOFTNET Industrial Ethernet

Set PG/PC Interface / Configuration Console – Which combination of interface parameter settings is not permitted?

“ISO Ind. Ethernet –> SIMATIC NET NDIS-Ether”

When can data be lost during data transmission?

When using the TCP/IP transport protocol, if the connection is terminated(CLOSE_REQ) immediately following a SEND_DATA or SEND_EOM_DATA, thedata can be overtaken by the close request and is then lost.

Remedy

We recommend that you implement your own acknowledgment mechanisms abovethe transport layer.With the ISO protocol, transport data cannot be overtaken and no data lossoccurs.

When using the RFC1006 adapter “S7ONTCP.DLL”, if there is a high transmission load withshort messages (< 10 bytes), the connections sometimes break down. How canyou get round this problem?

� You should take measures to attempt to distribute the message load.

� At a higher layer, implement mechanisms to ensure that the CP has receivedand processed the messages.

When sending over the RFC1006 adapter, the sockets put the messages in abuffer if they cannot be sent immediately. The user is informed that the messageshave been sent even though they have only been placed in the buffer of the socket(because they will be sent later).

What are the effects of a high transmission load with short messages (<10 bytes) with TCP(RFC1006)?

If send jobs are initiated in the user program more quickly than they can beprocessed by the recipient, this can lead to buffer overload and cause a breakdownon the connection. This problem occurs particularly with a high transmission loadand short messages (<10 bytes).

Remedy

You can avoid the connection breakdown by reducing the number of send jobs atthe user program end.

Page 718: Industrial Communication With PG-PC

FAQs

718SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Which error messages can be ignored?

If you select the “SIEMENS Industrial Ethernet (ISO)” protocol from the list ofnetwork protocols and then click on the “Properties” button, the following errormessage appears: “The software component could not be configured.” This message does not affect your communication with SIMATIC S7 and SIMATICS5 devices and can be ignored.

With which network cards was Softnet IE tested?

With the PCI network card 3COM 3C905 and the PCMCIA card XIRCOM CreditCard Ethernet 10/100.

Can a CP 1613 be operated at the same time as SOFTNET IE?

This combination has not been approved.

Is it possible to operate SOFTNET IE with several network adapters installed?

The Siemens ISO protocol can only be bound to one Ethernet network adapter. IfSOFTNET Industrial Ethernet is installed, the SIEMENS ISO protocol is bound toall Ethernet-compliant adapters! You should therefore remove the Siemens ISOprotocol from the Ethernet adapters that are not used with the SIEMENS ISOprotocol in the Control Panel (taskbar Start \ Control Panel \ Network \Configuration).This also applies to installed modules such as the adapter for dial-up networking.

What is the maximum number of S7 connections?

The following table shows the maximum number of S7 connections depending onthe PDU size and number of credits:

PDUSize

Number of S7 Connectionswith Credit 1

Number of S7 Connectionswith Credit 2

112 64 32

240 64 32

480 64 32

960 64 32

Page 719: Industrial Communication With PG-PC

FAQs

719SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Number of Applications/Connections

The values of the following set of parameters have been tested and areguaranteed.

Parameter Value forSEND/RECEIVE

Value for SAPI-S7

Maximum frame lengthof a job/request

4096 bytes 240 bytes, 480 bytes,960 bytes dependingon the partner

Maximum number ofsimultaneously esta-blished connections

64 64

Maximum number ofpartner stations

15 15

Maximum number ofsimultaneously activeuser programs

6 3

Maximum number ofsimultaneous jobs/re-quests per connection

1 send job

1 receive job

2 requests

Maximum number ofactive application (incl.OPC Server) accesspoints

8 8

With blocks of data >1024 bytes

64

Deviations from these settings for certain parameters that mean using less systemresources may release extra system resources for other parameters.

Note that the actual useful data length is less than the frame length and dependson the particular job type.

What is the significance of the “Keepalive Time” for TCP/IP (RFC1006)?

The “Keepalive time” monitoring time of TCP/IP (RFC1006) specifies the intervalafter which TCP checks whether or not a connection still exists. With all approvedoperating systems, the default setting is 2 hours:

Windows NT, Windows 2000

You can configure the settings with the “Configuration Console” program or modifythem in your STEP 7 project.

Page 720: Industrial Communication With PG-PC

FAQs

720SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Why is the TCP/IP connection terminated in Windows 2000 10 seconds after disconnectingthe network cable regardless of the selected keepalive time?

In Windows 2000 Professional, TCP/IP has a link monitoring function. As a result,removing the TP cable from the network adapter causes a remote_abort afterapproximately 10 s.

10.5 FAQs on SEND/RECEIVE for Industrial Ethernet

What do I need to remember when activating the trace for the SEND/RECEIVE programminginterface?

To activate modified settings, the SEND/RECEIVE user program must berestarted.

What restrictions apply to the SEND/RECEIVE programming interface?

In a SEND/RECEIVE user program, the SRMD_set() initializations must be calledfrom within the same thread. The same window and the same message ID mustalways be passed as the parameter.

What happens when using the functions and calls of the SEND/RECEIVE interface if I usea TSAP that has already been assigned during connection establishment?

This double assignment is not detected by SOFTNET for Industrial Ethernet. Thevalue of ISO-Reason-Code contained in the job block is immaterial.

What functional restrictions are there for a SEND/RECEIVE job when using the TCP/IPtransport protocol?

Passive connection establishment can only be initiated by a user program. The simultaneous use of several user programs with passive connectionestablishment is not currently possible.The components vc_buf1_ptr and vc_buf1_length are not currently supported invariable array 2.

What differences are there on the user interfaces SEND/RECEIVE or SAPI-S7 between theISO and the TCP/IP (RFC1006) transport protocol?

An acknowledged message with the ISO transport protocol (for example withSEND/RECEIVE, opcode=SEND_EOM_DATA and response=OK_RESP) confirmsthe reception of the data at the connection partner, whereas an acknowledgedmessage when using the TCP/IP (RFC1006) transport protocol simply confirmstransmission of the data to the connection partner.

Page 721: Industrial Communication With PG-PC

FAQs

721SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

When can data be lost during data transmission?

When using the TCP/IP transport protocol, if the connection is terminated(CLOSE_REQ) immediately following a SEND_DATA or SEND_EOM_DATA, thedata can be overtaken by the close request and is then lost.

Remedy

We recommend that you implement your own acknowledgment mechanisms abovethe transport layer.With the ISO protocol, transport data cannot be overtaken and no data lossoccurs.

Which SIMATIC programmable controllers can I communicate with using theSEND/RECEIVE programming interface?

With the SEND/RECEIVE programming interface, you can communicate with theS5 and S7 SIMATIC programmable controllers from a PC/PG (primarily withSIMATIC S5).

What do I need to remember about segmented jobs with the SEND/RECEIVE programminginterface?

A single packet transmitted over the SEND/RECEIVE interface can be a maximumof 4096 bytes long. This means that larger packets must be segmented. On thesender, the data must be split into blocks with a length of 4 Kbytes. The recipientmust then reassemble these blocks correctly.

If a send credit higher than 1 is used, the correct order of the individual blocks ofdata on the recipient cannot be guaranteed by the SEND/RECEIVE interface. Thismeans that the sending and receiving applications must have suitable mechanismsthat will allow the data to be reassembled in the correct order.

Page 722: Industrial Communication With PG-PC

FAQs

722SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

10.6 FAQs on the CP 5613/CP 5614

What hardware resources does the module require?

The module occupies three address windows with sizes:128 bytes, 1 Mbyte, 1 Mbyte The required address ranges are assigned by the PCI-BIOS.

The module requires an interrupt. The assignment is made automatically by thePCI-BIOS. The module allows the interrupt to be used by other modules(shareable interrupt).No settings are required on the module.

What is the difference between the CP 5613 and CP 5614?

The CP 5614 has the properties of the CP 5613 and also provides the option of asecond PROFIBUS port that can be operated as a DP slave as well as allowingprogram-controlled transfer of DP data between the two ports.

Can the CP 5613 be upgraded to a CP 5614?

No.

Are the drivers for the CP 5614 different from those of the CP 5613?

No, the drivers and the firmware are the same for both CPs.

The process list in Windows NT/Windows 2000 contains a CI_SERV process. What doesthis do?

This program is necessary for the CP 5613/CP 5614 to display error messages.

Page 723: Industrial Communication With PG-PC

FAQs

723SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

10.7 FAQs on Converting from the CP 5412 to the CP 5613/CP5614 and CP 5...11

What is the difference between the FDL interface and the interface of the CP 5412 (A2)?

The following FDL services are no longer implemented:

� FDL_READ_STATISTIC_COUNTER

� FDL_READ_LAS_STATISTIC_COUNTER

There is a new security mechanism that prevents more than one applicationprogram accessing a SAP.In contrast to the CP 5412 (A2), the SAPs with the numbers 0 and 50 are reservedas default. During configuration, the reservation for SAP no. 50 can, however, becanceled.With the CP 5613 / 5614, the list of SAPs and the status of the SAPs can bedisplayed (open the “LSAP List” dialog in the Configuration Console tool).

What is the difference between the DP interface of the CP 5613/CP 5614 and the DP interfaceof the CP 5412 (A2)?

The CP 5613 or CP 5614 has a different interface optimized for the transfer of DPdata.Differences in functionality:

Cyclic, global control frames that could be configured with COM PROFIBUS forthe CP 5412 (A2) are not supported by the CP 5613 or CP 5614 (and CP 5511,CP 5611).

What is the difference between the FMS programming interface and the interface of the CP5412 (A2)?

The FMS programming interface differs in the following aspects:

� FMS-5613 does not support open-responder connections.

� SAP 50 can no longer be used.

Page 724: Industrial Communication With PG-PC

FAQs

724SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

10.8 FAQs on SOFTNET PROFIBUS

Is it possible to operate more than one protocol under SOFTNET at the same time?

No. Parallel operation of FDL, DP and S7 with one SOFTNET module has notbeen approved. It is, however, possible to operate these protocols at the sametime as STEP 7.

Is use of the CP 5411 still approved?

The use of a CP 5411 is no longer approved with this version.

Is it permitted to operate SOFTNET PROFIBUS CPs together or combined with HardnetCPs?

It is not possible to operate more than one CP 5...11 at the same time. Thecombination of a CP 5..11 with the CP 5613 or CP 5614 in one PC is permitted.

Are the functions ON_NOW and ACPI supported?

The ON_NOW function is not currently supported. The ACPI function has beenapproved for SOFTNET.

I have two PCs with SOFTNET modules attached to the bus and use the “PG operation”mode. When I display the bus nodes in diagnostics on one of the PCs, thesecond SOFTNET PC does not appear. How can I test the functionality of thenetwork?

The SOFTNET modules are only active in PG operation when an application hasactually started communication. For test purposes, you could, for example,execute an SCP-Open with the supplied FDL demonstration program and soactivate the CP.

I have already installed DP 5613 for Windows NT. When I install SOFTNET DP, the message‘License already installed’ appears. Can I run SOFTNET with the 5613 license?

Yes! The license is also valid for SOFTNET.

Page 725: Industrial Communication With PG-PC

FAQs

725SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

10.9 FAQs on the CP 5511

Is use of the CP 5411 still approved?

The use of a CP 5411 is no longer approved with this version.

What do I need to remember when using the CP 5511?

Note on using the CP 5511 under Windows NT 4.0:

To operate a CP 5511 under Windows NT, you also require a Cardwizard fromSystemsoft. The 05/2000 CD contains the document “inSysSft.pdf” in the “sw\cp_5511” folderthat describes the procedure. Please follow the instructions in this document.Please note that you only have the right to use the Cardwizard when you operate aCP 5511. The Card & Socket Services from Award Inc. are no longer supported as of theSIMATIC NET CD 07/2001.

Is additional software required to operate the CP 5511 under Windows 2000 as it is for NT4.0?

No. The Cardwizard must not be used under Windows 2000!

I have had problems operating the CP 5511. What might be the cause and what can I doabout it?

Since there are considerable differences in the hardware that can be used,particularly the PCMCIA controller used, in rare cases, there may be hardwareconflicts with the CP 5511.For more detailed information, refer to the release list (Rel551ntd.pdf). This isconstantly being updated and is available on the Web.

In the Windows NT Control Panel under PCMCIA, the CP 5511 is always marked red as beingunconfigurable. What is wrong?

Windows NT does not recognize the CP 5511 and cannot configure it. The CP canonly be configured with the supplied drivers. This display says nothing about thecorrect installation and functionality of the CP.

What are the properties of the electrical interface adapter?

The physical connection is made by an interface adapter (floating RS-485interface) that connects the CP 5511 with the transmission medium. Datatransmission rates of 9.6 Kbps to 12 Mbps are possible.

Page 726: Industrial Communication With PG-PC

FAQs

726SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

The card is no longer recognized by the system. Is this because I have removed the interfaceadapter?

Yes! The card should only be removed and inserted along with the interfaceadapter. Remove the card, fit the interface adapter and insert the card again.

Do I need to configure anything manually on the CP 5511?

No, the CP 5511 is plug-and-play card.

What memory resources does the CP 5511 occupy?

The CP 5511 can adapt itself to your system. Starting with the largest memorysize, Windows attempts to find a free memory range for the CP from the list below.

Size DPRAM ATTRIB (4 KB)

256 KB F00000–F3FFFF EFF000–EFFFFF

256 KB F80000–FBFFFF F7F000–F7FFFF

128 KB F00000–F1FFFF EFF000–EFFFFF

128 KB F80000–F9FFFF F7F000–F7FFFF

60 KB 0D1000–0DFFFF 0D0000–0D0FFF

56 KB 0D2000–0DFFFF 0D1000–0D1FFF

48 KB 0D4000–0DFFFF 0D3000–0D3FFF

32 KB 0D8000–0DFFFF 0D7000–0D7FFF

32 KB 0D2000–0D9FFF 0D1000–0D1FFF

24 KB 0D2000–0D7FFF 0D1000–0D1FFF

24 KB 0DA000–0DFFFF 0D9000–0D9FFF

16 KB 0D2000–0D5FFF 0D1000–0D1FFF

16 KB 0D7000–0DAFFF 0D6000–0D6FFF

16 KB 0DC000–0DFFFF 0DB000–0DBFFF

8 KB 0D2000–0D3FFF 0D1000–0D1FFF

8 KB 0D5000–0D6FFF 0D4000–0D4FFF

8 KB 0DE000–0DFFFF 0DD000–0DDFFF

Page 727: Industrial Communication With PG-PC

FAQs

727SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

When I install under Windows NT, I receive a message telling me to deactivate theAutoRelease option of the Card&Socket Services. How do I do this?

This is possible only with a manual intervention in the Registry for which yourequire administrator privileges. Follow the steps outlined below:

� Open the Registry Editor. (Start–>Run–>regedit.exe)

� Locate the entry’HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PCCS\Options’

� Add ’AR:OFF’ to the entry under ’CommandLine’. If, for example, you find theentry ’CommandLine’ ’/SC:OFF’, you must change this to ’/SC:OFF /AR:OFF’.

My CP 5511 does not work under Windows 2000!

With Windows 2000 Pro, several cases are known in which the operating systemplaced the memory window for the CP 5511 in a range that had already beenassigned to another device resulting in a variety of errors. A modified inf file wasable to remedy the situation by restricting the possible address range for thememory window of the CP 5511 to the D segment. You can check the addressesof the memory window in the Configuration Console or “Set PG/PC Interface”program.To remedy the problem, follow the steps below:

Step Description

1 Save the original inf file (in the Windows\inf folder) in a differentfolder

2 Copy the new inf file (obtainable from SIMATIC Customer Sup-port on the Internet) to the Windows\inf folder.

3 Uninstall the CP 5511 in the Device Manager.

4 Remove and reinsert the CP 5511

5 Recommended: Reboot

6 Check whether or not the memory ranges are all in the D seg-ment

7 If the new addresses do not bring about any improvement, re-store the original situation.

NoteBy restricting the DPRAM area to the D segment, you may find that the maximumconfiguration is reduced.

Can I operate a CP 5511 at the same time as a PCMCIA Ethernet adapter?

In principle yes. Remember, however, that the CP 5511 requires a lot of resources.Depending on your hardware, you may find that you do not have enough resourcesfor parallel operation. The CP 5511 cannot be operated at the same time as aPCMCIA IBM Ethernet Adapter II because this results in a memory conflict.

Page 728: Industrial Communication With PG-PC

FAQs

728SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Installing the CP 5511 on the SNI Mobile 710 notebook!

To operate the CP 5511 under Windows NT 4.0 with an SNI MOBILE 710, yourequire at least BIOS 4.0 Release 5.1 Release Version 3C31. You can request thisBIOS version over the Hotline. ( Phone: +49 (0)911 – 895 – 7000, E-mail:[email protected])

To operate the CP 5511 under Windows Millennium and NT/2000 Pro, the followingBIOS settings are necessary: ’Advanced–>PCI Devices–>PC Card Controller Mode’:’ PCI’. ’Advanced–>Integrated Peripherals–>On Board Audio’: ’ Disabled’ ’Advanced–>Memory Cache–>External Cache’:’ Disabled’

Additional settings depending on the operating system:

Windows NT 4.0

’Advanced–>Plug and Play OS’:’ No’

Windows 2000

’Advanced–>Plug and Play OS’:’ Yes’

Page 729: Industrial Communication With PG-PC

FAQs

729SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

10.10 FAQs on the CP 5611

After I plugged the CP 5611 into the PCI slot, the BIOS message “Resource Conflict PCINetwork Controller as Slot ...” was displayed!

The resources required by the CP 5611 (interrupt, memory ranges) are set by thePCI BIOS and mapped to suitable system resources. The PCI BIOS has detected that the required resources are not available. Changethe hardware configuration of the computer so that the required resources are free.

The CP 5611 is correctly installed but still cannot be operated under Windows NT. What isthe reason?

Some computers have the option ’Plug&Play O/S’ under ’Advanced’ in the BIOS.For operation under Windows NT 4.0, set this option to ’No’.

I cannot start up the CP 5611 in a PG 740 P II. Are there any problems known?

If all PCI interrupts are set to ’Auto’ in the BIOS, you may encounter problems.Change the settings of the interrupts under PCI in the BIOS, for example to9,9,11,11.

Page 730: Industrial Communication With PG-PC

FAQs

730SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

10.11 FAQs on PROFIBUS SOFTNET S7

How many partner stations can I communicate with at the same time using the S7 protocol?

If you establish exactly one connection to each partner station, the maximumnumber of partner stations is the same as the maximum number of connections.The maximum number of connections with the CP 5511 depends on the hardwareconfiguration. With the currently available PCMCIA drivers under WindowsNT/2000, the dual-port RAM is restricted to 59 KB.

Number of Applications/Connections

The following table provides you with an overview of the basic data of the S7interface dependent on the hardware configuration.

5611 551159 KB

551155 KB

551131 KB

551123 KB

551115 KB

Maximumnumber ofsimulta-neous S7connectionsSN S7

8 8 8 8 8 8

Maximumnumber ofsimulta-neous userprocesses(with S7communica-tion)

8 8 8 8 8 8

Which development tools can the S7 programming interface be used with?

DLLs with the C calling convention (S732.dll) and with the standard callingconvention (S732std.dll ) are supplied (in the Windows\System folder). For the DLLs with the standard calling convention, import libraries for Microsoftdevelopment tools are available (s7msstd.lib) that use the standard callingconvention (for example Visual Basic). There is also an import library available forthe DLL with the C calling convention for Microsoft development tools (s7msc.lib).

How should I set the ’dev_name’ parameter when calling the ’s7_init’ and ’s7_get_vfd’functions?

The ’dev_name’ parameter identifies the access point via which you willcommunicate. This device name is the same as the entry made in the “Accesspoint of the application” box in the “Configuration Console” program. This can bethe value “CP_L2_1:” that is installed as default.

Page 731: Industrial Communication With PG-PC

FAQs

731SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Can I also use the trace functionality of SAPI-S7 under SOFTNET?

Yes! The trace settings are made with the “Configuration Console” parameterassignment tool.

Are there services that are not supported by all S7 CPUs?

Yes, the S7_get_vfd_state_req service is not supported by the S7-300. TheBSEND/BRECEIVE functions and alarms are not supported by the S7-300.

What is Routing?

If you use this SIMATIC NET product on a PC/PG with a STEP 7 V5 product, youcan use the new routing functionality. This is not possible with older versions of thisproduct.

Routing

As of STEP 7 V5, it is possible to access S7 stations in other subnets online fromyour PG/PC, for example to load user programs or a hardware configuration or torun test and diagnostic functions. You can attach a programming device at any point in the network and establish anonline connection to all stations accessible via gateways.

Example

The gateway between a subnet and one or more other subnets is in a SIMATICstation with interfaces to the relevant subnets.

SubnetType 1

SubnetType 2

Inter-

Type 1face

Inter-

Type 2face

Connection establishment following problems on the bus.

Following a problem on the bus (for example a bus short-circuit), the connectioncan only be established again after approximately 10 seconds.

Page 732: Industrial Communication With PG-PC

FAQs

732SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Are the times of SAPI-S7 jobs monitored?

Yes, with the ’Abort-Timeout’ value. This value specifies the maximum time forretries if the remote station does not respond. This time is specified in multiples of 51 ms (default setting: 3000). The parameterapplies both to the connection establishment phase and the data transfer phase. Inother words, if connection establishment is initiated to a station that is not attachedto the bus, there is a negative acknowledgment after approximately 150 seconds. If a job is sent to station that is no longer attached, the CP initiates a negativeacknowledgment or an abort indication at the latest after 150 seconds.

The SOFTNET CP 5...11 modules monitor the following:Connection establishment, partner stationdoes not exist

TimeOut PersistenceCount TimeOut after

500 5 25 sec

1000 5 50 sec

1000 10 50 sec

Connection breakdown, no data exchange

TimeOut PersistenceCount TimeOut after

500 5 Immediately

1000 5 Immediately

1000 10 Immediately

Connection breakdown, data exchange

TimeOut PersistenceCount TimeOut after

500 5 Immediately

1000 5 Immediately

1000 10 Immediately

What should I note about evaluating the return value of the ’s7_receive’ function?

If unexpected values occur for which no processing function is called, the’s7_discard_msg’ function must be called (for example in the default branch of asuitable switch statement).

Can I use the licenses of other products to operate SOFTNET S7?

Yes! If you have already installed the license for the product “S7-5613 for WindowsNT”, you can use this license for the S7 mode under SOFTNET.In this case, you can skip installation of the authorization in the setup.

Page 733: Industrial Communication With PG-PC

FAQs

733SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

10.12 FAQs on PROFIBUS SOFTNET DP

Can I operate my SOFTNET DP slave purely as an input or output slave ?

Yes, this is possible.

Closing an application that uses the DP slave interface in the Task Manager or in thedebugger does not work. What can I do?

If you close the application without previously executing dps_stop and dps_close, itcan take quite a long time before the process is actually closed. Always executeDPS_stop and DPS_close before you close your application.

How many slaves can be operated with SOFTNET DP?

The CP 5511 attempts to find the largest possible memory area for the dual-portRAM for access to the module. The following table provides you with an overviewof the relationship between memory size and the number of slaves that can beconfigured. Please note: The possible number of slaves also depends greatly on theconfigured length of the input/output data of the slaves. For this reason, it is onlypossible to specify broad ranges. If you do not have enough memory for yourdatabase, reduce the number of slaves by at least five.

PCMCIA Card CP 5511

Memory Size Number of Slaves

60 KB max. 50

56 KB approx. 40 to 50

48 KB approx. 25 to 40

32 KB approx. 17 to 25

24 KB approx. 10 to 16

16 KB approx. 5 to 10

8 KB max. 4

CP 5611

Memory Size Number of Slaves

256 KB 64

PC card CP 5512

Memory Size Number of Slaves

252 KB 64

Page 734: Industrial Communication With PG-PC

FAQs

734SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

What do I need to remember if I abort my DP application in the Task Manager?

Make sure that when the DP application is aborted, a dpn_reset() call is made. IfWindows sends a WM_CLOSE message, the program must react and if it has notalready done so, it must execute a dpn_reset() call.

Can I design my SOFTNET DP application with more than one thread ?

In principle yes. However, to keep the load caused by constantly changing threadsto a minimum, it is advisable to implement the SOFTNET DP application with onlyone thread. You will also find that this increases the performance of your DPapplication.

My DP application has a multi-thread architecture. What do I need to remember ?

Make sure that the threads are correctly synchronized to exclude the possibility ofuncontrolled, simultaneous access by more than one thread to the DP driver.

What are the most important points to remember when creating a SOFTNET DP PROFIBUSapplication?

Continuous polling on the DP interface (for example “while” instructions withoutinserting “sleep” functions) can lead to poor performance on the bus because theDP drivers no longer have adequate CPU capacity available.If necessary, include pauses of a few milliseconds between the calls.

Note on the dpn_slv_diag() DP function!

The diagnostic data is not valid if the return parameter slv_state of thedpn_interface structure contains the value DPN_SLV_STAT_NOT_ACTIVE orDPN_SLV_STAT_OFFLINE.

Do I need to use the dpn_set_slv_state function in my DP application?

The use of this function is not normally necessary in a DP application since a DPslave is activated or deactivated automatically by the communications software(depending on the mode of the master). The function should only be used inexceptional situations to take a slave out of the DP cycle regardless of the mode ofthe DP master.

I receive error messages for dpn_init that are not listed in my manual on the DPprogramming interface. What do these mean?

Two new error codes have been introduced:

� DPN_LOAD_L2_VXD_ERROR (0x0097): The layer 2 drivers for the CP 5611,the CP 5511, or for the CP 5411 (S7OASPCX.VXD) cannot be loaded.

� DPN_OPEN_L2_VXD_ERROR (0x0098): The layer 2 drivers cannot beopened. Possible causes: Permanent disturbances on the bus (for example thebus terminator is not activated); another master station with the same stationaddress is already active on the bus; for further information, refer to theWindows event log.

Page 735: Industrial Communication With PG-PC

FAQs

735SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

I work with various groups of slaves. When I try to address group 1 by setting bit 0 asdescribed in the manual, an error occurs.

Selecting groups 1 to 8 in the structure element user_data[0] functions as follows:

Set bit 0: Group 8 is selectedSet bit 1: Group 7 is selected ...Set bit 7: Group 1 is selected

I receive a dialog box telling me that my CP does not have enough memory for theconfigured slaves. I have configured 60 slaves in my DP network with a CP 5511as master. What does the message mean?

The plug-and-play card CP 5511 searches for the largest possible memory area itcan obtain during installation. If you are using other cards, it is possible that the CP only gets part of themaximum possible memory. The number of slaves that can be configured depends on the memory available tothe CP. To save memory, you should only configure slaves that are actuallyconnected to the bus. You can also try to obtain more memory for the CP 5511 by reconfiguring othercards or installing them in a different order. Otherwise, you must reduce the number of slaves.

During DP operation, the message “Bus short-circuit or bad transmission rate” appears.The dpn_reset of my DP application is then no longer acknowledged.

This can only occur in isolated situations if there is a permanent (!) busshort-circuit. Disconnect your CP 5...11 from the bus. The dpn_reset thenterminates itself. Eliminate the bus short-circuits and start your application again.

Page 736: Industrial Communication With PG-PC

FAQs

736SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

10.13 FAQs on the FDL Protocol in SOFTNET PROFIBUS

I use the SCP_receive call in the synchronous mode but sometimes when the functionreturns there is no request block. Why does it do this?

Since the FDL interface with SOFTNET is available only for Windows NT andWindows 2000, and because the asynchronous mode must be used for Windowsprograms, the SCP_receive no longer supports the timeout parameter.This means that with SCP_receive, the value SCP_NOWAIT must always be usedin the timeout parameter.

How many request blocks and data buffers are available?

For the CP 5611, this is a fixed number; for the CP 5511 (PCMCIA card), thenumber depends on the DPRAM size available in the system. A request block isrequired for every job put on the FDL interface. All services that contain data in theuser areas of the request block (for example, SDN, SDA, SDR,AWAIT_INDICATION) require adequate data buffers during processing. The size ofthe data buffers used depends on the length of the data to be transferred.Refer to the following table:

CP Type RequestBlock

Buffersize256 by-tes

Buffersize 32 bytes

Buffersize16 bytes

Buffersize8 bytes

CP 5611 1420 768 325 325 325

CP 5511DPRAM60 KB

458 140 140 140 140

CP 551156 KB

437 128 135 135 135

CP 551148 KB

388 104 122 122 122

CP 551132 KB

255 68 76 76 76

CP 551124 KB

192 48 56 56 56

CP 551116 KB

129 28 36 36 36

CP 5511 8KB

66 8 16 16 16

Note:If no more buffers of a particular class are available, buffers from the next largerclass are allocated instead.

Page 737: Industrial Communication With PG-PC

FAQs

737SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Which parameter assignment do I need if I want to communicate with FDL over PROFIBUS?

The FDL protocol can be used with all parameter assignments. You must,however, specify FLC with SCP_open. If, for example, you set CP_L2_1: to DP master, you can run FDL if you executeSCP_open with the parameter /CP_L2_1:/FLC. With MPI, however, there is a special FDL parameter assignment that allows datalengths up to 246 bytes but does not tolerate any other protocol.

I use the GD (Global Data) S7 protocol in my PROFIBUS network. When I open SAPs in the range of the GD protocol on my PC, they continuouslyreceive broadcasts from the S7 PLCs. The communication partner, however, always sends to this SAP. How can Ifilter to receive the correct frames?

Set SAP_ACTIVATE so that the PC only receives frames from the requiredpartner. You can do this by specifying the station address of the partner in theaccess_station field in the fdl_sap structure. This filters the frames so that you onlyreceive them from this station.

Can I use all the FDL services of the CP 5412 (A2)/CP 5613 unchanged on the SOFTNET FDLinterface?

The SOFTNET FDL interface is compatible with the FDL interface of theCP 5412 (A2)/CP 5613.However, the following services are not available:

� FDL_READ_STATISTIC_CTR

� FDL_READ_LAS_STATISTIC_CTR

� LSAP_STATUS (only local SAPs, no remote access)

� FDL_IDENT

Specifying the role with SAP_Activate under SOFTNET FDL is also restricted: If Responder or Both_Roles is requested for one of the services, only this serviceis permitted and all others are blocked.If, however, Responder or Both_Roles is specified for two or more services, allservices are enabled.

Are their differences in the events compared with the CP 5412 (A2)/CP 5613?

Yes! The SOFTNET FDL interface reports the events not_syn, time_out,uart_error, duplicate_address, out_of_ring, hardware_error.Removing the PCMCIA card during operation results in the hardware_error event.

Page 738: Industrial Communication With PG-PC

FAQs

738SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

What does “network configuration” mean in terms of PROFIBUS ?Number of masters

The number of active stations specifies the number of active master stations in thenetwork. You set this value manually. The value must be set the same for allstations.

� Minimum possible value: 1

� Maximum possible value: the same as the setting for the highest PROFIBUSaddress

If you have activated the DP software package on your CP, you cannot set thenumber of active stations here.

Number of Slaves

The number of passive stations (slaves) is the number of stations on the networkthat do not initiate communication.The value must be set the same for all stations.

� Minimum possible value: 0

� Maximum possible value: 126

If you have activated the DP software package or the Scope PROFIBUS softwarepackage on your CP, you cannot set the number of passive stations here.

When using FDL, SCP_get_errno returns error codes that are not documented in my FDLmanual!

Here is a complete list of all the error codes

Error Code HexValue

Explanation

E_SUCCESS 0x0000

E_RESOURCES 0x012a Not enough system resources (for ex-ample, work memory).

E_PAR_ERR 0x012e Bad parameter – Check the functionparameters.

E_DPRAM 0x0132 No dual-port RAM or it cannot be writ-ten to.

SCP_RESOURCE 0x00ca Not enough system resources – Checkyour configuration.

SCP_CON-FIG_ERR

0x00cb Configuration error – Check your confi-guration.

SCP_ILLEGAL 0x00cd Invalid function call

SCP_PARAM 0x00ce Bad parameter – Check the functionparameters.

SCP_DEVOPEN 0x00cf Opening the device (SCP_OPEN) fai-led because it is already activated orusing the device (SCP_SEND) failedbecause the device is not yet activated.

Page 739: Industrial Communication With PG-PC

FAQs

739SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Error Code ExplanationHexValue

SCP_BOARD 0x00d0 Hardware (communications processor)not reacting. Check your configuration.

SCP_SOFTWARE 0x00d1 Undefined error in the driver

SCP_MEM 0x00d2 Lack of memory in the driver

SCP_NOMESS 0x00d7 No message exists

SCP_USERMEM 0x00d8 Access to the application buffer notpossible.

SCP_TIMEOUT 0x00db Timeout (SCP_receive) not relevant forSOFTNET

EUSERMAX 0x00e1 The maximum number of users for thedevice has been reached. Close a fewapplications.

SCP_EINTR 0x00e2 Job aborted

SCP_NO_WIN_SERV

0x00e9 A utility for initialization/synchronizationcould not be started. Reinstall.

EPROTECT 0x00ea License error. Reinstall.

SCP_DB_FILE_DOES_NOT_EXIST

0x00f0 No database specified, irrelevant forFDL

SCP_DB_FILE_CLOSE_NOT_OK

0x00f1 Failed to close the database, irrelevantfor FDL.

SCP_SEND_NOT_SUCCESSFUL

0x00f2 SCP_Send failed

SCP_RE-CEIVE_NOT_SUC-CESSFUL

0x00f3 SCP_Receive failed

SCP_NO_DE-VICE_AVAILABLE

0x00f4 No device available

SCP_ILLE-GAL_SUBSYSTEM

0x00f5 Invalid subsystem specified

SCP_ILLE-GAL_OPCODE

0x00f6 Invalid opcode specified

SCP_buf-fer_TOO_SHORT

0x00f7 Transfer buffer too short

SCP_buf-fer_1_TOO_SHORT

0x00f8 Transfer buffer 1 too short

SCP_ILLE-GAL_PROTO-COL_SEQUENCE

0x00f9 Illegal protocol sequence, irrelevant forFDL

Page 740: Industrial Communication With PG-PC

FAQs

740SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Error Code ExplanationHexValue

SCP_ILLE-GAL_PDU_ARRI-VED

0x00fa Invalid PDU received, irrelevant forFDL

SCP_RE-QUEST_ERROR

0x00fb Request failed

SCP_NO_LI-CENSE

0x00fc No license found, reinstall

E_INIT_COM 0x0301 Error in internal driver communication

E_NO_HW 0x0310 Module not found (module does notexist, bad settings on the module, in-correct configuration of the hardwareresources or incorrect installation).Check the configuration of the accesspoint in Set PG/PC Interface.

E_HW_DEFEKT 0x0311 Hardware error (possibly defective mo-dule)

E_CNF 0x0312 Bad configuration parameter

E_BAUDRATE 0x0313 Wrong baudrate or invalid interrupt. Re-configure the CP with Set PG/PC Inter-face.

E_HSA 0x0314 Bad HSA set. You can modify the busparameters in Set PG/PC Interface.

E_TS 0x0315 The station address set is alreadybeing used in the network. You can mo-dify this in Set PG/PC Interface.

E_OCC 0x0316 Hardware device already assigned, ir-relevant for SOFTNET.

E_INT_NOT_PROV

0x0317 The specified interrupt is not available.Reconfigure the CP with Set PG/PCInterface.

E_INT_BUSY 0x0318 There is an interrupt resource conflict.Reconfigure the CP with Set PG/PCInterface.

E_SAP 0x0319 SAP deactivate: SAP not in use

E_UNPLUGGED 0x031a No active PROFIBUS network found.Check whether the option ’PG/PC isthe only master on the bus’ is activatedin Set PG/PC Interface. Deactivate thisoption.

E_SYNI 0x031b This occurs when there are disturban-ces on the bus or when there is an in-terrupt conflict.

Page 741: Industrial Communication With PG-PC

FAQs

741SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Error Code ExplanationHexValue

E_AMPRO 0x031c Internal error

E_NO_FILE 0x0320 DLL/VxD file not found all the device isnot active. Reinstall.

E_NO_ENTRY 0x0321 The loaded DLL does not have this en-try. Reinstall.

E_VERSION 0x0330 Version conflict between SmartCabledriver and SmartCable firmware

E_NO_SMC 0x0332 Problem with COM port configurationfor SmartCable

E_ONLINE 0x0380 Internal error

E_LOGDEV 0x0381 The specified device parameter assign-ment could not be found. You cancreate and configure a logical devicewith the Set PG/PC Interface program.

E_L2DRIVER 0x0382 The layer 2 driver could not be started.Reinstall the product.

E_L4DRIVER 0x0384 The layer 4 driver could not be started.Reinstall the product.

E_SYSERROR 0x03FF Windows system error. You can findout the error number with GetLastEr-ror().

Page 742: Industrial Communication With PG-PC

FAQs

742SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 743: Industrial Communication With PG-PC

743SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Related Literature

You want to read the specifications of the OPC Foundation or require additionalinformation on a particular topic.

Your Area of Interest is dealt with in:

You want more detailed informationon a specific topic?

Other Available Literature

You would like detailed information onOPC Data Access and OPC Alarms &Events?

OPC Specifications

11.1 Other Available Literature

Which other documents can I read?

The following documents contain additional information on topics relating toSIMATIC NET.

� Network Manual for PROFIBUS

� Network Manual for Industrial Ethernet

� TF Manual

� DP-Base Programming Interface for CP 5613/CP 5614

11

Page 744: Industrial Communication With PG-PC

Related Literature

744SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

11.2 OPC Specifications

Which OPC Specifications exist?

The first and most fundamental specification of the OPC Foundation was the OPCData Access Specification. This provides management of process variables andvarious ways of accessing these variables.

The OPC Alarms & Events Specification covers the transfer of process alarmsand events. It is independent of the Data Access Specification.

Up to now, the OPC Foundation has published the following specifications alsoincluded on the CD SIMATIC NET Manual Collection:

OPC OverviewVersion 1.0, October 27, 1998

A brief introduction in the basic concept of OPC.

OPC Common Definition and InterfacesVersion 1.0, October 27, 1998

This document describes important interfaces available at all OPC servers.

Data Access Custom InterfaceVersion 1.1, September 11, 1997

The specification of the custom interface for Data Access, Version 1.1

Data Access Custom InterfaceVersion 2.04, September 5, 2000

The specification of the custom interface for Data Access, Version 2.04

Data Access Custom InterfaceVersion 2.05, December 17, 2001

The specification of the custom interface for Data Access, Version 2.05

Data Access Automation InterfaceVersion 2.02, February 4, 1999

The specification of the automation interface for Data Access, Version 2.02

OPC Alarms and EventsVersion 1.02, November 2, 1999

A description of the OPC Alarms & Events Server as well as the specification ofthe custom interface of this server.

Page 745: Industrial Communication With PG-PC

Related Literature

745SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Alarm & Events Automation InterfaceVersion 1.01, December 15, 1999

The specification of the automation interface of the OPC Alarms & Events Server.

OPC XML-DA Specification – Release CandidateVersion RC1.8, June 13, 2002

The Release Candidate of the specification of the OPC XML interface for DataAccess.

To come:

� Historical Data Access, handling historical process data.

� Batch handling.

Additional specifications for tasks of the automation will follow.

Page 746: Industrial Communication With PG-PC

Related Literature

746SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 747: Industrial Communication With PG-PC

747SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Glossary

AccessPathAccessPath is optional information for objects of the OPC Item class. The need for andthe interpretation of an access path depends on the particular server. The access pathspecifies (when necessary) the path via which the server should read or write the dataof a process variable. The access path can, for example, be a path or connectionname.

ActiveStatefor the Data Access interface: An OPC server can read, write, and monitor a processvariable. When monitoring, the server checks whether the value of the process variablehas changed after a specific interval. If the value has changed, the new value is sent tothe client automatically. The client can control the monitoring of a process variableusing the active state. Each group and each OPC item object has the active stateattribute. If a client wants to monitor a process variable, it sets the active state of theOPC item that represents the connection to this process variable to TRUE. The activestate of the group must also be set to TRUE. If a group is not active, there is nomonitoring of the process variables in the group.

Active nodeDuring communication over PROFIBUS, masters are known as active nodes orstations.

Actuator-sensor levelThe actuator-sensor level is an automation level. Within the actuator-sensor level, amaster communicates with the actuators and sensors attached to its network. The mainfeature of the actuator-sensor level is the fast reaction time for few data bits.

Alarmfor OPC Alarms & Events: An alarm is an event triggered by a condition that no longerrepresents the normal state.

AsynchronousDuring asynchronous access, the program continues to execute while data are read orwritten.

Automation levelLogical division of an automation system into separate levels to organize the tasksrequired of the system. Automation is divided into the following levels: managementlevel, cell level, field level and actuator-sensor level.

Page 748: Industrial Communication With PG-PC

Glossary

748SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Bus topologyThis is a network with a linear structure. All nodes are connected together via acommon network, the bus. The nodes can all communicate with each other, howevernot at the same time. Only one node can send at any one time and the other nodes areonly allowed to receive. The data exchange is controlled by network access methods.

Cachefor Data Access: The cache is an interim buffer for all variables that are referencedusing OPC items. The cache is global for all users. This means that if more than oneuser references the same variable, this is stored only once in the cache. Readoperations (read or refresh) can read the data from the server cache with theOPC_DS_CACHE option.

Canonical data typeThe canonical data type is the original data type of a variable as represented internallyand supplied by the OPC Server.

Categoriesfor Alarms & Events: With the aid of categories, the events supported by an OPC EventServer can be grouped and selected. The definition of the categories is left up to thevendor of an OPC Event Server, the OPC Specification defines a list of recommendedevent categories.

Cell levelThe cell level is an automation level. At this level, all automation and optimization tasksare processed independently. At the cell level, programmable controllers, PCs, anddevices for operator control and monitoring are interconnected.

Class modelThe OPC specification separates the available interfaces and their methods into variousclasses. This structure is known as a class model. A class contains several objects andspecifies which methods and properties these objects must have as representativesof the particular class.

Client-server principleData exchange, in which a client sends communication jobs and a server processes thejobs.

CLSIDIdentification code for OLE classes

Coaxial cableTransmission medium within the cell and management level in PROFIBUS andIndustrial Ethernet. Coaxial cables are made up of several layers: A mid conductor issurrounded by an insulation jacket, the insulating material is surrounded by a wire braid,the wire braid is surrounded by an insulation jacket. Coaxial cables are used forelectrical data transmission where simple cabling and straightforward expandability areprime concerns.

Page 749: Industrial Communication With PG-PC

Glossary

749SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

CommunicationCommunication means the transfer of data between two communication partners(devices or modules).

Communications processorProcessor for communication within automation systems. The communicationsprocessor is used to handle a communication process.

COMTo make objects implemented on different platforms or computer architecturescompatible with each other, it is necessary to specify how the platforms interpret anobject. To achieve this, the Component Object Model (COM) is used. COM defines thestandard for interaction between the components. COM allows calls within a process toa different process and even to a different computer.

COM libraryThe COM library is part of the operating system and manages information in a registerabout the COM objects known in the system, for example OPC servers. Whenaccessed by the client, the COM library finds the target object and establishes aconnection depending on its location: – Over the local COM mechanism if the targetobject and client are on the same computer – Over DCOM if the target object and clientare on different computers.

ConfiguringDuring configuration, protocol-specific system settings are made on a virtual device.

CSMA/CD(Carrier Sense Multiple Access with Collision Detection, standardized in IEEE 802.3)Stochastic (including a random element) medium access control technique. Every nodecan transmit at any time as long as the bus is not currently being used by another node.Conflicts arise due to the propagation time when two nodes begin to transmit at thesame time or within a very short time of each other while the bus is still free. The nodeslisten to the bus and detect the collision. They then start transmitting and only attemptto transmit following a randomized waiting time. Buses using the CSMA/CD techniquenormally operate at a transmission rate of 10 Mbps, for example Industrial Ethernet.

Data Communication:Data exchange between programmable controllers or between programmablecontrollers and computers.

DCOMThe object model for calls between different machines is known as DCOM (DistributedComponent Object Model) and is integrated in the operating system as of Windows NT4.0.

Detailed local stateThe detailed local state provides detailed information on the state of the local VFDusing an S7-specific information variable. To interpret the return value, you require thedescription of the local VFD. The data is transferred as data type VT_UI2.

Page 750: Industrial Communication With PG-PC

Glossary

750SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

DP ProtocolDP is the acronym for distributed peripheral I/Os and is used within SIMATIC NET forPROFIBUS. The DP protocol allows communication with distributed I/Os.

Electrical data transmissionType of data transmission on PROFIBUS and Industrial Ethernet. Standard electricaldata transmission is on shielded, twisted pair cable. Other cable types include: versionwith PE jacket, halogen-free version, underground cable, version for hazardous areas,and trailing cables.

EthernetTechnology for local area networks (LANs) and wide area networks (WANs). Ethernetstandardizes the procedures for interconnecting several computers. It specifies how thedata flow over the network cable is controlled. Ethernet uses the CSMA/CD (CarrierSense Multiple Access with Collision Detection) medium access control technique asspecified in the international standard 802.3. With this type of medium access control, aworkstation checks whether the transmission medium is free before it startstransmission. From a logical point of view, Ethernet networks are based on a bustopology. The transmission media include shielded coaxial cables, twisted pair cables,or fiber-optic cables. SIMATIC NET Industrial Ethernet uses both the Ethernet and FastEthernet standard.

Eventfor Alarms & Events: An event is any occurrence that might be of interest to the client.Although events can also degenerated due to a condition being met, they do not needto be related to conditions. Examples of events that are not related to conditionsinclude, for example, error messages from the communications system.

Expedited dataAccelerated transmission of small amounts of data. Expedited data is supported only byISO transport and not in TCP/IP.

Field levelThe field level is an automation level. It connects the automated production plants withthe programmable controllers. The field devices measure, signal, and pass on thecommands of the cell level to the plant or process. At this level, the volume of datatransferred is relatively small. A hierarchical communication structure is typical here; inother words, several field devices communicate with one master.

FETCHThe address of the requested data is sent to the partner, the partner then returns thedata. Communication is initiated by the OPC Server.

FMS communicationFMS is the acronym for Fieldbus Message Specification and is used within SIMATICNET for PROFIBUS. FMS provides services for transferring structured data. The FMSservice belongs to layer 7 of the ISO/OSI reference model.

Page 751: Industrial Communication With PG-PC

Glossary

751SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

FMS protocolFMS is the acronym for Fieldbus Message Specification and is used within SIMATICNET for PROFIBUS. FMS provides services for transferring structured data. The FMSservice belongs to layer 7 of the ISO/OSI reference model.

GANGlobal Area Network. This is a worldwide network connecting computers on differentcontinents. Such networks normally operate over satellite. There are varioustransmission rates and service classes. The transfer of a message from the source tothe target takes a perceptible time. Example: Internet.

Glass fiber cableTransmission medium within the cell and management level in PROFIBUS andIndustrial Ethernet. Glass fiber cables are fiber-optic cables used for optical datatransmission particularly when electrical isolation and immunity from electromagneticinterference are important.

Industrial Twisted Pair cableTransmission medium within the cell and management level in Industrial Ethernet. Atwisted-pair cable consists of two pairs of wires intertwined to produces a high immunityto interference The twisted-pair cables used in SIMATIC NET are known as IndustrialTwisted-Pair cable. These are used for electrical data transmission, particularly forstructured cabling within the factory.

In-process serverThe in-process server accesses the local server over the OPC Custom interface.An in-process server is in the same process area as the client and is only available forthis process. Normally in-process servers are implemented as DLLs.The OPC Automation interface is implemented as an in-process server.

Interface moduleMethod of attaching devices or computers in process communication. These devicesare not attached over an integrated interface but using interface modules (IM) orcommunications processors (CP).

ISO/OSI reference modelThe ISO/OSI reference model stipulates 7 logical layers in which the data exchangebetween partners in an open system is regulated. The layers are arranged one on topof the other (layer 7 is the highest layer) with each layer building on the layer below it.The ISO/OSI reference model is used, for example, to define the transmission system,access method, or connection establishment. Only peer layers communicated witheach other. The actual implementation of the individual layers is not specified by thereference model. The layers are as follows: Layer 1 (physical layer), Layer 2 (data-linklayer), Layer 3 (network layer), Layer 4 (transport layer), Layer 5 (session layer), Layer6 (presentation layer) and Layer 7 (application layer).

Page 752: Industrial Communication With PG-PC

Glossary

752SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

IT communicationAbbreviation for information technology. In the office, E-mail and Web browsers arenormally the tools of communication; the communication paths are generally Ethernet,telephone cables, and the Internet. The SIMATIC programmable controller isincorporated in IT communication over Industrial Ethernet. The communication toolsand paths of IT communication are also available to SIMATIC, since SIMATIC supportsthe TCP/IP protocol and in particular SMTP (Simple Mail Transfer Protocol) for E-mailand HTTP (Hyper Text Transfer Protocol) for access with Web browsers.

LAN (Local Area Network)Local area networks are systems that allow exchange of data between partner-orientednodes over high-performance communication media (for example fiber-optic or coaxialcable) within a limited area. The network operator is solely responsible for the local areanetwork. Due to their “private” nature, systems can be implemented that would beunthinkable in other types of network. LANs normally have a homogeneoustransmission structure supporting rates from 10 – 300 Mbps. They can be linkedtogether directly or over GANs and WANs to form larger structures. LAN services arenot provided by public bodies. Example: Industrial Ethernet, PROFIBUS

Layer 1 of the ISO/OSI reference modelThis is known as the physical layer. It is responsible for the transparent transmission ofa raw stream of bits in the order in which they were passed down from layer 2. Thefollowing factors are specified in layer 1: The type of data transmission, the physicaltransmission medium, the transmission rate and the electrical, mechanical, andfunctional properties of the cable. The particular feature of layer 1 is the range of datatransmission media available: coaxial cable, triaxial cable, fiber-optic cable, and twistedpair.

Layer 2 of the ISO/OSI reference model

Layer 3 of the ISO/OSI reference modelThis is known as the network layer. This is responsible for getting data from one nodeto another (sender and recipient). The following factors are specified in layer 3:Internetwork addresses, routing if the path involves several systems in transit, and flowcontrol. The particular feature of layer 3 is that it specifies how communication takesplace between two subnets.

Layer 4 of the ISO/OSI reference modelThis is known as the transport layer. This provides the user with a reliable connection.The following factors are specified in layer 4: Connection establishment, datatransmission, connection termination, packet retransmission, packet sequencing andassembly. The particular feature of layer 4 is the reliable transfer of data packets.

Layer 5 of the ISO/OSI reference modelThis is known as the session layer and it synchronizes the data prior to transmission.The following factors are specified in layer 5: How a connection is established,maintained, and terminated. Repetition of a transmission from a specificsynchronization point. The particular feature of layer 5 is coordination of the datatransmission session.

Page 753: Industrial Communication With PG-PC

Glossary

753SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Layer 6 of the ISO/OSI reference modelThis is known as the presentation layer. Participants in communication often ’speak’different languages. Prior to data exchange, layer 6 translates different systemlanguages into a uniform language with an abstract syntax. The following factors arespecified in layer 6: Data presentation and translation of the standardized presentationof the communications system into a device-specific form. The particular feature oflayer 6 is the implementation of a common communications language.

Layer 7 of the ISO/OSI reference modelThis is known as the application layer. This provides specific services for the variouscommunication applications. Application-specific communication services are specifiedin layer 7. The particular feature of layer 7 is the provision of communication servicessuch as: Read/Write and Start/Stop.

Local ServerA local server runs on the same computer as the client. Like every independentapplication, it has its own process area and name space. The OPC Server for SIMATICNET is a local server. It is implemented as an EXE file.

Logical stateThe logical state of an S7-specific information variable provides information on thesupported services. The data is transferred in the data type VT_BSTR.

Management levelThe management level is an automation level. At this level, wider-ranging tasks areexecuted and processed that affect the entire production or process operation(management functions). The tasks include storage of process values, handling ofoptimization and analysis processing functions and output of the results in the form ofreports. The required data are be collected for example from several process cells orfactories and processed centrally. It is possible to access other geographical locationsat the management level. The number of nodes can run into the thousands.

MAPAcronym for Manufacturing Automation Protocol. Standard for local area networks usedprimarily in factory automation.

masterMasters manage communication on the bus. Each master receives the token once percycle and can then exchange data with slaves or other masters. Once the token holdingtime has elapsed, the node passes the token on to the next master. The master isknown as an active node.

Master-slave principleBus access method in which an active PROFIBUS node (master) controls the entirebus data traffic centrally. It sends data to peripheral devices (slaves) and requests themto send their data. The slaves read the information from the master and output it to theperiphery. The master-slave principle is used mainly within the field level (for examplePROFIBUS-DP).

Page 754: Industrial Communication With PG-PC

Glossary

754SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

OCXAn OCX is an ActiveX control. These are COM objects that can be employed asreusable components in the form of controls.

OLEOLE, Acronym for Object Linking and Embedding. OLE is a technology for dataexchange between different Windows programs. OLE establishes a connectionbetween a Windows server program and a Windows container program. Objects fromthe server program can then be included in a document of the container program.

OPC class modelThe OPC specification groups the interfaces and their methods in three hierarchicalclasses: OPC Server, OPC Group and OPC Item. The OPC Server class is at the topof the model and has various attributes containing information on the status and versionof an OPC Server object. The OPC Group class manages the OPC items. With anOPC group, a client can form meaningful units of OPC items and execute operationswith them. The OPC item class represents the connection to a process variable. Anobject of the OPC Server class is a sort of container for an object of the OPC groupclass; this in turn is a container for objects of the OPC item class.

OPC clientstands for a Windows application with OPC capability, such as an operator control andmonitoring system.

OPC FoundationThe OPC Foundation was founded to define and document the standard for OPCinterfaces. The foundation is supported by SIEMENS and other leading companies fromthe automation branch. Microsoft guarantees conformity with Windows.

OPC ItemThe OPC item class is the lowest class in the OPC class model. An object belonging tothe OPC item class represents a connection to a process variable.

Optical data transmissionType of data transmission on PROFIBUS and Industrial Ethernet. Optical datatransmission is on fiber-optic cable with glass or plastic fibers for both indoors andoutdoors.

Passive nodeDuring communication over PROFIBUS, slaves are known as passive nodes orstations.

PG/OP communicationA PG is a programming device and an OP is an operator panel. PG/OP allows accessto the SIMATIC programmable controllers by the STEP 5 and STEP 7 configurationsoftware. The terms PG/OP communication and PG/OP protocol are synonymous.

PG/OP protocolA PG is a programming device and an OP is an operator panel. PG/OP allows accessto the SIMATIC programmable controllers by the STEP 5 and STEP 7 configurationsoftware. The terms PG/OP communication and PG/OP protocol are synonymous.

Page 755: Industrial Communication With PG-PC

Glossary

755SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Physical stateThe physical state of an S7-specific information variable provides information on theoperability of a real device. The data is transferred in the data type VT_BSTR.

PLCProgrammable logic controller. Interface between sensors and production machines,also used in communication and data transport between the user and the entireproduction sequences.

Point-to-point linkA point-to-point link allows data exchange over a serial link. It can be used betweenprogrammable controllers or between a programmable controller and computer.

PollingPolling is cyclic communication between DP stations. Polling means that during theproductive phase, the DP master sends cyclic polling frames to the DP slaves assignedto it. A separate polling frame is sent for each DP slave.

Process and field communicationProcess or field communication is used to connect of actuators and sensors toprogrammable logic controllers. The exchange of process signals with the actuatorsand sensors can be performed both cyclically or individually using a control command.For process and field communication SIMATIC NET has PROFIBUS-DP and theAS-Interface. To exchange signals in buildings, the EIB network is used.

PROFIBUSAcronym for Process Field Bus PROFIBUS – a standardized field bus system(standard: EN 50 170). PROFIBUS is a standardized communications system based onthe ISO/OSI reference model for communication between open systems andimplements the following layers: Layer 1 (physical layer), layer 2 (data-link layer) andlayer 7 (application layer). PROFIBUS therefore sets the standards for the transmissionmedium and medium access control as well as for user protocols and the userinterface. Data transmission is digital. To allow fast, real-time communication, theimplementation of layers 3 through 6 was deliberately omitted in PROFIBUS. Thefunctionality of these layers is provided by the LLI (Lower Layer Interface). The LLI isalso used to interface layer 7 with layer 2. Physically, PROFIBUS is an electricalnetwork using shielded twisted pair or an optical network using fiber-optic cable.

PROFIBUS-PAPROFIBUS-PA extends PROFIBUS-DP by the use of optimized transmissiontechniques for field devices (for example for supplying power to field devices over thedata line and use in hazardous areas) while retaining the communications functions ofPROFIBUS-DP. PROFIBUS-PA defines a variant of PROFIBUS-DP that allows the useof PROFIBUS in intrinsically safe areas while maintaining system integration inPROFIBUS-DP.

ProgIDUnique OPC server name assigned by the vendor.

Page 756: Industrial Communication With PG-PC

Glossary

756SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

ProtocolA protocol is a set of rules agreed between two communication partners to allow themto communicate with each other. According to the ISO/OSI reference model, suitableprotocols are defined for each layer. Among other things, a protocol specifies thefollowing aspects of data exchange: Mode, connection establishment, data security,and transmission rate.

QualityThis provides information indicating whether or not the value of a variable could beobtained reliably. From this, you can draw conclusions about the validity of the value.

Redundant ring topologyNetwork structure as a special form of the bus topology. In the redundant ring topology,the bus structure is closed to form a ring. A fiber-optic cable serves as the transmissionmedium. The redundant ring topology ensures continuity of communication even iffaults develop in the network. If, for example, a communication node fails or if thefiber-optic cable is broken, the network reconfigures itself within a few milliseconds to afunctioning bus.

Remote serverA remote server is located on another computer. It can be accessed by the client over anetwork connection.

Ring topologyThis is a network with a ring structure. Each node has exactly one node before it andone after it. Data travels in the ring from a sender to a recipient. The data is transmittedonly in one direction through the entire network. The failure of a network node meansthe failure of the entire network.

S7 communication, S7 protocolThis is used for communication within the SIMATIC S7 and SIMATIC M7 programmablecontroller and for communication between these systems and PCs. The terms S7communication and S7 protocol are synonymous.This is known as the data-link layer. This controls the data flow and is responsible fordetecting, reporting, and correcting transmission errors. The following factors arespecified in layer 2: Medium access control, grouping of data into frames, and reliabledata transmission. The particular feature of layer 2 is the ability to select between thefollowing bus access methods: CSMA/CD and token access methods.

SEND/RECEIVE communicationSEND/RECEIVE is used for reliable data transfer between SIMATIC S7 and SIMATICS5 programmable controllers. SEND/RECEIVE belongs to layer 2 of the ISO/OSIreference model in PROFIBUS and layer 4 in Industrial Ethernet. The termsSEND/RECEIVE communication and SEND/RECEIVE protocol are synonymous.

SEND/RECEIVE protocolSEND/RECEIVE is used for reliable data transfer between SIMATIC S7 and SIMATICS5 programmable controllers. SEND/RECEIVE belongs to layer 2 of the ISO/OSIreference model in PROFIBUS and layer 4 in Industrial Ethernet. The termsSEND/RECEIVE communication and SEND/RECEIVE protocol are synonymous.

Page 757: Industrial Communication With PG-PC

Glossary

757SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

SIMATIC programmable controllerA SIMATIC programmable controller is a fully integrated system for all automation tasksin industry. SIMATIC PLCs execute all the functions required in automation engineeringfor which various special systems were previously required. Products of other vendorscan be integrated in the system over standardized interfaces. SIMATIC is at work in awide variety of branches, for example the automobile industry, chemicals industry,building automation, semiconductor industry, Power station technology, machinebuilding industry, foodstuffs industry, paper and printing industry, traffic controltechnology, and water supply and effluent disposal technology There are various seriesof SIMATIC programmable controllers: SIMATIC S7/M7/C7, SIMATIC PG/PC, SIMATICHMI, SIMATIC S5, and SIMATIC 505.

SlaveSlave devices cannot initiate communication. They do not receive the token andrespond only to polls from the master. Slaves are therefore known as passive nodes.

SNMPSimple Network Management Protocol, a UDP-based, open protocol for managingnetworks.

SR protocolThe SEND/RECEIVE protocol is used for reliable data transfer between SIMATIC S7and SIMATIC S5 programmable controllers. SEND/RECEIVE belongs to the data linklayer, layer 4 of the ISO/OSI reference model. The terms SEND/RECEIVEcommunication and SEND/RECEIVE protocol are synonymous.

Star topologyThis is a network with a star structure. All the nodes are connected over the networkwith a server that organizes the data transfer. Failure of the server means failure of theentire network; the failure of one node does not block the network.

SynchronousDuring synchronous access, the program stops executing until a variable is read orwritten.

TCP/IPAcronym for Transmission Control Protocol/Internet Protocol TCP is a protocol thatorganizes the establishment and termination of a connection between two networks,controls data flow, and checks that data transfer is complete. IP is a protocol thatorganizes and addresses data. TCP/IP is used in worldwide and local area networks.

Transmission mediumData exchange takes place over various media. The various media differ in the span,immunity to noise, and the transmission rate. Listed in order of increasing complexityand performance, the following transmission media can be used: two-wire cable,untwisted, unshielded (for example for AS-Interface) Industrial Twisted Pair, unshielded(for example for EIB) Industrial Twisted Pair, shielded (for example for PROFIBUS)coaxial cable (for example for Industrial Ethernet) triaxial cable (for example forPROFIBUS) fiber-optic cable (for Industrial Ethernet and PROFIBUS).

Page 758: Industrial Communication With PG-PC

Glossary

758SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Tree topologyThis is a network with a tree structure. All nodes are attached to the network over acable. A tree-structured network is a concatenation of several bus structures of differentlengths.

Time stampFrom the time stamp, you can see when the value of the queried variable was acquired.

TopologyThe topology describes the network structure. It determines how a network (thetransmission medium) and the attachable devices or computers are interconnected.Possible structures are linear bus, star, ring, redundant ring and tree.

Triaxial cableThis is also known as shielded two-wire cable. Transmission medium within the cell andmanagement level in PROFIBUS and Industrial Ethernet. Triaxial cables are shieldedcoaxial cables; in other words they have an additional sealed aluminum outer jacket.Triaxial cables are used in electrical data transmission. They are particularly suited toan industrial environment since they are protected from external interference by theirgrounded shield.

UTCUTC (Universal Time Coordinated) is the standard world time previously known asGreenwich Mean Time.

ValueWhen a variable is queried, the corresponding value is obtained from the latest processdata and returned. This might be the value of a sensor, control parameter, statusinformation, or the status of the network connection.

VariablesVariables are placeholders that are replaced by the current values.

VFD (Virtual Field Device)A VFD simulates a field device. The OPC server registers on the VFD duringconfiguration.

Virtual devicealso known as VFD (Virtual Field Device). A VFD simulates a field device. The OPC server registers on the VFD duringconfiguration.

WAN (Wide Area Network)Connects computers in the same or in different countries (or even continents). Thenetworks are operated on metallic cables, in exceptional cases also on fiber-opticcables. Within a network, there are usually different transmission rates. Thetransmission from the source to the destination takes a perceptible time. WANs canalso be connected to GANs or can be extended to form GANs themselves. LANservices are often provided by public bodies. Example: DATEX-P network of theGerman Post Office.

Page 759: Industrial Communication With PG-PC

Glossary

759SIMATIC NET Industrial Communication with PG/PCC79000–G8976–C172–02

Wireless transmissionTransmission medium for PROFIBUS. Wireless data transmission makes use of theInfrared Link Module (ILM) with a range of 15 m.

Page 760: Industrial Communication With PG-PC

Glossary

760SIMATIC NET Industrial Communication with PG/PC

C79000–G8976–C172–02

Page 761: Industrial Communication With PG-PC

A&D Technical SupportWorldwide, available 24 hours a day:

Beijing

Nuernberg

Johnson City

Worldwide (Nuernberg)Technical Support

24 hours a day, 365 days a year

Phone: +49 (0) 180 5050-222

Fax: +49 (0) 180 5050-223

E-Mail: [email protected]

GMT: +1:00

Europe / Africa (Nuernberg)Authorization

Local time: Mon.-Fri. 8:00 to 17:00

Phone: +49 (0) 180 5050-222

Fax: +49 (0) 180 5050-223

E-Mail: [email protected]

GMT: +1:00

United States (Johnson City)Technical Support andAuthorizationLocal time: Mon.-Fri. 8:00 to 17:00

Phone: +1 (0) 423 262 2522

Fax: +1 (0) 423 262 2289

E-Mail: simatic.hotline@

sea.siemens.com

GMT: -5:00

Asia / Australia (Beijing)Technical Support andAuthorizationLocal time: Mon.-Fri. 8:00 to 17:00

Phone: +86 10 64 75 75 75

Fax: +86 10 64 74 74 74

E-Mail: adsupport.asia@

siemens.com

GMT: +8:00The languages of the SIMATIC Hotlines and the authorization hotline are generally German and English.

Page 762: Industrial Communication With PG-PC

A&D Technical Support

A&D Technical Support

Service & Support on the InternetIn addition to our documentation, we offer our Know-how online on the internet at:http://www.siemens.com/automation/service&support

where you will find the following:

• The newsletter, which constantly provides you with up-to-date information onyour products.

• The right documents via our Search function in Service & Support.

• A forum, where users and experts from all over the world exchange theirexperiences.

• Your local representative for Automation & Drives via our representativesdatabase.

• Information on field service, repairs, spare parts and more under "Services".