Sie sind auf Seite 1von 446

SIMATIC NET

Introduction to the OPC Server for SIMATIC NET

Manual

1 Overview of the OPC Server for SIMATIC NET

2 Quick Start

3 Basics of OLE

4 Basics of OPC

5 Structure of the OPC Items for the SIMATIC NET Data Access Interface

6 Properties of the OPC Event Server for SIMATIC NET

7 Configuration of the OPC Server for SIMATIC NET

8 Configuration Using Files

9 DCOM with the OPC-Server for SIMATIC NET

10 The OPC Custom Interface for Data Access

11 The OPC Automation Interface for Data Access

12 The OPC Custom Interface for Alarms & Events

13 Where to Get Help

14 Glossary

A SIMATIC Computing

6GK1971-0BA00-0AA1 Release 3

SIMATIC NET is a trademark of Siemens


Siemens Aktiengesellschaft
Wir haben den Inhalt der Druckschrift auf Weitergabe sowie Vervielfältigung dieser Unterlage,
Übereinstimmung mit der beschriebenen Hard- und Verwertung und Mitteilung ihres Inhalts nicht gestattet,
Software geprüft. Dennoch können Abweichungen soweit nicht ausdrücklich zugestanden.
nicht ausgeschlossen werden, so daß wir für die Zuwiderhandlungen verpflichten zu Schadenersatz.
vollständige Übereinstimmung keine Gewähr Alle Rechte vorbehalten, insbesondere für den Fall
übernehmen. Die Angaben in der Druckschrift der Patenterteilung oder GM-Eintragung.
werden jedoch regelmäßig überprüft. Notwendige
Korrekturen sind in den nachfolgenden Auflagen 6GK1971-0BA00-0AA1
enthalten. Für Verbesserungsvorschläge sind wir Copyright © Siemens AG 1997
dankbar. All Rights Reserved
Technische Änderungen vorbehalten.

We have checked the contents of this manual for The reproduction, transmission or use of this
agreement with the hardware described. Since document or its contents is not permitted without
deviations cannot be precluded entirely, we cannot express written authority. Offenders will be liable for
guarantee full agreement. However, the data in this damages. All rights, including rights created by patent
manual are reviewed regularly and any necessary grant or registration of a utility or design, are reserved.
corrections included in subsequent editions.
Suggestions for improvement are welcome. 6GK1971-0BA00-0AA1
Technical data subject to change. Copyright © Siemens AG 1997
All Rights Reserved

Nous avons vérifié la conformité du contenu du Toute communication ou reproduction de ce support


présent manuel avec le matériel et le logiciel qui y d'informations, toute exploitation ou communication de
sont décrits. Or, des divergences n'étant pas son contenu sont interdites, sauf autorisation
exclues, nous ne pouvons pas nous porter garants expresse. Tout manquement à cette règle est illicite et
pour la conformité intégrale. Si l'usage du manuel expose son auteur au versement de dommages et
devait révéler des erreurs, nous en tiendrons compte intérêts. Tous nos droits sont réservés, notamment
et apporterons les corrections nécessaires dès la pour le cas de la délivrance d'un brevet ou celui de
prochaine édition. Veuillez nous faire part de vos l'enregistrement d'un modèle d'utilité.
suggestions.
6GK1971-0BA00-0AA1
Nous nous réservons le droit de modifier les Copyright © Siemens AG 1997
caractéristiques techniques. All Rights Reserved

Siemens Aktiengesellschaft Elektronikwerk Karlsruhe


Printed in the Federal Republic of Germany
SIMATIC NET
Introduction to the OPC Server for SIMATIC NET

Manual C79000-B8976-C126/3
Note

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

We would further point out that, for reasons of clarity, these operating instructions cannot deal with every possible problem
arising from the use of this device. Should you require further information or if any special problems arise which are not
sufficiently dealt with in the operating instructions, please contact your local Siemens representative.

General
This device is electrically operated. In operation, certain parts of this device carry a dangerously high
voltage.

WARNING !
Failure to heed warnings may result in serious physical injury and/or material damage.
!
Only appropriately qualified personnel may operate this equipment or work in its vicinity. Personnel
must be thoroughly familiar with all warnings and maintenance measures in accordance with these
operating instructions.

Correct and safe operation of this equipment requires proper transport, storage and assembly as well
as careful operator control and maintenance.

Personnel qualification requirements

Qualified personnel as referred to in the operating instructions or in the warning notes are defined as persons who are
familiar with the installation, assembly, startup and operation of this product and who possess the relevant qualifications for
their work, e.g.:

− Training in or authorization for connecting up, grounding or labeling circuits and devices or systems in accordance with
current standards in safety technology;

− Training in or authorization for the maintenance and use of suitable safety equipment in accordance with current
standards in safety technology;

− First Aid qualification.

Siemens Aktiengesellschaft Elektronikwerk Karlsruhe


Printed in the Federal Republic of Germany
Contents

Contents

1 Overview of the OPC Server for SIMATIC NET .......................................................13


1.1 OPC Interface ................................................................................................14
1.2 OPC Server, OPC Server for SIMATIC NET ..................................................16
1.3 Advantages of the OPC Server ......................................................................18
1.4 Background Knowledge ..................................................................................19
1.5 Guide to the Documentation ...........................................................................20
2 Quick Start ................................................................................................................21
2.1 Installing and Starting up the Underlying Communications System .................22
2.1.1 Installing the DP Protocol ...............................................................................23
2.1.2 Installing the S7 Protocol ................................................................................24
2.1.3 Starting Up the S7 Protocol for Alarms & Events ............................................25
2.1.4 Installing the FMS Protocol.............................................................................26
2.1.5 Installing the Send/Receive Protocol for Industrial Ethernet............................28
2.1.6 Installing the Send/Receive Protocol for PROFIBUS (FDL) ............................30
2.1.7 Commissioning the DP Slave .........................................................................32
2.2 Simulation Connections of the OPC Server ....................................................33
2.2.1 Working with the Simulation Connection.........................................................34
2.3 Description of the Quick Start .........................................................................35
2.4 Using the Quick Start......................................................................................36
3 Basics of OLE ...........................................................................................................39
3.1 COM as the Basis for OPC.............................................................................40
3.2 Objects and Interfaces....................................................................................41
3.3 Standard Representation of Objects in OLE ...................................................43
3.4 Object Control Via the Automation Interface...................................................44
4 Basics of OPC...........................................................................................................45
4.1 The Role of OLE in OPC ................................................................................46
4.2 The OPC Specifications .................................................................................47
4.3 The Two Interfaces of OPC ............................................................................48
4.4 The Class Model of OPC Data Access............................................................50
4.5 The Principle of OPC Alarms & Events...........................................................52
4.6 Group Operations...........................................................................................55
4.7 The Client-Server Architecture of OPC...........................................................56
4.8 Terminology of the OPC Interface Description................................................58
5 Structure of the OPC Items for the SIMATIC NET Data Access Interface..............63

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 5
Contents

5.1 General Information........................................................................................64


5.2 DP Protocol ....................................................................................................66
5.2.1 Specifications for the DP Protocol ..................................................................66
5.2.2 Syntax of Variable Names for DP ...................................................................67
5.2.3 Syntax of Variable Names for DPC1 Access...................................................70
5.2.4 DP-Specific Information Variables ..................................................................72
5.3 S7 Protocol.....................................................................................................76
5.3.1 Specifications for the S7 Protocol ...................................................................76
5.3.2 Syntax of Variable Names for S7 (Variable Services) .....................................78
5.3.3 Syntax of Variable Names for Field-Oriented Services ...................................81
5.3.4 Syntax of Variable Names for Messages ........................................................84
5.3.5 Information Variables Specific to S7...............................................................88
5.3.6 Special Variables for Domain and Password Services ....................................92
5.4 FMS Protocol .................................................................................................98
5.4.1 Specifications for the FMS Protocol................................................................98
5.4.2 Syntax of Variable Names for FMS ..............................................................100
5.4.3 Information Variables Specific to FMS..........................................................102
5.4.4 FMS Server Connection ...............................................................................106
5.5 Send/Receive Protocol via Industrial Ethernet ..............................................107
5.5.1 Specifications for the Send/Receive Protocol ...............................................107
5.5.2 Syntax of Variable Names for SR .................................................................111
5.5.3 Information Variables Specific to SR ............................................................116
5.6 Send/Receive Protocol via PROFIBUS (FDL) ..............................................117
5.6.1 Specifications for the Send/Receive Protocol via PROFIBUS (FDL).............117
5.6.2 Syntax of Variable Names for FDL ...............................................................120
5.6.3 Information Variables Specific to FDL...........................................................124
5.7 DPS Protocol................................................................................................126
5.7.1 Specifications for the DPS Protocol ..............................................................126
5.7.2 Syntax of Variable Names for DPS...............................................................127
5.8 Symbolic Variable Names (Aliases) ..............................................................131
6 Properties of the OPC Event Server for SIMATIC NET ........................................133
6.1 General Information......................................................................................134
6.2 S7 Protocol...................................................................................................135
6.2.1 Events and Parameters ................................................................................136
6.2.2 Event Attributes............................................................................................138
7 Configuration of the OPC Server for SIMATIC NET..............................................143
7.1 General Information......................................................................................144
7.2 General Settings for all Protocols .................................................................145
7.3 Protocol Settings Specifically for DP ............................................................147
7.4 Protocol Settings Specifically for S7 .............................................................149
7.5 Protocol Settings Specifically for FMS..........................................................152
7.6 Protocol Settings Specifically for Send/Receive ...........................................156
7.7 Protocol Settings Specifically for FDL...........................................................158
7.8 Protocol Settings Specifically for DPS ..........................................................160
7.9 Trace for a Specific Protocol ........................................................................162

Introduction to the OPC Server for SIMATIC NET


6 6GK1971-0BA00-0AA1
Contents

7.10 Quitting the OPC Server...............................................................................163


7.11 Symbols for the OPC Server for SIMATIC NET............................................164
7.11.1 The Symbol File with STEP 7 Symbols ........................................................165
7.11.2 Creating a Symbol File with STEP 7 Symbols ..............................................167
7.11.3 Entering Additional Symbols.........................................................................170
7.11.4 Using Symbols in OPC .................................................................................172
8 Configuration Using Files ......................................................................................175
8.1 Configuration Files .......................................................................................176
8.2 Configuring Access Rights............................................................................177
8.3 DP Protocol ..................................................................................................179
8.3.1 General Protocol Configuration.....................................................................180
8.3.2 Module-Specific Configuration......................................................................181
8.3.3 Slave Configuration......................................................................................183
8.3.4 Definition of Symbolic Names.......................................................................184
8.3.5 Configuration of the DP Demo Connection ...................................................185
8.4 S7 Protocol...................................................................................................187
8.4.1 General Protocol Configuration.....................................................................188
8.4.2 Connection-Specific Configuration................................................................190
8.4.3 Definition of Symbolic Names.......................................................................193
8.4.4 Settings for S7 Messages .............................................................................194
8.4.5 Configuration of the S7 Demo Connection....................................................195
8.5 FMS Protocol ...............................................................................................196
8.5.1 General Protocol Configuration.....................................................................197
8.5.2 Connection-Specific Configuration................................................................199
8.5.3 Variable Definition ........................................................................................201
8.5.4 Definition of Symbolic Names.......................................................................203
8.5.5 Configuration of the FMS Server Connection................................................204
8.5.6 Configuration of the FMS Demo Connection.................................................207
8.5.7 Creating a Local Object Dictionary ...............................................................209
8.6 Send/Receive Protocol .................................................................................210
8.6.1 General Protocol Configuration.....................................................................211
8.6.2 Connection Configuration for a Specific Access Point...................................212
8.6.3 Connection-Specific Configuration................................................................214
8.6.4 Configuration of the Demo Connection .........................................................217
8.7 Send/Receive Protocol for PROFIBUS (FDL) ...............................................218
8.7.1 General Protocol Configuration.....................................................................219
8.7.2 Connection Configuration for a Specific Access Point...................................220
8.7.3 Connection-Specific Configuration................................................................221
8.7.4 Configuration of the FDL Demo Connection .................................................223
8.7.5 Dynamic Connections...................................................................................224
8.8 DPS Protocol................................................................................................225
8.8.1 General Protocol Configuration.....................................................................226
8.8.2 Connection-Specific Configuration................................................................227
8.8.3 Configuration of the DPS Demo Connection.................................................229
9 DCOM with the OPC Server for SIMATIC NET ......................................................231
9.1 Introduction to DCOM...................................................................................232
9.2 Configuring DCOM Operation.......................................................................233
9.2.1 Configuration of the Server Computer ..........................................................236

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 7
Contents

9.2.2 Configuration of the Client Computer............................................................241


10 The OPC Custom Interface for Data Access .........................................................243
10.1 Versions of the OPC Interface ......................................................................244
10.2 Creating and Using an OLE Object in C/C++ ................................................245
10.3 Further Information about the Interface Description for the OPC Custom
Interface .......................................................................................................248
10.4 The “OPC Server” Object .............................................................................249
10.4.1 IOPCServer Interface ...................................................................................250
10.4.2 IOPCBrowseServerAddressSpace Interface .................................................252
10.4.3 IOPCCommon Interface (Version 2.0) ..........................................................254
10.4.4 IConnectionPointContainer Interface ............................................................256
10.4.5 IOPCItemProperties (V 2.0) Interface ...........................................................257
10.5 Objects of the “OPC Group” Class................................................................258
10.5.1 IOPCItemMgt Interface.................................................................................259
10.5.2 IOPCGroupStateMgt Interface......................................................................262
10.5.3 IOPCSyncIO Interface..................................................................................264
10.5.4 IOPCAsyncIO Interface ................................................................................265
10.6 IDataObject Interface ...................................................................................267
10.6.1 IEnumOPCItemAttributes Interface...............................................................268
10.6.2 IAsyncIO2 Interface (Version 2.0) .................................................................269
10.6.3 IConnectionPointContainer Interface ............................................................271
11 The OPC Automation Interface for Data Access...................................................273
11.1 Versions of the Automation Interface ............................................................274
11.2 Creating and Using an OLE Object in Visual Basic .......................................275
11.3 Further Information about the Interface Description for the OPC Automation
Interface .......................................................................................................279
11.4 The “OPC Server” Object .............................................................................281
11.4.1 Properties of "OPCServer“ ...........................................................................281
11.4.2 Methods of the "OPCServer“ ........................................................................282
11.4.3 Events of "OPCServer" ................................................................................285
11.5 The "OPCBrowser“ Object ............................................................................286
11.5.1 Properties of "OPCBrowser“ .........................................................................286
11.5.2 Methods of "OPCBrowser"............................................................................287
11.6 The "OPCGroups“ Collection Object.............................................................289
11.6.1 Properties of "OPCGroups“ ..........................................................................290
11.6.2 Methods of "OPCGroups“ .............................................................................291
11.6.3 Events of "OPCGroups“................................................................................292
11.7 The "OPCGroup“ Object...............................................................................293
11.7.1 Properties of "OPCGroup“ ............................................................................293
11.7.2 Methods of "OPCGroup“...............................................................................295
11.7.3 Events of "OPCGroup“ .................................................................................297
11.8 The "OPCItems“ Collection Object ...............................................................298
11.8.1 Properties of "OPCItems“ .............................................................................298
11.8.2 Methods of "OPCItems“................................................................................299
11.9 The "OPCItem“ Object..................................................................................302
11.9.1 Properties of "OPCItem“...............................................................................303

Introduction to the OPC Server for SIMATIC NET


8 6GK1971-0BA00-0AA1
Contents

11.9.2 Methods of "OPCItem“ .................................................................................305


12 The OPC Custom Interface for Alarms & Events ..................................................307
12.1 Supplement to the Interface Description of the OPC Custom Interface for
Alarms & Events...........................................................................................308
12.2 The "OPC Event Server" Object ...................................................................309
12.2.1 The "IOPCEventServer" Interface ................................................................310
12.3 The "OPC Event Subscription" Object ..........................................................316
12.3.1 The "IOPCEventSubscriptionMgt" Interface..................................................317
12.4 The Interfaces of the Client ..........................................................................320
12.4.1 The "IOPCEventSink" Interface ....................................................................321
12.4.2 The "IOPCShutdown" Interface.....................................................................322
13 Where to Get Help...................................................................................................323
13.1 Help with Technical Questions......................................................................324
13.2 Who to Contact about Training for SIMATIC NET Products..........................327
14 Glossary ..................................................................................................................329

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 9
Notes for the Reader

Introduction to the OPC Server for SIMATIC NET


10 6GK1971-0BA00-0AA1
Notes for the Reader

Notes for the Reader

Guide to the The documentation for the OPC Server for SIMATIC NET consists of
Documentation two parts
• "Introduction to the OPC Server for SIMATIC NET" (this manual)
• "OLE for Process Control Standard" - OPC Interface Description
These manuals are available only:
− in English
− as files that are written to the "DOC" folder during installation of
the product. You can read and print these files using a word
processing program capable of opening Word 6.0 compatible
files.

Conventions The text includes the following symbol:

☞ This character highlights special features and dangers.

History This manual is valid for product versions V 2.1 and higher.
Descriptions of the following product properties have been added in
this release of the manual:

Product Version Content of the Manual

up to V2.0 OPC Data access for DP, S7, FMS,


Send/Receive
V2.1 Added: OPC alarms & events, extraction of STEP
7 symbols, definition of rights for OPCItems
(access protection), S7 domain and password
services
V2.2

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 11
Notes for the Reader

Introduction to the OPC Server for SIMATIC NET


12 6GK1971-0BA00-0AA1
Overview of the OPC Server for SIMATIC NET

1 Overview of the OPC Server for SIMATIC NET

The open network concept of SIMATIC NET provides industrial communications


networks for automation engineering. These consist of network components and
programs for network access.
This chapter provides you with an overview of the functions of the OPC server. It
illustrates the advantages of using OPC in industrial communication. The guide to the
documentation shows you what you ought to read according to your experience and prior
knowledge.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 13
Overview of the OPC Server for SIMATIC NET

1.1 OPC Interface

OPC OPC is an acronym for OLE for Process Control and is used as the
name for a standard interface for communication in automation
engineering. OLE itself means the component model of Microsoft.
Components are the software objects or applications that provide their
functionality to other applications.

OPC Interface The OPC interface is the specification of a uniform and vendor-
independent software interface based on OLE. It was developed as
an industrial standard by leading firms in the field of automation with
the support of Microsoft.

Previously, applications that access process data were restricted to the


access techniques of the communication networks of one
manufacturer. The standardized OPC interface now allows a user,
who, for example, operates control and monitoring software, uniform
access to communication networks of any vendor via the OPC
interface.

Introduction to the OPC Server for SIMATIC NET


14 6GK1971-0BA00-0AA1
Overview of the OPC Server for SIMATIC NET

OPC Specification: Apart from the specification for access to process data (data access),
the OPC standard includes further specifications for other areas of
automation engineering:
• Alarms & Events
• Historical Data Access

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 15
Overview of the OPC Server for SIMATIC NET

1.2 OPC Server, OPC Server for SIMATIC NET

OPC Server An OPC server is a program that provides the standardized OPC
interface for applications from various manufacturers.
Communication via industrial networks is possible with simple calls.
The, at times, complicated handling of vendor-specific characteristics
on communications networks is disguised by the OPC server.
Regardless of the communications network and protocol being used,
access to the process via the OPC interfaces is always uniform.
An OPC server forms an intermediate layer between the applications
allowing process data, the various network protocols and interfaces for
access to this data to be processed.

OPC Server for The OPC server of SIMATIC NET allows Windows applications access
SIMATIC NET to SIMATIC NET products for industrial communication. The
requirement for connecting your applications with SIMATIC NET
products is the use of the open OPC interface. The interface to the
products of SIMATIC NET is implemented by the OPC server for
SIMATIC NET.

The OPC server for SIMATIC NET supports the interface "OPC Data
Access" for all protocols. The "OPC Alarms & Events" interface is
available for those protocols whose protocol mechanisms support the
sending of events. (For details of the product version, refer to the
section "Notes for the Reader").

Additional To access process variables and receive events via the OPC server
SIMATIC NET for SIMATIC NET, you also require a protocol software belonging to
Components SIMATIC NET and a SIMATIC NET communications processor.
Required

Introduction to the OPC Server for SIMATIC NET


16 6GK1971-0BA00-0AA1
Overview of the OPC Server for SIMATIC NET

OPC Server for The following diagram illustrates an OPC server for SIMATIC NET
SIMATIC NET with along with an application known as the OPC client.
OPC Client The OPC server for SIMATIC NET provides the OPC client with the
values of process variables or signals events from the partner device.
The OPC server for SIMATIC NET accesses the partner device via the
communications network using the protocol software and the
SIMATIC NET communications processor.

Application – OPC client


(e.g. operator control and monitoring)
heterogeneous
OPC interface
OPC server for SIMATIC NET

Data Access Alarms & Events

Protocol software from


SIMATIC NET

Communications processor from


SIMATIC NET
Comm. network from
SIMATIC NET

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 17
Overview of the OPC Server for SIMATIC NET

1.3 Advantages of the OPC Server

Advantages when If you use the OPC server for SIMATIC NET along with the
Installing a System SIMATIC NET protocols, you have the following benefits:
• You use a protocol-independent interface.
• You obtain simple access to the communications networks of
SIMATIC NET.
• You can connect your programmable controllers to a wide variety of
automation engineering applications via a SIMATIC NET
communications network.
• Communication is also possible with office applications such as
Microsoft Excel, Access etc.
• Using the OLE mechanism “DCOM”, applications installed on other
computers can access the services provided by the OPC server via
a local or global network (Internet).

Benefits for the When you develop an application that accesses process data via the
Developer OPC interface of an OPC server for SIMATIC NET, you have the
following benefits:
• The OPC interface is a heterogeneous (vendor-independent)
interface. This opens up a larger market for your product, increases
the usability of your developments, and makes your investment
more viable.
• The developed applications are not dependent on the
communications system of one manufacturer and with appropriate
programming can communicate unchanged with the OPC servers
of other manufacturers.
• The OPC interface provides applications with a powerful means of
access to OPC servers and the underlying communications
networks.
• OPC has a high-performance interface for the C/C++ programming
language.
• Convenient and simple access to process data is possible with
development environments such as Visual Basic (Microsoft).
• The developer no longer needs to be involved with protocol and
vendor-specific interfaces.
• Troubleshooting is simplified with the option of a trace output.

Introduction to the OPC Server for SIMATIC NET


18 6GK1971-0BA00-0AA1
Overview of the OPC Server for SIMATIC NET

1.4 Background Knowledge

User Groups The OPC server for SIMATIC NET is used by the following user
groups:
• Developers of client applications (products for automation
engineering)
• Installation personnel
If you are using OPC client applications exclusively, the following
information is unnecessary. The OPC client-server architecture is
transparent for the user.

Background The following table shows the required background knowledge for
Knowledge different user groups.

Background Knowledge Developers of Client Installation


Applications personnel
Knowledge of PCs yes yes
Knowledge of the C/C++ yes, if the custom no
programming languages interface is used
Knowledge of the yes, if the automation no
development environments interface is used
(for example, Visual Basic)
Application-specific yes yes, limited
knowledge of OLE knowledge
mechanisms
Configuration of the yes yes
communications protocol
being used
Configuration of the yes yes
underlying communications
module
Knowledge of the partner yes yes
stations on the network

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 19
Overview of the OPC Server for SIMATIC NET

1.5 Guide to the Documentation

Who Should Read Not everyone needs to read everything! A programmer naturally
What? requires more information than installation personnel.
The following table recommends what each user group should read.

Source of Developers of Client Installation


Information Applications personnel
README yes yes
FAQ (Frequently yes yes
Asked Questions)
This manual yes yes
(completely)
OPC specification: yes no
Basics
OPC specification: yes, if developing with no
Data Access C/C++
Custom Interface
OPC specification: yes, if developing, for no
Data Access example, with Visual
Automation Interface Basic
OPC Specification yes no
Alarms & Events

Introduction to the OPC Server for SIMATIC NET


20 6GK1971-0BA00-0AA1
Quick Start

2 Quick Start

This chapter explains the following:


• How to install and start up the underlying communication system required for the
OPC server
• How to use the FMS OPC server with a simulation connection without an
underlying communications network.
• How to familiarize yourself with the OPC server for SIMATIC NET with a quick start
using OPC Scout.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 21
Quick Start

2.1 Installing and Starting up the Underlying Communications


System

Introduction The OPC server provides uniform access via various industrial
communications systems. To use the OPC server, the underlying
communications system must be installed and configured. The
following sections list the steps necessary for the various protocols.

The following sections describe the standard operation of a protocol.


Special situations such as multiple communications processors are not
included in this introduction.

For details of the individual steps necessary, refer to the relevant


product documentation.

Requirements Before you can work through the procedures outlined below, you
require the software products as described in the installation
instructions.

Configuring The communications partner is configured for the SIMATIC NET


protocol software using the protocol-specific tools of the
communications modules. The configuration tools are shipped with the
underlying protocol software, for example COM PROFIBUS for the DP
protocol.

Introduction to the OPC Server for SIMATIC NET


22 6GK1971-0BA00-0AA1
Quick Start

2.1.1 Installing the DP Protocol

Step Procedure
1 Installing the Communications Processor
Insert the communications processor as described in the installation instructions for the
module.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"
button.
Select the module you want to install.
2 Creating the Configuration
Along with the software for the DP protocol, the "COM PROFIBUS“ configuration tool was
also installed.
Start this program so that you can create a description of your DP communications system
in a database.
When you have completed your configuration, create a binary database that can be
downloaded to the CP using the "Export => NCM File“ menu item.
3 Assigning an Interface Parameter Set
Start the "Setting the PG/PC Interface“ configuration program.
Select the access point of the application "CP_L2_1:".
Assign the interface parameter set for the DP mode corresponding to your module to this
access point (for example CP5412A2 (PROFIBUS) or CP 5511 (DP master )).
4 Configuring the Communications Processor
Click the "Properties“ button.
Select the tab for configuring the DP protocol and enter the path and name of the loadable
binary database (*.ldb) you have just created in the dialog that is displayed. Some modules
also require explicit activation of the DP protocol ("DP“ check box).
Close the configuration program.
5 Testing the Communications Processor
Start the "Setting the PG/PC Interface“ configuration program again.
Select the access point of the application "CP_L2_1:" and click the "Diagnostics" button.
Check that the module is functioning correctly.
6 Using the OPC Scout
Follow the steps outlined in Section 2.4 for the quick start.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 23
Quick Start

2.1.2 Installing the S7 Protocol

Step Procedure
1 Installing the Communications Processor
Insert the communications processor as described in the installation instructions for the
module.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"
button.
Select the module you want to install.
2 Creating the Configuration
Along with the software for the S7 protocol, the "COM S7“ configuration tool was also
installed.
Start this program so that you can create a description of your S7 communications system
in a database.
When possible, use only one VFD for all connections.
When you have completed your configuration, create a binary database that can be
downloaded to the CP using the "File => Generate Binary DB ...“ menu item.
As an alternative, you can also use the NCM configuration tool.
3 Assigning an Interface Parameter Set
Start the "Setting the PG/PC Interface“ configuration program.
Select the access point of the application.
If you communicate via PROFIBUS or MPI, select "CP_L2_1:", If you work with Industrial
Ethernet, select "CP_H1_1:".
Assign the interface parameter set for the S7 mode corresponding to your module to this
access point (for example CP 5412A2(PROFIBUS), CP 1613 or similar).
4 Configuring the Communications Processor
Click the "Properties“ button.
Select the tab for configuring the S7 protocol and enter the path and name of the loadable
binary database (*.ldb) you have just created in the dialog that is displayed.
If required, activate the S7 protocol using the "S7“ check box.
Close the configuration program.
5 Testing the Communications Processor
Start the "Setting the PG/PC Interface“ configuration program again.
Select the access point of the application used previously and click the "Diagnostics" button.
Check that the module is functioning correctly.
6 Configuring the OPC Server
Start the configuration program for the OPC server ("OPC Settings“).
Select the "S7 Protocol" tab.
Select the CP/VFD pairs containing the access points corresponding to your network type.
("CP_L2_1:“ or "CP_H1_1:“).
Close the configuration program.
7 Using the OPC Scout
Follow the steps outlined in Section 2.4 for the quick start.

Introduction to the OPC Server for SIMATIC NET


24 6GK1971-0BA00-0AA1
Quick Start

2.1.3 Starting Up the S7 Protocol for Alarms & Events

Step Procedure
1 Installing and starting up the S7 protocol
Install and start up the S7 protocol for access to process variables as described in Section
2.1.2. Close all OPC clients to quit the OPC server.
2 Opening the configuration file
Start the configuration program for the OPC server and open the "S7 Protocol" tab. Click the
"Edit S7 Configuration File" button; the text database for configuring the S7 OPC server is
opened ( default: SscoreS7.txt").
3 Entering the connection configuration
In the section for the connection, enter the following for the connection via which the alarms
and events will be received (for example [MyAlarmCon|MyOPCVFD|CP_L2_1:]:
Events=3 ; Activate Alarm&Event mechanism
InitiateReq=2 ; Maintain connection permanently
4 Severity entry
For each alarm and each scan event, you can select the severity in a range from 1 to 1000
(optional). You can also define a default value for alarms and scans:
DefaultScan=300 ; Severity of the scan events is 300
DefaultAlarm=600 ; Severity of the alarms is 600
Scan123=200 ; The scan with ID 123 has severity 200
Alarm222=900 ; The alarm with ID 222 has severity 900
5 Saving the configuration file
Save the configuration file and start a client for OPC Alarm & Events.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 25
Quick Start

2.1.4 Installing the FMS Protocol

Requirements The partner devices to be accessed on the PROFIBUS network are


configured and can provide a short object dictionary.

Introduction to the OPC Server for SIMATIC NET


26 6GK1971-0BA00-0AA1
Quick Start

Step Procedure
1 Installing the Communications Processor
Insert the communications processor as described in the installation instructions for the
module.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"
button.
Select the module you want to install.
2 Creating the Configuration
The "COM PROFIBUS“ configuration tool was installed along with the software for the FMS
protocol.
Start this program so that you can create a description of your FMS communications
system in a database.
When possible, use only one VFD for all connections.
When you have completed your configuration, create a binary database that can be
downloaded to the CP using the "Export => NCM File“ menu item.
3 Assigning an Interface Parameter Set
Start the "Setting the PG/PC Interface“ configuration program.
Select the access point of the application "CP_L2_1:".
Assign the interface parameter set for the FMS mode corresponding to your module to this
access point (for example "CP5412A2 (PROFIBUS)“ ).
4 Configuring the Communications Processor
Click the "Properties“ button.
Select the tab for configuring the FMS protocol and enter the path and name of the loadable
binary database (*.ldb) you have just created in the dialog that is displayed.
Activate the FMS protocol in the "FMS“ check box.
Close the configuration program.
5 Testing the Communications Processor
Start the "Setting the PG/PC Interface“ configuration program again.
Select the access point of the application "CP_L2_1:" and click the "Diagnostics" button.
Check that the module is functioning correctly.
6 Configuring the OPC Server
Start the configuration program for the OPC server ("OPC Settings“).
Select the "FMS Protocol" tab.
Click the "Select..." button to select the CP/VFD pairs to be used by the OPC server.
By selecting the relevant check boxes in the lower part of the dialog, select the CP/VFD
pairs you require that have the access point "CP_L2_1:".
7 Using the OPC Scout
Follow the steps outlined in Section 2.4 for the quick start.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 27
Quick Start

2.1.5 Installing the Send/Receive Protocol for Industrial Ethernet

Requirements The partner devices are configured on the Industrial Ethernet network
and the required handling blocks or function blocks are called.

Introduction to the OPC Server for SIMATIC NET


28 6GK1971-0BA00-0AA1
Quick Start

Step Procedure
1 Installing the Communications Processor
Insert the communications processor as described in the installation instructions for the
module.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"
button.
Select the module you want to install.
2 Assigning an Interface Parameter Set
Start the "Setting the PG/PC Interface“ configuration program.
Select the access point of the application (CP_H1_1: ).
Assign the interface parameter set corresponding to your module to this access point (for
example “CP 1613“).
3 Testing the Communications Processor
Start the "Setting the PG/PC Interface“ configuration program again.
Select the access point of the application used previously ("CP_H1_1:") and click the
"Diagnostics" button.
Check that the module is functioning correctly.
4 Configuring the OPC Server
Start the configuration program for the server ("OPC Settings“).
Select the "SR Protocol" tab.
Select the access point "CP_H1_1:“. Close the configuration program in the lower part of
the dialog.
5 Starting the OPC Scout
Carry out steps 1 and 2 in Section 2.4 to start the SR-OPC server for the first time using the
OPC Scout. When it is first started, the SR-OPC server enters default values in the text
database (see Section 8.6) that make subsequent configuration easier.
Close the OPC Scout.
6 Configuring the OPC Server
Start the configuration program for the SR-OPC server and click the "Edit SR Configuration
File". The text database for configuring the SR-OPC server is opened with a text editor.
In the section "[CP_H1_1: (Connections)], enter the definitions for the required connections
using the following notation: (see Section 9.3.2 in this manual)
Connection name=LocalTSAP, HostID, RemoteTSAP, ActiveFlag.
With this information about the connection, the OPC server can access the configured send
or receive buffers on the partner device.
Finally, save the text file.
7 Using the OPC Scout
Follow the steps outlined in Section 2.4 for the quick start.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 29
Quick Start

2.1.6 Installing the Send/Receive Protocol for PROFIBUS (FDL)

Requirements The partner devices are configured on the PROFIBUS network and the
required handling blocks or function blocks are called.

Introduction to the OPC Server for SIMATIC NET


30 6GK1971-0BA00-0AA1
Quick Start

Step Procedure
1 Installing the Communications Processor
Insert the communications processor as described in the installation instructions for the
module.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"
button.
Select the module you want to install.
2 Assigning an Interface Parameter Set
Start the "Setting the PG/PC Interface“ configuration program.
Select the access point of the application (CP_L2_1: ).
Assign the interface parameter set corresponding to your module to this access point (for
example “CP 5611 (PROFIBUS) “).
3 Testing the Communications Processor
Start the "Setting the PG/PC Interface“ configuration program again.
Select the access point of the application used previously ("CP_L2_1:") and click the
"Diagnostics" button.
Check that the module is functioning correctly.
4 Configuring the OPC Server
Start the configuration program for the server ("OPC Settings“).
Select the "FDL Protocol" tab.
Select the access point "CP_L2_1:“. Close the configuration program in the lower part of
the dialog.
5 Starting the OPC Scout
Carry out steps 1 and 2 in Section 2.4 to start the FDL-OPC server for the first time using
the OPC Scout. When it is first started, the FDL-OPC server enters default values in the text
database (see Section 8.7) that make subsequent configuration easier.
Close the OPC Scout.
6 Continuing OPC Server Configuration
Start the configuration program for the OPC server and click the "Edit FDL Configuration
File" button. The text database for configuring the FDL-OPC server is opened with a text
editor.
In the section "[CP_L2_1: (Connections)], enter the definitions for the required connections
using the following notation: (See Section 8.7 in this manual)
Connection name=LocalTSAP, Station, RemoteSAP.
With this information about the connection, the OPC server can access the configured send
or receive buffers on the partner device.
Finally, save the text file.
7 Using the OPC Scout
Follow the steps outlined in Section 2.4 for the quick start.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 31
Quick Start

2.1.7 Commissioning the DP Slave

Step Procedure
1 Installing the Communications Processor
Insert the communications processor as described in the installation instructions for the
module.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"
button.
Select the module you want to install.
2 Assigning an Interface Parameter Set
Start the "Setting the PG/PC Interface“ configuration program.
Select the access point of the application "DPSONLINE".
Assign the interface parameter set for the DP mode corresponding to your module to this
access point (for example "CP 5611 (PROFIBUS DP Slave)“ ).
3 Testing the Communications Processor
Start the "Setting the PG/PC Interface“ configuration program again.
Select the access point of the application "DPSONLINE" and click the "Diagnostics" button.
Check that the module is functioning correctly.
4 Processing the GSD File
The configuration of the DP slave is specified in a GSD file (*.gsd). Along with the software
for the DP slave, a sample file was also installed. If you want to modify the configuration of
the slave, you must adapt this file.
For more information on the structure of a GSD file, refer to the "DP Slave Programming
Interface for CP 5411, CP 5511 and CP 5611" manual.
5 Configuring the OPC Server
Start the configuration program for the server ("OPC Settings“).
Select the "DP Slave" tab. Select the access point "DPSONLINE".
Now click the "Edit DPS Configuration File" button. The text database for configuring the DP
slave OPC server is opened with a text editor.
Enter the path and file name of the GSD file of your slave in the section [DPSONLINE].
Finally, save the text file.
Close the configuration program.
6 Using the OPC Scout
Follow the steps outlined in Section 2.4 for the quick start.

Introduction to the OPC Server for SIMATIC NET


32 6GK1971-0BA00-0AA1
Quick Start

2.2 Simulation Connections of the OPC Server

Description The OPC server allows you to use simulated connections for all
protocols. This connection with the fixed name "DEMO" simulates a
connection to a partner device.

Requirements The simulation variant of the OPC server for SIMATIC NET can be
used without a communications processor.

☞ This simulation connection can be activated at any time by the


configuration program.

Properties The simulation connection has the name DEMO. The simulated device
provides several variables depending on the particular protocol. You
can configure some of the properties of the simulation connection
yourself. For further information about configuring properties, refer to
Chapter 8

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 33
Quick Start

2.2.1 Working with the Simulation Connection

How the Before you can work with the simulation connection, this must be
Connection Works activated (see below). If you have not installed underlying protocol
software, the simulation connection is detected automatically.
In this case, the configuration program cannot be started.
After activating the simulation connection, a virtual partner station with
several variables is available. You can use all the OPC functions with
☞ these slaves.

The simulation connection can also be started parallel to a real


network, as long as the connection name DEMO does not exist in
the real network.

Activating the Carry out the following steps to activate the simulation connection of
Simulation the OPC server for SIMATIC NET.
Connection

Step Procedure
1 Close the OPC server
If the OPC server for SIMATIC NET is already activated, close this application.
2 Start the Configuration Program
Start the “OPC Settings” program in the Start menu of Windows (taskbar (Start =>
SIMATIC => SIMATIC NET => OPC Server => OPC Settings)
3 Activate the Simulation Connection
Change to the tab for the relevant protocol and activate the "Activate simulation connection"
check box.
When you no longer require the simulation connection, deselect this check box.

Introduction to the OPC Server for SIMATIC NET


34 6GK1971-0BA00-0AA1
Quick Start

2.3 Description of the Quick Start

Introduction For the quick start, you use the program “OPC Scout” to test the OPC
server for SIMATIC NET. This OPC client is a powerful Visual Basic
application for testing and installing a system.

Range of With the sample program “OPC Scout”, you can do the following:
Functions
• Investigate the process area of your communications network
• Generate OPC groups
• Select and include process variables as items in a group
• Read and write values

Sample Programs Once you have got to know the OPC server with the OPC Scout, you
can get to know the principles of programming the OPC server using
the supplied sample programs for Visual Basic and for C++ in the
"SAMPLES" folder.
The sample programs are described in the file "EXAMPLE" in the
"SAMPLES" folder.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 35
Quick Start

2.4 Using the Quick Start

Procedure Follow the steps outlined below to familiarize yourself with the OPC
server for SIMATIC NET using the “OPC Scout” sample program:

Step Procedure
1 Starting the “OPC Scout” Program
Now start the "OPC Scout" program (Start => Programs => SIMATIC NET =>
OPC Server => OPC Scout)
2 Connecting to the OPC Server
Select the OPC server in the left-hand box "Servers and Groups“ using the mouse.
• For SIMATIC NET (OPC.SimaticNet)
Select the "Connect" menu command from the "Server" menu.
Reaction: The selected OPC server is started. This can take several seconds.
3 Creating a Group
In the "Add Group“ dialog, you can enter any name for a group and confirm your
entry with OK.
Reaction: The name of the newly created group is displayed in the "Servers and
Groups“ box below the selected server.
4 Investigating the Process Area
Select the group you created in the "Servers and Groups“ box and click the "Add
Item" command in the "Group“ menu.
Reaction: In the "OPC Navigator" dialog that appears now, you can investigate the
process area of the OPC server. The left column shows the hierarchical structure of
the process area. If you double-click an entry, the next level is displayed. The
middle column lists the variables available at a level.
5 Adding OPC Items
Select the variables displayed in the middle column.
Now click the arrow "=>“. The selected variables are displayed in the right column
and are therefore selected for inclusion in the current group.
Click "OK“ to insert the variables in the current group.
Reaction: The dialog is closed. In the table in the main window, you will see the
selected variables and their attributes (for example value, time stamp).

Introduction to the OPC Server for SIMATIC NET


36 6GK1971-0BA00-0AA1
Quick Start

Step Procedure
6 Writing a Value
If you have selected a writeable variable (W or RW attribute), you can assign a new
value to this process variable.
Click the line containing the variable to be modified and click the "Write Values"
command in the "Item“ menu.
Enter a new value in the dialog and confirm your entry with "OK“.
Reaction: The dialog is closed. The table displays the new value and the result of
the operation (write result).

Getting to Know You should experiment with the functions of the OPC Scout. Try out
the Rest of the the right mouse button when you have selected an object. With many
Program elements, a context-sensitive menu is displayed that illustrates which
operations you can perform with the particular object.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 37
Basics of OLE

Introduction to the OPC Server for SIMATIC NET


38 6GK1971-0BA00-0AA1
Basics of OLE

3 Basics of OLE

The OPC interface uses OLE mechanisms to provide communication services to


applications under Windows. To develop applications either with Visual Basic or with
C/C++, you must be familiar with the basic architecture of OLE. This chapter provides
you with the basic information you require about OLE to allow you to develop OPC
programs.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-AA1 39
Basics of OLE

3.1 COM as the Basis for OPC

Introduction With OLE 1, it was possible for the first time under Microsoft Windows
3.1 to combine different and basically independent applications with
each other. This represented a significant step towards modularization
of user software. With the OLE 2 standard used by OPC, Microsoft has
not only extended OLE 1 but has also introduced a new far-reaching
architecture and has changed the thinking behind the development of
software under Microsoft Windows.

COM The basis of all OLE mechanisms is COM, the Component Object
Model from Microsoft.
COM defines a standard that allows objects to be defined as separate
units in Windows and to access these units beyond the limits of a
process.
Objects can be understood as extensions of the operating system.
They are not dependent on programming languages and are available
in principle to all applications. The COM component model is a client-
server architecture.
The server is the object that provides services.
The client is an application that uses the services of an object. Clients
are often also known as container applications.

DCOM With Windows NT, Version 4, the COM specification was extended to
allow objects to be accessed outside a local computer. The objects
used by an application are distributed within a network. This extension
of COM is known as DCOM (Distributed COM).

Introduction to the OPC Server for SIMATIC NET


40 6GK1971-0BA00-0AA1
Basics of OLE

3.2 Objects and Interfaces

The Term OLE objects are units in Windows that provide other objects with
OLE Object defined functions via their interfaces. OLE objects provide their
services via defined interfaces. The “content” of the object, data and
code, remains hidden to the object user. OLE objects are defined by
their interfaces.
The term “object” in the sense of OLE is not the same as the object
definition in object-oriented programming languages. OLE objects, for
example, do not support inherit functions.

Structure of an The following diagram illustrates an OLE object with 4 interfaces (as
OLE Object an example). The object is accessed via only one of the interfaces. It is
not possible to access the actual object as a whole, nor the data or
code it contains. The interfaces hide the methods assigned to them.

M1 M2 M3 M4
Method 1

OLE Object
Data and
code

M1 M2 M3 M4

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 41
Basics of OLE

The Term Interface Objects can have more than one interface and are described
completely by their interfaces. The methods (object functions) can only
be executed via the interfaces and object data can only be accessed
via the interfaces.
Objects can be used by more than one application. An interface
consists of a table of pointers to the actual functions.

Structure of an The following diagram illustrates the basic structure of an interface. A


Interface pointer to an interface in OLE 2.0 is a pointer to a jump table with
function pointers.
The caller uses a pointer to the required interface. This in turn contains
a pointer to a list of function pointers. These now reference the actual
methods in the OLE object.

Caller

Interface pointer

Pointer to list Function pointer M1


Function pointer M2
Function pointer M3
Function pointer M4

Object data and code

Interface

Introduction to the OPC Server for SIMATIC NET


42 6GK1971-0BA00-0AA1
Basics of OLE

3.3 Standard Representation of Objects in OLE

Description A graphic representation of OLE objects is usual in OLE


documentation. This representation is also used in this manual. The
functions supported by an interface are grouped together and only the
interface itself is symbolized by a circle with a line. The interface is
shown together with the object that it supports. Object-specific
interfaces point to the side of the object. The IUnknown interface
supplied with all objects is linked to the upper edge of the object.

Representation of The diagram below clearly shows that an object is defined by its
an OLE Object interfaces. The user of an object can only ever obtain access to the
object via the interfaces. A pointer to the object itself does not exist.

IUnknown

Interface A
Interface B
Interface C
Object X
Interface D

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 43
Basics of OLE

3.4 Object Control Via the Automation Interface

Automation Automation is an extension of OLE 2 that is based on the COM


component model. Automation makes the commands understood by
objects visible to the outside using a distributor interface. Originally,
the automation interface was intended to control objects, for example
the embedding of a graphic in a word processing program using macro
languages.

Access for Script The interfaces of COM described up to now are less suitable for the
Languages range of functions of development tools based on script languages. By
extending the OLE objects with a distributor interface, the methods of
the objects are accessible for simple script languages. This allows the
simple embedding of an OLE object, for example in development
environments such as Visual Basic, Delphi or Power Builder. The
development tools disguise all details of the object calls.
Programmable access to OLE automation servers is defined by
properties and methods.

Introduction to the OPC Server for SIMATIC NET


44 6GK1971-0BA00-0AA1
Basics of OPC

4 Basics of OPC

This chapter explains the concept of OPC. You will see the role of OLE in OPC. The
chapter also explains the concept of the OPC interface and the class model on which it
is based. The chapter also provides you with more detailed information about the client-
server architecture of OPC.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 45
Basics of OPC

4.1 The Role of OLE in OPC

OPC Server as Part An OPC server provides a vendor-independent interface. By using the
of the Operating COM component model, the OPC server becomes similar to part of
System the Windows operating system and is therefore independent of file
names, storage locations and versions.

Why OLE? These characteristics and, not least, the widespread use of Microsoft
Windows operating systems prompted the development of a vendor-
independent interface based on COM and therefore also on OLE.

Powerful A further advantage of OLE is the possibility of editing the OLE objects
Development in a powerful development environment (Visual Basic, Delphi and
Environments others).

Introduction to the OPC Server for SIMATIC NET


46 6GK1971-0BA00-0AA1
Basics of OPC

4.2 The OPC Specifications

Data Access The OPC Data Access specification is the fundamental and first
specification of the OPC Foundation. The OPC Data Access
specification offers functions for management of process variables and
various opportunities for access to variables. Variables can be read
and written synchronously and asynchronously. OPC Data Access also
defines the possibility of sending a message to a client if a variable
changes.

To use an OPC variable, a client must first register the variable with
the OPC server. The client therefore defines the values and the points
in time that are of interest to it.

The application gets a "snapshot" of the process values from the point
in time at which the read job was executed. Values between these
points may not be acquired by the application. When monitoring
variables, internal cyclic read jobs are sent.

The source of the process values is not specified by the specification.


Any information can be provided by DataAccess. The data source is
vendor-specific and effectively defines an OPC server product.

The possible variables of an OPC Data Access server could be control


values of a programmable controller, measured values of a data
acquisition system, or status variables of the communication system.

Alarms & Events OPC Alarms & Events is an additional specification for the transfer of
process alarms and events. It is basically independent of the Data
Access specification.

Events are particular states in the process that need to be signaled to a


receiver. All received events are signaled to the applications according
to the selected filter criteria.

The OPC Alarms & Events specification makes a distinction between


simple events and complex status messages. Status messages can
also require confirmation.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 47
Basics of OPC

4.3 The Two Interfaces of OPC

OLE Interfaces An OLE component provides objects and their methods for other
components or applications. These objects are accessed via the OLE
interfaces. An interface in the sense of OLE is a group of logically
related functions.

Two Types of The OPC server for SIMATIC NET supports two different types of OLE
Interface interface:
• Automation interface
• Custom interface
Both interfaces are used for the communication between objects.
The automation and custom interfaces differ from each other in the
way in which the methods of an interface are called internally. This
means that there are also two different interface specifications for the
OPC server:
• Interface specification of the automation interface
• Interface specification of the custom interface

OPC Specification: Both types of interface are possible in principle for all OPC
specifications. Both interface types are available for the basic
specification "OPC Data Access".
Only the custom interface is available for "OPC Alarms & Events".
Representation of The following schematic shows an example of the types of applications
the OPC Server can by used via which interfaces of the OPC server.

C/C++ application
Custom
interface
OPC server

Specific vendor
Visual Basic hardware
application
Automation
interface

Introduction to the OPC Server for SIMATIC NET


48 6GK1971-0BA00-0AA1
Basics of OPC

When is Which Client applications based on a script language such as Visual Basic or
Interface Used? VBA must use the automation interface.
Applications in the C/C++ programming language should use the
custom interface for maximum performance.
It is also possible to use the automation interface in C/C++.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 49
Basics of OPC

4.4 The Class Model of OPC Data Access

Structure The OPC specification for data access groups the interfaces and their
methods into three hierarchical classes. This structure is known as a
class model.
Both the automation and the custom interface of OPC Data Access are
based on this class model. The classes are implemented by OLE
objects simply called objects in the following text.

Class Model The class model consists of three object classes:


• OPC server
• OPC group
• OPC item

The following diagram illustrates the OPC class model:

OPC-Server
1:n

OPC-Group

OPC-Item

“OPC Server” The highest class is the OPC server class. The OPC server class has
Class various attributes that contain information about the status, the version
etc. of an OPC server object. The OPC server class also has methods
with which the client can manage the objects of the OPC group class.
A client application addresses only an object of this class directly using
COM mechanisms. The other objects are created by corresponding
OPC methods.

Introduction to the OPC Server for SIMATIC NET


50 6GK1971-0BA00-0AA1
Basics of OPC

"OPC Group“ The “OPC Group” class manages the individual process variables, the
Class OPC items. Using these group objects, a client can form semantically
meaningful units of OPC items and execute operations with them.
All the process variables of machine A could, for example, be put in
one group and the process variables of machine B in a second group.
On the other hand, all the process variables of a screen page of an
operator interface system could be put together in one group. When
the page is displayed, the group would be activated.

“OPC Item” Class An object of the class OPC item represents a link to a process
variable, for example to the input module of a programmable
controller. A process variable is data of the process I/Os that can be
written and/or read, for example the temperature of a tank.
An object of the server class can be considered as a container for
objects of the OPC group class.
An object of the OPC group can be considered as a container for
objects of the OPC item class.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 51
Basics of OPC

4.5 The Principle of OPC Alarms & Events

Structure To be able to use the OPC Alarms & Events interface for widely
differing sources of events, it has an extremely flexible structure. It can
be used for simple event sources that, for example, provide
information about the failure of a system component or for complex
events requiring status messages and confirmation. Such events are
specified using conditions.
Example of a condition: The temperature in a process exceeds a
defined limit value.

The OPC specification defines the possible status changes for


conditional events in a state diagram. For more detailed information
about the state diagram, refer to the OPC specification.

Event Messages An event is the occurrence of a situation that is of interest to the user.
The user is informed of such an event in a message.

Along with the message, the parameters defined by the OPC


specification and (where necessary) associated values specified by the
vendor are also supplied.

The specification for OPC Alarms & Events defines three types of
messages:

• Condition-Related Events
signal the state changes defined in the OPC state model and are
linked to defined conditions
• Tracking Events
signal changes in the process, for example resulting from user
intervention. (Example: The user modifies the setpoint of a
controller)
• Simple Events
Simple events include all other events. These do not have a state.
A typical simple event is the failure of a system component.

Introduction to the OPC Server for SIMATIC NET


52 6GK1971-0BA00-0AA1
Basics of OPC

OPC Event
Server

1 1
1:n 0:n

OPC Event OPC Event


Subscription Area Browser

"OPC Event A client application accesses the objects of the "OPC Event Server"
Server" Class class using COM mechanisms. This means that the application can
receive events supplied by the OPC Event server. The most important
task of the OPC Event server is to manage the logging on of various
clients for events. The OPC Event server also provides information
about the supported event categories and parameters.

"OPC Event Using the OPC Event server, a client creates one or more OPC
Subscription" Subscription objects. A subscription can be understood as the client
Class subscribing to a group of events. Using the subscriptions, filters and
other attributes are managed for the specific client.

"OPC Event Area OPC Alarms & Events provides the option of structuring large systems
Browser" Class into areas. Areas can be used to filter events. The use of the optional
object "OPC Event Area Browser" allows the areas to be investigated.

Connection The following schematic illustrates the steps taken by an application to


Between Client log on for receiving messages:
and Server

111
1 OPC Event Server
Client

2 OPC Event
Subscription
3 Connection Point
Container
On Event 4 Connection Point

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 53
Basics of OPC

Step 1: Using COM mechanisms, the client creates an OPC


Event server object.
Step 2: Using the "CreateEventSubscription" method, the client
creates an OPC Event Subscription object on the
server. When it is created, the subscription object in
turn creates a Connection Point Container.
Step 3: The client uses the connection point container to
localize the connection point for messages
(IID_IOCEventSink). Using an advise, the client logs on
its return call object "OnEvent" at this connection point.
Step 4: If an event occurs, the OPC Event server calls the
return call object of the client.

Introduction to the OPC Server for SIMATIC NET


54 6GK1971-0BA00-0AA1
Basics of OPC

4.6 Group Operations

Definition The OPC specification supports group operations with various methods
for objects of the OPC group class. A group operation means that
more than one object can be addressed with a single method call.

Benefits for the It is, for example, possible to read all OPC item objects of a group with
OPC User a single command by calling the OPC Data Access method “Read”. In
the OPC Alarms & Events specification, all events are transferred by
calling the "OnEvent" function.

Group operations have the advantage that the number of process


changes that occur when methods of a software component are called
is kept low. This improves the execution speed of method calls and is
particularly advantageous when the software components are located
on different computers or in different processes

A further advantage is that in many situations the SIMATIC NET OPC


server optimizes the access to OPC item objects in group operations
and reduces the load on the network.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 55
Basics of OPC

4.7 The Client-Server Architecture of OPC

Description Like all OLE implementations, OPC has a client-server architecture.


The OPC server provides the OPC clients with interfaces and therefore
with defined functionality. The client can create, use and delete objects
on the server via these interfaces.

Types of OLE Depending on the way in which the server is linked, an OLE server can
Servers be divided into three types:
• In-Process Server
• Local Server
• Remote Server
The calling application does not need to distinguish the type of server it
addresses. The syntax of the method calls is the same for all.

In-Process Server An In-Process Server is in the same process area as the client and is
only available for this process. Normally In-Process Servers are
implemented as DLLs. Only the OPC automation interface of the OPC
server for SIMATIC NET is implemented an In-Process Server that
implements the automation interface. The In-Process Server accesses
the local server via the OPC custom interface.

Local Server A Local Server runs on the same computer as the client. Like every
independent application, it has its own process and address area. The
OPC server for SIMATIC NET is a local server and is implemented as
an EXE file.

Remote Server A Remote Server is located on a different computer but can be


accessed by the client via a network connection.

With the implementation, the provider of an OPC server specifies


whether the server is an in-process server or a local server. Operation
as a remote server must be configured by the user.

Introduction to the OPC Server for SIMATIC NET


56 6GK1971-0BA00-0AA1
Basics of OPC

Access to The following diagram shows which components of the OPC server for
Components SIMATIC NET are accessed by various types of clients:

OPC
Visual In-Proc server
Basic client

Automation
interface OPC local Protocol
(as DLL) server software
and
hardware
Custom linking
interface
(as EXE)
C/C++
client

SIMATIC NET OPC Server

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 57
Terminology of the OPC Interface Description

4.8 Terminology of the OPC Interface Description

This chapter explains certain terms used in the description of the interfaces. For a
complete description of the OPC terminology, refer to the OPC specifications located as
files in the “DOC” directory of the OPC server for SIMATIC NET.
Where this is useful, special features of the OPC server for SIMATIC NET are pointed
out in this chapter.

Introduction to the OPC Server for SIMATIC NET


58 6GK1971-0BA00-0AA1
Terminology of the OPC Interface Description

Structure of the The terms are sorted alphabetically. For each turn, you can also see
List which environment the turn belongs to: OLE, OPC Data Access, OPC
Alarms & Events (A&E) or Windows (see Figure Page 13).

Special Features of Notes relating to the characteristics of the OPC server for
the OPC Server SIMATIC NET are enclosed in a box like this and should be read
from SIMATIC NET carefully.

OLE, OPC and Windows Terminology

Active State Apart from the possibility of reading or writing the values of a process
(OPC Data Access) variable, an OPC server also allows process variables to be monitored.
Monitoring means that the server checks whether the value of the
process variable has changed after a time interval (see monitoring
interval) has elapsed. If the value has changed, the new value is sent
automatically to the client. The client can control the monitoring of a
process variable by setting the active state. Each group and each OPC
item object has the active state attribute.
If a client wants to monitor a process variable, it sets the active state of
the OPC item that represents the link to this process variable to TRUE.
The active status of the group must also have the value TRUE .
If a group is not active, there is no monitoring of the process variables
in this group.

Alarm An alarm is an event triggered by a condition that no longer describes


(OPC A&E) the normal state. For this reason, alarms are not given special
handling since they are a special form of a condition.
Area Using areas, an OPC Event server can divide up the production plant
(OPC A&E) being monitored. The details and configuration of this division is up to
the vendor of the server. The implementation of the area concept is
optional.

The OPC Event server for SIMATIC NET does not support the
concept of areas.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 59
Terminology of the OPC Interface Description

Cache The cache is a buffer for all variables that are referenced via OPC
(OPC Data Access) items. The cache is global for all users. This means that if more than
one user references the same variable, this is stored only once in the
cache.
Read operations (read or refresh) can read the data from the server
cache with the option OPC_DS_CACHE.

The SIMATIC NET OPC Server manages a cache.

Categories Using categories, the events supported by an OPC Event server can
(OPC A&E) be grouped and therefore selected. The definition of the categories is
left up to the vendor of an OPC Event server; the OPC specification
defines a list of recommended event categories.

The categories supported by the OPC Event server for SIMATIC


NET are listed in Section 6.2.

Condition A condition is a defined state of the OPC Event server. Conditions can
(OPC A&E) include subconditions. Example: A condition of the "Level" variable is
the level alarm with the subconditions HighAlarm, HighHighAlarm,
LowAlarm and LowLowAlarm.

The OPC Event server for SIMATIC NET does not support
conditions and subconditions.

Enumerator Using an enumerator, it is possible to run through a collection of


(Windows) objects.
Events An event is an occurrence that could be of interest to the client.
(OPC A&E) Although events can be generated by the occurrence of a condition,
they do not need to be linked to conditions. Example of events that are
not linked to conditions, are for example error messages from the
communication system.
OPC Item-ID The OPC Item ID is a string that identifies the process variable
(OPC Data Access) uniquely.
The syntax of the ID depends on the server. The OPC item ID informs
the server unequivocally which process variable is assigned to the
OPC item.

The value of the OPC item ID for the OPC server for SIMATIC NET
depends on the protocol. Section 5 describes the structure of the
OPC item ID for the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


60 6GK1971-0BA00-0AA1
Terminology of the OPC Interface Description

LCID Abbreviation for Local ID. The LCID provides information about the
(Windows) regional setting selected by the user for the Windows operating
system.
This information affects the way in which certain regional information is
displayed. You can query the LCID using a Windows API call.

The OPC server for SIMATIC NET displays error texts either in
German or in English.

OPCHANDLE OPCHANDLEs are used for groups and OPC items. They allow fast
(OPC) access to the various objects both for clients and for the server.
The value of a handle depends on the particular implementation.
Clients cannot make any assumptions about the range of values. In the
same way, servers cannot make assumptions regarding client handles.
Server OPCHANDLEs are only valid during the existence of an OPC
server object. It is therefore not possible to save them and use them
again after starting a client. A server group handle is always unique
within a server. An OPC item group handle is unique within a group.
Client handles must be used for asynchronous operations since they
are returned in the callback as an OPC item identification.

REFIID REFIID is a reference or pointer to an interface ID ( IID).


(Windows)
An interface ID is a unique key for an interface; with OPC for example
interface "IOPCItemMgt". To obtain a pointer to a particular interface,
the IID of the required interface must be specified as the parameter.

Requested Data By specifying the requested data type, a user can determine the data
Type type of a variable. If the data type is not specified explicitly by the user,
(OPC Data Access) the variable has the canonical data type. The OPC specification
specifies the conversion only for scalar types. The OPC server for
SIMATIC NET can also convert all data types (including arrays) to
VT_BSTR.
Time Bias Time bias specifies the difference between the UTC time and the local
(OPC) time zone. This takes into account the possibility that an OPC server
and OPC client can be distributed in a world-wide network.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 61
Terminology of the OPC Interface Description

UpdateRate The monitoring interval “UpdateRate” specifies the interval at which


(OPC Data Access) the server checks whether the value of an OPC item has changed
when it is monitoring this item (see “Active State”). The update rate is
an attribute of a group object.
The user can set an update rate for each group. The value 0 requests
the fastest permitted “UpdateRate”.
If the required rate is not supported, the server sends back an
alternative rate (“RevisedUpdateRate”) as close as possible to the
required rate.

VARIANT A VARIANT is a special data type that is used primarily in OLE


(Windows) automation.
A variable of the type VARIANT can represent values of various
variable types and the special values Empty, Error and Null.

Canonical Data The canonical data type means the original data type of a variable, as
Type represented internally and supplied by the OPC server.
(OPC Data Access)

Access Path The access path contains optional information for objects of the OPC
(OPC Data Access) Item class. The need for an access path and its interpretation depends
on the particular server. When it is required, the access path indicates
the path to be used by the server when reading or writing the data of a
process variable.
The access path can, for example be a path or connection name.

The value for the access path for the OPC Server for SIMATIC NET
depends on the protocol. Chapter 5 describes the structure of the
access path for the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


62 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5 Structure of the OPC Items for the SIMATIC NET


Data Access Interface

The OPC Server for SIMATIC NET provides standardized access to the SIMATIC NET
industrial communications networks via the OPC interface. This provides the OPC user
with an open, comprehensive, and coordinated system for communication in automation
engineering.
This chapter explains how the vendor-specific characteristics of SIMATIC NET
communication networks are put to good use due to the structure of the names of OPC
variables.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 63
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.1 General Information

OPC Item The only class in OPC that creates a reference to a real variable from
Represents the process is the OPC Item class. An object of the OPC Item class
Process Variable represents a process variable. The properties of an OPC item that are
transferred to the created object with the “AddItem” call describe which
variable is to be addressed.
The OPC specification contains no information about how the
parameters should be structured. This information depends on the
server and the connected communication system.

Description To describe the syntax, the following notation is used:

Conventions (not part of Meaning


actual syntax)
Pointed brackets ( < > ) Texts in pointed brackets are
mandatory
Braces ( { } ) Texts in braces are optional

Square brackets ( [ ] ) are part of the syntax and must be included.

“ItemID” Parameter The “ItemID” parameter contains all the information necessary to
identify a process variable. This involves a string with the following
structure:
<Protocol ID>:[<Connection name>]<Variable name>

Example 1: DP:[CP_L2_1:]Slave005M00AW00
Example 2: S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]EB0
Example 3: FMS:[FMS_CON|VFD_OPC|CP_L2_1:]&vfdstate()
Example 4: SR:[SROPC_1||CP_H1_1:]Motor
Example 5: FDL:[SROPC_1||CP_H1_1:]Motor
Example 6: DPS:[DPSONLINE]Motor

Introduction to the OPC Server for SIMATIC NET


64 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Protocol ID The protocol ID specifies the protocol to be used when accessing the
process variable. This information is absolutely necessary. The
protocol ID can be specified as an alternative with the connection
name in the “AccessPath” parameter.

The following protocol IDs apply to the available protocols:


DP DP master class 1 (incl. DP-C1)
S7 S7 functions via PROFIBUS and Ethernet
FMS FMS protocol via PROFIBUS
SR S5-compatible communication via Ethernet
("Send/Receive")
FDL S5-compatible communication via PROFIBUS
DPS DP slave (cyclic services)

Connection Name The connection name identifies the connection or communication


access via which the partner (DP slave or PLC) can be reached. The
connection name must be unique within a protocol. This information
depends on the selected protocol. The connection name can also be
included in the “AccessPath” parameter.

Variable Name The variable name specifies the variable to be addressed and must be
unique for the specified connection. The format of this parameter also
depends on the protocol. If the protocol ID and connection name are
specified in the “AccessPath” parameter, the “ItemID” parameter only
contains the variable name.

“AccessPath” The “AccessPath” is optional information. The protocol ID and


Parameter connection name can be entered in the “AccessPath” parameter for the
OPC server for SIMATIC NET.
If the “AccessPath” parameter is used, it is a string with the following
structure:

<Protocol ID>:[<Connection name>]

Please note that in this case the information specified above must not
be part of the "ItemID" parameter.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 65
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.2 DP Protocol

5.2.1 Specifications for the DP Protocol

Master and Slaves The DP for PROFIBUS protocol also specifies multi-master operation.
Generally (to improve performance) it is used in single-master
systems. For the OPC server for SIMATIC NET, the DP master is a
PC with the appropriate communications processor, for example
CP 5412 (A2). A master addresses slaves cyclically via the fieldbus.
Slaves are generally input/output modules located in a distributed
configuration and equipped with a passive communications module.

Properties of the The DP-OPC server from SIMATIC NET has the following
DP-OPC Server characteristics:
• Variable services access and monitoring of DP
inputs and outputs
• DPC1 services acyclic transfer of data
fields
• Diagnostic evaluation automatic evaluation of
static diagnostics

Protocol ID The protocol ID for the DP protocol is always “DP”.

Connection Name For the DP protocol, the connection name specifies the communication
access by specifying the communications processor that
communicates with the slaves as the DP master.
The connection name for the DP protocol is as follows:
CP_L2_x: x = 1, 2, 3 or 4

Example: CP_L2_1:

Access to DP Access to a DP variable (an I/O area of a slave) is achieved by


Variables specifying the slave number (PROFIBUS address), the module
number and the I/O area.

DP slaves have a modular structure. A DP slave can have more than


one module with different I/O areas. The modules are assigned during
configuration.

Introduction to the OPC Server for SIMATIC NET


66 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.2.2 Syntax of Variable Names for DP

Overview The variable name identifies the input or output area in the module of
a slave. Status information of the slaves and the DP master is also
available using variable names.

To describe the syntax, the following notation is used:

Conventions (not part of Meaning


actual syntax)
Pointed brackets ( < > ) Texts in pointed brackets are
mandatory
Braces ( { } ) Texts in braces are optional

Syntax The syntax of the slave inputs and outputs is defined as follows (upper
and lower case irrelevant):
• Inputs:
Slave<address>M<number>E<format><element>{.bit}{,quantity}

• Outputs:
Slave<address>M<number>A<format><element>{.bit}{,quantity}

Description of the The individual parameters have the following meaning:


Parameters

<address> PROFIBUS address of the slave. Range 0 to 126

<number> Number of the module containing the input or output area

{format} The "format" element specifies the format in which the data are
supplied. Specifying the format also specifies the data type.
In principle, all specified OLE data types can be read via the
automation interface of OPC. However, certain development tools (for
example Visual Basic) only offer a restricted number of data types.
The following table therefore lists the corresponding Visual Basic type
in which the variable value can be represented.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 67
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Format Description OLE Data Type VB Type


ID
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 (unsigned 16) VT_UI2 Long
INT Integer (signed 16) VT_I2 Integer
DWORD or D Double word (unsigned 32) VT_UI4 Double
DINT Double integer (signed 32) VT_I4 Long
REAL Floating-point number (IEEE 4 bytes) VT_R4 Single
BK Consistent data as an array of bytes VT_ARRAY of Byte() *
(unsigned 8) VT_UI1
WK Consistent data as an array of words VT_ARRAY of Long() *
(unsigned 16) VT_UI2

* Default setting in Visual Basic BSTR

<element{.bit}> Number of the element to be accessed (not possible for BK and WK).
The byte address of an element is decided by the data type.
Example:
B2 supplies a byte starting at byte address 2, W2 ,on the other hand,
supplies a word starting at word address 2, corresponding to byte
address 4!

Specification of a bit is only permitted for type X. The address to be


specified is a byte address.
Example:
X2.3 means the 3rd bit of the 2nd byte.

{,quantity} Number of elements (not possible for BK, WK and X). The data type of
the variable is an array with elements (data type VT_ARRAY) of the
specified format. If this part of the name is omitted, the quantity 1 is
assumed and the data type of the variable is not an array.

Introduction to the OPC Server for SIMATIC NET


68 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition.

Do not forget, that you must always precede the variable with the
protocol ID and the module identifier (for example "DP:[CP_L2_1:]" )!

Example of Syntax Description


Slave005M003EB0 Input byte 0 of module 3 of slave 5
Slave005M003EB1,3 Array with 3 bytes starting at input byte 1
Slave005M003ED0 Double word starting at input byte 0
Slave005M007AB1 Output byte 1 of module 7
Slave005M007AX2.5 Bit 5 in output byte 2 of slave 5, module 7
Slave004M007EBK All input data of module 7 of slave 4 as byte
array
Slave004M003AWK All output data of module 3 of slave 4 as array
of data type word
Slave004M003IReal0 The input area of slave 4, module 3 as
floating-point number

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 69
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.2.3 Syntax of Variable Names for DPC1 Access

General The DPC1 protocol allows access to memory areas of the DPC1 slave.
The meaning of this memory area is specified by the vendor of the
slave. Memory areas can, for example, be used for configuration data.

When a DPC1 variable is logged on, the OPC server only check the
correctness of the syntax but not whether the variable is valid on the
partner device based on the configuration of the DPC1 slave.

Syntax With access to DPC1 variables, the variable names are formed with
the following syntax:
Slave<address>M<slot>
DPC1,{format}<index>{,quantity}

Description of the The individual parameters have the following meaning:


Parameters

<address> PROFIBUS address of the slave. Range 0 to 126

<slot> Slot of the slave, typically a module

{format} The "format" element specifies the format in which the data are
supplied. If no format is specified, the "byte" format is used.

Format Description OLE Data Type VB Type


ID
BYTE or B Byte (unsigned 8) VT_UI1 Byte
CHAR Character (signed 8) VT_I1 Integer
WORD or W Word (unsigned 16) VT_UI2 Long
INT Integer (signed 16) VT_I2 Integer
DWORD or D Double word (unsigned 32) VT_UI4 Double
DINT Double integer (signed 32) VT_I4 Long
REAL Floating-point number VT_R4 Single

<index> Index of the data on the slave

Introduction to the OPC Server for SIMATIC NET


70 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

{,quantity} Number of elements. The data type of the variable is an array with
elements (data type VT_ARRAY) of the specified format. If this part of
the name is omitted, the quantity 1 is assumed and the data type of the
variable is not an array.

The data length specified by the parameters <format> and {,quantity}


must match the real data length on the slave. This depends on the
slave and cannot be checked by the OPC server.

Syntax Examples
It is assumed that the slave supports DPC1 data with a length of 4
bytes in slot 3 with index 7.

Example 1:
Slave005M003DPC1,DWORD7 1 double word = 4
bytes
Example 2:
Slave005M003DPC1,B7,4 4 bytes

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 71
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.2.4 DP-Specific Information Variables

Introduction In DP, the OPC server for SIMATIC NET has variables available for
diagnostic purposes with which information about the DP master and
the connected DP slaves can be queried. The name of the information
variable must be specified in the parameter ItemID of an OPC item.
The following information can be obtained:
• DP master mode
• Event messages of the DP master
• Sign of life monitoring of the CP
• Mode of a DP slave
• DP slave type
• Other information

DP Master Mode Using the MasterState information variable, you can query and set the
current mode of the DP master.
It is only possible to set the mode dependent on the DP application
environment.
The following table describes the possible values (data type VT_BSTR,
in Visual Basic: String):

Return Value Description


OFFLINE No communication between master and slave
STOP No communication between master and slave
except for diagnostic data
CLEAR Parameter assignment and configuration phase
OPERATE Productive phase

Event Messages of Using the information variables EvAutoclear, EvWatchdog and


the DP Master EvClass2Master, unexpected events (system events) can be queried
during operation.
The following table describes the possible values (data type
VT_BOOL, in Visual Basic: Boolean):

Introduction to the OPC Server for SIMATIC NET


72 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Return Value Description


True Event occurred
False Event did not occur

For further information on these events, refer to the "DP Programming


Interface" manual.

Sign of Life Using the WatchdogTimeout information variable, the sign of life
Monitoring of the monitoring can be set on the CP:
CP
The following table describes the possible values (data type VT_UI4, in
Visual Basic: Double):

Return Value Description


0 Monitoring off
400-102000 Any value in ms. The value is rounded
to a multiple of 400
6000 Default

Mode of a DP Using the SlaveXXXSlvState information variable, the current mode of


Slave the DP slave with number XXX can be queried.
The following table describes the possible values (data type VT_BSTR,
in Visual Basic: String):

Return Value Description


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

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 73
Structure of the OPC Items for the SIMATIC NET Data Access Interface

DP Slave Type With the SlaveXXXMiscSlvType information variable, the type of the
DP slave with number XXX can be queried.
The following table describes the possible values (data type VT_BSTR,
in Visual Basic: String):

Return Value Description


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

Introduction to the OPC Server for SIMATIC NET


74 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

SlaveXXXAllInputs The AllInputs variable supplies all input bytes of a slave as an array of
bytes (data type VT_ARRAY of VT_UI1), in Visual Basic: Byte() ). The
inputs of non-standard slaves can be read using this variable.

SlaveXXXAllOutputs The AllOutputs variable supplies all output bytes of a slave as an array
of bytes (data type VT_ARRAY of VT_UI1), in Visual Basic: Byte() ).
The outputs of non-standard slaves can be set using this variable.

Other Information The following information variables are not intended for productive
operation. If problems occur, it may, nevertheless, be useful to
evaluate the variables listed below. All variables are generally
assigned directly to low level DP services. These variables are read in
the same way as other information variables. The result of the call is
the byte dump of the particular low level DP service. For more
information about evaluating the result, refer to the manual describing
the DP interface.
The following variables are supported by the OPC server for
SIMATIC NET for DP:

Information Variable Name Meaning


MiscReadBusPar Bus parameters
MiscReadCfg Types of all slaves
MiscReadSysInfo State of all slaves
MiscDpnRoleCentral Central role for this
application (1,0)
MiscDpnSysCentral Central application logged
on (1,0)
MiscOnTriggerWatchdog Value is incremented by 1
each time the watchdog
timer is triggered
SlaveXXXMiscReadSlvParCFGData Configuration data
SlaveXXXMiscReadSlvParUserData User data
SlaveXXXMiscReadSlvParAddTab Add-Tab list
SlaveXXXMiscReadSlvParPrmData Parameter assignment
data
SlaveXXXMiscReadSlvParTyp SI flag, type, octet string
SlaveXXXMiscSlvDiag Diagnostic data

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 75
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.3 S7 Protocol

5.3.1 Specifications for the S7 Protocol

Communication The S7 for PROFIBUS and Industrial Ethernet protocol was specially
with S7 developed for communication between S7 system components and
Components of between S7 system components and programming devices and PCs.
SIMATIC This is a layer 7 communication protocol according to the ISO/OSI
reference model.
The OPC server for SIMATIC NET requires underlying S7 protocol
software from SIMATIC NET and a suitable communications
processor.
Before starting S7 communication, an S7 database must be created.
Suitable configuration tools are shipped with the protocol software.

Properties of the The S7-OPC server from SIMATIC NET has the following
S7-OPC Server characteristics:
• Variable services access and monitoring of S7
variables
• Field-oriented services program-controlled transfer
of larger fields of data
• S7 messages processing of S7 messages (S7
scans)
• Server functionality In field-oriented services, the
PC can also be used as
server.
• Domain services Transfer of a loadable data
area from and to S7
• S7 password functions Setting a password to access
protected domains
• Events Processing of S7 messages
(S7 scans, S7 alarms) as OPC
Alarms & Events

Introduction to the OPC Server for SIMATIC NET


76 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Establishing The S7 protocol is a connection-oriented transport protocol. A


Connections connection-oriented protocol provides a virtual channel for the user.
Communication consists of the following:
• Logon
• Connection establishment
• Data exchange
• Connection termination
• Logoff
The management of connections is handled by the OPC server for
SIMATIC NET automatically and is not visible for the OPC user.
When an OPC item is accessed or as a result of browsing, the OPC
server establishes the connection to the partner device, as necessary.
The connection name must be specified in the ItemID or in the
AccessPath of the OPC item and must be configured in the S7
database.

Protocol ID The protocol ID for the S7 protocol is always “S7”.

Connection Name The connection name consists of three parts:


• The configured name of the S7 connection
• The configured local VFD, at which the OPC server will log on
• The name of the communications processor or the access point of
the application
These parts are separated by the “|” character.
The name of the S7 connections and the VFDs are specified during
configuration. If only one CP/VFD pair is selected, the information on
the access point and VFD can be omitted.
The name of the communications processor or the access point of the
application is specified by configuration tools of the protocol software.
Typical names are:
• "CP_L2_1:“
• "CP_H1_1:"
• "S7ONLINE“

Examples of Three examples of connection names are listed below:


Connection Names
• My_connection|My_VFD|CP_L2_1:
• S7-OPC_conn|VFD1_OPC|CP_H1_1:
• PLC_314_conn|VFD2|S7ONLINE

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 77
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.3.2 Syntax of Variable Names for S7 (Variable Services)

Overview The variable name identifies the variable to be accessed on the


programmable controller. The type of access is based on the notation
of the S7 tools. Objects supported on the S7 OPC server are as
follows:
• Data blocks (DB)
• Inputs (E)
• Outputs (A)
• Peripheral inputs (PE)
• Peripheral outputs (PA)
• Memory bits (M)
• Timers (T)
• Counters (Z)
Note that not all object types are supported by every S7 programmable
controller.

Syntax The syntax is defined as follows (upper and lower case irrelevant):
• DB<no>,<type><byte address>{,<quantity>} or
• DI<no>,<type><byte address>{,<quantity>} or
• <object><type><byte address>{,<quantity>}

To describe the syntax, the following notation is used:

Conventions (not part of Meaning


actual syntax)
Pointed brackets ( < > ) Texts in pointed brackets are
mandatory
Braces ( { } ) Texts in braces are optional

Introduction to the OPC Server for SIMATIC NET


78 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Description of the The individual parameters have the following meaning:


Parameters

Parameter Description
DB or DI Data or instance data block
<no> Number of the data or instance data block
<object> The following objects exist:

Object Description
A Outputs
Z Counters
E Inputs
M Memory bits
PA Peripheral outputs
PE Peripheral inputs
T Timers

{type} If you specify "type" the S7 data type is specified. This is converted to the
corresponding OLE data type in the OPC server for SIMATIC NET.

S7 Data Types Description OLE Data VB Type


Type
X Bit (bool), bit number VT_BOOL Boolean
must be specified
B Byte (unsigned) VT_UI1 Byte
W Word (unsigned) VT_UI2 Long
D Double word (unsigned) VT_UI4 Double
CHAR Character (signed) VT_I1 Integer
INT Word (signed) VT_I2 Integer
DINT Double word (signed) VT_I4 Long
REAL Floating point VT_R4 Single
STRING Character string, VT_BSTR String
character string length
must be specified

<byte address> <Byte number>, for example MD5 or <byte number>.<bit> for example,
EX1.1 or <byte number>.<string length>, for example DB10,STRING4.20
{quantity} Number of variables of a type to be addressed starting at the address
specified in the "byte address" parameter. It is not possible to specify a
quantity for data type X.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 79
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition.

Do not forget that you must always precede the variable with the
protocol ID and the connection!

Example of Syntax Description


DB5,X12.1 Data block 5, data byte 12, bit 1
DB5,B12 Data block 5, data byte 12
DB5,W10 Data block 5, data word starting at address 10
EX1.1 Input bit 1 in byte 1
EB0 Input byte 0
MB9,3 3 memory bytes starting at memory byte 9
DB5,W10,9 Data block 5, 9 words starting at address 10
DB5,STRING7.30 Data block 5, string with maximum 30
characters (= 32 bytes incl. length prefix) from
address 7

Introduction to the OPC Server for SIMATIC NET


80 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.3.3 Syntax of Variable Names for Field-Oriented Services

Overview With the field-oriented services for the S7 protocol, the OPC server
provides the following advantages:
• Transfer of larger amounts of data
• The transfer can be triggered by the SIMATIC S7 PLC

For data exchange between a SIMATIC S7 PLC and PG/PC, the


connection must be configured at both ends. In contrast to the non-
field-oriented services, the connection configuration created with STEP
7 NETPRO must be downloaded to the PLC. In the field-oriented
services, a pair of blocks BSEND and BRCV are always required.
Either there is a BSEND block on the SIMATIC S7 PLC that
communicates with a BRCV variable of the OPC server (PLC sends to
OPC server) or a BRCV block is programmed on the SIMATIC S7 PLC
that receives data from the BSEND variable of the OPC server.
The amount of data that can be transferred in this way is up to 65534
bytes,
regardless of the size of the CPU. The segmentation of the data
is handled by the function itself.

Syntax The syntax for variables that can receive fields of data is defined as
Block Receive follows: (the part in braces is optional)

BRCV,<RID>{,<type><byte address>{,<quantity>}}

Syntax The syntax for variables with which data fields can be transferred from
Block Send the PG/PC to the partner is as follows:

BSEND<length>,<RID>{,<type><byte
address>{,<quantity>}}

BRCV A BRCV variable contains the last data field received from the partner.
The structure and length of the received data are specified by the
sending partner. For this reason, the data field is transferred as default
in the data type "VT_ARRAY | VT_UI1" (byte array). The variable can
only be read.
There is no practical value in monitoring this variable. The reception of
a data field by the OPC server is reported to a client application.
BSEND A BSEND variable contains a field of data to be sent to a partner
device. The buffer is only transferred to the partner when the variable
itself or a subvariable is written. The value of the send variable that is
read is the last value entered in the send buffer. The data are not read
from the partner device. By default, the variable has the data type
"VT_ARRAY | VT_UI1" (byte array) with the specified length.
Length Appending the length information to the variable name "BSEND"
specifies the length of the send buffer.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 81
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Addressing The addressing parameter R_ID is fixed for a block pair (BSEND/
Parameter RID BRCV) and is specified uniquely within a connection. This means that
several BSEND blocks can send on one connection but always with
their own R_ID. The same R_IDs can be used on other connections.
Structured Access To support the structuring of the received data field, one or more
sections of the data field can be selected and assigned to individual
variables.
When accessing data blocks, a defined notation can be used. Since
the length of a received field is unknown, it is also permissible to
define variables outside the received field. If variables are not filled out
or are filled out only partly by the received data field, the quality of the
item changes to "BAD".
If a subvariable is written, the complete buffer is always transferred to
the partner device. When writing with structured access, subvariables
should always be created on a send field in an OPC group. To prevent
the transfer of uninitialized areas, the subvariables should always
cover the entire send field and all items of a group should be written at
the same time.

{type} If you specify "type" the S7 data type is specified. This is converted to the
corresponding OLE data type in the OPC server for SIMATIC NET.

S7 Data Types Description OLE Data VB Type


Type
X Bit (bool), bit number VT_BOOL Boolean
must be specified
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 (signed) VT_I4 Long
REAL Floating point VT_R4 Single

<byte address> Address in bytes within the send or receive data field, <byte number>, for
example DWORD5 or <byte number>,<bit>, for example X1.1. The address
starts at 0.
{quantity} Number of variables of a type to be addressed starting at the address
specified in the <byte address> parameter. It is not possible to specify a
quantity for data type X.

Introduction to the OPC Server for SIMATIC NET


82 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition.

Do not forget that you must always precede the variable with the
protocol ID and the connection!

Example of Syntax Description


BRCV,1 Entire receive buffer with the R_ID 1
BRCV,1,X1.1 Bit 1 in byte 1 of the receive buffer with R_ID 1
BRCV,1,B2,4 4 bytes from byte 2 in the receive buffer with
R_ID 2
BRCV,1,W2,4 4 words (unsigned 16) from byte 2 in the
receive buffer with R_ID 1
BSEND16,1,D2 Double word (unsigned 32) starting at byte 2
in send buffer with R_ID 1 with size 16
BSEND32,1,CHAR2,4 4 characters (signed 8) starting at byte 2 in
send buffer with R_ID 1 with size 32
BSEND32,1,DINT2,8 8 Double words (unsigned 32) starting at byte
2 in send buffer with R_ID 1 with size 32
BSEND32,1,REAL2,2 2 floating-point (real) numbers starting at byte
2 in send buffer with R_ID 1 with size 32

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 83
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.3.4 Syntax of Variable Names for Messages

Overview S7-400 controllers allow automatic monitoring of bits and the transfer
of a message to a communications partner if the monitored data
change. Along with the event message, up to 10 associated values can
be transferred depending on the S7-CPU.
The OPC server provides the received message information and the
associated values as variables. With the possibility of monitoring
variables, user programs can be informed of the occurrence of
messages.
The use of messages has the following advantages:
• No bus load from cyclic polling of variables; load only when a
change has really occurred
• Transfer of additional information with the message

Configuring S7 messages must be configured with STEP 7 and downloaded to the


S7 controller.
For information on configuring, refer to the STEP 7 documentation.

Message Data When an S7 message is received, a data record is transferred to the


OPC server containing the following information:

• Event state
• Acknowledgment state
• Number of additional values
• Associated values (0 to 10)

For each associated value, information about the data type and the
length of the data record is also available.

Introduction to the OPC Server for SIMATIC NET


84 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax of The message data can be accessed via the following OPC items:
Message Variables
Syntax Description
scan,<EvID>,eventstate State of the bit to be monitored. Data type
VT_UI2, VB type long
Bit Description
Current state of the event
1 to 15 irrelevant

scan,<EvID>,state General message state, data type VT_UI2,


VB type long
Value Meaning
0x00 OK
0x81 No message
scan,<EvID>,ackstate Acknowledgment state, message could be
acknowledged via a different system, the
acknowledgment state is shown here. Data
type VT_UI2, VB type long
Important note:
The OPC server does not provide any
means of acknowledging these messages,
however, other "display devices" could do
this.
Bit Meaning
0 Acknowledgment of
messages (entered state)
8 Acknowledgment of
messages (left state)
Explanation of the term entered state/left
state with messages:
Message entered state: e.g. limit value
exceeded
Message left state: e.g. limit value no
longer violated
scan,<EvID>,noaddvalue Number of associated values supplied with
this message. Data type VT_UI2, VB type
long
scan,<EvID>,pctime Time the message was received by the
OPC server. All message variables contain
the value generated by the S7 controller as
the time stamp. This variable allows the
clocks of the S7 controller and the PC to
be compared. Data type VT_DATE (VB
type date)

<EvID> Normalized message number assigned for this message during


configuration with STEP 7.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 85
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax of Access is possible to the associated values via the following OPC
Associated Values items:
Syntax Description
scan,<EvID>,data<N>,datatype Data type of the nth associated value.
Data type VT_UI2, (VB type long)
Possible values are as follows:
Value Meaning
0 Error in associated value
acquisition
3 Boolean
4 Bit string
5 Integer
6 Octet string
scan,<EvID>,data<N>,value Value of the nth associated value. Data
type VT_Array with the possible types
VT_BOOL, VT_I2, VT_I4, VT_UI1,
VT_ERROR (VB types Boolean, integer,
long, byte, error). If a single value is
transferred, the array has only one entry.
scan,<EvID>,data<N>,valuelen Length of the nth additional value in
bytes. Data type VT_UI2, (VB type long)
scan,<EvID>,data<N>{,S7 Value of the nth additional value in a
syntax} preset data type. Alternate access is also
possible. The S7 syntax is described, for
example in Section 7.3.3.

<N> The name part <N> specifies the associated value to be accessed.
The permitted range is from 0-9. When a message is received, only
the associated values are updated that were actually transferred with
the message. The "quality" of the associated values not supplied with
the message is set to "bad".
The number of associated values supplied with a message is provided
by the variable "scan,<EvID>, noaddvalue".

Introduction to the OPC Server for SIMATIC NET


86 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition for messages.

Do not forget that you must always precede the variable with the
protocol ID and the connection!

Example of Syntax Description


scan,1,eventstate State of the monitored bit for message 1
scan,2,ackstate Acknowledgment state for message 2
scan,3,Noaddvalue Number of associated values that arrived
with the last message for ID 3
scan,4,pctime Time stamp of the arrival of message 4
scan,1,data0 Value of the associated value 0 of the
message 1, represented as a byte array
scan,1,data0,value Value of the associated value 0 of the
message 1, represented as an array with a
data type corresponding to the associated
value
scan,1,data9,dword0 Value of the 9th associated value of the
message 1, represented as DWORD
(starting at byte address 0 of the data buffer)
scan,1,data8,X0.1 Value of the 8th associated value of the
message 1, bit 1 of the byte address 0 is
evaluated and represented as Boolean
scan,1,data7,valuelen Length of the data buffer supplied as
associated value 7 for message 1
scan,1,data7,datatype S7 data type of the associated value 7 for
message 1

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 87
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.3.5 Information Variables Specific to S7

Introduction For monitoring purposes, the OPC server for SIMATIC NET provides
variables for S7 with which information about the S7 communication
and the established connections can be queried. The name of the
information variable must be specified in the parameter ItemID of an
OPC item.
The following information can be obtained:
• Attributes of a virtual device (VMD/VFD)
• Status of an S7 connection
• Status of a virtual device
• Status of the logon for messages

Attributes of a A virtual device (VFD - virtual field device) is the model of a real
Virtual Device device. The &Identify() information variable provides information
about the vendor attributes of a device.
The type of the information variable &Identify() is a VT_ARRAY of
VT_BSTR (VB type string) and contains 3 components:

<vendor>
<model>
<revision>

Example
The item "S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&identify()"
supplies the following information as an array with 3 VT_BSTR via
"VFD1_OPC":
{"SIEMENS AG"|„GES7413-1AE0-0AB0"|"V1.0"}

Introduction to the OPC Server for SIMATIC NET


88 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Status of a Virtual The “&vfdstate()” information variable is used to query the status of a
Device device.
The status value (type VT_ARRAY of VT_VARIANT, VB type string
with 3 components) consists of a
• logical status (type VT_BSTR)
• physical status (type VT_BSTR) and
• detailed information about the local VFD status (type VT_ARRAY
of VT_BSTR).
The parts of the &vfdstate() information variables can have the
following values:

Logical Status
The logical status indicates which services are supported:

Return Value Description

S7_STATE_CHANGES_ALLOWED All services are permitted.

Physical Status
The physical status indicates the operating status of the real device.

Return Value Description

S7_OPERATIONAL The real device is operational.

S7_NEEDS_COMMISSIONING The real device is only operational


after local settings have been
made.

Detailed local status


The detailed local status as an octet string with the structure "hh.hh.hh"
where h = 0..f provides detailed about the local VFD status. The
description of the local VFD must be used to interpret this value.

Example
The item "S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&vfdstate()",
represented as VT_BSTR, returns the following value:

{"S7_STATE_CHANGES_ALLOWED"|"S7_OPERATIONAL"|"02.00.00
"}

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 89
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Connection Status The "&statepath()" and "&statepathval()" information variables


provide the state of a communication connection to a partner device.
While the variable &statepath (type VT_BSTR, VB type string)
represents the result as a string, &statepathval provides a number
(type VT_UI1, VB type byte).
The possible values of the information variables &statepath and
&statepathval are as follows:

Return Value Return Value Description


&statepath() &statepathval()
DOWN 1 Connection is not established

UP 2 Connection is established

RECOVERY 3 Connection being established

ESTABLISH 4 (Reserved for future expansions)

Example
The Item "S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:] &statepath()"
could, for example, provide the following:
"RECOVERY"

State of the Logon The "&stateevent() information variable provides the status of the
for Messages logon for the message services. While the variable &stateevent
represents the result as a string, &stateeventval returns a number (type
VT_UI1, VB type byte).

The possible values of the information variable &stateevent()


(type VT_BSTR, VB type string) are as follows:

Return Value Return Description


&stateevent() Value
&stateevent
val()
NONE 0 No logon for message services

ESTABLISH_SCAN 1 Logon for ALARM message


services active
SCAN 2 SCAN message services are
logged on
ESTABLISH_ALARM 3 Logon for alarm services active

ALARM 4 ALARM message services are


logged on

Introduction to the OPC Server for SIMATIC NET


90 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Example
The Item "S7:[OPC_1|VFD1_OPC|CP_L2_1:]&stateevent()"
could, for example, provide the following:
"SCAN"

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 91
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.3.6 Special Variables for Domain and Password Services

Introduction A domain represents a loadable data area on a programmable


controller. In SIMATIC systems these are the following loadable
blocks:

• Organization blocks (OB),


• Function blocks (FB),
• Functions (FC),
• Data blocks (DB).

A block transferred to a programmable controller is stored in a buffer.


This means that the block is not yet available for an S7 program.
Although the block is visible in the list of data blocks that can be
viewed using the online functions of STEP 7, the block cannot be
opened.
This is first possible after the block has linked into the list of active
blocks.

Available Services Using special variables of the S7-OPC server, the following services
are available for handling loadable areas:

• Downloading blocks from the PC to the programmable


controller.
• Uploading blocks from a programmable controller to the
PC.
• Deleting, linking blocks and compressing memory of the
programmable controller.

Application The domain services allow the transfer and retransfer of data and
program elements between the PC and programmable controller. On
the PC, the loadable areas are saved in files.
To allow a program element to be transferred to the programmable
controller, it must first be downloaded from the programmable
controller to the PC. It is only possible to create blocks with STEP 7.

For example, to change the algorithms of a function block running on a


programmable controller from an operator control and monitoring
station, the algorithms could be stored in different variants of a
function block. The function block is swapped over during operation
using the domain services controlled from an operator station to obtain
a different program function on the programmable controller.
The various variants of the function block must be generated when the
system is created and stored in different files.

Password Services Write and read access to the CPU can be made dependent on the
knowledge of a password. The priority of the password is higher than
that of the keyswitch of the CPU. With the – password – service, a
password can be transferred to a programmable controller as
legitimization.

Introduction to the OPC Server for SIMATIC NET


92 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Read block With the special variable &blockread(), a block can be transferred
from a programmable controller to a file on the PC.
This variable can only be written. Writing a value triggers the transfer
service.
The written value contains the parameter assignment of the service. It
is represented as an array of variant with the following elements:
• Flags
• Block
• File

Element Data Type Description


Flags String One of the following hexadecimal numbers:
0x0040 Reads a linked block, if a destination file
already exists, this is not overwritten
(error message)
0x1001 Reads an unlinked block, an existing
block is overwritten.
0x1040 Reads a linked block, an existing block
is overwritten.
Block String Block type and number. The following types are
possible: OB, DB, FC and FB.
Example: DB10
File String Full path of the file in which the block will be
stored.

Example
To read the OB1 block in a file "c:\temp\ob1.blk", the item
"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blockread()"
must be written with the following value:
{0x0040|OB1|c:\temp\ob1.blk}

(To be able to specify the value as in this example, the type "string"
must be requested as the "requested data type". This string is
converted to the canonical data type by the OPC server.)

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 93
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Write block With the special variable &blockwrite(), a block can be transferred
from a PC to a programmable controller. This variable can only be
written. Writing a value triggers the transfer service.
The written value contains the parameter assignment of the service. It
is represented as an array of variant with the following elements:
• Flags
• File

Element Data Type Description


Flags String One of the following hexadecimal numbers:
0x0000 An unlinked block with the same name
already on the programmable controller
is not overwritten.
File String Full path of the file in which the block is stored.

Example
To send the block in file "c:\temp\ob1.blk" to the programmable
controller, the item
"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blockwrite()"
must be written with the following value:
{0x0000|c:\temp\ob1.blk}

(To be able to specify the value as in this example, the type "string"
must be requested as the "requested data type". This string is
converted to the canonical data type by the OPC server.)

Note After transfer to the programmable controller, the block is not yet
active. It must first be linked into the list of active blocks by using the
special variable &blocklinkin().
Link in block Using the special variable &blocklinkin(), a block can be linked in
from the passive state into the active program of the programmable
controller. The block is then available for the active program.
Remember that by linking in a block, an existing active block is
overwritten without an error message.
This variable can only be written. Writing a value triggers the service.
The value written specifies the block to be linked as the parameter for
this service.

Element Data Type Description


Block String Block type and number. The following types are
possible: OB, DB, FC and FB.
Example: DB10

Introduction to the OPC Server for SIMATIC NET


94 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Example
To link block DB1 in the program execution of the programmable
controller, the item
"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blocklinkin()"
must be written with the following value:
DB1

Delete block Using the special variable &blockdelete(), a block can be deleted on
the programmable controller. Both the passive blocks and those linked
into the program can be removed.
This variable can only be written. Writing a value triggers the service.
The written value contains the parameter assignment of the service. It
is represented as an array of variant with the following elements:
• Flags
• Block

Element Data Type Description


Flags String One of the following hexadecimal numbers:
0x0001 Deletes the unlinked block
0x0040 Deletes the linked block
0x0041 Deletes the linked and unlinked block
Block String Block type and number. The following types are
possible: OB, DB, FC and FB.
Example: DB10

Example
To delete the linked block DB1, the item
"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blockdelete()"
must be written with the following value:
{0x0040|DB1}

Compress Using the special variable &blockcompress(), the memory on the


programmable controller can be compressed.
Fragmented memory areas are shifted together and space created for
the transfer of new blocks.

This variable can only be written. Writing an empty string triggers the
service.

Example
To compress memory, the item
"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blockcompress()"
must be written with an empty string ("").

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 95
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Transfer password Using the special variable &password(), the password for a
connection can be sent to legitimize and cancel the level of protection.
For an S7 programmable controller, three levels protection can be
activated for the domain services 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 are canceled for the connection on which the password was
sent. By sending an empty string as password, the protection function
is activated again on the connection.

On bilaterally configured connections, all services can be executed


even in the RUN key position.

Connections Resulting active protection level


configured at
one end
Protection Password was not Correct password was
level transferred transferred
configured by
Keyswitch setting Keyswitch setting
STEP 7
RUN RUN-P RUN RUN-P
STOP STOP
Keyswitch 2 1 1 1
RUN - can be
canceled by
password
Keyswitch 2 1 2 1
RUN - cannot
be canceled
by password
Write 2 2 1 1
protection with
password
Write/read 3/3 3/3 1 1
protection with
password
Legend:
Resulting active protection level
1: No restriction (read, write, link, delete block, and compress
possible).
2: Read block only
3: No block function allowed.

Introduction to the OPC Server for SIMATIC NET


96 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

The &password() variable can only be written. Writing a variable


triggers transfer of the password. The data type of the variable is
string.
The password can be transferred in the following representations
Representation Description Example
Octet string A string with the 31.32.33.34.35.36.37.38
hexadecimal codes
of the characters of
the password
(maximum 8
characters),
separated by a
period
String Any alphanumeric &12345678
string with a
maximum length of 8
characters preceded
by the character "&".

OPC Error Codes If the following error codes occur in conjunction with passwords, they
have the following significance:
The OPC server returns the error code OPC_E_BADRIGHTS when an
invalid password was sent. Otherwise, the error code
OPC_E_COMMUNICATION is returned.
Further error codes are also possible.

Example
To send the password "SetMeFre" to a programmable controller, the
variable
"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&password()"
must be written with the following value:
&SetMeFre

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 97
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.4 FMS Protocol

5.4.1 Specifications for the FMS Protocol

Open The FMS for PROFIBUS protocol is an open layer 7 communications


Communication protocol based on the ISO/OSI reference model. With FMS,
with FMS communication at the fieldbus level is possible not only with S5 and S7
programmable controllers from Siemens but also with all other devices
that meet the FMS standard.
The FMS-OPC server of SIMATIC NET requires an underlying FMS
protocol software from SIMATIC NET and a suitable communications
processor.
Before starting FMS communication, an FMS database must be
created. Suitable configuration tools are shipped with the protocol
software.

Characteristics of The FMS-OPC server from SIMATIC NET has the following
the FMS-OPC characteristics:
Server
• Automatic analysis of the configuration
• Reading and writing of FMS variables
• FMS server functionality
• Support of arrays and structures, including alternate access
• Support of connections via which no object dictionary (OD), a short
OD or long OD can be downloaded.
• Support of the FMS services Identify and VfdState
• Support of the SAPI service Lifelist
• Display and monitoring of the connection state
• Browsing of the local variables and variables on the server

Introduction to the OPC Server for SIMATIC NET


98 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Establishing The FMS protocol is a connection-oriented communication protocol. A


Connections connection-oriented protocol provides a virtual channel for the user.
The normal sequence of communication is as follows:
• Logon
• Connection establishment
• Load object dictionaries
• Data exchange
• Connection termination
• Logoff
The management of connections is handled by the OPC server for
SIMATIC NET automatically and is not visible for the OPC user.
When an OPC item is accessed or as a result of browsing, the OPC
server establishes the connection to the partner device, as necessary.
The connection name must be specified in the ItemID or in the
AccessPath of the OPC item and configured in the FMS database.

Protocol ID The protocol ID for the FMS protocol is always "FMS“.


Connection Name The connection name consists of three parts:
• The configured name of the FMS connection
• The configured local VFD, at which the OPC server will log on
• The name of the communications processor or the access point of
the application
These parts are separated by the “|” character.
You specify the names of the FMS connections and the VFDs during
configuration.
If an element of the connection name in the configuration is unique, it
can be omitted. If, for example, you have only configured the access
point "CP_L2_1:“ with one VFD_OPC, it is adequate to specify only
the FMS connection.
The name of the communications processor or the access point of the
application is specified by configuration tools of the protocol software.
Typical names are:
• "CP_L2_1:“
• "CP_L2_2:“

Examples of Three examples of connection names are listed below:


Connection Names
• Simocode|VFD_OPC|CP_L2_1:
• S5_5431|VFD1_S5|CP_L2_2:
• Connection|VFD1|access

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 99
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.4.2 Syntax of Variable Names for FMS

Function The variable name identifies the variable to be accessed on the


partner device. FMS variables are accessed using the names that exist
in the object dictionary of the partner device. If the partner device
provides a short object dictionary, it is only possible to access
variables using indexes. If a long object dictionary is provided, the
symbolic names contained in the object dictionary can also be used.

Syntax of the The syntax of a variable is defined as follows, upper and lower case
Variable Names characters are irrelevant:
<index> or
<symbolic name>

For alternate access to structure elements, the syntax is defined as


follows:
<index>:<subindex> or
<symbolic name>:<subindex>

Syntax Examples Several examples of syntax with the connection component are listed
below to illustrate the above definition.

Example of Syntax Description


FMS:[DEMO]100 Variable with Index 100 of the Demo
connection
FMS:[DEMO]Valve_In Variable with the name "Valve_In" of the
demo connection
FMS:[CR1|VFD1|CP_L2_1:] Variable with Index 200 of the connection
200 CR1 via VFD1 to module CP_L2_1:
FMS:[CR1|VFD1|CP_L2_1:] "Count" variable of the connection CR1
Count via VFD1 to the module CP_L2_1:
FMS:[CR1|VFD1|CP_L2_1:] Access to 2 structure elements of the
200:2 variable with index 200

Introduction to the OPC Server for SIMATIC NET


100 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

FMS Types The following table describes the FMS data types and the
corresponding VARIANT data types.

FMS data type Canonical VB Type Meaning


OLE data type
unsigned8 VT_UI1 Byte unsigned char (1 byte)

unsigned16 VT_UI2 Long unsigned short (2 bytes)

unsigned32 VT_UI4 Double unsigned long (4 bytes)

integer8 VT_I1 Integer signed char (1 byte)

integer16 VT_I2 Integer signed short (2 Byte)

integer32 VT_I4 Long signed long (4 bytes)

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.b" where b=0
or 1

ostringX VT_BSTR String Octet string, X: Number of octets,


structure: "hh.hh.hh.hh.hh" where
h=0..f
time_of_day VT_DATE Date time of day

date VT_DATE Date date

time_difference VT_DATE Date time difference

data type[N] VT_ARRAY of Array of the VB FMS array as a safearray with N


element type elementary elements of the type element type.
type *

{Type1|Type2|Type3|Ty VT_ARRAY of Array with FMS structure with 4 different


pe4} VT_VARIANT elements of data types Type1..Type4. *
the respective
elementary
types
* Default setting VT_BSTR

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 101
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.4.3 Information Variables Specific to FMS

Introduction The OPC server for FMS provides variables for with which information
about the FMS communication system and the connection states can
be queried. The name of the information variable must be specified in
the parameter ItemID of an OPC item.
The following information can be obtained:
• Attributes of a virtual device (VMD/VFD)
• Status of a virtual device
• Status of an FMS connection
• Station addresses of the obtainable nodes (LifeList)

Attributes of a A virtual device (VFD - virtual field device) is the model of a real
Virtual Device device. The &Identify() information variable provides information
about the vendor attributes of a device.
Type of the information variable &Identify() is a VT_ARRAY of
VT_BSTR (VB type: string array ) and contains 3 components:

<Hersteller>
<Modell>
<Revision>
Example
The item "FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&identify()"
supplies the following information as an array with 3 VT_BSTR via
"VFD1_OPC":
"SIEMENS AG"
"ET 200U-DP/FMS"
"V1.0"

Introduction to the OPC Server for SIMATIC NET


102 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Status of a Virtual The “&vfdstate()” information variable is used to query the status of a
Device device.
The status value (type VT_ARRAY of VT_VARIANT, VB type: array
with 3 string elements) consists of a
• logical status (type VT_BSTR)
• physical status (type VT_BSTR) and
• detailed information about the local VFD status (type VT_BSTR,
formatted).
The parts of the &vfdstate() information variables can have the
following values:

Logical Status
The logical status indicates which services are supported:

Return Value Description

FMS_STATE_CHANGES_ALLOWED All services are


permitted.
FMS_LIMITED_SERVICES_PERMITTED Only the services
“Status virtual device“
and “Identify virtual
device“ are permitted
FMS_OD_LOADING_NON_INTERACTING Loading an object
dictionary is not
permitted.
FMS_OD_LOADING_INTERACTING An object dictionary is
currently being loaded
on the interface
module.

Physical Status
The physical status indicates the operating status of the real device.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 103
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Return Value Description

FMS_OPERATIONAL The real device is


operational.
FMS_PARTIALLY_OPERATIONAL The real device is
operational with
certain restrictions.
FMS_NEEDS_COMMISSIONING The real device is only
operational after local
settings have been
made.
FMS_INOPERABLE The real device is not
operational.

Detailed local status


The detailed local status as an octet string with the structure "hh.hh.hh"
where h = 0..f provides detailed about the local VFD status. The
description of the local VFD must be used to interpret this value.

Example
The item "FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&vfdstate()",
represented as VT_BSTR, returns the following value:

{"FMS_STATE_CHANGES_ALLOWED"|"FMS_OPERATIONAL"|"00.00
.00"}

Connection Status The "&statepath()" and "&statepathval()" information variables


provide the state of a communication connection to a partner device.
While the variable &statepath (type VT_BSTR, VB type string)
represents the result as a string, &statepathval provides a number
(type VT_UI1, VB type byte).
The possible values of the information variables &statepath and
&statepathval are as follows:

Return Value Return Value Description


&statepath() &statepathval()
DOWN 1 Connection is not established

UP 2 Connection is established

RECOVERY 3 Connection has broken down

ESTABLISH 4 Connection being established

Example 1
The item "FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&statepath()“
could, for example, provide the following:
"UP"

Introduction to the OPC Server for SIMATIC NET


104 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Example 2
The item
"FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&statepathval()“ could,
for example, provide the following:
2 (corresponds to "UP"):

Lifelist The "&lifelist()“ information variable provides information about the


nodes available on the bus.
The value of these variables is provided as VT_ARRAY of VT_UI1 (VB
type: array with 127 elements of the type byte). The array with its 127
elements includes information about every possible station address.
Each station address is assigned an index of the array. Possible values
for one entry are as follows:

Return Value Description

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)

Example
The item "FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&lifelist()",
represented as VT_BSTR, might return the following value:
{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}

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 105
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.4.4 FMS Server Connection

Introduction The FMS-OPC server can itself operate as a server in the sense of the
FMS protocol. As an FMS server, it provides variables and an object
dictionary that other FMS partner devices can access. In this way,
FMS communication between PCs can be established.
Uses A server connection is implicitly assigned to every CP/VFD pair of an
FMS configuration. The variables of this server connection that can
access other FMS partner devices must be described in a
configuration file. For details of configuring a server connection, refer
to Section 8.5.5.
Please note the following: So that an FMS server is available, the OPC
☞ server on this computer must be started by using an OPC clients (for
example OPC Scout).
The variable stipulated in the server connection are available via the
OPC interface as OPC items in the same way as the variables of
another device. If a server variable is written via the OPC interface,
the value of the variable is only changed locally. This new value is
transferred to the querying device the next time an FMS client queries
the value. Reading a server variable via OPC returns the current, local
value. This value can be modified by write access from an FMS client.
Changes to values made by an FMS client are reported to an OPC
client using the OPC mechanisms for reporting value changes.
Diagram The following diagram illustrates how an FMS partner device can
access variables defined on the OPC server.

Access to FMS
variables
Local
access
PC with
OPC
server Partner
device

Text
data OD
base

FMS server FMS client

PROFIBUS network

Introduction to the OPC Server for SIMATIC NET


106 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.5 Send/Receive Protocol via Industrial Ethernet

5.5.1 Specifications for the Send/Receive Protocol

Communication The Send/Receive (SR) protocol for Industrial Ethernet is a layer 4


via Industrial transport protocol according to the ISO/OSI reference model
Ethernet standardized for SIMATIC devices. With Send/Receive,
communication is possible via Industrial Ethernet to S5 and S7
programmable controllers from Siemens and to PCs on which the SR
protocol is installed.
The SR-OPC server of SIMATIC NET requires an underlying SR
protocol software from SIMATIC NET and a suitable communications
processor. The SR protocol software is part of the S7 products of
SIMATIC NET.

Principle of The SR protocol communicates with handling or function blocks that


Communication are running on a programmable controller. The following block types or
job types are available:
• SEND (without WRITE function)
• SEND (with WRITE function only SIMATIC S5)
• RECEIVE
• FETCH (SIMATIC S5 only)
With SEND and RECEIVE, the data exchange is between the SEND
block and the RECEIVE block. The SEND block always initiates
communication. For bi-directional communication, both a SEND and a
RECEIVE block must be called at 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 S5 communications processor to read and read
back data directly from the CPU. With this type of job, direct access to
objects such as inputs, outputs, data blocks, memory bits (flags) and
counters is possible.
For more detailed information about the Send/Receive interface, refer
to the manual "Send/Receive Programming Interface“ and the
documentation of the programmable controller.

Configuring The configuration of Send/Receive communication is not created using


an additional configuration program on the PC. The communication
parameters must be configured in a text file used by the SR-OPC
server.
A SIMATIC S5 partner device handles communication using handling
blocks (HDBs). The handling blocks must be called in the S5 program.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 107
Structure of the OPC Items for the SIMATIC NET Data Access Interface

For communication via a SIMATIC S7 PLC, the function blocks FC5


(SEND) and FC6 (RECEIVE) must be called in the S7 program.
In addition to the use of the handling or function blocks, a suitable
connection configuration of the communications processor of the
programmable controller is necessary.

Characteristics of The SR-OPC server of SIMATIC NET has the following characteristics:
the SR-OPC Server
• Communication via SIMATIC S5 handling blocks and S7 function
blocks
• Support of the services "SEND with WRITE function" and "FETCH“
(S5 only)
• Support of the "Expedited Data“ service (S5 only)
• Fast access to large data packets
• Definition of variables within a data packet
• Display and monitoring of the connection state
• Functionality for browsing defined variables
Protocol ID The protocol ID for the Send/Receive protocol is always "SR“.

Introduction to the OPC Server for SIMATIC NET


108 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Connection Name The connection configuration for the Send/Receive protocol is not
created as with the other protocols in a database assigned to the CP
and written with special configuration tools, but must be created
specifically for each user program.
The SR-OPC server uses a text file for connection configuration in
which the connections and variables to be used by the OPC server are
entered by the user.
A symbolic name is declared for each connection that must also be
used in the designations of the OPC items. For further information
about the structure of the text file, refer to Section 8.6.
The connection name consists of the following parts:
• The symbolic name of the connection as specified in the text file
• The connection parameters for this connection
• The name of the communications processor or the access point of
the application
These parts are separated by the “|” character. The symbolic name or
the connection parameters are used as alternatives. The pipe
character to separate them must always be specified.

Connection The information for the connection parameters is made up as follows:


Parameters
<LocalTSAP>,<HostID>,<RemoteTSAP>,<ActiveFlag>

LocalTSAP Name of the local TSAP. Two notations are possible:

1) Hexadecimal notation: xx.xx.xx.xx.xx.xx.xx.xx


Maximum 8, two digit, hexadecimal values separated by periods.

2) String notation: &TTTTTTTT


Leading & character followed by a maximum 8 printable characters.
The comma must not be used. If you want the TSAP to contain
nonprintable characters, the comma or the pipe character, use the
hexadecimal notation.

HostID Ethernet or TCP/IP address of the partner station. Depending on the


network type, two different notations are distinguished:

1) Ethernet address: xx.xx.xx.xx.xx.xx


Exactly 6 2-digit hexadecimal numbers, separated by periods

2) TCP/IP address: yyy.yyy.yyy.yyy


e.g. 142.011.045.197
Exactly 4 3-digit decimal values, separated by periods

RemoteTSAP TSAP of the partner station. The notation is the same as for the
LocalTSAP parameter

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 109
Structure of the OPC Items for the SIMATIC NET Data Access Interface

ActiveFlag Controls the connection establishment. Possible values:

0 Passive connection establishment, the partner establishes the


connection.

1 Active connection establishment, the partner waits for


connection establishment.

Access Point The name of the communications processor or the access point of the
application is specified by the configuration tools of the protocol
software. Typical names are:
• "CP_H1_1:"
• "CP_H1_2:“
• "S7ONLINE“
Examples of Examples of connection names are listed below:
Connection Names
• |&PC4711,142.011.045.197,&RECVS5,0|CP_H1_1:
(Passive connection establishment, TCP/IP via access CP_H1_1:)
• |65.ff.43.ff,08.00.06.01.26.70,&SENDSEEX,1|S7ONLINE
Active connection establishment, ISO protocol via S7ONLINE
access, alternative notation of the TSAP
• MyConnection||CP_H1_1:
Use of a symbolic name "MyConnection“ from the text file via
access point CP_H1_1:

Introduction to the OPC Server for SIMATIC NET


110 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.5.2 Syntax of Variable Names for SR

Function The variable name identifies the variable to be accessed on the


partner device. SR variables are accessed using fixed names or
aliases corresponding to the job types.
If this is supported by the partner device, direct access to the address
area is possible. This functionality is currently only available for S5
programmable controllers and is identified by the job types FETCH and
WRITE in the S5 connection configuration.

Variable Names The following variable names are specified for each connection:

• RECEIVE
• receiveexp
• send
• sendexp

receive / The complete syntax for the variables for reading out the receive
receiveexp buffer is as follows:

receive{,validvariablesyntax}
receivexp{, validvariablesyntax}

The "receive“ variable contains the last data buffer received from the
partner. The structure and length of the data buffer is not fixed. The
buffer is therefore always supplied as an array of bytes (data type
VT_ARRAY|VT_UI1, VB type: array with elements of the type byte).

The "receiveexp“ variable contains the last, high priority data buffer
received from the partner. Analogous to the "receive“ function, the
buffer is an array of bytes, its length is, however, restricted to 16 bytes.
High-priority data buffers are not supported by all partner devices!

☞ Since these variables correspond to a receive buffer, they can only be


read. If the device is to be read ("DEVICE“), an explicit receive request
block is sent to the protocol. It is therefore advisable to simply monitor
these variables or to read them from the cache.

Valid Variable To support the user when structuring the data to be received, specific
Syntax sections of the buffer can be selected. The following syntax is
mandatory for describing the variables:

• Receive{,}<type><byte address>{,quantity}

• Receiveexp{,}<type><byte address>{,quantity}

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 111
Structure of the OPC Items for the SIMATIC NET Data Access Interface

<type> With "type", you specify the data type. This is converted to the
corresponding OLE data type in the OPC server for SIMATIC NET.
Data Types Description OLE Data VB Type
Type
X Bit (Boolean) VT_BOOL Boolean
Only for objects I,Q,M,P and
OY (read only) and Send /
Receive!
B or BYTE Byte (unsigned 8) VT_UI1 Byte
CHAR Byte (signed8) VT_I1 Integer
W or WORD Word (unsigned 16) VT_UI2 Long
INT Word (signed16) VT_I2 Integer
D or DWORD Double word (unsigned 32) VT_UI4 Double
DINT Double word (signed32) VT_I4 Long
REAL Floating-point, IEEE VT_R4 Single
representation
S5REAL Floating-point, S5 VT_R4 Single
representation

<byte address> Byte address of the variables in the range: <byte number>, e.g. 5
For the bit data type, the requested bit is addressed by
<byte number>.<bit number>. (e.g.: 3.3)
{quantity} Number of variables of a type to be addressed starting at the address
specified in the "byte address" parameter.
Bit arrays are not supported. For the data type X (Boolean), the
specification of a number is omitted or it must be 1.
Syntax Examples Several examples of syntax are listed below to illustrate the above
definition:

Example of Syntax Description


receive,w0,6 6 data words from byte 0 in the receive buffer
receive,dword7 A double word starting at byte 7
receiveexp,REAL0,2 Two real values from byte 0 onwards in the
high-priority receive buffer.

Introduction to the OPC Server for SIMATIC NET


112 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Send / The complete syntax for the variables for writing the send buffer is as
sendexp follows:

send{n}{,validvariablesyntax}
sendexp{n}{, validvariablesyntax}

The "send“ variable contains a permanently available send buffer that


can be transferred to the connection partner. A default value is
specified for the size of the send buffer by the "LenSend“ entry in the
configuration file. The buffer is always supplied as an array of bytes
(data type VT_ARRAY|VT_UI1, VB type: array with elements of the
type byte). Alternatively, the size can also be set using the n parameter
in the variable name.

The "sendexp“ variable contains the permanently existing, high priority


send buffer. Analogous to the "send“ function, the buffer is an array of
bytes, its length is, however, restricted to 16 bytes.

The value of the send variable that is read is the last value entered in
the send buffer. The data are not read from the partner device.

Write access to these and derived variables cause the send buffer to
☞ be transferred to the partner.

These variables and variables derived from them cannot be read.


They must therefore be neither read nor activated. Read access to
these variables may well be responded to by the partner terminating
the connection.

Valid Variable To support the user when structuring the data to be sent, specific
Syntax sections of the buffer can be selected. The following syntax is
mandatory for describing the variables:

• send{n}{,}<type><byte address>{,quantity}

• sendexp{n}{,}<type><byte address>{,quantity}

The notation of the variable syntax corresponds to the syntax for the
receive buffer.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 113
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition.

Example of Syntax Description


send30,dword7 A double word starting at byte 7 in a 30-byte
long send buffer
send,B20 An array with 20 bytes in a send buffer with
the default size
SendExp8,DINT0 A signed double word starting at byte address
0 in the high-priority send buffer

Direct Access Apart from communication using fixed send and receive buffers, the
(S5 only) SR-OPC server also supports direct access to the address area of the
CPU of the partner device. The sender transfers the required address
information to the receiver and this then returns the requested data.
The notation of the variable names for direct access is as follows:
• <area>{,}<type><byte address>{,quantity}

<area> The area specifies which object will be accessed. Possible values are
as follows:
Obtainable Description
Objects
DBnn Data block no. nn
A Outputs
E Inputs
M Memory bits
PAE Peripheral inputs
Z Counters
T Timers
BS System area
AS Absolute start address
DXnn Extended data block
Denn Data block in the external memory
QB Extended I/Os

<type> The notation for the type corresponds to the syntax or the receive
buffer.
<address> The address of the variables in the range.

Please note the following:


☞ Depending on the area, the address specified is either a byte or
word address. When accessing the following areas, the specified
address is interpreted as a word address:

DBnn, BS, AS, DXnn, DEnn, C, T

Introduction to the OPC Server for SIMATIC NET


114 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

{quantity} Number of variables of a type to be addressed starting at the address


specified in the "Address" parameter.

☞ Please note the following:


The configuration of the partner device must be consistent.
Depending on the configuration of the partner device, access to
certain areas will lead to communication errors.
The SR-OPC server can only check the syntax when a variable
logs on. Based on the configuration of the partner, it is not
possible to determine whether the variable is valid on the
partner device.

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition:

Example of Syntax Description


eb2 Input byte 2
DB10,real6,2 2 floating-point values starting at data word (!)
6 in data block 10
Z12 Counter 12

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 115
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.5.3 Information Variables Specific to SR

Introduction The OPC server for Send/Receive provides variables for with which
information the connection states can be queried. The name of the
information variable must be specified in the parameter ItemID of an
OPC item.
The following information can be obtained:
• Status of a connection
• Versions of the Protocol Software

Connection Status The "&statepath()" and "&statepathval()" information variables


provide the state of a communication connection to a partner device.
While the variable &statepath (type VT_BSTR, VB type string)
represents the result as a string, &statepathval provides a number
(type VT_UI1, VB type byte).
The possible values of the information variables &statepath and
&statepathval are as follows:

Return Value Return Value Description


&statepath() &statepathval()
DOWN 1 Connection is not established

UP 2 Connection is established

RECOVERY 3 Connection has broken down

ESTABLISH 4 (Reserved for future expansions)

Example 1
The item "SR:[SR_CONNECTION||CP_H1_1:]&statepath()"
supplies for example the following:
"UP"

Example 2
The item "SR:[SR_CONNECTION||CP_H1_1:]&statepathval()"
could, for example, supply the following:
2 (corresponds to "UP"):

Introduction to the OPC Server for SIMATIC NET


116 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.6 Send/Receive Protocol via PROFIBUS (FDL)

5.6.1 Specifications for the Send/Receive Protocol via PROFIBUS (FDL)

Communication The Send/Receive protocol for PROFIBUS (FDL) is a simple, frame-


via PROFIBUS oriented protocol for SIMATIC devices. It uses the services of the
Fieldbus Data Link (FDL), of layer 2 of the ISO/OSI reference model in
PROFIBUS.
With Send/Receive, communication is possible via PROFIBUS to S5
and S7 programmable controllers from Siemens and to PCs on which
the FDL protocol is available.
The FDL-OPC server of SIMATIC NET requires an underlying FDL
protocol software from SIMATIC NET and a suitable communications
processor. The FDL protocol software is part of the DP products of
SIMATIC NET.

FDL is used Although the Send/Receive OPC server for PROFIBUS is called the
FDL-OPC server below, it uses only the services of the FDL protocol
for convenient access to communication data. Please note that the
entire functionality of the FDL layer cannot be mapped to the OPC
server.

Principle of The FDL protocol communicates with handling or function blocks that
Communication are running on a programmable controller. The following block types or
job types are available:
• SEND (without WRITE function)
• RECEIVE
With SEND and RECEIVE, the data exchange is between the SEND
block and the RECEIVE block. The SEND block always initiates
communication. For bi-directional communication, both a SEND and a
RECEIVE block must be called at both ends.
For more detailed information about the Send/Receive interface, refer
to the manual "FDL Programming Interface“ and the documentation of
the programmable controller.

Configuring The configuration of Send/Receive communication is not created using


an additional configuration program on the PC. The communication
parameters must be configured in a text file used by the FDL-OPC
server.
A SIMATIC S5 partner device handles communication using handling
blocks (HDBs). The handling blocks must be called in the S5 program.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 117
Structure of the OPC Items for the SIMATIC NET Data Access Interface

For communication via a SIMATIC S7 PLC, the function blocks FC5


(SEND) and FC6 (RECEIVE) must be called in the S7 program.
In addition to the use of the handling or function blocks, a suitable
connection configuration of the communications processor of the
programmable controller is necessary.

Properties of the The FDL-OPC server of SIMATIC NET has the following
FDL-OPC Server characteristics:
• Communication via SIMATIC S5 handling blocks and S7 function
blocks
• Fast access to large data packets
• Definition of variables within a data packet
• Display and monitoring of the connection state
• Functionality for browsing defined variables

Protocol ID The protocol ID for the FDL protocol is always “FDL”.

Introduction to the OPC Server for SIMATIC NET


118 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Connection Name The FDL-OPC server uses a text file for connection configuration in
which the connections and variables to be used by the OPC server are
entered by the user.
A symbolic name is declared for each connection that must also be
used in the designations of the OPC items. For further information
about the structure of the text file, refer to Section 8.7.
The connection name consists of the following parts:
• The symbolic name of the connection as specified in the text file
• The connection parameters for this connection
• The name of the communications processor or the access point of
the application
These parts are separated by the “|” character. The symbolic name or
the connection parameters are used as alternatives. The pipe
character to separate them must always be specified.

Connection The information for the connection parameters is made up as follows:


Parameters
<LocalSAP>,<RemoteStation>,<RemoteSAP>

LocalSAP Name of the local SAP activated for communication:

Decimal number in the range from 0 to 62 and 255 (for default SAP).

RemoteStation PROFIBUS address of the partner station:

Decimal number in the range from 0 to 126 or 127 for


muliticast/broadcast

RemoteSAP Name of the SAP of the partner station to which the frames are sent:

Decimal number in the range 0 to 63

Access Point The name of the communications processor or the access point of the
application is specified by the configuration tools of the protocol
software. Typical names are:
• "CP_L2_1:“
• "CP_L2_2:“

Examples of Examples of connection names are listed below:


Connection Names
• |15,7,15|CP_L2_1:
(Communication with station address 7 from SAP 15 to SAP 15 via
access "CP_L2_1:")
• MyConnection||CP_L2_1:
Use of a symbolic name "MyConnection“ from the text file via
access point CP_L2_1:

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 119
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.6.2 Syntax of Variable Names for FDL

Function The variable name identifies the variable to be accessed on the


partner device. Variables are accessed using fixed names or aliases
corresponding to the job types.

Variable Names The following variable names are specified for each connection:

• Receive (access to receive buffer)


• Send (send a buffer)
• SendSDA (send a buffer using SDA service)
• SendSDN (send a buffer using SDN service)

Receive The complete syntax for the variables for reading out the receive
buffer is as follows:

receive{,validvariablesyntax}
The "receive“ variable contains the last data buffer received from the
partner. The structure and length of the data buffer is not fixed. The
buffer is therefore always supplied as an array of bytes (data type
VT_ARRAY|VT_UI1, VB type: array with elements of the type byte).

Since these variables correspond to a receive buffer, they can only be


read. It is therefore advisable to simply monitor these variables or to
read them from the cache.

Valid Variable To support the user when structuring the data to be received, specific
Syntax sections of the buffer can be selected. The following syntax is
mandatory for describing the variables:

• Receive{,}<type><byte address>{,quantity}

Introduction to the OPC Server for SIMATIC NET


120 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

<type> With "type", you specify the data type. This is converted to the
corresponding OLE data type in the OPC server for SIMATIC NET.
Data Types Description OLE Data VB Type
Type
X Bit (Boolean) VT_BOOL Boolean
B or BYTE Byte (unsigned 8) VT_UI1 Byte
CHAR Byte (signed8) VT_I1 Integer
W or WORD Word (unsigned 16) VT_UI2 Long
INT Word (signed16) VT_I2 Integer
D or DWORD Double word (unsigned 32) VT_UI4 Double
DINT Double word (signed32) VT_I4 Long
REAL Floating-point, IEEE VT_R4 Single
representation
S5REAL Floating-point, S5 VT_R4 Single
representation

<byte address> Byte address of the variables in the range: <byte number>, e.g. B5
For the bit data type, the requested bit is addressed by
<byte number>.<bit number>. (e.g.: AX3.3)

{quantity} Number of variables of a type to be addressed starting at the address


specified in the "byte address" parameter.
Bit arrays are not supported. For the data type X (Boolean), the
specification of a number is omitted or it must be 1.

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition:

Example of Syntax Description


receive,w0,6 6 data words from byte 0 in the receive buffer
receive,dword7 A double word starting at byte 7
Receive,REAL0,2 Two real values from byte 0 onwards in the
high-priority receive buffer.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 121
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Send The complete syntax for the variables for writing the send buffer is as
follows:

send{n}{,validvariablesyntax}
The "send“ variable contains a permanently available send buffer that
can be transferred to the connection partner. A default value is
specified for the size of the send buffer by the "LenSendSDA" or
"LenSendSDN"“ entry in the configuration file. The buffer is always
supplied as an array of bytes (data type VT_ARRAY|VT_UI1, VB type:
array with elements of the type byte). Alternatively, the size can also
be set using the n parameter in the variable name.

Write access to these and derived variables cause the send buffer to
be transferred to the partner. The value of the send variable that is
read is the last value entered in the send buffer. The data are not read
from the partner device.

These variables and variables derived from them cannot be read.


They must therefore be neither read nor activated.

Send Services Depending on the combination of the station address and the SAPs
Used specified in the connection part, a special FDL service is used when
writing a send item:

LocalSAP Remote Remote Meaning/Service Used for


Station SAP "Send"

0 to 62, 0 to 126 0 to 62, Send and receive/SDA


255 255

0 to 62, 0 to 126 63 Send only/SDA


255

63 0 to 126 0 to 62, Receive only (no send)


255

0 to 62, 127 63 Broadcast: Only send to


255 all/SDN

63 127 0 to 62, Receive broadcast


255 (no send)

0 to 62, 127 0 to 62, Multicast: Only send to all


255 255 that have activated the
RemoteSAP/SDN

Introduction to the OPC Server for SIMATIC NET


122 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Valid Variable To support the user when structuring the data to be sent, specific
Syntax sections of the buffer can be selected. The following syntax is
mandatory for describing the variables:

• send{n}{,}<type><byte address>{,quantity}

The notation of the variable syntax corresponds to the syntax for the
receive buffer.

SendSDA In special situations, it may be desirable that the service used is not
SendSDN dependent on the combination of the address of the partner station and
the SAPs. By using the names "SendSDA" and "SendSDN", an OPC
client can specify that only the relevant services SDA or SDN are used
for sending. The syntax corresponds to the syntax of "Send". These
special names are not displayed in the OPC Browser.

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition:

Example of Syntax Description


send30,dword7 A double word starting at byte 7 in a 30-byte
long send buffer
send,B20 An array with 20 bytes in a send buffer with
the default size
send8,DINT0 A signed double word starting at byte address
0

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 123
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.6.3 Information Variables Specific to FDL

Introduction The OPC server for Send/Receive via PROFIBUS (FDL) provides
variables for with which information about the connection states can be
queried. The name of the information variable must be specified in the
parameter ItemID of an OPC item.
The following information can be obtained:
• Status/Configuration of the Communication Network
• Versions of the Protocol Software

Bus Parameters The module-specific information variable


FDL:[||<module>]&busparameter() supplies the bus parameters of
the PROFIBUS network operated on the specified module. The values
are returned as a field of the data type VT_UI1 and correspond to the
results returned by the FDL service FDL_READ_VALUE. To interpret
the results of this low-level service, refer to the manual for the FDL
programming interface.
Example: FDL:[CP_L2_1:||]&busparameter()

Local Station The module-specific variable FDL:[||<module>]&ts() returns the


Address station address of the specified module. The data type of this item is
VT_UI1.
Example: FDL:[CP_L2_1:||]&ts()

Node Identification The module-specific variable FDL:[||<module>]&ts() supplies the


of the Local node identification of the specified module. The value is supplied in the
Station "VT_ARRAY|VT_BSTR”. The elements of this field contain the
following information:
"Vendor"
"Controller"
"Hardware Version"
"Software Version"
List of the Nodes The module-specific variable FDL:[||<module>]&lifelist() supplies the
on the Bus list of PROFIBUS nodes obtainable by the specified module.
This information is obtained using the FDL service
FDL_LIFE_LIST_CREATE_REMOTE. Note that this service creates a
significant load on the bus so that this variable should not be
monitored.
The data type of this variable is a field with 127 elements with the
index of each element standing for a PROFIBUS address.
Each element can have one of the following values:

Introduction to the OPC Server for SIMATIC NET


124 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Return Value Description

0x10 Station does not exist, i.e. address not used.

0x20 The station is an active node and is ready for inclusion


in the logical ring of the PROFIBUS network.

0x30 The station is an active node and is already in the


logical ring.

0x00 The station is a passive PROFIBUS node (for example


DP slave)

Node Identification The connection-specific variableFDL:[<connection>]&identify()


of the Partner supplies the node identification of the partner device that can be
Device obtained via the specified connection. The value is supplied in the
"VT_ARRAY|VT_BSTR”. The elements of this field contain the
following information:
"Vendor"
"Controller"
"Hardware Version"
"Software Version"

Example: FDL:[MyConnection||CP_L2_1:]&identify()

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 125
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.7 DPS Protocol

5.7.1 Specifications for the DPS Protocol

Master and Slaves The DPS protocol for PROFIBUS basically specifies a single master
system. For the OPC server for SIMATIC NET, the DP master is a PC
with the appropriate communications processor, for example
CP 5412 (A2). A master addresses slaves cyclically via the fieldbus.
Slaves are generally input/output modules located in a distributed
configuration and equipped with a passive communications module.
The OPC server represents the inputs and outputs of a slave.

Properties of the The DP-OPC server from SIMATIC NET has the following
DP-OPC Server characteristics:
• Variable services access and monitoring of DP inputs
and outputs
• Diagnostic evaluation automatic evaluation of static
diagnostics

Protocol ID The protocol ID for the DPS protocol is always “DPS”.

Connection Name For the DPS protocol, the connection name specifies the
communication access by specifying the communications processor
that communicates with the slaves as the DP master.
The connection name for the DP protocol is DPSONLINE

Access to DP The inputs and outputs of the slave are accessed by specifying the
Variables module number and the I/O area.

DP slaves have a modular structure. A DP slave can have more than


one module with different I/O areas. The modules are assigned during
configuration.

Introduction to the OPC Server for SIMATIC NET


126 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.7.2 Syntax of Variable Names for DPS

Overview The variable name identifies the input or output area in the module of
a slave. Status information of the slaves and the DP master is also
available using variable names.

To describe the syntax, the following notation is used:

Conventions (not part of Meaning


actual syntax)
Pointed brackets ( < > ) Texts in pointed brackets are
mandatory
Braces ( { } ) Texts in braces are optional

Syntax The syntax of the slave inputs and outputs is defined as follows (upper
and lower case irrelevant):
• Inputs:
SlaveM<number>E<format><element>{.bit}{,quantity}

• Outputs:
SlaveM<number>A<format><element>{.bit}{,quantity}

Description of the The individual parameters have the following meaning:


Parameters

<number> Number of the module containing the input or output area.

{format} The "format" element specifies the format in which the data are
supplied. Specifying the format also specifies the data type.
In principle, all specified OLE data types can be read via the
automation interface of OPC. However, certain development tools (for
example Visual Basic) only offer a restricted number of data types.
The following table therefore lists the corresponding Visual Basic type
in which the variable value can be represented.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 127
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Format ID Description OLE Data Type VB 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 (unsigned 16) VT_UI2 Long
INT Integer (signed 16) VT_I2 Integer
DWORD or D Double word (unsigned 32) VT_UI4 Double
DINT Double integer (signed 32) VT_I4 Long
REAL Floating-point number VT_R4 Single
BK Consistent data as an array of bytes VT_ARRAY of VT_UI1 Byte() *
(unsigned 8)
WK Consistent data as an array of words VT_ARRAY of VT_UI2 Long() *
(unsigned 16)

* Default setting in Visual Basic BSTR

<element{.bit}> Number of the element to be accessed (not possible for BK and WK).
The byte address of an element is decided by the data type.

Example:
B2 supplies a byte starting at byte address 2, W2 ,on the other hand,
supplies a word starting at word address 2, corresponding to byte
address 4!

Specification of a bit is only permitted for type X. The address to be


specified is a byte address.

Example:
X2.3 means the 3rd bit of the 2nd byte.

{,quantity} Number of elements (not possible for BK, WK and X). The data type of
the variable is an array with elements (data type VT_ARRAY) of the
specified format. If this part of the name is omitted, the quantity 1 is
assumed and the data type of the variable is not an array.

Introduction to the OPC Server for SIMATIC NET


128 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Syntax Examples Several examples of syntax are listed below to illustrate the above
definition.

Do not forget, that you must always precede the variable with the
protocol ID and the module identifier (for example
"DPS:[DPSONLINE]" )!

Example of Syntax Description


SlaveM003EB0 Input byte 0 (offset 0)
SlaveM003EB1,3 3 bytes starting at input byte 1
(offset 1)
SlaveM003AW3 Output word 3 (offset 6)
SlaveM003ADWORD2 Output double word 2 (offset 8)
SlaveM003EX0.0 Input bit 0 in byte 0
SlaveM003AX3.7 Output bit 7 in byte 3
SlaveM003EBK All input bytes in module 3
SlaveM001AWK All output words in module 1

Predefined DPS The following predefined DPS item is used to query and control the
Item of the Module status of the module:

Item Description
DPS:[ DPSONLINE]&devicestate Status of the module hosting the
slave.
Data type: VT_BSTR with the values
"ONLINE" and "OFFLINE".
By writing these values, the module
can be set to the corresponding
status.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 129
Structure of the OPC Items for the SIMATIC NET Data Access Interface

Predefined OPC The following predefined OPC items exist:


Items of the Slave

Item Description
DPS:[DPSONLINE]SlaveSlvState Current status of the DPS slave. The
data type is VT_BSTR with the
possible values
"DATA_EXCHANGE" and
"NO_DATA_EXCHANGE".
DPS:[DPSONLINE]SlaveAllInputs All input bytes of all input modules
of the slave. The data type is
VT_ARRAY|VT_UI1.
DPS:[DPSONLINE]SlaveAllOutputs All outputs bytes of all output
modules of the slave. The data type
is VT_ARRAY|VT_UI1.
DPS:[DPSONLINE]SlaveMiscReadSl Configuration data of the slave. The
vParCfgData data type is VT_ARRAY|VT_UI1.

Introduction to the OPC Server for SIMATIC NET


130 6GK1971-0BA00-0AA1
Structure of the OPC Items for the SIMATIC NET Data Access Interface

5.8 Symbolic Variable Names (Aliases)

Introduction The SIMATIC NET OPC servers allow the definition and use of
symbolic variable names. This means that OPC applications can be
developed without specific reference to a system configuration and can
be adapted to the variable names and connections of a system.
The symbols are defined within a connection. To specify an item
completely, the connection information must also be provided.

Examples • AccessPath=""
ItemID = "FMS:[Pump_1]voltage"
Pump_1 is configured in the FMS database, voltage is a symbolic
name for an FMS index. Since the VFD and communications
processor are unique, they can be omitted.
• AccessPath = “FMS:[ FMS_CON|VFD1_OPC|CP_L2_1:] “
ItemID1 = “Flow“
ItemID2 = “Fill“
The AccessPath contains the complete connection information and
is used for all items.

Definition Symbolic definitions (aliases) can be defined in a text file before the
OPC server is started. For further details about defining aliases using a
text file, refer to Section 8.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 131
Properties of the OPC Event Server for SIMATIC NET

Introduction to the OPC Server for SIMATIC NET


132 6GK1971-0BA00-0AA1
Properties of the OPC Event Server for SIMATIC NET

6 Properties of the OPC Event Server for


SIMATIC NET

The OPC Event specification gives the vendor of an OPC Event server a great deal of
freedom to map the properties of the programmable controllers on the OPC interfaces
for alarms and events.
This chapter describes the options provided by the OPC specification for Alarm & Events
used by the OPC server for SIMATIC NET, which events are provided by the OPC
server and which additional information is available as attributes.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 133
Properties of the OPC Event Server for SIMATIC NET

6.1 General Information

Simple Event The OPC Event server for SIMATIC NET does not have any
Server configuration information relating to alarm/event handling in an
operator control and monitoring system.

Since the configuration information is missing, the OPC Event server


for SIMATIC NET can only be operated as a "Simple Event Server". A
Simple Event Server passes on only simple messages to the
underlying components. A higher level Alarm/Event Management
Server processes the messages of the lower level Simple Server
taking into consideration configuration information (see next section).

Operator
station 2

Log
Operator printer
station 2

Alarm/Event
Management Server

Simple Alarm/ Simple Alarm/


Event Server Event Server

Attachment to Other device with


communication alarm
system information

Restrictions As a Simple Alarm/Events Server, the OPC Event server for SIMATIC
NET has the following restrictions:

• No conditions
• No state-related events
• No confirmation
• No areas
• No area browsing

Introduction to the OPC Server for SIMATIC NET


134 6GK1971-0BA00-0AA1
Properties of the OPC Event Server for SIMATIC NET

6.2 S7 Protocol

Services Used The S7 protocol provides two protocol mechanisms for transferring
events.

• Configured messages (SCAN)


• Programmed messages (ALARM)

Both message types are used by the OPC Event server for the S7
protocol.

Supported Alarm In keeping with the message types, the OPC Event server provides the
Categories following alarm categories:

• S7_PROCESS_SCAN
• S7_PROCESS_ALARM.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 135
Properties of the OPC Event Server for SIMATIC NET

6.2.1 Events and Parameters

Parameter By calling the "OnEvent" callback function of the client, the client
obtains a list of events. The OPC Event server for S7 supplies server-
specific parameters that are explained in this section.

"szSource" As the source of the message, the OPC Event server for S7 specifies
Parameter the connection information of the reporting S7 device. This
corresponds to the connection portion of an S7 variable for OPC Data
Access:
The connection information is made up of three parts:
• The configured name of the S7 connection
• The configured local VFD, at which the OPC server will be logged
on
• The name of the communications processor or the access point of
the application
These parts are separated by the “|” character.
You specify the names of the S7 connections and VFDs during
configuration.
Example: S7:\AG1|VFD_OPC|CP_L2_1:

Parameter The name of a message is made up of the message mechanism and


"szMessage" the configured message number:
• SCAN<message number>
• ALARM<message number>

Examples: SCAN83
ALARM55

"dwEventType" The OPC Event server supports only the type:


Parameter
OPC_SIMPLE_EVENT
This constant has the value 0x0001.

"dwEventCategory The following values are possible as event categories:


" Parameter
• S7_PROCESS_SCAN = 1
• S7_PROCESS_ALARM = 2

Introduction to the OPC Server for SIMATIC NET


136 6GK1971-0BA00-0AA1
Properties of the OPC Event Server for SIMATIC NET

"dwSeverity" The return value provides information about the importance of the
Parameter event. This return value can be modified in the configuration file for
individual message numbers of a communication partner (see Section
8.4).

"dwNumEventAttrs The number of attributes supplied with the message depends on the
" Parameter number of supplied associated values.
"pEventAttributes" This structure contains the attributes supplied with the event. The
Parameter attributes also include the associated values of the message supplied
by the partner device. The structure is described in the OPC
specification.

Other Parameters The other parameters contain information relevant to the condition-
related events or tracking events. Since these event types are not
supported by the OPC Event server for SIMATIC NET, the remaining
parameters are irrelevant.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 137
Properties of the OPC Event Server for SIMATIC NET

6.2.2 Event Attributes

Supplied An S7 station can send up to 10 associated values with a message or


Attributes an alarm. These associated values are available in the event attributes
via the OPC Alarm & Event interface. This section describes the
attributes supplied with an event by the OPC Event server for
SIMATIC NET.
Configured messages (SCAN) and programmed messages (ALARM)
provide the following attributes:

Introduction to the OPC Server for SIMATIC NET


138 6GK1971-0BA00-0AA1
Properties of the OPC Event Server for SIMATIC NET

Name Value Type Description


EVENT_ATTR_S7_ 6000 VT_DATE Time at which the OPC Event Server received the
PCTIME message.
EVENT_ATTR_S7_ 6001 VT_DATE Time at which the message was generated on the
S7TIME partner device.
EVENT_ATTR_S7_ 6002 VT_UI2 With SCAN messages:
STATE
Indicates the general status, whether the message
exists or not. Possible values:
S7_SCAN_MSG_EXIST OK (value 0x0)
S7_SCAN_NO_MSG message does not exist (value
0x81)

With ALARM messages:


0x00H OK
Bit Meaning
0 Initialization
1 Overflow signal
2 Overflow instance
3 to 5 0, reserved
6 No additional values possible (size)
7 Additional values not obtainable

EVENT_ATTR_S7_ 6003 VT_UI2 Acknowledgment status of the scan object:


ACK_STATE
It is not possible to acknowledge messages using the
OPC Event Server for SIMATIC NET. Messages can,
however, be acknowledged by other user interface
systems.
With SCAN messages:
Bit Description
0 Acknowledgment entered state
1 to 7 irrelevant
8 Acknowledgment left state
9 to 15 irrelevant

With ALARM messages:


Bit Description
0 Acknowledgment 1 entered state
... ...
7 Acknowledgment 8 entered state
8 Acknowledgment 1 left state
... ...
15 Acknowledgment 8 left state

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 139
Properties of the OPC Event Server for SIMATIC NET

Name Value Type Description


EVENT_ATTR_S7_ 6004 VT_UI2 Event state
EVENT_STATE
Bit 0: Current status (1 = active)
Remaining bits: irrelevant

EVENT_ATTR_S7_ 6005 VT_UI2 Number of associated values


NO_DATA
Range of values: 1..10

EVENT_ATTR_S7_ 6006 VT_UI2 Data type of associated value no. 0


DATA00_DATATYPE
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 in
bytes instead of
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
S7_DATATYPE_TIME Time (0x32)
Note:
In ms
S7_DATATYPE_S5TIMETime (0x33)
Note:
BCD coded
EVENT_ATTR_S7_ 6007 VT_UI2 Number of relevant bytes of associated value no. 0
DATA00_VALUE_
LEN
EVENT_ATTR_S7_ 6008 VT_ARRAY | The relevant bytes of associated value no. 0 as array
DATA00 VT_UI1 of bytes.
EVENT_ATTR_S7_ 6010 VT_UI2 Data type of associated value no. 1
DATA01_DATATYPE
EVENT_ATTR_S7_ 6011 VT_UI2 Number of relevant bytes of associated value no. 1
DATA01_VALUE_
LEN
EVENT_ATTR_S7_ 6012 VT_ARRAY | The relevant bytes of associated value no. 1 as array
DATA01 VT_UI1 of bytes.
...

Introduction to the OPC Server for SIMATIC NET


140 6GK1971-0BA00-0AA1
Properties of the OPC Event Server for SIMATIC NET

Name Value Type Description


EVENT_ATTR_S7_ 6042 VT_UI2 Data type of associated value no. 9
DATA09_DATATYPE
EVENT_ATTR_S7_ 6043 VT_UI2 Number of relevant bytes of associated value no. 9
DATA09_VALUE_
LEN
EVENT_ATTR_S7_ 6044 VT_ARRAY | The relevant bytes of associated value no. 9 as array
DATA09 VT_UI1 of bytes.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 141
Configuration of the OPC Server for SIMATIC NET

Introduction to the OPC Server for SIMATIC NET


142 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7 Configuration of the OPC Server for SIMATIC NET

The OPC server for SIMATIC NET must be configured before it can use the underlying
communication systems. This chapter explains the basic configuration using the
configuration program.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 143
Configuration of the OPC Server for SIMATIC NET

7.1 General Information

Introduction The way in which the OPC server for SIMATIC NET operates can be
adapted to the requirements of the area of application.
After installing the OPC server for SIMATIC NET, the configuration
parameters have default values.
To install and start up the OPC server without problems, the
configuration program should be started, the default parameters
checked and necessary parameters must be set.

Configuration Files For more detailed information about the settings, refer to the
configuration files described in Chapter 9.

Call The configuration program of the OPC server for SIMATIC NET can
be called via the Control Panel or from the Start menu in two different
ways:

First Possibility
Double-click the “SIMATIC NET OPC Server” icon in the Control
Panel.

Second Possibility
Start the “OPC Settings” program in the taskbar of Windows (taskbar
Start => SIMATIC => SIMATIC NET => OPC Server => OPC
Settings).

After starting the configuration program, you can make general and
protocol-specific settings in various tab pages.

Entering Changes The settings of the configuration program are updated when you click
the “OK” button or the “Apply” button. The settings (apart from the
trace settings) only become active when you restart the OPC server.
Close all clients to quit the OPC server and then start an OPC client.

Introduction to the OPC Server for SIMATIC NET


144 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7.2 General Settings for all Protocols

Overview In the "OPC Parameters“ tab, you can set general parameters for
operating the OPC server for all protocols.

Active Protocols The OPC server for SIMATIC NET supports simultaneous operation of
more than one protocol. By marking the check boxes "DP Protocol",
"S7 Protocol", "SR Protocol" or "FMS Protocol" you specify the
protocols to be used by the OPC server for communication. If the
underlying communication system does not exist or is incorrectly
configured, this is indicated by error messages when the OPC server
starts up. In this case, eliminate the problem or deactivate the protocol.

Symbol File With the OPC server, apart from the connection-specific alias, a
protocol-independent symbol file can be used. If you intend to use a
symbol file, you must activate the "Symbol File" check box and enter
the path and name of the file in the input box. For detailed information
on creating the symbol file, refer to Section 7.11.

Licenses To operate a protocol, you require the license for the corresponding
SIMATIC NET OPC product. The simulated connections can,
however, be operated without a license.

Trace To debug your own applications it is often extremely useful to be able


to evaluate the correct response of the underlying components.
Particularly errors in the dynamic activities involved in communication
can be traced much more easily. Using trace outputs, a program logs
the actions it has performed.

The OPC server allows OPC-specific (Data Access or Alarms &


Events) and protocol-specific actions to be recorded separately.

Activating Trace To activate the trace output of the OPC-specific actions for Data
Output Access, activate the "Activate OPC Data Access Trace" check box.

To activate the trace output of OPC-specific actions for Alarms &


Events, activate the "Activate OPC Alarms&Events Trace" check box.
The activation of trace outputs slows down program execution
considerably.

Trace File
☞ Enter the path and name of the file in which the trace log will be written
in the “Trace file” text box.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 145
Configuration of the OPC Server for SIMATIC NET

Number of Entries To avoid overtaxing your system with an ever-growing trace file, the
in the File size of the trace file is limited. With the “Number of entries in file”
parameter, you decide how many entries the trace file can hold. If the
trace file is full, it is renamed by changing the file name extension and
a new file is created. This allows you to see the last trace entries in the
renamed file after reaching the maximum number of entries.

Introduction to the OPC Server for SIMATIC NET


146 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7.3 Protocol Settings Specifically for DP

Overview In the “DP Protocol” tab page, you can set parameters for operating
the DP protocol.

"Request Cycle" The "request cycle" parameter specifies the smallest possible interval
Parameter for querying the values of OPC items. Only active items in active
groups are checked. When this time has elapsed, the server checks
whether the value of the OPC items has changed. Changed active
OPC items are then updated in the cache and notified to the user.
The user can set an update rate for each group. If the selected rate is
not supported, the server reports back with an alternative rate
(RevisedUpdateRate) that represents the closest permitted value. The
value 0 requests the fastest permitted “UpdateRate”. The value of the
request cycle set is returned as the minimum update rate.
The value of the minimum update rate must match the timing of the
underlying communications system. It must not be significantly lower
than the time required by the communication system to acquire new
process data.

"Activate The DP OPC server can be operated for tests, presentations and
Simulation development without an underlying communications processor. For
Connection" such situations, there is a configurable simulation module. This
simulation module always has the name DEMO.
This connection can be activated and deactivated with the "Activate
Simulation Module" check box.
For details of configuring the simulation module, refer to Section 8.3.5.

Activating "Access With the OPC server, you can specify the access rights of individual
Rights variables or variable groups. By specifying access rights, you can, for
Configuration" example, prevent variables used for internal calculation from being
overwritten. You configure access rights either in the Tag File
Configurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box means
that the configuration file for access rights is evaluated when the OPC
server starts up. The configuration file for access rights is then opened
along with the general configuration file when you click the "Edit DP
Configuration File" button. For details of the structure of the
configuration file, refer to Section 8.2.

"Edit DP Clicking this button opens a text editor with the active configuration
Configuration File" file. In this file, you can now make changes to the configuration.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 147
Configuration of the OPC Server for SIMATIC NET

Saving and The configuration program also makes changes to the configuration
Activating file that can be overwritten by your changes.
Recommendation:

☞ Click the "Edit DP Configuration File" button only when you have
applied the changes made by the configuration program with the
"Apply" button.

Selecting Access An access point is a name that refers unequivocally to a


Points communication module. The names of the access points are specified
by the configuration program of the underlying protocol software. The
following access points are possible for the DP protocol:
• CP_L2_1:
• CP_L2_2:
• CP_L2_3:
• CP_L2_4:

You select the access point to be used by the OPC server by activating
the check box of the relevant line in the list of available access points.

Unavailable The configuration program recognizes when the access points


Access Points specified in an earlier configuration are no longer valid. Such access
points are then indicated by a red check box. Access points that are no
longer valid are removed from the list of selected access points by the
configuration program. The removal of invalid access points is
prevented, if you activate the check box "Keep unavailable access
points".

Entering your Remember that a selected access point is only entered after you
Selections confirm the properties page with "Apply" or "OK". These modifications
only take effect after you restart the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


148 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7.4 Protocol Settings Specifically for S7

Overview In the “S7 Protocol” tab page, you can set general parameters for
operating the S7 protocol.

"Request Cycle" The "request cycle" parameter specifies the smallest possible interval
Parameter for querying the values of OPC items. Only active items in active
groups are checked. When this time has elapsed, the server checks
whether the value of the OPC items has changed. Changed active
OPC items are then updated in the cache and notified to the user.
The user can set an update rate for each group. If the selected rate is
not supported, the server reports back with an alternative rate
(RevisedUpdateRate) that represents the closest permitted value. The
value 0 requests the fastest permitted “UpdateRate”. The value of the
request cycle set is returned as the minimum update rate.
The value of the minimum update rate must match the timing of the
underlying communications system. It must not be significantly lower
than the time required by the communication system to acquire new
process data.

Activate the The S7 OPC server can be operated for tests, presentations and
Simulation development without an underlying communications processor. For
Connection such situations, there is a configurable simulation connection. This
simulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activate
simulation connection" check box.

Activate "Access With the OPC server, you can specify the access rights of individual
Rights variables or variable groups. By specifying access rights, you can, for
Configuration" example, prevent variables used for internal calculation from being
overwritten. You configure access rights either in the Tag File
Configurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box means
that the configuration file for access rights is evaluated when the OPC
server starts up. The configuration file for access rights is then opened
along with the general configuration file when you click the "Edit S7
Configuration File" button. For details of the structure of the
configuration file, refer to Section 8.2.

"Edit S7 Clicking this button opens a text editor with the active configuration
Configuration File" file. In this file, you can make changes to the configuration.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 149
Configuration of the OPC Server for SIMATIC NET

Saving and The configuration program also makes changes to the configuration
Activating file that can be overwritten by your changes.
Recommendation:

☞ Click the "Edit S7 Configuration File" button only when you have
applied the changes made by the configuration program with the
"Apply" button.

Selecting CP/VFD A VFD is a "Virtual Field Device". It is a simulation of one or more real
Pairs field devices and is used to provide a uniform view of the real plant. Its
function is to provide a unique assignment of real devices to an
application.
The number of available VFDs is specified by the configuration of the
communications system. A VFD contains the connections configured
for this VFD. A separate set of VFDs can be configured for each
communications processor.
An application can log on at one or more VFDs and at one or more
communications processors (CPs). A CP/VFD pair must be assigned to
exactly one application. By selecting a CP/VFD pair, you specify which
module and which VFD (and consequently which connections) are
used in an application for communication.
The FMS OPC server for SIMATIC NET uses all the VFDs configured
on a computer for communication without previous configuration.
Querying and obtaining the existing configuration can take some time.
Since a communications processor can be accessed using several
names, VFDs occur more than once in the list of CP/VFD pairs.
Before you install and start up the S7 OPC server, you should
☞ always select the CP/VFD pairs that are really necessary.
When VFDs are listed in more than one CP/VFD pair, it is advisable to
select the pairs that include an access point (for example CP_L2_1:) .
This means that you can switch over to other CPs without changing the
OPC configuration.
If other applications on this computer use the S7 protocol at the same
time, these programs require their own VFD not used by the OPC
server.

Sample Configuration sample:


Configuration
You only want to use the S7 OPC server for S7 communication with 5
partner devices. You would therefore configure 5 connections in the S7
database that all use the same VFD<1>. You use a CP 5412 (A2).
In the list of CP/VFD pairs, you see for example "CP_L2_1:|VFD<1>"
and "CP 5412 (A2) PROFIBUS|VFD <1>".
Select only the CP/VFD pair "CP_L2:1|VFD <1>".
You specify the CP/VFD pairs to be used by the S7 protocol by
activating the check box in the relevant line.

Introduction to the OPC Server for SIMATIC NET


150 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Unavailable The configuration program recognizes when the CP/VFD pairs


CP/VFD Pairs specified in an earlier configuration are no longer valid. The reason for
this could be the use of a different S7 database or that an access point
has been changed or deleted. Such CP/VFD pairs are then indicated
by a red check box. CP/VFD pairs that are no longer valid are
removed from the list of selected CP/VFD pairs by the configuration
program. The removal of invalid CP/VFD pairs is prevented if you
activate the check box "Keep unavailable VFD/CP pairs".

Entering your Remember that the selected CP/VFD pairs become valid only after
Selections you confirm the Properties page with “Apply” or “OK”. These
modifications only take effect after you restart the OPC server for
SIMATIC NET.

Modifying the If the configuration is modified or you enter a different database for the
Configuration S7 protocol, remember that the selected CP/VFD pairs may no longer
be valid. When you restart the OPC server, you will then receive error
messages.
After modifying the S7 configuration in a way that affects the VFDs or
the CPs being used, check the selected CP/VFD pairs.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 151
Configuration of the OPC Server for SIMATIC NET

7.5 Protocol Settings Specifically for FMS

Overview In the “FMS Protocol” tab page, you can set general parameters for
operating the FMS OPC server.

"Repetitions of FMS sequential services are handled by the FMS OPC server. If an
Sequential error occurs in a single job, it is repeated several times. With the
Services" "Repetitions of sequential services“ parameter, the number of
Parameter repetitions can be set in the range from '0' to '65535'. The default value
is 20.

"Request Cycle" The "request cycle" parameter specifies the smallest possible interval
Parameter for querying the values of OPC items. Only active items in active
groups are checked. When this time has elapsed, the server checks
whether the value of the OPC items has changed. Changed active
OPC items are then updated in the cache and notified to the user.
The user can set an update rate for each group. If the selected rate is
not supported, the server reports back with an alternative rate
(RevisedUpdateRate) that represents the closest permitted value. The
value 0 requests the fastest permitted “UpdateRate”. The value of the
request cycle set is returned as the minimum update rate.
The value of the minimum update rate must match the timing of the
underlying communications system. It must not be significantly lower
than the time required by the communication system to acquire new
process data.

"Activate The FMS-OPC server can be operated for tests, presentations and
Simulation development without an underlying communications processor. For
Connection" such situations, there is a configurable simulation connection. This
simulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activate
simulation connection" check box.
For details of configuring the simulation connection, refer to Section
8.5.6

Activating "Access With the OPC server, you can specify the access rights of individual
Rights variables or variable groups. By specifying access rights, you can, for
Configuration" example, prevent variables used for internal calculation from being
overwritten. You configure access rights either in the Tag File
Configurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box means
that the configuration file for access rights is evaluated when the OPC
server starts up. The configuration file for access rights is then opened
along with the general configuration file when you click the "Edit FMS
Configuration File" button. For details of the structure of the
configuration file, refer to Section 8.2.

Introduction to the OPC Server for SIMATIC NET


152 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

"Edit FMS Clicking this button opens a text editor with the active configuration
Configuration File" file. In this file, you can make changes to the configuration.

Saving and The configuration program also makes changes to the configuration
Activating file that can be overwritten by your changes.
Recommendation:

☞ Click the "Edit FMS Configuration File" button only when you
have applied the changes made by the configuration program
with the "Apply" button.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 153
Configuration of the OPC Server for SIMATIC NET

Selecting CP/VFD A VFD is a "Virtual Field Device". It is a simulation of one or more real
Pairs field devices and is used to provide a uniform view of the real plant. Its
function is to provide a unique assignment of real devices to an
application.
The number of available VFDs is specified by the configuration of the
communications system. A VFD contains the connections configured
for this VFD. A separate set of VFDs can be configured for each
communications processor.
An application can log on at one or more VFDs and at one or more
communications processors (CPs). A CP/VFD pair must be assigned to
exactly one application. By selecting a CP/VFD pair, you specify which
module and which VFD (and consequently which connections) are
used in an application for communication.
The FMS OPC server for SIMATIC NET uses all the VFDs configured
on a computer for communication without previous configuration.
Querying and obtaining the existing configuration can take some time.
Since a communications processor can be accessed using several
names, VFDs occur more than once in the list of CP/VFD pairs.
Before you install and start up the FMS-OPC server, you should
☞ select the CP/VFD pairs that are really necessary.
When VFDs are listed in more than one CP/VFD pair, it is advisable to
select the pairs that include an access point (for example CP_L2_1:) .
This means that you can switch over to other CPs without changing the
OPC configuration.
If other applications on this computer use the FMS protocol at the
same time, these programs require their own VFD not supported by the
OPC server.

Sample Configuration samples:


Configurations
1. You only want to use the FMS OPC server for FMS communication
with 5 FMS partner devices. You would therefore configure 5
connections in the FMS database using COM PROFIBUS that all
use the same VFD<1>. You use a CP 5412 (A2).
In the list of CP/VFD pairs, you see for example
"CP_L2_1:|VFD<1>" and "CP 5412 (A2) PROFIBUS|VFD <1>".
Select only the CP/VFD pair "CP_L2:1|VFD <1>".
You want to use the FMS OPC server as a program based on SAPI
FMS at the same time with 3 FMS partner devices. You have a CP
5412 (A2). You configure the FMS database with COM PROFIBUS for
this CP:
- In the FMS master system 2 VFDs (for example "VFD <1>“ and "VFD
<2>“)
- 3 partner devices each with 2 connections. The first connection is
assigned to VFD <1> the second connection to VFD <2>.
In the list of CP/VFD pairs in the OPC settings, you see for example
"CP_L2_1:|VFD <1>“, "CP_L2_1::|VFD <2>", "CP 5412 (A2)
PROFIBUS|VFD <1>" and "CP 5412 (A2) PROFIBUS|VFD <2>".
For the OPC server, select only the pair "CP_L2_1:|VFD <1>" and use
VFD <2> in your program.

Introduction to the OPC Server for SIMATIC NET


154 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

You specify the CP/VFD pairs to be used by the FMS protocol by


activating the check box in the relevant line.

Unavailable The configuration program recognizes when the CP/VFD pairs


CP/VFD Pairs specified in an earlier configuration are no longer valid. The reason for
this could be the use of a different FMS database or that an access
point has been changed or deleted. Such CP/VFD pairs are then
indicated by a red check box. CP/VFD pairs that are no longer valid
are removed from the list of selected CP/VFD pairs by the
configuration program. The removal of invalid CP/VFD pairs is
prevented if you activate the check box "Keep unavailable VFD/CP
pairs".

Entering your Remember that the selected CP/VFD pairs become valid only after
Selections you confirm the Properties page with “Apply” or “OK”. These
modifications only take effect after you restart the OPC server for
SIMATIC NET.

Modifying the If the configuration is modified or you enter a different database for the
Configuration FMS protocol, remember that the selected CP/VFD pairs may no
longer be valid. When you restart the OPC server, you will then
receive error messages.
After modifying the FMS configuration in a way that affects the VFDs
or the CPs being used, check the selected CP/VFD pairs.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 155
Configuration of the OPC Server for SIMATIC NET

7.6 Protocol Settings Specifically for Send/Receive

Overview In the “SR Protocol” tab page, you can set general parameters for
operating the SR-OPC server.

"Request Cycle" The "request cycle" parameter specifies the smallest possible interval
Parameter for querying the values of OPC items. Only active items in active
groups are checked. When this time has elapsed, the server checks
whether the value of the OPC items has changed. Changed active
OPC items are then updated in the cache and notified to the user.
The user can set an update rate for each group. If the selected rate is
not supported, the server reports back with an alternative rate
(RevisedUpdateRate) that represents the closest permitted value. The
value 0 requests the fastest permitted “UpdateRate”.
The value of the minimum update rate should be selected to suit the
time involved in the underlying communication system. It should not
be significantly lower than the time required by the communication
system to acquire new process data.

“Activate the The SR-OPC server can be operated for tests, presentations and
Simulation development without an underlying communications processor. For
Connection” such situations, there is a configurable simulation connection. This
simulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activate
simulation connection" check box.
For details of configuring the simulation connection, refer to Section
8.6.4

Activating "Access With the OPC server, you can specify the access rights of individual
Rights variables or variable groups. By specifying access rights, you can, for
Configuration" example, prevent variables used for internal calculation from being
overwritten. You configure access rights either in the Tag File
Configurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box means
that the configuration file for access rights is evaluated when the OPC
server starts up. The configuration file for access rights is then opened
along with the general configuration file when you click the "Edit SR
Configuration File" button. For details of the structure of the
configuration file, refer to Section 8.2.

"Edit SR Clicking this button opens a text editor with the active configuration
Configuration File" file. In this file, you can now make changes to the configuration.

Introduction to the OPC Server for SIMATIC NET


156 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Saving and The configuration program also makes changes to the configuration
Activating file that can be overwritten by your changes.
Recommendation:

☞ Click the "Edit SR Configuration File" button only when you have
applied the changes made by the configuration program with the
"Apply" button.

Selecting Access An access point is a name that refers to a communication module. The
Points names of the access points are specified by the configuration program
of the underlying protocol software. A particular module is linked with
this access point. A typical access point set up by installing the
protocol software is CP_H1_1:.
Prior to installing and starting the SR-OPC server, you must specify
which access points are used.
☞ If access points are not specified, the SR-OPC server cannot be
started up.

You select the access point to be used by the OPC server by activating
the check box of the relevant line in the list of available access points.

Unavailable The configuration program recognizes when the access points


Access Points specified in an earlier configuration are no longer valid. Such access
points are then indicated by a red check box. Access points that are no
longer valid are removed from the list of selected access points by the
configuration program. The removal of invalid access points is
prevented, if you activate the check box "Keep unavailable access
points".

Entering your Remember that a selected access point is only entered after you
Selections confirm the properties page with "Apply" or "OK". These modifications
only take effect after you restart the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 157
Configuration of the OPC Server for SIMATIC NET

7.7 Protocol Settings Specifically for FDL

Overview In the “FDL Protocol” tab, you can set general parameters for operating
the FDL-OPC server.

"Request Cycle" The "Request Cycle" parameter specifies the shortest possible interval
Parameter for checking the values of the active OPC items of an active OPC
group. When this time has elapsed, the server checks whether the
value of the OPC items has changed. All changed OPC items are then
updated in the cache and signaled to the user.
The user can set an update rate for each group. If the selected rate is
not supported, the server reports back with an alternative rate
(RevisedUpdateRate) that represents the closest permitted value. The
value 0 requests the fastest permitted “UpdateRate”.
The value of the minimum update rate should be selected to suit the
time involved in the underlying communication system. It should not
be significantly lower than the time required by the communication
system to acquire new process data.

Activate the The FDL-OPC server can be operated for tests, presentations and
Simulation development without an underlying communications processor. For
Connection such situations, there is a configurable simulation connection. This
simulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activate
simulation connection" check box.
For more detailed information in the simulation connection, refer to
Section 8.7.4.

Activating "Access With the OPC server, you can specify the access rights of individual
Rights variables or variable groups. By specifying access rights, you can, for
Configuration" example, prevent variables used for internal calculation from being
overwritten. You configure access rights either in the Tag File
Configurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box means
that the configuration file for access rights is evaluated when the OPC
server starts up. The configuration file for access rights is then opened
along with the general configuration file when you click the "Edit FDL
Configuration File" button. For details of the structure of the
configuration file, refer to Section 8.2.

"Edit FDL Clicking this button opens a text editor with the active configuration
Configuration File" file. In this file, you can now make changes to the configuration.

Introduction to the OPC Server for SIMATIC NET


158 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Saving and The configuration program also makes changes to the configuration
Activating file that can be overwritten by your changes.
Recommendation:

☞ Click the "Edit FDL Configuration File" button only when you
have applied the changes made by the configuration program
with the "Apply" button.

Selecting Access An access point is a name that refers to a communication module. The
Points names of the access points are specified by the configuration program
of the underlying protocol software. A particular module is linked with
this access point. A typical access point set up by installing the
protocol software is CP_H1_1:.
Prior to installing and starting the FDL-OPC server, you must specify
which access points are used.
☞ If access points are not specified, the FDL-OPC server cannot be
started up.

You select the access point to be used by the OPC server by activating
the check box of the relevant line in the list of available access points.

Unavailable The configuration program recognizes when the access points


Access Points specified in an earlier configuration are no longer valid. Such access
points are then indicated by a red check box. Access points that are no
longer valid are removed from the list of selected access points by the
configuration program. The removal of invalid access points is
prevented, if you activate the check box "Keep unavailable access
points".

Entering your Remember that a selected access point is only entered after you
Selections confirm the properties page with "Apply" or "OK". These modifications
only take effect after you restart the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 159
Configuration of the OPC Server for SIMATIC NET

7.8 Protocol Settings Specifically for DPS

Overview In the “DPS Protocol” tab, you can set general parameters for
operating the DPS-OPC server.

"Request Cycle" The "Request Cycle" parameter specifies the shortest possible interval
Parameter for checking the values of the active OPC items of an active OPC
group. When this time has elapsed, the server checks whether the
value of the OPC items has changed. All changed OPC items are then
updated in the cache and signaled to the user.
The user can set an update rate for each group. If the selected rate is
not supported, the server reports back with an alternative rate
(RevisedUpdateRate) that represents the closest permitted value. The
value 0 requests the fastest permitted “UpdateRate”.
The value of the minimum update rate should be selected to suit the
time involved in the underlying communication system. It should not
be significantly lower than the time required by the communication
system to acquire new process data.

Activate the The DPS-OPC server can be operated for tests, presentations and
Simulation development without an underlying communications processor. For
Connection such situations, there is a configurable simulation connection. This
simulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activate
simulation connection" check box.
For more detailed information in the simulation connection, refer to
Section 8.8.3.

Activating "Access With the OPC server, you can specify the access rights of individual
Rights variables or variable groups. By specifying access rights, you can, for
Configuration" example, prevent variables used for internal calculation from being
overwritten. You configure access rights either in the Tag File
Configurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box means
that the configuration file for access rights is evaluated when the OPC
server starts up. The configuration file for access rights is then opened
along with the general configuration file when you click the "Edit DPS
Configuration File" button. For details of the structure of the
configuration file, refer to Section 8.2.

"Edit DPS Clicking this button opens a text editor with the active configuration
Configuration File" file. In this file, you can now make changes to the configuration.

Introduction to the OPC Server for SIMATIC NET


160 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Saving and The configuration program also makes changes to the configuration
Activating file that can be overwritten by your changes.
Recommendation:

☞ Click the "Edit DPS Configuration File" button only when you
have applied the changes made by the configuration program
with the "Apply" button.

Selecting Access An access point is a name that refers to a communication module. The
Points names of the access points are specified by the configuration program
of the underlying protocol software. A particular module is linked with
this access point. A typical access point set up by installing the
protocol software is CP_H1_1:.
Prior to installing and starting the DPS-OPC server, you must specify
which access points are used.
☞ If access points are not specified, the DPS-OPC server cannot be
started up.

You select the access point to be used by the OPC server by activating
the check box of the relevant line in the list of available access points.

Unavailable The configuration program recognizes when the access points


Access Points specified in an earlier configuration are no longer valid. Such access
points are then indicated by a red check box. Access points that are no
longer valid are removed from the list of selected access points by the
configuration program. The removal of invalid access points is
prevented, if you activate the check box "Keep unavailable access
points".

Entering your Remember that a selected access point is only entered after you
Selections confirm the properties page with "Apply" or "OK". These modifications
only take effect after you restart the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 161
Configuration of the OPC Server for SIMATIC NET

7.9 Trace for a Specific Protocol

Introduction To debug your own applications it is often extremely useful to be able


to evaluate the correct response of the underlying components.
Particularly errors of dynamic activities involved in communication can
be traced much more easily. Using trace outputs, a program logs the
actions it has performed.

Call The dialog for configuring the protocol-specific trace is opened by


clicking the "Protocol Trace" button in the tab for the protocol you want
to investigate.

Activating Trace To activate trace output, select the "Activate OPC trace" check box.
Output
The activation of trace outputs slows down program execution
considerably.

Trace File Enter the path and name of the file in which the trace log will be written
in the “Trace file” text box. Different files must be specified for the
OPC trace and the protocol-specific trace.

Create new file... If you select the option "create new file", an existing trace file is
overwritten when you start the OPC server. If you select the alternative
option "append to existing file", the existing trace file has new entries
added to it.

Closing the File By closing the protocol-specific trace file following each entry, there is
Following Each a physical transfer of the data to hard disk. This means that trace
Entry information is retained even if a program crashes.
Activating this option slows down program execution
significantly.

Maximum Number To avoid overtaxing your system with an ever-growing trace file, the
of Entries size of the trace file is limited. With the “Number of entries in file”
parameter, you decide how many entries the trace file can hold. If the
trace file is full, it is renamed by changing the file name extension and
a new file is created. This allows you to see the last trace entries in the
renamed file after reaching the maximum number of entries.

Trace Depth The amount of information to be recorded can be specified for the
protocol-specific trace.

Introduction to the OPC Server for SIMATIC NET


162 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7.10 Quitting the OPC Server

Introduction The OPC server for SIMATIC NET is started automatically by the
operating system when a client wants to use it. The OPC server
includes reference counters to be able to recognize when the last client
is closed. The OPC server then closes itself. This is, however, only
possible when the clients increment and decrement the reference
counters correctly. If a client terminates abnormally, so that the
reference counter cannot be reset, the OPC server does not close
even when no further client is active. The server then continues to
maintain the communications connections.

Quitting the OPC If you click the “Quit OPC Server” button in the “OPC Reset” tab page,
Server you reset the OPC server to a defined status without having to restart
the system. The OPC server terminates all communications
connections and closes itself. Both an active OPC Data Access server
and an OPC Alarms & Events server is closed.
You should first close all the OPC clients that work with the server
☞ otherwise any OPC calls from the clients will be rejected with RPC
errors.

Reason In the "Reason" text box, a reason can be specified that can be
evaluated by a client. Evaluating this information is interesting
particularly in DCOM operation.
Delay The OPC server is closed only after the time specified in the "Delay"
box has expired.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 163
Configuration of the OPC Server for SIMATIC NET

7.11 Symbols for the OPC Server for SIMATIC NET

Introduction The ItemIDs of the OPC servers for SIMATIC NET contain information
about the communication path of the variables. The syntax of the
variables specifies the protocol, the connection and possibly also the
service with which the data will be delivered.

It is, however, often useful to select names of variables that are not
dependent on the configuration of the communication system but
rather reflect the structure of a plant.

With the OPC Event server for SIMATIC NET, it is possible to enter a
symbolic name that is valid for all protocols.

The OPC server for the S7 protocol can also use the symbols created
with the STEP 7 configuration tool in the symbol table and in the
blocks.

Note: The use of symbols as described in this chapter has nothing to


do with the concept of aliases.

Examples The symbolic names can be selected freely.


e.g.

Assembly.Drive.Controller.Setpoint
S7300(1)_CPU416.Motor.Limitswitch

Introduction to the OPC Server for SIMATIC NET


164 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7.11.1 The Symbol File with STEP 7 Symbols

STEP 7 Symbols A symbol file is used to store the symbolic names. This file contains
information about the internal assignment of symbolic names to valid
S7 variable names.

Note:
When using symbols with the OPC server, the symbols are read out
once when the "AddItem" method is called. In subsequent calls, the
client uses the handle generated by the server and can therefore
access the variable directly.

Note:

☞ To be able to access STEP 7 projects, the configuration program for


the symbol file ("Tag File Configurator") must run on the computer with
the "STEP 7" configuration program. The symbol file itself, can be
transferred to the computer with the OPC server during runtime. The
"STEP 7" program is no longer necessary when the OPC server is
running.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 165
Configuration of the OPC Server for SIMATIC NET

The Files "*.wsd" The symbolic names of several S7 programs created with STEP 7 can
and "*.ssd" be entered in the symbol file (*.wsd). The symbol file contains the
symbols of the global symbol table of an S7 program and the symbolic
information stored in blocks.

Along with the file with the extension *.wsd, a file with the extension
*.ssd is also created when the symbol information is stored. While the
wsd file contains all symbols (including the entries marked as
invisible), the ssd file only contains the symbols to be used. Invisible
symbols are not entered in the ssd file. The wsd file is used as the
basis for editing the symbols with the tag file configuration program.
The ssd file is used by the OPC server and is entered in the
configuration program for the OPC server.

Introduction to the OPC Server for SIMATIC NET


166 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

7.11.2 Creating a Symbol File with STEP 7 Symbols

Requirements The Tag File Configurator must run on the computer on which the
"STEP 7" configuration tool is installed. If necessary, install the "OPC
Server" product on the configuration computer with STEP 7.

Starting the Tag Start the Tag File Configurator and create a new project:
File Configurator

Step Procedure
1 Starting the Tag File Configurator
Select the following menu command in the start menu of the Windows taskbar:
(Start => SIMATIC => SIMATIC NET => OPC Server => Tag File Configurator)
2 Creating a new Symbol File
Click the "New" button or select the menu command "File => New".
You can open an existing project by clicking the "Open" button or selecting the menu
command "File => Open".

The following screenshot shows the Tag File Configurator with an


empty symbol file. You can now enter STEP 7 programs and other
symbols in this symbol file.

Now insert the symbols of a STEP 7 program in the symbol file:

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 167
Configuration of the OPC Server for SIMATIC NET

Step Procedure
1 Select a STEP 7 project
Select the menu command "Insert => Program" .
A browser is displayed in which you can select the STEP 7 project and program.
2 Navigate through the projects
In the left-hand box, click the "+" character to open the next level.
The schematic below describes the meaning of the levels in the program hierarchy.
3 Select one or more programs
Æ
Select one or more S7 programs and click the " " to enter the symbols of the selected
program in the symbol file.

STEP 7 projects

PC station in project

SIMATIC stations
networked with PC station

CPU of SIMATIC station

Program in this CPU

Applications of PC station, if
more than one application is
defined for a PC station:

As a result, the Tag File Configurator enters the symbols in the right-
hand list box (see following page).

A symbol file is always created for one Simatic PC station and must
later be initialized on this PC station. If a STEP 7 project does not
contain a PC station, no symbol file can be created for the project.

In this case, first create a SIMATIC PC station with STEP 7 and


configure the connections to the SIMATIC S7 stations whose symbols
you want to access from the PC station.

Introduction to the OPC Server for SIMATIC NET


168 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Note The symbol file contains the connection information created with STEP
7/NetPro. This connection information must also be adopted on the PC
as the configuration. See also Section 7.11.4.

Assigning To distribute the communication load, it is possible to configure several


Connections parallel connections between two partner devices using
STEP 7/NetPro. The information about which of the possible
connections can be used to access a variable with a symbolic name is
stored in the symbol file. As default, all variables with symbolic names
are read via the connection configured last. To assign a variable to a
different connection, follow the steps outlined below:

Step Procedure
1 Select the variable
Select the list of variables in the left window. Click the row containing the required variable
in the right-hand window.
2 Open the selection dialog
Click the arrow button in the cell containing the connection information to display the
possible connections in a combo box.
3 Select a connection
Select the required connection in the dialog box.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 169
Configuration of the OPC Server for SIMATIC NET

7.11.3 Entering Additional Symbols

Introduction Apart from the symbols imported from STEP 7, you can also create
new symbols for existing variables using the Tag File Configurator. To
structure your symbols, you can create blocks. A block, in turn, can
contain lower-level variables or further blocks.
Note Fields and symbols cannot be entered in the CPUs and programs
extracted from STEP 7. It is only possible to create new symbols and
blocks at the lowest level within blocks that have already been created.

Creating blocks In the name space, you can now create blocks for structuring the name
space.

Step Procedure
1 Select the insertion position
Click the lowest level in the tree or click an existing block.
2 Open the input dialog
Click the right mouse button to open the context-sensitive menu. Select the "New Block"
menu command. If you select an insertion position incorrectly within a STEP 7 project, this
menu command cannot be activated.
As an alternative, you can select the "New Block" menu command from the "Insert" menu.
3 Enter the block name
Enter a unique name for the block at this position in the dialog box.

Entering Symbols You can now enter symbols in the block you have created. Follow the
steps outline below:

Introduction to the OPC Server for SIMATIC NET


170 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Step Procedure
1 Select the insertion position
Click the block in the tree in which you want to insert a symbol.
2 Open the input dialog
Click the right mouse button to open the context-sensitive menu. Select the menu command
"New Symbol".
As an alternative, you can select the "New Symbol" menu command from the "Insert" menu.
3 Entering or Selecting the Runtime Names
Enter the runtime names for the specific protocol in the "Runtime Name" column (as
described in Section 5). You can enter the names directly in this table or by clicking the
"Browse" button you can start a browser to search through the names on the OPC server. In
the "Browse" dialog, you can also select several items.
4 Specifying the Symbol Names
Enter a unique name for the symbol in the "Symboli Name" column for each runtime name.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 171
Configuration of the OPC Server for SIMATIC NET

7.11.4 Using Symbols in OPC

Activating To be able to use the symbolic variables of a symbol file in an OPC


Symbols client, you must activate the use of symbolic names and enter the path
of the file to be used. Use the configuration program described in
Section 7.11.2.

Entering a Symbol In the steps described below, you configure the OPC server for the use
File of a symbol file:

Step Procedure
1 Transfer the Symbol File
Transfer the previously created symbol file to the PC station, for example by copying the
symbol file to diskette.
2 Open the OPC configuration program
Start the program "OPC Settings" from the Windows taskbar (taskbar Start => SIMATIC =>
SIMATIC NET => OPC Server => OPC Settings).
3 Activating Symbols
Activate the "Symbol File" check box in the "OPC Parameters" tab.
Enter the path and name of the symbol file transferred to this PC station in the input box
below.

Inclusion in the In STEP 7, when you compile the network configuration with NetPro,
Network databases for the PC stations are created. These databases contain
Configuration configuration information that describes the access path of the PC
station to an S7 station. The databases have the extension "XDB".

A symbol file created from STEP 7 relates to the corresponding XDB


file for the PC station. The connection settings for a symbol in the
symbol file uses the connection information stored in the XDB file.

Note This functionality is only available from STEP 7 V5.0 and higher.

Entering the XDB The steps outlined below explain how to specify an XDB file for a PC
File station:

Introduction to the OPC Server for SIMATIC NET


172 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET

Step Procedure
1 Identify and copy the XDB file
Start STEP 7 and open the project from which you created the symbol file.
Select the PC station that will use the symbol file.
Display the object properties of the PC station and the "Configuration" tab.
Here, you can see the location of the configuration file.
Transfer the file to the PC station, for example by copying the configuration file to diskette.
2 Open the configuration program
Start the "Set PG/PC Interface" configuration program on the PC station, for example from
the taskbar Start => Simatic => SIMATIC NET => Set PG/PC Interface).
3 Enter the configuration file
Select "STEP 7 Configuration" in the configuration program.
Enter the path and name of the configuration file transferred to this PC station in the input
box "Name of the Configuration File".

Name Space The symbolic variables are visible beside the protocol-specific
variables in the name space of the OPC server.

Structure of the The ItemID of the symbolic name consists of the name of the control
ItemIDs engine, the name of the blocks and the name of the symbol. The
individual elements are separated by a period.

For example, the ItemID of a symbolic name "Setpoint" in the


"ConveyorBelt" block of the "Factory1" control engine is made up as
follows:

Factory1.ConveyorBelt. Setpoint

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 173
Configuration Using Files

Introduction to the OPC Server for SIMATIC NET


174 6GK1971-0BA00-0AA1
Configuration Using Files

8 Configuration Using Files

Further settings for the OPC server for SIMATIC NET to allow optimum use must be
entered in configuration files. For the send/receive protocol and the Alarms & Events
interface, the configuration file must be edited to define the connections.
This chapter explains the structure and meaning of the entries in the configuration files
for specific protocols.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 175
Configuration Using Files

8.1 Configuration Files

Overview Along with the OPC server for SIMATIC NET, configuration files are
installed for specific protocols. The configuration files must be
processed to allow optimum use of the products.

Structure of the The text files for configuring the OPC server are structured based on
Files the principle of the ini files of Windows. These are divided into sections
indicated by section names set in [ ]. Following the section name, there
are two assignments of the type "parameter=value". Comments within
the file are preceded by a semicolon.

File Location When you install the OPC server, two configuration files are entered in
the protocol-specific binary folder.

• DP <installation path> \ OPC2.NT \ binDP \ SCoreDP.txt


<installation path> \ OPC2.NT \ binDP \ SCoreDP.sec
• S7 <installation path> \ OPC2.NT \ binS7 \ SCoreS7.txt
<installation path> \ OPC2.NT \ binS7 \ SCoreS7.sec
• FMS <installation path> \ OPC2.NT \ binFMS \ SCoreFMS.txt
<installation path> \ OPC2.NT \ binFMS \ SCoreFMS.sec
• SR <installation path> \ OPC2.NT \ binSR \ SCoreSR.txt
<installation path> \ OPC2.NT \ binSR \ SCoreSR.sec

Content of the .txt The configuration files with the extension txt contain a section for
Files general protocol definition. This is followed by sections for assigning
parameters for access points or connections and for specifying
symbolic names (aliases). A simulation connection can also be
configured with which access is possible when no communications
processor is installed.

Content of the .sec The configuration files with the extension sec allow the access rights
files to individual variables or variable groups to be influenced.

To avoid the possibility of manipulation of the configuration files, it is


☞ advisable for the administrator to restrict write access to these files.

Introduction to the OPC Server for SIMATIC NET


176 6GK1971-0BA00-0AA1
Configuration Using Files

8.2 Configuring Access Rights

Overview In operator control and monitoring systems, it must not be possible for
any user to be able to monitor and manipulate variables that can be
accessed via the protocol. The unintentional writing of internal flag
variables of a programmable controller could have fatal consequences.
With the OPC server for SIMATIC NET, it is possible to restrict the
access rights of the variables that can be accessed using the OPC
server.

The rights specified in the protocol (for example write permission to


peripheral inputs can be further restricted but not extended).

Structure The structure of the sec files for configuring access rights to variables
is the same for all protocols. On the one hand, the global settings for
controlling access rights for a protocol are specified in the sec files.
The sec files also contain the definition of rights for variables and
variable groups.

Entry Meaning
Section [Security] General settings are made in this section.
SecurityLevel 0 No restriction of access rights
1 Access rights are restricted for all users as
specified in the following section.

Default 0

Definition of The global access rights for OPC variables are defined in the section
Access Rights "GlobalSecurityItems". To define areas for variables (all variables of a
connection or a block), you can use placeholders. Areas can be
specified in greater detail using the following definitions.

Entry Meaning
Section [GlobalSecurityItems] Definitions of global rights are defined in this section.
DefaultAccessRights Standard specification of the access rights for all
variables of the protocol not covered in the following
definitions.

(empty) No access to any OPC items of the protocol


R Read-only access to all OPC items
W Write-only access to all OPC items
RW Full access to all OPC items

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 177
Configuration Using Files

Default RW
<OPCItem>=<special rights> New definition of the access rights for a variable. All
previously defined rights are ignored; in other words,
it is also possible to restrict existing rights.
<OPCItem> Specification of one or more OPC items according to
the syntax defined in Chapter 5. This must also
include the connection information. The use of aliases
is possible.
The following placeholders can be used:
* any number of characters are irrelevant
? exactly one character is irrelevant
<special rights> (Empty) No access to the OPC item
R Read-only access to the OPC item
W Write-only access to the OPC item
RW Full access to the OPC item

Examples DefaultAccessRights=R All variables are read-only

S7:[appl1|VFD1|CP_L2_1:]*=RW All items of this connection can


be read and written.
S7:[appl1|VFD1|CP_L2_1:]M*=W The memory bit area of the
device accessible on this
connection is write-only
S7:[appl1|VFD1|CP_L2_1:]MW3=RW Memory word 3 can be read and
written.

Introduction to the OPC Server for SIMATIC NET


178 6GK1971-0BA00-0AA1
Configuration Using Files

8.3 DP Protocol

Overview Editing the configuration file for the DP protocol becomes necessary in
the following situations:

• when you want to change the DP application environment of the


OPC server,
• when you want to restrict access rights to individual DP slaves,
• when you want to create aliases or
• when you want to configure the demo connection

File Location The file location for the configuration file for the DP protocol set during
installation is as follows:

<installationpath> \ OPC2.NT \ binDP \ SCoreDP.txt

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 179
Configuration Using Files

8.3.1 General Protocol Configuration

General Protocol The following table shows the parameters for configuring the general
Configuration properties of the DP protocol.

Entry Meaning
Section [PROTOCOL] The general protocol settings are made in this
section.
CycleTime This value specifies how quickly the job waiting list is
checked through for pending jobs.
Default 100 ms
(is set as "Request Cycle" by the configuration
program)
UseOnlyThisBoard Number of the module at which the DP OPC server
logs on. Several numbers are separated by commas.
A logged on module has the name CP_L2_n, where n
corresponds to the module number.
Caution: The last module number must be
terminated by a comma.
Example:
UseOnlyThisBoard =1,2,
Default: 1,2,3,4,
(set by the configuration program)
UseDemoBoard 1 The DP OPC server generates a simulation
connection with which slave access can be
simulated without a functioning protocol.
0 No simulation connection is provided.
Default 0
(set by the configuration program)
CycleNet reserved

Introduction to the OPC Server for SIMATIC NET


180 6GK1971-0BA00-0AA1
Configuration Using Files

8.3.2 Module-Specific Configuration

Overview Each module has up to 3 sections in the configuration file. In the first
section, module-specific parameters are configured, in the second
section special slave settings can be made and in the third section
aliases can be defined for variables.
The configuration is evaluated when the OPC server starts up.

The following table describes the module-specific configuration


parameters.

Entry Meaning
1st module section Configuration parameters for this module
[module name]
e.g.
[CP_L2_1:]
ReferenceAccess Setting for the DP application type and the DP
application environment.
The permitted values correspond to the DP
structure element reference.access (see DP
documentation).

0x50 (DPN_SYS_NOT_CENTRAL |
DPN_ROLE_NOT_CENTRAL)
Several equal ranking DP applications are
possible, The OPC server changes
automatically to the "OPERATE" mode.

0xA0 (DPN_SYS_CENTRAL |
DPN_ROLE_CENTRAL)
The OPC server is a master application and
must set the mode explicitly. The OPC server
variable "Masterstate" must have suitable
value set.

0x60 (DPN_SYS_CENTRAL |
DPN_ROLE_NOT_CENTRAL)
There is another master application and this
must set the mode explicitly. The OPC server
is a subordinate application.
Access to slaves is possible only in the
"OPERATE" mode.
Default 0x50
WatchdogTimeout Configuration of the watchdog of the module. If
the OPC server no longer accesses the DP
programming interface (due to a problem), the
module reacts automatically as described in the
documentation of the module. (For example the
CP 5412 (A2): data with the value 0 is sent to all

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 181
Configuration Using Files

Entry Meaning
slaves assigned to the OPC server).
0 The watchdog is off.
n The watchdog responds after n milliseconds
without any access to the programming
interface.
For example, the OPC server accesses
programming interface periodically when DP
variables are monitored.
The watchdog can be modified during operation
with the variable
DP:[CP_L2_n:]WatchdogTimeout.
Default 6000 ms
Timeout Error monitoring time: If a pending DPC1 job
cannot be processed within this monitoring time,
the job is acknowledged with an error.
Default 15000 ms
AutoDiag 0 The diagnostic monitoring and evaluation is
off.
N Lock time for error diagnostics. The OPC
server monitors the diagnostic flag
automatically when the slave inputs/outputs
are accessed and evaluates the diagnostic
data of the standard slaves. If errors or
problems are detected in the diagnostic data,
access to the slave inputs/outputs is locked
for n ms; in other words, read/write jobs are
acknowledged with errors.
Default 500 ms

Introduction to the OPC Server for SIMATIC NET


182 6GK1971-0BA00-0AA1
Configuration Using Files

8.3.3 Slave Configuration

Overview
The entries in the 2nd section specify the access rights of the slaves in
the database.

Entry Meaning
2nd module section Settings for access rights
[module name(slaves)]
e.g.
[CP_L2_1:(slaves)]
AccessSlaveDefault If there are other DP applications on the same
module, access to individual DP slaves must be
e.g. specified. If access to the individual slaves by
the DP applications is inconsistent (for example
AccessSlaveDefault=1 2 applications have write access to the same
slave), the logon of the entire module fails and
none of the slaves are available.
This entry defines how the default access to
slaves is set when you log on. Access can be
adapted for individual slaves (see below). The
following values are possible:
1 As default, only read access to all slaves is
possible
2 As default, read and write access to all
slaves is possible
Default 2
AccessSlave<no> Normally, all available slaves of the module are
set for read/write access when the module logs
e.g. on. A different default can be set for each slave,
as follows:
AccessSlave003=0
0 No access to slave
AccessSlave063=1
AccessSlave107=2 1 Read-only access to slave
2 Read/write access to slave
The slave number is always 3 digits, and must be
padded with leading zeros. The OPC server does
not enter any values in this section. If there is no
entry, the default is used.
Default 2

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 183
Configuration Using Files

8.3.4 Definition of Symbolic Names

Defining Aliases The third section of the configuration file allows the definition of
symbolic names for a valid DP variable. An alias is a purely textual
substitute for an otherwise valid DP variable name.

Nesting of aliases is not supported, in other words an alias must always


refer directly to a valid DP variable.

The following table describes the section for defining aliases.

Entry Meaning
3rd module section Predefined aliases for this module. The section
[module name (aliases)] name is made up of the module name and
e.g. "(Aliases)".
[CP_L2_1:(Aliases)]
Alias=DPVariable This section contains any number of alias
e.g. definitions.
The symbolic name "Motor" references the 3rd
Motor=Slave012M002EX0.3
input bit of slave 12. The name "Heatingpower"
Heatingpower=Slave23M003AW3
references an output word of slave 23.
Alias The alias can be used just like a normal DP
variable on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) . (period) & (), ANSI > 127
DPVariable Internally, the OPC server replaces the variable
name of the alias with this DP variable.

Introduction to the OPC Server for SIMATIC NET


184 6GK1971-0BA00-0AA1
Configuration Using Files

8.3.5 Configuration of the DP Demo Connection

Introduction For demonstrations, for testing, or during development it is useful to be


able to operate the OPC server for the DP protocol without additional
hardware. The OPC server therefore allows you to simulate a module
with several slaves. The configuration of the demonstration module is
described below.
Requirements The demo module can be activated by the configuration program or
using the "UseDemoBoard“ parameter in the "PROTOCOL“ section of
the configuration file.
Name The simulated module always has the name "DEMO".
Just like a normal module, the demo module also has three
configuration sections.

Entry Meaning
1st section of the demonstration module Connection-specific parameters. No parameters
[DEMO] are defined within this section.

Entry Meaning
2nd connection section Configuration of the simulated slaves
[DEMO(Slaves)]

Slave<no>=configuration data Specification of the Demonstration Slaves based


on the Slave Configuration Data.
e.g.

Slave003=|R|unsigned8[2]|{00|19}
(corresponds to ET200B 32DI}
Slave004=|R|unsigned8[2]|{35|00}
(corresponds to ET200B 32DO}

Slave<no> The slave number is always 3 digits, and must be


padded with leading zeros. Read/write access is
always possible to a simulated slave.
Configuration Data The syntax of the configuration data is always
|R|unsigned8[ll]|{dd|....|dd}
where ll specifies the length of the configuration
data in bytes, dd are the decimal values of the
configuration data
For information on interpreting the configuration
data see the "DP Programming Interface"
manual.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 185
Configuration Using Files

Entry Meaning
3rd connection section Predefined aliases for the simulated module.
[DEMO(Aliases)]
Alias=DPVariable This section contains any number of alias
e.g. definitions.

Motor=Slave012M2EX0.3 Alias Motor input bit of a slave


Heatingpower=Slave23M01AW3 Alias Heatingpower refers to an output word of a
slave.
Alias The alias can be used just like a normal DP
variable on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) . (period) & (), ANSI > 127
DPVariable On the OPC interface, the occurrence of the
alias is replaced by this DP variable.

Introduction to the OPC Server for SIMATIC NET


186 6GK1971-0BA00-0AA1
Configuration Using Files

8.4 S7 Protocol

Overview Editing the configuration file for the S7 protocol becomes necessary in
the following situations:

• when you want to change connection parameters


• when you want to create aliases
• when you want to configure the demo connection
• when you want to configure S7 Alarms & Events

File Location The file location for the configuration file for the OPC server for the S7
protocol set during installation is as follows:

<installationpath> \ OPC2.NT \ binS7 \ SCoreS7.txt

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 187
Configuration Using Files

8.4.1 General Protocol Configuration

General Protocol The following table shows the parameters for configuring the general
Configuration properties of the S7 OPC server.

Entry Meaning
Section [PROTOCOL] The general protocol settings are made in this
section. You can also make parameter settings for the
trace of the underlying protocol software (SAPI-S7).
S7_MINI_DB_PERSISTENCE_COUNT For selectable SAPI-S7 mini-dB parameters, see
SAPI documentation
Default 5
S7_MINI_DB_ABORT_TIMEOUT For selectable SAPI-S7 mini-dB parameters, see
SAPI documentation
Default 300
ConfigProtocolTrace SAPI-S7 trace parameters are set
Default 0
S7_MINI_DB_TRACE_TARGET Selectable SAPI-S7 trace parameter, see SAPI
S7_MINI_DB_TRACE_SELECT documentation
S7_MINI_DB_TRACE_DEPTH
S7_MINI_DB_TRACE_FILENAME

CycleTime This value specifies how quickly the job waiting list is
checked through for pending jobs.
Default 100 ms
(is set as "Request Cycle" by the configuration
program)
UseAllAvailableVFD 1 The S7-OPC server logs on at all available
VFD|CP pairs. Since the search for VFD|CP pairs
in particular can take some time, the VFD|CP pairs
that are actually required should be set using the
configuration program.
0 The S7-OPC server logs on only at the VFD|CP
pairs specified in the UseOnlyThisVFD parameter.
Default: 1
(set by the configuration program)

Introduction to the OPC Server for SIMATIC NET


188 6GK1971-0BA00-0AA1
Configuration Using Files

Entry Meaning
UseOnlyThisVFD VFD|CP pairs at which the S7-OPC server logs on.
Several pairs are separated by commas.
Caution: The last VFD|CP pair must be terminated
by a comma.
Example:
UseOnlyThisVFD=VFD1|CP_L2_1:,VFD2|CP_L2_2:,
(set by the configuration program)
UseDemoConn 1 The S7-OPC server generates a simulation
connection with which variable access can be
simulated without a functioning protocol.
0 No simulation connection is provided.
Default 0
(set by the configuration program)
StoreEventsTime Time after which a pending protocol alarm is removed
from the internal waiting list if it cannot be passed on
to an OPC Alarms & Events client.
Default 60000 ms
StoreEventsCount Maximum number of waiting protocol alarms in the
internal waiting list, that cannot be passed on to an
OPC Alarms & Events client immediately after the
protocol alarm occurred.
Default 500

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 189
Configuration Using Files

8.4.2 Connection-Specific Configuration

Overview Each S7 connection has up to 3 sections in the configuration file. The


connection-specific parameters are configured in the first section, in
the second section, aliases for variables can be defined.
The configuration is evaluated when the OPC server starts up.

The following table describes the connection-specific configuration


parameters.

1. Connection section

Entry Meaning
[Connection|VFD|CP] Connection-specific parameters, the section
e.g. names correspond to the connection names.
[AG1|VFD1|CP_L2_1:]
S7_MINI_DB_INIT_REQ_AMQ_CALLING SAPI-S7 parameters that are set by the client
S7_MINI_DB_INIT_REQ_AMQ_CALLED during connection establishment, refer to the
S7_MINI_DB_INIT_REQ_AMQ_SIZE SAPI documentation.
S7_MINI_DB_INIT_REQ_RSP_CALLING
S7_MINI_DB_INIT_REQ_RSP_CALLED
S7_MINI_DB_INIT_REQ_RSP_SIZE

InitiateReq 0 The connection is never established


1 The connection is established when required;
in other words when a variable is accessed
via this connection.
2 The connection is always established
actively.
Default 1

Introduction to the OPC Server for SIMATIC NET


190 6GK1971-0BA00-0AA1
Configuration Using Files

Entry Meaning
Passive 0 The OPC server actively establishes the
connection to the partner device
1 The partner device establishes the
connection. The InitiateReq parameter is
ignored in this case.
Default 0
AbortConnectionAfter 0 The OPC server only terminates a connection
to a partner when the OPC server is closed
down. During operation of the OPC server,
once a connection has been established it
remains even when it is no longer used.
n>0
The OPC server terminates a connection
automatically n milliseconds after the last use
of the connection. This property must not be
used if the parameter Passive=1 is set.
Default 0
Timeout Error monitoring time: If a pending job cannot be
processed within this monitoring time, the
connection is reset and the job is acknowledged
with an error.
Default 15000 ms
Events Administrating Messages (logon)
0 Never
1 SCAN messages as soon as appropriate
OPC items are used
2 SCAN messages always after connection
establishment
3 ALARM messages always after
connection establishment

One of the settings 2 or 3 is necessary for


passing on S7 messages to OPC Alarms &
Events clients. At the same time, it is
recommended to set the parameter InitiateReq to
2 so that the connection is maintained
permanently.

Default 1
OptimizeS7Write 0 No optimization of S7 write access
1 Optimization of S7 write access

Optimization of S7 write access is recommended


when a lot of (> 50) small S7 items (for example
bits or bytes) of an S7 area (for example memory
bit area or data block) must be written
SIMULTANEOUSLY and WITHOUT GAPS
(entire bytes) (for example MX0.0 – MX10.7). In
this case, the write jobs are put together to form
one single write job for the larger area bringing

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 191
Configuration Using Files

Entry Meaning
about a reduction in load on the network and on
the partner. If the conditions SIMULTANEOUSLY
and WITHOUT GAPS are not met, the
performance of the core server may deteriorate.

Default 0
OptimizeS7Read 0 No optimization of S7 read access
n Optimization of S7 read access with gap
area n-1
e.g. n = 3 -> 2 bytes gap area permitted.

Optimization of S7 read access is recommended


when a large number (> 50) of S7 items of an S7
area (for example bit memory area or data block)
must be read or monitored actively
SIMULTANEOUSLY. In this case, the read jobs
are put together to form one single read job for
the larger area bringing about a reduction in load
on the network and on the partner. S7 items
covering the same area (for example MB0 and
MW0) are put together. The larger area to be
read can have n small gaps according to the
setting. We recommend that you set the value 11
for "n" (10 bytes gap). If the condition
SIMULTANEOUSLY is not met, the performance
of the core server may deteriorate.

Default 11
AutoPasswordReset 0 No automatic resetting of the S7
domain password
1 Automatic resetting of the S7 domain
password after connection establishment

Default 0

Introduction to the OPC Server for SIMATIC NET


192 6GK1971-0BA00-0AA1
Configuration Using Files

8.4.3 Definition of Symbolic Names

Defining Aliases The second section of the configuration file allows the definition of
symbolic names for a valid S7 variable. An alias is a purely textual
substitute for an otherwise valid S7 variable name.

Nesting of aliases is not supported, in other words an alias must always


refer directly to a valid S7 variable.

The following table describes the section for defining aliases.

2. Connection section

Entry Meaning
[Connection|VFD|CP(Aliases)] Predefined aliases for this connection. The
e.g. section name is made up of the connection name
[AG1|VFD1|CP_L2_1:(Aliases)] and the additional "(Aliases)".
Alias=S7Variable This section contains any number of alias
e.g. definitions.
The symbolic name "Motor" references output
Motor=AB0
byte 0; the name "Heatingpower" references data
Heatingpower=DB10,W0
word 0 in data block 10.
Alias The alias can be used just like a normal S7
variable on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) & (), ANSI > 127
S7Variable Internally, the OPC server replaces the variable
name of the alias with this S7 variable.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 193
Configuration Using Files

8.4.4 Settings for S7 Messages

To pass on S7 messages to the OPC Alarms & Events clients, the severity of the event is
required as the event parameter. This information is, however, not supported by the protocol
and is not contained in the S7 messages themselves.

The following table describes the section for settings for S7 messages expected via an S7
connection.

Entry Meaning
3rd connection section S7 message severities specified for this
[Connection|VFD|CP(Severities)] connection
e.g. The section name is made up of the
[AG1|VFD1|CP_L2_1:(Severities)] Connection name and "(Severities)".

DefaultScan Range of values: 1 <= n <= 1000


Severity for scan messages for which no explicit
severity was specified

Default 300

DefaultAlarm Range of values: 1 <= n <= 1000


Severity for scan messages for which no explicit
severity was specified
Default 500

MessageNN=Severity This section contains any number of severity


e.g. settings for individual S7 messages.

Scan456=200 S7 scan message ID546 has severity 200


Alarm333=900 S7 alarm message ID333 has severity 900
Message Either
Scan (S7 scan message)
Alarm (S7 alarm message)
NN S7 ID of the message, range of values 0 <= NN
<= 2^32 - 1
Severity Severity, range of values 1 <= n <= 1000

Introduction to the OPC Server for SIMATIC NET


194 6GK1971-0BA00-0AA1
Configuration Using Files

8.4.5 Configuration of the S7 Demo Connection

Introduction For demonstrations, for testing, or during development it is useful to be


able to operate the S7-OPC server without additional hardware. For
this reason, the S7-OPC server provides the option of using simulated
S7 variables in a demo connection via the OPC interface.
Requirements The demo connection can be activated by the configuration program or
using the "UseDemoCon“ parameter in the "PROTOCOL“ section of
the configuration file.
Name This demonstration connection always has the name DEMO. Make
sure that no other connection with this name exists in your network
configuration.
The demonstration connection contains the objects E, A, PE ,PA ,M
and data block 10. Variables can be created using alias definitions.

Entry Meaning
[DEMO(Aliases)] Aliases predefined for the demo connection.

Alias=S7Variable This section contains any number of alias


e.g. definitions.
The symbolic name "Motor" references output
Motor=AB0
byte 0; the name "Heatingpower" references data
Heatingpower=DB10,W0
word 0 in data block 10.
Alias The alias can be used just like a normal S7
variable on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) & (), ANSI > 127
S7Variable Internally, the OPC server replaces the variable
name of the alias with this S7 variable.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 195
Configuration Using Files

8.5 FMS Protocol

Overview Editing the configuration file for the FMS protocol becomes necessary
in the following situations:

• when you want to change the handling of the object dictionary for a
connection. As default, a short object dictionary is loaded.
• when you want to change connection parameters
• when you want to change variable definitions or create aliases,
• when you want to configure the server connection or
• when you want to configure the demo connection

File Location The file location for the configuration file of the FMS-OPC server set
during installation is as follows:

<installationpath> \ OPC2.NT \ binFMS \ SCoreFMS.txt

Introduction to the OPC Server for SIMATIC NET


196 6GK1971-0BA00-0AA1
Configuration Using Files

8.5.1 General Protocol Configuration

General Protocol The following table shows the parameters for configuring the general
Configuration properties of the FMS-OPC server.

Entry Meaning
Section [PROTOCOL] The general protocol settings are made in this
section. You can also make parameter settings for the
trace of the underlying protocol software (SAPI-FMS).
FMS_MINI_DB_SEQ_REPEAT_CNT Selectable SAPI-FMS Mini-DB parameter, see SAPI
documentation
Default 20
(set by the configuration program)
FMS_MINI_DB_OD_NAME_LENGTH Selectable SAPI-FMS Mini-DB parameter, see SAPI
documentation
Default 32
ConfigProtocolTrace SAPI-FMS trace parameters are set
Default 0
FMS_MINI_DB_TRACE_TARGET Selectable SAPI-FMS trace parameter, see SAPI
FMS_MINI_DB_TRACE_SELECT documentation. The numeric values corresponding to
FMS_MINI_DB_TRACE_DEPTH the constants in the SAPI header files must be
FMS_MINI_DB_TRACE_FILENAME entered.

CycleTime This value specifies how quickly the job waiting list is
checked through for pending jobs.
Default 100 ms
(is set as "Request Cycle" by the configuration
program)
UseAllAvailableVFD 1 The FMS-OPC server logs on at all available
VFD|CP pairs. Since the search for VFD|CP pairs
in particular can take some time, the VFD|CP pairs
that are actually required should be set using the
configuration program.
0 The FMS-OPC server logs on only at the VFD|CP
pairs specified in the UseOnlyThisVFD parameter.
Default: 1
(set by the configuration program)

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 197
Configuration Using Files

Entry Meaning
UseOnlyThisVFD VFD|CP pairs at which the FMS-OPC server logs on.
Several pairs are separated by commas.
Caution: The last VFD|CP pair must be terminated
by a comma.
Example:
UseOnlyThisVFD=VFD1|CP_L2_1:,VFD2|CP_L2_2:,
(set by the configuration program)
UseDemoConn 1 The FMS-OPC server generates a simulation
connection with which variable access can be
simulated without a functioning protocol.
0 No simulation connection is provided.
Default 0
(set by the configuration program)
CycleNet >0 The FMS-OPC server sends an fms_receive() call
to the protocol cyclically. This is intended to
eliminate protocol bottlenecks.
0 The FMS-OPC server only sends an fms_receive()
call to the protocol when it receives a WM_SINEC
message from the driver.
Default 1000 ms
WaitMultipleOD 0 A timeout error is generated if the read OD job
cannot be executed in the timeout time.
1 If a job for reading the OD cannot be executed
because there is another OD job pending on
another connection, the job is delayed until it can
be executed. This does not cause a timeout error.
Default 1

Introduction to the OPC Server for SIMATIC NET


198 6GK1971-0BA00-0AA1
Configuration Using Files

8.5.2 Connection-Specific Configuration

Overview Each FMS connection has up to 3 sections in the configuration file. In


the first section, connection-specific parameters are configured, in the
second section variables can be predefined and in the third section
aliases can be defined for variables.
The configuration is evaluated when the FMS-OPC server starts up.

The following table describes the connection-specific configuration


parameters.

Entry Meaning
1st connection section Connection-specific parameters, the section
[Connection|VFD|CP] names correspond to the connection names.
e.g.
[AG1|VFD1|CP_L2_1:]
FMS_MINI_DB_INIT_REQ_PASSWORD SAPI-FMS parameter set at the client end during
FMS_MINI_DB_INIT_REQ_ACCESS_GR connection establishment, refer to the SAPI
OUPS documentation (for example for passwords).
FMS_MINI_DB_INIT_RSP_PASSWORD
FMS_MINI_DB_INIT_RSP_ACCESS_GRO
UPS
FMS_OD 1 Following connection establishment, the
object dictionary is read by the partner and
the variables it contains are evaluated. Since
reading the object dictionary puts a
considerable load on the network and delays
the connection establishment, whenever
possible this should be omitted and local
object dictionaries used.
0 No object dictionary is read from the partner.
Caution: If no object dictionary is read,
access to variables on this connection is only
possible when a local object dictionary exists
or variables are configured in the
[connection(variables)] section of the text
database.
Default 1

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 199
Configuration Using Files

Entry Meaning
FMS_MINI_DB_OD_FORMAT 0 A short object dictionary is read from the
partner.
1 A long object dictionary is read from the
partner. The long object dictionary contains
additional information such as the variable
name and access rights. The long object
dictionary can only be read when the
connection configuration is suitable.
Default 0
FMS_OD_LOCALFILE Path and file name of the local object dictionary.
InitiateReq 0 The connection is never established actively
1 The connection is established actively when
the partner device is accessed.
2 The connection is always established actively
regardless of its use.
Default 1
AcceptInitiateInd 1 A connection establishment request from the
partner is always accepted.
2 The connection establishment request of the
partner is not accepted, the FMS-OPC server
can, however, attempt to establish the
connection to the partner itself.
Default 1
AbortConnectionAfter 0 The FMS-OPC server never terminates a
connection itself (except when the FMS-OPC
server is closed down)
n>0
The FMS-OPC server terminates a
connection automatically after n ms after the
last use of the connection.
Default 0
Timeout Error monitoring time: If a pending job cannot be
processed within this monitoring time, the
connection is reset and the job is acknowledged
with an error.
Default 15000 ms

Introduction to the OPC Server for SIMATIC NET


200 6GK1971-0BA00-0AA1
Configuration Using Files

8.5.3 Variable Definition

Overview The following section of the configuration file allows the definition of
the FMS variables valid for this connection. For access to variables,
the FMS protocol requires information about the properties of the
variables, for example, data type, access rights etc. Variables of a
connection that are required often can be predefined in this section so
that, for example, the data type is known prior to connection
establishment.
An alternative to defining variables in this section is the use of a local
object dictionary.

The following table describes the parameters for variable definition.

Entry Meaning
2nd connection section Variables predefined for this connection. The
[Connection|VFD|CP(Variables)] section name consists of the connection name
e.g. and the additional part "(Variables)".
[AG1|VFD1|CP_L2_1:(Variables)]
Name=Index|AccessRights|Type This section contains any number of variable
e.g. definitions

NAME100=100|RW|boolean Boolean
NAME101=101|RW|integer8|NAME102=10 1 byte integer
2|RW|integer16|NAME103=103|RW|integer 2 bytes integer
32 4 bytes integer
NAME104=104|RW|unsigned8 1 byte unsigned integer
NAME105=105|RW|unsigned16 2 bytes unsigned integer
Power=106|RW|unsigned32 4 bytes unsigned integer
Temperature=107|RW|float 4 bytes floating point
NAME108=108|RW|vstring5 Character string 5 characters
NAME109=109|RW|bstring8 Bit string 8 bits
NAME112=112|RW|integer8[4] Array of 4 integers
NAME119=119|RW|ostring5[3] Array of 3 octet strings with a length of 5 bytes
NAME120=120|RW|{integer8|float|vstring3}
| Structure with integer, floating point and
character string with 3 characters
Structures can have a maximum of 10
components.
FMS-Date
NAME130=130|RW|fmsdate
FMS-TimeOfDay
NAME131=131|RW|fmstimeofday4
FMS-TimeDifference
NAME132=132|RW|fmstimedifference4
FMS-TimeOfDay (with days from 01.01.1984)
NAME133=133|RW|fmstimeofday6
FMS-TimeDifference (with days from
NAME134=134|RW|fmstimedifference6 30.12.1899)

The individual elements of the variable definition


must be separated with the pipe character '|' and

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 201
Configuration Using Files

Entry Meaning
must not contain blanks.
Name Name in the long object dictionary
Range of values: Length maximum 32
characters, however not longer than defined in
the FMS_MINI_DB_OD_NAME_LENGTH
parameter in the [PROTOCOL] section.
Permitted characters: a-z A-Z 0-9 $ . (period) _
(underscore), ANSI >127
Index FMS variable index, must be higher than 15.
AccessRights R means read access, W means write access,
RW means read and write access.
Type FMS types: The string types vstring, ostring,
bstring, fmstimeofday and fmstimedifference
require additional length information, with bstring
this is always a multiple of 8. Arrays require the
number of array elements in square brackets,
structures can only contain simple data types in
the braces (in other words no arrays or
structures).

Introduction to the OPC Server for SIMATIC NET


202 6GK1971-0BA00-0AA1
Configuration Using Files

8.5.4 Definition of Symbolic Names

Defining Aliases The third section of the configuration file allows the definition of
symbolic names for a valid FMS variable. An alias is a purely textual
substitute for an otherwise valid FMS variable name or FMS variable
index.

Nesting of aliases is not supported, in other words an alias must always


refer directly to a valid FMS variable.

The following table describes the section for defining aliases.

Entry Meaning
3rd connection section Predefined aliases for this connection. The
[Connection|VFD|CP(Aliases)] section name is made up of the connection name
e.g. and the additional "(Aliases)".
[AG1|VFD1|CP_L2_1:(Aliases)]
Alias=FMSVariable This section contains any number of alias
e.g. definitions.
The symbolic name "Motor“ refers to FMS Index
Motor=100
100, the "Heatingpower“ name refers to the FMS
Heatingpower=Power
name "Power".
Alias The alias can be used just like a normal FMS
variable on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) & (), ANSI > 127
FMSVariable Internally, the OPC server replaces the variable
name of the alias with this FMS variable.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 203
Configuration Using Files

8.5.5 Configuration of the FMS Server Connection

Introduction The FMS-OPC server can also be operated as an FMS server as well
as an FMS client. Via an FMS server connection, the FMS-OPC server
provides variables that can be accessed by other FMS devices.
To be able to act as an FMS server, the OPC server must be started
with the help of an OPC client (for example OPC Scout).

Configuration Each FMS VFD|CP pair implicitly has one server connection. All the
communications partners of a VFD|CP pair can access the variables
defined on the server connection via the communication system. The
variables of the server connection are addressed like normal FMS
variables on the OPC interface of the FMS-OPC server. Just like a
normal FMS connection, the server connection also contains three
configuration sections.

The name of the connection section is made up of the name of a


VFD|CP pair. In this section, a symbolic name can be defined for the
server connection that is then used in further sections.

Entry Meaning
1st connection section General server parameters
[|VFD|CP]
The connection name of the server connection is
e.g.
empty unless otherwise configured, in other
[|VFD1|CP_L2_1:]
words it consists only of the VFD and CP name.
Server Activating the server connection
1 The VFD-specific server connection is
created.
2 The VFD-specific server connection is not
created.
Default 1
ServerConnectionName The server connection can be assigned a
connection name. This must be different from
the FMS connection name of this VFD. If a
connection name is entered here, all the names
of the sections are changed correspondingly.
Default ”empty”

Introduction to the OPC Server for SIMATIC NET


204 6GK1971-0BA00-0AA1
Configuration Using Files

Entry Meaning
2nd connection section Contains defined variables for the server
[|VFD|CP(Variables)] connection. If a name is entered in
e.g. "ServerConnectionName" in the 1st connection
[|VFD1|CP_L2_1:(Variables)] section, this name must precede the entries
here. Example:
[MyServer|VFD1|CP_L2_1:(Variables)]
Name=Index|AccessRights|Type|Initial- This section contains any number of variable
value definitions
e.g.

100=100|RW|boolean|-1 Boolean
101=101|RW|integer8|-123 1 byte integer
102=102|RW|integer16|-12345 2 bytes integer
103=103|RW|integer32|-1234567 4 bytes integer
104=104|RW|unsigned8|234 1 byte unsigned integer
105=105|RW|unsigned16|23456 2 bytes unsigned integer
Power=106|RW|unsigned32|2345678 4 bytes unsigned integer
Temperature=107|RW|float|1,345 4 bytes floating point
108=108|RW|vstring5|"abcde" Character string 5 characters
109=109|RW|bstring8|1.0.0.1.1.0.0.0 Bit string 8 bits
112=112|RW|integer8[4]|{10|20|30|40} Array of 4 integers
119=119|RW|ostring6[3]|{00.01.02.03.04.0 Array of 3 octet strings with a length of 6 bytes
5|40.41.42.43.44.45|d0.d1.d2.d3.d4.d5}
120=120|RW|{integer8,float,vstring3}|{- Structure with integer, floating point and
55|3|5|"xyz"} character string with 3 characters

130=130|RW|fmsdate|23:59:59 01.01.1999 FMS date


131=131|RW|fmstimeofday4|12:00:00 FMS time of day
132=132|RW|fmstimedifference4|01:10:22 FMS time difference
133=133|RW|fmstimeofday6|17:12:59 FMS time of day (with days from 01.01.1984)
01.01.1985
134=134|RW|fmstimedifference6|17:12:45 FMS time difference (with days from 30.12.1899)
01.01.1901
Structures can have a maximum of 10
components.

The individual elements of the variable definition


must be separated with the pipe character '|' and
must not contain blanks (exception: initial value
of a vstring).
Name Name in the long object dictionary
Index FMS variable index, must be higher than 15.
AccessRights R Read access
W Write access
RW Read and write access.
The access rights refer only to access by the
communications partner to this variable via FMS
connections. Read and write access to these
variables via the OPC interface is always
possible.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 205
Configuration Using Files

Entry Meaning
Type FMS types: The string types vstring, ostring,
bstring, fmstimeofday and fmstimedifference
require additional length information, with bstring
this is always a multiple of 8. Arrays require the
number of array elements in square brackets,
structures can only contain simple data types in
the braces (in other words no arrays or
structures).
Initialvalue The initial value must always correspond to the
particular data type. All initial values of arrays or
structures must be enclosed in braces and be
separated by the pipe symbol "|". The initial
value is optional but should always be used.

Entry Meaning
3rd connection section Aliases predefined for the server connection.
[|VFD|CP(Aliases)]
e.g.
[|VFD1|CP_L2_1:(Aliases)]
Alias=FMSVariable This section contains any number of alias
e.g. definitions.

Motor=100 Alias Motor references FMS index 100.


Heatingpower=Power Alias Heatingpower references FMS name
Power.

Alias The alias can be used just like a normal FMS


variable on the OPC interface.
FMSVariable On the OPC interface, the occurrence of the
alias is replaced by this FMS variable.

Introduction to the OPC Server for SIMATIC NET


206 6GK1971-0BA00-0AA1
Configuration Using Files

8.5.6 Configuration of the FMS Demo Connection

Introduction For demonstrations, for testing, or during development it is useful to be


able to operate the FMS-OPC server without additional hardware. For
this reason, the FMS-OPC server has the option of defining variables
in a demo connection and using these simulated FMS variables via the
OPC interface.
Requirements The demo connection can be activated by the configuration program or
using the "UseDemoCon“ parameter in the "PROTOCOL“ section of
the configuration file.
Name This demonstration connection always has the name DEMO. Make
sure that no other connection with this name exists in your network
configuration.
Just like a normal FMS connection, the demo connection also has
three configuration sections.

Entry Meaning
1st connection section Connection-specific parameters. No parameters
[DEMO] are defined within this section.

Entry Meaning
2nd connection section Variables defined for the demo connection.
[DEMO(Variables)]

Name=Index|AccessRights|Type|Initial- This section contains any number of variable


value definitions.

see Server Connection (8.5.5) see Server Connection


Name Name in the long object dictionary
Index FMS variable index, must be higher than 15.
AccessRights R Read access
W Write access
RW Read and write access.
Read and/or write access to these variables via
the OPC interface is possible depending on the
access rights.
Type FMS types, the string types vstring, ostring and
bstring also require length information. Arrays
require the number of array elements in square
brackets, structures in braces must only contain
simple data types (in other words no arrays or
structures).

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 207
Configuration Using Files

Initialvalue The initial value must always correspond to the


particular data type. All initial values of arrays or
structures must be enclosed in braces and be
separated by the pipe symbol "|". The initial
value is optional but should always be used.

Entry Meaning
3rd connection section Aliases predefined for the demo connection.
[DEMO(Aliases)]
Alias=FMSVariable This section contains any number of alias
e.g. definitions.

Motor=100 Alias Motor references FMS index 100.


Heatingpower=Power Alias Heatingpower references FMS name
Power.

Alias The alias can be used just like a normal FMS


variable on the OPC interface.
FMS Variable On the OPC interface, the occurrence of the
alias is replaced by this FMS variable.

Introduction to the OPC Server for SIMATIC NET


208 6GK1971-0BA00-0AA1
Configuration Using Files

8.5.7 Creating a Local Object Dictionary

Introduction The defined variables are contained in an object dictionary of an FMS


server. Normally, FMS devices can make this object dictionary
available to the partner device via the communication system. An FMS
client requires information from the object dictionary (for example
defined indexes and access rights) to access variables.
Local Object Depending on the partner device, loading an object dictionary can take
Dictionary a considerable amount of time. If high indexes were configured within
an object dictionary, the connection establishment can be considerably
delayed. There is also a significant increase in load on the network.
The situation is made worse since the communication software cannot
query the object dictionaries of different devices at the same time.
If a system consists of several FMS servers that are accessed by the
PC as FMS client, the startup phase of the system can take an
extremely long time and it is even possible that no reliable connection
establishment is possible.
For this reason, the FMS-OPC server provides the option of using an
object dictionary loaded at a different time and maintained in local
storage.
Creation To create a local object dictionary, you require the ODUPLOAD.EXE
program. This is installed in the same folder as the configuration file.
<installationpath> \ OPC2.NT \ binFMS \ ODUPLOAD.EXE
To start the program, open an MS DOS box with the system prompt
and change to the relevant folder with "cd <installationpath>opc2.nt \
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 CP|VFD pair. The "filename“ parameter specifies the path and file
name of the local object dictionary 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 this parameter is
0. With the "timeout“ parameter, the time is specified in milliseconds
after which an error is detected. The standard value is 120000 for 2
minutes.
Example: odupload "AG <1>|VFD <1>|CP_L2_1:" myconn.od 1
240000
Uses To allow the local object dictionary to be used for a connection, the
path and file name of the created file must be entered as the value for
the parameter "FMS_OD_LOCALFILE“ in the connection section. The
"FMS_OD“ parameter must also be set to 0 to prevent the transfer of
the object dictionary via the network.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 209
Configuration Using Files

8.6 Send/Receive Protocol

Overview Editing the configuration file for the Send/Receive protocol becomes
necessary in the following situations:

• when you want to use symbolic connection names in each variable


name instead of specifying connection parameters completely.
• when you want to modify variable definitions or create aliases
• when you want to configure the demo connection

File Location The file location for the configuration file for the SR-OPC server set
during installation is as follows:

<installationpath> \ OPC2.NT \ binSR \ SCoreSR.txt

Introduction to the OPC Server for SIMATIC NET


210 6GK1971-0BA00-0AA1
Configuration Using Files

8.6.1 General Protocol Configuration

General Protocol The following table shows the parameters for configuring the general
Configuration properties of the SR-OPC server.

Entry Meaning
Section [PROTOCOL] The general protocol settings are made in this
section.
CycleTime This value specifies how quickly the job waiting
list is checked through for pending jobs.
Default 100 ms
(set by the configuration program)
UseOnlyThisDevice Access points (devices) at which the SR-OPC
server logs on. Several access points are
separated by commas.
Caution:The last access point must be
terminated by a comma.
Example:
UseOnlyThisDevice=TCPIP:, CP_H1_1:,
UseDemoConn 1 The SR-OPC server generates a simulation
connection with which variable access can be
simulated without a functioning protocol.
0 No simulation connection is provided.
Default 0
(set by the configuration program)
BufferLength Segmentation of the data buffer
Range of values 512 – 4096
A change in the default maximum value is only
required when you are operating a TF database
of the SIMATIC NET TF communication protocol
at the same time. The maximum value must be
matched with the buffer pool of the TF database
(PDU size setting in the COML TF configuration
tool, refer to the TF documentation).
Default 4096

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 211
Configuration Using Files

8.6.2 Connection Configuration for a Specific Access Point

Overview Each access point used by the SR-OPC server has a section in the
text database file in which connections to network partners including
symbolic names can be predefined. The advantage of this is that when
the configuration is changed, (for example changed Ethernet address
on the communication partner) the address only needs to be changed
at one central point if the symbolic name was also used by the OPC
application in the SR variables.

The following table describes the configuration parameters for the


access points:

Entry Meaning
Access point section Connection predefined for this access
[Access point(Connections)] point. During operation, further
e.g. connections can be used with suitable
[CP_H1_1:(Connections)] SR variable notations.
Name=LocalTSAP,HostID,RemoteTSAP,ActiveFla This section contains any number of
g connection definitions.
e.g.
Passive connection establishment,
S5Receive=&PCPCPCPC,142.11.45.150,&RECVR TCPIP
ECV,0
S5Send=FF.FF.FF.FF, 142.11.45.150,AA.AA.AA,1 Active connection establishment, TCPIP,
as alternative TSAP
S5Fetch=&PCPCPCPC,08.00.06.01.26.70,&PCPC Active connection establishment, ISO
PC01,1
S5Write=&PCPCPCPC,08.00.06.01.26.70,&PCPC Active connection establishment, ISO
PC02,1
S5ReceiveExp=&PCPCPCPC,08.00.06.01.26.70,& Passive connection establishment, ISO
RECVREEX,0
S5SendExp=&PCPCPCPC,08.00.06.01.26.70,&SE Active connection establishment, ISO
NDSEEX,1
The individual elements of the
connection definition must be separated
by commas and must not contain blanks.
Name Symbolic connection name,
Range of values: Length maximum 32
characters, permitted characters: a-z A-Z
0-9 $ _ (underscore)
LocalTSAP Local TSAP, two notations are possible:
1. Hex Notation
xx.xx.xx.xx.xx.xx.xx
maximum 8 two-digit hexadecimal
values separated by periods.
2. Alternative String Notation
&TTTTTTTT
preceding & symbol followed by a
maximum of 8 printable characters. The
comma must not be used.
If you want non-printable characters or

Introduction to the OPC Server for SIMATIC NET


212 6GK1971-0BA00-0AA1
Configuration Using Files

Entry Meaning
commas in the TSAP name, you must
use hexadecimal notation.
HostID Ethernet or TCP/IP address of the
partner station.
1. Ethernet
xx.xx.xx.xx.xx.xx
exactly 6 two digit, hexadecimal
values separated by periods.
2. TCP/IP
yyy.yyy.yyy.yyy
exactly 4 3-digit decimal values
between 0 and 255 separated by
periods.
RemoteTSAP TSAP of the partner station, the notation
is the same as for LocalTSAP.
ActiveFlag 0 Passive establishment, the
partner establishes the
connection
1 Active establishment, the
partner waits for
connection establishment

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 213
Configuration Using Files

8.6.3 Connection-Specific Configuration

Overview Each SR connection has up to two sections in a text database file. The
connection-specific parameters are configured in the first section, in
the second section, aliases for variables can be defined. The
configuration is evaluated when the SR-OPC server starts up.

The following table describes the configuration parameters for the


connections:

Entry Meaning
1st connection section Connection-specific parameters
[Connection Name|Address|Access Point] If no symbolic name exists for a connection, this
e.g. must be used, otherwise the symbolic address.
[LocalClient||TCPIP:] They must not both be used at the same time.
[|&TCP2,142.11.45.150,&TCP1,1|TCPIP:]
Conn_persistance_count SR parameter of the SR variable field 1, see SR
documentation
Default 0
Conn_abort_timeout SR parameter of the SR variable field 1, see SR
documentation
Default 0
Conn_negot_options SR parameter of the SR variable field 1, see SR
documentation
Default 0x0000
AbortConnectionAfter 0 The SR-OPC server never terminates a
connection itself (except when the SR-OPC
server is closed down)
n > 0 The FMS-OPC server terminates a
connection automatically n ms after the last
use of the connection.
Default 0
S5Access Controls the access rights to variables for the
"FETCH" and "SEND with WRITE function"
modes. By using this parameter, you can, for
example, prevent a read job being requested on
a SEND connection which would lead to a
connection close by the partner.
0 S5 variables are not permitted on this
connection.
1 S5 variables are permitted only with read
access
2 S5 variables are permitted only with write
access
Default 0
(If direct access to S5 variables is required

Introduction to the OPC Server for SIMATIC NET


214 6GK1971-0BA00-0AA1
Configuration Using Files

Entry Meaning
with FETCH or SEND with WRITE function,
this parameter must be set.)
Initiate Controls the point in time at which a connection
is established
1 The connection is established actively where
necessary when the partner is accessed
2 The connection is established actively as
soon as the connection is closed. (For
example when the program starts up)
Default 1
Timeout Error monitoring time: If a pending job cannot be
processed within this monitoring time, the
connection is reset and the job is acknowledged
with an error.
Default 15000 ms
LenSend Preset size of the default send buffer
During operation, further additional send buffers
of any length (maximum 65535 bytes) can be
used.
Default 256
LenSendExp Preset size of the default send buffer for high
priority data.
During operation, additional send buffers of any
length (max. 16 bytes) can be used.
Default 16

Entry Meaning
2nd connection section Predefined aliases for this connection. An alias is
[Connection Name|Address|Access a purely textual substitute for an otherwise valid
Point(Aliases)] SR variable name.
e.g.
Nesting of aliases is not supported, in other
[LocalClient||TCPIP:(Aliases)]
words an alias must always refer directly to a
[|&TCP2, 142.11.45.150,&TCP1,1|
valid SR variable of this connection.
TCPIP:(Aliases)]
Alias=SRVariable This section contains any number of alias
e.g. definitions.

Motor=Receive,w0
Heatingpower=Send10,dword3 Alias motor refers to a word in the receive block.
Alias heatingpower refers to a double word within
a send buffer.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 215
Configuration Using Files

Entry Meaning
Alias The alias can be used like a normal SR variable
on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) & (), ANSI > 127
SRVariable On the OPC interface, the occurrence of the
alias is replaced by this SR variable.

Introduction to the OPC Server for SIMATIC NET


216 6GK1971-0BA00-0AA1
Configuration Using Files

8.6.4 Configuration of the Demo Connection

Introduction For demonstrations, testing, or development it is useful to be able to


run the SR-OPC server without additional hardware. The SR-OPC
server therefore has the option of defining variables in a demo
connection and using these simulated SR variables via the OPC
interface.
Requirements The demo connection can be activated by the configuration program or
using the "UseDemoConn“ parameter in the "PROTOCOL“ section of
the configuration file.
Name This demonstration connection always has the name DEMO. Make
sure that no other connection with this name exists in your network
configuration.
Default Variables Apart from the SR variables that are always present, the demo
connection has the following variables:
• RECEIVE
• receiveexp
• send
• sendexp

Also the simulation of a direct S5 access. The following areas are


simulated:

• E (Inputs, 4 bytes)
• A (Outputs, 4 bytes)
• P (Peripheral I/Os, 8 bytes)
• M (Flag, 256 bytes)
• DB10 (Data block number 10, 256 bytes).

Entry Meaning
1st connection section Connection-specific parameters, this section is
[DEMO] not currently supported.

Entry Meaning
2nd connection section Aliases predefined for the demo connection.
[DEMO(Aliases)]
Alias=SRVariable This section contains any number of alias
e.g. definitions.

Motor=Receive,w0 Alias motor refers to a word in the receive block.


Heatingpower=Send10,dword3 Alias heatingpower refers to a double word within
a send buffer.
Alias The alias can be used like a normal SR variable
on the OPC interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) & (), ANSI > 127
SRVariable On the OPC interface, the occurrence of the
alias is replaced by this SRvariable.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 217
Configuration Using Files

8.7 Send/Receive Protocol for PROFIBUS (FDL)

Overview You must edit the configuration file for the Send/Receive protocol in
PROFIBUS (FDL) in the following situations:

• when you want to use symbolic connection names in each variable


name instead of specifying connection parameters completely.
• when you want to modify variable definitions or create aliases
• when you want to configure the demo connection

File Location The file location for the configuration file for the FDL-OPC server set
during installation is as follows:

<installation path> \ OPC2.NT \ binFDL \ SCoreFDL.txt

Introduction to the OPC Server for SIMATIC NET


218 6GK1971-0BA00-0AA1
Configuration Using Files

8.7.1 General Protocol Configuration

General Protocol The following table shows the parameters for configuring the general
Configuration properties of the FDL-OPC server.

Entry Meaning
Section [PROTOCOL] The general protocol settings are made in this
section.
CycleTime Default 100 ms.
This value specifies how quickly the job waiting
list is checked through for pending jobs.
UseOnlyThisDevice Access points (devices) at which the FDL core
logs on. Several access points are separated by
commas. Caution: The last access point must be
terminated by a comma.
Example:
UseOnlyThisVFD=CP_L2_1:,CP_L2_2:,
UseDemoConn 0 Default.
No simulation connection is provided.
1 The FDL core generates a simulation
connection with which item access can be
simulated without a functioning protocol.

AutoDefineConnection 0 Default
1 The FDL core server detects all connected
partners when it is started up and creates a
connection for each of them via the default
SAPs. Since these connections are entered in
the text database, the core server resets this
flag to 0 again after it has been used once.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 219
Configuration Using Files

8.7.2 Connection Configuration for a Specific Access Point

Overview Each FDL access point has a further section in the text database file in
which connections to network partners including symbolic names can
be predefined. The advantage of this is that when the configuration is
changed, (for example changed PROFIBUS station address on the
communication partner) the address only needs to be changed at one
central point if the symbolic name was also used by the OPC
application in the FDL items.

The following table describes the configuration parameters for the


connections:

Entry Meaning
Access point section Connection predefined for this access point.
[Access point(Connections)] During runtime, further connections can be
e.g. created using suitable FDL item notations.
[CP_L2_1:(Connections)]
Name=LocalSAP,STATION,RemoteSAP This section contains any number of connection
e.g. definitions.
PLC1=15,11,14
STATION_10=255,10,255
The individual elements of the connection
definition must be separated by commas and
must not contain blanks.
Name Symbolic connection name,
Range of values: Length maximum 32
characters. Permitted characters: a-z A-Z 0-9 $ _
(underscore)
LocalSAP Local SAP
Range of values: 0-63, 255
STATION Profibus station address
RemoteSAP SAP of the partner station.
Range of values: 0-126,127

Introduction to the OPC Server for SIMATIC NET


220 6GK1971-0BA00-0AA1
Configuration Using Files

8.7.3 Connection-Specific Configuration

Overview Each FDL connection has up to two sections in a text database file.
The connection-specific parameters are configured in the first section,
in the second section, aliases for FDL items can be defined. The
configuration is evaluated when the FDL core starts up.

The following table describes the configuration parameters for the


connections:

Entry Meaning
1st connection section Connection-specific parameters
[Connection Name|Address|Access Point]
If no symbolic name exists for a connection, this
e.g.
must be used, otherwise the symbolic address.
[PLC1|CP_L2_1:]
They must not both be used at the same time.
[|255,10,255|CP_L2_1:]
Timeout Default 15000 ms
Error monitoring time: If a pending job cannot be
processed within this monitoring time, the
connection is reset and the job is acknowledged
with an error.
MaxSendCredits Default 3
Maximum number of parallel send jobs on this
connection
MaxRetryNoRessources Default 5
Maximum number of repeated send attempts if
the partner is temporarily unable to receive due
to a lack of resources
Conn_negot_options Default 0x0000
FDL parameter of the FDL variable field 1, see
FDL documentation
LenSendSDA Default 244 or 246 (with default SAPs)
Preset size of the default send buffer for
acknowledged sending.
During operation, further additional send buffers
of any length (maximum 244 or 246 bytes) can
be used.
LenSendSDN Default 244 or 246 (with default SAPs)
Preset size of the default send buffer for
unacknowledged sending.
During operation, further additional send buffers
of any length (maximum 244 or 246 bytes) can
be used.

Entry Meaning

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 221
Configuration Using Files

2nd connection section If no symbolic name exists for a connection, this


[Connection Name|Address|Access must be used, otherwise the symbolic address.
Point(Aliases)] They must not both be used at the same time.
e.g.
Predefined aliases for this connection. An alias is
[PLC1|CP_L2_1:]
a purely textual substitute for an otherwise valid
[|255,10,255|CP_L2_1:]
FDL item.
Nesting of aliases is not supported, in other
words an alias must always refer directly to a
valid FDL item of this connection.
Alias=FDLItem This section contains any number of alias
e.g. definitions.

Motor=Receive,w0 Alias motor refers to a word in the receive block.


Heatingpower=Send10,dword3 Alias heatingpower refers to a double word within
a send buffer.
Alias The alias can be used just like a normal FDL
item on the IVar interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) & (), ANSI > 127
FDLItem On the Ivar interface, the occurrence of the alias
is replaced by this FDL item.

Introduction to the OPC Server for SIMATIC NET


222 6GK1971-0BA00-0AA1
Configuration Using Files

8.7.4 Configuration of the FDL Demo Connection

Overview For demonstrations, for testing, or during development it is useful to be


able to operate the FDL-OPC server without additional hardware. For
this reason, the FDL-OPC server has the option of defining variables in
a demo connection and using these simulated FDL variables via the
OPC interface.

Requirements The demo connection is activated when the "UseDemoConn"


parameter is set to 1 in the section "[PROTOCOL]".

Name This demonstration connection always has the name DEMO. Make
sure that no other connection with this name exists in your network
configuration.

Entry Meaning
1st connection section Connection-specific parameters, this section is
[DEMO] not currently supported.

Entry Meaning
2nd connection section Aliases predefined for the demo connection.
[DEMO(Aliases)]
Alias=FDLItem The section contains any number of alias
e.g. definitions, see above.

Motor=Receive,w0 Alias motor refers to a word in the receive block.


Heatingpower=Send10,dword3 Alias heatingpower refers to a double word within
a send buffer.

The demo connection always contains the following FDL variables:

• Receive
• Send

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 223
Configuration Using Files

8.7.5 Dynamic Connections

Managing The FDL core can create and manage new connections during
Connections operation using an FDL variable with a suitable connection definition
using a symbolic address via the IVar interface, for example:

FDL:[|255,33,255|CP_L2_1:]receive

The notation of the symbolic connection address was described above.

Introduction to the OPC Server for SIMATIC NET


224 6GK1971-0BA00-0AA1
Configuration Using Files

8.8 DPS Protocol

Overview You must edit the configuration file for the DPS protocol in PROFIBUS
(DPS) in the following situations:

• when you want to use symbolic connection names in each variable


name instead of specifying connection parameters completely.
• when you want to modify variable definitions or create aliases
• when you want to configure the demo connection

File Location The file location for the configuration file for the DPS-OPC server set
during installation is as follows:

<installation path> \ OPC2.NT \ binDSP \ SCoreDPS.txt

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 225
Configuration Using Files

8.8.1 General Protocol Configuration

General Protocol The following table shows the parameters for configuring the general
Configuration properties of the DPS-OPC server.

Entry Meaning
Section [PROTOCOL] The general protocol settings are made in this
section.
CycleTime Default 20 ms
This value specifies how quickly the job waiting
list is checked through for pending jobs.
UseOnlyThisBoard Default DPSONLINE,
Board at which the DPS core logs on.
UseDemoBoard 0 Default
No simulation connection is made available.
1 The DPS core generates a simulation
connection with which slave access can be
simulated without a functioning protocol. The
slaves available in the demo connection can
be configured.
CSWatchThread 0 Default.
Debug monitoring deactivated.
For debugging purposes; not intended to be
documented for the user.
1 The DPS core creates the files WatchCS.ini
and WatchCS2.ini cyclically in the Windows
NT root folder. These files contain information
about the most important internal critical
sections.
ClearAlarms Default 60000 ms
Time after which a pending protocol alarm is
removed from the internal waiting list if it cannot
be passed on to an IAlarm client.
Alarms are not currently supported and this
parameter should therefore not be documented
for the user.

Introduction to the OPC Server for SIMATIC NET


226 6GK1971-0BA00-0AA1
Configuration Using Files

8.8.2 Connection-Specific Configuration

Overview Each DPS connection has up to 2 sections in the configuration file.


The connection-specific parameters are configured in the first section,
in the second section, aliases for items can be defined. The
configuration is evaluated when the DPS core starts up; Softnet DP
slave currently only supports the simultaneous operation of a single
slave.

Generally, the user must modify almost all board-specific


configurations since these largely determine the behavior of the slave.

The following table contains the configuration parameters for the


board.

Entry Meaning
1st Board Section Logon parameters set for this board.
[Boardname]
e.g.
[CP_L2_1:]
GSD Standardized PROFIBUS GSD file that identifies
the slave. The core server, however, only uses
the information PNO_Ident and the first module
description.
StationAddr PROFIBUS station address for the slave
Baudrate Baudrate used, the following values are possible:
Baudrate=BD_9K6
Baudrate=BD_19K2
Baudrate=BD_93K75
Baudrate=BD_187K5
Baudrate=BD_500K
Baudrate=BD_1M5
Baudrate=BD_3M
Baudrate=BD_6M
Baudrate=BD_12M
Baudrate=BD_45K45
AutoOnline 1 Default: The core server switches the slave
online when it starts up.
0 The core server does not switch the slave
online when it starts up, the slave is then only
ready for operation when the item
&devicestate() is written.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 227
Configuration Using Files

Entry Meaning
2nd Board Section Predefined alias for this board An alias is a
[Boardname(Aliases)] purely textual substitute for an otherwise valid
DPS item.
e.g.
Nesting of aliases is not supported, in other
[DPSONLINE(Aliases)]
words an alias must always refer directly to a
valid DPS item of the board.
Alias=DPSItem This section contains any number of alias
definitions.

e.g.
Motor=SlaveM2EX0.3 Alias Motor input bit of a slave
Heatingpower=SlaveAW3 Alias Heatingpower refers to an output word of a
slave.
Alias The alias can be used just like a normal DPS
item on the IVar interface.
Range of values: Length maximum 32
characters
permitted characters: a-z A-Z 0-9 $ _
(underscore) . (period) & (), ANSI > 127
DPSItem On the Ivar interface, the occurrence of the alias
is replaced by this DPS item.

Introduction to the OPC Server for SIMATIC NET


228 6GK1971-0BA00-0AA1
Configuration Using Files

8.8.3 Configuration of the DPS Demo Connection

Introduction For demonstrations, for testing, or during development it is useful to be


able to operate the DPS-OPC server without additional hardware. For
this reason, the DPS-OPC server has the option of defining variables
in a demo connection and using these simulated DPS variables via the
OPC interface.

Requirements The demo board is activated when the "UseDemoBoard" parameter is


set to 1 in the section "[PROTOCOL]".

Name The demo board always has the name "DEMO".

Sample Slaves Due to the complicated structure of the slave configuration data, this
section should not be made public to the user but a text database
containing several useful sample slaves should be made available.

Entry Meaning
1st Demo Board Section Connection-specific parameters, this section is
[DEMO] not currently supported.
GSD Standardized PROFIBUS GSD file that identifies
the slave. The core server DPS, however, uses
only the first module description.

Entry Meaning
3rd Demo Board Section Predefined aliases for the demo board. An alias
[DEMO(Aliases)] is a purely textual substitute for an otherwise
valid DPS item.
Nesting of aliases is not supported, in other
words an alias must always refer directly to a
valid DPS item of the demo board.
Alias=DPSItem This section contains any number of alias
definitions, see above.
e.g.
Motor=SlaveM2EX0.3 The "Motor" alias references an input bit of a
slave.
Heatingpower=SlaveAW3 Alias "Heatingpower" references an output word
of a slave.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 229
DCOM with the OPC Server for SIMATIC NET

Introduction to the OPC Server for SIMATIC NET


230 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET

9 DCOM with the OPC Server for SIMATIC NET

With Windows NT, version 4.0 or higher, the client can run COM objects on another
computer. This functionality that allows the COM objects of an application to be
distributed on several computers is known as DCOM (Distributed COM).
This chapter explains how to set up the OPC server for SIMATIC NET to operate with the
DCOM functionality.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 231
DCOM with the OPC Server for SIMATIC NET

9.1 Introduction to DCOM

What is DCOM? COM objects such as the OPC server do not necessarily need to be on
the same computer as the client. With DCOM (Distributed COM), a
client can create and use COM objects both on its own system and on
other computers. This allows the components of an application to be
distributed within a network.

COM Library A client does not address an object directly to start it or use it but
accesses the COM library. This is part of the operating system. The
COM library manages information in the registry about the COM object
known in the system.

The following schematic illustrates how a COM object is used on the


local machine or on another computer.

OPC client OPC server

COM library

Computer

OPC-Client
OPC client OPC server

COM-
COM COM
Bibliothek
library library

Computer A Network Computer B

Transparency For the client, the use of a COM object with DCOM or with local COM
mechanisms is transparent. The operating system internal COM library
manages the object and recognizes where the object should be created
based on the object configuration.

Introduction to the OPC Server for SIMATIC NET


232 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET

9.2 Configuring DCOM Operation

Program Before a client can use a COM object on another computer, the
"dcomcnfg" properties of the COM object must be configured on the client
computer and on the remote computer.
DCOM and the COM objects required on the computer are configured
using the system program dcomcnfg from the "Windows\System32"
folder. After starting the program, for example by entering "dcomcnfg"
in the "Run" dialog (Start menu), three tabs are available for
configuring DCOM:

Please note the following:


☞ If you lower the security settings, the system must be restarted to
activate the changes.
Caution:
The settings listed in this description guarantee simple
installation and startup of the DCOM protocol. Some of the
security settings of Windows NT are reduced. To meet stricter
security requirements, you must increase the settings according
to the DCOM guidelines.

This text describes the situation in which exactly one client connects to
an OPC server running on a different computer. If you want to use
more than one OPC server from a client, please refer to the DCOM
documentation.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 233
DCOM with the OPC Server for SIMATIC NET

Default Properties In the "Default Properties" tab, you specify basic properties of DCOM.
For DCOM operation with the OPC server within a workgroup (no
domain server available for authentication) make the settings as
shown.
If a domain server can be used for authentication, the default
authentication level can be set to "Connect" and the Default
Impersonation Level to "Identify" for security reasons. For installation
and startup, however, the settings shown below are also recommended
for this mode.

Default Security In the "Default Security" tab, you can specify the rights for DCOM
operation. These settings make sure that only clients with the correct
permissions can use the 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
default properties are then ignored.

Introduction to the OPC Server for SIMATIC NET


234 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET

Access The default access permissions for all COM objects specify which
Permissions accounts are allowed to access the object; in other words call the
methods and which accounts are explicitly denied access.
Launch The default launch permissions for all COM objects specify which
Permissions accounts have the right to create the object and which accounts are
explicitly denied this permission.
Configuration The default configuration permissions specify which accounts can
Permissions modify the information in the registry about COM objects; in other
words can also install new objects on the computer.
Applications 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 configuration dialog by clicking the "Properties" button.
The OPC server for SIMATIC NET is listed as "OPC.SimaticNET".

Select the object


"OPC Server for
SIMATIC NET"

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 235
DCOM with the OPC Server for SIMATIC NET

9.2.1 Configuration of the Server Computer

Different The DCOM configuration for the computer with the OPC client differs
Configurations from that of the computer with the OPC server:

• For the computer with the OPC client, you must set the computer in
the network on which the server will be activated and the account
for the server.

• For the computer with the OPC server, you must set the accounts
that have the right to use the server. In addition to the special
permissions in conjunction with OPC, the account of the user of the
OPC servers must also have user permissions.

"Location" Tab

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 this section, you must specify "Run application on this
computer".

Introduction to the OPC Server for SIMATIC NET


236 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET

"Identity" Tab

The settings made in the "Identity" tab specify the account to be


accessed to check the permissions of the user of the object. Here,
various settings are possible:
• Interactive user
• Launching user
• This user
"Interactive User" The account of the currently logged on user is used. If, however, no
user uses the computer, there is no interactive user and the COM
object cannot be created. For server operation, use the setting "This
user". "Interactive user" is the default setting for the OPC server for
SIMATIC NET.

"The Launching The account of the user that launched the OPC client is used. This
User" user must then also have the required permissions; in other words,
must be entered in the "Security" tab. The user must also have the
default permissions entered for the group 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 OPC server
cannot be started more than once (by different users).

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 237
DCOM with the OPC Server for SIMATIC NET

This User The account of a specified user is used. This user must have the
required permissions; in other words, must be entered in the "Security"
tab. The user must also 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 for the server mode of the
OPC server for SIMATIC NET (no user logged on).

"Security" Tab You specify the access permissions for the OPC server in the
"Security" tab. For the three aspects relevant to COM objects, you can
either use the default permissions or user-defined permissions for the
selected COM object.
When using the default permissions, the account entered in the
"Identity" tab must have the required permissions in the settings for
default security (default access permission, default launch permission).
If you do not want a particular user to have all COM objects of the
system available, you must configure user-defined permissions. To
operate the OPC server, only the access permission and the launch
permission need to be configured.

Introduction to the OPC Server for SIMATIC NET


238 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET

Selecting Users The users that are allowed to use the OPC server must be entered in
the default access permissions. Several users have been entered as
examples of the required permissions:

Workgroup Please note the following:


Operation
☞ Both on the server and on the client machine, the logons and therefore
the information about permissions in the logon must exist on the other
machine.
Example: User "Alpha" is logged on at the computer with the server
and "Beta" is logged on at the computer with the client user. For
DCOM operation an account "Beta" is required on the server computer
(with the same password as on the client machine) and an account
"Alpha" is required on the client computer (same password).
The use of a group with logons is advisable when using a domain. The
information about permissions is then fetched from the domain server.
Type of access:
Allow access

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 239
DCOM with the OPC Server for SIMATIC NET

Type of access:
Allow launch

Access to registry:
HKEY_CLASSES_
ROOT

Introduction to the OPC Server for SIMATIC NET


240 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET

9.2.2 Configuration of the Client Computer

The application that will use the OPC server runs on the client
computer. The OPC server itself is started on another computer when
using DCOM, which is why there is no process for the OPC server
visible in Windows NT Task Manager. The OPC server must
nevertheless be registered on the client computer so that the COM
library knows the required object and so that configuration is possible.
You should also read the notes on client installation in the Installation
Instructions.

For the computer with the OPC client, you must set the computer in
the network on which the server will be activated and the account for
the server.

"Location" Tab The location of the server must be specified in this tab. For DCOM
operation, only the check box "Run application on the following
computer:" must be selected. Click "Browse" to locate the server
computer.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 241
DCOM with the OPC Server for SIMATIC NET

"Identity" Tab In the "Identity" tab, you specify which user account should be used for
the client computer. For the client computer, it makes sense to specify
the currently interactive user; in other words the logged on user.

"Security" Tab The security settings should be made as they are configured on the
server computer.
Please note the following:
DCOM always uses the secure settings. If, for example "connect" and
☞ "anonymous" are set on the client and "none" and "identify" are set on
the server, the combination "connect" and "identify" will be used for the
DCOM protocol.

Introduction to the OPC Server for SIMATIC NET


242 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10 The OPC Custom Interface for Data Access

This chapter explains how the OPC Custom interface for Data Access is used. It also
lists the interfaces and methods of the OPC customer interface. This is not a detailed
interface description but contains supplementary information and notes relating
specifically to SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 243
The OPC Custom Interface for Data Access

10.1 Versions of the OPC Interface

Introduction There is now an extended version of the OPC custom interface,


specification 2.0. Version 2.0 supplements the existing OPC custom
interface in several aspects particularly those simplifying the handling
of asynchronous calls.

The interfaces of Version 1.0 of the OPC interface are completely


upwards compatible with Version 2.0.

the OPC server for SIMATIC NET supports version 2.0 of the OPC
Custom Interface.

Introduction to the OPC Server for SIMATIC NET


244 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.2 Creating and Using an OLE Object in C/C++

Introduction The following sections illustrate step-by-step how you can call the
methods of an instance of an OLE class in C++. Note the difference
between the term class in OLE and in C++.

OLE Classes, C++ A Windows object is an instance of an OLE class. The term OLE class
Classes differs from the class in C++. A class in C++ is a type definition. An
OLE class is, however, an object description and does not contain
types.

Class Identification Each OLE class can be identified uniquely by a 128 bit long
Code identification code, the CLSID. This is used by the operating system for
the unique assignment of a DLL or EXE file that implements this class.
A client that wishes to use an object of a class requires only the
CLSID.

ProgID To simplify the identification of OPC servers, there is normally a


readable name, the ProgID assigned in the CLSIDs. While a CLSID is
always unique due to the algorithm for compilation, it is possible that a
ProgID exists more than once. Just like the CLSID, the ProgID is
specified by the vendor of an OPC server.

The following applies to the OPC server for SIMATIC NET for all
protocols:

OPC.SimaticNET

Procedure A COM object is created in five steps.

Step Description
1 Initialize COM
2 Query the CLSID
3 Create an Object
4 Call an OPC function
5 Release the interfaces used

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 245
The OPC Custom Interface for Data Access

Step 1: Before you can use the functions of COM, the COM library must be
Initialize COM initialized with the following call:

#include "opc.h"
HRESULT r1;
r1 = CoInitialize(NULL);

Step 2: If the name of an object is known, the CLSID can be queried using the
Query the CLSID OLE function “CLSIDFromProgID”.

Example
The following program section illustrates how to query the CLSID for
the OPC server for SIMATIC NET:

CLSID clsid;

// Get the CLSID from the Name


r1 = CLSIDFromProgID((L"OPC.SimaticNET"),&clsid);

Step 3: If a client wants to use an object, it transfers the CLSID to the


Create an Object operating system and requests an object instance. Regardless of
where the server is located, the object request is always directed to
COM.
The “CoCreateInstance” function creates an object belonging to the
required class. This function encapsulates several interim steps via the
interface "IClassFactory". Generating objects using IClassFactory is
more efficient if you want to create several objects of one class.

Example
The following lines show how an object of the class “OPC server” with
reference to the “IUnknown” interface can be created:

IUnknown * pOPCUnknown;

r1 = CoCreateInstance (clsid, NULL,


CLSCTX_LOCAL_SERVER, IID_IUnknown,
(void**)&pOPCUnknown );

Introduction to the OPC Server for SIMATIC NET


246 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

Step 4: In this step, a method of the “IOPCServer” interface of the created


Call an OPC object will be used to learn the status of the server. First, a pointer to
function the “IOPCServer” interface is made available via “IUnKnown”. Finally,
the “GetStatus” method is called.

Example
The program shown below outputs the status of the server and the
vendor information. If the “GetStatus” method is called successfully,
the OPC server allocates the memory areas for the return information
via the “IMalloc” interface. The user must release these memory areas
again.

IOPCServer *pOPCServer;
IMAlloc *pIMalloc;

OPCSERVERSTATUS *pss;

r1 = pOPCUnknown->QueryInterface(IID_IOPCServer,
(void**)&pOPCServer);

r1 = pOPCServer ->GetStatus(&pss);

printf("Status.szVendorInfo = %ls\n", pss->


szVendorInfo);

// Remember to release the memory returned by the


method

CoGetMalloc( 1, &pIMalloc);

pIMalloc->Free(pss->szVendorInfo);
pIMalloc->Free(pss);

Step 5: Objects include reference counters to detect when the object is no


Release the longer required and can remove itself from memory. Each time the
interfaces used “QueryInterface” function is called, the reference counter is
incremented. To release the object, the counter must be reset.

Example
Using the following commands, the reference counter for the interfaces
“IUnknown” and “IOPCServer” is reset:

pOPCServer->Release();
pOPCUnknown->Release();
pIMalloc->Release();

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 247
The OPC Custom Interface for Data Access

10.3 Further Information about the Interface Description for the


OPC Custom Interface

Introduction A detailed interface description of the OPC interfaces is beyond the


scope of this manual. This is supplied as a file along with this product
as an original English document from the OPC Foundation. You will
find the documents in the "DOC" folder in the product folder of the
OPC servers for SIMATIC NET.

Structure of the The following supplementary information about the interfaces lists the
Description objects of OPC, their interfaces and the methods defined in these
interfaces and points out particular characteristics of the OPC server
for SIMATIC NET.

Return Values All the listed methods return a result of the type HRESULT.

Overview of the Object "OPCServer“


Objects and
IOPCServer
Interfaces
IOPCServerPublicGroups (optional)
IOPCBrowseServerAddressSpace (optional)
IOPCItemProperties (new with V 2.0)
IConnectionPointContainer (new with V 2.0)
IOPCCommon (new with V 2.0)
IPersistFile (optional)
Object "OPCGroup“
IOPCGroupStateMgt
IOPCPublicGroupStateMgt (optional)
IOPCASyncIO2 (new with V 2.0)
IOPCAsyncIO (no longer necessary with V2.0)
IOPCItemMgt
IConnectionPointContainer (new with V 2.0)
IOPCSyncIO
IDataObject (no longer necessary with V2.0)
Object "EnumOPCItemAttributes“
IEnumOPCItemAttributes

Introduction to the OPC Server for SIMATIC NET


248 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.4 The “OPC Server” Object

Description The OPC server class has various attributes that contain information
about the status, the version etc. of an OPC server object. The OPC
server class also has methods with which the client can manage the
objects of the OPC group class. A client application addresses only an
object of this class directly using COM mechanisms. The other objects
are created by corresponding OPC methods.
The methods of the IOPCServer interface are used to manage the
objects in the OPC group class. The interface IOPCBrowseSer-
verAddressSpace allows the address space of the server to be
investigated.

Schematic The following schematic illustrates the “OPC server” object with its
interfaces.

IUnknown

IOPCServer
IOPCBrowseServerAddressSpace
OPC server
object
IOPCCommon (V2.0)
IConnectionPointContainer (V2.0)
IOPCItemsProperties (V2.0)

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 249
The OPC Custom Interface for Data Access

10.4.1 IOPCServer Interface

Overview This interface contains methods to manage groups within a server


object. It is also possible to obtain information about the current status
of the server.

AddGroup ( szName, bActive, dwRequestedUpdateRate, hClientGroup,


pTimeBias, pPercentDeadband, dwLCID, phServerGroup,
pRevisedUpdateRate, riid, ppUnk )

Description:
Creates a group in the server object.

Notes:
• The "pTimeBias" parameter is not evaluated by the OPC server for
SIMATIC NET.
• "LCID" is irrelevant for the OPC server for SIMATIC NET.
• The "UpdateRate" is specified by the configuration parameter
“Minimum Update Rate” as a multiple of the configuration value.
• The “pPercentDeadband” parameter has no significance for the
OPC server for SIMATIC NET.
• If the "szName" parameter is empty, a name is generated beginning
with the underscore character (for example “_123456”). User-
defined names should therefore not begin with the underscore
character.

CreateGroupEnumerator
( dwScope, riid, ppUnk )

Description:
Creates various enumerators for the group.

Notes:
Since there are no public groups in the OPC server for SIMATIC NET,
the return values for the parameter “dwScope” “...PRIVATE” and
“...PUBLIC” are identical.

Introduction to the OPC Server for SIMATIC NET


250 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

GetErrorString ( dwError, dwLocale, ppString )

Description:
Supplies the error message for a specific error code.

Notes:
The OPC server for SIMATIC NET supports German and English error
texts. Errors detected by the Windows operating system are explained
in the language in which the operating system was installed.

GetGroupByName ( szName, riid, ppUnk )

Description:
Supplies an additional interface pointer for the name of a private
group, in other words the reference counter is incremented.

GetStatus ( ppServerStatus )

Description:
Supplies the status information of the server.

Notes:
The return value of the OPC server for SIMATIC NET is the name and
the version of the OPC server.

RemoveGroup ( hServerGroup, bForce )

Description:
Deletes a group on the server.

Notes:
The OPC server for SIMATIC NET does not support the use of the
"bForce“ parameter. It is not possible to delete groups to which
references are still active.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 251
The OPC Custom Interface for Data Access

10.4.2 IOPCBrowseServerAddressSpace Interface

Overview This interface contains methods with which the address area of the
server can be queried. The address area contains all the OPC items
known to the server.

BrowseAccessPaths ( szItemID, ppIEnumString )

Description:
This provides the possibility of querying the access path of an ItemID.

Notes:
Not required for the OPC server for SIMATIC NET.

BrowseOPCItemIDs ( dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter,


dwAccessRightsFilter, ppIEnumString )

Description:
Supplies a string of the type “IEnumString” whose content is specified
by the call parameters. The position from which the list is created can
be set using the “ChangeBrowsePosition” method.

Notes:
• “BRANCH” excludes the filters for Type and AccessRights.
• The rules for creating a filter are as follows:
− Asterisk (*) Any character string, including
empty strings
− Plus (+) Any string of characters,
however at least one character
− Question marks (?) Any single character
− Square brackets ( [ ] ) One single character from the
specified set
• To use one of the filter characters, this must be preceded by a back
slash (\).

Introduction to the OPC Server for SIMATIC NET


252 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

ChangeBrowsePosition
( dwBrowseDirection, szString )

Description:
Allows you to browse through the address area. You can change to the
higher level or to a branch.

GetItemID ( szItemDataID, szItemID )

Description:
Creates a complete ItemID in the hierarchical address area. This
function is necessary since browsing itself only provides the
designations below the current node.

Notes:
The description of GetItemID in OPC specification is inconsistent with
the description of ChangeBrowsePosition. With
ChangeBrowsePosition, it is not possible to specify a complete ItemID.
For this reason, the OPC server for SIMATIC NET only currently
supports the command GetItemID for single leaves (LEAF).

QueryOrganization ( pNameSpaceType )

Description:
Supplies the structure of the address area. The address area can be
organized with a flat or hierarchical structure.

Notes:
The structure of the address area of the OPC server for SIMATIC NET
is structured hierarchically.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 253
The OPC Custom Interface for Data Access

10.4.3 IOPCCommon Interface (Version 2.0)

Overview This interface of version 2.0 of the OPC Custom Interface contains
methods allowing the language settings and the name of the client to
be made known to the server.

SetLocaleID ( dwLcid )

Description:
Sets the language code of the server. The language code specifies the
language in which the server outputs text.

Notes:
The OPC server for SIMATIC NET supports English and German.

GetLocaleID ( pdwLcid )

Description:
Fetches the language code of the server.

Notes:
The OPC server for SIMATIC NET supports English and German.

QueryAvailableLocaleIDs
( pdwLcid )

Description:
Provides all the available language codes of the server.

Notes:
The OPC server for SIMATIC NET supports English and German.

GetErrorString ( dwError, ppString )

Description:
Provides the error text for a specific error code in the set language.

Introduction to the OPC Server for SIMATIC NET


254 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

SetClientName ( szName )

Description:
Transfers a descriptive text for the client to the server. The descriptive
text can be used for any purpose by the server, for example for logging
in trace files.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 255
The OPC Custom Interface for Data Access

10.4.4 IConnectionPointContainer Interface

Overview This interface is a standard COM interface for reporting asynchronous


events via connection points. For more detailed information about
using connection points, refer to the documentation of OLE/COM.

Introduction to the OPC Server for SIMATIC NET


256 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.4.5 IOPCItemProperties (V 2.0) Interface

Overview This interface of version 2.0 contains methods allowing specific server
information to be queried about an item.

QueryAvailableProperties
( szItemID, pdwCount, ppPropertyIDs, ppDescriptions,
ppvtDataTypes )

Description:
Returns a list of available properties for an item.

GetItemProperties ( szItemID, dwCount, pdwPropertyIDs,


ppvData, ppErrors )

Description:
Provides the values of the properties of an item transferred in a list of
PropertyIDs.

LookupItemIDs ( szItemID, dwCount, pdwPropertyIDs,


ppszNewItemIDs, ppErrors )

Description:
Provides (whenever possible for the propertyID) a list of ItemIDs for a
list of PropertyIDs. These ItemIDs can be included in a group
simplifying and speeding up access to the data.
Notes:
The OPC server for SIMATIC NET does not support this function. The
call is rejected with error message 0x8004001 (not implemented).

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 257
The OPC Custom Interface for Data Access

10.5 Objects of the “OPC Group” Class

Description The “OPC Group” class manages the individual process variables, the
OPC items. Using these group objects, a client can form semantically
meaningful units of OPC items and execute operations with them.

Schematic The following schematic illustrates an object of the “OPC Group” class
and its interfaces.

IUnknown

IOPCItemMgt
IOPCGroupStateMgt
IOPCSyncIO
IOPCAsyncIO OPC group
IDataObject object
IEnumOPCItemAttributes

IOPCAsyncIO2 (V 2.0)
IConnectionPointContainer (V2.0)

Introduction to the OPC Server for SIMATIC NET


258 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.5.1 IOPCItemMgt Interface

Overview This interface provides methods to manage more than one item in a
group.

Time Stamp With each value read, OPC supplies a time stamp. This indicates
when this value was received or when it was changed. Since the
SIMATIC systems do not use a time stamp, the time at which the value
is received on the server is used as the time stamp.

AddItems ( dwNumItems, pItemArray, ppAddResults, ppErrors )

Description:
Adds one or more items to a group.

Notes:
• A unique name of an item for the OPC server for SIMATIC NET is
as follows:
[<protId>:<connName>]VariableName (for DP and S7)
or
<protId>:[<connName>]VariableName (for FMS and SR)

Examples: S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]EB0
DP:[CP_L2_1]Slave063SlaveState
FMS:[CR1|VFD1|CP_L2_1:]100
SR:[MyConnection||CP_H1_1:]receive

This name can be specified completely in the ItemID. The


AccessPath must then be empty.
• As an alternative, the part of the name in square brackets can be
included in the AccessPath.

Example: AccessPath: DP:[CP_L2_1:]


ItemID: Slave063SlaveState

• Refer to Chapter 7 for a definition of the ItemIDs!


• It is possible to add the same OPC item to the same group more
than once. In this case each of these items nevertheless has its
own server handle.
The server handles of the items are only unique within a group and
not for all items of all groups.
• Valid data types are as follows: VT_UI1, VT_UI2, VT_UI4, VT_I1,
VT_I2, VT_I4, VT_R4, VT_BOOL, VT_BSTR

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 259
The OPC Custom Interface for Data Access

CreateEnumerator ( riid, ppUnk )

Description:
Creates an enumerator for the items of a group.

RemoveItems ( dwNumItems, phServer, ppErrors )

Description:
Deletes one or more items from a group.

SetActiveState ( dwNumItems, phServer, bActive, ppErrors )

Description:
Sets the active state of one or more items in a group.

SetClientHandles ( dwNumItems, phServer, phClient, ppErrors )

Description:
Sets the client handle of one or more items in a group.

SetDatatypes ( dwNumItems, phServer, pRequestedDatatypes, ppErrors )

Description:
Sets the requested data type of one or more items in a group.

Notes:
See AddItem

Introduction to the OPC Server for SIMATIC NET


260 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

ValidateItems ( dwNumItems, pItemArray, bBlobUpdate, ppValidationResults,


ppErrors )

Description:
Checks the validity of an OPC item, for example whether it was added
to a group without any error occurring, and supplies information such
as the canonical data type.

Notes:
See AddItem

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 261
The OPC Custom Interface for Data Access

10.5.2 IOPCGroupStateMgt Interface

Overview The IOPCGroupStateMgt interface provides methods with which


groups can be managed. It is possible to edit group-specific
parameters and to copy groups.

CloneGroup ( szName, riid, ppUnk )

Description:
Creates a copy of a group. All group attributes are copied except for
the following:
• The active state is set to FALSE
• A new server handle is assigned

Notes:
The “szName” parameter can be empty. In this case a unique name is
generated (see AddGroup).

GetState ( pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband,


pLCID, phClientGroup, phServerGroup )

Description:
Fetches the status of the group. The client application must inform the
OPC server where the results are to be stored using a pointer.

Notes:
• The "pTimeBias" parameter is irrelevant for the OPC server for
SIMATIC NET.
• The “pPercentDeadband” parameter has no significance for the
OPC server for SIMATIC NET.
• The “LCID” parameter, in other words language-specific textual
values in read/write, has no significance for SIMATIC variables.

SetName ( szName )

Description:
Allows the name of a group to be changed. The name must always be
unique.

Introduction to the OPC Server for SIMATIC NET


262 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

SetState ( pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias,


pPercentDeadband, pLCID, phClientGroup )

Description:
SetState allows various properties of the group to be changed.

Notes:
• The "pTimeBias" parameter is irrelevant for the OPC server for
SIMATIC NET.
• The “pPercentDeadband” parameter has no significance for the
OPC server for SIMATIC NET.
• The “LCID” parameter, in other words language-specific textual
values in read/write, has no significance for SIMATIC variables.
• The "UpdateRate" is specified by the configuration parameter
“Minimum Update Rate” as a multiple of this value.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 263
The OPC Custom Interface for Data Access

10.5.3 IOPCSyncIO Interface

Overview This interface provides methods for synchronous reading and writing.
Synchronous means that the client waits until the read or write
operation is completed and only then continues execution.

Use The use of synchronous calls is recommended when the client requires
the result for further processing. Other clients are not blocked since the
OPC server for SIMATIC NET starts a separate thread for each client.
In general, it is advisable to use the IData interface for processing
variable changes (or IAdviseSink on the client side). This interface
guarantees the highest possible data throughput and also reduces the
actual number of calls to the absolute minimum (only when changes
occur).

Read ( dwSource, dwNumItems, phServer, ppItemValues, ppErrors )

Description:
Reads the values, status information or time stamp of one or more
items in a group. The values can be read from the cache of the server
or directly from the hardware. Reading from the cache is, however,
only possible when the group is activated.
Notes:
The call is monitored by the timeout monitoring on the server. The
corresponding configuration parameter is “Read/Write Timeout” (see
Section 7.4).

Write ( dwNumItems, phServer, pItemValues, ppErrors )

Description:
Writes values for one or more items of a group to the hardware.
Notes:
The call is monitored by the timeout monitoring on the server. The
corresponding configuration parameter is “Read/Write Timeout” (see
Section 7.4).

Introduction to the OPC Server for SIMATIC NET


264 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.5.4 IOPCAsyncIO Interface

Overview This interface of the Group class provides methods for asynchronous
reading and writing of items. Asynchronous means that the client
triggers a read or write operation and then continues operation.
Asynchronous operations provide a transaction ID. When the server
has completed the read or write operation, the client receives a
message sent to its IAdviseSink interface.

Cancel ( dwTransactionID )

Description:
Cancels an outstanding job.

Read ( dwConnection, dwSource, dwNumItems, phServer, pTransactionID,


ppErrors )

Description:
Sends an asynchronous read command. The result is sent to the
IAdviseSink interface of the client.

Notes:
The call is monitored by the timeout monitoring on the server. The
corresponding configuration parameter is “Read/Write Timeout” (see
Section 7.4). If the timeout monitoring is aborted, there is a callback
with hrStatus=E_ABORT.

Refresh ( dwConnection, dwSource, pTransactionID )

Description:
Requests a current value for every active OPC item.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 265
The OPC Custom Interface for Data Access

Write ( dwConnection, dwNumItems, phServer, pItemValues,


pTransactionID, ppErrors )

Description:
Sends an asynchronous write command.

Notes:
The call is monitored by the timeout monitoring on the server. The
corresponding configuration parameter is “Read/Write Timeout” (see
Section 7.4). If the timeout monitoring is aborted there is a callback
with hrStatus=E_ABORT.

Introduction to the OPC Server for SIMATIC NET


266 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.6 IDataObject Interface

Overview The IDataObject interface is the standard interface of OLE for data
transmission. It contains methods for establishing a message
connection between the client and a server group.

Description of the If the server wants to send a message to a client, the client must
Mechanism provide a partner for the server. This partner is the IAdviseSink
interface of the client. A server sends a message to a client by calling
the OnDataChange method of the IAdviseSink interface of the client.

Schematic of the The following schematic illustrates how the “IAdviseSink” interface on
Mechanism the client and “IDataObject” on the server interact.

Client Server
IDataObject::DAdvise

IAdviseSink IDataObject

IAdviseSink::OnDataChange

DAdvise ( pFmt, adv, pSnk, pConnection )

Description:
Establishes a connection between a server and the client. If a client
wants to receive a message, it must establish a connection using this
method. It transfers a pointer to its IAdviseSink interface to the server.

DUnadvise ( Connection )

Description:
Terminates an existing connection between a client and server.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 267
The OPC Custom Interface for Data Access

10.6.1 IEnumOPCItemAttributes Interface

Overview This interface based on the IEnum standard interface returns the items
of a group. The interface is supplied only by
“IOPCItemMgr:CreateEnumerator”. It is not obtainable with
QueryInterface.

Clone ( ppEnumItemAttributes )

Description:
Creates an identical copy of the enumerator.

Next ( celt, ppItemArray, pceltFetched )

Description:
Fetches the next OPC item of the group.

Notes:
The OPC server for SIMATIC NET does not support engineering units.
EUType and EUInfo are therefore irrelevant.

Reset ( void )

Description:
Resets the list to the first item of the group.

Skip ( celt )

Description:
Skips a number of items in the list.

Introduction to the OPC Server for SIMATIC NET


268 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.6.2 IAsyncIO2 Interface (Version 2.0)

Overview This interface in version 2.0 provides methods for asynchronous


reading and writing of items. Asynchronous means that the client
triggers a read or write operation and then continues operation. Version
2 of the interface for asynchronous communication uses connection
points. This simplifies the processing of the transferred data.

Read ( dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors )

Description:
Sends an asynchronous read command. The result is sent to the client
via a connection point.

Notes:
The call is monitored by the timeout monitoring on the server. If the set
time is exceeded, this is indicated by the status E_ABORT.

Write ( dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID,


ppErrors )

Description:
Sends an asynchronous write command. The message indicating
completion of the job comes via the specified connection point.

Notes:
The call is monitored by the timeout monitoring on the server. If the set
time is exceeded, this is indicated by the status E_ABORT.

Cancel2 ( dwCancelID )

Description:
Cancels an outstanding job.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 269
The OPC Custom Interface for Data Access

Refresh ( dwSource, dwTransactionID, pdwCancelID )

Description:
Requests a current value for every active OPC item.

SetEnable ( bEnable )

Description:
Activates messages via connection points. Messages generated by the
Refresh method are sent regardless of these settings.

GetEnable ( pbEnable )

Description:
Returns the current value of the flag for messages via connection
points.

Introduction to the OPC Server for SIMATIC NET


270 6GK1971-0BA00-0AA1
The OPC Custom Interface for Data Access

10.6.3 IConnectionPointContainer Interface

Overview This interface is a standard COM interface for reporting asynchronous


events via connection points. For more detailed information about
using connection points, refer to the documentation of OLE or COM.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 271
The OPC Custom Interface for Data Access

Introduction to the OPC Server for SIMATIC NET


272 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11 The OPC Automation Interface for Data Access

This chapter explains how the OPC Automation interface for Data Access is used. It also
lists the properties and methods of the OPC automation interface. This is not a detailed
interface description but contains supplementary information and notes relating
specifically to the OPC server of SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 273
The OPC Automation Interface for Data Access

11.1 Versions of the Automation Interface

Introduction The OPC automation interface was specified by the OPC Foundation
in version 1.0. Certain aspects in this specification were unclear and it
was not approved. Some weaknesses of version 1.0 became
particularly clear with the introduction of Visual Basic 5.0.

New Version Since the start 1999, there is an approved version of the specification
of the automation interface available with version number 2.02.
The following descriptions relate to version 2.02 of the specification of
the OPC automation interface.

Introduction to the OPC Server for SIMATIC NET


274 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.2 Creating and Using an OLE Object in Visual Basic

Overview Visual Basic from Microsoft is a development environment which


supports the automation interface for the simple linking of OLE objects.
The following sections show how the OPC server is used via the
automation interface 2.02 in Visual Basic. At least version 5 of Visual
Basic is required.

Procedure

Step Description
1 Declaring the Variables

2 Connecting to the OPC Server

3 Generating an OPC Group

4 Adding OPC Items

5 Synchronous Reading

Preparations Create a new Visual Basic project and the activate the reference for
the automation interface 2.02 of the OPC server in the "Project -
References" menu.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 275
The OPC Automation Interface for Data Access

Step 1: In Visual Basic or Visual Basic for Applications, a variable of the type
Declaring a Object refers to an OLE object. The DIM statement declares an object
Variable of the instance.
Object Type
Example

Dim ObjServer As OPCServer

Step 2: Creating an OPC Server Object


Creating and Visual Basic programs are also OPC clients. To be able to access a
Assigning the process variable, the client must first create a server object and then
Object connect to an OPC server.

Example
The following code section shows how a Visual Basic client can
connect to the OPC server for SIMATIC NET:

Set ObjServer = New OPCServer


ObjServer.Connect ("OPC.SimaticNET")

Step 3: The next step is to create a group object to accommodate process


Generating an OPC variables.
Group First, the group object is declared. A server object contains a collection
object as a property with the name "OPCGroups". A group is created
by calling the Add method of the collection object.

Example
The following lines show how a group is created in Visual Basic:

'Declarations

Dim GroupObj As OPCGroup


Dim GroupCollection As OPCGroups

Set GroupObj = ObjServer.OPCGroups.Add("MyGroup")

Introduction to the OPC Server for SIMATIC NET


276 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

Step 4: OPC items will now be inserted in the created group object. The items
Adding OPC Items represent the connections to the process variables, their parameter
ItemID specifies which variable will be addressed. The syntax of this
parameter is shown in Chapter 5.

The AddItems method allows several items to be inserted into a group


in one call. The transfer parameters and the return values are
therefore one-dimensional arrays with identical sizes. The "lNumItems“
variable contains the number of items to be inserted.

When the method is called, the server initializes the values of the
arrays "lServerHandles“, "lErrors“ and "ItemsObj“. The "IErrors“ array
contains status information for each item inserted that indicated
whether or not the item was successfully inserted.

Example
The following example creates two items in the previously created
OPC group "GrpObj“. The first item represents a DP variable, the
second an FMS variable.

'Declaration
Dim ItemServerHandles() As Long
Const MAX_INDEX = 2
Const OPC_DS_CACHE = 1
Const OPC_DS_DEVICE = 2

Dim lNumItems As Long


Dim lClientHandles(MAX_INDEX) As Long
Dim perror() As Long

Dim szItemIDs(MAX_INDEX) As String


Dim AccPath(MAX_INDEX) As String
Dim ReqDataTypes(MAX_INDEX) As Integer

'Definition of ItemIDs
szItemIDs(1) = "FMS:[DEMO]101"
szItemIDs(2) = "DP:[DEMO]MyMotor"

AccPath(1) = ""
AccPath(2) = ""

' Set requested datatypes for the Items


ReqDataTypes(1) = vbVLong
ReqDataTypes(2) = vbVString

' Set Client handles


lClientHandles(1) = 1
lClientHandles(2) = 2

'Add Items to Group


GroupObj.OPCItems.AddItems MAX_INDEX, szItemIDs, _
lClientHandles, ItemServerHandles, perror, _
ReqDataTypes, AccPath

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 277
The OPC Automation Interface for Data Access

Step 5: In the last step, a synchronous read operation to read the process
Synchronous variables of a group is executed. Synchronous means that the server
Reading only returns control to the Visual Basic program after the required
results have been returned via the communications system. This
means that the flow of communication is delayed by the time required
for this communication. The OPCDevice constant means that the
values should be read directly from the device and not from the cache
of the OPC server.

Example
Just like the AddItems command, OPCRead is also a group operation,
in other words several process variables within a group can be
accessed with one call. The "lNumItems“ parameter specifies the
number of variables to be read. The individual variables themselves
are described in the array "lServerHandles“ by the handle assigned by
the server.
The values are returned as long and as string according to the
"ReqDataTypes" parameter of the "AddItems" method.

'Definition of the Variables for OPCRead


'Out Parameter
Dim vValues() As Variant
Dim pErrors() as Long

' Synchronous reading of 2 items


GroupObj.SyncRead OPC_DS_Device, _
2, _
ItemServerHandles, _
vValues, _
pErrors

Introduction to the OPC Server for SIMATIC NET


278 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.3 Further Information about the Interface Description for the


OPC Automation Interface

Introduction A detailed interface description of the OPC interfaces is beyond the


scope of this manual. This is supplied as a file along with this product
as an original English document from the OPC Foundation. You will
find the documents in the "DOC" folder in the product folder of the
OPC servers for SIMATIC NET.

Object Model for The object model for the OPC automation interface according
the Automation specification 2.0 differs from the model described in Section 4.4:
Interface Separate collection objects manage the objects OPC Group and OPC
Item. The collection objects provide functions for counting the objects
assigned to them. The browsing functions are also brought together in
a separate "OPC browser" object.

OPCServer

1:1 1:n

OPCGroups
(Collection) OPC-Browser

1:n

OPCGroup

1:1

OPCItems
(Collection)

1:n

OPCItem

Structure of the The following supplementary information about the interfaces lists the
Description objects of the automation interface of OPC, their properties, methods
and events and points out particular characteristics of the OPC server
for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 279
The OPC Automation Interface for Data Access

Note:

Optional parameters must be transferred as variants for the


automation interfaces. In Visual Basic, the optional parameters should,
however, be declared directly with the destination type. This ensures
that the variant has the correct data type.
The data types can be found in the descriptions of the methods in the
OPC specification.

Example:
Dim ReqDataTypes(MAX_INDEX) As Integer
ReqDataTypes(1) = vbVLong
ReqDataTypes(2) = vbVString

Remember that according to the OPC specification, arrays always


begin with the index 1. This must be defined in your program as
follows (as "General"):

Option Base 1 'ARRAYs are always Option Base 1


'(see SPEC Chapter 2.6)

Introduction to the OPC Server for SIMATIC NET


280 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.4 The “OPC Server” Object

Description Objects of the OPC server class are created by the client. The
properties of an OPC server contain general information about the
server. When an OPC server object is created, an OPCGroup
collection is also created as a property of the OPC server object.

11.4.1 Properties of "OPCServer“

Property Type Brief Description

StartTime Date Time at which the server was started (in UTC).

CurrentTime Date The current time (UTC), as supplied to the


server by the system.
LastUpdate Date The time (UTC), at which the server sent the last
Time update of data to the client.
MajorVersion Integer The major version number of the server.

MinorVersion Integer The minor version number of the server.

BuildNumber Integer The build number of the server.

VendorInfo String The vendor information.

ServerState Long Status of the server.

LocaleID Long Code for specifying the language for OPC server
output texts
Bandwidth Long Bandwidth of the server.

OPCGroups OPC A collection of OPCGroup objects


Groups
PublicGroup Variant The names of the public groups provided by this
Names server.
ServerName String Name of the linked OPC server

ServerNode String Computer name of the node in the network on


which the OPC server is run.
ClientName String Option of informing the OPC server of the name
of the client. Mainly intended for debugging and
trace.

Notes:
• The OPC server for SIMATIC NET provides the following as vendor
information: "SIMATIC NET OPC-Server“
• Public groups are not supported by the OPC server for SIMATIC
NET.
• The Bandwidth property is not supported by the OPC server for
SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 281
The OPC Automation Interface for Data Access

11.4.2 Methods of the "OPCServer“

GetOPCServers (Optional Node as Variant) As Variant

Description:
Provides the names (ProgIDs) of the registered OPC server on the
local computer (without argument) or on the specified node.

Notes:
• The ProgID for the OPC server for SIMATIC NET is as follows:

OPC.SimaticNET

Connect (ProgID As String, Optional NodeName As String)

Description:
Structure of a link to an OPC server.

Notes:
• The ProgID for the OPC server for SIMATIC NET is as follows:

OPC.SimaticNET

Disconnect ()

Description:
Structure of the link to an OPC server.

Notes:
The OPC server for SIMATIC NET closes all communications
connections after the Disconnect of the last OPC client.

Introduction to the OPC Server for SIMATIC NET


282 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

CreateBrowser () As OPCBrowser

Description:
Creates an object of the OPCBrowser class to investigate the address
area of the server.

Notes:
Refer to the description of the OPCBrowser object in Section 11.5.

GetErrorString (ErrorCode As Long) As String

Description:
Supplies the error message for a specific error code.

Notes:
The OPC server for SIMATIC NET supports German and English error
texts. Errors detected by the Windows operating system are explained
in the language in which the operating system was installed.

QueryAvailableLocaleIDs
() As Variant

Description:
Obtains the language codes available from the server as an array with
long values.

Notes:
The OPC server for SIMATIC NET supports German and English error
texts. Errors detected by the Windows operating system are explained
in the language in which the operating system was installed.

QueryAvailableProperties
ItemID As String, ByRef Count As Long, ByRef PropertyIDs() as Long,
ByRef Descriptions() As String, ByRef DataTypes() As Integer

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 283
The OPC Automation Interface for Data Access

Description:
Obtains a list of property codes and the corresponding description texts
for the properties of the specified item.

Notes:
Properties are supported by the OPC server for SIMATIC NET.

GetItemProperties (ItemID As String, Count As Long, ByRef PropertyIDs() as Long, ByRef


PropertyValues() As Variant, ByRef Errors() As Long)

Description:
Obtains a list with the values of the requested properties.

Notes:
Properties are supported by the OPC server for SIMATIC NET.

LookupItemIDs (ItemID As String, Count As Long, PropertyIDs() as Long, ByRef


NewItemIDs() As String, ByRef Errors () As Long)

Description:
Obtains a list of the ItemIDs corresponding to the transferred
PropertyIDs. ItemIDs can be inserted for more efficient data acquisition
in OPC groups.

Notes:
The OPC server for SIMATIC NET does not supply PropertyIDs that
could be represented as ItemIDs.

Introduction to the OPC Server for SIMATIC NET


284 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.4.3 Events of "OPCServer"

ServerShutDown (Reason As String)

Description:
This event is triggered when the OPC server is closed down. The
linked clients can react to the event, for example, by releasing items
and groups.

Notes:
The OPC server for SIMATIC NET triggers this event when the close
request is set in the configuration program (Section 7.10).

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 285
The OPC Automation Interface for Data Access

11.5 The "OPCBrowser“ Object

Description The OPCBrowser object is a collection object with which the address
area of the OPC server can be investigated. An object of the
OPCBrowser class must be created by the CreateBrowser method of
the OPCServer object. It is possible to create several OPCBrowser
objects for one server.

11.5.1 Properties of "OPCBrowser“

Property Type Access Brief Description

Organization Long Read-only Organizational structure of the


address area: hierarchy or flat
Filter String Read/Write The filter effective for the
ShowBranches and ShowLeafs
methods.
DataType Integer Read/Write The data type required for the
ShowLeafs method. The default
of this property is vbEmpty.
AccessRights Long Read/Write The access rights required for
the ShowLeafs method.
CurrentPosition String Read-only Current position in the tree of the
address area. The value is "“
when initialized in the root or
when the organization structure
is flat.
Count Long Read-only Property necessary for the
collection, provides the number
of entries.

Notes: • The structure of the address area of the OPC server for SIMATIC
NET is hierarchical.

• The rules for creating a filter are as follows:


− Asterisk (*) Any character string, including
empty strings
− Plus (+) Any string of characters,
however at least one character
− Question marks (?) Any single character
− Open/close bracket ( [ ] ) exactly one character from the
specified set
• To use one of the filter characters as a normal character, this must
be preceded by a backslash (\).

Introduction to the OPC Server for SIMATIC NET


286 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.5.2 Methods of "OPCBrowser"

Item (Key As Variant) As String

Description:
Provides the name of the entry specified by the index "Key“.

ShowBranches ()

Description:
Enters the names of the branches of the current browse position into
the collection.

ShowLeafs (Optional Flat As Variant)

Description:
Enters the names of the leaves of the current browse position into the
collection. If the parameter "Flat“ is true, the collection with all leaves
of the current and deeper branches are filled starting from the current
browse position. The default for "Flat" is false.

MoveUp ()

Description:
Moves the current position in the address area one level up.

MoveDown (Branch As String)

Description:
Moves the current position in the address area into the current branch
(one level deeper).

MoveToRoot ()

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 287
The OPC Automation Interface for Data Access

Description:
Moves the current position in the address area to the root.

MoveTo (Branches() As String)

Description:
Moves the current position in the address area to a specified, absolute
position. The absolute position is specified as an array of branch
names starting from the root.

GetItemID (Leaf As String) As String

Description:
The server converts the name to an ItemID that can be transferred to
the "Add" method of "OPCItems". The creation of this ID is based on
the current position of the browser, extended by the node with the
name contained in the "Leaf" string.

GetAccessPaths (ItemID As String) As Variant

Description:
This provides the possibility of querying the access path of an ItemID.

Notes:
Not required for the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


288 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.6 The "OPCGroups“ Collection Object

Description The OPCGroups object is a collection object for creating and


managing OPC groups. The default properties of OPC groups specify
default values for creating all OPC groups.

Public groups are not supported by the OPC server for SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 289
The OPC Automation Interface for Data Access

11.6.1 Properties of "OPCGroups“

Property Type Access Brief Description

Parent OPC Read- Provides a


server onlyRead- reference to the
only corresponding OPC
server object.
DefaultGroupIsActive Boolean Read/Write Specifies the initial
value for the
"ActiveState“
property of newly
created OPC
groups. Default:
True
DefaultGroupUpdateRate Long Read/Write Specifies the initial
value for the
"update rate“
property of newly
created OPC
groups. Default:
1000 milliseconds.
DefaultGroupDeadband Single Read/Write Specifies the initial
value for the
"Deadband“
property of newly
created OPC
groups.
DefaultGroupLocaleID Long Read/Write Specifies the initial
value for the "locale
ID“ property of
newly created OPC
groups.
DefaultGroupTimeBias Long Read/Write Specifies the initial
value for the "time
bias“ property of
newly created
OPCGroups.
Count Long Read-only Properties
necessary for the
collection, provides
the number of
entries.

Notes: • The DefaultGroupTimeBias property is not evaluated by the OPC •


server for SIMATIC NET.
• DefaultGroupLocaleID is irrelevant for the OPC server for
SIMATIC NET.
• The DefaultGroupDeadband property has no significance for the
OPC server for SIMATIC NET.-

Introduction to the OPC Server for SIMATIC NET


290 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.6.2 Methods of "OPCGroups“

Item (Key As Variant) As OPCGroup

Description:
Provides a reference to the indexed object of the collection.

Add (Optional Name As Variant) As OPCGroup

Description:
Creates a group in the server object.

Notes:
• If the Name parameter is empty or not specified, the OPC server
generates a name that starts with an underscore (for example
"_123456"). User-defined names should therefore not begin with the
underscore character.

GetOPCGroup (Key As Variant) As OPCGroup

Description:
Provides the reference to an OPC group indicated by the name or the
server handle.

Remove (Key As Variant)

Description:
Deletes a group on the server.

RemoveAll ()

Description:
Deletes all groups and items of the server.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 291
The OPC Automation Interface for Data Access

11.6.3 Events of "OPCGroups“

GlobalDataChange (TransactionID As Long, GroupHandle As Long, NumItems As Long,


ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long,
TimeStamps() As Date)

Description:
This event simplifies the processing of events throughout all groups of
the collection by reporting changes in the value and state of all items in
all groups.

Introduction to the OPC Server for SIMATIC NET


292 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.7 The "OPCGroup“ Object

Description The “OPC Group” class manages the individual process variables, the
OPC items. Using these group objects, a client can form semantically
meaningful units of OPC items and execute operations with them.

11.7.1 Properties of "OPCGroup“

Property Type Access Brief Description

Parent OPC Read- Provides a reference to the


Server onlyRead- corresponding OPC server
only object.
Name String Read/Write The name of the group.

IsPublic Boolean Read-only Returns "True“ when this group


is a public group, otherwise
false.
IsActive Boolean Read/Write Active state of the group.
An active group creates events
for all active items of the group.
IsSubscribed Boolean Read/Write Notification status of the group
specifying whether or not the
variables of a group will be
monitored.
ClientHandle Long Read/Write A handle assigned by the client
and that can be used in the
client program to localize data
(for example a row in a table)
ServerHandle Long Read-only A unique handle assigned for
the group by the server. The
client must transfer this handle
with many methods that
influence the group (for example
Remove).
LocaleID Long Read/Write Specifies the language ID for
strings supplied by the server
(for example error texts)
TimeBias Long Read/Write Provides the time offset used to
change the time stamp of the
data to the local time.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 293
The OPC Automation Interface for Data Access

Property Type Access Brief Description

DeadBand Single Read/Write Specifies a bandwidth (as a


percentage) within which value
changes do not result in a
message.

UpdateRate Long Read/Write The fastest rate at which a


client is informed of changes in
values or states of items.

OPCItems OPC Read-only Collections object "OPCItems“


Items for managing the items of a
group

Notes: • The TimeBias property is not evaluated by the OPC server for
SIMATIC NET.
• LocaleID is irrelevant for the OPC server for SIMATIC NET.
• The DeadBand property has no significance for the OPC server for
SIMATIC NET.-
• To allow value changes of the items of a group to be signaled using
the appropriate event, the properties "IsActive" and
"IsSubscribed" must be set to "True".

Introduction to the OPC Server for SIMATIC NET


294 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.7.2 Methods of "OPCGroup“

SyncRead (Source As Integer, NumItems As Long, ServerHandles() As Long, ByRef


Values() As Variant, ByRef Errors() As Long, Optional ByRef Qualities As
Variant, Optional ByRef TimeStamps as Variant)

Description:
Synchronous reading of the values, status information or time stamp of
one or more items in a group. The values can be read from the cache
of the server or directly from the hardware. Reading from the cache is,
however, only possible when the group is activated.
Notes:
The call is monitored by the timeout monitoring on the server. The
duration is specified by a configuration parameter in the protocol-
specific configuration file (Section 8).

SyncWrite (NumItems As Long, ServerHandles() As Long, Values() As Variant, ByRef


Errors() As Long)

Description:
Synchronous writing of values for one or more items of a group to the
hardware.
Notes:
The call is monitored by the timeout monitoring on the server. The
duration is specified by a configuration parameter in the protocol-
specific configuration file (Section 8).

AsyncRead ( NumItems As Long, ServerHandles() As Long, ByRef Errors() As Long,


TransactionID As Long, ByRef CancelID As Long)

Description:
Sends an asynchronous read command. The result is returned with the
"AsyncReadComplete“ event.
Notes:
Asynchronous read commands always read directly from the device!
The call is monitored by the timeout monitoring on the server. The
duration is specified by a configuration parameter in the protocol-
specific configuration file (Section 8).

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 295
The OPC Automation Interface for Data Access

AsyncWrite (NumItems As Long, ServerHandles() As Long, Values() As Variant, ByRef


Errors() As Long, TransactionID As Long, ByRef CancelID As Long)

Description:
Sends an asynchronous write command. The result is returned with the
"AsyncWriteComplete“ event.
Notes:
The call is monitored by the timeout monitoring on the server. The
duration is specified by a configuration parameter in the protocol-
specific configuration file (Section 8).

AsyncRefresh (Source As Integer, TransactionID As Long,ByRef CancelID As Long)

Description:
Requests a current value for every active OPC item. The results are
returned by the "DataChange“ event.

AsyncCancel (TransactionID As Long)

Description:
Cancels an outstanding asynchronous job.

Introduction to the OPC Server for SIMATIC NET


296 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.7.3 Events of "OPCGroup“

Description The OPC automation interface supplies the changes to the values of
active terms and the results of asynchronous operations with events.
The requirement for this is the declaration of OPC groups WithEvents.

DataChange (TransactionID As Long, NumItems As Long, ClientHandles() As Long,


ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date)

Description:
The DataChange event occurs when it is detected that an active item
has a change value or a change quality. Checking value changes is
triggered by the UpdateRate timer. Events are generated only for
active items within an active group of events.

AsyncReadComplete (TransactionID As Long, NumItems As Long, ClientHandles() As Long,


ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date,
Errors() As Long)

Description:
The AsyncReadComplete event is triggered when a read job is
completed.

AsyncWriteComplete (TransactionID As Long, NumItems As Long, ClientHandles() As Long,


Errors() As Long)

Description:
The AsyncWriteComplete event is triggered when a write job is
completed.

AsyncCancelComplete (TransactionID As Long)

Description:
The AsyncCancelComplete event is triggered when a cancel job is
completed.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 297
The OPC Automation Interface for Data Access

11.8 The "OPCItems“ Collection Object

Description The OPCItems object is a collection object for creating and managing
OPC items. The default properties of OPCItems specify default values
for all OPC items to be created.

11.8.1 Properties of "OPCItems“

Property Type Access Brief Description

Parent OPC Read Supplies a


Group reference to the
corresponding
OPCGroup object
DefaultRequestedDataType Integer Read/Write Specifies the initial
value for the
"RequestedDataTy
pe“ property of
newly added
items. The default
is vbEmpty for the
canonical data
type of the server.
DefaultAccessPath String Read/Write Specifies the initial
value for the
"AccessPath“
property of newly
added items. The
default is an
empty string.
DefaultIsActive Boolean Read/Write Specifies the initial
value for the
"Active State“
property of newly
added items.
The default value
is true.
Count Long Read-only Properties
necessary for the
collection,
provides the
number of entries.

Introduction to the OPC Server for SIMATIC NET


298 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.8.2 Methods of "OPCItems“

Item (ItemSpecifier As Variant) As OPCItem

Description:
Provides a reference to the item of the collection described by the
ItemSpecifier index.
(The "GetOPCItem“ method, on the other hand, provides a reference
to the server handle.)

GetOPCItem (ServerHandle As Long) As OPCItem

Description:
Provides a reference to the server handle created by Add.

AddItem (ItemID As String, ClientHandle As Long)

Description:
Inserts an item in the OPCItems collection of a group.

Notes:
• AddItem returns errors using the variable "Err" to "On Error".
• The structure of the ItemIDs for the OPC server for SIMATIC NET
is described in Chapter 5.
• It is possible to add the same OPC item to the same group more
than once. In this case each of these items nevertheless has its
own server handle.
The server handles of the items are only unique within a group and
not for all items of all groups.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 299
The OPC Automation Interface for Data Access

AddItems (Count As Long, ItemIDs() As String, ClientHandles() As Long, ByRef


ServerHandles() As Long, ByRef Errors() As Long, Optional
RequestedDataTypes As Variant, Optional AccessPaths As Variant)

Description:
Inserts several items in the OPCItems collection of a group.

Notes:
• AddItems returns errors only using the "Errors" array, the error
variable "Err" is not set.
• The structure of the ItemIDs for the OPC server for SIMATIC NET
is described in Chapter 5.
• It is possible to add the same OPC item to the same group more
than once. In this case each of these items nevertheless has its
own server handle.
The server handles of the items are only unique within a group and
not for all items of all groups.

Remove (Count As Long, ServerHandles() As Long, ByRef Errors() As Long)

Description:
Deletes one or more items from a group.

Validate (Count As Long, ItemIDs() As String, ByRef Errors() As Long, Optional


RequestedDataTypes As Variant, Optional AccessPaths As Variant)

Description:
Checks the validity of one or more OPC items; in other words whether
it was added to a group without any error occurring, and supplies
information such as the canonical data type.

Notes:
See AddItems

SetActive (Count As Long, ServerHandles() As Long, ActiveState As Boolean, ByRef


Errors() As Long)

Description:
Sets the active state of one or more items in a group.

Introduction to the OPC Server for SIMATIC NET


300 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

SetClientHandles (Count As Long, ServerHandles() As Long, ClientHandles() As Long, ByRef


Errors() As Long)

Description:
Changes the client handle of one or more items in a group.

SetDataTypes (Count As Long, ServerHandles() As Long, RequestedDataTypes() As Long,


ByRef Errors() As Long)

Description:
Sets the required data type of one or more items in a group.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 301
The OPC Automation Interface for Data Access

11.9 The "OPCItem“ Object

Description An object of the class OPC item represents a link to a process


variable, for example to the input module of a programmable
controller. A process variable is data of the process I/Os that can be
written and/or read, for example the temperature of a tank. Each
process variable is associated with a value (variant data type), a
quality, and a time stamp.

Introduction to the OPC Server for SIMATIC NET


302 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.9.1 Properties of "OPCItem“

Property Type Access Brief Description

Parent OPC Read-only Supplies a reference to the


Group parent OPCGroup object.
ClientHandle Long Read/Write A handle that can be freely
defined by the user to allow
simpler assignment of the
process variable in internal
data structures of the client.
ServerHandle Long Read-only A handle assigned uniquely to
the item by the server. This
handle is required in several
operations to identify an item.
AccessPath String Read-only The access path of the item as
specified in the Add function.
AccessRights Long Read-only Provides the access rights of
the variable.
ItemID String Read-only The unique name of the item
as specified in the Add
function.
IsActive Boolean Read/Write Specifies whether message
events will be created for this
item.
RequestedData Integer Read/Write The data type in which the
value of the item will be
Type supplied.
Value Variant Read-only The last valid value of the
variable (default property of
the OPCItem object)
Quality Long Read-only The quality of the value last
read. The quality indicates the
validity of the value of the
variable.
TimeStamp Date Read-only The time at which the last
value was acquired.
CanonicalData Integer Read-only The original data type of the
Type item.
EUType Integer Read-only Identifies the unit of the value.
If no units are available, the
value is always "VT_EMPTY“.
EUInfo Variant Read-only Information about the unit of
the value.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 303
The OPC Automation Interface for Data Access

Notes:
The OPC server for SIMATIC NET does not support units (engineering
units)

Introduction to the OPC Server for SIMATIC NET


304 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access

11.9.2 Methods of "OPCItem“

Read (Source As Integer, Optional ByRef Value As Variant, Optional ByRef Quality
As Variant, Optional ByRef TimeStamp As Variant )

Description:
Reads the value, the quality, and/or the time stamp of this variable.

Write (Value As Variant)

Description:
Sets the value of this variable synchronously.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 305
The OPC Custom Interface for Alarms & Events

Introduction to the OPC Server for SIMATIC NET


306 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

12 The OPC Custom Interface for Alarms & Events

This chapter lists the interfaces and methods of the OPC Custom interface for Alarms &
Events. This is not a detailed interface description but contains supplementary
information and notes relating specifically to SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 307
The OPC Custom Interface for Alarms & Events

12.1 Supplement to the Interface Description of the OPC


Custom Interface for Alarms & Events

Introduction A detailed interface description of the OPC interfaces is beyond the


scope of this manual. This is supplied as a file along with this product
as an original English document from the OPC Foundation. You will
find the documents in the "DOC" folder in the product folder of the
OPC servers for SIMATIC NET.

Use in C/C++ The use of the OPC Custom interface for Alarms & Events is
analogous to the use of the custom interface for Data Access (see
Section 10.2). The ProgID must, however, be used for the OPC Alarm
& Events server:
OPC.SimaticNetAlarms

Refer, in particular, to the sample program for OPC Alarms & Events
in the product folder "Samples\S7\Custom\AlrmEvnt\SimpleAE".

Structure of the The following supplementary information about the interfaces lists the
Description objects of OPC, their interfaces and the methods defined in these
interfaces and points out particular characteristics of the OPC server
for SIMATIC NET.

Overview of the "OPC EventServer" Object


Objects and
IOPCCommon
Interfaces
IOPCEventServer
IconnectionPointContainer

"OPC Event Subscription" Object


IOPCEventSubscriptionMgt
IconnectionPointContainer

"OPC Event Area Browser" Object*


IOPCEventAreaBrowser

*: not supported by SIMATIC NET

Introduction to the OPC Server for SIMATIC NET


308 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

12.2 The "OPC Event Server" Object

Description A client generates an object of the class "OPC Event Server" and
addresses this object to be able to use the Alarm&Event services. It
provides a management interface via which a message object is
created, various queries are executed and events are activated. The
client can also set the language for output texts and logon to receive
server-specific events.

ProgID The Alarm & Event server for SIMATIC NET has the ProgID
SIMATIC NET
OPC.SimaticNETAlarms

Schematic The following schematic illustrates the “OPC server” object with its
interfaces.

IUnknown

IOPCEventServer
IOPCCommon
IConnectionPointContainer OPC event
server object

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 309
The OPC Custom Interface for Alarms & Events

12.2.1 The "IOPCEventServer" Interface

Overview This is the central interface for use of the Alarm&Event functionality. It
is used to generate subscription objects and the area browser as well
as to investigate event categories and to manage conditions.

GetStatus (OPCEVENTSERVERSTATUS ** ppEventServerStatus)

Description:
Provides current information about the status of the OPC server. The
status is returned as a structure (refer to the OPC Alarms & Events
specification).

Notes:
• The client must release the memory required for the structure and
the szVendorInfo.

CreateEventSubscription
(BOOL bActive, DWORD dwBufferTime, DWORD dwMaxSize,
OPCHANDLE hClientSubscription, REFIID riid, LPUNKNOWN * ppUnk,
DWORD * pdwRevisedBufferTime, DWORD * pdwRevisedMaxSize´)

Description:
Creates a subscription for informing the client and returns the
requested interface for access to the subscription object.

QueryAvailableFilters (DWORD * pdwFilterMask)

Description:
Provides information about the filter options supported by the OPC
Event server.

Notes:
• The OPC Event server for SIMATIC NET supports the following
filters.
OPC_FILTER_BY_EVENTS 0x01
OPC_FILTER_BY_CATEGORY 0x02
OPC_FILTER_BY_SEVERITY 0x04
OPC_FILTER_BY_SOURCE 0x16

Introduction to the OPC Server for SIMATIC NET


310 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

QueryEventCategories (DWORD dwEventType, DWORD* pdwCount,


DWORD** ppdwEventCategories, LPWSTR** ppEventCategoryDescs )

Description:
Provides the event categories offered by the OPC Event server.

Notes:
• The OPC Event server for SIMATIC NET supplies event categories
only when the value OPC_SIMPLE_EVENT is set for the parameter
"dwEventType".
• The OPC Event server for SIMATIC NET supports the following
event categories.
S7_PROCESS_SCAN 0x01
S7_PROCESS_ALARM 0x02

QueryConditionNames
(DWORD dwEventCategory, DWORD* pdwCount, LPWSTR**
ppszConditionNames)

Description:
Provides the conditions offered by the OPC Event server for a
particular event category.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET.

QuerySubConditionNames
(LPWSTR szConditionName, DWORD* pdwCount, LPWSTR**
ppszSubConditionNames)

Description:
Provides the subconditions offered by the OPC Event server for
specific event categories.

Notes:
Subconditions are not supported by the OPC Event server for
SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 311
The OPC Custom Interface for Alarms & Events

QuerySourceConditions
(LPWSTR szSource, DWORD* pdwCount, LPWSTR**
ppszConditionNames)

Description:
Provides the conditions offered by the OPC Event server for a specific
event source.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET.

QueryEventAttributes
(DWORD dwEventCategory, DWORD* pdwCount, DWORD**
ppdwAttrIDs, LPWSTR** ppszAttrDescs, VARTYPE** ppvtAttrTypes)

Description:
Provides the attributes offered by the OPC server for a specific event
category. Additional information (for example associated values) are
transferred to the client using attributes.

Notes:
The attributes provided by the OPC Event server for SIMATIC NET
are listed in Section 6.2.2.

TranslateToItemIDs (LPWSTR szSource, DWORD dwEventCategory LPWSTR


szConditionName, LPWSTR szSubconditionName, DWORD
dwCount, DWORD* pdwAssocAttrIDs, LPWSTR** ppszAttrItemIDs,
LPWSTR** ppszNodeNames, CLSID** ppCLSIDs )

Description:
Using this function, the OPCItems corresponding to an event attribute
for use with an associated OPC Data Access server can be obtained.

Notes:
The attributes provided by the OPC Event server for SIMATIC NET
cannot be represented as ItemIDs for use with the OPC Data Access
server for SIMATIC NET.
TranslateToItemIDs is not supported by the OPC Event server for
SIMATIC NET.

Introduction to the OPC Server for SIMATIC NET


312 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

GetConditionState (LPWSTR szSource, LPWSTR szConditionName, DWORD


dwNumEventAttrs, DWORD* pdwAttributeIDs,
OPCCONDITIONSTATE ** ppConditionState)

Description:
Provides information about the state of a condition of an event source.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET. E_NOTIMPL is returned.

EnableConditionByArea
(DWORD dwNumAreas, LPWSTR* pszAreas)

Description:
Activates all the conditions for all event sources within the specified
area.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET. E_NOTIMPL is returned.

EnableConditionBySource
(DWORD dwNumSources, LPWSTR* pszSources)

Description:
Activates all conditions for all specified event sources.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET. E_NOTIMPL is returned.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 313
The OPC Custom Interface for Alarms & Events

DisableConditionByArea
(DWORD dwNumAreas, LPWSTR* pszAreas)

Description:
Deactivates all the conditions for all the events sources within the
specified area.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET. E_NOTIMPL is returned.

DisableConditionBySource
(DWORD dwNumSources, LPWSTR* pszSources)

Description:
Deactivates all conditions for all specified event sources.

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET. E_NOTIMPL is returned.

AckCondition (DWORD dwCount, LPWSTR szAcknowledgerID, LPWSTR


szComment, LPWSTR* pszSource, LPWSTR* pszConditionName,
FILETIME* pftActiveTime, DWORD* pdwCookie, HRESULT
**ppErrors )

Description:
Transfers an event confirmation to the client. Only conditional events
can be confirmed. An event is identified by the event source, the event
name, the activation time, and an additional information ("Cookie").

Notes:
Conditions are not supported by the OPC Event server for SIMATIC
NET.

Introduction to the OPC Server for SIMATIC NET


314 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

CreateAreaBrowser (REFIID riid, LPUNKNOWN* ppUnk)

Description:
Creates an OPCEventAreaBrowser object for investigating the process
area.

Notes:
Areas and the browsing of areas is not supported by the OPC Event
server for SIMATIC NET. E_NOTIMPL is returned.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 315
The OPC Custom Interface for Alarms & Events

12.3 The "OPC Event Subscription" Object

Description An object of the class "OPC Event Subscription" provides event


messages for the client that uses the connection point container of this
event object. A client can use several objects of the class "OPC Event
Subscription". It could, for example define different filters for different
objects.
An OPC event subscription is basically a subscription for defined
events.
The "OPC Event Subscription" object provides methods for selecting
messages.
Schematic The following schematic illustrates the “OPC server” object with its
interfaces.

IUnknown

IOPCEventSubscriptionMgt
IConnectionPointContainer
OPC event
subscription
object

Introduction to the OPC Server for SIMATIC NET


316 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

12.3.1 The "IOPCEventSubscriptionMgt" Interface

Overview This is the central interface for managing the information via a specific
"Event Subscription". On this interface, relevant events can be
selected for the client among other things.

SetFilter (DWORD dwEventType, DWORD dwNumCategories, DWORD*


pdwEventCategories, DWORD dwLowSeverity, DWORD
dwHighSeverity, DWORD dwNumAreas, LPWSTR* pszAreaList,
DWORD dwNumSources, LPWSTR* pszSourceList)

Description:
Provides a filter for selecting certain events for this "Event
Subscription".

Notes:
The parameters for filtering have the following significance for the
OPC Event server for SIMATIC NET:

Event Type Only the event type OPC_SIMPLE_EVENT is


supported. Filtering is pointless
Event Categories Possible event categories are as follows:
• S7_PROCESS_SCAN
• S7_PROCESS_ALARM

Severity The default severity of the message is 600 for


S7_PROCESS_ALARM and 300 for
S7_PROCESS_SCAN, this can however be
changed using the configuration file.
Areas Areas are not supported
Source As the source, connection information can be
specified. (See Section 6.2.1 )

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 317
The OPC Custom Interface for Alarms & Events

GetFilter (DWORD* pdwEventType, DWORD* pdwNumCategories, DWORD**


ppdwEventCategories, DWORD* pdwLowSeverity, DWORD*
pdwHighSeverity, DWORD* pdwNumAreas, LPWSTR** ppszAreaList,
DWORD* pdwNumSources, LPWSTR** ppszSourceList )

Description:
Returns the currently used filter for selecting certain events for this
"Event Subscription".

Notes:
The parameters for filtering have the same significance for the OPC
Event server for SIMATIC NET as explained in the description of the
"SetFilter" method.

SelectReturnedAttributes
(DWORD dwEventCategory, DWORD dwCount, DWORD*
dwAttributeIDs)

Description:
Specifies the attribute for an event category to be supplied with the
event message.

Notes:
The possible attributes for the OPC Event server for SIMATIC NET are
described in Section 6.2.2.

GetReturnedAttributes
( DWORD dwEventCategory, DWORD * pdwCount, DWORD*
pdwAttributeIDs)

Description:
Returns the list with the attributes for an event category to be supplied
with an event message.

Notes:
The possible attributes for the OPC Event server for SIMATIC NET are
described in Section 6.2.2.

Refresh (DWORD dwConnection )

Introduction to the OPC Server for SIMATIC NET


318 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

Description:
Sends all active and all inactive, unconfirmed condition messages
corresponding to the current filter setting to the client.

Notes:
Since the OPC Event server for SIMATIC NET supports only simple
events, no event messages are sent with the refresh.

CancelRefresh (DWORD dwConnection )

Description:
Cancels an active refresh.

Notes:
Since the OPC Event server for SIMATIC NET supports only simple
events no event messages are sent during a refresh. A CancelRefresh
therefore has not effect.

GetState (BOOL * pbActive, DWORD * pdwBufferTime, DWORD *


pdwMaxSize, OPCHANDLE * phClientSubscription)

Description:
Returns the current status of the event subscription.

SetState (BOOL * pbActive, DWORD * pdwBufferTime, DWORD *


pdwMaxSize, OPCHANDLE hClientSubscription DWORD *
pdwRevisedBufferTime, DWORD * pdwRevisedMaxSize)

Description:
Allows the setting of various properties of an event subscription.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 319
The OPC Custom Interface for Alarms & Events

12.4 The Interfaces of the Client

Description When using connection points to transfer events to a client, the client
must provide a COM object with the interfaces IUnknown and the call-
specific interface (for example IOPCEventSink) to receive the calls.
When it logs on at a connection point, the client transfers a pointer to
the IUnknown interface to the server.

Schematic The following schematic shows the object to be implemented by the


client for receiving messages and its interfaces.

IUnknown

IOPCEventSink
IOPCShutdown
Event sink
client object

Introduction to the OPC Server for SIMATIC NET


320 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events

12.4.1 The "IOPCEventSink" Interface

Overview This is the central interface of the client for receiving messages. It
contains a method called by the server to transfer events.

OnEvent (OPCHANDLE hClientSubscription, BOOL bRefresh, BOOL


bLastRefresh, DWORD dwCount, ONEVENTSTRUCT* pEvents)

Description:
Transfers one or more event messages to the client.

Notes:
The "*pEvents" structure contains one or more events. In the structure
elements that follow, the SIMATIC NET OPC Event enters specific
values:

SzSource Connection information


Conversion to an ItemID for use in OPC Data
Access using TranslateToItemID provides no
result.
ftTime Time at which the event occurred on the partner
device. The time at which the message is received
on the OPC Event server is entered in the
"EVENT_ATTR_S7_PCTIME" attribute.
szMessage • SCAN<message number> or
• ALARM<message number>
dwEventType OPC_SIMPLE_EVENT
dwEventCategory • S7_PROCESS_SCAN
• S7_PROCESS_ALARM
pEventAttributes The attributes provided are described in Section
6.2.2.

All other structure elements are irrelevant.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 321
The OPC Custom Interface for Alarms & Events

12.4.2 The "IOPCShutdown" Interface

Overview Via the call interface based on this connection point, the server can
inform its clients before it is closed down or before it closes down. In
critical situations, this allows the OPC server to inform its clients so
that, for example, they can close down correctly.

The interface contains one method:

ShutdownRequest (LPWSTR szReason)

Description:
Via this interface, the server can inform its clients when it is closed.

Notes:
The "Reason" (parameter szReason) can be set using the configuration
program for the OPC server.

Introduction to the OPC Server for SIMATIC NET


322 6GK1971-0BA00-0AA1
Where to Get Help

13 Where to Get Help

This section lists sources of information about SIMATIC NET:


• Who to contact with technical questions
• Who to contact about training for SIMATIC NET products

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 323
Where to Get Help

13.1 Help with Technical Questions

SIMATIC Customer Support Hotline

Available at all times worldwide:

Nuremberg
Johnson City

Singapore

SIMATIC Basic Hotline

Nuremberg
SIMATIC BASIC Hotline SIMATIC Premium Hotline
(charged, only with SIMATIC card)
Local time: Mo to Fr 8:00 to 18:00 (CET) Local time: Mo to Fr 0:00 to 24:00 (CET)
Phone: +49 (911) -895-7000 Phone: +49 (911) -895-7777
Fax: +49 (911) -895-7002 Fax: +49 (911) -895-7001
E-mail: simatic.support@nbgm.siemens.de

Johnson City Singapore


SIMATIC BASIC Hotline SIMATIC BASIC Hotline
Local time: Mo to Fr 8:00 to 17:00 Local time: Mo to Fr 8:30 to 17:30
Phone: +1 423 461-2522 Phone: +65 740-7000
Fax: +1 423 461-2231 Fax: +65 740-7376
E-mail: simatic.hotline@sea.siemens.com E-Mail: simatic.hotline@sae.siemens.com.sg

Introduction to the OPC Server for SIMATIC NET


324 6GK1971-0BA00-0AA1
Where to Get Help

SIMATIC Customer Support Online Services

In its online services, SIMATIC Customer Support provides you with wide-ranging
additional information about SIMATIC products:

1. You will find general, up-to-date information:

on the Internet (http://www.ad.siemens.de/simatic)

using fax polling

2. You can obtain the latest product information and downloads:

on the Internet (http://www.ad.siemens.de/support/html-00).

via the Bulletin Board System (BBS) of the SIMATIC Customer Support
mailbox in Nuremberg (Tel.: +49 (911) - 895-7100).

To dial the mailbox, use a modem with up to 28.8 Kbps, V.34 (parameters:
8, N, 1, ANSI) or ISDN (parameters: x.75, 64 Kbps)

SIMATIC Training Center

To help you to become familiar with the SIMATIC S7 automation system, we offer
training courses Please contact your regional training center or the central training
center in D-90327 Nuremberg, Tel. 0911-895-3154.

Authorization

Please note that this software product can only be operated when you are in
possession of a valid authorization..

The product is supplied with a key diskette (authorization diskette).

Note
For test or demonstration purposes, you can install the software product in the
demonstration mode without a license to acquaint yourself with the functions.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 325
Where to Get Help

Standards and Approvals

The S7-300 meets the requirements and criteria of IEC 1131, Part 2. The S7-300
meets the requirements for CE marking. CSA, UL and FM approvals exist for the
S7-300.

Recycling and Disposal

Due to the low levels of pollutants, the SIMATIC S7-300 can be recycled.

For environmentally-friendly recycling and disposal of your old SIMATIC devices,


contact:

Siemens Aktiengesellschaft
Anlagenbau und Technische Dienstleistung
ATD ERC Essen Recyling/Remarketing
Fronhauser Str. 69
45 127 Essen

Phone: 0201-816-1540 (Hotline)


Telefax: 0201-816-1506

Introduction to the OPC Server for SIMATIC NET


326 6GK1971-0BA00-0AA1
Where to Get Help

13.2 Who to Contact about Training for SIMATIC NET Products

Course Siemens AG
Registration Trainings-Center für Automatisierungstechnik
AUT 959 Kursbüro
Östliche Rheinbrückenstraße 50
76181 Karlsruhe
Germany

Telephone 0721 - 595 - 2917


outside Germany +49 - 721 - 595 - 2917
Telefax 0721 - 595 - 6987
outside Germany +49 - 721 - 595 - 6987

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 327
Where to Get Help

Introduction to the OPC Server for SIMATIC NET


328 6GK1971-0BA00-0AA1
Glossary

14 Glossary

Application Synonym for user programs

AS-Interface Actuator Sensor Interface - cable for direct connection of simple binary
sensors and actuators (transfer of small amounts of information)

COM Component Object Model - specification from Microsoft for Windows


objects, basis of OLE

DCOM Distributed COM - extension of the COM standard allowing the


distribution of COM objects in a network.

DLL Dynamic Link Library - selection of functions available to more than


one program. The DLL is only loaded in memory once
(Windows/Windows NT property).

DP Protocol Protocol for data transmission to distributed I/Os via a DP network ->
PROFIBUS

FMS Fieldbus Message Specification, -> PROFIBUS protocol for convenient


communication on the basis of layer 7 of the ISO/OSI reference model

Industrial Ethernet Bus system for use in industry on the basis of Ethernet (previously
SINEC H1)

Network A network consists of one or more connected subnets with any number
of nodes. Several networks can exist parallel to each other.

OLE Object Linking and Embedding - central architectural principle of the


Windows versions Windows 95, Windows NT and the basis of
Windows application software under Windows 3.x

OPC OLE for Process Control - industrial standard allowing vendor-


independent access to industrial communication networks, defined on
the basis of OLE.

OPC Client User program that uses an OPC server via the OPC interface to
access process data.

Introduction to the OPC Server for SIMATIC NET


6GK1971-0BA00-0AA1 329
Glossary

OPC Server An OPC server is a product that provides the OPC client with wide
ranging functions allowing communication via industrial networks.

PLC Programmable Logic Controller - interface between sensors and


production machines also used for communication and data transport
between the user and the entire operational production sequence.

PROFIBUS Process Field Bus - European fieldbus standard

SIMATIC Name of products and systems for industrial automation from Siemens

SIMATIC NET Siemens product range industrial communications networks and


network components

SR Send/Receive, SIMATIC NET protocol for simple, but powerful


communication on layer 4 of the ISO/OSI reference model.

UTC Coordinated Universal Time - coordinated atomic universal time (UT);


since 1967 worldwide time as atomic time as opposed to astronomical
time.

VBA Visual Basic for Applications - macro language of various office


applications from Microsoft

Introduction to the OPC Server for SIMATIC NET


330 6GK1971-0BA00-0AA1
Appendix A
SIMATIC COMPUTING
A SIMATIC Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
A.1 Getting Started with Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
A.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
A.1.2 Creating a Sample I/O Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4
A.1.3 Connecting Third-Party Controls to a SIMATIC Data Control . . . . . . . . . . A-9
A.1.4 Using Computing with Microsoft Excel 97 . . . . . . . . . . . . . . . . . . . . . . . . . . . A-12
A.2 Product Overview and Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-16
A.2.1 Using an ActiveX Control to Access the Process Data . . . . . . . . . . . . . . . . A-16
A.3 Accessing the Process Data with the SIMATIC Data Control . . . . . . . . . . A-17
A.3.1 Connecting the SIMATIC Controls to the Control Engine . . . . . . . . . . . . . . A-18
A.3.2 Configuring the Connection Properties for the Data Control . . . . . . . . . . . A-19
A.3.3 Selecting the Control Engine for the Data Control . . . . . . . . . . . . . . . . . . . . A-20
A.3.4 Connecting to a Specific Control Engine over DCOM . . . . . . . . . . . . . . . . . A-22
A.3.5 Connecting the ActiveX Controls to the Control Engine . . . . . . . . . . . . . . . A-24
A.3.6 Filtering the Properties for the ActiveX Controls . . . . . . . . . . . . . . . . . . . . . A-27
A.3.7 Configuring Custom Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-29
A.3.8 Creating a Connection Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-30
A.3.9 Sample Program for Creating a Connection Table and an Event Table . . A-31
A.3.10 Sample Program for Responding to Events . . . . . . . . . . . . . . . . . . . . . . . . . A-33
A.3.11 Sample Programs for Reading and Writing Data . . . . . . . . . . . . . . . . . . . . . A-37
A.3.12 Sample Program for Reading and Writing Boolean Data . . . . . . . . . . . . . . A-41
A.3.13 Properties, Methods, and Events of the Data Control . . . . . . . . . . . . . . . . . A-42
A.4 Properties and Methods of the SIMATIC Controls . . . . . . . . . . . . . . . . . . . . A-44
A.4.1 Activated Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-44
A.4.2 Alignment Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-44
A.4.3 Appearance Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-45
A.4.4 AutoConnect Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-46
A.4.5 AutoConnectTimeout Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-46
A.4.6 BackColor Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-47
A.4.7 BorderStyle Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-47
A.4.8 Caption1 and Caption2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-48
A.4.9 Caption1Alignment and Caption2Alignment Properties . . . . . . . . . . . . . . . A-48
A.4.10 Caption1BackColor, Caption2BackColor Properties . . . . . . . . . . . . . . . . . . A-49
A.4.11 Caption1Font and Caption2Font Properties . . . . . . . . . . . . . . . . . . . . . . . . . A-50
A.4.12 Caption1ForeColor, and Caption2ForeColor Properties . . . . . . . . . . . . . . . A-50
A.4.13 Caption1Size and Caption2Size Properties . . . . . . . . . . . . . . . . . . . . . . . . . A-51
A.4.14 Connect Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-51
A.4.15 ConnectName Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-52
A.4.16 ConnectObject Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-53
A.4.17 ControlEngine Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-54
A.4.18 ConvertedValue Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-55
A.4.19 DataType Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-55
A.4.20 DefaultDeadband Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-57
A.4.21 DefaultUpdateRate Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-57
A.4.22 Direction Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-58
A.4.23 Disconnect Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-59
A.4.24 Enabled Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-59
A.4.25 Factor Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-60
A.4.26 FalseCaption Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-61
A.4.27 FalseColor Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-61
A.4.28 Font Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-62

SIMATIC Computing
6GK1971–0BA00–0AA1 i
A.4.29 ForeColor Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-62
A.4.30 LargeChange Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-63
A.4.31 LayoutType Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-63
A.4.32 LimitCheck Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-64
A.4.33 Locked Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-65
A.4.34 LowerLimit Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-65
A.4.35 Max Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-66
A.4.36 Min Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-67
A.4.37 MultipleEngines Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-67
A.4.38 Offset Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-68
A.4.39 PCName Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-68
A.4.40 Precision Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-69
A.4.41 PropertyChangedName Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-69
A.4.42 PropertyChangedObject Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-70
A.4.43 Radix Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-71
A.4.44 RangeRawMax, RangeRawMin, RangeScaledMax, and RangeScaledMin
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-72
A.4.45 ReadMultiVariables Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-74
A.4.46 ReadVariable Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-74
A.4.47 ScaleMode Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-75
A.4.48 ShowButtons Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-76
A.4.49 ShowErrorBoxes Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-77
A.4.50 SmallChange Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-78
A.4.51 TagServerName Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-79
A.4.52 TagSource Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-79
A.4.53 Ticks Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-80
A.4.54 TrueCaption Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-80
A.4.55 TrueColor Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-81
A.4.56 UpperLimit Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-81
A.4.57 Value Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-83
A.4.58 Write Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-84
A.4.59 WriteMode Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-84
A.4.60 WriteMultiVariables Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-85
A.4.61 WriteVariable Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-85
A.4.62 ZeroPad Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-86
A.5 Other SIMATIC Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-87
A.5.1 SIMATIC Button Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-87
A.5.2 Properties, Methods, and Events of the Button Control . . . . . . . . . . . . . . . A-91
A.5.3 SIMATIC Number Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-92
A.5.4 Properties, Methods, and Events of the Number Control . . . . . . . . . . . . . . A-99
A.5.5 SIMATIC Slider Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-103
A.5.6 Properties, Methods, and Events of the Slider Control . . . . . . . . . . . . . . . . A-106
A.6 Guidelines for Custom Controls and Third-Party Containers . . . . . . . . . . . A-107
A.6.1 Guidelines for Using Third-Party Containers with the Data Control . . . . . A-107
A.6.2 Guidelines for Creating a Custom ActiveX Control . . . . . . . . . . . . . . . . . . . A-108
A.6.3 Using a Custom Control with the Data Control . . . . . . . . . . . . . . . . . . . . . . . A-109

SIMATIC Computing
ii 6GK1971–0BA00–0AA1
SIMATIC Computing A
A.1 Getting Started with Computing

Chapter Overview
The Computing software provides you with a simple way to access and to use data
from a communication system such as a PROFIBUS–DP, a FMS Network or a S7
programmable controller.
This chapter provides some easy programming examples to help you become
familiar with the power and flexibility that can be achieved by using the ActiveX
controls provided by SIMATIC Computing.

Warning
! After you assign a variable to the Value property of a SIMATIC ActiveX control, the
control is able to access process data. When you change the value that is
displayed in the control, you are changing the value in the actual process. Do not
connect these examples to a control engine that is connected to equipment.
Altering process data can cause unpredictable process operation, and
unpredictable process operation could result in death or serious injury to
personnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could cause
process equipment to operate erratically. Always install a physical emergency stop
circuit for your machineor process.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-1
SIMATIC Computing

Simatic Computing für WinAC und SlotPLC


The SIMATIC Computing software supplied with the OPC Server for SIMATIC NET
corresponds to SIMATIC Computing for the products Win AC and Slot PLC Version
V2.x. There are, however, the following differences:
– It is only possible to access variables via the SIMATIC NET communication
systems.
– The names of the variables when using SIMATIC Computing with the OPC
Server from SIMATIC NET differ from the variable names used in WinAC.

SIMATIC Computing
A-2 6GK1971–0BA00–0AA1
SIMATIC Computing

A.1.1 Overview

The examples in this chapter show some of the ways you can use the ActiveX
controls provided by Computing. As shown in Figure A-1, this chapter provides
samples of subroutines for the following applications:
S Create a user interface: You can use the SIMATIC controls with a third–party
container (such as Microsoft’s Visual Basic) to create an I/O interface Panel.
See Section A.1.2. (You can use this panel to test the other sample programs in
this chapter.)
S Use a standard ActiveX control: You can use a standard control (such as a
Label control from Visual Basic) to access data in the control engine. See
Section A.1.3.
S Load data from the control engine into standard software packages: You can
load data into a Microsoft Office application (such as Microsoft’s Excel). See
Section A.1.4.

I/O Panel

QB0 QB1 QB2


Interface Panel
0 0 0

OFF OFF OFF

I 0.0 I 0.1 I 0.2

Standard ActiveX Control

Label control

Excel

Third-party application

Figure A-1 Using Computing to Access Data in the Control Engine

SIMATIC Computing
6GK1971–0BA00–0AA1 A-3
SIMATIC Computing

A.1.2 Creating a Sample I/O Panel

The Data control allows any OLE Container (such as Visual Basic 5.0) to access
process data. You can use the SIMATIC controls provided by Computing with
Visual Basic to create a simple I/O Panel that interacts with a control engine.
To create this sample application, you need the following items:
S Microsoft Visual Basic 5 or higher
S SIMATIC controls from Computing

Inserting the SIMATIC Controls into the Toolbox for Visual Basic
Use the following procedure to create the sample I/O panel:
1. Open a standard Visual Basic project:
– Select the File –>New Project menu command to display the “New Project”
dialog box.
– Select the “Standard EXE” icon and click on the “Open” button.
2. Select the Project –> Components menu command to display the
“Components” dialolg box.
3. As shown in Figure A-2, select the following SIMATIC controls in the
“Components” dialog box:
– Data control (Siemens SIMATIC Data Control)
– Button control (Siemens S7vbButton Control)
– Number control (Siemens S7Number Control)
4. Click on the “Apply” button. The SIMATIC controls that you selected appear in
the toolbox for Visual Basic. Click on the “OK” button to close the “Components”
dialog box.

Note
Even though the Computing controls sometimes use “S7” in their names, they can
be used with other systems (S5, DP–Network, FMS–Devices) too.

SIMATIC Computing
A-4 6GK1971–0BA00–0AA1
SIMATIC Computing

Components

Controls Designers Insertable Objects


S Click on the Data control, Number
control, and the Button control.
Siemens S7DiagBF Control
Siemens S7Number Control S Click on the “Apply” button to add the
Siemens S7Panel Control control to the VB toolbox.
Siemens S7vbButton Control S Click on the “OK” button to close the
Siemens S7vbSlider Control “Components” dialog box.
Siemens SIMATIC Data Control
Third-Party Control... Browse...
Third-Party Control...
Third-Party Control... Selected Items Only
Siemens SIMATIC Data Control
Location: C:\SIEMENS\Common\OCX\S7WCDATX.OCX

OK Cancel Apply

Figure A-2 Adding SIMATIC Controls to the VB Toolbox

Creating the VB Form for the Sample I/O Panel


1. Insert one SIMATIC Data control, three SIMATIC Number controls and three
SIMATIC Button controls onto the Visual Basic form. See Figure A-3.
2. Create standard VB label controls to indicate the address that you have
assigned for each of the controls. See Figure A-3.

I/O Panel

Temp Power Flow Label controls

0 0 0
Number controls

Button controls
OFF OFF OFF

EB0 EB1 EB2 Label controls

Data control

Figure A-3 Sample I/O Panel Created in Visual Basic

SIMATIC Computing
6GK1971–0BA00–0AA1 A-5
SIMATIC Computing

Assigning Variables in the Control Engine to the SIMATIC Controls


In order to connect a SIMATIC or third-party controls to the process data in the
control engine, you must assign a variable to the Value property (or to other
properties) for each control. You use the Connection tab of “Properties” dialog box
for the Data control to assign properties to the process variables in the control
engine. You cannot assign a process variable to the Value property of a control by
using the property list of the control itself.
Use the following procedure to assign variables to the SIMATIC controls:
1. Select the Data control and click the right mouse button to bring up the pop-up
menu. From the pop-up menu, select the Properties menu command to
display the “Properties” dialog box for the Data control.
2. Select the “Connections” tab. Click on the “+” symbol to expand the list of
controls.
3. Select the control and click on its “+” symbol to expand its properties list.
4. As shown in See Figure A-4, select the Value property of the control.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7:[DEMO]EB0
S7vbBttn1
Enabled Browse...
FalseCaption
FalseColor
Font Update rate (ms): 100
ToolTipText
TrueCaption Dead band: 0
TrueColor After you select the property from the
Value
Automati hierarchy, enter the name of the
variable to be assigned to that
Add... Delete Filter... Apply property

OK Cancel Apply Help

Figure A-4 Assigning a Variable in the Control Engine to a Property in a Control

5. Refer to Table A-1 and assign the variables to the SIMATIC controls.
6. Click on the “Apply” button to enter the assigned variables.

SIMATIC Computing
A-6 6GK1971–0BA00–0AA1
SIMATIC Computing

Table A-1 Assigning Sample names to the SIMATIC Controls (for S7–protocol)

Control Name of Description


variables
S7Number1 S7:[DEMO]Demo Alias for MW1
Temperature
S7Number2 S7:[DEMO]Demo Alias for DB10,W0
Power
S7Number3 S7:[DEMO]Demo Alias for DB10,D0
Flow
S7vbBttn1 S7:[DEMO]EB0 Input byte 0
S7vbBttn2 S7:[DEMO]EB1 Input byte 1
S7vbBttn3 S7:[DEMO]EB2 Input byte 2

The variable names correspond to the itemIDs valid for the OPC

Selecting a Control Engine


Use the following procedure to configure the Data control for communicating with
the control engine:
1. Select the “Engine” tab to configure the control engine. See Figure A-5.
2. Select the “Direct Connect” option and enter either @SimaticNet as the control
engine. Click on the “Apply” button to enter the data, and then click on the “OK”
button to close the dialog box.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name Select the option for a direct
connection
Connect via Tag Source

Tag Source

Browse...

Direct Connect
Enter @SimaticNet as the type of
control engine
PC Name

Control Engine @SimaticNet

OK Cancel Apply Help

Figure A-5 Connecting the Data Control to a Control Engine

SIMATIC Computing
6GK1971–0BA00–0AA1 A-7
SIMATIC Computing

Operating of the I/O Panel Program


Before you run the I/O Panel program, make certain that the communcation
system is ready.
1. Select the File Save Project menu command to save the program before
switching Visual Basic from Design mode to Run mode.
2. Click on the “Start” icon or select the Run Start menu command to switch
Visual Basic from Design mode to Run mode to run the I/O panel program.
3. Click on the Button Control for EB0 to set the Input byte.
– The Button control changes color to show the state of EB0
4. Enter a value into the field “Temp”.
5. Monitor the changes of the values with the OPC–Scout.

SIMATIC Computing
A-8 6GK1971–0BA00–0AA1
SIMATIC Computing

A.1.3 Connecting Third-Party Controls to a SIMATIC Data Control

You can use the Data control to connect any ActiveX control (such as VB Label
control) to data in the control engine. To create this sample application, you need
the following items:
S Microsoft Visual Basic 5 or higher
S SIMATIC Data control from Computing

Creating a VB label that Displays a Value in the Control Engine


Use the following procedure to connect a Data control with a Label control:
1. Open a standard Visual Basic project: Use the File ”New Project” menu
command to display the “New Project” dialog box, then select the “Standard
EXE” icon and click on the “Open” button.
2. Add the Siemens SIMATIC Data control to the VB toolbox. For information
about adding controls to the VB toolbox, see Section A.1.1 and Figure A-6.

Components

Controls Designers Insertable Objects


S Click on the SIMATIC Data control.
Siemens S7DiagBF Control
S Click on the “Apply” button to add the
control to the VB toolbox.
Siemens S7Number Control
Siemens S7Panel Control S Click on the “OK” button to close the
Siemens S7vbButton Control “Components” dialog box.
Siemens S7vbSlider Control
Siemens SIMATIC Data Control
Third-Party Control... Browse...
Third-Party Control...
Third-Party Control... Selected Items Only
Siemens SIMATIC Data Control
Location: C:\SIEMENS\Common\OCX\S7WCDATX.OCX

OK Cancel Apply

Figure A-6 Adding the Data Control to the Visual Basic Toolbox

3. Insert a Data control onto the VB form. (For information about inserting controls
onto the VB form, see Section A.1.1.)
4. Insert a VB label on your form. Change the Border Style property to “1–Fixed
Single.”
5. Select the Data control and click the right mouse button to bring up the pop-up
menu. From the pop-up menu, select Properties to display the “Properties”
dialog box for the Data control.
6. From the “Properties” dialog box, select the “Connections” tab. Click on the “+”
symbol to expand the list of controls.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-9
SIMATIC Computing

7. Select the Label1 control and click on its “+” symbol to expand its properties list.
8. Select the Caption property and enter S7:[ DEMO]MB0 in the “Assigned
Variable” field. A-7). Click on the “Apply” and “OK” buttons to enter the data and
close the “Properties” dialog box.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7:[DEMO]MB0
Label1
Alignment Browse...
Appearance
Autosize
BackColor Update rate (ms): 100
BackStyle
BorderStyle Dead band: 0
Caption Select the Caption property
DataField and enter S7:[DEMO]MB0 in
Automati the “Assigned Variable” field.
Add... Delete Filter... Apply

OK Cancel Apply Help

Figure A-7 Assigning a Variable to the Caption Property of a VB Label Control

SIMATIC Computing
A-10 6GK1971–0BA00–0AA1
SIMATIC Computing

Running the Sample Program for the Label Control


Save the program before switching Visual Basic from Design mode to Run mode.
When the sample program runs, the caption of the label displays the value of MB0
in the control engine.
Use the following procedure to configure the Data control for communicating with
the control engine and for running the sample program.
1. Select the “Engine” tab to configure the control engine. See Figure A-8.
2. Select the “Direct Connect” option and enter either @SimaticNet as the control
engine. Click on the “Apply” button to enter the data, and then click on the “OK”
button to close the dialog box.
3. Switch Visual Basic from Design mode to Run mode to run the sample
program.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name Select the option for a direct
connection
Connect via Tag Source

Tag Source

Browse

Direct Connect
Enter @SimaticNet as the type of
control engine
PC Name

Control Engine @SimaticNet

OK Cancel Apply Help

Figure A-8 Connecting to the Control Engine (Label Control Example)

SIMATIC Computing
6GK1971–0BA00–0AA1 A-11
SIMATIC Computing

A.1.4 Using Computing with Microsoft Excel 97

Using the Data control in an Excel spreadsheet allows you to access the values in
the control engine. To create this sample application, you need the following items:
S Microsoft Excel 97

Creating a Command Button in Excel 97


The first step in creating the sample Excel application is to create a command
button. Use the following procedure to create a command button:
1. Start the Excel application. (If prompted about whether to enable or disable
macros, select the “Enable Macros” option.)
2. In the following cells of the spreadsheet, enter the following labels:
– In cell A1, enter: MB0
– In cell A2, enter: MB1
– In cell A3, enter: MB2
3. Select the View ”Toolbars” Control Toolbox menu command to display the
Control toolbox.
4. Click on the “Design Mode” icon in the Control toolbox to put the spreadsheet
into Design mode.
5. Insert a Command Button control onto the spreadsheet by clicking on the
“Command Button” icon in the Control toolbox and then clicking the left mouse
button in an empty area of the spreadsheet.
6. Move or size the Command Button control as required.

Using the Visual Basic Editor to Configure the Command Button


After you have created the command button, you use the Visual Basic Editor in
Excel 97 to configure the command button for starting and stopping the program.
Use the following procedure to configure the command button:
1. Select the command button (CommandButton1).
2. Select the Tools ”Macro” Visual Basic Editor menu command to display the
Visual Basic editor.
3. In the Properties window, select the Caption property of CommandButton 1 and
enter the following caption:
Start
4. Display the Code window by selecting the “View–>Code” menu command.
Select “CommandButton1” from the drop-down list for the Object field. Enter the
following code for the CommandButton1_Click() event:
UserForm1.show
5. Close the Code window for CommandButton1.

SIMATIC Computing
A-12 6GK1971–0BA00–0AA1
SIMATIC Computing

Creating a SIMATIC Data Control


1. Create a new user form by selecting the “Insert–>UserForm
2. In the “Toolbox” window, click the right mouse button to bring up a pop-up menu
and select the ”Additional Controls”menu command. (To display the
“Toolbox” window, select the ”View–>Toolbox” menu command.)
3. Scroll through the list of controls and select the Siemens SIMATIC Data control
(by selecting the check box). Click on the “OK” button to insert the Data control
onto the toolbox.
4. Select the “Data control” icon in the “Toolbox” window and insert a Data control
onto UserForm1.
5. Select the Data control and click the right mouse button to bring up the pop-up
menu. From the pop-up menu, select the Properties menu command to display
the properties for the Data control (S7Data1) in the Properties window.
6. In the Properties window for S7Data1, select the “(Custom)” property field and
then click on the expansion button to display the “Properties” dialog box for the
Data control.

Adding Events for the Data Control


1. In the ”Properties” dialog box for the Data control, select ”Events” tab. In the list
under the ”Keys” heading, select S7Data1.
2. Click on the “Add” button to add a new event key. See Figure A-9. In the “Add”
dialog box, enter MB0 in the “Add a new key” field.
After you click on the “OK” button, the event key is added to the S7Data1
control.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-13
SIMATIC Computing

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name


Select the Data control and click
on the “Add” button to display the
Keys: “Add” dialog box.
Assigned Variable:
Enter MB0 in the “Add new key”
S7Soft1
field and click on the “OK” button.
S7Data1
Add

Add a new key:

MB0

Add...
OK Cancel

OK Cancel Apply Help

Figure A-9 Adding an Event Key to the Data Control

3. In the ”Properties” dialog box, enter the variable name “S7:[DEMO]MB0” in the
“Assigned Variable” field. See Figure A-10.
4. Click on the “Apply” button to accept the assigned variable. Notice that the
event key “MB0” appears in boldface under S7Data1.
5. Enter new event keys for MB1 (Variable S7:[DEMO] MB1) and MB2 (Variable
S7:[DEMO]MB2) by selecting S7Data1 again and repeating steps 2. and 3.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Keys: Assigned Variable:


S7Soft1 S7:[DEMO]MB0

S7Data1 Browse...
MB0
Update rate (ms): 100

Dead band: 0

Select the event key (MB0).


Enter S7:[DEMO]MB0 in the
“Assigned Variable” field and click
Add... Delete
on the “Apply” button.

OK Cancel Apply Help

Figure A-10 Assigning a Variable to an Event Key

SIMATIC Computing
A-14 6GK1971–0BA00–0AA1
SIMATIC Computing

Configuring the Control Engine for the Data Control


1. In the “Properties” dialog box for the Data control, select the “Engine” tab to
configure the control engine.
2. Deactivate the option “Auto Connect” and specify @SimaticNet as the control
engine. To enter the data, click teh “Apply” button; to close the dialog box, click
“OK”.

Entering a Sample Program for the Data Control


1. Select the Data control in UserForm1.
2. Select the View Code command to open the code dialog for the data control.
3. Select S7Data2 from the drop-down list box of the Object box.
4. Enter the following program for the S7Data1_ValueChanged event, enter the
following program:
Select Case Property
Case ”MB0”
Worksheets(”Sheet1”).Range(”B1”).Value = Value
Case ”MB1”
Worksheets(”Sheet1”).Range(”B2”).Value = Value
Case ”MB2”
Worksheets(”Sheet1”).Range(”B3”).Value = Value
End Select
5. Select UserForm from the drop–down list box of the object box.
6. Enter the following programm:
Private Sub UserForm_Activate ()
S7Data1.Connect
End Sub
Private Sub UserForm_Deactivate
S7Data1.Disconnect
End Sub
7. Close the dialog for the data control and UserForm1.

Running the Sample Program


1. Select the File –> Close and Return menu command to the spreadsheet.
2. Exit Design mode by clicking on the “Exit Design Mode” icon in the “Toolbox”
window.
3. Connect the Excel spreadsheet to the control engine by clicking on the “Start”
command button.
4. Use the OPC–Scout to change the memorybyte 0...2 and watch the changes in
Excel.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-15
SIMATIC Computing

Note
To exit Excel or to activate the Excel menus, you must first close UserForm1.

A.2 Product Overview and Installation

A.2.1 Using an ActiveX Control to Access the Process Data

Computing provides access through the SIMATIC Data control to the process data
being controlled by a control engine such as a Simatic Net
Communicationsystem.You can use the standard SIMATIC controls provided with
the Computing software (see Table A-2), or you can connect any other ActiveX
control to the SIMATIC Data control.

Table A-2 Standard Controls Provided by Computing

Control Representation Description


Data Provides the connection to the control engine.
Without the Data control, none of the other
controls have access to the process data.

Button Provides access to individual memory bits in the


control engine. The Button control accesses only
OFF bits and has two values:
S Off = 0 (default color: red)
S On = 1 (default color: green)
Changing the state of the Button control changes
the state of the variable in your process that is
associated with the control.
If you configure the Button control to be read–only,
then it functions like a lamp or LED.
Number Provides access to the variables on the control
0 engine.You can access bytes, words, or
double-words, and you can manipulate individual
bits of this data.
Entering a new value in the Number control
changes the data in the control engine.
Slider Provides access to variables in the control engine.
You can access bytes, words, or double-words.
Adjusting the value of the Slider control changes
the data in the control engine.

SIMATIC Computing
A-16 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3 Accessing the Process Data with the SIMATIC Data Control

Chapter Overview
The SIMATIC Data control provides the connection between your ActiveX controls
and the control engine (for example, the protocol connection with S7).
The Data control has specific properties that you can configure:
S For container applications (such as MicroSoft Visual Basic): access the
properties as for any other control in that container (for example, by using the
right mouse button). Open the context menu for the Data control by clicking the
right mouse button and selecting the Properties menu command.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-17
SIMATIC Computing

A.3.1 Connecting the SIMATIC Controls to the Control Engine

Caution
! Failing to disable the timers in your program could cause timer-generated
connections to remain connected, allowing these connections to continue to write
data to the control engine. This could cause the control engine to operate
erratically, which could potentially cause damage to equipment and injury to
personnel.
To ensure that all connections are disconnected when your program closes,
always disable all timers before the End statement in the Form_Unload subroutine.

In order to access process data, the SIMATIC controls (Button, Number or Slider)
must first establish a connection through the Data control. Figure A-11 shows the
relationship between the Data control and the other SIMATIC controls.
You use the Connections tab of the Data control to assign a variable (the memory
location) to the Value property of each SIMATIC control. The Data control
configures the control engine to check the assigned variables at a specified rate (in
milliseconds). If there is a change in the value, the new value is written to the Data
control. The Data control then writes the new value to the other controls.

Third-party control OPC Client

SIMATIC Button control

SIMATIC Number control


Computing
SIMATIC Slider control

SIMATIC Data control OPC Server

Control Engine (i.e. DP–protocol)

Distributed I/O

Figure A-11 Using the SIMATIC Data Control for Connecting to a Control Engine

SIMATIC Computing
A-18 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3.2 Configuring the Connection Properties for the Data Control

As shown in Figure A-12 the General tab allows you to configure the following
parameters for the connection to the control engine:
S Autoconnect (automatic connection): when this option is enabled, the Data
control automatically connects to the process variables in the control engine.
When this option is disabled, the Data control connects to the variables only
when instructed by the program code (using a Connect method) that you
associated with the control.
S Autoconnect Timeout: time-out (in milliseconds) for the automatic connection:
specifies the amount of time that the Data control waits between connecting to
the control engine and writing data.
Some containers may not provide a mechanism for telling the Data control to
write to the control engine. After the time-out that you specify, the Data control
starts writing data.
S Default Update Rate (ms): specifies the rate that the control engine checks the
process variables to see if change has occurred.
S Default Dead Band: specifies to the control engine the amount of change that
must occur in a value before the control engine writes the new value to the Data
control. For example: if the dead band is 10 and the value in the control engine
is 22, then the control engine does not write a new value until the value
becomes either 33 or 11.
S Show Error Boxes: specifies whether to display the default error boxes when
there is a user-generated error. Computing provides error messages in English
only. If you want to display messages in other languages, you must deselect
this option and write program code to react on the error event.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

AutoConnect:

AutoConnect Timeout (ms): 100

Default Update Rate (ms): 100

Default Dead Band: 0

Show Error Boxes:

OK Cancel Apply Help

Figure A-12 SIMATIC Data Control Properties (General Tab)

SIMATIC Computing
6GK1971–0BA00–0AA1 A-19
SIMATIC Computing

A.3.3 Selecting the Control Engine for the Data Control

Computing allows you to connect either to a single control engine or to several


control engines. You can also connect to the control engine over a network, such
as a local area network (LAN). Use the Engine tab of the Properties dialog box to
select the control engine. See Figure A-13.
In the type of operation with Simatic Net communication systems as described in
this manual a control engine is a software module for binding a communication
protocol.
S If you select the “Direct Connection” option, enter the name of the control
engine. If you are connecting to a control engine over a network, enter the
computer name of the target computer in the “PC Name” field. Enter for
operating with Simatic Net the following strings in the “Control Engine” field:
– @SimaticNet
S If you want to use a symbol file, select the “Connection via Tag Source” option.
In the “Tag Source” field, enter (or browse to) the tag source or file that
identifies symbols for the variables and control engines to be accessed.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Connection via Tag Source

Tag Source

Browse

Direct Connection

PC Name

Control Engine @SimaticNet

OK Cancel Apply Help

Figure A-13 SIMATIC Data Control Properties (Engine Tab)

SIMATIC Computing
A-20 6GK1971–0BA00–0AA1
SIMATIC Computing

As shown in Figure A-14, clicking on the “Browse” button allows you to search for
a valid tag source (*.tsd). The tag source provides the symbolic identification that
allows you to access different control engines from one Data control.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Connection via Tag Source

Tag Source

Browse

Direct Connection

PC Name

Control Engine @SimaticNet

Click on the Browse button to


select a specific tag file for the
SIMATIC controls
OK Cancel

Figure A-14 Selecting a Tag File for the Data Control

After you select the type of connection (single control engine or multiple control
engines), click on the Apply button to enter your selections for the Data control
properties.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-21
SIMATIC Computing

A.3.4 Connecting to a Specific Control Engine over DCOM

As shown in Figure A-15, you can use the SIMATIC Data control to connect your
program to a control engine residing on a different computer.

Note
When you configure the SIMATIC Data control to connect to a single (specific)
control engine, you cannot connect a tag file. This means that you cannot use
symbol names for the variables in the control engine.
To use symbol names, select the option for connecting to multiple control engines
and browse to a tag file that contains symbols for only one control engine.

Third-party control

SIMATIC Button control

SIMATIC Number control

SIMATIC Slider control

DCOM
SIMATIC Data control

PC 1 PC 2

WinLC

Figure A-15 Connecting to a Specific Control Engine over DCOM

Use the following procedure to configure the SIMATIC Data control for
communicating over DCOM with a control engine on a remote computer:
1. Open a container application (such as Visual Basic).
2. Insert a SIMATIC Data Control in a form.

SIMATIC Computing
A-22 6GK1971–0BA00–0AA1
SIMATIC Computing

3. Double–click on the Data control to display the ”Properties” dialog box for the
Data control.
4. Click on the “Engine” tab to display the configuration choices. See Figure A-16.
5. Select the “Direct Connection” option.
6. In the “PC Name” field, enter the network name of server computer (for
example, “PC_2”).
7. In the “Control Engine” field, enter the name of the control engine: @SimaticNet
(using Simatic Net).
8. Click on the “OK” button to configure the Data control for communicating with
the remote control engine.
All of the controls that you insert and connect through this Data control will access
the variables in the remote control engine.

Note
You must have configured the different computers for DCOM.
For additional information about DCOM, refer to the online help for Windows NT.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Select “Direct Connection” and enter the


Connection via Tag Source name of the server computer and the
control engine
Tag Source

Browse

Direct Connection

PC Name PC_2

Control Engine @SimaticNet

OK Cancel Apply Help

Figure A-16 Configuring DCOM for a Specific Control Engine

SIMATIC Computing
6GK1971–0BA00–0AA1 A-23
SIMATIC Computing

A.3.5 Connecting the ActiveX Controls to the Control Engine

As shown in Figure A-17, the Connections tab shows the ActiveX controls
(whether they are SIMATIC controls or third-party) that can be connected to the
control engine.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Soft1
S7Data1 Browse...
S7vbBttn1
S7vbBttn2
Update rate (ms Click on the box with the “plus”
S7WCNumber1 sign (or double-click on the
S7WCNumber2 Dead band: name of the Data control) to
expand the hierarchy of controls
on the form.
Automatic write
Expand the controls to access
Add... Delete Filter... Apply filter the individual properties.

OK Cancel Apply Help

Figure A-17 SIMATIC Data Control Properties (Connections Tab)

Adding a Connection
If you want to configure a connection for an ActiveX control before you place the
control into your ActiveX container, you can use the Add button to add an instance
of the control to the Controls list. As shown in Figure A-18, click on the Add button
to specify the instance that you want to connect to the Data control.
After you have added the ActiveX control instance to the Controls list, you can
select the instance from the list, choose the Add button again and add any
additional properties. For instance, you could add a SIMATIC Number control
instance to the connections list, and then add the Value property to the Number
control in order to assign a variable to the Number control.

SIMATIC Computing
A-24 6GK1971–0BA00–0AA1
SIMATIC Computing

Note
If you have attached a tag file to the Data control or use the process variable from
Simatic Net, you can enter the symbols instead of the absolute addresses. You
can also click on the Browse button to navigate to the symbol.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Data1 S7:[DEMO]Power
S7vbBttn1
Enabled Browse...
FalseCaption
FalseColor
Font Update rate (ms): 100
ToolTipText
TrueCaption Dead band:
TrueColor After you select the property from the
Value hierarchy, enter the name of the
Automati
variable to be assigned to that
Add... Delete Filter... Appl property

OK Cancel Apply Help

Figure A-18 SIMATIC Data Control Properties (Connections Tab)

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Soft1
S7Data1 Browse...
S7vbBttn1
Enabled Update rate (ms): 100
Value
S7vbBttn2 Dead band: 0
S7WCNumber1
Click on the Browse button to
Automatic writ check the process range.
Add... Delete Filter... Apply filter

OK Cancel Apply Help

Figure A-19 SIMATIC Data Control Properties (Connections Tab)

SIMATIC Computing
6GK1971–0BA00–0AA1 A-25
SIMATIC Computing

Deleting a Connection
If you remove a control from the ActiveX container, the connection remains
configured in the Data control. This means that the next time you place a control of
the same name into the container, the connection that you configured for the
previous control of that name is automatically applied to the new control. For
instance, if you remove a control called Number1, and later insert a new Number
control, the default name for the new control is Number1, and the new control
inherits the existing Number1 connection. Use the Delete button if you want to
prevent new controls from inheriting a previously configured connection: from the
Controls list, select the instance whose connection you want to delete, and click on
the Delete button.

Note
If you remove a control, or change your mind about adding a control after you
have already configured a connection for it using the Add button, you can only
delete the connection to it if there is no control in the ActiveX container that uses
the name specified in the connection. Delete the connection before you add any
other control that uses the name that is specified in the connection. You cannot
use the Delete button to remove a connection to a control that is present in the
ActiveX container.

SIMATIC Computing
A-26 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3.6 Filtering the Properties for the ActiveX Controls

The Data control provides a filter that allows you to display a subset of the
properties for the controls. For example, you may want to display only the
“Enabled” and “Value” properties and avoid scrolling through all of the other
properties for each control.
Use the following procedure for filtering the properties:
1. Access the Properties dialog box for the Data control.
2. As shown in Figure A-20, click on the Filter button.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Soft1
Click on the Filter button to select
S7Data1 the properties to be displayed
S7vbBttn1
S7vbBttn2
Update rate (ms): 100
S7WCNumber1
S7WCNumber2 Dead band: 0

Automatic write mode:


Add... Delete Filter... Apply filter to properties

OK Cancel Apply Help

Figure A-20 SIMATIC Data Control Properties (Connections Tab)

3. As shown in Figure A-21, enter the properties to display and click on the Add
button. Use the Edit button to correct entries and the Delete button to remove
entries.
4. As shown in Figure A-22, select the “Apply filter to properties” check box to
display only the properties listed in the filter.
Use the “Apply filter to properties” check box to toggle the filter on and off.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-27
SIMATIC Computing

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name


Property Filter
Controls:
S7Soft1 Visible Properties:
Click on the Add button to enter a
Enabled
S7Data1 property to the filter
Value
SIM
SIM
100
SIM
SIM 0
Add... Edit Delete

OK Cancel mode:
Add... properties

OK Cancel Apply Help

Figure A-21 SIMATIC Data Control Properties (Connections Tab)

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Soft1
S7Data1 Browse...
S7vbBttn1
Enabled Click on the check box to toggle
Update rate (m
Value the property filter on and off
S7vbButton2
Dead band:
S7WCNumber1
S7WCNumber1
Automatic write mode:
Add... Delete Filter... Apply filter to properties

OK Cancel Apply Help

Figure A-22 SIMATIC Data Control Properties (Connections Tab)

SIMATIC Computing
A-28 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3.7 Configuring Custom Events

As shown in Figure A-23, the Events tab allows you to add custom events that are
triggered by the Data control. You enter a key (string) and assign that key to a
process variable. If that variable changes, then the Data control generates an
event with a parameter that contains the string that you entered in the “Key” field.
Your program can then react to this event.
See Section ”Sample Program for Responding to Events” for a sample program
that responds to events.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Keys: Assigned Variable:


S7Soft1 DP:[Demo]DemoPower

S7Data1 Browse...
OverflowWarning
Update rate (ms): 100

Dead band: 0

Add... Delete

OK Cancel Apply Help

Figure A-23 SIMATIC Data Control Properties (Events Tab)

Adding an Event
The Add button allows you to add user-specified events for controller value
changes. You can write your own code to handle the event by handling the
ValueChanged event of a Data control. Select a Data control from the expandable
list under the “Keys” field and click on the Add button; then type any name you
choose for the event (for example, OverflowWarning). Next, type a variable in the
“Assigned Variable” field to identify the process value that causes the event to be
fired.
Figure A-23 shows an sample event that has been added. A change in the value of
the variable DP:[Demo]DemoPower calls the event handler for the Data control.
The input to the event handler is the text string “OverflowWarning”.

Deleting an Event
To delete a user-specified event, expand the list under “Keys,” select the desired
event, and click on the Delete button.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-29
SIMATIC Computing

A.3.8 Creating a Connection Table

The Data control uses a connection table for determining which property of the
various controls are connected to specific process variables of the control engine.
Each connection table contains an entry for each connection. Each entry contains
the following information:
S Property name: this field identifies the property that has an assigned variable.
S Data source: this field identifies the name of the process variable.
S Update rate: this field defines the update rate for the connection. If no value is
entered in this field, the Data control uses the default update rate (which is the
value stored in the DefaultUpdateRate property).
S Default Dead Band: this field defines the dead band for automatically writing to
the control engine or the control. If no value is entered in this field, the Data
control uses the default update rate (which is the value stored in the
DefaultDeadBand property).
When you use the “Properties” dialog box to configure the Data control, the Data
control automatically creates a connection table. You can also create a program to
manually create connection tables. See Section A.3.9 for a sample program for
manually creating a connection table.

SIMATIC Computing
A-30 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3.9 Sample Program for Creating a Connection Table and an Event


Table

You can write a program to create a table to define the connections (assigned
variables) or events for the control engine.

Using a Connection Table


You can create a connection table to assign a variable in the control engine to a
specific control. The connection table corresponds to the “Connections” tab on the
“Properties” dialog box of the Data control.
For each element in the connection table, you must define the property in the
control for the connection, the source (process variable of the assigned variable in
the control engine), the update rate, and the dead band value. In order to
programmatically change connections with a connection table, you must first
disconnect the data control (ending all connections) before you can reassign
connections and reconnect the Data control.

Note
Instead of creating a connection table, consider using the read and write methods
for the Data control (ReadVariable, ReadMultipleVariables, WriteVariable, and
WriteMultipleVariables). These methods allow you to access more data with just
one line of code.

Table A-3 shows, how to assign the property caption of a label control with the
name lblChange to the process variable S7:[DEMO]MW2 using program code.The
value stored in MW2 displays as the caption in the label control.

Table A-3 Sample Program for Manually Creating a Connection Table

Visual Basic Code


Dim ControlTable (4) As String
’Define a connection table for lblChange
ControlTable (0) = ”Caption” ’Property<HR+>
ControlTable (1) = ”S7:[Demo]MW2” ’Source (memory location)
ControlTable (2) = ”100” ’Update rate
ControlTable (3) = ”0.0” ’Dead band
’Attach the connection table to S7Data1’
S7Data1.ConnectObject lblChange, ControlTable
’Connect to the control engine
S7Data1.Connect ’Connects to the control engine

SIMATIC Computing
6GK1971–0BA00–0AA1 A-31
SIMATIC Computing

Using an Event Table


You can also create an event table to define events for the control engine. The
event table corresponds to the “Events” tab on the “Properties” dialog box of the
Data control. Table A-4 provides the sample Visual Basic code for creating an
event table.
Section A.3.10 provides a sample program that responds to events. This sample
program uses an event table to define the events for control engine.

Table A-4 Sample Program for Manually Creating an Event Table

Visual Basic Code


Dim ControlTable(4) As String
’define the event keys
ControlTable(0) = ”m0_0” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.0” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_1” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.1” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_2” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.2” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_3” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.3” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_4” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.4” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_5” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.5” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_6” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.6” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_7” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.7” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
End

SIMATIC Computing
A-32 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3.10 Sample Program for Responding to Events

You can create a program that responds to events in the control engine. In this
sample program, eight lights correspond to the eight events which are defined in a
connection table. See Figure A-24. The events are connected to the status of
memory location MB0: a change in the value stored in MB0 generates a set of
events (named for each bit in the byte).
As shown in Figure A-24, the program also contains the following elements:
S Data control (S7Data4) for connecting to the control engine
S Timer (Timer1) that increments the value stored in MB0 (which then causes the
control engine to generate the events)
S Command button (cmdStartEvent) for starting or stopping the timer (thereby
starting or stopping the generation of events)

WinAC VB5 Programming Example


Light(0) to Light(7): These VB
shapes change color to display
the events stored in MB0

cmdStartEvent: This command


button starts (or stops) the
Start Events events

S7Data4 Connects these


elements to the control engine

Timer1: generates a
ReadVariable and WriteVariable
at fixed intervals

Figure A-24 Sample Program for Responding to Events in the Control Engine

Caution
! Failing to disable the timers in your program could cause timer-generated
connections to remain connected, allowing these connections to continue to write
data to the control engine. This could cause the control engine to operate
erratically, which could potentially cause damage to equipment and injury to
personnel.
To ensure that all connections are disconnected when your program closes,
always disable all timers before the End statement in the Form_Unload subroutine.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-33
SIMATIC Computing

Creating an Event Table for the Sample Program


Your program can create an event table to define specific events in the control
engine.Table A-5 lists the code for creating a connection table for defining event
keys for a control engine.

Table A-5 Sample Program for Creating a Connection Table for Responding to Events

Visual Basic Code


Dim ControlTable(4) As String
’define the event keys
ControlTable(0) = ”m0_0” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.0” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_1” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.1” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_2” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.2” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_3” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.3” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_4” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.4” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_5” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.5” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_6” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.6” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_7” ’ Event name
ControlTable(1) = ”S7:[DEMO]m0.7” ’ process variable
ControlTable(2) = ”500” ’ update rate
ControlTable(3) = ”0” ’ dead band
lResult = S7Data1.ConnectName(””, ControlTable)
End

SIMATIC Computing
A-34 6GK1971–0BA00–0AA1
SIMATIC Computing

Responding to the Events Generated by the Sample Program


The program listing in table A-6 shows how to respond to different events from the
control engine.

Table A-6 Sample Programm for Responding to Events in the Control Engine

Visual Basic Code


Private Sub S7Data4_ValueChanged(ByVal Property As String, ByVal VarName As String,
ByVal Value As Variant, ByVal Quality As Integer)

’Evaluates which event occurred


Select Case Property
Case ”M0_0” ’Event M0_0 turns Light(0) green
If Value = True Then
Light(0).FillColor = vbGreen
Else
Light(0).FillColor = vbRed
End If
Case ”M0_1” ’Event M0_1 turns Light(1) green
If Value = True Then
Light(1).FillColor = vbGreen
Else
Light(1).FillColor = vbRed
End If
Case ”M0_2” ’Event M0_2 turns Light(2) green
If Value = True Then
Light(2).FillColor = vbGreen
Else
Light(2).FillColor = vbRed
End If
Case ”M0_3” ’Event M0_3 turns Light(3) green
If Value = True Then
Light(3).FillColor = vbGreen
Else
Light(3).FillColor = vbRed
End If
Case ”M0_4” ’Event M0_4 turns Light(4) green
If Value = True Then
Light(4).FillColor = vbGreen
Else
Light(4).FillColor = vbRed
End If
Case ”M0_5” ’Event M0_5 turns Light(5) green
If Value = True Then
Light(5).FillColor = vbGreen
Else
Light(5).FillColor = vbRed
End If
Case ”M0_6” ’Event M0_6 turns Light(6) green
If Value = True Then
Light(6).FillColor = vbGreen
Else
Light(6).FillColor = vbRed
End If

SIMATIC Computing
6GK1971–0BA00–0AA1 A-35
SIMATIC Computing

Table A-6 Sample Programm for Responding to Events in the Control Engine, continued

Case ”M0_7” ’Event M0_7 turns Light(7) green


If Value = True Then
Light(7).FillColor = vbGreen
Else
Light(7).FillColor = vbRed
End If
End Select
End Sub

Running the Sample Program (Generating the Events in the Control Engine)
The code listed in Table A-7 changes the value stored in MB0. These changes
then causes the control engine to generate the events defined in the connection
table (Table A-5).
S The command button (cmdStartEvents) starts or stops the timer (Timer1).
S The timer (Timer1) reads the value stored in MB0 of the control engine,
increments the value, and writes the new value back to the control engine.
The changed value of MB0 causes the control engine to generate the events.

Warning
! Failing to disable the timers in your program could cause timer-generated
connections to remain connected, allowing these connections to continue to write
data to the control engine. This could cause the control engine to operate
erratically, which could potentially cause damage to equipment and injury to
personnel.
To ensure that all connections are disconnected when your program closes,
always disable all timers before the End statement in the Form_Unload subroutine.

SIMATIC Computing
A-36 6GK1971–0BA00–0AA1
SIMATIC Computing

Table A-7 Other Subroutines for Running the Sample Program

Visual Basic Code


Private Sub cmdStartEvents_Click()
If cmdStartEvents.Caption = ”Start Events” Then
Timer1.Enabled = True
cmdStartEvents.Caption = ”Stop Events”
Else
Timer1.Enabled = False
cmdStartEvents.Caption = ”Start Events”
End If
End Sub
Private Sub Timer1_Timer()
Dim mb0 As Variant
Dim my_state As Long
S7Data4.ReadVariable ”S7:[Demo]MB0.0”, mb0, my_state, 0
If mb0 < 254 Then
mb0 = mb0 + 1
Else
mb0 = 0
End If
Label2.Caption = mb0
S7Data4.WriteVariable ”S7:[Demo]MB0.0”, mb0, 0
End Sub

A.3.11 Sample Programs for Reading and Writing Data

You can write a program that initiates access to data (reading or writing) in the
control engine.

Reading a Single Variable in the Control Engine


The program listing in Table A-8 uses the ReadVariable method of the Data control
to read a single variable in the control engine.

Table A-8 Reading a Single Variable from the Control Engine

Visual Basic Code


Private Sub ReadSingleRealVariable
Dim rc As Long
Dim name_s As String
Dim value_v As Variant
Dim state_l As Long
Dim timeout_l As Long

SIMATIC Computing
6GK1971–0BA00–0AA1 A-37
SIMATIC Computing

Table A-8 Reading a Single Variable from the Control Engine, continued

’Read one value


name_s = ”S7:[Demo]MD0”
timeout_l = 0

rc = S7Data3.ReadVariable(name_s, value_v, state_l, timeout_l)

’Display the value and return code in a List Box


ListBox1.Clear
ListBox1.AddItem ”RetCode = ” & Hex(rc)
ListBox1.AddItem ” – ” & name_s & ” = ” & value_v
ListBox1.AddItem ” – State = ” & Hex(state_l)
End Sub

SIMATIC Computing
A-38 6GK1971–0BA00–0AA1
SIMATIC Computing

Writing a Single Variable to the Control Engine


The program listing in Table A-9 uses the WriteVariable method of the Data control
to write a single variable to the control engine.

Table A-9 Writing a Single Variable to the Control Engine

Visual Basic Code


Private Sub WriteSingleRealVariable
Dim rc As Long
Dim name_s As String
Dim value_v As Variant
Dim timeout_l As Long
’Write one value
name_s = ”S7:[Demo]MD0”
value_v = (Rnd * 1000)
timeout_l = 100

rc = S7Data3.WriteVariable(name_s, value_v, timeout_l)

’Display the value and return code in a List Box


ListBox1.Clear
ListBox1.AddItem ”Wrote ” & name_s & ” = ” & value_v
ListBox1.AddItem ”Return Code = ” & Hex(rc)
End Sub

Reading an Array in the Control Engine


The program listing in Table A-10 uses the ReadVariable method of the Data
control to read an array of data in the control engine.

Table A-10 Sample Program for Reading an Array of Variables

Visual Basic Code


Private Sub ReadArrayOfReals
Dim rc As Long
Dim name_s As String
Dim value_v As Variant
Dim state_1 As Long
Dim timeout_l As Long
Randomize
’Read an array oof values
name_s = ”S7:[Demo]MD0,3”
timeout_l = 0

rc = S7Data3.ReadVariable(name_s, value_v, state_1, timeout_l)

’Display the values and return codes for the array in a List Box
ListBox1.Clear
ListBox1.AddItem ”Return Code = ” & Hex(rc)
ListBox1.AddItem ” – name_s & “ = ” & value_v(0) & “ “ & value_v(1) & “ “ –
value_v(2)
ListBox1.AddItem ” – State = ” & Hex(state_1)
End Sub

SIMATIC Computing
6GK1971–0BA00–0AA1 A-39
SIMATIC Computing

Writing an Array to the Control Engine


The program listing in Table A-10 uses the WriteVariable method of the Data
control to write an array of data to the control engine.

Table A-11 Sample Program for Writing an Array of Variables

Visual Basic Code


Private Sub WriteArrayOfReals
Dim rc As Long
Dim name_s As String
Dim timeout_l As Long
Dim value_b(2) As Byte ’ for byte write
Dim value_w(2) As Integer ’ for word write
Dim value_r(2) As Single ’ for real write
’Read an array of values
name_s = ”S7:[Demo]DB10,REAL0,3”
value_r(0) = (Rnd * 1000)
value_r(1) = (Rnd * 1000)
value_r(2) = (Rnd * 1000)
timeout_l = 100

rc = S7Data3.WriteVariable(name_s, value_r, timeout_l)

’Display the values and return codes for the array in a List Box
ListBox1.Clear
ListBox1.AddItem ”Return Code = ” & Hex(rc)
ListBox1.AddItem ” – Wrote MD0:REAL[0] = ” & value_r(0)
ListBox1.AddItem ” – Wrote MD0:REAL[1] = ” & value_r(1)
ListBox1.AddItem ” – Wrote MD0:REAL[2] = ” & value_r(2)
End Sub

SIMATIC Computing
A-40 6GK1971–0BA00–0AA1
SIMATIC Computing

A.3.12 Sample Program for Reading and Writing Boolean Data

For reading and writing Boolean data, you must use the ReadMultiVariables
method or WriteMultiVariables method. Table A-12 provides a sample program for
reading and writing arrays of Boolean data.

Table A-12 Reading and Writing Multiple Variables

Visual Basic Code


Private Sub Read_Booleans()
Dim mybools(7) As String
Dim vals_v As Variant
Dim states_v As Variant
Dim rc As Long

mybools(0) = “S7:[Demo]M0.0”
mybools(1) = “S7:[Demo]M0.1”
mybools(2) = “S7:[Demo]M0.2”
mybools(3) = “S7:[Demo]M0.3”
mybools(4) = “S7:[Demo]M0.4”
mybools(5) = “S7:[Demo]M0.5”
mybools(6) = “S7:[Demo]M0.6”
mybools(7) = “S7:[Demo]M0.7”

rc = S7Data1.ReadMultiVariables(mybools, vals_v, states_v)


End Sub
Private Sub Write_Booleans()
Dim mybools(7) As String
Dim myvals(7) As Variant
Dim states_v As Variant
Dim rc As Long
mybools(0) = “S7:[Demo]M0.0”
mybools(1) = “S7:[Demo]M0.1”
mybools(2) = “S7:[Demo]M0.2”
mybools(3) = “S7:[Demo]M0.3”
mybools(4) = “S7:[Demo]M0.4”
mybools(5) = “S7:[Demo]M0.5”
mybools(6) = “S7:[Demo]M0.6”
mybools(7) = “S7:[Demo]M0.7”

myvals(0) = False
myvals(1) = False
myvals(2) = False
myvals(3) = False
myvals(4) = False
myvals(5) = False
myvals(6) = False
myvals(7) = False

rc = S7Data1.WriteMultiVariables(mybools, myvals, states_v)


End Sub

SIMATIC Computing
6GK1971–0BA00–0AA1 A-41
SIMATIC Computing

A.3.13 Properties, Methods, and Events of the Data Control

You use the properties and methods listed in Table A-13 to manipulate the Data
control.

Table A-13 Properties and Methods of the SIMATIC Data Control

Property or Method Description


Activated Specifies whether or not all connections are activated
AutoConnect property Specifies whether or not the configured connections are
established at runtime
AutoConnectTimeout Specifies a timeout value
property
Connect method Establishes all configured connections
ConnectName method Establishes connections for the object that is specified by name
ConnectObject method Establishes connections for a specified object
ControlEngine property Specifies the control engine for the connection
DefaultDeadband Specifies the dead band used by the Data control, if no dead
property band is specified in the connection table
DefaultUpdateRate Specifies the update rate used by the SIMATIC DataControl, if
property no update rate is specified in the connection table
Disconnect method Releases all established connections
MultipleEngines property Specifies whether the connection is to one specific control or to
several control engines
PCName property Specifies the network identification for a remote computer (for
connecting over a network)
PropertyChangedName Notifies the Data control that the value of a property of a
method connected control, referenced by Name, has changed
PropertyChangedObject Notifies the Data control that the value of a property of a
method connected control, referenced by Object, has changed
ReadMultiVariables Reads the status of several variables in the control engine
method
ReadVariable method Reads the status of several variables in the control engine
ShowErrorBoxes Specifies whether to display the default error boxes when there
property is a user-generated error
TagSource property Specifies the source (such as a tag file) of symbolic information
WriteMultiVariables Writes new values to several variables in the control engine
method
WriteVariable method Writes a new value to a specific variable in the control engine

The control responds to the events listed in Table A-14.

SIMATIC Computing
A-42 6GK1971–0BA00–0AA1
SIMATIC Computing

Table A-14 Events of the SIMATIC Data Control

Event Description
ConnectionError Occurs when an error on a connection occurs
ValueChanged Occurs when the value of a connected variable changes and no
connected event was specified on the call to the Connect method

When an error occurs in the Data control, the control generates a ConnectionError
event. Your program can capture this ConnectionError event and respond to
specific situations. The ConnectionError event can detect standard OLE errors,
such as E_FAIL or E_OUTOFMEM. Table A-15 lists some of the error codes.

Table A-15 SIMATIC Data Control Error Codes

Error Code Description


0x80004005 General OLE failure
0x8007000E Out of available memory
0x80070057 Invalid variable syntax
0xC0040007 Invalid variable type
0xC004000B Value passed to write is out of range

SIMATIC Computing
6GK1971–0BA00–0AA1 A-43
SIMATIC Computing

A.4 Properties and Methods of the SIMATIC Controls

A.4.1 Activated Property

Applies to: SIMATIC Data


This property allows you to specify whether or not all connections are activated.
Syntax:
object.Activated [= value]
The Activated property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object can
respond to user-generated events.

The settings for value are:

Setting Description
True (default) All connections are activated.
False All connections are deactivated.

Note
The connections remain established, even if they are deactivated.

A.4.2 Alignment Property

Applies to: SIMATIC Number


This property specifies the alignment of the number in the control.
Syntax:
object.Alignment [= value]
The Alignment property has these parts:

SIMATIC Computing
A-44 6GK1971–0BA00–0AA1
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the alignment.

The settings for value are:

Setting Description
0 or Left (default) The number is aligned to the left side of the field.
1 or Right The number is aligned to the right side of the field.
2 or Center The number is centered in the field.

A.4.3 Appearance Property

Applies to: SIMATIC Number


If this property is set to 3D (1), the Appearance property draws controls with
three-dimensional effects if the BorderStyle property is set to “Fixed Single” (1). If
the property is set to Flat (0), a flat border will surround the controls rectangle.

Note
This property only has an effect if the BorderStyle property is set to
“Fixed Single” (1).

Syntax:
object.Appearance [= value]
The Appearance property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the appearance of
object.

The settings for value are:

Setting Description
0 or Flat Paints the controls and forms without visual effects.
1 or ThreeD (default) Paints the controls with three-dimensional (3-D)
effects.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-45
SIMATIC Computing

A.4.4 AutoConnect Property

Applies to: SIMATIC Data


This property allows you to specify whether or not the configured connections are
established at runtime.
Syntax:
object.AutoConnect [= value]
The AutoConnect property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object can
respond to user-generated events.

The settings for value are:

Setting Description
True (default) All configured connections will be established at
runtime.
False The connections will be established with a call to the
Connect method.

A.4.5 AutoConnectTimeout Property

Applies to: SIMATIC Data


This property allows you to specify a timeout. After the time specified, the SIMATIC
Data Control issues a call to its Connect method if the AutoConnect property is set
to True. The value can also be specified at the General Property Tab.
Syntax:
object.AutoConnectTimeout [= value]
The AutoConnectTimeout property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value of the type Long, which states the timeout in
milliseconds.

SIMATIC Computing
A-46 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.6 BackColor Property

Applies to: SIMATIC Number


This property returns or sets the background color of an object.
Syntax:
object.BackColor [= value]
The BackColor property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the background color
of an object.

The settings for value are:

Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows System Colors specified by system color constants (depending on
Colors the container); for example, colors listed in the Visual
Basic (VB) object library in the Object Browser

A.4.7 BorderStyle Property

Applies to: SIMATIC Number


If the property has the value “Fixed Single” (1), the control is surrounded by a
rectangular border. If the property has the value None (0), no border will be
displayed.

Note
This property determines whether the Appearance property has any effect.

Syntax:
object.BorderStyle [= value]
The BorderStyle property has these parts:

SIMATIC Computing
6GK1971–0BA00–0AA1 A-47
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the border style.

The settings for value are:

Setting Description
0 or None (default) No border or border-related elements
1 or FixedSingle A fixed, single-line border

A.4.8 Caption1 and Caption2 Properties

Applies to: SIMATIC Number


These properties specify the displayed text of the first (Caption1) and second
(Caption2) labels.
Syntax:
object.Caption1 [= value]
object.Caption2 [= value]
The Caption1 and Caption2 properties have these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String value that specifies the text of the label.

A.4.9 Caption1Alignment and Caption2Alignment Properties

Applies to: SIMATIC Number


These properties specify the alignment of the first (Caption1Alignment) or second
(Caption2Alignment) labels.
Syntax:
object.Caption1Alignment [= value]
object.Caption2Alignment [= value]
The Caption1Alignment and Caption2Alignment properties have these parts:

SIMATIC Computing
A-48 6GK1971–0BA00–0AA1
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the alignment of the
label.

The settings for value are:

Setting Description
0 or Left (Default for the first label) The label is aligned to the left
side of the field.
1 or Right (Default for the second label) The label is aligned to the
right side of the field.
2 or Center The label is centered in the field.

A.4.10 Caption1BackColor, Caption2BackColor Properties

Applies to: SIMATIC Number


These properties return or set the background colors of the labels. The first label is
determined by the Caption1BackColor property, and the second label is
determined by the Caption2BackColor property.
Syntax:
object.Caption1BackColor [= value]
object.Caption2BackColor [= value]
The Caption1BackColor and Caption2BackColor properties have these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the background color
of object.

The settings for value are:

Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows System Colors specified by system color constants (depending on
Colors the container); for example, colors listed in the Visual
Basic (VB) object library in the Object Browser

SIMATIC Computing
6GK1971–0BA00–0AA1 A-49
SIMATIC Computing

A.4.11 Caption1Font and Caption2Font Properties

Applies to: SIMATIC Number


This property returns a Font object for the font of the first (Caption1Font) or second
(Caption2Font) label.
Syntax:
object.Caption1Font
object.Caption2Font
The Caption1Font and Caption2Font properties have these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.

A.4.12 Caption1ForeColor, and Caption2ForeColor Properties

Applies to: SIMATIC Number


These properties return or set the foreground colors of the labels. The first label is
determined by the Caption1ForeColor property, and the second label is determined
by the Caption2ForeColor property.
Syntax:
object.Caption1ForeColor [= value]
object.Caption2ForeColor [= value]
The Caption1ForeColor and Caption2ForeColor properties have these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the background or
foreground colors of object.

The settings for value are:

Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows System Colors specified by system color constants (depending on
Colors the container); for example, colors listed in the Visual
Basic (VB) object library in the Object Browser

SIMATIC Computing
A-50 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.13 Caption1Size and Caption2Size Properties

Applies to: SIMATIC Number


If the layout type is horizontal, than you can specify a width (in twips) of the first
(Caption1Size) and second (Caption2Size) labels. If the layout type is vertical, than
it specifies the height (in twips) of the labels. If you do not specify a size (if you
accept the default value of -1), then the size will be calculated by the space
required for the text.
Syntax:
object.Caption1Size [= value]
object.Caption2Size [= value]
The Caption1Size and Caption2Size properties have these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that allows the user is to determine a
specific size for a label. The default value (-1) specifies
that the size be determined by the length of the text for the
label.

A.4.14 Connect Method

Applies to: SIMATIC Data


This method establishes all configured connections.
Syntax:
result = object.Connect
The Connect method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
result A long value that indicates whether an error has occurred.
The result is zero if no error occurs.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-51
SIMATIC Computing

A.4.15 ConnectName Method

Applies to: SIMATIC Data


This method establishes connections for the object that is specified by the name of
the object on the form (such as S7Number1).

Note
A programmer who uses Visual Basic (or a similar programming language) would
use the ConnectName method, while a programmer who uses Visual C (or a
similar programming language) would use the ConnectObject method.

Syntax:
result = object.ConnectName ConnectedObject, ConnectionTable
The ConnectName method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
result A long value that indicates whether an error has occurred.
The result is zero if no error occurs.
ConnectedObject A String expression that evaluates to the name of an
object that should be connected. If this parameter is set to
an empty String, the control generates the ValueChanged
event if a connected variable changes.
ConnectionTable (optional) Specifies a connection table. If this parameter is
omitted, the control reads the ConnectionTable property of
the ConnectedObject.
The connection table is declared as an array. Each
element in the array has the following parts:
S Name of the element (such as “Value”)
S Memory location (such as MW100)
S Update rate or time-out value (in ms)
S Deadband value
For more information about the connection table, see
Section A.3.8.

Note
If the ConnectedObject and ConnectionTable parameters are both omitted, an
error is reported.

SIMATIC Computing
A-52 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.16 ConnectObject Method

Applies to: SIMATIC Data


This method establishes connections for a specified object which was declared in
the program.

Note
A programmer who uses Visual Basic (or a similar programming language) would
use the ConnectName method, while a programmer who uses Visual C (or a
similar programming language) would use the ConnectObject method.

Syntax:
result = object.ConnectObject ConnectedObject, ConnectionTable
The ConnectObject method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
result A long value that indicates whether an error has occurred.
The result is zero if no error occurs.
ConnectedObject A String expression that evaluates to the name of an
object that should be connected. If this parameter is set to
an empty String, the control generates the ValueChanged
event if a connected variable changes.
ConnectionTable (optional) Specifies a connection table. If this parameter is
omitted, the control reads the ConnectionTable property of
the ConnectedObject.
The connection table is declared as an array. Each
element in the array has the following parts:
S Name of the element (such as “Value”)
S Memory location (such as MW100)
S Update rate or time-out value
S Deadband value

Note
If the ConnectedObject and ConnectionTable parameters are both omitted, an
error is reported.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-53
SIMATIC Computing

A.4.17 ControlEngine Property

Applies to: SIMATIC Data, SIMATIC Panel, S7DiagBF


This property stores the pathname or identification of the control engine connected
to the control.
Syntax:
object.ControlEngine [= value]
The ControlEngine property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String that specifies the pathname or identification of the
control engine to be accessed by object.

SIMATIC Computing
A-54 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.18 ConvertedValue Property

Applies to: SIMATIC Number


This read-only property holds the value from the control engine (after data typing
and range transformation have been performed). Use the following descriptions to
understand the differences between the Value, ConvertedValue and Text
properties:
S The Value property is a Variant. It must be connected, by way of the SIMATIC
Data Control, to a value in the control engine. It can hold values of different
data types.
S The ConvertedValue property is also a Variant and contains the value from the
Value property, but it is already scaled and converted to the specified data type
(DataType property).
S The Text property contains a String with the displayed String, which means,
inclusively, radix conversion (Radix property), zero padding (ZeroPad property),
and precision (Precision property) usage.
If the Enabled property is False, the bi-directional connection between Value and
ConvertedValue is broken and changes to the Text or ConvertedValue property will
not be written to the Value property.
Syntax:
object.ConvertedValue [= value]
The ConvertedValue property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Variant that specifies the value of the control.

A.4.19 DataType Property

Applies to: SIMATIC Number


This property defines the storage type used for converted values. If you are using
a data type for displaying a value which is too large, the value will be truncated.
The data type specified in the SIMATIC Number Control must match any data type
specified in the “Assigned Variable” field of the SIMATIC Data Control.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-55
SIMATIC Computing

Note
This property determines whether the Precision property has any effect.

Syntax:
object.DataType [= value]
The DataType property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the data type.
Table A-16 lists the data types and settings for value.

Table A-16 Settings for the Data Types

Data Type Setting 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-byte integer value
Double Word 4 4 bytes Unsigned four-byte value (default)
Double 5 4 bytes Signed four-byte integer value
Integer
Real 6 4 bytes Signed four-byte real (floating-point) value
Timer 7 2 bytes Unsigned two-byte value
Counter 8 2 bytes Unsigned two-byte value

Note
If the data size configured to be accessed in the control engine is larger than the
data being displayed in the SIMATIC control and the value of the data from the
control engine is larger than can be displayed by the data type, the value is
displayed with ‘‘...’’ preceding it. For example, you can assign a double-word
variable, such as MD100, in the SIMATIC Data Control and select the data type
“Byte” in the SIMATIC Number Control. If the value in the control engine exceeds
255 (the maximum value for a byte), “...” precedes the value. Before the value can
be changed from the SIMATIC Number Control, the ‘‘...’’ preceding the value must
be deleted.

SIMATIC Computing
A-56 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.20 DefaultDeadband Property

Applies to: SIMATIC Data


This property allows you to specify the dead band used by the SIMATIC Data
Control, if no dead band is specified in the connection table.

Note
If you specify a dead band (such as “10”) for a bit variable (such as M15.5), the
control engine will not transmit a changed value for that bit.

Syntax:
object.DefaultDeadBand [= value]
The DefaultDeadband property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value of the type Single, which must not be negative.

A.4.21 DefaultUpdateRate Property

Applies to: SIMATIC Data


This property allows you to specify the update rate used by the SIMATIC Data
control, if no update rate is specified in the connection table.

Note
For WinLC, the minimum default update rate is 0. For CPU 416-2 DP ISA, the
minimum default update rate is 100 ms.

Syntax:
object.DefaultUpdateRate [= value]
The DefaultUpdateRate property has these parts:

SIMATIC Computing
6GK1971–0BA00–0AA1 A-57
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value of type Long.

The settings for value are:

Part Description
0 All changes of the connected variable are reported
immediately.
>0 Changes of the connected variable are reported after this
timeout.

A.4.22 Direction Property

Applies to: SIMATIC Slider


The Direction property sets the orientation (horizontal or vertical) of the SIMATIC
control.
Syntax:
object.Direction [= value]
The Direction property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the orientation.

The settings for value are:

Setting Description
0 Horizontal
1 Vertical

SIMATIC Computing
A-58 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.23 Disconnect Method

Applies to: SIMATIC Data


This method releases all established connections.
Syntax:
result = object.Disconnect
The Disconnect method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
result A long value that indicates whether an error has occurred.
The result is zero if no error occurs.

A.4.24 Enabled Property

Applies to: SIMATIC Button, SIMATIC Number, SIMATIC Slider


When this property is True, the control reacts on changes of the Value property
and fires events. If this property is False, then the control is disabled and does not
react on changes in the Value property and does not fire any event (except the
error event).
Syntax:
object.Enabled [= value]
The Enabled property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object can
respond to user-generated events.

The settings for value are:

Setting Description
True (default) Allows the object to respond to events
False Prevents object from responding to events

SIMATIC Computing
6GK1971–0BA00–0AA1 A-59
SIMATIC Computing

A.4.25 Factor Property

Applies to: SIMATIC Number


The Factor and Offset properties specify the scaling factor and the offset used
when the scale-by-formula option has been enabled.

Note
The ScaleMode property must be set to “ByFormula” (1) for the Factor and Offset
properties to have any effect.

You can use a formula to scale the value. In the following formula, “PLC Value” is
similar to the contents of the Value property if the control is connected to the
control engine; “Scale” is the value of the Factor property; “Offset” is the value of
the Offset property; and “Displayed value” is also the contents of the Text property.
PLC Value * Factor + Offset = Displayed value
Syntax:
object.Factor [= value]
The Factor property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A floating-point value that defines the factor for the scaling
formula.

Note
The default value of the factor is 1.0, and the default value of the offset is 0.0.

SIMATIC Computing
A-60 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.26 FalseCaption Property

Applies to: SIMATIC Button


This property determines the text that is displayed in the control when the Value
property is False (equal to 0, or “Off”).
Syntax:
object.FalseCaption [= value]
The FalseCaption property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String value that specifies the text of the label.

A.4.27 FalseColor Property

Applies to: SIMATIC Button


This property determines the color of the control when the Value property is False
(equal to 0, or “Off”).
Syntax:
object.FalseColor [= value]
The FalseColor property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the background or
foreground colors of an object.

The settings for value are:

Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows System Colors specified by system color constants (depending on
Colors the container); for example, colors listed in the Visual
Basic (VB) object library in the Object Browser

SIMATIC Computing
6GK1971–0BA00–0AA1 A-61
SIMATIC Computing

A.4.28 Font Property

Applies to: SIMATIC Button, SIMATIC Number


This property returns a Font object for the main font of the control.
Syntax:
object.Font
The Font property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.

A.4.29 ForeColor Property

Applies to: SIMATIC Number


The ForeColor property returns or sets the foreground color used to display text
and graphics in an object.
Syntax:
object.ForeColor [= value]
The ForeColor property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the foreground colors
of object.

The settings for value are:

Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows System Colors specified by system color constants (depending on
Colors the container); for example, colors listed in the Visual
Basic (VB) object library in the Object Browser

SIMATIC Computing
A-62 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.30 LargeChange Property

Applies to: SIMATIC Slider


The LargeChange property determines how far the slider indicator moves when the
control has focus and you press the Page Up or Page Down key. The Value
property is increased by LargeChange if you press the Page Up key or click to to
right/top of the indicator. It is decreased by LargeChange if you press the Page
Down key or click to the left/bottom of the indicator.
Syntax:
object.LargeChange [= value]
The LargeChange property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the amount of change.

A.4.31 LayoutType Property

Applies to: SIMATIC Number


This property specifies how the labels are arranged around the display area of the
control. When the layout type is Horizontal (0), caption 1 is on the left of the display
area, and caption 2 on the right side of the display area. When the layout type
Vertical (1), caption 1 is located above the display area, and caption 2 is below the
display area.
Syntax: object.LayoutType [= value]
The LayoutType property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the layout type.

The settings for value are:

Setting Description
Horizontal (0) (default) Arranges the labels to the left and right of the
display area of the control
Vertical (1) Arranges the labels above and below the display area of
the control

SIMATIC Computing
6GK1971–0BA00–0AA1 A-63
SIMATIC Computing

A.4.32 LimitCheck Property

Applies to: SIMATIC Number


This property determines whether to check that a value entered by the control is
within specified limits and to define the range of values that determine the limits. A
value changed by the control engine is not checked against the defined range.
You can specify a range of valid values for any entry. (The lower limit equals the
smallest number allowed, and the upper limit equals the largest number allowed). If
an invalid value (a value which is outside of the range) is entered, the control does
not write that value to the Value property.
If the limit-check fails, the Error event and the LimitCheckFailed events will be
fired. The Error event will be fired only if the ShowErrorBoxes property is enabled
(selected).

Note
This Limit Check property must be enabled for the UpperLimit and LowerLimit
properties to have any effect.

Syntax:
object.LimitCheck [= value]
The LimitCheck property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the kind of limit check.

The settings for value are:

Setting Description
CheckNone (0) (default) Does not check the entry against limits
Lower (1) Checks the value against the lower limit only
Upper (2) Checks the value against the upper limit only
Both (3) Checks the value against both the upper and lower limits

SIMATIC Computing
A-64 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.33 Locked Property

Applies to: SIMATIC Number


If the control is locked it is in a read-only state. The user is unable to change any
values, but the current value is nevertheless shown. By default the control is not in
locked mode, so the user can enter numbers.
Syntax:
object.Locked [= value]
The Locked property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object can be
edited.

The settings for value are:

Setting Description
True You can scroll and highlight the text in the control, but you
cannot edit it. The program can still modify the text by
changing the Value property. Changes to the Value
property are reflected: the control displays the values in
the control engine, but you are unable to change them.
False (default) You can edit the text in the control.

A.4.34 LowerLimit Property

Applies to: SIMATIC Number


These properties allow access to the lower limit value. If the value entered by the
user is lower than the LowerLimit value or higher than the UpperLimit value, it will
not be written to the control engine.
You can specify a range of valid values for any entry. (The lower limit equals the
smallest number allowed.) If an invalid value (a value which is outside of the range)
is entered, the control does not write that value to the Value property.
If the limit-check fails, the Error event and the LimitCheckFailed events will be
generated. The Error event will be generated only if the ShowErrorBoxes property
is enabled (selected).

SIMATIC Computing
6GK1971–0BA00–0AA1 A-65
SIMATIC Computing

Note
The LimitCheck property must be set to “Lower” (1) or “Both” (3) before the
LowerLimit property can have an effect.
The LimitCheck property must be set to “Upper” (2) or “Both” (3) before the
UpperLimit property can have an effect.

Syntax:
object.LowerLimit [= value]
The LowerLimit property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A floating-point value that defines the lower or upper limit
used at limit checking.

A.4.35 Max Property

Applies to: SIMATIC Slider


The Max property determines the position of the slider indicator of the SIMATIC
control. When the Value property is greater than or equal to Max, the indicator is in
its rightmost (or top) position.
Syntax:
object.Max [= value]
The Max property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the maximum number
displayed.

SIMATIC Computing
A-66 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.36 Min Property

Applies to: SIMATIC Slider


The Min property determines the position of the slider indicator of the SIMATIC
control. When the Value property is less than or equal to Min, the indicator is in its
leftmost (or bottom) position.
Syntax:
object.Min [= value]
The Min property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the minimum number
displayed.

A.4.37 MultipleEngines Property

Applies to: SIMATIC Data


This property specifies whether the control connects to a specific control engine or
connects simultaneously to several control engines.
Syntax:
object.MultipleEngines [= value]
The MultipleEngines property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object
connects to one or to several control engines.

The settings for value are:

Setting Description
True object connects to more than one control engine
simultaneously.
False (default) object connects only to the control engine
specified in the ControlEngine property.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-67
SIMATIC Computing

A.4.38 Offset Property

Applies to: SIMATIC Number


The Factor and Offset properties specify the scaling factor and the offset used
when the scale-by-formula option has been enabled.

Note
The ScaleMode property must be set to “ByFormula” (1) for the Factor and Offset
properties to have any effect.

You can use a formula to scale the value. In the following formula, “PLC Value” is
similar to the contents of the Value property if the control is connected to the
control engine; “Scale” is the value of the Factor property; “Offset” is the value of
the Offset property; and “Displayed value” is also the contents of the Text property.
PLC Value * Factor + Offset = Displayed value
Syntax:
object.Offset [= value]
The Offset property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A floating-point value that defines the factor or the offset
for the scaling formula.

Note
The default value of the factor is 1.0, and the default value of the offset is 0.0.

A.4.39 PCName Property

Applies to: SIMATIC Data


This property selects the name of a remote computer (PC) in order to connect to a
control engine over a network, such as a local area network (LAN).
Syntax:
object.PCName [= value]
The PCName property has these parts:

SIMATIC Computing
A-68 6GK1971–0BA00–0AA1
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String that specifies the pathname or identification of the
remote computer (PC) for the connection.

A.4.40 Precision Property

Applies to: SIMATIC Number


This property is available if the DataType is set to “Real” (6) (data type with
precision). In that case you can change the precision (number of digits behind the
decimal point) of the number. The number will be rounded at the specified
precision.

Note
The DataType property must be set to “Real” (6) before this property can have an
effect.

Syntax:
object.Precision [= value]
The Precision property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value An integer value that defines the precision of the number.
The default precision is 3.

A.4.41 PropertyChangedName Method

Applies to: SIMATIC Data


This method notifies the SIMATIC Data Control that the value of a property of a
connected control, referenced by the name of the object in the form (such as
S7Number1), has changed. The SIMATIC Data Control reads the value from the
property and writes it to the data source.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-69
SIMATIC Computing

Note
A programmer who uses Visual Basic (or a similar programming language) would
use the PropertyChangedName method, while a programmer who uses Visual C
(or a similar programming language) would use the PropertyChangedObject
method.

Syntax:
result = object.PropertyChangedName ConnectedObject, Property
The PropertyChangedName method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
result A long value that indicates whether an error has occurred.
The result is zero if no error occurs.
ConnectedObject A String expression that evaluates to the name of the
connected control whose property has changed.
Property A String value with the name of the property that has
changed.

A.4.42 PropertyChangedObject Method

Applies to: SIMATIC Data


This method notifies the SIMATIC Data Control that the value of a property of a
connected control (an object which was declared in the program) has changed.
The SIMATIC Data Control reads the value from the property and writes it to the
data source.

SIMATIC Computing
A-70 6GK1971–0BA00–0AA1
SIMATIC Computing

Note
A programmer who uses Visual Basic (or a similar programming language) would
use the PropertyChangedName method, while a programmer who uses Visual C
(or a similar programming language) would use the PropertyChangedObject
method.

Syntax:
result = object.PropertyChangedObject ConnectedObject, Property
The PropertyChangedObject method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
result A long value that indicates whether an error has occurred.
The result is zero if no error occurs.
ConnectedObject A String expression that evaluates to the name of the
connected control whose property has changed.
Property A String value with the name of the property that has
changed.

A.4.43 Radix Property

Applies to: SIMATIC Number


This property defines the radix (binary, octal, decimal, or hexadecimal) for the
number to be displayed. Any value entered must also be in the radix defined by
this property.
Syntax:
object.Radix [= value]
The Radix property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the radix used for
displaying the value.

The settings for value are:

SIMATIC Computing
6GK1971–0BA00–0AA1 A-71
SIMATIC Computing

Setting Description
Binary (0) Binary mode (valid characters for input: 0 and 1)
Octal (1) Octal mode (valid characters for input: 0 to 7)
Decimal (2) (default) Decimal mode (valid characters for input: 0 to 9,
‘+’, ‘–’, and ‘.’)
Hexadecimal (3) Hexadecimal mode (valid characters for input: 0 to 9, a to
f, and A to F)

A.4.44 RangeRawMax, RangeRawMin, RangeScaledMax, and


RangeScaledMin Properties

Applies to: SIMATIC Number


These properties define the ranges for scaling a value by a “range transformation”:
S RangeRawMax specifies the upper value of the source range.
S RangeRawMin specifies the lower value of the source range.
S RangeScaledMax specifies the upper value of the destination range.
S RangeScaledMin specifies the lower value of the destination range.

Note
The ScaleMode property must be set to “ByRange” (2) before these properties can
have an effect.

When you use a range transformation to scale the value, you specify a source
range (for the values in the control engine) and a destination range (for the values
that are displayed by the control). The values of one range will be transformed to
the other range. See Figure A-25. The source and destination ranges define a ratio
for the transformation; they do not define upper or lower limits. A value can be
larger or smaller than the range; the transformation will use the two ranges to
extrapolate the other value.

SIMATIC Computing
A-72 6GK1971–0BA00–0AA1
SIMATIC Computing

Transformation ratio
RangeRawMax RangeScaledMax

PLC value Value displayed


(in control engine) by S7 control

RangeRawMin RangeScaledMin

Figure A-25 Scaling Values by Range Transformation

Syntax:
object.RangeRawMax [= value]
object.RangeRawMin [= value]
object.RangeScaledMax [= value]
object.RangeScaledMin [= value]
The RangeRawMin, RangeRawMax, RangeScaleMin, RangeScaleMax properties
have these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A floating-point value that defines the range boundaries for
the range mode scaling.

Note
The default value of the RangeRawMax is 255.0; the default value of the
RangeRawMin is 0.0; the default value of the RangeScaledMax is 100.0; and the
default value of the RangeScaledMin is 0.0.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-73
SIMATIC Computing

A.4.45 ReadMultiVariables Method

Applies to: SIMATIC Data


This method reads the status of the connected variables in the control engine.
Syntax:
result = object.ReadMultiVariables (VarNames, VarValues, States)
The ReadMultiVariables method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
VarNames A Variant that specifies the array of variables (memory
locations) to be read from the control engine.
VarValues A Variant that contains an array of the corresponding
values of the specified variables in the control engine.
States A Variant that contains an array of the quality code (Long)
for each of the variables.
result A Long value that indicates whether an error has occurred.
The result is zero if no error occurs.

A.4.46 ReadVariable Method

Applies to: SIMATIC Data


This method reads the status of one specific variable in the control engine.
Syntax:
result = object.ReadVariable (VariableName, Value, State, TimeOut)
The ReadVariable method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
VariableName A String expression that specifies the variable (memory
location) in the control engine to be read.
Value A Variant value containing the content of the specified
variable in the control engine.
State A Long value that provides the quality code for the
variable.

SIMATIC Computing
A-74 6GK1971–0BA00–0AA1
SIMATIC Computing

Part Description
TimeOut A Long value that determines the length of time (in ms)
before generating a time-out error. (Not applicable for this
release). For the current release, this value should always
be 0.
result A Long value that indicates whether an error has occurred.
The result is zero if no error occurs.

A.4.47 ScaleMode Property

Applies to: SIMATIC Number


This property specifies the scaling mode to be used for scaling values. The values
can also be specified at the Scale Property Tab. There are two choices for scaling
mode:
S By formula: PLC Value * Factor + Offset = Displayed value
where: PLC Value is similar to the contents of the Value property if the control is
connected to the control engine; Scale is the value of the Factor property;
Offset is the value of the Offset property; and Displayed value is the contents of
the Text property.
S By range transformation: you specify a source range (of PLC values) and a
destination range (of displayed values), and the values of the one range are
transformed to the other range. See Figure A-25 and the Range properties.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-75
SIMATIC Computing

Note
The Scale Mode property determines whether the RangeRawMax, RangeRawMin,
RangeScaledMax, RangeScaledMin, Factor, and Offset properties have any
effect.

Syntax:
object.ScaleMode [= value]
The ScaleMode property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the kind of scaling.

The settings for value are:

Setting Description
ScaleNone (0) (default) No scaling
ByFormula (1) Use the formula containing the factor and offset to scale
the value
ByRange (2) Use the range transformation method to scale the value

A.4.48 ShowButtons Property

Applies to: SIMATIC Number


This property displays the Enter and Cancel buttons for the control. When this
property is enabled (True), any new value entered with the control must be
confirmed before it is written to the SIMATIC Data Control. Typing a new value in
the display field of the control enables the buttons. Clicking on the Enter button
writes the new value to the control engine; clicking on the Cancel button replaces
the new value with the value from the control engine. The default setting for this
option is False (disabled).
Syntax:
object.ShowButtons [= value]
The ShowButtons property has these parts:

SIMATIC Computing
A-76 6GK1971–0BA00–0AA1
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether or not to
display buttons.

The settings for value are:

Setting Description
True Two buttons will be shown on the right side of the display
field. When you enter a new value in the display field, the
buttons become active. To confirm the change and write
this value to the Value property (and to the control engine),
click on the Enter button; to cancel the value, click on the
Cancel button.
False (default) The buttons are hidden.

A.4.49 ShowErrorBoxes Property

Applies to: SIMATIC Data, SIMATIC Number, SIMATIC Panel


This property specifies whether to display the default error boxes when there is a
user-generated error. Every time an error occurs, an Error event will be generated.
If the ShowErrorBoxes property is enabled (selected), a default error message box
will be displayed.
All errors on connections are reported by the Connection Error event.

Note
Computing provides error messages in English only. If you want to display
messages in other languages, you must disable (deselect) the ShowErrorBoxes
option and write program code to react on the error event.

Syntax:
object.ShowErrorBoxes [= value]
The ShowErrorBoxes property has these parts:

SIMATIC Computing
6GK1971–0BA00–0AA1 A-77
SIMATIC Computing

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether the control
displays error boxes.

The settings for value are:

Setting Description
True (default) The control shows the default error boxes.
False The error boxes are hidden.

A.4.50 SmallChange Property

Applies to: SIMATIC Slider


This property determines how far the slider indicator moves when the control has
focus and you press the up/down or right/left arrow keys. The Value property is
increased by SmallChange if you press the right (or up) arrow key. It is decreased
by SmallChange if you press the left (or down) arrow key.
Syntax:
object.SmallChange [= value]
The SmallChange property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the amount of change

SIMATIC Computing
A-78 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.51 TagServerName Property

Applies to: SIMATIC Number


This property determines the name of the SIMATIC Data Control which shall be
used for a connection to the control engine. The TagServerName property applies
to the SIMATIC Number Control, but it is created automatically by the SIMATIC
Data Control. It can also be created by your program code.
Syntax:
object.TagServerName [= value]
The TagServerName property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String value that specifies the name of an available
SIMATIC Data Control.

A.4.52 TagSource Property

Applies to: SIMATIC Data


This property identifies the source of symbolic information to be used when
assigning variables and identifying control engines. The source can be a tag file.
Syntax:
object.TagSource [= value]
The TagSource property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String that identifies the pathname to the source (such
as a tag file) of symbolic information to be used when
configuring the control for variables and control engines.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-79
SIMATIC Computing

A.4.53 Ticks Property

Applies to: SIMATIC Slider


This property sets the number of ticks, or unit markers, of the control. For
example, if Ticks = 10, the scale of the control will be divided into 10 sections.
Syntax:
object.Ticks [= value]
The Ticks property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A constant that determines the number of unit markers to
be displayed.

A.4.54 TrueCaption Property

Applies to: SIMATIC Button


This property determines the text that is displayed in the control when the Value
property is True (equal to 1, or “On”).
Syntax:
object.TrueCaption [= value]
The TrueCaption property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A String value that specifies the text of the label.

SIMATIC Computing
A-80 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.55 TrueColor Property

Applies to: SIMATIC Button


This property determines the color of the control when the Value property is True
(equal to 1, or “On”).
Syntax:
object.TrueColor [= value]
The TrueColor property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant that determines the background or
foreground colors of object.

The settings for value are:

Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows System Colors specified by system color constants (depending on
Colors the container); for example, colors listed in the Visual
Basic (VB) object library in the Object Browser

A.4.56 UpperLimit Property

Applies to: SIMATIC Number


This property allows access to the upper limit value. If the value entered by the
user is higher than the UpperLimit value, it will not be written to the control engine.
You can specify a range of valid values for any entry. (The upper limit equals the
largest number allowed.) If an invalid value (a value which is outside of the range)
is entered, the control does not write that value to the Value property.
If the limit-check fails, the Error event and the LimitCheckFailed events will be
generated. The Error event will be generated only if the ShowErrorBoxes property
is enabled (selected).

SIMATIC Computing
6GK1971–0BA00–0AA1 A-81
SIMATIC Computing

Note
The LimitCheck property must be set to “Lower” (1) or “Both” (3) before the
LowerLimit property can have an effect.
The LimitCheck property must be set to “Upper” (2) or “Both” (3) before the
UpperLimit property can have an effect.

Syntax:
object.UpperLimit [= value]
The UpperLimit property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A floating-point value that defines the lower or upper limit
used at limit checking.

Note
The default value for the LowerLimit is 0.0, and the default value for the
UpperLimit is 100.0.

SIMATIC Computing
A-82 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.57 Value Property

Applies to: SIMATIC Button, SIMATIC Number, SIMATIC Slider


This property should be linked, using the SIMATIC Data Control, to a value in the
control engine. It is bindable. Use the following descriptions to understand the
differences between the Value, ConvertedValue, and Text properties:
S The Value property is a Variant. It must be connected, by way of the SIMATIC
Data Control, to a value in the control engine. It can hold values of different
data types.
S The ConvertedValue property is also a Variant and contains the value from the
Value property, but it is already scaled and converted to the specified data type
(DataType property).
S The Text property contains a String with the displayed String, which means,
inclusively, radix conversion (Radix property), zero padding (ZeroPad property),
and precision (Precision property) usage.
If the Enabled property is False, the bi-directional connection between Value and
ConvertedValue is broken. The result is that changes to the Text or
ConvertedValue property will not be written to the Value property.

Note
If the value of the Value property changes, the Change event will be generated.

Syntax:
object.Value [= value]
The Value property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Variant that specifies the value of the control.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-83
SIMATIC Computing

A.4.58 Write Method

Applies to: SIMATIC Number


This method writes the value of the ConvertedValue property to the Value property.
You must use this method only if the WriteMode is set to Manual (1).
Syntax:
object.Write
The Write method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.

A.4.59 WriteMode Property

Applies to: SIMATIC Number


This property determines how the control responds when the user enters a new
value. If the write mode is set to Automatic (0), the value (if valid) is written
automatically into the Value property (and to the control engine). If the write mode
is Manual (1), the value is not written to the value property unless your program
code calls the method “Write” at the control.
Syntax:
object.WriteMode [= value]
The WriteMode property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A value or constant expression that specifies whether the
control automatically passes entered values to the Value
property.

The settings for value are:

Setting Description
Automatic (0) (default) Automatically passes the new (input) value to the
Value property
Manual (1) Does not write the new (input) value unless the control
processes a Write method

SIMATIC Computing
A-84 6GK1971–0BA00–0AA1
SIMATIC Computing

A.4.60 WriteMultiVariables Method

Applies to: SIMATIC Data


This method writes new values for several variables in the control engine.
Syntax:
result = object.WriteMultiVariables (VarNames, VarValues, States)
The WriteMultiVariables method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
VarNames A Variant that specifies the array of variables (memory
locations) in the control engine.
VarValues A Variant that contains an array of the corresponding
values to be written to the specified variables.
States A Variant that contains an array of the quality code (Long)
for each of the variables.
result A Long value that indicates whether an error has occurred.
The result is zero if no error occurs.

A.4.61 WriteVariable Method

Applies to: SIMATIC Data


This method writes a new value to a specific variable in the control engine.
Syntax:
result = object.WriteVariable (VariableName, Value, TimeOut)
The WriteVariable method has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
VariableName A String expression that specifies the variable (memory
location) in the control engine.
Value A Variant value containing the content to be written to the
specified variable in the control engine.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-85
SIMATIC Computing

Part Description
TimeOut A Long value that determines the length of time (in ms)
before generating a time-out error. (Not applicable for this
release). For the current release, this value should always
be 0.
result A Long value that indicates whether an error has occurred.
The result is zero if no error occurs.

A.4.62 ZeroPad Property

Applies to: SIMATIC Number


This property determines whether the number displayed by the control is padded
with zeros (to the left of the value) to the size of the data type.
Syntax:
object.ZeroPad [= value]
The ZeroPad property has these parts:

Part Description
object An object expression (identifier for the specific SIMATIC
control) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether or not the
displayed number is filled with leading zeros.

The settings for value are:

Part Description
True Fills the number with leading zeros to the size specified by
the DataType property.
False (default) Does not fill the number with leading zeros.

SIMATIC Computing
A-86 6GK1971–0BA00–0AA1
SIMATIC Computing

A.5 Other SIMATIC Controls

Chapter Overview
SIMATIC Computing provides a collection of custom SIMATIC controls for
accessing data in the control engine:
S SIMATIC Button control reads and writes Boolean (single bit) values.
S SIMATIC Number control automatically converts the S7data types, allowing you
to accurately read and write all of the S7 data types,
S SIMATIC Slider control provides a sliding indicator (“slider”) for entering or
displaying dynamic data.

A.5.1 SIMATIC Button Control

The Button control allows you to associate a button display with data bit from your
process and to change them. You associate the button with your process by
assigning a variable (namely, the desired bit location) to it. You can then toggle the
button display to change the state of the bit; the button color also changes
automatically as the state of the bit changes within the process.
Figure A-26 shows the Button control. The Button control has two states of
animation: 0 (off) or 1 (on). Clicking on the Button control changes the data in the
control engine.

OFF Control

Figure A-26 SIMATIC Button Control

Connecting the Button control to the Process Data


To establish a connection between the Button control and your process data, you
assign a (single-bit) variable to the Value property of the Button control. Die
Variable kann mit Hilfe des Dialogfeldes “Properties” des Button Controls
verbunden werden. Instead, use the Properties dialog box of the Data control and
select the button from the expandable list of controls under the Connections tab.
A-27).
To set properties for anything other than the Value property, you can use the
Properties dialog box of the Button control itself. Click the mouse button and select
the Properties command for the control.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-87
SIMATIC Computing

Warning
! After you assign a variable to the Value property of a SIMATIC or a third-party
ActiveX control, the control is able to access process data. When you change the
value that is displayed in the control, you are changing the value in the actual
process.
Altering process data can cause unpredictable process operation, and
unpredictable process operation could result in death or serious injury to
personnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could cause
process equipment to operate erratically. Always install a physical emergency stop
circuit for your machine or process.

Remember that the button control can be assigned only to an individual bit in the
control engine. The only valid data type for an Button control is BOOL.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Data1 S7:[DEMO]M0.0
S7vbBttn1
Enabled Browse...
FalseCaption
FalseColor
Font Update rate (ms): 100
ToolTipText
TrueCaption Dead band: 0
TrueColor
Value Automatic write mode:
Add... Delete Filter... Apply filter to properties

OK Cancel Apply Help

Figure A-27 Assigning Variables for the Button Control

SIMATIC Computing
A-88 6GK1971–0BA00–0AA1
SIMATIC Computing

Defining the Label and Enabling the Control (Using the General Tab)
The General tab of the Properties dialog (see Figure A-28) allows you to define the
two labels for the Button control:
S “TrueCaption”: Enter the text to be displayed in the control when the bit is “true”
(equal to 1 or “on”).
S “FalseCaption”: Enter the text to be displayed in the control when the bit is
“false” (equal to 0 or “off”).
The General tab also includes a check box for enabling the control. When you
select this option, the control can actively access the control engine. Deselecting
this option deactivates the control: it does not access the memory location of the
control engine and does not react on any mouse clicks. It also does not generate
events while disabled. The default setting for this option is enabled (selected).

Siemens Button Control Properties

General Font Color Name

TrueCaption: ON

FalseCaption: OFF

Enabled:

OK Cancel Apply Help

Figure A-28 Button Control Properties (General Tab)

Defining the Typeface of the Label (Using the Font Tab)


The Font tab of the Properties dialog (see Figure A-29) allows you to define the
typeface and size for the labels of the Button control:
S “Font”: select the typeface for the label from a list of standard typefaces.
S “Size”: select the point size for the label or enter a specific point size for the
label.
S “Effects”: select other typographical options (boldface, italic, underline, or
strike-through) for the label.
The “Sample Text” field displays the selection of the Font property.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-89
SIMATIC Computing

Defining the Color of the Control (Using the Color Tab)


The Color tab of the Properties dialog (see Figure A-30) allows you to define the
colors for the two states of the Button control. You select the “Off” state
(FalseColor) or the “On” state (TrueColor) and then select the color to be displayed
for that state from the color palette. You can choose from a palette of standard
colors, or you can create custom colors.

Siemens Button Control Properties

General Font Color

Properties: Font: Size:


Font MS Sans Serif 8.25

Effects
Bold Underline

Italic Strikeout

Sample Text:

MS Sans Serif

OK Cancel Apply Help

Figure A-29 Button Control Properties (Font Tab)

Siemens Button Control Properties

General Font Color

Properties: Color Set:

FalseColor Standard Colors

TrueColor Color Palette:

Gray

Green

Magenta

Red

Edit Custom Color...

OK Cancel Apply Help

Figure A-30 Button Control Properties (Color Tab)

SIMATIC Computing
A-90 6GK1971–0BA00–0AA1
SIMATIC Computing

A.5.2 Properties, Methods, and Events of the Button Control

You use the properties and methods listed in Table A-17 to manipulate the Button
control. Das Data Control reagiert auf die in Tabelle A-18 aufgelisteten
Ereignisse.

Table A-17 Properties and Methods of the Button Control

Property or Method Description


Enabled property Determines whether the control reacts to changes of the Value
property and fires events
FalseCaption property Determines the text that is displayed in the control when the
Value property is False (equal to 0, or “Off”)
FalseColor property Determines the color of the control when the Value property is
False (equal to 0, or “Off”)
Font property Returns a Font object for the main font of the control.
TrueCaption property Determines the text that is displayed in the control when the
Value property is True (equal to 1, or “On”)
TrueColor property Determines the color of the control when the Value property is
True (equal to 1, or “On”)
Value property Contains the value that is linked to the control engine

Table A-18 Events of the Button Control

Event Description
Change event Occurs when the value of the Value property changes
Click event Occurs when a mouse button is pressed and released while the
mouse cursor is over the control

SIMATIC Computing
6GK1971–0BA00–0AA1 A-91
SIMATIC Computing

A.5.3 SIMATIC Number Control

The Number control allows you to display process data in a numeric format and to
modify that data. You associate the number display with your process by assigning
a variable (the process value) to it.
You can type a new value into the display; the display also updates automatically
when the variable associated with it changes within the process. Besteht eine
Verknüpfung des Number Controls mit einer Prozeßvariablen, zeigt das Control
den Wert der Variablen an und die Prozeßvariable kann durch Eingabe eines
Wertes gesetzt werden.
The Number control provides access to the memory locations of the control
engine. Entering a new value in the control changes the data in the control engine.
Figure A-31 shows the Number control.

Display area Control

Enter Cancel
button button

Figure A-31 SIMATIC Number Control

Note
In order to connect the Number control to actual process data, you must establish
a connection through the Data control.

Connecting the Number Control to the Process Data


To establish a connection between the Number control and your process data, you
assign a variable to the Value property of the Number control. The variable cannot
be assigned within the Properties dialog box of the Number control. Instead, use
the Properties dialog box of the Data control and select the Number control from
the expandable list of controls under the Connections tab. A-32

SIMATIC Computing
A-92 6GK1971–0BA00–0AA1
SIMATIC Computing

Warning
! After you assign a variable to the Value property of a SIMATIC or a third-party
ActiveX control, the control is able to access process data. When you change the
value that is displayed in the control, you are changing the value in the actual
process.
Altering process data can cause unpredictable process operation, and
unpredictable process operation could result in death or serious injury to
personnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could cause
process equipment to operate erratically. Always install a physical emergency stop
circuit for your machine or process.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Data1 S7:[DEMO]MD100
S7Number1
Browse...
Value
Alignment
Appearance Update rate (ms): 100
BackColor
BorderStyle Dead band: 0
Caption1

Automatic write mode:


Add... Delete Filter... Apply filter to properties

OK Cancel Apply Help

Figure A-32 Assigning Variables for the Number Control

To set properties for anything other than the Value property, you can use the
properties dialog box for the Number control itself. Use the Edit menu or right click
the mouse button and select the Properties command for the control.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-93
SIMATIC Computing

Defining How the Data is Displayed (Using the General Tab)


The General tab of the Properties dialog box (see Figure A-33) allows you to
define the presentation of the data accessed by the Number control.

Siemens Number Control Properties

General Style Label Scaling Color Font

Data type: 4 – Double Word Zero Pad

Radix: 2 – Decimal Show Buttons

Precision: 0 Show Error Boxes

Limit check: 0 – None Alignment:

Upper limit: 100


Lower limit: 0

OK Cancel Apply Help

Figure A-33 Number Control Properties (General Tab)

The fields on the General tab allow you to define the following properties
concerning how the data will be displayed:
S “Data type” defines the size of the presentation for the data. Table A-19
describes the sizes of the data types used by the Number control.
If you entered a specific data type for the assigned variable in the SIMATIC
Data control, you must enter the same data type here.
S “Radix” configures the data to be accessed (display or entered) as a binary,
octal, decimal or hexadecimal value.
S “Precision” defines the decimal place for the real (floating–point) number. (The
default value is three digits) This field is enabled only for the Real data type.

SIMATIC Computing
A-94 6GK1971–0BA00–0AA1
SIMATIC Computing

Table A-19 Size of Data Types for the Number control

Data Type Setting Size Description


Boolean 0 1 bit boolean value
Byte 1 1 byte Unsigned single–byte value
Word 2 1 byte Vorzeichenloser Zwei-Byte wert
Integer 3 2 bytes Vorzeichenbehafteter, ganzzahliger Zwei–Byte wert
Double Word 4 4 bytes Unsigned four–byte value (default)
Double 5 4 bytes Signed four–byte integer value
Integer
Real 6 4 bytes Signed four–byte real (floating–point) value

Using the alignment buttons, you can define how the value will be displayed in the
Number control: aligned to the left side of the field, centered in the field, or aligned
to the right side of the field.
You can also enable the Number control to check for upper and lower limits on the
value that you enter. You can select limit checking for a maximum value, a
minimum value, both maximum and minimum value, or for no limit checking.
When you enable the Limit Checking option, the Number control does not write an
out-of-range value (larger than the upper limit or smaller than the lower limit) to the
control engine. If the Number control has been configured to show the error
messages, the out-of-range value generates an error message.
Using the check boxes on the General tab, you can define other operations for the
control:
S “Zero Pad”: When you enable this option, the Number control fills out the data
type by inserting zeroes (0) to the left of the value. The default setting for this
option is disabled (not selected).
S “Show Buttons”: When you enable this option, the Number control displays the
Enter and Cancel buttons. (See Figure A-33.) When this option is checked, you
must confirm any new value in order to enter it. Typing a new value in the
display field of the control enables the buttons. Clicking on the Enter button
writes the new value to the control engine; clicking on the Cancel button
replaces the new value with the value from the control engine. The default
setting for this option is disabled (not selected).
You can also use the Return (or Enter) key on the keyboard instead of the Enter
button, and the Escape (Esc) key instead of the Cancel button.
S “Show Error Boxes”: when you enable this option, the Number control displays
the messages (“error boxes”) in response to pre-defined error conditions (for
example, for out-of-range or invalid numbers). The default setting for this option
is enabled (selected).

SIMATIC Computing
6GK1971–0BA00–0AA1 A-95
SIMATIC Computing

Defining the Appearance of the Number Control


The Style tab of the Properties dialog box (see Figure A-34) provides you with the
following options for the appearance of the control:
S “Appearance”: If you set this property to 3D, the control will have a
three-dimensional appearance. (You must also set the border style to Fixed
Single to enable the three-dimensional appearance.) The other option is Flat,
which displays a two-dimensional, rectangular border around the control.
S “Border Style”: If you set this property to Fixed Single, the control is displayed
with a rectangular border; if you set the property to None, no border will be
displayed.
In addition to fields that determine the appearance of the control, the Style tab also
includes a “Write Mode” field that controls whether changes to the value are written
automatically to the control engine, or are written only when requested by the
program code (using a Write command) that you associated with the Number
control.

Siemens Number Control Properties

General Style Label Scaling Color Font

Appearance: 1 – 3D

Border Style: 1 – Fixed Single

Write Mode: 0 – Automatic

Enabled

Locked (read-only)

OK Cancel Apply Help

Figure A-34 Number Control Properties (Style Tab)

Using the check boxes on the Style tab, you can define other operations for the
Number control:
S “Enabled”: When you select this option, the control can actively access the
control engine. Disabling this option deactivates the Number control: it does not
access the memory location of the control engine and does not react on any
mouse clicks. It also does not generate events while disabled. The default
setting for this option is enabled (selected).
S “Locked”: When you enable this option, the control becomes a : read-only
display. you can view the value in the memory location of the control engine, but
you cannot change the values from this control. The default setting for this
option is disabled (not selected).

SIMATIC Computing
A-96 6GK1971–0BA00–0AA1
SIMATIC Computing

Creating a Label for the Number Control (Using the Label Tab)
The Label tab of the Properties dialog box (see Figure A-35) allows you to define a
label (or caption) for the control. You can define two different captions for the
control (“Caption 1” and “Caption 2”).
As shown in Figure A-36, the labels can be oriented either horizontally or vertically
in relationship to the Number control:
S If you select Horizontal, Caption 1 is on the left and Caption 2 is on the right
side of the control.
S If you select Vertical, Caption 1 on the top and the Caption 2 on the bottom.
Use the alignment buttons for each caption to determine whether the label is
centered, aligned to the left, or aligned to the right.
Use the Font tab and the Color tab to specify the font, the font color, and the
background color of the label.

Siemens Number Control Properties

General Style Label Scaling Color Font


Layout Type
Horizontal Vertical

Size1: Size2:
–1 –1

Caption1: Caption2:
Control

Alignment1: Alignment2:

OK Cancel Apply Help

Figure A-35 Number control Properties (Label Tab)

You can also specify a specific width (for horizontal labels) or height (for vertical
labels). Figure A-36 shows the labeling options for the Number control.
If you keep the default value for the size of the label (1), the Number control
automatically adjusts the size of the label to the amount text entered or to the font
size for the caption.
Entering a specific size for the labels allows you to control the appearance of the
Number control. For example, you may want to align the display area for a series
of Number controls, but the labels vary in length for each control. Choosing a
constant size for the labels would align the display areas.
If you enter a specific size for the captions, you enter the size in twips. (A twip is a
screen-independent unit that ensures that the placement and proportion of screen

SIMATIC Computing
6GK1971–0BA00–0AA1 A-97
SIMATIC Computing

elements are the same on all display systems. A twip is approximately 1/20 of a
printer’s point: 1440 twips=1 Inch. or 56.7 twips=1 mm when printed.)

Horizontal orientation Caption1 Display area Caption 2

Caption1

Vertical orientation Display area

Caption 2

Figure A-36 Labeling Options for the Number Control

Using the Scaling Tab


The Scaling tab of the Properties dialog box (see Figure A-37) allows you to define
a scale for displaying the value in the memory location. This scaling factor is used
both in reading a value from and writing a value to the control engine. You can
select one of three scaling options:
S No scaling of the data (default)
S Scaling by formula
S Scaling by ranges
If you choose to scale by formula, you enter the following information:
S Scale represents a percentage of change (scaling factor) from the value in the
control engine to the value in the Number control.
S Offset represents a fixed value to be added to the scaled result before being
displayed.
The Number control uses the following formula to calculate the scaled value:
(process value  Scale) + Offset = Display

where:
process value = the value strored in the control engine, value of the
process variable
Scale = the scalling factor
Offset = the offset factor
Display = the value displayed in the Number control
When the Number control writes data to the control engine, the inverse of the
formula is used to scale the value.

SIMATIC Computing
A-98 6GK1971–0BA00–0AA1
SIMATIC Computing

Siemens Number Control Properties

General Style Label Scaling Color Font

Scale mode: 0 – No Scaling

Scale by formula Scale by range transformation


PLC value PLC value
x Upper value: 255
Scale: 1
Lower value: 0
+
Offset: 0 Display

= Upper value: 100


Display Lower value: 0

OK Cancel Apply Help

Figure A-37 Number Control Properties (Scaling Tab)

If you choose to scale by range transformation, you specifiy the upper and lower
values for a source range (for the value in the control engine) and for a destination
range (for the value displayed in the Number control or Display). The Number
control then transforms the value from one range into the equivalent value for the
other range.
These ranges define only the relationship between the data in the control engine
and the data in the Number Control: if the value is above or below the ranges
entered for the information, the transformation uses the formula to extrapolate the
scaled value.

A.5.4 Properties, Methods, and Events of the Number Control

You use the properties and methods listed in Table A-20 to manipulate the Number
control. The control responds to the events listed in Table A-21.
When an error occurs in the Number control, the control generates an Error event.
Your program can capture this Error event and respond to specific situations. Table
A-22 lists the error codes for the Number control.

Table A-20 Properties and Methods of the Number Control

Property or Method Description


Alignment property Specifies the alignment of the number in the control
Appearance property Specifies whether the control is displayed 3D or flat
BackColor property Returns or sets the background color
BorderStyle property Selects the border style (fixed single, or none)

SIMATIC Computing
6GK1971–0BA00–0AA1 A-99
SIMATIC Computing

Table A-20 Properties and Methods of the Number Control, continued

Property or Method Description


Caption1 and Caption2 Specifies the displayed text of the first or second label
properties
Caption1Alignment and Specifies the alignment of the first or second label
Caption2Alignment
properties
Caption1BackColor and Returns or sets the background color for the first or second
Caption2BackColor label
properties
CaptionFont property Returns a Font object for the labels
Caption1ForeColor and Returns or sets the foreground color for the first or second label
Caption2ForeColor
properties
Caption1Size and Selects the size of the font for the text of the first or second
Caption2Size properties label
ConvertedValue property Holds the value from the control engine (read-only)
DataType property Defines the storage type used for converted values
Enabled property Determines whether the control reacts to changes of the Value
property and fires events
Factor property Specifies the scaling factor used when the scale-by-formula
option has been enabled (Used with ScaleMode property)
Font property Returns a Font object for the main font of the control
ForeColor property Returns or sets the foreground color used to display text and
graphics
LayoutType property Specifies how the labels are arranged around the display area
LimitCheck property Determines whether to check that a value is within specified
limits, and to define the range of values that determine the limits
Locked property Sets the control to a read-only state
LowerLimit property Allows access to the lower limit value
Offset property Specifies the offset used when the scale–by–formula option
has been enabled (Used with ScaleMode property)
Precision property Selects the precision of the Real number
Radix property Selects the radix for the number to be displayed (binary, octal,
decimal, or hexadecimal)
RangeRawMax, Defines the ranges for scaling a value by a “range
RangeRawMin, transformation” by specifying the upper and lower limits for the
RangeScaledMax, and source and the upper and lower limits for the destination
RangeScaledMin
properties
ScaleMode property Specifies the scaling mode to be used for scaling the values
ShowButtons property Displays the Enter and Cancel buttons for confirming the
entering of new values
ShowErrorBoxes Specifies whether to display the default error boxes when there
property is a user-generated error

SIMATIC Computing
A-100 6GK1971–0BA00–0AA1
SIMATIC Computing

Table A-20 Properties and Methods of the Number Control, continued

Property or Method Description


TagServerName Determines the name of the Data control which shall be used
property for a connection to the control engine
UpperLimit property Allows access to the upper limit value
Value property Contains the value that is linked to the control engine
Write method Writes the value of the ConvertedValue property to the Value
property
WriteMode property Selects whether to write new values automatically or manually
ZeroPad Determines whether the displayed number is padded with
zeroes (to the left of the value) to the size of the data type

Table A-21 Events of the Number Control

Event Description
Change Occurs when the value of the Value property changes
Click Occurs when a mouse button is pressed and released while the
mouse cursor is over the control
DblClick Occurs when a mouse button is double-clicked while the cursor is
over the control
Error Occurs when the control encounters an error
KeyDown Occurs when the user presses a key while the control has the focus
KeyPress Occurs when an ANSI key is pressed and released while the control
has the focus
KeyUp Occurs when a key is released while the control has the focus
LimitCheckFailed Occurs when the limit check fails
MouseDown Occurs when a mouse button is pressed while the mouse cursor is
over the control
MouseMove Occurs when the mouse cursor moves over the control
MouseUp Occurs when a mouse button is released while the mouse cursor is
over the control

SIMATIC Computing
6GK1971–0BA00–0AA1 A-101
SIMATIC Computing

Table A-22 Error Codes for the Number Control

Error Code Description


C0040002 The scaling cannot proceed because of an error in the formula used.
This error only appears if you are using the Number control with range
scaling. In this case it is possible that you have specified a raw value range
(RangeRawMin, RangeRawMax) of the length of zero (min equal to max).
This would lead to a division by zero, which means the scaling is impossible.
To correct the error, specify a raw value range where RangeRawMin is not
equal to RangeRawMax.
C0040003 The set value at the Value property is invalid.
The value which came from the control engine or from a script that is
accessing the Value property is not interpretable.
To correct the error, check the values that you have written to the control.
C0040004 The set value at the Text property is invalid.
This is a common error, which occurs if the user enters an incorrect value in
the control. Normally, it means that the entered text contains characters that
are not allowed.
The allowed characters are dependent on the Radix and DataType used.
For a description of the allowed characters, see the description of the Radix
property.
To correct the error, reenter a value that is allowed.
C0040005 The other OLE components could not be found.
An error occurred in the installation of Computing or of Windows itself. The
control is unable to access the other necessary parts that are needed for the
sofware to work properly.
To correct the error, check the installation.
C0040006 The Microsoft standard controls could not be created.
Something went wrong with the installation of Computing or Windows itself.
The control is unable to access the other necessary parts that are needed
for the sofware to work properly.
To correct the error, check the installation.
C0040010 The limit check cannot proceed, because the lower limit is greater than the
upper limit.
This error can only appear if you are using the Number control with limit
checking (checking for upper and lower limit). In this case it is possible that
you’ve specified a lower limit (LowerLimit) that is greater than the upper limit
(UpperLimit).
To correct the error, specify a valid range for limit checking. The lower limit
has to be less than the upper limit.

SIMATIC Computing
A-102 6GK1971–0BA00–0AA1
SIMATIC Computing

A.5.5 SIMATIC Slider Control

The Slider control allows you to display process data in a visual format (as sliding
indicator) and to modify that data. You associate the slider with your process by
assigning a variable (the process value) to it. You can then adjust the slider
indicator in order to modify the process value; the slider also changes its indicator
position automatically as the variable associated with it changes within the
process.
The Slider control provides access to the memory locations of the control engine.
Entering a new value in the control changes the data in the control engine.
Figure A-38 shows the toolbox icon and the Slider control.

Control
0 100

Figure A-38 SIMATIC Slider Control

Note
In order to connect the Slider control to actual process data, you must establish a
connection through the SIMATIC Data control.

Connecting the Slider Control to the Process Data

Warning
! After you assign a variable to the Value property of a SIMATIC or a third-party
ActiveX control, the control is able to access process data. When you change the
value that is displayed in the control, you are changing the value in the actual
process.
Altering process data can cause unpredictable process operation, and
unpredictable process operation could result in death or serious injury to
personnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could cause
process equipment to operate erratically. Always install a physical emergency stop
circuit for your machine or process.

To establish a connection between the Slider control and your process data, you
assign a variable to the Value property of the control. The variable cannot be
assigned within the Properties dialog box of the Slider control. Instead, use the
Properties dialog box of the SIMATIC Data control and select the slider from the
expandable list of controls under the Connections tab. (See FigureA-39).

SIMATIC Computing
6GK1971–0BA00–0AA1 A-103
SIMATIC Computing

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name

Controls: Assigned Variable:


S7Data1 S7:[DEMO]MD10
S7vbSlid1
Browse...
Direction
LargeChange
Max Update rate (ms): 100
Min
ShowMinMax
Dead band: 0
Ticks
Value
Automatic write mode:
Add... Delete Filter... Apply filter to properties

OK Cancel Apply Help

Figure A-39 Assigning Variables for the Slider Control

To set properties for anything other than the Value property, you can use the
Properties dialog box of the Slider control. Use the Edit menu or right click the
mouse button and select the Properties command for the control.

Defining How the Data is to be Displayed (Using the General Tab)


The General tab of the Properties dialog box (see Figure A-40) allows you to
define the presentation of the data accessed by the Slider control.
The Properties dialog box also allow you to dermine the amount that the value
displayed by the Slider control increases or decreases when you press an arrow
key (SmallChange) or press the Page Up and Page Down keys (LargeChange).

SIMATIC Computing
A-104 6GK1971–0BA00–0AA1
SIMATIC Computing

Siemens Slider Control Properties

General

Direction Show Min and Max Value


Horizontal Enabled

Vertical Ticks:

Min: Max:

SmallChange: LargeChange:

OK Cancel Apply Help

Figure A-40 Slider Control Properties (General Tab)

Figure A-41 shows the other elements that are defined by the Properties dialog
box. You can enter the minimum (Min) and maximum (Max) values for the Slider
control, and you can choose whether or not to display these values. You can also
define the number of interim units (ticks) between the minimum and maximum
values.

Ticks
Minimum Maximum
value value
0 100

Figure A-41 Elements of the Slider Control

As shown in Figure A-42, the Slider control can be displayed in a vertical or


horizontal orientation. You choose the orientation by selecting either a horizontal or
vertical direction.

100

Horizontal Vertical

0 100

Figure A-42 Orientation of the Slider Control

SIMATIC Computing
6GK1971–0BA00–0AA1 A-105
SIMATIC Computing

A.5.6 Properties, Methods, and Events of the Slider Control

You use the properties and methods listed in Table A-23 to manipulate the Slider
control. Das Control reagiert auf die in Tabelle A-24 aufgelisten Ereignisse.

Table A-23 Properties and Methods of the Slider Control

Property or Method Description


Direction property Sets the orientation (horizontal or vertical)
Enabled property Determines whether the control reacts to changes of the Value
property and fires events
LargeChange property Determines how far the slider indicator moves when the control
has focus and you press the Page Up or Page Down key
Max property Determines the value of the rightmost (or top) position of the
slider indicator
Min property Determines the value of the rightmost (or top) position of the
slider indicator
SmallChange property Determines how far the slider indicator moves when the control
has focus and you press the up/down or right/left arrow keys
Ticks property Sets the number of ticks (unit markers)
Value property Contains the value that is linked to the control engine

Table A-24 Events of the Slider Control

Event Description
Change event Occurs when the value of the Value property changes
Click event Occurs when a mouse button is pressed and released while the
mouse cursor is over the control
DblClick event Occurs when a mouse button is double-clicked while the cursor is
over the control
KeyDown event Occurs when the user presses a key while the control has the focus
KeyPress event Occurs when an ANSI key is pressed and released while the control
has the focus
KeyUp event Occurs when a key is released while the control has the focus
MouseDown event Occurs when a mouse button is pressed while the mouse cursor is
over the control
MouseMove event Occurs when the mouse cursor moves over the control
MouseUp event Occurs when a mouse button is released while the mouse cursor is
over the control

SIMATIC Computing
A-106 6GK1971–0BA00–0AA1
SIMATIC Computing

A.6 Guidelines for Custom Controls and Third-Party Containers

Chapter Overview
The SIMATIC Data control can be used not only with other SIMATIC ActiveX
controls, but also controls of other providers or custom ActiveX controls. To work
with a custom ActiveX control, the Data control requires that the control provide a
minimum of code to respond to changes in the assigned variable.
You can also use other containers, such as Visual Basic, with the SIMATIC
Controls. In order to use the SIMATIC controls in another container, the container
must support the requests of ”extended controls”. If the container does not support
these functions, you must supply program code to perform these functions.

A.6.1 Guidelines for Using Third-Party Containers with the Data


Control

For the SIMATIC Data control to work within a third-party container, the container
must support the “property browsing” functions of the Data control. To do this, the
container must support the functions for “extended controls” (as defined by
Microsoft for containers). An extended control is a partial control that wraps around
another control to support container-specific properties, methods and events.
(Refer to Microsoft’s on–line documentation for more information about containers
and extended controls.)
To provide the extended control functions, the container must support the following
methods:
S IOleClientSize::GetContainer
S IOleContainer::EnumObjects
S IOleControlSite::GetExtendedControl
The extended control of the container must also support a Name property.
Visual Basic unterstützt extended Controls. Containers from other vendors (such
as Borland’s Delphi version 3.0) do not support extended controls. The Siemens
customer support center can help determine if your container supports the
extended control functions.
If your container does not support the extended control functions, you must provide
program code to perform these functions. Contact the Siemens customer support
center for sample code that performs the extended control functions.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-107
SIMATIC Computing

A.6.2 Guidelines for Creating a Custom ActiveX Control

In order to create a custom ActiveX control that can be used with SIMATIC Data
Control, the custom control must provide a property to which data can be written
For example, your custom control might have a value property: when the Value
property changes, then the control reacts.

Reading Data from the Data Control


If the container supports extended controls, the Data control automatically finds the
custom control and its properties. You use the “Properties” dialog box of the Data
control to assign a variable in the control engine to the property of the custom
control. Whenever the value of the variable in the control engine changes, the Data
control updates the value of the property for the custom control.
The custom control should include a subroutine for handling the data written from
the Data control. Tabke A-25 provides a sample subroutine for a propertiy (Value).
It reads the data written by the Data control.

Writing Data to the Data Control


For the custom control to generate (write) a change to the variable in the control
engine, you must include a subroutine for handling a change in the property.
Table A-25 provides a sample subroutine for writing the new value to the Data
control.

Table A-25 Reading and Writing a Changed Value of a Property

Visual Basic Code


Public Property Get Value() As Long
Value = Object1.Value
End 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

SIMATIC Computing
A-108 6GK1971–0BA00–0AA1
SIMATIC Computing

A.6.3 Using a Custom Control with the Data Control

You can create a custom ActiveX control that communicates through the Data
control to access the control engine. To create this sample application, you need
the following items:
S Microsoft Visual Basic 5 or higher
S SIMATIC Data control from Computing
S Sample program

Creating a Custom ActiveX Control for Accessing the Control Engine


Use the following procedure to use a standard VB horizontal scrollbar (HScrollBar
control) to create a custom ActiveX control:
1. Open a Visual Basic project for creating an ActiveX control: Use the File ”New
Project menu command to display the “New Project” dialog box, then select the
“ActiveX Control” icon (not the “ActiveX EXE” icon) and click on the “Open”
button.
2. Add a User Control to the project: Select the Project”Add User Control menu
command, then select the “User Control” icon from the “Add User Control”
dialog box. Clicking on the “Open” button adds the User Control to the project.
3. Select the horizontal scrollbar control (HScrollBar) in the toolbox and insert it
onto the UserControl1 form.
4. Select the scrollbar control. In the Properties window, select the Max property
for this control (HScroll1) and enter the following value:
255
5. Display the Code window for UserControl1 by selecting the View”Code menu
command. In the Code window, enter the program listed in Table.
6. Close both the code window and the Object window. Visual Basic adds this
ActiveX control (UserControl1) to the toolbox.

SIMATIC Computing
6GK1971–0BA00–0AA1 A-109
SIMATIC Computing

Table A-26 Sample Program for an ActiveX Control Used with Computing

Visual Basic Code


Public Property Get Value() As Integer
Value = HScroll1.Value
End Property
Public Property Let Value (ByVal New_Value As Integer)
HScroll1.Value = New_Value
PropertyChanged ”Value”
End Property
Public Sub HScroll1_Change()
Value = HScroll1.Value
End Sub

Adding the Custom Control to a Program Using the SIMATIC Data Control
1. Open a new VB project: Use the File”Add Project menu command to display
the “Add Project” dialog box, then select the Standard EXE icon and click on
the “Open” button. Visual Basic opens a new project with an empty form in the
Object window.
The Project directory area now lists two projects: Project1 contains
UserControl1, and Project2 contains Form1.
2. Select the UserControl1 icon in the toolbox and insert it onto Form1 of Project2.
3. Add the Siemens SIMATIC Data control to the toolbox (components menu).
4. Select the Data control icon in the toolbox and insert it onto Form1 of Project2.
5. Select the Data control and click the right mouse button to bring up the pop-up
menu. From the pop-up menu, select Properties to display the “Properties”
dialog box for the Data control.
6. From the “Properties” dialog box, select the “Connections” tab. Click on the “+”
symbol to expand the list of controls.
7. Select the UserControl1 control and click on its “+” symbol to expand its
properties list.
8. Select the Value property and enter a process variable (browse button) in the
“Assigned Variable” field. Click on the “Apply” and “OK” buttons to enter the
data and close the “Properties” dialog box.

SIMATIC Computing
A-110 6GK1971–0BA00–0AA1
SIMATIC Computing

Running the Sample Program


Save the program before switching Visual Basic from Design mode to Run mode.
When the sample program runs, the custom scrollbar control that you created
reflects the changing value stored in the selected process variable.
Use the following procedure to configure the Data control for communicating with
the control engine and for running the sample program.
1. Wählen Sie das Register “Engine” zur Einrichtung der Control Engine. See
Figure A-43.
2. Select the “Direct Connect” option and enter @SimaticNet. Click on the “Apply”
button to enter the data, and then click on the “OK” button to close the dialog
box.
3. Switch Visual Basic from Design mode to Run mode to run the sample
program.

Siemens SIMATIC Data Control Properties

General Engine Connections Events Name Select the option for a direct
connection
Connect via Tag Source

Tag Source

Browse

Direct Connect
Enter@SimaticNet as the type of
control engine
PC Name

Control Engine @SimaticNet

OK Cancel Apply Help

Figure A-43 Connecting to the Control Engine (Scrollbar Control Example)

SIMATIC Computing
6GK1971–0BA00–0AA1 A-111

Das könnte Ihnen auch gefallen