[Manual] Introduction to the OPC Server for SIMATIC NET
-
Upload
rodmariana -
Category
Documents
-
view
1.162 -
download
75
Transcript of [Manual] Introduction to the OPC Server for SIMATIC NET
SIMATIC NETInt roduction to the O PC Server fo r 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 SiemensSiemens Aktiengesellschaft
Siemens Aktiengesellschaft Elektronikwerk KarlsruhePrinted in the Federal Republic of Germany
Wir haben den Inhalt der Druckschrift aufÜbereinstimmung mit der beschriebenen Hard- undSoftware geprüft. Dennoch können Abweichungennicht ausgeschlossen werden, so daß wir für dievollständige Übereinstimmung keine Gewährübernehmen. Die Angaben in der Druckschriftwerden jedoch regelmäßig überprüft. NotwendigeKorrekturen sind in den nachfolgenden Auflagenenthalten. Für Verbesserungsvorschläge sind wirdankbar.Technische Änderungen vorbehalten.
Weitergabe sowie Vervielfältigung dieser Unterlage,Verwertung und Mitteilung ihres Inhalts nicht gestattet,soweit nicht ausdrücklich zugestanden.Zuwiderhandlungen verpflichten zu Schadenersatz.Alle Rechte vorbehalten, insbesondere für den Fallder Patenterteilung oder GM-Eintragung.
6GK1971-0BA00-0AA1Copyright © Siemens AG 1997All Rights Reserved
We have checked the contents of this manual foragreement with the hardware described. Sincedeviations cannot be precluded entirely, we cannotguarantee full agreement. However, the data in thismanual are reviewed regularly and any necessarycorrections included in subsequent editions.Suggestions for improvement are welcome.Technical data subject to change.
The reproduction, transmission or use of thisdocument or its contents is not permitted withoutexpress written authority. Offenders will be liable fordamages. All rights, including rights created by patentgrant or registration of a utility or design, are reserved.
6GK1971-0BA00-0AA1Copyright © Siemens AG 1997All Rights Reserved
Nous avons vérifié la conformité du contenu duprésent manuel avec le matériel et le logiciel qui ysont décrits. Or, des divergences n'étant pasexclues, nous ne pouvons pas nous porter garantspour la conformité intégrale. Si l'usage du manueldevait révéler des erreurs, nous en tiendrons compteet apporterons les corrections nécessaires dès laprochaine édition. Veuillez nous faire part de vossuggestions.
Nous nous réservons le droit de modifier lescaractéristiques techniques.
Toute communication ou reproduction de ce supportd'informations, toute exploitation ou communication deson contenu sont interdites, sauf autorisationexpresse. Tout manquement à cette règle est illicite etexpose son auteur au versement de dommages etintérêts. Tous nos droits sont réservés, notammentpour le cas de la délivrance d'un brevet ou celui del'enregistrement d'un modèle d'utilité.
6GK1971-0BA00-0AA1Copyright © Siemens AG 1997All Rights Reserved
SIMATIC NETIntroduction to the OPC Server for SIMATIC NET
Manual C79000-B8976-C126/3
Siemens Aktiengesellschaft Elektronikwerk KarlsruhePrinted in the Federal Republic of Germany
Note
We would point out that the contents of this product documentation shall not become a part of or modify any prior orexisting agreement, commitment or legal relationship. The Purchase Agreement contains the complete and exclusiveobligations of Siemens. Any statements contained in this documentation do not create new warranties or restrict theexisting warranty.
We would further point out that, for reasons of clarity, these operating instructions cannot deal with every possible problemarising from the use of this device. Should you require further information or if any special problems arise which are notsufficiently dealt with in the operating instructions, please contact your local Siemens representative.
GeneralThis device is electrically operated. In operation, certain parts of this device carry a dangerously highvoltage.
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. Personnelmust be thoroughly familiar with all warnings and maintenance measures in accordance with theseoperating instructions.
Correct and safe operation of this equipment requires proper transport, storage and assembly as wellas 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 arefamiliar with the installation, assembly, startup and operation of this product and who possess the relevant qualifications fortheir work, e.g.:
− Training in or authorization for connecting up, grounding or labeling circuits and devices or systems in accordance withcurrent standards in safety technology;
− Training in or authorization for the maintenance and use of suitable safety equipment in accordance with currentstandards in safety technology;
− First Aid qualification.
!
Contents
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 5
Contents
1 Overv iew of the OPC Server f or 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.................222.1.1 Installing the DP Protocol ...............................................................................232.1.2 Installing the S7 Protocol ................................................................................242.1.3 Starting Up the S7 Protocol for Alarms & Events ............................................252.1.4 Installing the FMS Protocol.............................................................................262.1.5 Installing the Send/Receive Protocol for Industrial Ethernet............................282.1.6 Installing the Send/Receive Protocol for PROFIBUS (FDL) ............................302.1.7 Commissioning the DP Slave .........................................................................32
2.2 Simulation Connections of the OPC Server ....................................................332.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 f or the SIMATIC NET Data Access Interfac e..............63
Contents
Introduction to the OPC Server for SIMATIC NET6 6GK1971-0BA00-0AA1
5.1 General Information........................................................................................64
5.2 DP Protocol ....................................................................................................665.2.1 Specifications for the DP Protocol ..................................................................665.2.2 Syntax of Variable Names for DP ...................................................................675.2.3 Syntax of Variable Names for DPC1 Access...................................................705.2.4 DP-Specific Information Variables ..................................................................72
5.3 S7 Protocol.....................................................................................................765.3.1 Specifications for the S7 Protocol ...................................................................765.3.2 Syntax of Variable Names for S7 (Variable Services) .....................................785.3.3 Syntax of Variable Names for Field-Oriented Services ...................................815.3.4 Syntax of Variable Names for Messages ........................................................845.3.5 Information Variables Specific to S7...............................................................885.3.6 Special Variables for Domain and Password Services ....................................92
5.4 FMS Protocol .................................................................................................985.4.1 Specifications for the FMS Protocol................................................................985.4.2 Syntax of Variable Names for FMS ..............................................................1005.4.3 Information Variables Specific to FMS..........................................................1025.4.4 FMS Server Connection ...............................................................................106
5.5 Send/Receive Protocol via Industrial Ethernet ..............................................1075.5.1 Specifications for the Send/Receive Protocol ...............................................1075.5.2 Syntax of Variable Names for SR .................................................................1115.5.3 Information Variables Specific to SR ............................................................116
5.6 Send/Receive Protocol via PROFIBUS (FDL) ..............................................1175.6.1 Specifications for the Send/Receive Protocol via PROFIBUS (FDL).............1175.6.2 Syntax of Variable Names for FDL ...............................................................1205.6.3 Information Variables Specific to FDL...........................................................124
5.7 DPS Protocol................................................................................................1265.7.1 Specifications for the DPS Protocol ..............................................................1265.7.2 Syntax of Variable Names for DPS...............................................................127
5.8 Symbolic Variable Names (Aliases) ..............................................................131
6 Propert ies of the OPC Event Server f or SIMATIC NET ........................................133
6.1 General Information......................................................................................134
6.2 S7 Protocol...................................................................................................1356.2.1 Events and Parameters ................................................................................1366.2.2 Event Attributes............................................................................................138
7 Configu ration of th e OPC Server f or 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
Contents
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 7
7.10 Quitting the OPC Server...............................................................................163
7.11 Symbols for the OPC Server for SIMATIC NET............................................1647.11.1 The Symbol File with STEP 7 Symbols ........................................................1657.11.2 Creating a Symbol File with STEP 7 Symbols ..............................................1677.11.3 Entering Additional Symbols.........................................................................1707.11.4 Using Symbols in OPC.................................................................................172
8 Configu ration Using Fil es ......................................................................................175
8.1 Configuration Files .......................................................................................176
8.2 Configuring Access Rights............................................................................177
8.3 DP Protocol ..................................................................................................1798.3.1 General Protocol Configuration.....................................................................1808.3.2 Module-Specific Configuration......................................................................1818.3.3 Slave Configuration......................................................................................1838.3.4 Definition of Symbolic Names.......................................................................1848.3.5 Configuration of the DP Demo Connection ...................................................185
8.4 S7 Protocol...................................................................................................1878.4.1 General Protocol Configuration.....................................................................1888.4.2 Connection-Specific Configuration................................................................1908.4.3 Definition of Symbolic Names.......................................................................1938.4.4 Settings for S7 Messages.............................................................................1948.4.5 Configuration of the S7 Demo Connection....................................................195
8.5 FMS Protocol ...............................................................................................1968.5.1 General Protocol Configuration.....................................................................1978.5.2 Connection-Specific Configuration................................................................1998.5.3 Variable Definition ........................................................................................2018.5.4 Definition of Symbolic Names.......................................................................2038.5.5 Configuration of the FMS Server Connection................................................2048.5.6 Configuration of the FMS Demo Connection.................................................2078.5.7 Creating a Local Object Dictionary ...............................................................209
8.6 Send/Receive Protocol .................................................................................2108.6.1 General Protocol Configuration.....................................................................2118.6.2 Connection Configuration for a Specific Access Point...................................2128.6.3 Connection-Specific Configuration................................................................2148.6.4 Configuration of the Demo Connection .........................................................217
8.7 Send/Receive Protocol for PROFIBUS (FDL) ...............................................2188.7.1 General Protocol Configuration.....................................................................2198.7.2 Connection Configuration for a Specific Access Point...................................2208.7.3 Connection-Specific Configuration................................................................2218.7.4 Configuration of the FDL Demo Connection .................................................2238.7.5 Dynamic Connections...................................................................................224
8.8 DPS Protocol................................................................................................2258.8.1 General Protocol Configuration.....................................................................2268.8.2 Connection-Specific Configuration................................................................2278.8.3 Configuration of the DPS Demo Connection.................................................229
9 DCOM wi th t he OPC Server f or SIMATIC NET ......................................................231
9.1 Introduction to DCOM...................................................................................232
9.2 Configuring DCOM Operation.......................................................................2339.2.1 Configuration of the Server Computer ..........................................................236
Contents
Introduction to the OPC Server for SIMATIC NET8 6GK1971-0BA00-0AA1
9.2.2 Configuration of the Client Computer............................................................241
10 The OPC Custom Interface f or Data Acces s .........................................................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 CustomInterface.......................................................................................................248
10.4 The “OPC Server” Object .............................................................................24910.4.1 IOPCServer Interface...................................................................................25010.4.2 IOPCBrowseServerAddressSpace Interface .................................................25210.4.3 IOPCCommon Interface (Version 2.0) ..........................................................25410.4.4 IConnectionPointContainer Interface ............................................................25610.4.5 IOPCItemProperties (V 2.0) Interface ...........................................................257
10.5 Objects of the “OPC Group” Class................................................................25810.5.1 IOPCItemMgt Interface.................................................................................25910.5.2 IOPCGroupStateMgt Interface......................................................................26210.5.3 IOPCSyncIO Interface..................................................................................26410.5.4 IOPCAsyncIO Interface ................................................................................265
10.6 IDataObject Interface ...................................................................................26710.6.1 IEnumOPCItemAttributes Interface...............................................................26810.6.2 IAsyncIO2 Interface (Version 2.0) .................................................................26910.6.3 IConnectionPointContainer Interface ............................................................271
11 The OPC Auto mation Int erface for Data Acces s ...................................................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 AutomationInterface.......................................................................................................279
11.4 The “OPC Server” Object .............................................................................28111.4.1 Properties of "OPCServer“ ...........................................................................28111.4.2 Methods of the "OPCServer“ ........................................................................28211.4.3 Events of "OPCServer" ................................................................................285
11.5 The "OPCBrowser“ Object ............................................................................28611.5.1 Properties of "OPCBrowser“ .........................................................................28611.5.2 Methods of "OPCBrowser"............................................................................287
11.6 The "OPCGroups“ Collection Object.............................................................28911.6.1 Properties of "OPCGroups“ ..........................................................................29011.6.2 Methods of "OPCGroups“ .............................................................................29111.6.3 Events of "OPCGroups“................................................................................292
11.7 The "OPCGroup“ Object...............................................................................29311.7.1 Properties of "OPCGroup“ ............................................................................29311.7.2 Methods of "OPCGroup“...............................................................................29511.7.3 Events of "OPCGroup“ .................................................................................297
11.8 The "OPCItems“ Collection Object ...............................................................29811.8.1 Properties of "OPCItems“ .............................................................................29811.8.2 Methods of "OPCItems“................................................................................299
11.9 The "OPCItem“ Object..................................................................................30211.9.1 Properties of "OPCItem“...............................................................................303
Contents
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 9
11.9.2 Methods of "OPCItem“ .................................................................................305
12 The OPC Custom Interface f or Alarms & Eve nts ..................................................307
12.1 Supplement to the Interface Description of the OPC Custom Interface forAlarms & Events...........................................................................................308
12.2 The "OPC Event Server" Object ...................................................................30912.2.1 The "IOPCEventServer" Interface ................................................................310
12.3 The "OPC Event Subscription" Object ..........................................................31612.3.1 The "IOPCEventSubscriptionMgt" Interface..................................................317
12.4 The Interfaces of the Client ..........................................................................32012.4.1 The "IOPCEventSink" Interface....................................................................32112.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 Glossar y ..................................................................................................................329
Notes for the Reader
Introduction to the OPC Server for SIMATIC NET10 6GK1971-0BA00-0AA1
Notes for the Reader
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 11
Notes for the Reader
Guid e to theDocumentat ion
The documentation for the OPC Server for SIMATIC NET consists oftwo 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 ofthe product. You can read and print these files using a wordprocessing program capable of opening Word 6.0 compatiblefiles.
Conventions The text includes the following symbol:
This character highlight s 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 inthis release of the manual:
Produ ct Vers ion Cont ent of th e Manual
up to V2.0 OPC Data access for DP, S7, FMS,Send/Receive
V2.1 Added: OPC alarms & events, extraction of STEP7 symbols, definition of rights for OPCItems(access protection), S7 domain and passwordservices
V2.2
☞
Notes for the Reader
Introduction to the OPC Server for SIMATIC NET12 6GK1971-0BA00-0AA1
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 13
1 Overview of the OPC Server for SI MATIC NET
The open network concept of SIMATIC NET provides industrial communicationsnetworks for automation engineering. These consist of network components andprograms for network access.
This chapter provides you with an overview of the functions of the OPC server. Itillustrates the advantages of using OPC in industrial communication. The guide to thedocumentation shows you what you ought to read according to your experience and priorknowledge.
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET14 6GK1971-0BA00-0AA1
1.1 OPC Interface
OPC OPC is an acronym for OLE for Process Control and is used as thename for a standard interface for communication in automationengineering. OLE itself means the component model of Microsoft.Components are the software objects or applications that provide theirfunctionality to other applications.
OPC Interface The OPC interface is the specification of a uniform and vendo r-ind ependent software interface based on OLE. It was developed asan industrial standard by leading firms in the field of automation withthe support of Microsoft.
Previously, applications that access process data were restricted to theaccess techniques of the communication networks of onemanufacturer. The standardized OPC interface now allows a user,who, for example, operates control and monitoring software, uniformaccess to communication networks of any vendor via the OPCinterface.
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 15
OPC Specifi cation: Apart from the specification for access to process data (data access),the OPC standard includes further specifications for other areas ofautomation engineering:
• Alarms & Events• Historical Data Access
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET16 6GK1971-0BA00-0AA1
1.2 OPC Server, OPC Server for SI MATIC NET
OPC Server An OPC server is a program that provides the standardized OPCinterface for applications from various manufacturers.
Communication via industrial networks is possible with simple calls.The, at times, complicated handling of vendor-specific characteristicson 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 applicationsallowing process data, the various network protocols and interfaces foraccess to this data to be processed.
OPC Server f orSIMATIC NET
The OPC server of SIMATIC NET allows Windows applications accessto SIMATIC NET products for industrial communication. Therequirement for connecting your applications with SIMATIC NETproducts is the use of the open OPC interface. The interface to theproducts of SIMATIC NET is implemented by the OPC server forSIMATIC NET.
The OPC server for SIMATIC NET supports the interface "OPC DataAccess" for all protocols. The "OPC Alarms & Events" interface isavailable for those protocols whose protocol mechanisms support thesending of events. (For details of the product version, refer to thesection "Notes for the Reader").
Addition alSIMATIC NETCompon entsRequi red
To access process variables and receive events via the OPC serverfor SIMATIC NET, you also require a protocol software belonging toSIMATIC NET and a SIMATIC NET communications processor.
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 17
OPC Server f orSIMATIC NET withOPC Client
The following diagram illustrates an OPC server for SIMATIC NETalong with an application known as the OPC client.
The OPC server for SIMATIC NET provides the OPC client with thevalues of process variables or signals events from the partner device.The OPC server for SIMATIC NET accesses the partner device via thecommunications network using the protocol software and theSIMATIC NET communications processor.
OPC server for SIMATIC NET
Application – OPC client(e.g. operator control and monitoring)
Protocol software fromSIMATIC NET
Communications processor fromSIMATIC NET
Comm. network fromSIMATIC NET
heterogeneousOPC interface
Data Access Alarms & Events
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET18 6GK1971-0BA00-0AA1
1.3 Advantages of the OPC Se rver
Advantages whenInstalling a System
If you use the OPC server for SIMATIC NET along with theSIMATIC NET protocols, you have the following benefits:
• You use a protocol-independent interface.
• You obtain simple access to the communications networks ofSIMATIC NET.
• You can connect your programmable controllers to a wide variety ofautomation engineering applications via a SIMATIC NETcommunications network.
• Communication is also possible with office applications such asMicrosoft Excel, Access etc.
• Using the OLE mechanism “DCOM”, applications installed on othercomputers can access the services provided by the OPC server viaa local or global network (Internet).
Benefits f or theDevelop er
When you develop an application that accesses process data via theOPC interface of an OPC server for SIMATIC NET, you have thefollowing benefits:
• The OPC interface is a heterogeneous (vendor-independent)interface. This opens up a larger market for your product, increasesthe usability of your developments, and makes your investmentmore viable.
• The developed applications are not dependent on thecommunications system of one manufacturer and with appropriateprogramming can communicate unchanged with the OPC serversof other manufacturers.
• The OPC interface provides applications with a powerful means ofaccess to OPC servers and the underlying communicationsnetworks.
• OPC has a high-performance interface for the C/C++ programminglanguage.
• Convenient and simple access to process data is possible withdevelopment environments such as Visual Basic (Microsoft).
• The developer no longer needs to be involved with protocol andvendor-specific interfaces.
• Troubleshooting is simplified with the option of a trace output.
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 19
1.4 Backg roun d Knowledge
User Groups The OPC server for SIMATIC NET is used by the following usergroups:
• Developers of client applications (products for automationengineering)
• Installation personnel
If you are using OPC client applications exclusively, the followinginformation is unnecessary. The OPC client-server architecture istransparent for the user.
Back groundKnowl edge
The following table shows the required background knowledge fordifferent user groups.
Back ground Knowl edge Developers of ClientAppli cations
Installationpersonn el
Knowledge of PCs yes yes
Knowledge of the C/C++programming languages
yes, if the custominterface is used
no
Knowledge of thedevelopment environments(for example, Visual Basic)
yes, if the automationinterface is used
no
Application-specificknowledge of OLEmechanisms
yes yes, limitedknowledge
Configuration of thecommunications protocolbeing used
yes yes
Configuration of theunderlying communicationsmodule
yes yes
Knowledge of the partnerstations on the network
yes yes
Overview of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET20 6GK1971-0BA00-0AA1
1.5 Guide to the Docu mentation
Who Should ReadWhat?
Not everyone needs to read everything! A programmer naturallyrequires more information than installation personnel.
The following table recommends what each user group should read.
Source ofInformat ion
Developers of ClientAppli cations
Installationpersonn el
README yes yes
FAQ (FrequentlyAsked Questions)
yes yes
This manual(completely)
yes yes
OPC specification:Basics
yes no
OPC specification:Data AccessCustom Interface
yes, if developing withC/C++
no
OPC specification:Data AccessAutomation Interface
yes, if developing, forexample, with VisualBasic
no
OPC SpecificationAlarms & Events
yes no
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 21
2 Quick Start
This chapter explains the following:
• How to install and start up the und erlying communi cation syste m required for theOPC server
• How to use the FMS OPC server with a simulation conn ection without anunderlying communications network.
• How to familiarize yourself with the OPC server for SIMATIC NET with a quick startusing OPC Scout.
Quick Start
Introduction to the OPC Server for SIMATIC NET22 6GK1971-0BA00-0AA1
2.1 Installing and Starting up the Unde rlying Co mmunicationsSystem
Introdu ction The OPC server provides uniform access via various industrialcommunications systems. To use the OPC server, the underlyingcommunications system must be installed and configured. Thefollowing 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 notincluded in this introduction.
For details of the individual steps necessary, refer to the relevantproduct documentation.
Requi rements Before you can work through the procedures outlined below, yourequire the software products as described in the installationinstructions.
Configu ring The communications partner is configured for the SIMATIC NETprotocol software using the protocol-specific tools of thecommunications modules. The configuration tools are shipped with theunderlying protocol software, for example COM PROFIBUS for the DPprotocol.
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 23
2.1.1 Installi ng the DP Protocol
Step Procedu re
1 Installi ng the Comm unications Processor
Insert the communications processor as described in the installation instructions for themodule.
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 Con figuration
Along with the software for the DP protocol, the "COM PROFIBUS“ configuration tool wasalso installed.
Start this program so that you can create a description of your DP communications systemin a database.
When you have completed your configuration, create a binary database that can bedownloaded to the CP using the "Export => NCM File“ menu item.
3 Ass igning 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 thisaccess point (for example CP5412A2 (PROFIBUS) or CP 5511 (DP master )).
4 Configuring the Communications P rocessor
Click the "Properties“ button.
Select the tab for configuring the DP protocol and enter the path and name of the loadablebinary database (*.ldb) you have just created in the dialog that is displayed. Some modulesalso require explicit activation of the DP protocol ("DP“ check box).
Close the configuration program.
5 Testing the Comm unications 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET24 6GK1971-0BA00-0AA1
2.1.2 Installi ng the S7 Protocol
Step Procedu re
1 Installi ng the Comm unications Processor
Insert the communications processor as described in the installation instructions for themodule.
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 Con figuration
Along with the software for the S7 protocol, the "COM S7“ configuration tool was alsoinstalled.
Start this program so that you can create a description of your S7 communications systemin a database.
When possible, use only one VFD for all connections.
When you have completed your configuration, create a binary database that can bedownloaded to the CP using the "File => Generate Binary DB ...“ menu item.
As an alternative, you can also use the NCM configuration tool.
3 Ass igning 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 IndustrialEthernet, select "CP_H1_1:".
Assign the interface parameter set for the S7 mode corresponding to your module to thisaccess point (for example CP 5412A2(PROFIBUS), CP 1613 or similar).
4 Configuring the Communications P rocessor
Click the "Properties“ button.
Select the tab for configuring the S7 protocol and enter the path and name of the loadablebinary 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 Comm unications 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 25
2.1.3 Starting Up t he S7 Protocol fo r Alarms & Events
Step Procedu re
1 Installi ng and s tarting up the S7 protocol
Install and start up the S7 protocol for access to process variables as described in Section2.1.2. Close all OPC clients to quit the OPC server.
2 Opening the con figuration 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 isopened ( default: SscoreS7.txt").
3 Entering the connec tion con figuration
In the section for the connection, enter the following for the connection via which the alarmsand events will be received (for example [MyAlarmCon|MyOPCVFD|CP_L2_1:]:
Events=3 ; Ac tivate Alarm&Event mechan ism
Initi ateReq=2 ; Maintain connection permanently
4 Sever ity 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 ; Sever ity of the scan even ts is 300
DefaultAlarm=600 ; Sever ity of the alarms is 600
Scan123=200 ; The scan with ID 123 has sever ity 200
Alarm222=900 ; The alarm with ID 222 has sever ity 900
5 Saving the con figuration file
Save the configuration file and start a client for OPC Alarm & Events.
Quick Start
Introduction to the OPC Server for SIMATIC NET26 6GK1971-0BA00-0AA1
2.1.4 Installi ng the FMS Protocol
Requi rements The partner devices to be accessed on the PROFIBUS network areconfigured and can provide a short object dictionary.
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 27
Step Procedu re
1 Installi ng the Comm unications Processor
Insert the communications processor as described in the installation instructions for themodule.
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 Con figuration
The "COM PROFIBUS“ configuration tool was installed along with the software for the FMSprotocol.
Start this program so that you can create a description of your FMS communicationssystem in a database.
When possible, use only one VFD for all connections.
When you have completed your configuration, create a binary database that can bedownloaded to the CP using the "Export => NCM File“ menu item.
3 Ass igning 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 thisaccess point (for example "CP5412A2 (PROFIBUS)“ ).
4 Configuring the Communications P rocessor
Click the "Properties“ button.
Select the tab for configuring the FMS protocol and enter the path and name of the loadablebinary 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 Comm unications 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/VFDpairs 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET28 6GK1971-0BA00-0AA1
2.1.5 Installi ng the Send/Recei ve Protocol fo r Indust rial Ethernet
Requi rements The partner devices are configured on the Industrial Ethernet networkand the required handling blocks or function blocks are called.
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 29
Step Procedu re
1 Installi ng the Comm unications Processor
Insert the communications processor as described in the installation instructions for themodule.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"button.
Select the module you want to install.
2 Ass igning 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 (forexample “CP 1613“).
3 Testing the Comm unications 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 ofthe 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 theOPC Scout. When it is first started, the SR-OPC server enters default values in the textdatabase (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 ConfigurationFile". 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 connectionsusing 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 sendor 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET30 6GK1971-0BA00-0AA1
2.1.6 Installi ng the Send/Recei ve Protocol fo r PROFIBUS (FDL)
Requi rements The partner devices are configured on the PROFIBUS network and therequired handling blocks or function blocks are called.
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 31
Step Procedu re
1 Installi ng the Comm unications Processor
Insert the communications processor as described in the installation instructions for themodule.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"button.
Select the module you want to install.
2 Ass igning 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 (forexample “CP 5611 (PROFIBUS) “).
3 Testing the Comm unications 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 ofthe 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 usingthe OPC Scout. When it is first started, the FDL-OPC server enters default values in the textdatabase (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 ConfigurationFile" button. The text database for configuring the FDL-OPC server is opened with a texteditor.
In the section "[CP_L2_1: (Connections)], enter the definitions for the required connectionsusing 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 sendor 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET32 6GK1971-0BA00-0AA1
2.1.7 Commissio ning the DP Slave
Step Procedu re
1 Installi ng the Comm unications Processor
Insert the communications processor as described in the installation instructions for themodule.
Now start the "Setting the PG/PC Interface“ configuration program and click the "Install"button.
Select the module you want to install.
2 Ass igning 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 thisaccess point (for example "CP 5611 (PROFIBUS DP Slave)“ ).
3 Testing the Comm unications 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 Process ing the GSD File
The configuration of the DP slave is specified in a GSD file (*.gsd). Along with the softwarefor the DP slave, a sample file was also installed. If you want to modify the configuration ofthe slave, you must adapt this file.
For more information on the structure of a GSD file, refer to the "DP Slave ProgrammingInterface 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 DPslave 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 33
2.2 Simulation Connections of the O PC Server
Descr iption The OPC server allows you to use simulated connections for allprotocols. This connection with the fixed name "DEMO" simulates aconnection to a partner device.
Requi rements The simulatio n var iant of the OPC server for SIMATIC NET can beused without a communications processor.
This simulation connection can be activated at any time by theconfiguration program.
Properties The simulation connection has the name DEMO. The simulated deviceprovides several variables depending on the particular protocol. Youcan configure some of the properties of the simulation connectionyourself. For further information about configuring properties, refer toChapter 8
☞
Quick Start
Introduction to the OPC Server for SIMATIC NET34 6GK1971-0BA00-0AA1
2.2.1 Working wit h the Simulatio n Connection
How theConn ection Works
Before you can work with the simulation connection, this must beactivated (see below). If you have not installed underlying protocolsoftware, the simulation connection is detected automatically.
In this case, the configuration program cannot be started.
After activating the simulation connection, a virtual partner station withseveral variables is available. You can use all the OPC functions withthese slaves.
The simulation conn ection can also be started parallel to a realnetwo rk, as long as the conn ection n ame DEMO does not exist inthe real network.
Activating theSimulationConn ection
Carry out the following steps to activate the simulation conn ection ofthe OPC server for SIMATIC NET.
Step Procedu re
1 Close the OPC server
If the OPC server for SIMATIC NET is already activated, close this application.
2 Start the Con figuration Program
Start the “OPC Settings” program in the Start menu of Windows (taskbar (Start =>SIMATIC => SIMATIC NET => OPC Server => OPC Setti ngs)
3 Activate the Simulation Connec tion
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.
☞
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 35
2.3 Description of the Quick Sta rt
Int rodu ction For the quick start, you use the program “OPC Scout” to test the OPCserver for SIMATIC NET. This OPC client is a powerful Visual Basicapplication for testing and installing a system.
Range ofFunctions
With the sample program “OPC Scout”, you can do the following:
• 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, youcan get to know the principles of programming the OPC server usingthe 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.
Quick Start
Introduction to the OPC Server for SIMATIC NET36 6GK1971-0BA00-0AA1
2.4 Using the Quick Sta rt
Procedure Follow the steps outlined below to familiarize yourself with the OPCserver for SIMATIC NET using the “OPC Scout” sample program:
Step Procedure
1 Starting th e “OP C Scout” P rogram
Now start the "OPC Scout" program (Start => Programs => SIMATIC NET =>OPC Server => OPC Scout )
2 Conn ecting to th e 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.
React ion: The selected OPC server is started. This can take several seconds.
3 Creat ing a Group
In the "Add Group“ dialog, you can enter any name for a group and confirm yourentry with OK.
React ion: The name of the newly created group is displayed in the "Servers andGroups“ box below the selected server.
4 Invest igating th e Process Area
Select the group you created in the "Servers and Groups“ box and click the "AddItem" command in the "Group“ menu.
React ion: In the "OPC Navigator" dialog that appears now, you can investigate theprocess area of the OPC server. The left column shows the hierarchical structure ofthe process area. If you double-click an entry, the next level is displayed. Themiddle column lists the variables available at a level.
5 Adding OP C Items
Select the variables displayed in the middle column.
Now click the arrow "=>“. The selected variables are displayed in the right columnand 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 theselected variables and their attributes (for example value, time stamp).
Quick Start
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 37
Step Procedure
6 Writing a ValueIf you have selected a writeable variable (W or RW attribute), you can assign a newvalue 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“.
React ion: The dialog is closed. The table displays the new value and the result ofthe operation (write result).
Getting to Knowthe Rest of theProgram
You should experiment with the functions of the OPC Scout. Try outthe right mouse button when you have selected an object. With manyelements, a context-sensitive menu is displayed that illustrates whichoperations you can perform with the particular object.
Basics of OLE
Introduction to the OPC Server for SIMATIC NET38 6GK1971-0BA00-0AA1
Basics of OLE
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-AA1 39
3 Basics of OLE
The OPC interface uses OLE mechanisms to provide communication services toapplications under Windows. To develop applications either with Visual Basic or withC/C++, you must be familiar with the basic architecture of OLE. This chapter providesyou with the basic information you require about OLE to allow you to develop OPCprograms.
Basics of OLE
Introduction to the OPC Server for SIMATIC NET40 6GK1971-0BA00-0AA1
3.1 COM as the Basis for OPC
Introdu ction With OLE 1, it was possible for the first time under Microsoft Windows3.1 to combine different and basically independent applications witheach other. This represented a significant step towards modularizationof user software. With the OLE 2 standard used by OPC, Microsoft hasnot only extended OLE 1 but has also introduced a new far-reachingarchitecture and has changed the thinking behind the development ofsoftware under Microsoft Windows.
COM The basis of all OLE mechanisms is COM, the Component ObjectModel from Microsoft.
COM defines a standard that allows objects to be defined as separateunits in Windows and to access these units beyond the limits of aprocess.
Objects can be understood as extensions of the operating system.They are not dependent on programming languages and are availablein 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. Clientsare often also known as container applications.
DCOM With Windows NT, Version 4, the COM specification was extended toallow objects to be accessed outside a local computer. The objectsused by an application are distributed within a network. This extensionof COM is known as DCOM (Distributed COM).
Basics of OLE
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 41
3.2 Objects and Inte rfaces
The TermOLE Obj ect
OLE objects are units in Windows that provide other objects withdefined functions via their interfaces. OLE objects provide theirservices via defined interfaces. The “content” of the object, data andcode, remains hidden to the object user. OLE objects are defined bytheir interfaces.
The term “object” in the sense of OLE is not the same as the objectdefinition in object-oriented programming languages. OLE objects, forexample, do not support inherit functions.
Structure of anOLE Obj ect
The following diagram illustrates an OLE object with 4 interfaces (asan example). The object is accessed via only one of the interfaces. It isnot possible to access the actual object as a whole, nor the data orcode it contains. The interfaces hide the methods assigned to them.
OLE ObjectData and
code
Method 1
M1 M4M3M2
M1 M4M3M2
Basics of OLE
Introduction to the OPC Server for SIMATIC NET42 6GK1971-0BA00-0AA1
The Term Interface Objects can have more than one interface and are describedcompletely by their interfaces. The methods (object functions) can onlybe executed via the interfaces and object data can only be accessedvia the interfaces.
Objects can be used by more than one application. An interfaceconsists of a table of pointers to the actual functions.
Structure of anInterface
The following diagram illustrates the basic structure of an interface. Apointer to an interface in OLE 2.0 is a pointer to a jump table withfunction pointers.
The caller uses a pointer to the required interface. This in turn containsa pointer to a list of function pointers. These now reference the actualmethods in the OLE object.
Caller
Interface pointer
Pointer to list Function pointer M1Function pointer M2Function pointer M3Function pointer M4
Object data and code
Interface
Basics of OLE
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 43
3.3 Standa rd Representation of Objects in OLE
Descr iption A graphic representation of OLE objects is usual in OLEdocumentation. This representation is also used in this manual. Thefunctions supported by an interface are grouped together and only theinterface itself is symbolized by a circle with a line. The interface isshown together with the object that it supports. Object-specificinterfaces point to the side of the object. The IUnknown interfacesupplied with all objects is linked to the upper edge of the object.
Representat ion ofan OLE Obj ect
The diagram below clearly shows that an object is defined by itsinterfaces. The user of an object can only ever obtain access to theobject via the interfaces. A pointer to the object itself does not exist.
IUnknown
Interface AInterface BInterface C
Interface DObject X
Basics of OLE
Introduction to the OPC Server for SIMATIC NET44 6GK1971-0BA00-0AA1
3.4 Object Cont rol Via the Auto mation Inte rface
Automat ion Automation is an extension of OLE 2 that is based on the COMcomponent model. Automation makes the commands understood byobjects visible to the outside using a distributor interface. Originally,the automation interface was intended to control objects, for examplethe embedding of a graphic in a word processing program using macrolanguages.
Access f or Scr ip tLangu ages
The interfaces of COM described up to now are less suitable for therange of functions of development tools based on script languages. Byextending the OLE objects with a distributor interface, the methods ofthe objects are accessible for simple script languages. This allows thesimple embedding of an OLE object, for example in developmentenvironments such as Visual Basic, Delphi or Power Builder. Thedevelopment tools disguise all details of the object calls.
Programmable access to OLE automation servers is defined byproperties and methods.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 45
4 Basics of OPC
This chapter explains the concept of OPC. You will see the role of OLE in OPC. Thechapter also explains the concept of the OPC interface and the class model on which itis based. The chapter also provides you with more detailed information about the client-server architecture of OPC.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET46 6GK1971-0BA00-0AA1
4.1 The Role of OLE in OPC
OPC Server as Partof the Operat ingSystem
An OPC server provides a vendor-independent interface. By using theCOM component model, the OPC server becomes similar to part ofthe Windows operating system and is therefore independent of filenames, storage locations and versions.
Why OLE? These characteristics and, not least, the widespread use of MicrosoftWindows operating systems prompted the development of a vendor-independent interface based on COM and therefore also on OLE.
PowerfulDevelop mentEnvironments
A further advantage of OLE is the possibility of editing the OLE objectsin a powerful development environment (Visual Basic, Delphi andothers).
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 47
4.2 The OPC Specifications
Data Access The OPC Data Access specification is the fundamental and firstspecification of the OPC Foundation. The OPC Data Accessspecification offers functions for management of process variables andvarious opportunities for access to variables. Variables can be readand written synchronously and asynchronously. OPC Data Access alsodefines the possibility of sending a message to a client if a variablechanges.
To use an OPC variable, a client must first register the variable withthe OPC server. The client therefore defines the values and the pointsin time that are of interest to it.
The application gets a "snapshot" of the process values from the pointin time at which the read job was executed. Values between thesepoints may not be acquired by the application. When monitoringvariables, 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 isvendor-specific and effectively defines an OPC server product.
The possible variables of an OPC Data Access server could be controlvalues of a programmable controller, measured values of a dataacquisition system, or status variables of the communication system.
Alarms & Eve nts OPC Alarms & Events is an additional specification for the transfer ofprocess alarms and events. It is basically independent of the DataAccess specification.
Events are particular states in the process that need to be signaled to areceiver. All received events are signaled to the applications accordingto the selected filter criteria.
The OPC Alarms & Events specification makes a distinction betweensimple events and complex status messages. Status messages canalso require confirmation.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET48 6GK1971-0BA00-0AA1
4.3 The Two Inte rfaces of OPC
OLE Interfaces An OLE component provides objects and their methods for othercomponents or applications. These objects are accessed via the OLEinterfaces. An interface in the sense of OLE is a group of logicallyrelated functions.
Two Types ofInterface
The OPC server for SIMATIC NET supports two different types of OLEinterface:
• Automation interface
• Custom interface
Both interfaces are used for the communication between objects.
The automation and custom interfaces differ from each other in theway in which the methods of an interface are called internally. Thismeans that there are also two different interface specifications for theOPC server:
• Interface specification of the automation interface
• Interface specification of the custom interface
OPC Specifi cation: Both types of interface are possible in principle for all OPCspecifications. Both interface types are available for the basicspecification "OPC Data Access".
Only the custom interface is available for "OPC Alarms & Events".
Representat ion ofthe OPC Server
The following schematic shows an example of the types of applicationscan by used via which interfaces of the OPC server.
OPC server
Custominterface
Automationinterface
Specific vendorhardware
C/C++ application
Visual Basicapplication
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 49
When is WhichInterface Use d?
Client applications based on a script language such as Visual Basic orVBA must use the automation interface.
Applications in the C/C++ programming language should use thecustom interface for maximum performance.
It is also possible to use the automation interface in C/C++.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET50 6GK1971-0BA00-0AA1
4.4 The Class Model of OPC Data Access
Structure The OPC specification for data access groups the interfaces and theirmethods into three hierarchical classes. This structure is known as aclass m odel.
Both the automation and the custom interface of OPC Data Access arebased on this class model. The classes are implemented by OLEobjects 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
OPC-Group
OPC-Item
1:n
“ OPC Server”Class
The highest class is the OPC server class. The OPC server class hasvarious attributes that contain information about the status, the versionetc. of an OPC server object. The OPC server class also has methodswith which the client can manage the objects of the OPC group class.A client application addresses only an object of this class directly usingCOM mechanisms. The other objects are created by correspondingOPC methods.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 51
"OPC Group“Class
The “OPC Group” class manages the individual process variables, theOPC items. Using these group objects, a client can form semanticallymeaningful units of OPC items and execute operations with them.
All the process variables of machine A could, for example, be put inone 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 anoperator interface system could be put together in one group. Whenthe page is displayed, the group would be activated.
“ OPC Item” C lass An object of the class OPC item represents a link to a processvariable, for example to the input module of a programmablecontroller. A process variable is data of the process I/Os that can bewritten and/or read, for example the temperature of a tank.
An object of the server class can be considered as a container forobjects of the OPC group class.An object of the OPC group can be considered as a container forobjects of the OPC item class.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET52 6GK1971-0BA00-0AA1
4.5 The Principle of OPC Alarms & Events
Structure To be able to use the OPC Alarms & Events interface for widelydiffering sources of events, it has an extremely flexible structure. It canbe used for simple event sources that, for example, provideinformation about the failure of a system component or for complexevents requiring status messages and confirmation. Such events arespecified using conditions.Example of a condition: The temperature in a process exceeds adefined limit value.
The OPC specification defines the possible status changes forconditional events in a state diagram. For more detailed informationabout the state diagram, refer to the OPC specification.
Event Messa ges 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 OPCspecification and (where necessary) associated values specified by thevendor are also supplied.
The specification for OPC Alarms & Events defines three types ofmessages:
• Condition- Related Eventssignal the state changes defined in the OPC state model and arelinked to defined conditions
• Track ing E ventssignal changes in the process, for example resulting from userintervention. (Example: The user modifies the setpoint of acontroller)
• Simple EventsSimple events include all other events. These do not have a state.A typical simple event is the failure of a system component.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 53
OPC EventServer
OPC EventSubscription
1:n
OPC EventArea Browser
0:n
1 1
"OPC EventServer" C lass
A client application accesses the objects of the "OPC Event Server"class using COM mechanisms. This means that the application canreceive events supplied by the OPC Event server. The most importanttask of the OPC Event server is to manage the logging on of variousclients for events. The OPC Event server also provides informationabout the supported event categories and parameters.
"OPC EventSubscr iption"Class
Using the OPC Event server, a client creates one or more OPCSubscription objects. A subscription can be understood as the clientsubscribing to a group of events. Using the subscriptions, filters andother attributes are managed for the specific client.
"OPC Event AreaBrowser" C lass
OPC Alarms & Events provides the option of structuring large systemsinto areas. Areas can be used to filter events. The use of the optionalobject "OPC Event Area Browser" allows the areas to be investigated.
Conn ectionBetween Clientand Server
The following schematic illustrates the steps taken by an application tolog on for receiving messages:
111OPC Event Server
OPC EventSubscription
Client
Connection PointContainer
Connection PointOn Event
1
2
3
4
Basics of OPC
Introduction to the OPC Server for SIMATIC NET54 6GK1971-0BA00-0AA1
Step 1: Using COM mechanisms, the client creates an OPCEvent server object.
Step 2: Using the "CreateEventSubscription" method, the clientcreates an OPC Event Subscription object on theserver. When it is created, the subscription object inturn creates a Connection Point Container.
Step 3: The client uses the connection point container tolocalize the connection point for messages(IID_IOCEventSink). Using an advise, the client logs onits return call object "OnEvent" at this connection point.
Step 4: If an event occurs, the OPC Event server calls thereturn call object of the client.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 55
4.6 Group Operations
Definition The OPC specification supports group operations with various methodsfor objects of the OPC group class. A group operation means thatmore than one object can be addressed with a single method call.
Benefits f or theOPC User
It is, for example, possible to read all OPC item objects of a group witha single command by calling the OPC Data Access method “Read”. Inthe OPC Alarms & Events specification, all events are transferred bycalling the "OnEvent" function.
Group operations have the advantage that the number of processchanges that occur when methods of a software component are calledis kept low. This improves the execution speed of method calls and isparticularly advantageous when the software components are locatedon different computers or in different processes
A further advantage is that in many situations the SIMATIC NET OPCserver optimizes the access to OPC item objects in group operationsand reduces the load on the network.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET56 6GK1971-0BA00-0AA1
4.7 The Client-Se rver Architectu re of OPC
Descr iption Like all OLE implementations, OPC has a client-server architecture.The OPC server provides the OPC clients with interfaces and thereforewith defined functionality. The client can create, use and delete objectson the server via these interfaces.
Types of OLEServers
Depending on the way in which the server is linked, an OLE server canbe divided into three types:
• In-Process Server
• Local Server
• Remote Server
The calling application does not need to distinguish the type of server itaddresses. 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 isonly available for this process. Normally In-Process Servers areimplemented as DLLs. Only the OPC automation interface of the OPCserver for SIMATIC NET is implemented an In-Process Server thatimplements the automation interface. The In-Process Server accessesthe local server via the OPC custom interface.
Local Server A Local Server runs on the same computer as the client. Like everyindependent application, it has its own process and address area. TheOPC server for SIMATIC NET is a local server and is implemented asan EXE file.
Remote Server A Remote Server is located on a different computer but can beaccessed by the client via a network connection.
With the implementation, the provider of an OPC server specifieswhether the server is an in-process server or a local server. Operationas a remote server must be configured by the user.
Basics of OPC
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 57
Access toCompon ents
The following diagram shows which components of the OPC server forSIMATIC NET are accessed by various types of clients:
VisualBasic client
C/C++client
OPCIn-Proc server
Automationinterface(as DLL)
OPC localserver
Custominterface (as EXE)
Protocolsoftware
andhardware
linking
SIMATIC NET OPC Server
Terminology of the OPC Interface Description
Introduction to the OPC Server for SIMATIC NET58 6GK1971-0BA00-0AA1
4.8 Terminolog y of the OPC Inte rface Desc ription
This chapter explains certain terms used in the description of the interfaces. For acomplete description of the OPC terminology, refer to the OPC specifications located asfiles 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 pointedout in this chapter.
Terminology of the OPC Interface Description
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 59
Structure of theList
The terms are sorted alphabetically. For each turn, you can also seewhich environment the turn belongs to: OLE, OPC Data Access, OPCAlarms & Events (A&E) or Windows (see Figure Page 13).
Special Features ofthe OPC Serverfrom SIM ATIC NET
Notes relating to the characteristics of the OPC server forSIMATIC NET are enclosed in a box like this and should be readcarefully.
OLE, OPC and Windows Te rminology
Active State(OPC Data Access)
Apart from the possibility of reading or writing the values of a processvariable, an OPC server also allows process variables to be monitored.
Monitoring means that the server checks whether the value of theprocess variable has changed after a time interval (see monitoringinterval) has elapsed. If the value has changed, the new value is sentautomatically to the client. The client can control the monitoring of aprocess variable by setting the active state. Each group and each OPCitem object has the active state attribute.
If a client wants to monitor a process variable, it sets the active state ofthe 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 variablesin this group.
Alarm(OPC A&E)
An alarm is an event triggered by a condition that no longer describesthe normal state. For this reason, alarms are not given specialhandling since they are a special form of a condition.
Area(OPC A&E)
Using areas, an OPC Event server can divide up the production plantbeing monitored. The details and configuration of this division is up tothe vendor of the server. The implementation of the area concept isoptional.
The OPC Event server for SIMATIC NET does not support theconcept of areas.
Terminology of the OPC Interface Description
Introduction to the OPC Server for SIMATIC NET60 6GK1971-0BA00-0AA1
Cache(OPC Data Access)
The cache is a buffer for all variables that are referenced via OPCitems. The cache is global for all users. This means that if more thanone user references the same variable, this is stored only once in thecache.
Read operations (read or refresh) can read the data from the servercache with the option OPC_DS_CACHE.
The SIMATIC NET OPC Server manages a cache.
Categories(OPC A&E)
Using categories, the events supported by an OPC Event server canbe grouped and therefore selected. The definition of the categories isleft up to the vendor of an OPC Event server; the OPC specificationdefines a list of recommended event categories.
The categories supported by the OPC Event server for SIMATICNET are listed in Section 6.2.
Condition(OPC A&E)
A condition is a defined state of the OPC Event server. Conditions caninclude subconditions. Example: A condition of the "Level" variable isthe level alarm with the subconditions HighAlarm, HighHighAlarm,LowAlarm and LowLowAlarm.
The OPC Event server for SIMATIC NET does not supportconditions and subconditions.
Enumerat or(Windows)
Using an enumerator, it is possible to run through a collection ofobjects.
Events(OPC A&E)
An event is an occurrence that could be of interest to the client.Although events can be generated by the occurrence of a condition,they do not need to be linked to conditions. Example of events that arenot linked to conditions, are for example error messages from thecommunication system.
OPC Item-ID(OPC Data Access)
The OPC Item ID is a string that identifies the process variableuniquely.
The syntax of the ID depends on the server. The OPC item ID informsthe server unequivocally which process variable is assigned to theOPC item.
The value of the OPC item ID for the OPC server for SIMATIC NETdepends on the protocol. Section 5 describes the structure of theOPC item ID for the OPC server for SIMATIC NET.
Terminology of the OPC Interface Description
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 61
LCID(Windows)
Abbreviation for Local ID. The LCID provides information about theregional setting selected by the user for the Windows operatingsystem.
This information affects the way in which certain regional information isdisplayed. You can query the LCID using a Windows API call.
The OPC server for SIMATIC NET displays error texts either inGerman or in English.
OPCHANDLE(OPC)
OPCHANDLEs are used for groups and OPC items. They allow fastaccess 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 thesame way, servers cannot make assumptions regarding client handles.
Server OPCHANDLEs are only valid during the existence of an OPCserver object. It is therefore not possible to save them and use themagain after starting a client. A server group handle is always uniquewithin a server. An OPC item group handle is unique within a group.
Client handles must be used for asynchronous operations since theyare returned in the callback as an OPC item identification.
REFIID(Windows)
REFIID is a reference or pointer to an interface ID ( IID).
An interface ID is a unique key for an interface; with OPC for exampleinterface "IOPCItemMgt". To obtain a pointer to a particular interface,the IID of the required interface must be specified as the parameter.
Requested DataType(OPC Data Access)
By specifying the requested data type, a user can determine the datatype of a variable. If the data type is not specified explicitly by the user,the variable has the canonical data type. The OPC specificationspecifies the conversion only for scalar types. The OPC server forSIMATIC NET can also convert all data types (including arrays) toVT_BSTR.
Time Bias(OPC)
Time bias specifies the difference between the UTC time and the localtime zone. This takes into account the possibility that an OPC serverand OPC client can be distributed in a world-wide network.
Terminology of the OPC Interface Description
Introduction to the OPC Server for SIMATIC NET62 6GK1971-0BA00-0AA1
UpdateRate(OPC Data Access)
The monitoring interval “UpdateRate” specifies the interval at whichthe server checks whether the value of an OPC item has changedwhen it is monitoring this item (see “Active State”). The update rate isan attribute of a group object.
The user can set an update rate for each group. The value 0 requeststhe fastest permitted “UpdateRate”.
If the required rate is not supported, the server sends back analternative rate (“RevisedUpdateRate”) as close as possible to therequired rate.
VARIANT(Windows)
A VARIANT is a special data type that is used primarily in OLEautomation.
A variable of the type VARIANT can represent values of variousvariable types and the special values Empty, Error and Null.
Canoni cal DataType(OPC Data Access)
The canonical data type means the original data type of a variable, asrepresented internally and supplied by the OPC server.
Access Path(OPC Data Access)
The access path contains optional information for objects of the OPCItem class. The need for an access path and its interpretation dependson the particular server. When it is required, the access path indicatesthe path to be used by the server when reading or writing the data of aprocess 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 NETdepends on the protocol. Chapter 5 describes the structure of theaccess path for the OPC server for SIMATIC NET.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 63
5 Structure of the OPC Items for the SI MATIC NETData Access Interface
The OPC Server for SIMATIC NET provides standardized access to the SIMATIC NETindustrial communications networks via the OPC interface. This provides the OPC userwith an open, comprehensive, and coordinated system for communication in automationengineering.
This chapter explains how the vendor-specific characteristics of SIMATIC NETcommunication networks are put to good use due to the structure of the names of OPCvariables.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET64 6GK1971-0BA00-0AA1
5.1 General Info rmation
OPC ItemRepresentsProcess Var iable
The only class in OPC that creates a reference to a real variable fromthe process is the OPC Item class. An object of the OPC Item classrepresents a process variable. The properties of an OPC item that aretransferred to the created object with the “AddItem” call describe whichvariable is to be addressed.
The OPC specification contains no information about how theparameters should be structured. This information depends on theserver and the connected communication system.
Descr iption To describe the syntax, the following notation is used:
Convention s (not p art ofactual sy ntax)
Meaning
Pointed brackets ( < > ) Texts in pointed brackets aremandatory
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 toidentify a process variable. This involves a string with the followingstructure:
<Protocol ID>:[<Connection name>]<Variable name>
Example 1: DP:[CP_L2_1:]Slave005M00AW00Example 2: S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]EB0Example 3: FMS:[FMS_CON|VFD_OPC|CP_L2_1:]&vfdstate()Example 4: SR:[SROPC_1||CP_H1_1:]MotorExample 5: FDL:[SROPC_1||CP_H1_1:]MotorExample 6: DPS:[DPSONLINE]Motor
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 65
Proto col ID The protocol ID specifies the protocol to be used when accessing theprocess variable. This information is absolutely necessary. Theprotocol ID can be specified as an alternative with the connectionname 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)
Conn ection Name The connection name identifies the connection or communicationaccess via which the partner (DP slave or PLC) can be reached. Theconnection name must be unique within a protocol. This informationdepends on the selected protocol. The connection name can also beincluded in the “AccessPath” parameter.
Variable Name The variable name specifies the variable to be addressed and must beunique for the specified connection. The format of this parameter alsodepends on the protocol. If the protocol ID and connection name arespecified in the “AccessPath” parameter, the “ItemID” parameter onlycontains the variable name.
“ AccessPat h”Parameter
The “AccessPath” is optional information. The protocol ID andconnection name can be entered in the “AccessPath” parameter for theOPC server for SIMATIC NET.
If the “AccessPath” parameter is used, it is a string with the followingstructure:
<Protocol ID>:[<Connection name>]
Please note that in this case the information specified above must notbe part of the "ItemID" parameter.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET66 6GK1971-0BA00-0AA1
5.2 DP Protocol
5.2.1 Specificatio ns fo r the DP Protocol
Master a nd Slaves The DP for PROFIBUS protocol also specifies multi-master operation.Generally (to improve performance) it is used in single-mastersystems. For the OPC server for SIMATIC NET, the DP master is aPC with the appropriate communications processor, for exampleCP 5412 (A2). A master addresses slaves cyclically via the fieldbus.
Slaves are generally input/output modules located in a distributedconfiguration and equipped with a passive communications module.
Propert ies of theDP-OPC Server
The DP-OPC server from SIMATIC NET has the followingcharacteristics:
• Variable services access and monitoring of DPinputs and outputs
• DPC1 services acyclic transfer of datafields
• Diagnostic evaluation automatic evaluation ofstatic diagnostics
Proto col ID The protocol ID for the DP protocol is always “DP”.
Conn ectio n Name For the DP protocol, the connection name specifies the communicationaccess by specifying the communications processor thatcommunicates 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 DPVariables
Access to a DP variable (an I/O area of a slave) is achieved byspecifying the slave number (PROFIBUS address), the modulenumber and the I/O area.
DP slaves have a modular structure. A DP slave can have more thanone module with different I/O areas. The modules are assigned duringconfiguration.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 67
5.2.2 Syntax of Variable Na mes fo r DP
Overv iew The variable name identifies the input or output area in the module ofa slave. Status information of the slaves and the DP master is alsoavailable using variable names.
To describe the syntax, the following notation is used:
Convention s (not p art ofactual sy ntax)
Meaning
Pointed brackets ( < > ) Texts in pointed brackets aremandatory
Braces ( { } ) Texts in braces are optional
Syntax The syntax of the slave inputs and outputs is defined as follows (upperand lower case irrelevant):
• Inputs:Slave<address>M<number>E<format><element>{.bit}{,quantity}
• Outputs:Slave<address>M<number>A<format><element>{.bit}{,quantity}
Descr iption of theParameters
The individual parameters have the following meaning:
<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 aresupplied. Specifying the format also specifies the data type.
In principle, all specified OLE data types can be read via theautomation interface of OPC. However, certain development tools (forexample Visual Basic) only offer a restricted number of data types.The following table therefore lists the corresponding Visual Basic typein which the variable value can be represented.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET68 6GK1971-0BA00-0AA1
FormatID
Descr iption 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 (IEEE 4 bytes) VT_R4 Single
BK Consistent data as an array of bytes(unsigned 8)
VT_ARRAY ofVT_UI1
Byte() *
WK Consistent data as an array of words(unsigned 16)
VT_ARRAY ofVT_UI2
Long() *
* 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 byteaddress 4!
Specification of a bit is only permitted for type X. The address to bespecified 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 ofthe variable is an array with elements (data type VT_ARRAY) of thespecified format. If this part of the name is omitted, the quantity 1 isassumed and the data type of the variable is not an array.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 69
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition.
Do not forget, that you must always precede the variable with theprotocol ID and the module identifier (for example "DP:[CP_L2_1:]" )!
Example of Syntax Descr iption
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 bytearray
Slave004M003AWK All output data of module 3 of slave 4 as arrayof data type word
Slave004M003IReal0 The input area of slave 4, module 3 asfloating-point number
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET70 6GK1971-0BA00-0AA1
5.2.3 Syntax of Variable Na mes fo r 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 theslave. Memory areas can, for example, be used for configuration data.
When a DPC1 variable is logged on, the OPC server only check thecorrectness of the syntax but not whether the variable is valid on thepartner device based on the configuration of the DPC1 slave.
Syntax With access to DPC1 variables, the variable names are formed withthe following syntax:
Slave<address>M<slot>DPC1,{format}<index>{,quantity}
Descr iption of theParameters
The individual parameters have the following meaning:
<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 aresupplied. If no format is specified, the "byte" format is used.
FormatID
Descr iption OLE Data Type VB Type
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
<ind ex> Index of the data on the slave
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 71
{,quantit y} Number of elements. The data type of the variable is an array withelements (data type VT_ARRAY) of the specified format. If this part ofthe name is omitted, the quantity 1 is assumed and the data type of thevariable 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 theslave and cannot be checked by the OPC server.
Syntax Exam ples It is assumed that the slave supports DPC1 data with a length of 4bytes in slot 3 with index 7.
Example 1:Slave005M003DPC1,DWORD7 1 double word = 4bytes
Example 2:Slave005M003DPC1,B7,4 4 bytes
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET72 6GK1971-0BA00-0AA1
5.2.4 DP-Specific Informatio n Variables
Int rodu ction In DP, the OPC server for SIMATIC NET has variables available fordiagnostic purposes with which information about the DP master andthe connected DP slaves can be queried. The name of the informationvariable 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 M ode Using the MasterState information variable, you can query and set thecurrent mode of the DP master.
It is only possible to set the mode dependent on the DP applicationenvironment.
The following table describes the possible values (data type VT_BSTR,in Visual Basic: String):
Return Value Descr iption
OFFLINE No communication between master and slave
STOP No communication between master and slaveexcept for diagnostic data
CLEAR Parameter assignment and configuration phase
OPERATE Productive phase
Event Messa ges ofthe DP Master
Using the information variables EvAutoclear, EvWatchdog andEvClass2Master , unexpected events (system events) can be queriedduring operation.
The following table describes the possible values (data typeVT_BOOL, in Visual Basic: Boolean):
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 73
Return Value Descr iption
True Event occurred
False Event did not occur
For further information on these events, refer to the "DP ProgrammingInterface" manual.
Sign of LifeMonito ring of theCP
Using the Watchdog Timeout information variable, the sign of lifemonitoring can be set on the CP:
The following table describes the possible values (data type VT_UI4, inVisual Basic: Double):
Return Value Descr iption
0 Monitoring off
400-102000 Any value in ms. The value is roundedto a multiple of 400
6000 Default
Mode of a DPSlave
Using the SlaveXXXSlvStat e information variable, the current mode ofthe 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 Descr iption
OFFLINE No communication between masterand slave
NOT_ACTIVE DP slave is not activated
READY DP slave is in the data transferphase
READY_DIAG DP slave is in the data transferphase; diagnostic data also exist
NOT_READY DP slave is not in the data transferphase
NOT_READY_DIAG DP slave is not in the data transferphase; diagnostic data also exist
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET74 6GK1971-0BA00-0AA1
DP Slave Type With the SlaveXXXMiscSlv Type information variable, the type of theDP slave with number XXX can be queried.
The following table describes the possible values (data type VT_BSTR,in Visual Basic: String):
Return Value Descr iption
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
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 75
SlaveXXXAllInputs The AllInputs variable supplies all input bytes of a slave as an array ofbytes (data type VT_ARRAY of VT_UI1), in Visual Basic: Byte() ). Theinputs of non-standard slaves can be read using this variable.
SlaveXXXAllOutputs The AllOutputs variable supplies all output bytes of a slave as an arrayof 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 Informat ion The following information variables are not intended for productiveoperation. If problems occur, it may, nevertheless, be useful toevaluate the variables listed below. All variables are generallyassigned directly to low level DP services. These variables are read inthe same way as other information variables. The result of the call isthe byte dump of the particular low level DP service. For moreinformation about evaluating the result, refer to the manual describingthe DP interface.
The following variables are supported by the OPC server forSIMATIC NET for DP:
Informat ion V ariable Name Meaning
MiscReadBusPar Bus parameters
MiscReadCfg Types of all slaves
MiscReadSysInfo State of all slaves
MiscDpnRoleCentral Central role for thisapplication (1,0)
MiscDpnSysCentral Central application loggedon (1,0)
MiscOnTriggerWatchdog Value is incremented by 1each time the watchdogtimer is triggered
SlaveXXXMiscReadSlvParCFGData Configuration data
SlaveXXXMiscReadSlvParUserData User data
SlaveXXXMiscReadSlvParAddTab Add-Tab list
SlaveXXXMiscReadSlvParPrmData Parameter assignmentdata
SlaveXXXMiscReadSlvParTyp SI flag, type, octet string
SlaveXXXMiscSlvDiag Diagnostic data
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET76 6GK1971-0BA00-0AA1
5.3 S7 Protocol
5.3.1 Specificatio ns fo r the S7 Protocol
Communi cat ionwith S7Compon ents ofSIMATIC
The S7 for PROFIBUS and Industrial Ethernet protocol was speciallydeveloped for communication between S7 system components andbetween S7 system components and programming devices and PCs.This is a layer 7 communication protocol according to the ISO/OSIreference model.
The OPC server for SIMATIC NET requires underlying S7 protocolsoftware from SIMATIC NET and a suitable communicationsprocessor.
Before starting S7 communication, an S7 database must be created.Suitable configuration tools are shipped with the protocol software.
Propert ies of theS7-OPC Server
The S7-OPC server from SIMATIC NET has the followingcharacteristics:
• Variable services access and monitoring of S7variables
• Field-oriented services program-controlled transferof larger fields of data
• S7 messages processing of S7 messages (S7scans)
• Server functionality In field-oriented services, thePC can also be used asserver.
• Domain services Transfer of a loadable dataarea from and to S7
• S7 password functions Setting a password to accessprotected domains
• Events Processing of S7 messages(S7 scans, S7 alarms) as OPCAlarms & Events
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 77
Establi shingConn ections
The S7 protocol is a connection-oriented transport protocol. Aconnection-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 forSIMATIC NET automatically and is not visible for the OPC user.
When an OPC item is accessed or as a result of browsing, the OPCserver establishes the connection to the partner device, as necessary.
The connection name must be specified in the ItemID or in theAccessPath of the OPC item and must be configured in the S7database.
Proto col ID The protocol ID for the S7 protocol is always “S7”.
Conn ectio n 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 ofthe application
These parts are separated by the “|” character.
The name of the S7 connections and the VFDs are specified duringconfiguration. If only one CP/VFD pair is selected, the information onthe access point and VFD can be omitted.
The name of the communications processor or the access point of theapplication is specified by configuration tools of the protocol software.Typical names are:
• "CP_L2_1:“
• "CP_H1_1:"
• "S7ONLINE“
Examples ofConn ectio n Names
Three examples of connection names are listed below:
• My_connection|My_VFD|CP_L2_1:
• S7-OPC_conn|VFD1_OPC|CP_H1_1:
• PLC_314_conn|VFD2|S7ONLINE
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET78 6GK1971-0BA00-0AA1
5.3.2 Syntax of Variable Na mes fo r S7 (Variable Services)
Overv iew The variable name identifies the variable to be accessed on theprogrammable controller. The type of access is based on the notationof the S7 tools. Objects supported on the S7 OPC server are asfollows:
• 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 programmablecontroller.
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:
Convention s (not p art ofactual sy ntax)
Meaning
Pointed brackets ( < > ) Texts in pointed brackets aremandatory
Braces ( { } ) Texts in braces are optional
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 79
Descr iption of theParameters
The individual parameters have the following meaning:
Parameter Descr iption
DB or DI Data or instance data block
<no> Number of the data or instance data block
<object> The following objects exist:
Object Descr iption
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 thecorresponding OLE data type in the OPC server for SIMATIC NET.
S7 Data Types Descr iption OLE DataType
VB Type
X Bit (bool), bit numbermust be specified
VT_BOOL Boolean
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,character string lengthmust be specified
VT_BSTR String
<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 addressspecified in the "byte address" parameter. It is not possible to specify aquantity for data type X.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET80 6GK1971-0BA00-0AA1
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition.
Do not forget that you must always precede the variable with theprotocol ID and the connection!
Example of Syntax Descr iption
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 30characters (= 32 bytes incl. length prefix) fromaddress 7
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 81
5.3.3 Syntax of Variable Na mes fo r Field-O riented Services
Overv iew With the field-oriented services for the S7 protocol, the OPC serverprovides 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, theconnection must be configured at both ends. In contrast to the non-field-oriented services, the connection configuration created with STEP7 NETPRO must be downloaded to the PLC. In the field-orientedservices, a pair of blocks BSEND and BRCV are always required.Either there is a BSEND block on the SIMATIC S7 PLC thatcommunicates with a BRCV variable of the OPC server (PLC sends toOPC server) or a BRCV block is programmed on the SIMATIC S7 PLCthat receives data from the BSEND variable of the OPC server.
The amount of data that can be transferred in this way is up to 65534bytes,regardless of the size of the CPU. The segmentation of the datais handled by the function itself.
SyntaxBlock Rece ive
The syntax for variables that can receive fields of data is defined asfollows: (the part in braces is optional)
BRCV,<RID>{,<type><byte address>{,<quantity>} }
SyntaxBlock Send
The syntax for variables with which data fields can be transferred fromthe PG/PC to the partner is as follows:
BSEND<length>,<RID>{,<type><byteaddress>{,<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 thesending partner. For this reason, the data field is transferred as defaultin the data type "VT_ARRAY | VT_UI1" (byte array). The variable canonly be read.There is no practical value in monitoring this variable. The reception ofa 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 partnerdevice. The buffer is only transferred to the partner when the variableitself or a subvariable is written. The value of the send variable that isread is the last value entered in the send buffer. The data are not readfrom 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.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET82 6GK1971-0BA00-0AA1
Address ingParameter R ID
The addressing parameter R_ID is fixed for a block pair (BSEND/BRCV) and is specified uniquely within a connection. This means thatseveral BSEND blocks can send on one connection but always withtheir 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 moresections of the data field can be selected and assigned to individualvariables.
When accessing data blocks, a defined notation can be used. Sincethe length of a received field is unknown, it is also permissible todefine variables outside the received field. If variables are not filled outor are filled out only partly by the received data field, the quality of theitem changes to "BAD".
If a subvariable is written, the complete buffer is always transferred tothe partner device. When writing with structured access, subvariablesshould always be created on a send field in an OPC group. To preventthe transfer of uninitialized areas, the subvariables should alwayscover the entire send field and all items of a group should be written atthe same time.
{type} If you specify "type" the S7 data type is specified. This is converted to thecorresponding OLE data type in the OPC server for SIMATIC NET.
S7 Data Types Descr iption OLE DataType
VB Type
X Bit (bool), bit numbermust be specified
VT_BOOL Boolean
B Byte (unsigned) VT_UI1 Byte
W Word (unsigned) VT_UI2 Long
D Double word (unsigned) VT_UI4 Double
CHAR Byte (signed) VT_I1 Integer
INT Word (signed) VT_I2 Integer
DINT Double word (signed) VT_I4 Long
REAL Floating point VT_R4 Single
<byte address> Address in bytes within the send or receive data field, <byte number>, forexample DWORD5 or <byte number>,<bit>, for example X1.1. The addressstarts at 0.
{quantity} Number of variables of a type to be addressed starting at the addressspecified in the <byte address> parameter. It is not possible to specify aquantity for data type X.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 83
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition.
Do not forget that you must always precede the variable with theprotocol ID and the connection!
Example of Syntax Descr iption
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 withR_ID 2
BRCV,1,W2,4 4 words (unsigned 16) from byte 2 in thereceive buffer with R_ID 1
BSEND16,1,D2 Double word (unsigned 32) starting at byte 2in send buffer with R_ID 1 with size 16
BSEND32,1,CHAR2,4 4 characters (signed 8) starting at byte 2 insend buffer with R_ID 1 with size 32
BSEND32,1,DINT2,8 8 Double words (unsigned 32) starting at byte2 in send buffer with R_ID 1 with size 32
BSEND32,1,REAL2,2 2 floating-point (real) numbers starting at byte2 in send buffer with R_ID 1 with size 32
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET84 6GK1971-0BA00-0AA1
5.3.4 Syntax of Variable Na mes fo r Messages
Overv iew S7-400 controllers allow automatic monitoring of bits and the transferof a message to a communications partner if the monitored datachange. Along with the event message, up to 10 associated values canbe transferred depending on the S7-CPU.The OPC server provides the received message information and theassociated values as variables. With the possibility of monitoringvariables, user programs can be informed of the occurrence ofmessages.The use of messages has the following advantages:
• No bus load from cyclic polling of variables; load only when achange has really occurred
• Transfer of additional information with the message
Configu ring S7 messages must be configured with STEP 7 and downloaded to theS7 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 theOPC 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 thelength of the data record is also available.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 85
Syntax ofMessage Variables
The message data can be accessed via the following OPC items:
Syntax Descr iption
scan,<EvID>,eventstate State of the bit to be monitored. Data typeVT_UI2, VB type long
Bit Descr iption
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 beacknowledged via a different system, theacknowledgment state is shown here. Datatype VT_UI2, VB type long
Important note:
The OPC server does not provide anymeans of acknowledging these messages,however, other "display devices" could dothis.
Bit Meaning
0 Acknowledgment ofmessages (entered state)
8 Acknowledgment ofmessages (left state)
Explanation of the term entered state/leftstate with messages:
Message entered state: e.g. limit valueexceeded
Message left state: e.g. limit value nolonger violated
scan,<EvID>,noaddvalue Number of associated values supplied withthis message. Data type VT_UI2, VB typelong
scan,<EvID>,pctime Time the message was received by theOPC server. All message variables containthe value generated by the S7 controller asthe time stamp. This variable allows theclocks of the S7 controller and the PC tobe compared. Data type VT_DATE (VBtype date)
<EvID> Normalized message number assigned for this message duringconfiguration with STEP 7.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET86 6GK1971-0BA00-0AA1
Syntax ofAssociated Values
Access is possible to the associated values via the following OPCitems:
Syntax Descr iption
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 valueacquisition
3 Boolean
4 Bit string
5 Integer
6 Octet string
scan,<EvID>,data<N>,value Value of the nth associated value. Datatype VT_Array with the possible typesVT_BOOL, VT_I2, VT_I4, VT_UI1,VT_ERROR (VB types Boolean, integer,long, byte, error). If a single value istransferred, the array has only one entry.
scan,<EvID>,data<N>,valuelen Length of the nth additional value inbytes. Data type VT_UI2, (VB type long)
scan,<EvID>,data<N>{,S7syntax}
Value of the nth additional value in apreset data type. Alternate access is alsopossible. The S7 syntax is described, forexample 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, onlythe associated values are updated that were actually transferred withthe message. The "quality" of the associated values not supplied withthe message is set to "bad".The number of associated values supplied with a message is providedby the variable "scan,<EvID>, noaddvalue".
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 87
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition for messages.
Do not forget that you must always precede the variable with theprotocol ID and the connection!
Example of Syntax Descr iption
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 arrivedwith 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 themessage 1, represented as a byte array
scan,1,data0,value Value of the associated value 0 of themessage 1, represented as an array with adata type corresponding to the associatedvalue
scan,1,data9,dword0 Value of the 9th associated value of themessage 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 themessage 1, bit 1 of the byte address 0 isevaluated and represented as Boolean
scan,1,data7,valuelen Length of the data buffer supplied asassociated value 7 for message 1
scan,1,data7,datatype S7 data type of the associated value 7 formessage 1
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET88 6GK1971-0BA00-0AA1
5.3.5 Informatio n Variables Specific to S7
Int rodu ction For monitoring purposes, the OPC server for SIMATIC NET providesvariables for S7 with which information about the S7 communicationand the established connections can be queried. The name of theinformation variable must be specified in the parameter ItemID of anOPC 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
Att ribut es of aVirtual Device
A virtual device (VFD - virtual field device) is the model of a realdevice. The &Identif y() information variable provides informationabout the vendor attributes of a device.
The type of the information variable &Identify() is a VT_ARRAY ofVT_BSTR (VB type string) and contains 3 components:
<vendor>
<model>
<revision>
ExampleThe 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 "}
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 89
Status of a VirtualDevice
The “&vfdstate() ” information variable is used to query the status of adevice.
The status value (type VT_ARRAY of VT_VARIANT, VB type stringwith 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_ARRAYof VT_BSTR).
The parts of the &vfdstate() information variables can have thefollowing values:
Logi cal StatusThe logical status indicates which services are supported:
Return Value Descr iption
S7_STATE_CHANGES_ALLOWED All services are permitted.
Physical StatusThe physical status indicates the operating status of the real device.
Return Value Descr iption
S7_OPERATIONAL The real device is operational.
S7_NEEDS_COMMISSIONING The real device is only operationalafter local settings have beenmade.
Detailed local stat us
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. Thedescription 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"}
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET90 6GK1971-0BA00-0AA1
Conn ection St atus The "&state path()" and "&state pathval()" information variablesprovide 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&statepath()
Return Value&statepathval()
Descr iption
DOWN 1 Connection is not established
UP 2 Connection is established
RECOVERY 3 Connection being established
ESTABLISH 4 (Reserved for future expansions)
ExampleThe Item "S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:] &statepath( ) "could, for example, provide the following:
"RECOVERY"
State of th e Logonfor Messa ges
The "&stateeve nt() information variable provides the status of thelogon for the message services. While the variable &stateeventrepresents the result as a string, &stateeventval returns a number (typeVT_UI1, VB type byte).
The possible values of the information variable &stateevent()(type VT_BSTR, VB type string) are as follows:
Return Value&stateevent()
ReturnValue&stateeve ntval()
Descr iption
NONE 0 No logon for message services
ESTABLISH_SCAN 1 Logon for ALARM messageservices active
SCAN 2 SCAN message services arelogged on
ESTABLISH_ALARM 3 Logon for alarm services active
ALARM 4 ALARM message services arelogged on
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 91
ExampleThe Item "S7:[OPC_1|VFD1_OPC|CP_L2_1:]&stateevent( ) "could, for example, provide the following:
"SCAN"
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET92 6GK1971-0BA00-0AA1
5.3.6 Special Variables fo r Domain and Passwo rd Services
Int rodu ction A domain represents a loadable data area on a programmablecontroller. In SIMATIC systems these are the following loadableblocks:
• 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 beviewed using the online functions of STEP 7, the block cannot beopened.This is first possible after the block has linked into the list of activeblocks.
Available Serv ices Using special variables of the S7-OPC server, the following servicesare available for handling loadable areas:
• Downloading blocks from the PC to the programmablecontroller.
• Uploading blocks from a programmable controller to thePC.
• Deleting, linking blocks and compressing memory of theprogrammable controller.
Appli cation The domain services allow the transfer and retransfer of data andprogram elements between the PC and programmable controller. Onthe PC, the loadable areas are saved in files.To allow a program element to be transferred to the programmablecontroller, it must first be downloaded from the programmablecontroller 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 aprogrammable controller from an operator control and monitoringstation, the algorithms could be stored in different variants of afunction block. The function block is swapped over during operationusing the domain services controlled from an operator station to obtaina different program function on the programmable controller.The various variants of the function block must be generated when thesystem is created and stored in different files.
Password Serv ices Write and read access to the CPU can be made dependent on theknowledge of a password. The priority of the password is higher thanthat of the keyswitch of the CPU. With the – password – service, apassword can be transferred to a programmable controller aslegitimization.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 93
Read blo ck With the special variable &blockrea d(), a block can be transferredfrom a programmable controller to a file on the PC.
This variable can only be written. Writing a value triggers the transferservice.
The written value contains the parameter assignment of the service. Itis 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 filealready exists, this is not overwritten(error message)
0x1001 Reads an unlin ked block, an existingblock is overwritten.
0x1040 Reads a linked block, an existing blockis overwritten.
Block String Block type and number. The following types arepossible: OB, DB, FC and FB.Example: DB10
File String Full path of the file in which the block will bestored.
ExampleTo 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 isconverted to the canonical data type by the OPC server.)
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET94 6GK1971-0BA00-0AA1
Write blo ck With the special variable &blockwrite(), a block can be transferredfrom a PC to a programmable controller. This variable can only bewritten. Writing a value triggers the transfer service.
The written value contains the parameter assignment of the service. Itis 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 namealready on the programmable controlleris not overwritten.
File String Full path of the file in which the block is stored.
ExampleTo send the block in file "c:\temp\ob1.blk" to the programmablecontroller, 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 isconverted to the canonical data type by the OPC server.)
Note After transfer to the programmable controller, the block is not yetactive. It must first be linked into the list of active blocks by using thespecial variable &blocklinkin().
Lin k in blo ck Using the special variable &blo cklin kin() , a block can be linked infrom the passive state into the active program of the programmablecontroller. The block is then available for the active program.Remember that by linking in a block, an existing active block isoverwritten 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 forthis service.
Element Data Type Description
Block String Block type and number. The following types arepossible: OB, DB, FC and FB.Example: DB10
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 95
ExampleTo link block DB1 in the program execution of the programmablecontroller, the item"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blocklinkin( ) "must be written with the following value:
DB1
Delete blo ck Using the special variable &blockdelete(), a block can be deleted onthe programmable controller. Both the passive blocks and those linkedinto 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. Itis 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 unlin ked block
0x0040 Deletes the linked block
0x0041 Deletes the linked and unlinked block
Block String Block type and number. The following types arepossible: OB, DB, FC and FB.Example: DB10
ExampleTo 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 &blockc ompress() , the memory on theprogrammable controller can be compressed.
Fragmented memory areas are shifted together and space created forthe transfer of new blocks.
This variable can only be written. Writing an empty string triggers theservice.
ExampleTo compress memory, the item"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&blockcompress( ) "must be written with an empty string ("").
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET96 6GK1971-0BA00-0AA1
Transfer password Using the special variable &password(), the password for aconnection can be sent to legitimize and cancel the level of protection.
For an S7 programmable controller, three levels protection can beactivated 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 listedabove are canceled for the connection on which the password wassent. By sending an empty string as password, the protection functionis activated again on the connection.
On bilaterally configured connections, all services can be executedeven in the RUN key position.
Conn ectionsconfigu red atone end
Resulting active protection level
Password was nottransferred
Correct password wastransferred
Keyswitch setting Keyswitch setting
Protectionlevelconfigured bySTEP 7
RUN RUN-P
STOP
RUN RUN-P
STOP
KeyswitchRUN - can becanceled bypassword
2 1 1 1
KeyswitchRUN - cannotbe canceledby password
2 1 2 1
Writeprotection withpassword
2 2 1 1
Write/readprotection withpassword
3/3 3/3 1 1
Legend:
Resulting active protection level
1: No restriction (read, write, link, delete block, and compresspossible).
2: Read block only
3: No block function allowed.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 97
The &password() variable can only be written. Writing a variabletriggers transfer of the password. The data type of the variable isstring.
The password can be transferred in the following representations
Representation Description Example
Octet string A string with thehexadecimal codesof the characters ofthe password(maximum 8characters),separated by aperiod
31.32.33.34.35.36.37.38
String Any alphanumericstring with amaximum length of 8characters precededby the character "&".
&12345678
OPC Error Codes If the following error codes occur in conjunction with passwords, theyhave the following significance:
The OPC server returns the error code OPC_E_BADRIGHTS when aninvalid password was sent. Otherwise, the error codeOPC_E_COMMUNICATION is returned.
Further error codes are also possible.
ExampleTo send the password "SetMeFre" to a programmable controller, thevariable"S7:[S7-OPC_1|VFD1_OPC|CP_L2_1:]&password( ) "must be written with the following value:
&SetMeFre
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET98 6GK1971-0BA00-0AA1
5.4 FMS Protocol
5.4.1 Specificatio ns fo r the FMS Protocol
OpenCommuni cat ionwith FMS
The FMS for PROFIBUS protocol is an open layer 7 communicationsprotocol based on the ISO/OSI reference model. With FMS,communication at the fieldbus level is possible not only with S5 and S7programmable controllers from Siemens but also with all other devicesthat meet the FMS standard.
The FMS-OPC server of SIMATIC NET requires an underlying FMSprotocol software from SIMATIC NET and a suitable communicationsprocessor.
Before starting FMS communication, an FMS database must becreated. Suitable configuration tools are shipped with the protocolsoftware.
Character ist ics ofthe FMS-OPCServer
The FMS-OPC server from SIMATIC NET has the followingcharacteristics:
• 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 shortOD 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
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 99
Establi shingConn ections
The FMS protocol is a connection-oriented communication protocol. Aconnection-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 forSIMATIC NET automatically and is not visible for the OPC user.
When an OPC item is accessed or as a result of browsing, the OPCserver establishes the connection to the partner device, as necessary.
The connection name must be specified in the ItemID or in theAccessPath of the OPC item and configured in the FMS database.
Proto col ID The protocol ID for the FMS protocol is always "FMS“.
Conn ection 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 ofthe application
These parts are separated by the “|” character.
You specify the names of the FMS connections and the VFDs duringconfiguration.
If an element of the connection name in the configuration is unique, itcan be omitted. If, for example, you have only configured the accesspoint "CP_L2_1:“ with one VFD_OPC, it is adequate to specify onlythe FMS connection.
The name of the communications processor or the access point of theapplication is specified by configuration tools of the protocol software.Typical names are:
• "CP_L2_1:“
• "CP_L2_2:“
Examples ofConn ectio n Names
Three examples of connection names are listed below:
• Simocode|VFD_OPC|CP_L2_1:
• S5_5431|VFD1_S5|CP_L2_2:
• Connection|VFD1|access
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET100 6GK1971-0BA00-0AA1
5.4.2 Syntax of Variable Na mes fo r FMS
Function The variable name identifies the variable to be accessed on thepartner device. FMS variables are accessed using the names that existin the object dictionary of the partner device. If the partner deviceprovides a short object dictionary, it is only possible to accessvariables using indexes. If a long object dictionary is provided, thesymbolic names contained in the object dictionary can also be used.
Syntax of theVariable Names
The syntax of a variable is defined as follows, upper and lower casecharacters are irrelevant:
<index> or
<symbolic name>
For alternate access to structure elements, the syntax is defined asfollows:
<index>:<subindex> or
<symbolic name>:<subindex>
Syntax Exam ples Several examples of syntax with the connection component are listedbelow to illustrate the above definition.
Example of Syntax Descr iption
FMS:[DEMO]100 Variable with Index 100 of the Democonnection
FMS:[DEMO]Valve_In Variable with the name "Valve_In" of thedemo connection
FMS:[CR1|VFD1|CP_L2_1:]200
Variable with Index 200 of the connectionCR1 via VFD1 to module CP_L2_1:
FMS:[CR1|VFD1|CP_L2_1:]Count
"Count" variable of the connection CR1via VFD1 to the module CP_L2_1:
FMS:[CR1|VFD1|CP_L2_1:]200:2
Access to 2 structure elements of thevariable with index 200
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 101
FMS Types The following table describes the FMS data types and thecorresponding VARIANT data types.
FMS data type Canoni calOLE data type
VB Type Meaning
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 ofcharacters
bstringX VT_BSTR String Bit string, X: Number of bits,structure: "b.b.b.b.b.b" where b=0or 1
ostringX VT_BSTR String Octet string, X: Number of octets,structure: "hh.hh.hh.hh.hh" whereh=0..f
time_of_day VT_DATE Date time of day
date VT_DATE Date date
time_difference VT_DATE Date time difference
data type[N] VT_ARRAY ofelement type
Array of the VBelementarytype
FMS array as a safearray with Nelements of the type element type.*
{Type1|Type2|Type3|Type4}
VT_ARRAY ofVT_VARIANT
Array withelements ofthe respectiveelementarytypes
FMS structure with 4 differentdata types Type1..Type4. *
* Default setting VT_BSTR
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET102 6GK1971-0BA00-0AA1
5.4.3 Informatio n Variables Specific to F MS
Introdu ction The OPC server for FMS provides variables for with which informationabout the FMS communication system and the connection states canbe queried. The name of the information variable must be specified inthe 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)
Att ribut es of aVirtual Device
A virtual device (VFD - virtual field device) is the model of a realdevice. The &Identif y() information variable provides informationabout the vendor attributes of a device.
Type of the information variable &Identify() is a VT_ARRAY ofVT_BSTR (VB type: string array ) and contains 3 components:
<Hersteller>
<Modell>
<Revision>
ExampleThe 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 "
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 103
Status of a VirtualDevice
The “&vfdstate() ” information variable is used to query the status of adevice.
The status value (type VT_ARRAY of VT_VARIANT, VB type: arraywith 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 thefollowing values:
Logi cal StatusThe logical status indicates which services are supported:
Return Value Descr iption
FMS_STATE_CHANGES_ALLOWED All services arepermitted.
FMS_LIMITED_SERVICES_PERMITTED Only the services“Status virtual device“and “Identify virtualdevice“ are permitted
FMS_OD_LOADING_NON_INTERACTING Loading an objectdictionary is notpermitted.
FMS_OD_LOADING_INTERACTING An object dictionary iscurrently being loadedon the interfacemodule.
Physical StatusThe physical status indicates the operating status of the real device.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET104 6GK1971-0BA00-0AA1
Return Value Descr iption
FMS_OPERATIONAL The real device isoperational.
FMS_PARTIALLY_OPERATIONAL The real device isoperational withcertain restrictions.
FMS_NEEDS_COMMISSIONING The real device is onlyoperational after localsettings have beenmade.
FMS_INOPERABLE The real device is notoperational.
Detailed local stat us
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. Thedescription 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 "}
Conn ection St atus The "&state path()" and "&state pathval()" information variablesprovide 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&statepath()
Return Value&statepathval()
Descr iption
DOWN 1 Connection is not established
UP 2 Connection is established
RECOVERY 3 Connection has broken down
ESTABLISH 4 Connection being established
Example 1The item "FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&statepath( ) “could, for example, provide the following:
"UP"
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 105
Example 2The item"FMS:[FMS_CON|VFD1_OPC|CP_L2_1:]&statepathval( ) “ could,for example, provide the following:
2 (corresponds to "UP"):
Lif eli st The "&lif eli st()“ information variable provides information about thenodes available on the bus.
The value of these variables is provided as VT_ARRAY of VT_UI1 (VBtype: array with 127 elements of the type byte). The array with its 127elements includes information about every possible station address.Each station address is assigned an index of the array. Possible valuesfor one entry are as follows:
Return Value Descr iption
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 tokenring of PROFIBUS (value 2)
FMS_STATION_ACTIVE Active node (value 3)
ExampleThe 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}
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET106 6GK1971-0BA00-0AA1
5.4.4 FMS Server Connection
Int rodu ction The FMS-OPC server can itself operate as a server in the sense of theFMS protocol. As an FMS server, it provides variables and an objectdictionary 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 anFMS configuration. The variables of this server connection that canaccess other FMS partner devices must be described in aconfiguration file. For details of configuring a server connection, referto Section 8.5.5.
Please note the following: So that an FMS server is available, the OPCserver on this computer must be started by using an OPC clients (forexample OPC Scout).
The variable stipulated in the server connection are available via theOPC interface as OPC items in the same way as the variables ofanother device. If a server variable is written via the OPC interface,the value of the variable is only changed locally. This new value istransferred to the querying device the next time an FMS client queriesthe value. Reading a server variable via OPC returns the current, localvalue. This value can be modified by write access from an FMS client.Changes to values made by an FMS client are reported to an OPCclient using the OPC mechanisms for reporting value changes.
Diagram The following diagram illustrates how an FMS partner device canaccess variables defined on the OPC server.
PROFIBUS network
Textdatabase
OD
Partnerdevice
PC withOPCserver
FMS clientFMS server
Access to FMSvariables
Localaccess
☞
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 107
5.5 Send/Recei ve Protocol via Indust rial Ethe rnet
5.5.1 Specificatio ns fo r the Send/Recei ve Protocol
Communi cat ionvia Indu strialEthernet
The Send/Receive (SR) protocol for Industrial Ethernet is a layer 4transport protocol according to the ISO/OSI reference modelstandardized for SIMATIC devices. With Send/Receive,communication is possible via Industrial Ethernet to S5 and S7programmable controllers from Siemens and to PCs on which the SRprotocol is installed.
The SR-OPC server of SIMATIC NET requires an underlying SRprotocol software from SIMATIC NET and a suitable communicationsprocessor. The SR protocol software is part of the S7 products ofSIMATIC NET.
Principl e ofCommuni cat ion
The SR protocol communicates with handling or function blocks thatare running on a programmable controller. The following block types orjob 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 SENDblock and the RECEIVE block. The SEND block always initiatescommunication. For bi-directional communication, both a SEND and aRECEIVE block must be called at both ends.
If FETCH is selected as the job type (corresponds to the READfunction in S5), source parameters can be provided with a send jobthat are used by the S5 communications processor to read and readback data directly from the CPU. With this type of job, direct access toobjects such as inputs, outputs, data blocks, memory bits (flags) andcounters is possible.
For more detailed information about the Send/Receive interface, referto the manual "Send/Receive Programming Interface“ and thedocumentation of the programmable controller.
Configu ring The configuration of Send/Receive communication is not created usingan additional configuration program on the PC. The communicationparameters must be configured in a text file used by the SR-OPCserver.
A SIMATIC S5 partner device handles communication using handlingblocks (HDBs). The handling blocks must be called in the S5 program.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET108 6GK1971-0BA00-0AA1
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 suitableconnection configuration of the communications processor of theprogrammable controller is necessary.
Character ist ics ofthe SR-OPC Server
The SR-OPC server of SIMATIC NET has the following characteristics:
• Communication via SIMATIC S5 handling blocks and S7 functionblocks
• 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
Proto col ID The protocol ID for the Send/Receive protocol is always "SR“.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 109
Conn ectio n Name The connection configuration for the Send/Receive protocol is notcreated as with the other protocols in a database assigned to the CPand written with special configuration tools, but must be createdspecifically for each user program.
The SR-OPC server uses a text file for connection configuration inwhich the connections and variables to be used by the OPC server areentered by the user.
A symbolic name is declared for each connection that must also beused in the designations of the OPC items. For further informationabout 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 ofthe application
These parts are separated by the “|” character. The symbolic name orthe connection parameters are used as alternatives. The pipecharacter to separate them must always be specified.
Conn ectionParameters
The information for the connection parameters is made up as follows:
<LocalTSAP>,<HostID>,<RemoteTSAP>,<ActiveFlag>
LocalTSAP Name of the local TSAP. Two notations are possible:
1) Hexadecimal notation: xx.xx.xx.xx.xx.xx.xx.xxMaximum 8, two digit, hexadecimal values separated by periods.
2) String notation: &TTTTTTTTLeading & character followed by a maximum 8 printable characters.The comma must not be used. If you want the TSAP to containnonprintable characters, the comma or the pipe character, use thehexadecimal notation.
Host ID Ethernet or TCP/IP address of the partner station. Depending on thenetwork type, two different notations are distinguished:
1) Ethernet address: xx.xx.xx.xx.xx.xxExactly 6 2-digit hexadecimal numbers, separated by periods
2) TCP/IP address: yyy.yyy.yyy.yyye.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 theLocalTSAP parameter
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET110 6GK1971-0BA00-0AA1
ActiveFlag Controls the connection establishment. Possible values:
0 Passive connection establishment, the partner establishes theconnection.
1 Active connection establishment, the partner waits forconnection establishment.
Access P oint The name of the communications processor or the access point of theapplication is specified by the configuration tools of the protocolsoftware. Typical names are:
• "CP_H1_1:"
• "CP_H1_2:“
• "S7ONLINE“
Examples ofConn ectio n Names
Examples of connection names are listed below:
• |&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|S7ONLINEActive connection establishment, ISO protocol via S7ONLINEaccess, alternative notation of the TSAP
• MyConnection||CP_H1_1:Use of a symbolic name "MyConnection“ from the text file viaaccess point CP_H1_1:
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 111
5.5.2 Syntax of Variable Na mes fo r SR
Function The variable name identifies the variable to be accessed on thepartner device. SR variables are accessed using fixed names oraliases corresponding to the job types.
If this is supported by the partner device, direct access to the addressarea is possible. This functionality is currently only available for S5programmable controllers and is identified by the job types FETCH andWRITE in the S5 connection configuration.
Variable Names The following variable names are specified for each connection:
• RECEIVE
• receiveexp
• send
• sendexp
receive /receiveexp
The complete syntax for the variables for reading out the receivebuffer is as follows:
receive{,validvariablesyntax}
receivexp{, validvariablesyntax}
The "receive“ variable contains the last data buffer received from thepartner. The structure and length of the data buffer is not fixed. Thebuffer is therefore always supplied as an array of bytes (data typeVT_ARRAY|VT_UI1, VB type: array with elements of the type byte).
The "receiveexp“ variable contains the last, high priority data bufferreceived from the partner. Analogous to the "receive“ function, thebuffer 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 beread. If the device is to be read ("DEVICE“), an explicit receive requestblock is sent to the protocol. It is therefore advisable to simply monitorthese var iables or to read t hem fr om the cache.
Valid V ariableSyntax
To support the user when structuring the data to be received, specificsections of the buffer can be selected. The following syntax ismandatory for describing the variables:
• Receive{,}<type><byte address>{,quantity}
• Receiveexp{,}<type><byte address>{,quantity}
☞
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET112 6GK1971-0BA00-0AA1
<type> With "type", you specify the data type. This is converted to thecorresponding OLE data type in the OPC server for SIMATIC NET.
Data Types Description OLE DataType
VB Type
X Bit (Boolean)
Only for objects I,Q,M,P andOY (read only) and Send /Receive!
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, IEEErepresentation
VT_R4 Single
S5REAL Floating-point, S5representation
VT_R4 Single
<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)
{quantit y} Number of variables of a type to be addressed starting at the addressspecified in the "byte address" parameter.
Bit arrays are not supported. For the data type X (Boolean), thespecification of a number is omitted or it must be 1.
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition:
Example of Syntax Descr iption
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 thehigh-priority receive buffer.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 113
Send /sendexp
The complete syntax for the variables for writing the send buffer is asfollows:
send{n}{,validvariablesyntax}
sendexp{n}{, validvariablesyntax}
The "send“ variable contains a permanently available send buffer thatcan be transferred to the connection partner. A default value isspecified for the size of the send buffer by the "LenSend“ entry in theconfiguration file. The buffer is always supplied as an array of bytes(data type VT_ARRAY|VT_UI1, VB type: array with elements of thetype byte). Alternatively, the size can also be set using the n parameterin the variable name.
The "sendexp“ variable contains the permanently existing, high prioritysend buffer. Analogous to the "send“ function, the buffer is an array ofbytes, its length is, however, restricted to 16 bytes.
The value of the send variable that is read is the last value entered inthe send buffer. The data are not read from the partner device.
Write access to these and derived variables cause the send buffer tobe transferred to the partner.
These variables and variables derived from them cannot be read.They must t herefore be neither read nor act ivated. Read access tothese variables may well be responded to by the partner terminatingthe connection.
Valid V ariableSyntax
To support the user when structuring the data to be sent, specificsections of the buffer can be selected. The following syntax ismandatory 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 thereceive buffer.
☞
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET114 6GK1971-0BA00-0AA1
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition.
Example of Syntax Descr iption
send30,dword7 A double word starting at byte 7 in a 30-bytelong send buffer
send,B20 An array with 20 bytes in a send buffer withthe default size
SendExp8,DINT0 A signed double word starting at byte address0 in the high-priority send buffer
Direct Access(S5 onl y)
Apart from communication using fixed send and receive buffers, theSR-OPC server also supports direct access to the address area of theCPU of the partner device. The sender transfers the required addressinformation 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 areas follows:
ObtainableObjects
Descr iption
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 receivebuffer.
<address> The address of the variables in the range.
Please note the following:Depending on th e area, the address s pecified is either a byte orword address. W hen access ing th e following areas, t he specifiedaddress is interpreted as a word address:
DBnn, BS, AS, DXnn, DEnn, C, T
☞
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 115
{quantit y} Number of variables of a type to be addressed starting at the addressspecified in the "Address" parameter.
Please no te the following:The configu ration of th e partner device must be consistent.Depending on th e configu ration of th e partner device, access tocerta in areas will l ead to communi cation errors.
The SR-OPC server can onl y check t he syntax when a var iablelog s on. Based on the configu ration of th e partner, it i s notpossibl e to d etermine whether the var iable is valid on thepartner device.
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition:
Example of Syntax Descr iption
eb2 Input byte 2
DB10,real6,2 2 floating-point values starting at data word (!)6 in data block 10
Z12 Counter 12
☞
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET116 6GK1971-0BA00-0AA1
5.5.3 Informatio n Variables Specific to SR
Introdu ction The OPC server for Send/Receive provides variables for with whichinformation the connection states can be queried. The name of theinformation variable must be specified in the parameter ItemID of anOPC item.
The following information can be obtained:
• Status of a connection
• Versions of the Protocol Software
Conn ection St atus The "&state path()" and "&state pathval()" information variablesprovide 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&statepath()
Return Value&statepathval()
Descr iption
DOWN 1 Connection is not established
UP 2 Connection is established
RECOVERY 3 Connection has broken down
ESTABLISH 4 (Reserved for future expansions)
Example 1The item "SR:[SR_CONNECTION||CP_H1_1:]&statepath() "supplies for example the following:
"UP"
Example 2The item "SR:[SR_CONNECTION||CP_H1_1:]&statepathval( ) "could, for example, supply the following:
2 (corresponds to "UP"):
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 117
5.6 Send/Recei ve Protocol via PROFIBUS (FDL)
5.6.1 Specificatio ns fo r the Send/Recei ve Protocol via PROFIBUS (FDL)
Communi cat ionvia PROFIBUS
The Send/Receive protocol for PROFIBUS (FDL) is a simple, frame-oriented protocol for SIMATIC devices. It uses the services of theFieldbus Data Link (FDL), of layer 2 of the ISO/OSI reference model inPROFIBUS.
With Send/Receive, communication is possible via PROFIBUS to S5and S7 programmable controllers from Siemens and to PCs on whichthe FDL protocol is available.
The FDL-OPC server of SIMATIC NET requires an underlying FDLprotocol software from SIMATIC NET and a suitable communicationsprocessor. The FDL protocol software is part of the DP products ofSIMATIC NET.
FDL is used Although the Send/Receive OPC server for PROFIBUS is called theFDL-OPC server below, it uses only the services of the FDL protocolfor convenient access to communication data. Please note that theentire functionality of the FDL layer cannot be mapped to the OPCserver.
Principl e ofCommuni cat ion
The FDL protocol communicates with handling or function blocks thatare running on a programmable controller. The following block types orjob types are available:
• SEND (without WRITE function)
• RECEIVE
With SEND and RECEIVE, the data exchange is between the SENDblock and the RECEIVE block. The SEND block always initiatescommunication. For bi-directional communication, both a SEND and aRECEIVE block must be called at both ends.
For more detailed information about the Send/Receive interface, referto the manual "FDL Programming Interface“ and the documentation ofthe programmable controller.
Configu ring The configuration of Send/Receive communication is not created usingan additional configuration program on the PC. The communicationparameters must be configured in a text file used by the FDL-OPCserver.
A SIMATIC S5 partner device handles communication using handlingblocks (HDBs). The handling blocks must be called in the S5 program.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET118 6GK1971-0BA00-0AA1
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 suitableconnection configuration of the communications processor of theprogrammable controller is necessary.
Propert ies of theFDL-OPC Server
The FDL-OPC server of SIMATIC NET has the followingcharacteristics:
• Communication via SIMATIC S5 handling blocks and S7 functionblocks
• 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
Proto col ID The protocol ID for the FDL protocol is always “FDL”.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 119
Conn ectio n Name The FDL-OPC server uses a text file for connection configuration inwhich the connections and variables to be used by the OPC server areentered by the user.
A symbolic name is declared for each connection that must also beused in the designations of the OPC items. For further informationabout 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 ofthe application
These parts are separated by the “|” character. The symbolic name orthe connection parameters are used as alternatives. The pipecharacter to separate them must always be specified.
Conn ectionParameters
The information for the connection parameters is made up as follows:
<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).
RemoteStat ion PROFIBUS address of the partner station:
Decimal number in the range from 0 to 126 or 127 formuliticast/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 P oint The name of the communications processor or the access point of theapplication is specified by the configuration tools of the protocolsoftware. Typical names are:
• "CP_L2_1:“
• "CP_L2_2:“
Examples ofConn ectio n Names
Examples of connection names are listed below:
• |15,7,15|CP_L2_1:(Communication with station address 7 from SAP 15 to SAP 15 viaaccess "CP_L2_1:")
• MyConnection||CP_L2_1:Use of a symbolic name "MyConnection“ from the text file viaaccess point CP_L2_1:
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET120 6GK1971-0BA00-0AA1
5.6.2 Syntax of Variable Na mes fo r FDL
Function The variable name identifies the variable to be accessed on thepartner device. Variables are accessed using fixed names or aliasescorresponding 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 receivebuffer is as follows:
receive{,validvariablesyntax}
The "receive“ variable contains the last data buffer received from thepartner. The structure and length of the data buffer is not fixed. Thebuffer is therefore always supplied as an array of bytes (data typeVT_ARRAY|VT_UI1, VB type: array with elements of the type byte).
Since these variables correspond to a receive buffer, they can only beread. It is therefore advisable to simply monito r these var iables or toread t hem fr om the cache.
Valid V ariableSyntax
To support the user when structuring the data to be received, specificsections of the buffer can be selected. The following syntax ismandatory for describing the variables:
• Receive{,}<type><byte address>{,quantity}
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 121
<type> With "type", you specify the data type. This is converted to thecorresponding OLE data type in the OPC server for SIMATIC NET.
Data Types Description OLE DataType
VB 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, IEEErepresentation
VT_R4 Single
S5REAL Floating-point, S5representation
VT_R4 Single
<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)
{quantit y} Number of variables of a type to be addressed starting at the addressspecified in the "byte address" parameter.
Bit arrays are not supported. For the data type X (Boolean), thespecification of a number is omitted or it must be 1.
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition:
Example of Syntax Descr iption
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 thehigh-priority receive buffer.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET122 6GK1971-0BA00-0AA1
Send The complete syntax for the variables for writing the send buffer is asfollows:
send{n}{,validvariablesyntax}
The "send“ variable contains a permanently available send buffer thatcan be transferred to the connection partner. A default value isspecified for the size of the send buffer by the "LenSendSDA" or"LenSendSDN"“ entry in the configuration file. The buffer is alwayssupplied as an array of bytes (data type VT_ARRAY|VT_UI1, VB type:array with elements of the type byte). Alternatively, the size can alsobe set using the n parameter in the variable name.
Write access to these and derived variables cause the send buffer tobe transferred to the partner. The value of the send variable that isread is the last value entered in the send buffer. The data are not readfrom the partner device.
These variables and variables derived from them cannot be read.They must t herefore be neither read nor act ivated.
Send Serv icesUsed
Depending on the combination of the station address and the SAPsspecified in the connection part, a special FDL service is used whenwriting a send item:
LocalSAP RemoteStation
RemoteSAP
Meaning/Service Used for"Send"
0 to 62,255
0 to 126 0 to 62,255
Send and receive/SDA
0 to 62,255
0 to 126 63 Send only/SDA
63 0 to 126 0 to 62,255
Receive only (no send)
0 to 62,255
127 63 Broadcast: Only send toall/SDN
63 127 0 to 62,255
Receive broadcast(no send)
0 to 62,255
127 0 to 62,255
Multicast: Only send to allthat have activated theRemoteSAP/SDN
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 123
Valid V ariableSyntax
To support the user when structuring the data to be sent, specificsections of the buffer can be selected. The following syntax ismandatory for describing the variables:
• send{n}{,}<type><byte address>{,quantity}
The notation of the variable syntax corresponds to the syntax for thereceive buffer.
SendSDASendSDN
In special situations, it may be desirable that the service used is notdependent on the combination of the address of the partner station andthe SAPs. By using the names "SendSDA" and "SendSDN", an OPCclient can specify that only the relevant services SDA or SDN are usedfor sending. The syntax corresponds to the syntax of "Send". Thesespecial names are not displayed in the OPC Browser.
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition:
Example of Syntax Descr iption
send30,dword7 A double word starting at byte 7 in a 30-bytelong send buffer
send,B20 An array with 20 bytes in a send buffer withthe default size
send8,DINT0 A signed double word starting at byte address0
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET124 6GK1971-0BA00-0AA1
5.6.3 Informatio n Variables Specific to FDL
Int rodu ction The OPC server for Send/Receive via PROFIBUS (FDL) providesvariables for with which information about the connection states can bequeried. The name of the information variable must be specified in theparameter 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 variableFDL:[||< modul e>]&busparameter() supplies the bus parameters ofthe PROFIBUS network operated on the specified module. The valuesare returned as a field of the data type VT_UI1 and correspond to theresults returned by the FDL service FDL_READ_VALUE. To interpretthe results of this low-level service, refer to the manual for the FDLprogramming interface.
Example: FDL:[CP_L2_1:||]&busparameter()
Local StationAddress
The module-specific variable FDL:[||< modul e>]&ts() returns thestation address of the specified module. The data type of this item isVT_UI1.
Example: FDL:[CP_L2_1:||]&ts()
Node Identifi cationof th e LocalStation
The module-specific variable FDL:[||< modul e>]&ts() supplies thenode identification of the specified module. The value is supplied in the"VT_ARRAY|VT_BSTR”. The elements of this field contain thefollowing information:
"Vendor"
"Controller"
"Hardware Version"
"Software Version"
List of th e Nodeson the Bus
The module-specific variable FDL:[||< modul e>]&lif eli st() supplies thelist of PROFIBUS nodes obtainable by the specified module.
This information is obtained using the FDL serviceFDL_LIFE_LIST_CREATE_REMOTE. Note that this service creates asignificant load on the bus so that this variable should not bemonitored.
The data type of this variable is a field with 127 elements with theindex of each element standing for a PROFIBUS address.
Each element can have one of the following values:
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 125
Return Value Descr iption
0x10 Station does not exist, i.e. address not used.
0x20 The station is an active node and is ready for inclusionin the logical ring of the PROFIBUS network.
0x30 The station is an active node and is already in thelogical ring.
0x00 The station is a passive PROFIBUS node (for exampleDP slave)
Node Identifi cationof the PartnerDevice
The connection-specific variableFDL:[< conn ection>] &identif y()supplies the node identification of the partner device that can beobtained via the specified connection. The value is supplied in the"VT_ARRAY|VT_BSTR”. The elements of this field contain thefollowing information:
"Vendor"
"Controller"
"Hardware Version"
"Software Version"
Example: FDL:[MyConnection||CP_L2_1:]&identify()
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET126 6GK1971-0BA00-0AA1
5.7 DPS Protocol
5.7.1 Specificatio ns fo r the DPS Protocol
Master a nd Slaves The DPS protocol for PROFIBUS basically specifies a single mastersystem. For the OPC server for SIMATIC NET, the DP master is a PCwith the appropriate communications processor, for exampleCP 5412 (A2). A master addresses slaves cyclically via the fieldbus.
Slaves are generally input/output modules located in a distributedconfiguration and equipped with a passive communications module.The OPC server represents the inputs and outputs of a slave.
Propert ies of theDP-OPC Server
The DP-OPC server from SIMATIC NET has the followingcharacteristics:
• Variable services access and monitoring of DP inputsand outputs
• Diagnostic evaluation automatic evaluation of staticdiagnostics
Proto col ID The protocol ID for the DPS protocol is always “DPS”.
Conn ection Name For the DPS protocol, the connection name specifies thecommunication access by specifying the communications processorthat communicates with the slaves as the DP master.
The connection name for the DP protocol is DPSONLINE
Access to DPVariables
The inputs and outputs of the slave are accessed by specifying themodule number and the I/O area.
DP slaves have a modular structure. A DP slave can have more thanone module with different I/O areas. The modules are assigned duringconfiguration.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 127
5.7.2 Syntax of Variable Na mes fo r DPS
Overv iew The variable name identifies the input or output area in the module ofa slave. Status information of the slaves and the DP master is alsoavailable using variable names.
To describe the syntax, the following notation is used:
Convention s (not p art ofactual sy ntax)
Meaning
Pointed brackets ( < > ) Texts in pointed brackets aremandatory
Braces ( { } ) Texts in braces are optional
Syntax The syntax of the slave inputs and outputs is defined as follows (upperand lower case irrelevant):
• Inputs:
SlaveM<number>E<format><element>{.bit}{,quantity}
• Outputs:
SlaveM<number>A<format><element>{.bit}{,quantity}
Descr iption of theParameters
The individual parameters have the following meaning:
<number > Number of the module containing the input or output area.
{format } The "format" element specifies the format in which the data aresupplied. Specifying the format also specifies the data type.
In principle, all specified OLE data types can be read via theautomation interface of OPC. However, certain development tools (forexample Visual Basic) only offer a restricted number of data types.The following table therefore lists the corresponding Visual Basic typein which the variable value can be represented.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET128 6GK1971-0BA00-0AA1
Format ID Descr iption 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(unsigned 8)
VT_ARRAY of VT_UI1 Byte() *
WK Consistent data as an array of words(unsigned 16)
VT_ARRAY of VT_UI2 Long() *
* 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 byteaddress 4!
Specification of a bit is only permitted for type X. The address to bespecified 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 ofthe variable is an array with elements (data type VT_ARRAY) of thespecified format. If this part of the name is omitted, the quantity 1 isassumed and the data type of the variable is not an array.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 129
Syntax Exam ples Several examples of syntax are listed below to illustrate the abovedefinition.
Do not forget, that you must always precede the variable with theprotocol ID and the module identifier (for example"DPS:[DPSONLINE]" )!
Example of Syntax Descr iption
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 DPSItem of th e Module
The following predefined DPS item is used to query and control thestatus of the module:
Item Descr iption
DPS:[ DPSONLINE]&devicestate Status of the module hosting theslave.
Data type: VT_BSTR with the values"ONLINE" and "OFFLINE".
By writing these values, the modulecan be set to the correspondingstatus.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET130 6GK1971-0BA00-0AA1
Predefin ed OPCItems of the Slave
The following predefined OPC items exist:
Item Descr iption
DPS:[DPSONLINE]SlaveSlvState Current status of the DPS slave. Thedata type is VT_BSTR with thepossible values"DATA_EXCHANGE" and"NO_DATA_EXCHANGE".
DPS:[DPSONLINE]SlaveAllInputs All input bytes of all input modulesof the slave. The data type isVT_ARRAY|VT_UI1.
DPS:[DPSONLINE]SlaveAllOutputs All outputs bytes of all outputmodules of the slave. The data typeis VT_ARRAY|VT_UI1.
DPS:[DPSONLINE]SlaveMiscReadSlvParCfgData
Configuration data of the slave. Thedata type is VT_ARRAY|VT_UI1.
Structure of the OPC Items for the SIMATIC NET Data Access Interface
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 131
5.8 Symbolic Va riable Na mes (Aliases)
Int rodu ction The SIMATIC NET OPC servers allow the definition and use ofsymbolic variable names. This means that OPC applications can bedeveloped without specific reference to a system configuration and canbe adapted to the variable names and connections of a system.
The symbols are defined within a connection. To specify an itemcompletely, 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 symbolicname for an FMS index. Since the VFD and communicationsprocessor 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 andis used for all items.
Definition Symbolic definitions (aliases) can be defined in a text file before theOPC server is started. For further details about defining aliases using atext file, refer to Section 8.
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET132 6GK1971-0BA00-0AA1
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 133
6 Properties of the OPC Event Server forSIMATIC NET
The OPC Event specification gives the vendor of an OPC Event server a great deal offreedom to map the properties of the programmable controllers on the OPC interfacesfor alarms and events.
This chapter describes the options provided by the OPC specification for Alarm & Eventsused by the OPC server for SIMATIC NET, which events are provided by the OPCserver and which additional information is available as attributes.
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET134 6GK1971-0BA00-0AA1
6.1 General Info rmation
Simple EventServer
The OPC Event server for SIMATIC NET does not have anyconfiguration information relating to alarm/event handling in anoperator control and monitoring system.
Since the configuration information is missing, the OPC Event serverfor SIMATIC NET can only be operated as a "Simple Event Server". ASimple Event Server passes on only simple messages to theunderlying components. A higher level Alarm/Event ManagementServer processes the messages of the lower level Simple Servertaking into consideration configuration information (see next section).
Attachment tocommunication
system
Other device withalarm
information
Simple Alarm/Event Server
Simple Alarm/Event Server
Alarm/EventManagement Server
Operatorstation 2
Operatorstation 2
Logprinter
Restr ict ions As a Simple Alarm/Events Server, the OPC Event server for SIMATICNET has the following restrictions:
• No conditions• No state-related events• No confirmation• No areas• No area browsing
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 135
6.2 S7 Protocol
Services Used The S7 protocol provides two protocol mechanisms for transferringevents.
• Configured messages (SCAN)• Programmed messages (ALARM)
Both message types are used by the OPC Event server for the S7protocol.
Suppo rted AlarmCategories
In keeping with the message types, the OPC Event server provides thefollowing alarm categories:
• S7_PROCESS_SCAN• S7_PROCESS_ALARM.
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET136 6GK1971-0BA00-0AA1
6.2.1 Events and Parameters
Parameter By calling the "OnEvent" callback function of the client, the clientobtains a list of events. The OPC Event server for S7 supplies server-specific parameters that are explained in this section.
"szS ource"Parameter
As the source of the message, the OPC Event server for S7 specifiesthe connection information of the reporting S7 device. Thiscorresponds to the connection portion of an S7 variable for OPC DataAccess:
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 loggedon
• The name of the communications processor or the access point ofthe application
These parts are separated by the “|” character.
You specify the names of the S7 connections and VFDs duringconfiguration.
Example: S7:\AG1|VFD_OPC|CP_L2_1:
Parameter"szMessa ge"
The name of a message is made up of the message mechanism andthe configured message number:
• SCAN<message number>• ALARM<message number>
Examples: SCAN83ALARM55
"dwEventType"Parameter
The OPC Event server supports only the type:
OPC_SIMPLE_EVENT
This constant has the value 0x0001.
"dwEventCategory" Parameter
The following values are possible as event categories:
• S7_PROCESS_SCAN = 1
• S7_PROCESS_ALARM = 2
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 137
"dwSever ity"Parameter
The return value provides information about the importance of theevent. This return value can be modified in the configuration file forindividual message numbers of a communication partner (see Section8.4).
"dwNumEvent Attrs" Parameter
The number of attributes supplied with the message depends on thenumber of supplied associated values.
"pE ventAtt ribut es"Parameter
This structure contains the attributes supplied with the event. Theattributes also include the associated values of the message suppliedby the partner device. The structure is described in the OPCspecification.
Other Parameters The other parameters contain information relevant to the condition-related events or tracking events. Since these event types are notsupported by the OPC Event server for SIMATIC NET, the remainingparameters are irrelevant.
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET138 6GK1971-0BA00-0AA1
6.2.2 Event Att ributes
Suppli edAtt ribut es
An S7 station can send up to 10 associated values with a message oran alarm. These associated values are available in the event attributesvia the OPC Alarm & Event interface. This section describes theattributes supplied with an event by the OPC Event server forSIMATIC NET.
Configured messages (SCAN) and programmed messages (ALARM)provide the following attributes:
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 139
Name Value Type Descr iption
EVENT_ATTR_S7_PCTIME
6000 VT_DATE Time at which the OPC Event Server received themessage.
EVENT_ATTR_S7_S7TIME
6001 VT_DATE Time at which the message was generated on thepartner device.
EVENT_ATTR_S7_STATE
6002 VT_UI2 With SCAN messages:
Indicates the general status, whether the messageexists or not. Possible values:
S7_SCAN_MSG_EXIST OK (value 0x0)
S7_SCAN_NO_MSG message does not exist (value0x81)
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_ACK_STATE
6003 VT_UI2 Acknowledgment status of the scan object:
It is not possible to acknowledge messages using theOPC Event Server for SIMATIC NET. Messages can,however, be acknowledged by other user interfacesystems.
With SCAN messages:
Bit Descr iption
0 Acknowledgment entered state
1 to 7 irrelevant
8 Acknowledgment left state
9 to 15 irrelevant
With ALARM messages:
Bit Descr iption
0 Acknowledgment 1 entered state
... ...
7 Acknowledgment 8 entered state
8 Acknowledgment 1 left state
... ...
15 Acknowledgment 8 left state
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET140 6GK1971-0BA00-0AA1
Name Value Type Descr iption
EVENT_ATTR_S7_EVENT_STATE
6004 VT_UI2 Event state
Bit 0: Current status (1 = active)
Remaining bits: irrelevant
EVENT_ATTR_S7_NO_DATA
6005 VT_UI2 Number of associated values
Range of values: 1..10
EVENT_ATTR_S7_DATA00_DATATYPE
6006 VT_UI2 Data type of associated value no. 0
Parameter Value Descr iption
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 inbytes instead ofbits!S7_DATATYPE_DATE Date(0x30)Note: Days since01.01.1990
S7_DATATYPE_TIME_OF_DAY Time (0x31)Note: ms sincestart of day
S7_DATATYPE_TIME Time (0x32)Note:In ms
S7_DATATYPE_S5TIMETime (0x33)Note:BCD coded
EVENT_ATTR_S7_DATA00_VALUE_LEN
6007 VT_UI2 Number of relevant bytes of associated value no. 0
EVENT_ATTR_S7_DATA00
6008 VT_ARRAY |VT_UI1
The relevant bytes of associated value no. 0 as arrayof bytes.
EVENT_ATTR_S7_DATA01_DATATYPE
6010 VT_UI2 Data type of associated value no. 1
EVENT_ATTR_S7_DATA01_VALUE_LEN
6011 VT_UI2 Number of relevant bytes of associated value no. 1
EVENT_ATTR_S7_DATA01
6012 VT_ARRAY |VT_UI1
The relevant bytes of associated value no. 1 as arrayof bytes.
...
Properties of the OPC Event Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 141
Name Value Type Descr iption
EVENT_ATTR_S7_DATA09_DATATYPE
6042 VT_UI2 Data type of associated value no. 9
EVENT_ATTR_S7_DATA09_VALUE_LEN
6043 VT_UI2 Number of relevant bytes of associated value no. 9
EVENT_ATTR_S7_DATA09
6044 VT_ARRAY |VT_UI1
The relevant bytes of associated value no. 9 as arrayof bytes.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET142 6GK1971-0BA00-0AA1
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 143
7 Configuration of the OPC Server for SI MATIC NET
The OPC server for SIMATIC NET must be configured before it can use the underlyingcommunication systems. This chapter explains the basic configuration using theconfiguration program.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET144 6GK1971-0BA00-0AA1
7.1 General Info rmation
Int rodu ction The way in which the OPC server for SIMATIC NET operates can beadapted to the requirements of the area of application.
After installing the OPC server for SIMATIC NET, the configurationparameters have default values.
To install and start up the OPC server without problems, theconfiguration program should be started, the default parameterschecked and necessary parameters must be set.
Configu ration Fil es For more detailed information about the settings, refer to theconfiguration files described in Chapter 9.
Call The configuration program of the OPC server for SIMATIC NET canbe called via the Control Panel or from the Start menu in two differentways:
First PossibilityDouble-click the “SIMATIC NET OPC Server” icon in the ControlPanel.
Second Po ssibilityStart the “OPC Settings” program in the taskbar of Windows (taskbarStart => SIMATIC => SIMATIC NET => OPC Server => OPCSetting s).
After starting the configuration program, you can make general andprotocol-specific settings in various tab pages.
Entering Changes The settings of the configuration program are updated when you clickthe “OK” button or the “Apply” button. The settings (apart from thetrace settings) only become active when you restart the OPC server.Close all clients to quit the OPC server and then start an OPC client.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 145
7.2 General Settings for all Protocols
Overv iew In the "OPC Parameters“ tab, you can set general parameters foroperating the OPC server for all protocols.
Active Proto cols The OPC server for SIMATIC NET supports simultaneous operation ofmore than one protocol. By marking the check boxes "DP Proto col ","S7 Proto col ", "SR Proto col " or "FMS Proto col " you specify theprotocols to be used by the OPC server for communication. If theunderlying communication system does not exist or is incorrectlyconfigured, this is indicated by error messages when the OPC serverstarts up. In this case, eliminate the problem or deactivate the protocol.
Symbol File With the OPC server, apart from the connection-specific alias, aproto col-ind ependent symbol fil e can be used. If you intend to use asymbol file, you must activate the "Symbol File" check box and enterthe path and name of the file in the input box. For detailed informationon creating the symbol file, refer to Section 7.11.
Licenses To operate a protocol, you require the license for the correspondingSIMATIC NET OPC product. The simulated conn ection s can,however, be operated without a license.
Trace To debug your own applications it is often extremely useful to be ableto evaluate the correct response of the underlying components.Particularly errors in the dynamic activities involved in communicationcan be traced much more easily. Using trace outputs, a program logsthe actions it has performed.
The OPC server allows OPC-specific (Data Access or Alarms &Events) and protocol-specific actions to be recorded separately.
Activating TraceOutput
To activate the trace output of the OPC-specific actions for DataAccess, 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 t race outputs s low s down p rogram exec utionconsiderably.
Trace File Enter the path and name of the file in which the trace log will be writtenin the “Trace file” text box.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET146 6GK1971-0BA00-0AA1
Number of Entr iesin th e File
To avoid overtaxing your system with an ever-growing trace file, thesize 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 thetrace file is full, it is renamed by changing the file name extension anda new file is created. This allows you to see the last trace entries in therenamed file after reaching the maximum number of entries.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 147
7.3 Protocol Settings Specificall y for DP
Overv iew In the “DP Protocol” tab page, you can set parameters for operatingthe DP protocol.
"Request Cyc le"Parameter
The "request cycle" parameter specifies the smallest possible intervalfor querying the values of OPC items. Only active items in activegroups are checked. When this time has elapsed, the server checkswhether the value of the OPC items has changed. Changed activeOPC 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 isnot supported, the server reports back with an alternative rate(RevisedUpdateRate) that represents the closest permitted value. Thevalue 0 requests the fastest permitted “UpdateRate”. The value of therequest cycle set is returned as the minimum update rate.
The value of the minimum update rate must match the timing of theunderlying communications system. It must not be significantly lowerthan the time required by the communication system to acquire newprocess data.
"Act ivateSimulationConn ection"
The DP OPC server can be operated for tests, presentations anddevelopment without an underlying communications processor. Forsuch situations, there is a configurable simulation module. Thissimulation module always has the name DEMO.
This connection can be activated and deactivated with the "ActivateSimulation Module" check box.
For details of configuring the simulation module, refer to Section 8.3.5.
Activating " AccessRightsConfigu ration"
With the OPC server, you can specify the access rights of individualvariables or variable groups. By specifying access rights, you can, forexample, prevent variables used for internal calculation from beingoverwritten. You configure access rights either in the Tag FileConfigurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box meansthat the configuration file for access rights is evaluated when the OPCserver starts up. The configuration file for access rights is then openedalong with the general configuration file when you click the "Edit DPConfiguration File" button. For details of the structure of theconfiguration file, refer to Section 8.2.
"Edit DPConfigu ration Fil e"
Clicking this button opens a text editor with the active configurationfile. In this file, you can now make changes to the configuration.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET148 6GK1971-0BA00-0AA1
Saving andAct ivat ing
The configuration program also makes changes to the configurationfile that can be overwritten by your changes.
Recommendation:
Click the "Edit DP Configu ration Fil e" button onl y when you h aveappli ed th e changes made by the configu ration p rogram with t he"Appl y" button.
Selecting AccessPoints
An access point is a name that refers unequivocally to acommunication module. The names of the access points are specifiedby the configuration program of the underlying protocol software. Thefollowing 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 activatingthe check box of the relevant line in the list of available access points.
UnavailableAccess P oints
The configuration program recognizes when the access pointsspecified in an earlier configuration are no longer valid. Such accesspoints are then indicated by a red check box. Access points that are nolonger valid are removed from the list of selected access points by theconfiguration program. The removal of invalid access points isprevented, if you activate the check box "Keep unavailable accesspoints".
Entering yourSelections
Remember that a selected access point is only entered after youconfirm the properties page with "Apply" or "OK". These modificationsonly take effect after you restart the OPC server for SIMATIC NET.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 149
7.4 Protocol Settings Specificall y for S7
Overv iew In the “S7 Protocol” tab page, you can set general parameters foroperating the S7 protocol.
"Request Cyc le"Parameter
The "request cycle" parameter specifies the smallest possible intervalfor querying the values of OPC items. Only active items in activegroups are checked. When this time has elapsed, the server checkswhether the value of the OPC items has changed. Changed activeOPC 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 isnot supported, the server reports back with an alternative rate(RevisedUpdateRate) that represents the closest permitted value. Thevalue 0 requests the fastest permitted “UpdateRate”. The value of therequest cycle set is returned as the minimum update rate.
The value of the minimum update rate must match the timing of theunderlying communications system. It must not be significantly lowerthan the time required by the communication system to acquire newprocess data.
Act ivate t heSimulationConn ection
The S7 OPC server can be operated for tests, presentations anddevelopment without an underlying communications processor. Forsuch situations, there is a configurable simulation connection. Thissimulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activatesimulation connection" check box.
Act ivate " AccessRightsConfigu ration"
With the OPC server, you can specify the access rights of individualvariables or variable groups. By specifying access rights, you can, forexample, prevent variables used for internal calculation from beingoverwritten. You configure access rights either in the Tag FileConfigurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box meansthat the configuration file for access rights is evaluated when the OPCserver starts up. The configuration file for access rights is then openedalong with the general configuration file when you click the "Edit S7Configuration File" button. For details of the structure of theconfiguration file, refer to Section 8.2.
"Edit S7Configu ration Fil e"
Clicking this button opens a text editor with the active configurationfile. In this file, you can make changes to the configuration.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET150 6GK1971-0BA00-0AA1
Saving andAct ivat ing
The configuration program also makes changes to the configurationfile that can be overwritten by your changes.
Recommendation:
Click the "Edit S 7 Configu ration Fil e" button onl y when you h aveappli ed th e changes made by the configu ration p rogram with t he"Appl y" button.
Selecting CP/VFDPairs
A VFD is a "Virtual Field Device". It is a simulation of one or more realfield devices and is used to provide a uniform view of the real plant. Itsfunction is to provide a unique assignment of real devices to anapplication.
The number of available VFDs is specified by the configuration of thecommunications system. A VFD contains the connections configuredfor this VFD. A separate set of VFDs can be configured for eachcommunications processor.
An application can log on at one or more VFDs and at one or morecommunications processors (CPs). A CP/VFD pair must be assigned toexactly one application. By selecting a CP/VFD pair, you specify whichmodule and which VFD (and consequently which connections) areused in an application for communication.
The FMS OPC server for SIMATIC NET uses all the VFDs configuredon 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 severalnames, VFDs occur more than once in the list of CP/VFD pairs.
Before you insta ll and start up the S7 OPC server, y ou shouldalways se lect t he CP/VFD pairs t hat are rea ll y necessary.
When VFDs are listed in more than one CP/VFD pair, it is advisable toselect the pairs that include an access point (for example CP_L2_1:) .This means that you can switch over to other CPs without changing theOPC configuration.
If other applications on this computer use the S7 protocol at the sametime, these programs require their own VFD not used by the OPCserver.
SampleConfigu ration
Configuration sample:
You only want to use the S7 OPC server for S7 communication with 5partner devices. You would therefore configure 5 connections in the S7database 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 byactivating the check box in the relevant line.
☞
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 151
UnavailableCP/VFD Pairs
The configuration program recognizes when the CP/VFD pairsspecified in an earlier configuration are no longer valid. The reason forthis could be the use of a different S7 database or that an access pointhas been changed or deleted. Such CP/VFD pairs are then indicatedby a red check box. CP/VFD pairs that are no longer valid areremoved from the list of selected CP/VFD pairs by the configurationprogram. The removal of invalid CP/VFD pairs is prevented if youactivate the check box "Keep unavailable VFD/CP pairs".
Entering yourSelections
Remember that the selected CP/VFD pairs become valid only afteryou confirm the Properties page with “Apply” or “OK”. Thesemodifications only take effect after you restart the OPC server forSIMATIC NET.
Modif ying theConfigu ration
If the configuration is modified or you enter a different database for theS7 protocol, remember that the selected CP/VFD pairs may no longerbe valid. When you restart the OPC server, you will then receive errormessages.
After modifying the S7 configuration in a way that affects the VFDs orthe CPs being used, check the selected CP/VFD pairs.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET152 6GK1971-0BA00-0AA1
7.5 Protocol Settings Specificall y for F MS
Overv iew In the “FMS Protocol” tab page, you can set general parameters foroperating the FMS OPC server.
"Repetition s ofSequenti alServ ices"Parameter
FMS sequential services are handled by the FMS OPC server. If anerror occurs in a single job, it is repeated several times. With the"Repetitions of sequential services“ parameter, the number ofrepetitions can be set in the range from '0' to '65535'. The default valueis 20.
"Request Cyc le"Parameter
The "request cycle" parameter specifies the smallest possible intervalfor querying the values of OPC items. Only active items in activegroups are checked. When this time has elapsed, the server checkswhether the value of the OPC items has changed. Changed activeOPC 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 isnot supported, the server reports back with an alternative rate(RevisedUpdateRate) that represents the closest permitted value. Thevalue 0 requests the fastest permitted “UpdateRate”. The value of therequest cycle set is returned as the minimum update rate.
The value of the minimum update rate must match the timing of theunderlying communications system. It must not be significantly lowerthan the time required by the communication system to acquire newprocess data.
"Act ivateSimulationConn ection"
The FMS-OPC server can be operated for tests, presentations anddevelopment without an underlying communications processor. Forsuch situations, there is a configurable simulation connection. Thissimulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activatesimulation connection" check box.
For details of configuring the simulation connection, refer to Section8.5.6
Activating " AccessRightsConfigu ration"
With the OPC server, you can specify the access rights of individualvariables or variable groups. By specifying access rights, you can, forexample, prevent variables used for internal calculation from beingoverwritten. You configure access rights either in the Tag FileConfigurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box meansthat the configuration file for access rights is evaluated when the OPCserver starts up. The configuration file for access rights is then openedalong with the general configuration file when you click the "Edit FMSConfiguration File" button. For details of the structure of theconfiguration file, refer to Section 8.2.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 153
"Edit FMSConfigu ration Fil e"
Clicking this button opens a text editor with the active configurationfile. In this file, you can make changes to the configuration.
Saving andAct ivat ing
The configuration program also makes changes to the configurationfile that can be overwritten by your changes.
Recommendation:
Click the "Edit FMS Configu ration Fil e" button onl y when youhave appli ed th e changes made by the configu ration p rogramwith th e "Appl y" button.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET154 6GK1971-0BA00-0AA1
Selecting CP/VFDPairs
A VFD is a "Virtual Field Device". It is a simulation of one or more realfield devices and is used to provide a uniform view of the real plant. Itsfunction is to provide a unique assignment of real devices to anapplication.
The number of available VFDs is specified by the configuration of thecommunications system. A VFD contains the connections configuredfor this VFD. A separate set of VFDs can be configured for eachcommunications processor.
An application can log on at one or more VFDs and at one or morecommunications processors (CPs). A CP/VFD pair must be assigned toexactly one application. By selecting a CP/VFD pair, you specify whichmodule and which VFD (and consequently which connections) areused in an application for communication.
The FMS OPC server for SIMATIC NET uses all the VFDs configuredon 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 severalnames, VFDs occur more than once in the list of CP/VFD pairs.
Before you insta ll and start up the FMS-OPC server, you shouldselect t he CP/VFD pairs t hat are rea ll y necessary.
When VFDs are listed in more than one CP/VFD pair, it is advisable toselect the pairs that include an access point (for example CP_L2_1:) .This means that you can switch over to other CPs without changing theOPC configuration.
If other applications on this computer use the FMS protocol at thesame time, these programs require their own VFD not supported by theOPC server.
SampleConfigu rations
Configuration samples:
1. You only want to use the FMS OPC server for FMS communicationwith 5 FMS partner devices. You would therefore configure 5connections in the FMS database using COM PROFIBUS that alluse 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 SAPIFMS at the same time with 3 FMS partner devices. You have a CP5412 (A2). You configure the FMS database with COM PROFIBUS forthis 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 isassigned 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 useVFD <2> in your program.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 155
You specify the CP/VFD pairs to be used by the FMS protocol byactivating the check box in the relevant line.
UnavailableCP/VFD Pairs
The configuration program recognizes when the CP/VFD pairsspecified in an earlier configuration are no longer valid. The reason forthis could be the use of a different FMS database or that an accesspoint has been changed or deleted. Such CP/VFD pairs are thenindicated by a red check box. CP/VFD pairs that are no longer validare removed from the list of selected CP/VFD pairs by theconfiguration program. The removal of invalid CP/VFD pairs isprevented if you activate the check box "Keep unavailable VFD/CPpairs".
Entering yourSelections
Remember that the selected CP/VFD pairs become valid only afteryou confirm the Properties page with “Apply” or “OK”. Thesemodifications only take effect after you restart the OPC server forSIMATIC NET.
Modif ying theConfigu ration
If the configuration is modified or you enter a different database for theFMS protocol, remember that the selected CP/VFD pairs may nolonger be valid. When you restart the OPC server, you will thenreceive error messages.
After modifying the FMS configuration in a way that affects the VFDsor the CPs being used, check the selected CP/VFD pairs.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET156 6GK1971-0BA00-0AA1
7.6 Protocol Settings Specificall y for Send/Recei ve
Overv iew In the “SR Protocol” tab page, you can set general parameters foroperating the SR-OPC server.
"Request Cyc le"Parameter
The "request cycle" parameter specifies the smallest possible intervalfor querying the values of OPC items. Only active items in activegroups are checked. When this time has elapsed, the server checkswhether the value of the OPC items has changed. Changed activeOPC 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 isnot supported, the server reports back with an alternative rate(RevisedUpdateRate) that represents the closest permitted value. Thevalue 0 requests the fastest permitted “UpdateRate”.
The value of the minimum update rate should be selected to suit thetime involved in the underlying communication system. It should notbe significantly lower than the time required by the communicationsystem to acquire new process data.
“ Act ivate t heSimulationConn ection”
The SR-OPC server can be operated for tests, presentations anddevelopment without an underlying communications processor. Forsuch situations, there is a configurable simulation connection. Thissimulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activatesimulation connection" check box.
For details of configuring the simulation connection, refer to Section8.6.4
Activating " AccessRightsConfigu ration"
With the OPC server, you can specify the access rights of individualvariables or variable groups. By specifying access rights, you can, forexample, prevent variables used for internal calculation from beingoverwritten. You configure access rights either in the Tag FileConfigurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box meansthat the configuration file for access rights is evaluated when the OPCserver starts up. The configuration file for access rights is then openedalong with the general configuration file when you click the "Edit SRConfiguration File" button. For details of the structure of theconfiguration file, refer to Section 8.2.
"Edit SRConfigu ration Fil e"
Clicking this button opens a text editor with the active configurationfile. In this file, you can now make changes to the configuration.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 157
Saving andAct ivat ing
The configuration program also makes changes to the configurationfile that can be overwritten by your changes.
Recommendation:
Click the "Edit S R Configu ration Fil e" button onl y when you h aveappli ed th e changes made by the configu ration p rogram with t he"Appl y" button.
Selecting AccessPoints
An access point is a name that refers to a communication module. Thenames of the access points are specified by the configuration programof the underlying protocol software. A particular module is linked withthis access point. A typical access point set up by installing theprotocol software is CP_H1_1:.
Prior to installing and starting the SR-OPC server, you must specifywhich access points are used.
If access point s are not specified, the SR-OPC server ca nnot bestarted up.
You select the access point to be used by the OPC server by activatingthe check box of the relevant line in the list of available access points.
UnavailableAccess P oints
The configuration program recognizes when the access pointsspecified in an earlier configuration are no longer valid. Such accesspoints are then indicated by a red check box. Access points that are nolonger valid are removed from the list of selected access points by theconfiguration program. The removal of invalid access points isprevented, if you activate the check box "Keep unavailable accesspoints".
Entering yourSelections
Remember that a selected access point is only entered after youconfirm the properties page with "Apply" or "OK". These modificationsonly take effect after you restart the OPC server for SIMATIC NET.
☞
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET158 6GK1971-0BA00-0AA1
7.7 Protocol Settings Specificall y for FDL
Overv iew In the “FDL Protocol” tab, you can set general parameters for operatingthe FDL-OPC server.
"Request Cyc le"Parameter
The "Request Cycle" parameter specifies the shortest possible intervalfor checking the values of the active OPC items of an active OPCgroup. When this time has elapsed, the server checks whether thevalue of the OPC items has changed. All changed OPC items are thenupdated in the cache and signaled to the user.
The user can set an update rate for each group. If the selected rate isnot supported, the server reports back with an alternative rate(RevisedUpdateRate) that represents the closest permitted value. Thevalue 0 requests the fastest permitted “UpdateRate”.
The value of the minimum update rate should be selected to suit thetime involved in the underlying communication system. It should notbe significantly lower than the time required by the communicationsystem to acquire new process data.
Act ivate t heSimulationConn ection
The FDL-OPC server can be operated for tests, presentations anddevelopment without an underlying communications processor. Forsuch situations, there is a configurable simulation connection. Thissimulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activatesimulation connection" check box.
For more detailed information in the simulation connection, refer toSection 8.7.4.
Activating " AccessRightsConfigu ration"
With the OPC server, you can specify the access rights of individualvariables or variable groups. By specifying access rights, you can, forexample, prevent variables used for internal calculation from beingoverwritten. You configure access rights either in the Tag FileConfigurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box meansthat the configuration file for access rights is evaluated when the OPCserver starts up. The configuration file for access rights is then openedalong with the general configuration file when you click the "Edit FDLConfiguration File" button. For details of the structure of theconfiguration file, refer to Section 8.2.
"Edit F DLConfigu ration Fil e"
Clicking this button opens a text editor with the active configurationfile. In this file, you can now make changes to the configuration.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 159
Saving andAct ivat ing
The configuration program also makes changes to the configurationfile that can be overwritten by your changes.
Recommendation:
Click the "Edit F DL Configu ration Fil e" button onl y when youhave appli ed th e changes made by the configu ration p rogramwith th e "Appl y" button.
Selecting AccessPoints
An access point is a name that refers to a communication module. Thenames of the access points are specified by the configuration programof the underlying protocol software. A particular module is linked withthis access point. A typical access point set up by installing theprotocol software is CP_H1_1:.
Prior to installing and starting the FDL-OPC server, you must specifywhich access points are used.
If access point s are not specified, the FDL-OPC server ca nnot bestarted up.
You select the access point to be used by the OPC server by activatingthe check box of the relevant line in the list of available access points.
UnavailableAccess P oints
The configuration program recognizes when the access pointsspecified in an earlier configuration are no longer valid. Such accesspoints are then indicated by a red check box. Access points that are nolonger valid are removed from the list of selected access points by theconfiguration program. The removal of invalid access points isprevented, if you activate the check box "Keep unavailable accesspoints".
Entering yourSelections
Remember that a selected access point is only entered after youconfirm the properties page with "Apply" or "OK". These modificationsonly take effect after you restart the OPC server for SIMATIC NET.
☞
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET160 6GK1971-0BA00-0AA1
7.8 Protocol Settings Specificall y for DPS
Overv iew In the “DPS Protocol” tab, you can set general parameters foroperating the DPS-OPC server.
"Request Cyc le"Parameter
The "Request Cycle" parameter specifies the shortest possible intervalfor checking the values of the active OPC items of an active OPCgroup. When this time has elapsed, the server checks whether thevalue of the OPC items has changed. All changed OPC items are thenupdated in the cache and signaled to the user.
The user can set an update rate for each group. If the selected rate isnot supported, the server reports back with an alternative rate(RevisedUpdateRate) that represents the closest permitted value. Thevalue 0 requests the fastest permitted “UpdateRate”.
The value of the minimum update rate should be selected to suit thetime involved in the underlying communication system. It should notbe significantly lower than the time required by the communicationsystem to acquire new process data.
Act ivate t heSimulationConn ection
The DPS-OPC server can be operated for tests, presentations anddevelopment without an underlying communications processor. Forsuch situations, there is a configurable simulation connection. Thissimulation connection always has the name DEMO.
This connection can be activated and deactivated with the "Activatesimulation connection" check box.
For more detailed information in the simulation connection, refer toSection 8.8.3.
Activating " AccessRightsConfigu ration"
With the OPC server, you can specify the access rights of individualvariables or variable groups. By specifying access rights, you can, forexample, prevent variables used for internal calculation from beingoverwritten. You configure access rights either in the Tag FileConfigurator for symbolic variables or in a protocol-specific text file.
Setting the "Activate Access Rights Configuration" check box meansthat the configuration file for access rights is evaluated when the OPCserver starts up. The configuration file for access rights is then openedalong with the general configuration file when you click the "Edit DPSConfiguration File" button. For details of the structure of theconfiguration file, refer to Section 8.2.
"Edit DPSConfigu ration Fil e"
Clicking this button opens a text editor with the active configurationfile. In this file, you can now make changes to the configuration.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 161
Saving andAct ivat ing
The configuration program also makes changes to the configurationfile that can be overwritten by your changes.
Recommendation:
Click the "Edit DPS Configu ration Fil e" button onl y when youhave appli ed th e changes made by the configu ration p rogramwith th e "Appl y" button.
Selecting AccessPoints
An access point is a name that refers to a communication module. Thenames of the access points are specified by the configuration programof the underlying protocol software. A particular module is linked withthis access point. A typical access point set up by installing theprotocol software is CP_H1_1:.
Prior to installing and starting the DPS-OPC server, you must specifywhich access points are used.
If access point s are not specified, the DPS-OPC server ca nnot bestarted up.
You select the access point to be used by the OPC server by activatingthe check box of the relevant line in the list of available access points.
UnavailableAccess P oints
The configuration program recognizes when the access pointsspecified in an earlier configuration are no longer valid. Such accesspoints are then indicated by a red check box. Access points that are nolonger valid are removed from the list of selected access points by theconfiguration program. The removal of invalid access points isprevented, if you activate the check box "Keep unavailable accesspoints".
Entering yourSelections
Remember that a selected access point is only entered after youconfirm the properties page with "Apply" or "OK". These modificationsonly take effect after you restart the OPC server for SIMATIC NET.
☞
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET162 6GK1971-0BA00-0AA1
7.9 Trace for a Specific P rotocol
Int rodu ction To debug your own applications it is often extremely useful to be ableto evaluate the correct response of the underlying components.Particularly errors of dynamic activities involved in communication canbe traced much more easily. Using trace outputs, a program logs theactions it has performed.
Call The dialog for configuring the protocol-specific trace is opened byclicking the "Protocol Trace" button in the tab for the protocol you wantto investigate.
Activating TraceOutput
To activate trace output, select the "Activate OPC trace" check box.
The activation of t race outputs s low s down p rogram exec utionconsiderably.
Trace File Enter the path and name of the file in which the trace log will be writtenin the “Trace file” text box. Different files must be specified for theOPC trace and the protocol-specific trace.
Create new f ile... If you select the option "create new file", an existing trace file isoverwritten when you start the OPC server. If you select the alternativeoption "append to existing file", the existing trace file has new entriesadded to it.
Closing th e FileFollowing E achEntry
By closing the protocol-specific trace file following each entry, there isa physical transfer of the data to hard disk. This means that traceinformation is retained even if a program crashes.
Activating thi s option slow s down p rogram exec utionsignifi cantl y.
Maximum Numberof Ent ries
To avoid overtaxing your system with an ever-growing trace file, thesize 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 thetrace file is full, it is renamed by changing the file name extension anda new file is created. This allows you to see the last trace entries in therenamed file after reaching the maximum number of entries.
Trace Depth The amount of information to be recorded can be specified for theprotocol-specific trace.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 163
7.10 Quitting the OPC Se rver
Int rodu ction The OPC server for SIMATIC NET is started automatically by theoperating system when a client wants to use it. The OPC serverincludes reference counters to be able to recognize when the last clientis closed. The OPC server then closes itself. This is, however, onlypossible when the clients increment and decrement the referencecounters correctly. If a client terminates abnormally, so that thereference counter cannot be reset, the OPC server does not closeeven when no further client is active. The server then continues tomaintain the communications connections.
Quitting th e OPCServer
If you click the “Quit OPC Server” button in the “OPC Reset” tab page,you reset the OPC server to a defined status without having to restartthe system. The OPC server terminates all communicationsconnections and closes itself. Both an active OPC Data Access serverand an OPC Alarms & Events server is closed.
You should first close all the OPC clients that work with the serverotherwise any OPC calls from the clients will be rejected with RPCerrors.
Reason In the "Reason" text box, a reason can be specified that can beevaluated by a client. Evaluating this information is interestingparticularly in DCOM operation.
Delay The OPC server is closed only after the time specified in the "Delay"box has expired.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET164 6GK1971-0BA00-0AA1
7.11 Symbols for the OPC Se rver for SI MATIC NET
Introdu ction The ItemIDs of the OPC servers for SIMATIC NET contain informationabout the communication path of the variables. The syntax of thevariables specifies the protocol, the connection and possibly also theservice with which the data will be delivered.
It is, however, often useful to select names of variables that are notdependent on the configuration of the communication system butrather reflect the structure of a plant.
With the OPC Event server for SIMATIC NET, it is possible to enter asymbolic name that is valid for all protocols.
The OPC server for the S7 protocol can also use the symbols createdwith the STEP 7 configuration tool in the symbol table and in theblocks.
Note: The use of symbols as described in this chapter has nothing todo with the concept of aliases.
Examples The symbolic names can be selected freely.e.g.
Assembly.Drive.Controller.SetpointS7300(1)_CPU416.Motor.Limitswitch
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 165
7.11.1 The Symbol File wit h STEP 7 Symbols
STEP 7 Symbols A symbol file is used to store the symbolic names. This file containsinformation about the internal assignment of symbolic names to validS7 variable names.
Note:When using symbols with the OPC server, the symbols are read outonce when the "AddItem" method is called. In subsequent calls, theclient uses the handle generated by the server and can thereforeaccess the variable directly.
Note:
To be able to access STEP 7 projects, the configuration program forthe symbol file ("Tag File Configurator") must run on the computer withthe "STEP 7" configuration program. The symbol file itself, can betransferred to the computer with the OPC server during runtime. The"STEP 7" program is no longer necessary when the OPC server isrunning.
☞
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET166 6GK1971-0BA00-0AA1
The Files " *.wsd"and " *.ssd"
The symbolic names of several S7 programs created with STEP 7 canbe entered in the symbol file (*.wsd). The symbol file contains thesymbols of the global symbol table of an S7 program and the symbolicinformation 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 thewsd file contains all symbols (including the entries marked asinvisible), the ssd file only contains the symbols to be used. Invisiblesymbols are not entered in the ssd file. The wsd file is used as thebasis for editing the symbols with the tag file configuration program.The ssd file is used by the OPC server and is entered in theconfiguration program for the OPC server.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 167
7.11.2 Creating a Symbol File wit h STEP 7 Symbols
Requi rements The Tag File Configurator must run on the computer on which the"STEP 7" configuration tool is installed. If necessary, install the "OPCServer" product on the configuration computer with STEP 7.
Starting th e TagFile Configu rator
Start the Tag File Configurator and create a new project:
Step Procedu re
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 S ymbol F ile
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 menucommand "File => Open".
The following screenshot shows the Tag File Configurator with anempty symbol file. You can now enter STEP 7 programs and othersymbols in this symbol file.
Now insert the symbols of a STEP 7 program in the symbol file:
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET168 6GK1971-0BA00-0AA1
Step Procedu re
1 Select a STEP 7 pro ject
Select the menu command "Insert => Progra m" .
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 selectedprogram in the symbol file.
STEP 7 projects
PC station in project
SIMATIC stationsnetworked with PC station
CPU of SIMATIC station
Program in this CPU
Applications of PC station, ifmore than one application isdefined 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 mustlater be initialized on this PC station. If a STEP 7 project does notcontain a PC station, no symbol file can be created for the project.
In this case, first create a SIMATIC PC station with STEP 7 andconfigure the connections to the SIMATIC S7 stations whose symbolsyou want to access from the PC station.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 169
Note The symbol file contains the connection information created with STEP7/NetPro. This connection information must also be adopted on the PCas the configuration. See also Section 7.11.4.
AssigningConn ections
To distribute the communication load, it is possible to configure severalparallel connections between two partner devices usingSTEP 7/NetPro. The information about which of the possibleconnections can be used to access a variable with a symbolic name isstored in the symbol file. As default, all variables with symbolic namesare read via the connection configured last. To assign a variable to adifferent connection, follow the steps outlined below:
Step Procedu re
1 Select the var iable
Select the list of variables in the left window. Click the row containing the required variablein the right-hand window.
2 Open the selection d ialog
Click the arrow button in the cell containing the connection information to display thepossible connections in a combo box.
3 Select a connec tion
Select the required connection in the dialog box.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET170 6GK1971-0BA00-0AA1
7.11.3 Entering Additio nal Symbols
Int rodu ction Apart from the symbols imported from STEP 7, you can also createnew symbols for existing variables using the Tag File Configurator. Tostructure your symbols, you can create blocks. A block, in turn, cancontain lower-level variables or further blocks.
Note Fields and symbols cannot be entered in the CPUs and programsextracted from STEP 7. It is only possible to create new symbols andblocks at the lowest level within blocks that have already been created.
Creat ing blo cks In the name space, you can now create blocks for structuring the namespace.
Step Procedu re
1 Select the inser tion pos ition
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, thismenu command cannot be activated.
As an alternative, you can select the "New Block" menu command from the "Insert" menu.
3 Enter the b lock na me
Enter a unique name for the block at this position in the dialog box.
Entering S ymbols You can now enter symbols in the block you have created. Follow thesteps outline below:
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 171
Step Procedu re
1 Select the inser tion pos ition
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 Se lecting the Run time Names
Enter the runtime names for the specific protocol in the "Runtime Name" column (asdescribed 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. Inthe "Browse" dialog, you can also select several items.
4 Specifying the Symbol Na mes
Enter a unique name for the symbol in the "Symboli Name" column for each runtime name.
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET172 6GK1971-0BA00-0AA1
7.11.4 Using Symbols i n OPC
Act ivat ingSymbols
To be able to use the symbolic variables of a symbol file in an OPCclient, you must activate the use of symbolic names and enter the pathof the file to be used. Use the configuration program described inSection 7.11.2.
Entering a SymbolFile
In the steps described below, you configure the OPC server for the useof a symbol file:
Step Procedu re
1 Transfer the Symbol F ile
Transfer the previously created symbol file to the PC station, for example by copying thesymbol file to diskette.
2 Open the OPC con figuration p rogram
Start the program "OPC Settings" from the Windows taskbar (taskbar Start => SIMATIC =>SIMATIC NET => OPC Server => OPC Setti ngs).
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 boxbelow.
Inclusion in theNetworkConfigu ration
In STEP 7, when you compile the network configuration with NetPro,databases for the PC stations are created. These databases containconfiguration information that describes the access path of the PCstation to an S7 station. The databases have the extension "XDB".
A symbol file created from STEP 7 relates to the corresponding XDBfile for the PC station. The connection settings for a symbol in thesymbol file uses the connection information stored in the XDB file.
Note This functionality is only available from STEP 7 V5.0 and higher.
Entering th e XDBFile
The steps outlined below explain how to specify an XDB file for a PCstation:
Configuration of the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 173
Step Procedu re
1 Identif y 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 con figuration p rogram
Start the "Set PG/PC Interface" configuration program on the PC station, for example fromthe taskbar Start => Simatic => SIMATIC NET => Set PG/PC Interface).
3 Enter the con figuration 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 inputbox "Name of the Configuration File".
Name Space The symbolic variables are visible beside the protocol-specificvariables in the name space of the OPC server.
Structure of theItemIDs
The ItemID of the symbolic name consists of the name of the controlengine, the name of the blocks and the name of the symbol. Theindividual 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 asfollows:
Factory1.ConveyorBelt. Setpoint
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET174 6GK1971-0BA00-0AA1
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 175
8 Configuration Using Files
Further settings for the OPC server for SIMATIC NET to allow optimum use must beentered in configuration files. For the send/receive protocol and the Alarms & Eventsinterface, the configuration file must be edited to define the connections.This chapter explains the structure and meaning of the entries in the configuration filesfor specific protocols.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET176 6GK1971-0BA00-0AA1
8.1 Configu ration Files
Overv iew Along with the OPC server for SIMATIC NET, configuration files areinstalled for specific protocols. The configuration files must beprocessed to allow optimum use of the products.
Structure of theFiles
The text files for configuring the OPC server are structured based onthe principle of the ini files of Windows. These are divided into sectionsindicated by section names set in [ ]. Following the section name, thereare two assignments of the type "parameter=value". Comments withinthe file are preceded by a semicolon.
File Location When you install the OPC server, two configuration files are entered inthe 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
Cont ent of th e .txtFiles
The configuration files with the extension txt contain a section forgeneral protocol definition. This is followed by sections for assigningparameters for access points or connections and for specifyingsymbolic names (aliases). A simulation connection can also beconfigured with which access is possible when no communicationsprocessor is installed.
Content of the .secfil es
The configuration files with the extension sec allow the access rightsto individual variables or variable groups to be influenced.
To avoid the possibility of manipulation of the configuration files, it isadvisable for the administrator to restrict write access to these files.☞
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 177
8.2 Configu ring Access Rights
Overv iew In operator control and monitoring systems, it must not be possible forany user to be able to monitor and manipulate variables that can beaccessed via the protocol. The unintentional writing of internal flagvariables of a programmable controller could have fatal consequences.With the OPC server for SIMATIC NET, it is possible to restrict theaccess rights of the variables that can be accessed using the OPCserver.
The rights specified in the protocol (for example write permission toperipheral inputs can be further restricted but not extended).
Structure The structure of the sec files for configuring access rights to variablesis the same for all protocols. On the one hand, the global settings forcontrolling access rights for a protocol are specified in the sec files.The sec files also contain the definition of rights for variables andvariable groups.
Entry Meaning
Section [Security] General settings are made in this section.
SecurityLevel 0 No restriction of access rights1 Access rights are restricted for all users as
specified in the following section.
Default 0
Definition ofAccess R ights
The global access rights for OPC variables are defined in the section"GlobalSecurityItems". To define areas for variables (all variables of aconnection or a block), you can use placeholders. Areas can bespecified 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 allvariables of the protocol not covered in the followingdefinitions.
(empty) No access to any OPC items of the protocolR Read-only access to all OPC itemsW Write-only access to all OPC itemsRW Full access to all OPC items
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET178 6GK1971-0BA00-0AA1
Default RW
<OPCItem>=<special rights> New definition of the access rights for a variable. Allpreviously defined rights are ignored; in other words,it is also possible to restrict existing rights.
<OPCItem> Specification of one or more OPC items according tothe syntax defined in Chapter 5. This must alsoinclude the connection information. The use of aliasesis 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 itemR Read-only access to the OPC itemW Write-only access to the OPC itemRW 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 canbe read and written.
S7:[appl1|VFD1|CP_L2_1:]M*=W The memory bit area of thedevice accessible on thisconnection is write-only
S7:[appl1|VFD1|CP_L2_1:]MW3=RWMemory word 3 can be read andwritten.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 179
8.3 DP Protocol
Overv iew Editing the configuration file for the DP protocol becomes necessary inthe following situations:
• when you want to change the DP application environment of theOPC 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 duringinstallation is as follows:
<installationpath> \ OPC2.NT \ binDP \ SCoreDP.txt
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET180 6GK1971-0BA00-0AA1
8.3.1 General Protocol Co nfig uration
General Pr otocolConfigu ration
The following table shows the parameters for configuring the generalproperties of the DP protocol.
Entry Meaning
Section [PROTOCOL] The general protocol settings are made in thissection.
CycleTime This value specifies how quickly the job waiting list ischecked through for pending jobs.Default 100 ms(is set as "Request Cycle" by the configurationprogram)
UseOnlyThisBoard Number of the module at which the DP OPC serverlogs on. Several numbers are separated by commas.A logged on module has the name CP_L2_n, where ncorresponds to the module number.Caution: The last module number must beterminated 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 simulationconnection with which slave access can besimulated without a functioning protocol.
0 No simulation connection is provided.Default 0(set by the configuration program)
CycleNet reserved
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 181
8.3.2 Module-Specific Co nfig uration
Overv iew Each module has up to 3 sections in the configuration file. In the firstsection, module-specific parameters are configured, in the secondsection special slave settings can be made and in the third sectionaliases can be defined for variables.
The configuration is evaluated when the OPC server starts up.
The following table describes the module-specific configurationparameters.
Entry Meaning
1st module section[module name]e.g.[CP_L2_1:]
Configuration parameters for this module
ReferenceAccess Setting for the DP application type and the DPapplication environment.
The permitted values correspond to the DPstructure element reference.access (see DPdocumentation).
0x50 (DPN_SYS_NOT_CENTRAL |DPN_ROLE_NOT_CENTRAL)Several equal ranking DP applications arepossible, The OPC server changesautomatically to the "OPERATE" mode.
0xA0 (DPN_SYS_CENTRAL |DPN_ROLE_CENTRAL)The OPC server is a master application andmust set the mode explicitly. The OPC servervariable "Masterstate" must have suitablevalue set.
0x60 (DPN_SYS_CENTRAL |DPN_ROLE_NOT_CENTRAL)There is another master application and thismust set the mode explicitly. The OPC serveris a subordinate application.
Access to slaves is possible only in the"OPERATE" mode.
Default 0x50
WatchdogTimeout Configuration of the watchdog of the module. Ifthe OPC server no longer accesses the DPprogramming interface (due to a problem), themodule reacts automatically as described in thedocumentation of the module. (For example theCP 5412 (A2): data with the value 0 is sent to all
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET182 6GK1971-0BA00-0AA1
Entry Meaning
slaves assigned to the OPC server).
0 The watchdog is off.
n The watchdog responds after n millisecondswithout any access to the programminginterface.
For example, the OPC server accessesprogramming interface periodically when DPvariables are monitored.The watchdog can be modified during operationwith the variableDP:[CP_L2_n:]WatchdogTimeout.
Default 6000 ms
Timeout Error monitoring time: If a pending DPC1 jobcannot be processed within this monitoring time,the job is acknowledged with an error.
Default 15000 ms
AutoDiag 0 The diagnostic monitoring and evaluation isoff.
N Lock time for error diagnostics. The OPCserver monitors the diagnostic flagautomatically when the slave inputs/outputsare accessed and evaluates the diagnosticdata of the standard slaves. If errors orproblems are detected in the diagnostic data,access to the slave inputs/outputs is lockedfor n ms; in other words, read/write jobs areacknowledged with errors.
Default 500 ms
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 183
8.3.3 Slave Config uration
Overv iew The entries in the 2nd section specify the access rights of the slaves inthe database.
Entry Meaning
2nd module section[module name(slaves)]e.g.[CP_L2_1:(slaves)]
Settings for access rights
AccessSlaveDefault
e.g.
AccessSlaveDefault=1
If there are other DP applications on the samemodule, access to individual DP slaves must bespecified. If access to the individual slaves bythe DP applications is inconsistent (for example2 applications have write access to the sameslave), the logon of the entire module fails andnone of the slaves are available.
This entry defines how the default access toslaves is set when you log on. Access can beadapted for individual slaves (see below). Thefollowing values are possible:
1 As default, only read access to all slaves ispossible
2 As default, read and write access to allslaves is possible
Default 2
AccessSlave<no>
e.g.
AccessSlave003=0AccessSlave063=1AccessSlave107=2
Normally, all available slaves of the module areset for read/write access when the module logson. A different default can be set for each slave,as follows:
0 No access to slave
1 Read-only access to slave
2 Read/write access to slave
The slave number is always 3 digits, and must bepadded with leading zeros. The OPC server doesnot enter any values in this section. If there is noentry, the default is used.
Default 2
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET184 6GK1971-0BA00-0AA1
8.3.4 Definitio n of Symbolic Na mes
Defining Aliases The third section of the configuration file allows the definition ofsymbolic names for a valid DP variable. An alias is a purely textualsubstitute for an otherwise valid DP variable name.
Nesting of aliases is not supported, in other words an alias must alwaysrefer directly to a valid DP variable.
The following table describes the section for defining aliases.
Entry Meaning
3rd module section[module name (aliases)]e.g.[CP_L2_1:(Aliases)]
Predefined aliases for this module. The sectionname is made up of the module name and"(Aliases)".
Alias=DPVariablee.g.
Motor=Slave012M002EX0.3Heatingpower=Slave23M003AW3
This section contains any number of aliasdefinitions.
The symbolic name "Motor" references the 3rdinput bit of slave 12. The name "Heatingpower"references an output word of slave 23.
Alias The alias can be used just like a normal DPvariable on the OPC interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) . (period) & (), ANSI > 127
DPVariable Internally, the OPC server replaces the variablename of the alias with this DP variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 185
8.3.5 Config uratio n of t he DP Demo Connection
Int rodu ction For demonstrations, for testing, or during development it is useful to beable to operate the OPC server for the DP protocol without additionalhardware. The OPC server therefore allows you to simulate a modulewith several slaves. The configuration of the demonstration module isdescribed below.
Requi rements The demo module can be activated by the configuration program orusing the "UseDemoBoard“ parameter in the "PROTOCOL“ section ofthe configuration file.
Name The simulated module always has the name "DEMO".
Just like a normal module, the demo module also has threeconfiguration sections.
Entry Meaning
1st section of the demonstration module[DEMO]
Connection-specific parameters. No parametersare defined within this section.
Entry Meaning
2nd connection section[DEMO(Slaves)]
Configuration of the simulated slaves
Slave<no>=configuration data
e.g.
Slave003=|R|unsigned8[2]|{00|19}(corresponds to ET200B 32DI}Slave004=|R|unsigned8[2]|{35|00}(corresponds to ET200B 32DO}
Specification of the Demonstration Slaves basedon the Slave Configuration Data.
Slave<no> The slave number is always 3 digits, and must bepadded with leading zeros. Read/write access isalways 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 configurationdata in bytes, dd are the decimal values of theconfiguration dataFor information on interpreting the configurationdata see the "DP Programming Interface"manual.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET186 6GK1971-0BA00-0AA1
Entry Meaning
3rd connection section[DEMO(Aliases)]
Predefined aliases for the simulated module.
Alias=DPVariablee.g.
Motor=Slave012M2EX0.3Heatingpower=Slave23M01AW3
This section contains any number of aliasdefinitions.
Alias Motor input bit of a slaveAlias Heatingpower refers to an output word of aslave.
Alias The alias can be used just like a normal DPvariable on the OPC interface.Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) . (period) & (), ANSI > 127
DPVariable On the OPC interface, the occurrence of thealias is replaced by this DP variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 187
8.4 S7 Protocol
Overv iew Editing the configuration file for the S7 protocol becomes necessary inthe 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 S7protocol set during installation is as follows:
<installationpath> \ OPC2.NT \ binS7 \ SCoreS7.txt
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET188 6GK1971-0BA00-0AA1
8.4.1 General Protocol Co nfig uration
General Pr otocolConfigu ration
The following table shows the parameters for configuring the generalproperties of the S7 OPC server.
Entry Meaning
Section [PROTOCOL] The general protocol settings are made in thissection. You can also make parameter settings for thetrace of the underlying protocol software (SAPI-S7).
S7_MINI_DB_PERSISTENCE_COUNT For selectable SAPI-S7 mini-dB parameters, seeSAPI documentationDefault 5
S7_MINI_DB_ABORT_TIMEOUT For selectable SAPI-S7 mini-dB parameters, seeSAPI documentationDefault 300
ConfigProtocolTrace SAPI-S7 trace parameters are setDefault 0
S7_MINI_DB_TRACE_TARGETS7_MINI_DB_TRACE_SELECTS7_MINI_DB_TRACE_DEPTHS7_MINI_DB_TRACE_FILENAME
Selectable SAPI-S7 trace parameter, see SAPIdocumentation
CycleTime This value specifies how quickly the job waiting list ischecked through for pending jobs.Default 100 ms(is set as "Request Cycle" by the configurationprogram)
UseAllAvailableVFD 1 The S7-OPC server logs on at all availableVFD|CP pairs. Since the search for VFD|CP pairsin particular can take some time, the VFD|CP pairsthat are actually required should be set using theconfiguration program.
0 The S7-OPC server logs on only at the VFD|CPpairs specified in the UseOnlyThisVFD parameter.
Default: 1(set by the configuration program)
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 189
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 terminatedby 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 simulationconnection with which variable access can besimulated 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 removedfrom the internal waiting list if it cannot be passed onto an OPC Alarms & Events client.Default 60000 ms
StoreEventsCount Maximum number of waiting protocol alarms in theinternal waiting list, that cannot be passed on to anOPC Alarms & Events client immediately after theprotocol alarm occurred.Default 500
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET190 6GK1971-0BA00-0AA1
8.4.2 Connectio n-Specific Co nfig uration
Overv iew Each S7 connection has up to 3 sections in the configuration file. Theconnection-specific parameters are configured in the first section, inthe 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 configurationparameters.
1. Connection section
Entry Meaning
[Connection|VFD|CP]e.g.[AG1|VFD1|CP_L2_1:]
Connection-specific parameters, the sectionnames correspond to the connection names.
S7_MINI_DB_INIT_REQ_AMQ_CALLINGS7_MINI_DB_INIT_REQ_AMQ_CALLEDS7_MINI_DB_INIT_REQ_AMQ_SIZES7_MINI_DB_INIT_REQ_RSP_CALLINGS7_MINI_DB_INIT_REQ_RSP_CALLEDS7_MINI_DB_INIT_REQ_RSP_SIZE
SAPI-S7 parameters that are set by the clientduring connection establishment, refer to theSAPI documentation.
InitiateReq 0 The connection is never established
1 The connection is established when required;in other words when a variable is accessedvia this connection.
2 The connection is always establishedactively.
Default 1
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 191
Entry Meaning
Passive 0 The OPC server actively establishes theconnection to the partner device
1 The partner device establishes theconnection. The InitiateReq parameter isignored in this case.
Default 0
AbortConnectionAfter 0 The OPC server only terminates a connectionto a partner when the OPC server is closeddown. During operation of the OPC server,once a connection has been established itremains even when it is no longer used.
n>0The OPC server terminates a connectionautomatically n milliseconds after the last useof the connection. This property must not beused if the parameter Passive=1 is set.
Default 0
Timeout Error monitoring time: If a pending job cannot beprocessed within this monitoring time, theconnection is reset and the job is acknowledgedwith an error.
Default 15000 ms
Events Administrating Messages (logon)0 Never1 SCAN messages as soon as appropriate
OPC items are used2 SCAN messages always after connection
establishment3 ALARM messages always after
connection establishment
One of the settings 2 or 3 is necessary forpassing on S7 messages to OPC Alarms &Events clients. At the same time, it isrecommended to set the parameter InitiateReq to2 so that the connection is maintainedpermanently.
Default 1
OptimizeS7Write 0 No optimization of S7 write access1 Optimization of S7 write access
Optimization of S7 write access is recommendedwhen a lot of (> 50) small S7 items (for examplebits or bytes) of an S7 area (for example memorybit area or data block) must be writtenSIMULTANEOUSLY and WITHOUT GAPS(entire bytes) (for example MX0.0 – MX10.7). Inthis case, the write jobs are put together to formone single write job for the larger area bringing
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET192 6GK1971-0BA00-0AA1
Entry Meaning
about a reduction in load on the network and onthe partner. If the conditions SIMULTANEOUSLYand WITHOUT GAPS are not met, theperformance of the core server may deteriorate.
Default 0OptimizeS7Read 0 No optimization of S7 read access
n Optimization of S7 read access with gaparea n-1
e.g. n = 3 -> 2 bytes gap area permitted.
Optimization of S7 read access is recommendedwhen a large number (> 50) of S7 items of an S7area (for example bit memory area or data block)must be read or monitored activelySIMULTANEOUSLY. In this case, the read jobsare put together to form one single read job forthe larger area bringing about a reduction in loadon the network and on the partner. S7 itemscovering the same area (for example MB0 andMW0) are put together. The larger area to beread can have n small gaps according to thesetting. We recommend that you set the value 11for "n" (10 bytes gap). If the conditionSIMULTANEOUSLY is not met, the performanceof the core server may deteriorate.
Default 11AutoPasswordReset 0 No automatic resetting of the S7
domain password1 Automatic resetting of the S7 domainpassword after connection establishment
Default 0
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 193
8.4.3 Definitio n of Symbolic Na mes
Defining Aliases The second section of the configuration file allows the definition ofsymbolic names for a valid S7 variable. An alias is a purely textualsubstitute for an otherwise valid S7 variable name.
Nesting of aliases is not supported, in other words an alias must alwaysrefer directly to a valid S7 variable.
The following table describes the section for defining aliases.
2. Connection section
Entry Meaning
[Connection|VFD|CP(Aliases)]e.g.[AG1|VFD1|CP_L2_1:(Aliases)]
Predefined aliases for this connection. Thesection name is made up of the connection nameand the additional "(Aliases)".
Alias=S7Variablee.g.
Motor=AB0Heatingpower=DB10,W0
This section contains any number of aliasdefinitions.
The symbolic name "Motor" references outputbyte 0; the name "Heatingpower" references dataword 0 in data block 10.
Alias The alias can be used just like a normal S7variable on the OPC interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) & (), ANSI > 127
S7Variable Internally, the OPC server replaces the variablename of the alias with this S7 variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET194 6GK1971-0BA00-0AA1
8.4.4 Setti ngs fo r S7 Messages
To pass on S7 messages to the OPC Alarms & Events clients, the severity of the event isrequired as the event parameter. This information is, however, not supported by the protocoland is not contained in the S7 messages themselves.
The following table describes the section for settings for S7 messages expected via an S7connection.
Entry Meaning
3rd connection section[Connection|VFD|CP(Severities)]e.g.[AG1|VFD1|CP_L2_1:(Severities)]
S7 message severities specified for thisconnectionThe section name is made up of theConnection name and "(Severities)".
DefaultScan Range of values: 1 <= n <= 1000Severity for scan messages for which no explicitseverity was specified
Default 300
DefaultAlarm Range of values: 1 <= n <= 1000Severity for scan messages for which no explicitseverity was specifiedDefault 500
MessageNN=Severitye.g.
Scan456=200Alarm333=900
This section contains any number of severitysettings for individual S7 messages.
S7 scan message ID546 has severity 200S7 alarm message ID333 has severity 900
Message EitherScan (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
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 195
8.4.5 Config uratio n of t he S7 Demo Connection
Int rodu ction For demonstrations, for testing, or during development it is useful to beable to operate the S7-OPC server without additional hardware. Forthis reason, the S7-OPC server provides the option of using simulatedS7 variables in a demo connection via the OPC interface.
Requi rements The demo connection can be activated by the configuration program orusing the "UseDemoCon“ parameter in the "PROTOCOL“ section ofthe configuration file.
Name This demonstration connection always has the name DEMO. Makesure that no other connection with this name exists in your networkconfiguration.
The demonstration connection contains the objects E, A, PE ,PA ,Mand data block 10. Variables can be created using alias definitions.
Entry Meaning
[DEMO(Aliases)] Aliases predefined for the demo connection.
Alias=S7Variablee.g.
Motor=AB0Heatingpower=DB10,W0
This section contains any number of aliasdefinitions.
The symbolic name "Motor" references outputbyte 0; the name "Heatingpower" references dataword 0 in data block 10.
Alias The alias can be used just like a normal S7variable on the OPC interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) & (), ANSI > 127
S7Variable Internally, the OPC server replaces the variablename of the alias with this S7 variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET196 6GK1971-0BA00-0AA1
8.5 FMS Protocol
Overv iew Editing the configuration file for the FMS protocol becomes necessaryin the following situations:
• when you want to change the handling of the object dictionary for aconnection. 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 setduring installation is as follows:
<installationpath> \ OPC2.NT \ binFMS \ SCoreFMS.txt
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 197
8.5.1 General Protocol Co nfig uration
General Pr otocolConfigu ration
The following table shows the parameters for configuring the generalproperties of the FMS-OPC server.
Entry Meaning
Section [PROTOCOL] The general protocol settings are made in thissection. You can also make parameter settings for thetrace of the underlying protocol software (SAPI-FMS).
FMS_MINI_DB_SEQ_REPEAT_CNT Selectable SAPI-FMS Mini-DB parameter, see SAPIdocumentationDefault 20(set by the configuration program)
FMS_MINI_DB_OD_NAME_LENGTH Selectable SAPI-FMS Mini-DB parameter, see SAPIdocumentationDefault 32
ConfigProtocolTrace SAPI-FMS trace parameters are setDefault 0
FMS_MINI_DB_TRACE_TARGETFMS_MINI_DB_TRACE_SELECTFMS_MINI_DB_TRACE_DEPTHFMS_MINI_DB_TRACE_FILENAME
Selectable SAPI-FMS trace parameter, see SAPIdocumentation. The numeric values corresponding tothe constants in the SAPI header files must beentered.
CycleTime This value specifies how quickly the job waiting list ischecked through for pending jobs.Default 100 ms(is set as "Request Cycle" by the configurationprogram)
UseAllAvailableVFD 1 The FMS-OPC server logs on at all availableVFD|CP pairs. Since the search for VFD|CP pairsin particular can take some time, the VFD|CP pairsthat are actually required should be set using theconfiguration program.
0 The FMS-OPC server logs on only at the VFD|CPpairs specified in the UseOnlyThisVFD parameter.
Default: 1(set by the configuration program)
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET198 6GK1971-0BA00-0AA1
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 terminatedby 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 simulationconnection with which variable access can besimulated 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() callto the protocol cyclically. This is intended toeliminate protocol bottlenecks.
0 The FMS-OPC server only sends an fms_receive()call to the protocol when it receives a WM_SINECmessage from the driver.
Default 1000 ms
WaitMultipleOD 0 A timeout error is generated if the read OD jobcannot be executed in the timeout time.
1 If a job for reading the OD cannot be executedbecause there is another OD job pending onanother connection, the job is delayed until it canbe executed. This does not cause a timeout error.
Default 1
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 199
8.5.2 Connectio n-Specific Co nfig uration
Overv iew Each FMS connection has up to 3 sections in the configuration file. Inthe first section, connection-specific parameters are configured, in thesecond section variables can be predefined and in the third sectionaliases can be defined for variables.
The configuration is evaluated when the FMS-OPC server starts up.
The following table describes the connection-specific configurationparameters.
Entry Meaning
1st connection section[Connection|VFD|CP]e.g.[AG1|VFD1|CP_L2_1:]
Connection-specific parameters, the sectionnames correspond to the connection names.
FMS_MINI_DB_INIT_REQ_PASSWORDFMS_MINI_DB_INIT_REQ_ACCESS_GROUPSFMS_MINI_DB_INIT_RSP_PASSWORDFMS_MINI_DB_INIT_RSP_ACCESS_GROUPS
SAPI-FMS parameter set at the client end duringconnection establishment, refer to the SAPIdocumentation (for example for passwords).
FMS_OD 1 Following connection establishment, theobject dictionary is read by the partner andthe variables it contains are evaluated. Sincereading the object dictionary puts aconsiderable load on the network and delaysthe connection establishment, wheneverpossible this should be omitted and localobject 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 onlypossible when a local object dictionary existsor variables are configured in the[connection(variables)] section of the textdatabase.
Default 1
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET200 6GK1971-0BA00-0AA1
Entry Meaning
FMS_MINI_DB_OD_FORMAT 0 A short object dictionary is read from thepartner.
1 A long object dictionary is read from thepartner. The long object dictionary containsadditional information such as the variablename and access rights. The long objectdictionary can only be read when theconnection 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 whenthe partner device is accessed.
2 The connection is always established activelyregardless of its use.
Default 1
AcceptInitiateInd 1 A connection establishment request from thepartner is always accepted.
2 The connection establishment request of thepartner is not accepted, the FMS-OPC servercan, however, attempt to establish theconnection to the partner itself.
Default 1
AbortConnectionAfter 0 The FMS-OPC server never terminates aconnection itself (except when the FMS-OPCserver is closed down)
n > 0The FMS-OPC server terminates aconnection automatically after n ms after thelast use of the connection.
Default 0
Timeout Error monitoring time: If a pending job cannot beprocessed within this monitoring time, theconnection is reset and the job is acknowledgedwith an error.
Default 15000 ms
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 201
8.5.3 Variable Defi nition
Overv iew The following section of the configuration file allows the definition ofthe FMS variables valid for this connection. For access to variables,the FMS protocol requires information about the properties of thevariables, for example, data type, access rights etc. Variables of aconnection that are required often can be predefined in this section sothat, for example, the data type is known prior to connectionestablishment.
An alternative to defining variables in this section is the use of a localobject dictionary.
The following table describes the parameters for variable definition.
Entry Meaning
2nd connection section[Connection|VFD|CP(Variables)]e.g.[AG1|VFD1|CP_L2_1:(Variables)]
Variables predefined for this connection. Thesection name consists of the connection nameand the additional part "(Variables)".
Name=Index|AccessRights|Typee.g.
NAME100=100|RW|booleanNAME101=101|RW|integer8|NAME102=102|RW|integer16|NAME103=103|RW|integer32NAME104=104|RW|unsigned8NAME105=105|RW|unsigned16Power=106|RW|unsigned32Temperature=107|RW|floatNAME108=108|RW|vstring5NAME109=109|RW|bstring8NAME112=112|RW|integer8[4]NAME119=119|RW|ostring5[3]NAME120=120|RW|{integer8|float|vstring3}|
NAME130=130|RW|fmsdate
NAME131=131|RW|fmstimeofday4
NAME132=132|RW|fmstimedifference4
NAME133=133|RW|fmstimeofday6
NAME134=134|RW|fmstimedifference6
This section contains any number of variabledefinitions
Boolean1 byte integer2 bytes integer4 bytes integer1 byte unsigned integer2 bytes unsigned integer4 bytes unsigned integer4 bytes floating pointCharacter string 5 charactersBit string 8 bitsArray of 4 integersArray of 3 octet strings with a length of 5 bytes
Structure with integer, floating point andcharacter string with 3 charactersStructures can have a maximum of 10components.FMS-Date
FMS-TimeOfDay
FMS-TimeDifference
FMS-TimeOfDay (with days from 01.01.1984)
FMS-TimeDifference (with days from30.12.1899)
The individual elements of the variable definitionmust be separated with the pipe character '|' and
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET202 6GK1971-0BA00-0AA1
Entry Meaning
must not contain blanks.Name Name in the long object dictionary
Range of values: Length maximum 32characters, however not longer than defined inthe FMS_MINI_DB_OD_NAME_LENGTHparameter 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 fmstimedifferencerequire additional length information, with bstringthis is always a multiple of 8. Arrays require thenumber of array elements in square brackets,structures can only contain simple data types inthe braces (in other words no arrays orstructures).
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 203
8.5.4 Definitio n of Symbolic Na mes
Defining Aliases The third section of the configuration file allows the definition ofsymbolic names for a valid FMS variable. An alias is a purely textualsubstitute for an otherwise valid FMS variable name or FMS variableindex.
Nesting of aliases is not supported, in other words an alias must alwaysrefer directly to a valid FMS variable.
The following table describes the section for defining aliases.
Entry Meaning
3rd connection section[Connection|VFD|CP(Aliases)]e.g.[AG1|VFD1|CP_L2_1:(Aliases)]
Predefined aliases for this connection. Thesection name is made up of the connection nameand the additional "(Aliases)".
Alias=FMSVariablee.g.
Motor=100Heatingpower=Power
This section contains any number of aliasdefinitions.
The symbolic name "Motor“ refers to FMS Index100, the "Heatingpower“ name refers to the FMSname "Power".
Alias The alias can be used just like a normal FMSvariable on the OPC interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) & (), ANSI > 127
FMSVariable Internally, the OPC server replaces the variablename of the alias with this FMS variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET204 6GK1971-0BA00-0AA1
8.5.5 Config uratio n of t he FMS Server Connection
Int rodu ction The FMS-OPC server can also be operated as an FMS server as wellas an FMS client. Via an FMS server connection, the FMS-OPC serverprovides variables that can be accessed by other FMS devices.To be able to act as an FMS server, the OPC server must be startedwith the help of an OPC client (for example OPC Scout).
Configu ration Each FMS VFD|CP pair implicitly has one server connection. All thecommunications partners of a VFD|CP pair can access the variablesdefined on the server connection via the communication system. Thevariables of the server connection are addressed like normal FMSvariables on the OPC interface of the FMS-OPC server. Just like anormal FMS connection, the server connection also contains threeconfiguration sections.
The name of the connection section is made up of the name of aVFD|CP pair. In this section, a symbolic name can be defined for theserver connection that is then used in further sections.
Entry Meaning
1st connection section[|VFD|CP]e.g.[|VFD1|CP_L2_1:]
General server parameters
The connection name of the server connection isempty unless otherwise configured, in otherwords it consists only of the VFD and CP name.
Server Activating the server connection
1 The VFD-specific server connection iscreated.
2 The VFD-specific server connection is notcreated.
Default 1
ServerConnectionName The server connection can be assigned aconnection name. This must be different fromthe FMS connection name of this VFD. If aconnection name is entered here, all the namesof the sections are changed correspondingly.
Default ”empty”
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 205
Entry Meaning
2nd connection section[|VFD|CP(Variables)]e.g.[|VFD1|CP_L2_1:(Variables)]
Contains defined variables for the serverconnection. If a name is entered in"ServerConnectionName" in the 1st connectionsection, this name must precede the entrieshere. Example:[MyServer|VFD1|CP_L2_1:(Variables)]
Name=Index|AccessRights|Type|Initial-valuee.g.
100=100|RW|boolean|-1101=101|RW|integer8|-123102=102|RW|integer16|-12345103=103|RW|integer32|-1234567104=104|RW|unsigned8|234105=105|RW|unsigned16|23456Power=106|RW|unsigned32|2345678Temperature=107|RW|float|1,345108=108|RW|vstring5|"abcde"109=109|RW|bstring8|1.0.0.1.1.0.0.0112=112|RW|integer8[4]|{10|20|30|40}119=119|RW|ostring6[3]|{00.01.02.03.04.05|40.41.42.43.44.45|d0.d1.d2.d3.d4.d5}120=120|RW|{integer8,float,vstring3}|{-55|3|5|"xyz"}
130=130|RW|fmsdate|23:59:59 01.01.1999131=131|RW|fmstimeofday4|12:00:00132=132|RW|fmstimedifference4|01:10:22133=133|RW|fmstimeofday6|17:12:5901.01.1985134=134|RW|fmstimedifference6|17:12:4501.01.1901
This section contains any number of variabledefinitions
Boolean1 byte integer2 bytes integer4 bytes integer1 byte unsigned integer2 bytes unsigned integer4 bytes unsigned integer4 bytes floating pointCharacter string 5 charactersBit string 8 bitsArray of 4 integersArray of 3 octet strings with a length of 6 bytes
Structure with integer, floating point andcharacter string with 3 characters
FMS dateFMS time of dayFMS time differenceFMS time of day (with days from 01.01.1984)
FMS time difference (with days from 30.12.1899)
Structures can have a maximum of 10components.
The individual elements of the variable definitionmust be separated with the pipe character '|' andmust not contain blanks (exception: initial valueof 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 thecommunications partner to this variable via FMSconnections. Read and write access to thesevariables via the OPC interface is alwayspossible.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET206 6GK1971-0BA00-0AA1
Entry Meaning
Type FMS types: The string types vstring, ostring,bstring, fmstimeofday and fmstimedifferencerequire additional length information, with bstringthis is always a multiple of 8. Arrays require thenumber of array elements in square brackets,structures can only contain simple data types inthe braces (in other words no arrays orstructures).
Initialvalue The initial value must always correspond to theparticular data type. All initial values of arrays orstructures must be enclosed in braces and beseparated by the pipe symbol "|". The initialvalue is optional but should always be used.
Entry Meaning
3rd connection section[|VFD|CP(Aliases)]e.g.[|VFD1|CP_L2_1:(Aliases)]
Aliases predefined for the server connection.
Alias=FMSVariablee.g.
Motor=100Heatingpower=Power
This section contains any number of aliasdefinitions.
Alias Motor references FMS index 100.Alias Heatingpower references FMS namePower.
Alias The alias can be used just like a normal FMSvariable on the OPC interface.
FMSVariable On the OPC interface, the occurrence of thealias is replaced by this FMS variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 207
8.5.6 Config uratio n of t he FMS Demo Connection
Int rodu ction For demonstrations, for testing, or during development it is useful to beable to operate the FMS-OPC server without additional hardware. Forthis reason, the FMS-OPC server has the option of defining variablesin a demo connection and using these simulated FMS variables via theOPC interface.
Requi rements The demo connection can be activated by the configuration program orusing the "UseDemoCon“ parameter in the "PROTOCOL“ section ofthe configuration file.
Name This demonstration connection always has the name DEMO. Makesure that no other connection with this name exists in your networkconfiguration.
Just like a normal FMS connection, the demo connection also hasthree configuration sections.
Entry Meaning
1st connection section[DEMO]
Connection-specific parameters. No parametersare defined within this section.
Entry Meaning
2nd connection section[DEMO(Variables)]
Variables defined for the demo connection.
Name=Index|AccessRights|Type|Initial-value
see Server Connection (8.5.5)
This section contains any number of variabledefinitions.
see Server ConnectionName 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 viathe OPC interface is possible depending on theaccess rights.
Type FMS types, the string types vstring, ostring andbstring also require length information. Arraysrequire the number of array elements in squarebrackets, structures in braces must only containsimple data types (in other words no arrays orstructures).
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET208 6GK1971-0BA00-0AA1
Initialvalue The initial value must always correspond to theparticular data type. All initial values of arrays orstructures must be enclosed in braces and beseparated by the pipe symbol "|". The initialvalue is optional but should always be used.
Entry Meaning
3rd connection section[DEMO(Aliases)]
Aliases predefined for the demo connection.
Alias=FMSVariablee.g.
Motor=100Heatingpower=Power
This section contains any number of aliasdefinitions.
Alias Motor references FMS index 100.Alias Heatingpower references FMS namePower.
Alias The alias can be used just like a normal FMSvariable on the OPC interface.
FMS Variable On the OPC interface, the occurrence of thealias is replaced by this FMS variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 209
8.5.7 Creating a Local Object Dictio nary
Int rodu ction The defined variables are contained in an object dictionary of an FMSserver. Normally, FMS devices can make this object dictionaryavailable to the partner device via the communication system. An FMSclient requires information from the object dictionary (for exampledefined indexes and access rights) to access variables.
Local Obj ectDict ion ary
Depending on the partner device, loading an object dictionary can takea considerable amount of time. If high indexes were configured withinan object dictionary, the connection establishment can be considerablydelayed. There is also a significant increase in load on the network.The situation is made worse since the communication software cannotquery the object dictionaries of different devices at the same time.
If a system consists of several FMS servers that are accessed by thePC as FMS client, the startup phase of the system can take anextremely long time and it is even possible that no reliable connectionestablishment is possible.
For this reason, the FMS-OPC server provides the option of using anobject dictionary loaded at a different time and maintained in localstorage.
Creat ion To create a local object dictionary, you require the ODUPLOAD.EXEprogram. 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 promptand 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" specifythe CP|VFD pair. The "filename“ parameter specifies the path and filename of the local object dictionary to be created. The optionalparameter "odformat“ decides whether a long (value 1) or a short (0)object dictionary is requested. The standard value for this parameter is0. With the "timeout“ parameter, the time is specified in millisecondsafter which an error is detected. The standard value is 120000 for 2minutes.
Example: odupload "AG <1>|VFD <1>|CP_L2_1:" myconn.od 1240000
Uses To allow the local object dictionary to be used for a connection, thepath and file name of the created file must be entered as the value forthe parameter "FMS_OD_LOCALFILE“ in the connection section. The"FMS_OD“ parameter must also be set to 0 to prevent the transfer ofthe object dictionary via the network.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET210 6GK1971-0BA00-0AA1
8.6 Send/Recei ve Protocol
Overv iew Editing the configuration file for the Send/Receive protocol becomesnecessary in the following situations:
• when you want to use symbolic connection names in each variablename 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 setduring installation is as follows:
<installationpath> \ OPC2.NT \ binSR \ SCoreSR.txt
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 211
8.6.1 General Protocol Co nfig uration
General Pr otocolConfigu ration
The following table shows the parameters for configuring the generalproperties of the SR-OPC server.
Entry Meaning
Section [PROTOCOL] The general protocol settings are made in thissection.
CycleTime This value specifies how quickly the job waitinglist is checked through for pending jobs.Default 100 ms(set by the configuration program)
UseOnlyThisDevice Access points (devices) at which the SR-OPCserver logs on. Several access points areseparated by commas.
Caution: The last access point must beterminated by a comma.
Example:UseOnlyThisDevice=TCPIP:, CP_H1_1:,
UseDemoConn 1 The SR-OPC server generates a simulationconnection with which variable access can besimulated without a functioning protocol.
0 No simulation connection is provided.Default 0(set by the configuration program)
BufferLength Segmentation of the data bufferRange of values 512 – 4096A change in the default maximum value is onlyrequired when you are operating a TF databaseof the SIMATIC NET TF communication protocolat the same time. The maximum value must bematched with the buffer pool of the TF database(PDU size setting in the COML TF configurationtool, refer to the TF documentation).Default 4096
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET212 6GK1971-0BA00-0AA1
8.6.2 Connectio n Config uratio n for a Specific Access Point
Overv iew Each access point used by the SR-OPC server has a section in thetext database file in which connections to network partners includingsymbolic names can be predefined. The advantage of this is that whenthe configuration is changed, (for example changed Ethernet addresson the communication partner) the address only needs to be changedat one central point if the symbolic name was also used by the OPCapplication in the SR variables.
The following table describes the configuration parameters for theaccess points:
Entry Meaning
Access point section[Access point(Connections)]e.g.[CP_H1_1:(Connections)]
Connection predefined for this accesspoint. During operation, furtherconnections can be used with suitableSR variable notations.
Name=LocalTSAP,HostID,RemoteTSAP,ActiveFlage.g.
S5Receive=&PCPCPCPC,142.11.45.150,&RECVRECV,0S5Send=FF.FF.FF.FF, 142.11.45.150,AA.AA.AA,1
S5Fetch=&PCPCPCPC,08.00.06.01.26.70,&PCPCPC01,1S5Write=&PCPCPCPC,08.00.06.01.26.70,&PCPCPC02,1S5ReceiveExp=&PCPCPCPC,08.00.06.01.26.70,&RECVREEX,0S5SendExp=&PCPCPCPC,08.00.06.01.26.70,&SENDSEEX,1
This section contains any number ofconnection definitions.
Passive connection establishment,TCPIP
Active connection establishment, TCPIP,as alternative TSAPActive connection establishment, ISO
Active connection establishment, ISO
Passive connection establishment, ISO
Active connection establishment, ISO
The individual elements of theconnection definition must be separatedby commas and must not contain blanks.
Name Symbolic connection name,Range of values: Length maximum 32characters, permitted characters: a-z A-Z0-9 $ _ (underscore)
LocalTSAP Local TSAP, two notations are possible:1. Hex Notation
xx.xx.xx.xx.xx.xx.xxmaximum 8 two-digit hexadecimalvalues separated by periods.
2. Alternative String Notation&TTTTTTTTpreceding & symbol followed by amaximum of 8 printable characters. Thecomma must not be used.If you want non-printable characters or
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 213
Entry Meaning
commas in the TSAP name, you mustuse hexadecimal notation.
HostID Ethernet or TCP/IP address of thepartner station.1. Ethernet
xx.xx.xx.xx.xx.xxexactly 6 two digit, hexadecimalvalues separated by periods.
2. TCP/IPyyy.yyy.yyy.yyyexactly 4 3-digit decimal valuesbetween 0 and 255 separated byperiods.
RemoteTSAP TSAP of the partner station, the notationis the same as for LocalTSAP.
ActiveFlag 0 Passive establishment, thepartner establishes theconnection
1 Active establishment, thepartner waits forconnection establishment
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET214 6GK1971-0BA00-0AA1
8.6.3 Connectio n-Specific Co nfig uration
Overv iew Each SR connection has up to two sections in a text database file. Theconnection-specific parameters are configured in the first section, inthe second section, aliases for variables can be defined. Theconfiguration is evaluated when the SR-OPC server starts up.
The following table describes the configuration parameters for theconnections:
Entry Meaning
1st connection section[Connection Name|Address|Access Point]e.g.[LocalClient||TCPIP:][|&TCP2,142.11.45.150,&TCP1,1|TCPIP:]
Connection-specific parametersIf no symbolic name exists for a connection, thismust be used, otherwise the symbolic address.They must not both be used at the same time.
Conn_persistance_count SR parameter of the SR variable field 1, see SRdocumentation
Default 0
Conn_abort_timeout SR parameter of the SR variable field 1, see SRdocumentation
Default 0
Conn_negot_options SR parameter of the SR variable field 1, see SRdocumentation
Default 0x0000
AbortConnectionAfter 0 The SR-OPC server never terminates aconnection itself (except when the SR-OPCserver is closed down)
n > 0 The FMS-OPC server terminates aconnection automatically n ms after the lastuse 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, forexample, prevent a read job being requested ona SEND connection which would lead to aconnection close by the partner.
0 S5 variables are not permitted on thisconnection.
1 S5 variables are permitted onl y with readaccess
2 S5 variables are permitted onl y with writeaccess
Default 0(If direct access to S5 variables is required
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 215
Entry Meaning
with FETCH or SEND with WRITE function,this parameter must be set.)
Initiate Controls the point in time at which a connectionis established
1 The connection is established actively wherenecessary when the partner is accessed
2 The connection is established actively assoon as the connection is closed. (Forexample when the program starts up)
Default 1
Timeout Error monitoring time: If a pending job cannot beprocessed within this monitoring time, theconnection is reset and the job is acknowledgedwith an error.
Default 15000 ms
LenSend Preset size of the default send bufferDuring operation, further additional send buffersof any length (maximum 65535 bytes) can beused.
Default 256
LenSendExp Preset size of the default send buffer for highpriority data.
During operation, additional send buffers of anylength (max. 16 bytes) can be used.
Default 16
Entry Meaning
2nd connection section[Connection Name|Address|AccessPoint(Aliases)]e.g.[LocalClient||TCPIP:(Aliases)][|&TCP2, 142.11.45.150,&TCP1,1|TCPIP:(Aliases)]
Predefined aliases for this connection. An alias isa purely textual substitute for an otherwise validSR variable name.
Nesting of aliases is not supported, in otherwords an alias must always refer directly to avalid SR variable of this connection.
Alias=SRVariablee.g.
Motor=Receive,w0Heatingpower=Send10,dword3
This section contains any number of aliasdefinitions.
Alias motor refers to a word in the receive block.
Alias heatingpower refers to a double word withina send buffer.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET216 6GK1971-0BA00-0AA1
Entry Meaning
Alias The alias can be used like a normal SR variableon the OPC interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) & (), ANSI > 127
SRVariable On the OPC interface, the occurrence of thealias is replaced by this SR variable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 217
8.6.4 Config uratio n of t he Demo Connection
Int rodu ction For demonstrations, testing, or development it is useful to be able torun the SR-OPC server without additional hardware. The SR-OPCserver therefore has the option of defining variables in a democonnection and using these simulated SR variables via the OPCinterface.
Requi rements The demo connection can be activated by the configuration program orusing the "UseDemoConn“ parameter in the "PROTOCOL“ section ofthe configuration file.
Name This demonstration connection always has the name DEMO. Makesure that no other connection with this name exists in your networkconfiguration.
Defaul t Var iables Apart from the SR variables that are always present, the democonnection has the following variables:
• RECEIVE• receiveexp• send• sendexp
Also the simulation of a direct S5 access. The following areas aresimulated:
• 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[DEMO]
Connection-specific parameters, this section isnot currently supported.
Entry Meaning
2nd connection section[DEMO(Aliases)]
Aliases predefined for the demo connection.
Alias=SRVariablee.g.
Motor=Receive,w0Heatingpower=Send10,dword3
This section contains any number of aliasdefinitions.
Alias motor refers to a word in the receive block.Alias heatingpower refers to a double word withina send buffer.
Alias The alias can be used like a normal SR variableon the OPC interface.Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) & (), ANSI > 127
SRVariable On the OPC interface, the occurrence of thealias is replaced by this SRvariable.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET218 6GK1971-0BA00-0AA1
8.7 Send/Recei ve Protocol for PROFIBUS (FDL)
Overv iew You must edit the configuration file for the Send/Receive protocol inPROFIBUS (FDL) in the following situations:
• when you want to use symbolic connection names in each variablename 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 setduring installation is as follows:
<installation path> \ OPC2.NT \ binFDL \ SCoreFDL.txt
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 219
8.7.1 General Protocol Co nfig uration
General Pr otocolConfigu ration
The following table shows the parameters for configuring the generalproperties of the FDL-OPC server.
Entry Meaning
Section [PROTOCOL] The general protocol settings are made in thissection.
CycleTime Default 100 ms.
This value specifies how quickly the job waitinglist is checked through for pending jobs.
UseOnlyThisDevice Access points (devices) at which the FDL corelogs on. Several access points are separated bycommas. Caution: The last access point must beterminated 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 simulationconnection with which item access can besimulated without a functioning protocol.
AutoDefineConnection 0 Default
1 The FDL core server detects all connectedpartners when it is started up and creates aconnection for each of them via the defaultSAPs. Since these connections are entered inthe text database, the core server resets thisflag to 0 again after it has been used once.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET220 6GK1971-0BA00-0AA1
8.7.2 Connectio n Config uratio n for a Specific Access Point
Overv iew Each FDL access point has a further section in the text database file inwhich connections to network partners including symbolic names canbe predefined. The advantage of this is that when the configuration ischanged, (for example changed PROFIBUS station address on thecommunication partner) the address only needs to be changed at onecentral point if the symbolic name was also used by the OPCapplication in the FDL items.
The following table describes the configuration parameters for theconnections:
Entry Meaning
Access point section[Access point(Connections)]e.g.[CP_L2_1:(Connections)]
Connection predefined for this access point.During runtime, further connections can becreated using suitable FDL item notations.
Name=LocalSAP,STATION,RemoteSAPe.g.PLC1=15,11,14STATION_10=255,10,255
This section contains any number of connectiondefinitions.
The individual elements of the connectiondefinition must be separated by commas andmust not contain blanks.
Name Symbolic connection name,
Range of values: Length maximum 32characters. 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
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 221
8.7.3 Connectio n-Specific Co nfig uration
Overv iew 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. Theconfiguration is evaluated when the FDL core starts up.
The following table describes the configuration parameters for theconnections:
Entry Meaning
1st connection section[Connection Name|Address|Access Point]e.g.[PLC1|CP_L2_1:][|255,10,255|CP_L2_1:]
Connection-specific parameters
If no symbolic name exists for a connection, thismust be used, otherwise the symbolic address.They must not both be used at the same time.
Timeout Default 15000 ms
Error monitoring time: If a pending job cannot beprocessed within this monitoring time, theconnection is reset and the job is acknowledgedwith an error.
MaxSendCredits Default 3
Maximum number of parallel send jobs on thisconnection
MaxRetryNoRessources Default 5
Maximum number of repeated send attempts ifthe partner is temporarily unable to receive dueto a lack of resources
Conn_negot_options Default 0x0000
FDL parameter of the FDL variable field 1, seeFDL documentation
LenSendSDA Default 244 or 246 (with default SAPs)
Preset size of the default send buffer foracknowledged sending.
During operation, further additional send buffersof any length (maximum 244 or 246 bytes) canbe used.
LenSendSDN Default 244 or 246 (with default SAPs)
Preset size of the default send buffer forunacknowledged sending.
During operation, further additional send buffersof any length (maximum 244 or 246 bytes) canbe used.
Entry Meaning
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET222 6GK1971-0BA00-0AA1
2nd connection section[Connection Name|Address|AccessPoint(Aliases)]e.g.[PLC1|CP_L2_1:][|255,10,255|CP_L2_1:]
If no symbolic name exists for a connection, thismust be used, otherwise the symbolic address.They must not both be used at the same time.
Predefined aliases for this connection. An alias isa purely textual substitute for an otherwise validFDL item.
Nesting of aliases is not supported, in otherwords an alias must always refer directly to avalid FDL item of this connection.
Alias=FDLIteme.g.
Motor=Receive,w0
Heatingpower=Send10,dword3
This section contains any number of aliasdefinitions.
Alias motor refers to a word in the receive block.
Alias heatingpower refers to a double word withina send buffer.
Alias The alias can be used just like a normal FDLitem on the IVar interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) & (), ANSI > 127
FDLItem On the Ivar interface, the occurrence of the aliasis replaced by this FDL item.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 223
8.7.4 Config uratio n of t he FDL Demo Connection
Overv iew For demonstrations, for testing, or during development it is useful to beable to operate the FDL-OPC server without additional hardware. Forthis reason, the FDL-OPC server has the option of defining variables ina demo connection and using these simulated FDL variables via theOPC interface.
Requi rements 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. Makesure that no other connection with this name exists in your networkconfiguration.
Entry Meaning
1st connection section[DEMO]
Connection-specific parameters, this section isnot currently supported.
Entry Meaning
2nd connection section[DEMO(Aliases)]
Aliases predefined for the demo connection.
Alias=FDLIteme.g.
Motor=Receive,w0
Heatingpower=Send10,dword3
The section contains any number of aliasdefinitions, see above.
Alias motor refers to a word in the receive block.
Alias heatingpower refers to a double word withina send buffer.
The demo connection always contains the following FDL variables:
• Receive
• Send
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET224 6GK1971-0BA00-0AA1
8.7.5 Dynamic Co nnectio ns
ManagingConn ections
The FDL core can create and manage new connections duringoperation using an FDL variable with a suitable connection definitionusing 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.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 225
8.8 DPS Protocol
Overv iew 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 variablename 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 setduring installation is as follows:
<installation path> \ OPC2.NT \ binDSP \ SCoreDPS.txt
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET226 6GK1971-0BA00-0AA1
8.8.1 General Protocol Co nfig uration
General Pr otocolConfigu ration
The following table shows the parameters for configuring the generalproperties of the DPS-OPC server.
Entry Meaning
Section [PROTOCOL] The general protocol settings are made in thissection.
CycleTime Default 20 ms
This value specifies how quickly the job waitinglist is checked through for pending jobs.
UseOnlyThisBoard Default DPSONLINE,
Board at which the DPS core logs on.
UseDemoBoard 0 DefaultNo simulation connection is made available.
1 The DPS core generates a simulationconnection with which slave access can besimulated without a functioning protocol. Theslaves available in the demo connection canbe configured.
CSWatchThread 0 Default.Debug monitoring deactivated.For debugging purposes; not intended to bedocumented for the user.
1 The DPS core creates the files WatchCS.iniand WatchCS2.ini cyclically in the WindowsNT root folder. These files contain informationabout the most important internal criticalsections.
ClearAlarms Default 60000 ms
Time after which a pending protocol alarm isremoved from the internal waiting list if it cannotbe passed on to an IAlarm client.
Alarms are not currently supported and thisparameter should therefore not be documentedfor the user.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 227
8.8.2 Connectio n-Specific Co nfig uration
Overv iew 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. Theconfiguration is evaluated when the DPS core starts up; Softnet DPslave currently only supports the simultaneous operation of a singleslave.
Generally, the user must modify almost all board-specificconfigurations since these largely determine the behavior of the slave.
The following table contains the configuration parameters for theboard.
Entry Meaning
1st Board Section[Boardname]e.g.[CP_L2_1:]
Logon parameters set for this board.
GSD Standardized PROFIBUS GSD file that identifiesthe slave. The core server, however, only usesthe information PNO_Ident and the first moduledescription.
StationAddr PROFIBUS station address for the slave
Baudrate Baudrate used, the following values are possible:
Baudrate=BD_9K6Baudrate=BD_19K2Baudrate=BD_93K75Baudrate=BD_187K5Baudrate=BD_500KBaudrate=BD_1M5Baudrate=BD_3MBaudrate=BD_6MBaudrate=BD_12MBaudrate=BD_45K45
AutoOnline 1 Default: The core server switches the slaveonline when it starts up.
0 The core server does not switch the slaveonline when it starts up, the slave is then onlyready for operation when the item&devicestate() is written.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET228 6GK1971-0BA00-0AA1
Entry Meaning
2nd Board Section[Boardname(Aliases)]
e.g.[DPSONLINE(Aliases)]
Predefined alias for this board An alias is apurely textual substitute for an otherwise validDPS item.
Nesting of aliases is not supported, in otherwords an alias must always refer directly to avalid DPS item of the board.
Alias=DPSItem
e.g.Motor=SlaveM2EX0.3
Heatingpower=SlaveAW3
This section contains any number of aliasdefinitions.
Alias Motor input bit of a slave
Alias Heatingpower refers to an output word of aslave.
Alias The alias can be used just like a normal DPSitem on the IVar interface.
Range of values: Length maximum 32characterspermitted characters: a-z A-Z 0-9 $ _(underscore) . (period) & (), ANSI > 127
DPSItem On the Ivar interface, the occurrence of the aliasis replaced by this DPS item.
Configuration Using Files
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 229
8.8.3 Config uratio n of t he DPS Demo Connection
Int rodu ction For demonstrations, for testing, or during development it is useful to beable to operate the DPS-OPC server without additional hardware. Forthis reason, the DPS-OPC server has the option of defining variablesin a demo connection and using these simulated DPS variables via theOPC interface.
Requi rements The demo board is activated when the "UseDemoBoard" parameter isset 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, thissection should not be made public to the user but a text databasecontaining several useful sample slaves should be made available.
Entry Meaning
1st Demo Board Section[DEMO]
Connection-specific parameters, this section isnot currently supported.
GSD Standardized PROFIBUS GSD file that identifiesthe slave. The core server DPS, however, usesonly the first module description.
Entry Meaning
3rd Demo Board Section[DEMO(Aliases)]
Predefined aliases for the demo board. An aliasis a purely textual substitute for an otherwisevalid DPS item.
Nesting of aliases is not supported, in otherwords an alias must always refer directly to avalid DPS item of the demo board.
Alias=DPSItem
e.g.Motor=SlaveM2EX0.3
Heatingpower=SlaveAW3
This section contains any number of aliasdefinitions, see above.
The "Motor" alias references an input bit of aslave.
Alias "Heatingpower" references an output wordof a slave.
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET230 6GK1971-0BA00-0AA1
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 231
9 DCOM with the OPC Server for SI MATIC NET
With Windows NT, version 4.0 or higher, the client can run COM objects on anothercomputer. This functionality that allows the COM objects of an application to bedistributed 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 theDCOM functionality.
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET232 6GK1971-0BA00-0AA1
9.1 Int roduction to DCOM
What is DCOM? COM objects such as the OPC server do not necessarily need to be onthe same computer as the client. With DCOM (Distributed COM), aclient can create and use COM objects both on its own system and onother computers. This allows the components of an application to bedistributed within a network.
COM Library A client does not address an object directly to start it or use it butaccesses the COM library. This is part of the operating system. TheCOM library manages information in the registry about the COM objectknown in the system.
The following schematic illustrates how a COM object is used on thelocal machine or on another computer.
OPC cl ient OPC server
COM l ibrary
Computer
OPC-Client OPC server
COM-Bibliothek
Computer A
COMlibrary
Computer B
OPC client
COMlibrary
Network
Transparency For the client, the use of a COM object with DCOM or with local COMmechanisms is transparent. The operating system internal COM librarymanages the object and recognizes where the object should be createdbased on the object configuration.
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 233
9.2 Configu ring DCOM Ope ration
Program"dcomcnfg"
Before a client can use a COM object on another computer, theproperties of the COM object must be configured on the clientcomputer and on the remote computer.
DCOM and the COM objects required on the computer are configuredusing 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 forconfiguring DCOM:
Please note the following:
If you lower the security settings, the system must be restarted toactivate the changes.
Caution:
The setting s li sted in thi s descr iption gu arantee s impleinstallation and startup of th e DCOM proto col. So me of thesecurity sett ing s of Window s NT are reduced. To meet str ictersecurity re qui rements, y ou must increase t he sett ing s accordingto th e DCOM guid elin es.
This text describes the situation in which exactly one client connects toan OPC server running on a different computer. If you want to usemore than one OPC server from a client, please refer to the DCOMdocumentation.
☞
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET234 6GK1971-0BA00-0AA1
Default P roperties In the "Default Properties" tab, you specify basic properties of DCOM.For DCOM operation with the OPC server within a workgroup (nodomain server available for authentication) make the settings asshown.
If a domain server can be used for authentication, the defaultauthentication level can be set to "Connect" and the DefaultImpersonation Level to "Identify" for security reasons. For installationand startup, however, the settings shown below are also recommendedfor this mode.
Defaul t Security In the "Default Security" tab, you can specify the rights for DCOMoperation. These settings make sure that only clients with the correctpermissions can use the server.
The following default permissions are relevant in conjunction withDCOM:
• Access permissions
• Launch permissions
• Configuration permissions
These permissions can be set individually for each object and thedefault properties are then ignored.
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 235
AccessPermissions
The default access permissions for all COM objects specify whichaccounts are allowed to access the object; in other words call themethods and which accounts are explicitly denied access.
LaunchPermissions
The default launch permissions for all COM objects specify whichaccounts have the right to create the object and which accounts areexplicitly denied this permission.
Configu rationPermissions
The default configuration permissions specify which accounts canmodify the information in the registry about COM objects; in otherwords can also install new objects on the computer.
Appli cations The "Applications" tab displays all the COM objects available on thecomputer. Here, you select a COM object you want to configure andopen the configuration dialog by clicking the "Properties" button.
The OPC server for SIMATIC NET is listed as "OPC.SimaticNET".
Select t he obj ect"OPC Server f orSIMATIC NET"
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET236 6GK1971-0BA00-0AA1
9.2.1 Config uratio n of t he Server Computer
Differe ntConfigu rations
The DCOM configuration for the computer with the OPC client differsfrom that of the computer with the OPC server:
• For the computer with the OPC client, you must set the computer inthe network on which the server will be activated and the accountfor the server.
• For the computer with the OPC server, you must set the accountsthat have the right to use the server. In addition to the specialpermissions in conjunction with OPC, the account of the user of theOPC servers must also have user permissions.
"Lo cation" Tab
The "Location" tab is used to specify the computer on which the serveris started. Since the configuration of the computer with the OPC serveris described in this section, you must specify "Run application on thiscomputer".
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 237
"Id entit y" Tab
The settings made in the "Identity" tab specify the account to beaccessed to check the permissions of the user of the object. Here,various settings are possible:
• Interactive user
• Launching user
• This user
" Interact ive User" The account of the currently logged on user is used. If, however, nouser uses the computer, there is no interactive user and the COMobject cannot be created. For server operation, use the setting "Thisuser". "Interactive user" is the default setting for the OPC server forSIMATIC NET.
"The LaunchingUser"
The account of the user that launched the OPC client is used. Thisuser must then also have the required permissions; in other words,must be entered in the "Security" tab. The user must also have thedefault permissions entered for the group of users on this computer; inother words, must belong to the group of users. This mode must notbe used with the OPC server for SIMATIC NET since the OPC servercannot be started more than once (by different users).
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET238 6GK1971-0BA00-0AA1
This User The account of a specified user is used. This user must have therequired permissions; in other words, must be entered in the "Security"tab. The user must also have the default permissions entered for thegroup of users on this computer; in other words, must belong to thegroup of users. This setting must be used for the server mode of theOPC server for SIMATIC NET (no user logged on).
"Sec urity" Tab You specify the access permissions for the OPC server in the"Security" tab. For the three aspects relevant to COM objects, you caneither use the default permissions or user-defined permissions for theselected COM object.
When using the default permissions, the account entered in the"Identity" tab must have the required permissions in the settings fordefault security (default access permission, default launch permission).
If you do not want a particular user to have all COM objects of thesystem available, you must configure user-defined permissions. Tooperate the OPC server, only the access permission and the launchpermission need to be configured.
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 239
Selectin g Users The users that are allowed to use the OPC server must be entered inthe default access permissions. Several users have been entered asexamples of the required permissions:
WorkgroupOperat ion
Please note the following:
Both on the server and on the client machine, the logons and thereforethe information about permissions in the logon must exist on the othermachine.
Example: User "Alpha" is logged on at the computer with the serverand "Beta" is logged on at the computer with the client user. ForDCOM 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. Theinformation about permissions is then fetched from the domain server.
Type of access:Allo w access
☞
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET240 6GK1971-0BA00-0AA1
Type of access:Allow l aunch
Access to re gistry:HKEY_CLASSES_ROOT
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 241
9.2.2 Config uratio n of t he Client Computer
The application that will use the OPC server runs on the clientcomputer. The OPC server itself is started on another computer whenusing DCOM, which is why there is no process for the OPC servervisible in Windows NT Task Manager. The OPC server mustnevertheless be registered on the client computer so that the COMlibrary knows the required object and so that configuration is possible.You should also read the notes on client installation in the InstallationInstructions.
For the computer with the OPC client, you must set the computer inthe network on which the server will be activated and the account forthe server.
"Lo cation" Tab The location of the server must be specified in this tab. For DCOMoperation, only the check box "Run application on the followingcomputer:" must be selected. Click "Browse" to locate the servercomputer.
DCOM with the OPC Server for SIMATIC NET
Introduction to the OPC Server for SIMATIC NET242 6GK1971-0BA00-0AA1
"Id entit y" Tab In the "Identity" tab, you specify which user account should be used forthe client computer. For the client computer, it makes sense to specifythe currently interactive user; in other words the logged on user.
"Sec urity" Tab The security settings should be made as they are configured on theserver 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 onthe server, the combination "connect" and "identify" will be used for theDCOM protocol.
☞
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 243
10 The OPC Custom Interface for Data Access
This chapter explains how the OPC Custom interface for Data Access is used. It alsolists the interfaces and methods of the OPC customer interface. This is not a detailedinterface description but contains supplementary information and notes relatingspecifically to SIMATIC NET.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET244 6GK1971-0BA00-0AA1
10.1 Versions of the OPC Inte rface
Introdu ction There is now an extended version of the OPC custom interface,specification 2.0. Version 2.0 supplements the existing OPC custominterface in several aspects particularly those simplifying the handlingof asynchronous calls.
The interfaces of Version 1.0 of the OPC interface are completelyupwards compatible with Version 2.0.
the OPC server for SIMATIC NET supports version 2.0 of the OPCCustom Interface.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 245
10.2 Creating and Using an OLE Object in C/C++
Introdu ction The following sections illustrate step-by-step how you can call themethods of an instance of an OLE class in C++. Note the differencebetween the term class in OLE and in C++.
OLE Classes, C ++Classes
A Windows object is an instance of an OLE class. The term OLE classdiffers from the class in C++. A class in C++ is a type definition. AnOLE class is, however, an object description and does not containtypes.
Class Identificat ionCode
Each OLE class can be identified uniquely by a 128 bit longidentification code, the CLSID. This is used by the operating system forthe 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 theCLSID.
ProgID To simplify the identification of OPC servers, there is normally areadable name, the ProgID assigned in the CLSIDs. While a CLSID isalways unique due to the algorithm for compilation, it is possible that aProgID exists more than once. Just like the CLSID, the ProgID isspecified by the vendor of an OPC server.
The following applies to the OPC server for SIMATIC NET for allprotocols:
OPC.SimaticNET
Procedure A COM object is created in five steps.
Step Descr iption
1 Initialize COM
2 Query the CLSID
3 Create an Object
4 Call an OPC function
5 Release the interfaces used
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET246 6GK1971-0BA00-0AA1
Step 1:Initi alize COM
Before you can use the functions of COM, the COM library must beinitialized with the following call:
#include "opc.h"
HRESULT r1;r1 = CoInitialize(NULL);
Step 2:Query t he CLSID
If the name of an object is known, the CLSID can be queried using theOLE function “CLSIDFromProgID”.
ExampleThe following program section illustrates how to query the CLSID forthe OPC server for SIMATIC NET:
CLSID clsid;
// Get the CLSID from the Namer1 = CLSIDFromProgID((L"OPC.SimaticNET"),&clsid);
Step 3:Create an Object
If a client wants to use an object, it transfers the CLSID to theoperating system and requests an object instance. Regardless ofwhere the server is located, the object request is always directed toCOM.
The “CoCreateInstance” function creates an object belonging to therequired class. This function encapsulates several interim steps via theinterface "IClassFactory". Generating objects using IClassFactory ismore efficient if you want to create several objects of one class.
ExampleThe following lines show how an object of the class “OPC server” withreference to the “IUnknown” interface can be created:
IUnknown * pOPCUnknown;
r1 = CoCreateInstance (clsid, NULL,CLSCTX_LOCAL_SERVER, IID_IUnknown,(void**)&pOPCUnknown );
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 247
Step 4:Call an OPCfun ction
In this step, a method of the “IOPCServer” interface of the createdobject will be used to learn the status of the server. First, a pointer tothe “IOPCServer” interface is made available via “IUnKnown”. Finally,the “GetStatus” method is called.
ExampleThe program shown below outputs the status of the server and thevendor information. If the “GetStatus” method is called successfully,the OPC server allocates the memory areas for the return informationvia the “IMalloc” interface. The user must release these memory areasagain.
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 themethod
CoGetMalloc( 1, &pIMalloc);
pIMalloc->Free(pss->szVendorInfo);pIMalloc->Free(pss);
Step 5:Release theinterfaces used
Objects include reference counters to detect when the object is nolonger required and can remove itself from memory. Each time the“QueryInterface” function is called, the reference counter isincremented. To release the object, the counter must be reset.
ExampleUsing the following commands, the reference counter for the interfaces“IUnknown” and “IOPCServer” is reset:
pOPCServer->Release();pOPCUnknown->Release();
pIMalloc->Release();
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET248 6GK1971-0BA00-0AA1
10.3 Further Info rmation about the Inte rface Desc ription for theOPC Custom Interface
Introdu ction A detailed interface description of the OPC interfaces is beyond thescope of this manual. This is supplied as a file along with this productas an original English document from the OPC Foundation. You willfind the documents in the "DOC" folder in the product folder of theOPC servers for SIMATIC NET.
Structure of theDescr iption
The following supplementary information about the interfaces lists theobjects of OPC, their interfaces and the methods defined in theseinterfaces and points out particular characteristics of the OPC serverfor SIMATIC NET.
Return Values All the listed methods return a result of the type HRESULT.
Overv iew of theObjects a ndInterfaces
Object "OPCServer“
IOPCServer
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
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 249
10.4 The “OPC Se rver” Object
Descr iption The OPC server class has various attributes that contain informationabout the status, the version etc. of an OPC server object. The OPCserver class also has methods with which the client can manage theobjects of the OPC group class. A client application addresses only anobject of this class directly using COM mechanisms. The other objectsare created by corresponding OPC methods.
The methods of the IOPCServer interface are used to manage theobjects in the OPC group class. The interface IOPCBrowseSer-verAddressSpace allows the address space of the server to beinvestigated.
Schemat ic The following schematic illustrates the “OPC server” object with itsinterfaces.
IUnknown
IOPCServerIOPCBrowseServerAddressSpace
OPC serverobject
IOPCCommon (V2.0)IConnectionPointContainer (V2.0)
IOPCItemsProperties (V2.0)
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET250 6GK1971-0BA00-0AA1
10.4.1 IOPCServer Interface
Overv iew This interface contains methods to manage groups within a serverobject. It is also possible to obtain information about the current statusof the server.
AddGroup ( szName, bActive, dwRequestedUpdateRate, hClientGroup,pTimeBias, pPercentDeadband, dwLCID, phServerGroup,pRevisedUpdateRate, riid, ppUnk )
Descr iption:
Creates a group in the server object.
Notes:
• The "pTimeBias" parameter is not evaluated by the OPC server forSIMATIC 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 theOPC server for SIMATIC NET.
• If the "szName" parameter is empty, a name is generated beginningwith the underscore character (for example “_123456”). User-defined names should therefore not begin with the underscorecharacter.
CreateGroupEnu merat or
( dwScope, riid, ppUnk )
Descr iption:
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.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 251
GetErrorString ( dwError, dwLocale, ppString )
Descr iption:
Supplies the error message for a specific error code.
Notes:
The OPC server for SIMATIC NET supports German and English errortexts. Errors detected by the Windows operating system are explainedin the language in which the operating system was installed.
GetGroup ByName ( szName, riid, ppUnk )
Descr iption:
Supplies an additional interface pointer for the name of a privategroup, in other words the reference counter is incremented.
GetStatus ( ppServerStatus )
Descr iption:
Supplies the status information of the server.
Notes:
The return value of the OPC server for SIMATIC NET is the name andthe version of the OPC server.
RemoveGroup ( hServerGroup, bForce )
Descr iption:
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 whichreferences are still active.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET252 6GK1971-0BA00-0AA1
10.4.2 IOPCBrowse ServerAddressSpace Interface
Overv iew This interface contains methods with which the address area of theserver can be queried. The address area contains all the OPC itemsknown to the server.
BrowseAccessPat hs ( szItemID, ppIEnumString )
Descr iption:
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 )
Descr iption:
Supplies a string of the type “IEnumString” whose content is specifiedby the call parameters. The position from which the list is created canbe 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 thespecified set
• To use one of the filter characters, this must be preceded by a backslash (\).
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 253
ChangeBrowsePosition
( dwBrowseDirection, szString )
Descr iption:
Allows you to browse through the address area. You can change to thehigher level or to a branch.
GetItemID ( szItemDataID, szItemID )
Descr iption:
Creates a complete ItemID in the hierarchical address area. Thisfunction is necessary since browsing itself only provides thedesignations below the current node.
Notes:
The description of GetItemID in OPC specification is inconsistent withthe description of ChangeBrowsePosition. WithChangeBrowsePosition, it is not possible to specify a complete ItemID.
For this reason, the OPC server for SIMATIC NET only currentlysupports the command GetItemID for single leaves (LEAF).
QueryOrganization ( pNameSpaceType )
Descr iption:
Supplies the structure of the address area. The address area can beorganized with a flat or hierarchical structure.
Notes:
The structure of the address area of the OPC server for SIMATIC NETis structured hierarchically.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET254 6GK1971-0BA00-0AA1
10.4.3 IOPCCommon Interface (Versio n 2.0)
Overv iew This interface of version 2.0 of the OPC Custom Interface containsmethods allowing the language settings and the name of the client tobe made known to the server.
SetLocaleID ( dwLcid )
Descr iption:
Sets the language code of the server. The language code specifies thelanguage in which the server outputs text.
Notes:
The OPC server for SIMATIC NET supports English and German.
GetLocaleID ( pdwLcid )
Descr iption:
Fetches the language code of the server.
Notes:
The OPC server for SIMATIC NET supports English and German.
QueryAvailableLocaleIDs
( pdwLcid )
Descr iption:
Provides all the available language codes of the server.
Notes:
The OPC server for SIMATIC NET supports English and German.
GetErrorString ( dwError, ppString )
Descr iption:
Provides the error text for a specific error code in the set language.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 255
SetClientName ( szName )
Descr iption:
Transfers a descriptive text for the client to the server. The descriptivetext can be used for any purpose by the server, for example for loggingin trace files.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET256 6GK1971-0BA00-0AA1
10.4.4 IConnectio nPointContainer Interface
Overv iew This interface is a standard COM interface for reporting asynchronousevents via connection points. For more detailed information aboutusing connection points, refer to the documentation of OLE/COM.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 257
10.4.5 IOPCItemProperties ( V 2.0) Interface
Overv iew This interface of version 2.0 contains methods allowing specific serverinformation to be queried about an item.
QueryAvailablePropert ies
( szItemID, pdwCount, ppPropertyIDs, ppDescriptions,ppvtDataTypes )
Descr iption:
Returns a list of available properties for an item.
GetItemPr opert ies ( szItemID, dwCount, pdwPropertyIDs,ppvData, ppErrors )
Descr iption:
Provides the values of the properties of an item transferred in a list ofPropertyIDs.
Loo kupIt emIDs ( szItemID, dwCount, pdwPropertyIDs,ppszNewItemIDs, ppErrors )
Descr iption:
Provides (whenever possible for the propertyID) a list of ItemIDs for alist of PropertyIDs. These ItemIDs can be included in a groupsimplifying and speeding up access to the data.
Notes:
The OPC server for SIMATIC NET does not support this function. Thecall is rejected with error message 0x8004001 (not implemented).
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET258 6GK1971-0BA00-0AA1
10.5 Objects of the “OPC G roup” Class
Descr iption The “OPC Group” class manages the individual process variables, theOPC items. Using these group objects, a client can form semanticallymeaningful units of OPC items and execute operations with them.
Schemat ic The following schematic illustrates an object of the “OPC Group” classand its interfaces.
IUnknown
OPC groupobject
IOPCItemMgtIOPCGroupStateMgt
IOPCSyncIO
IOPCAsyncIOIDataObject
IEnumOPCItemAttributes
IOPCAsyncIO2 (V 2.0)IConnectionPointContainer (V2.0)
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 259
10.5.1 IOPCItemMgt Interface
Overv iew This interface provides methods to manage more than one item in agroup.
Time Stamp With each value read, OPC supplies a time stamp. This indicateswhen this value was received or when it was changed. Since theSIMATIC systems do not use a time stamp, the time at which the valueis received on the server is used as the time stamp.
AddIt ems ( dwNumItems, pItemArray, ppAddResults, ppErrors )
Descr iption:
Adds one or more items to a group.
Notes:
• A unique name of an item for the OPC server for SIMATIC NET isas 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:]EB0DP:[CP_L2_1]Slave063SlaveStateFMS:[CR1|VFD1|CP_L2_1:]100SR:[MyConnection||CP_H1_1:]receive
This name can be specified completely in the ItemID. TheAccessPath must then be empty.
• As an alternative, the part of the name in square brackets can beincluded 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 morethan once. In this case each of these items nevertheless has itsown server handle.The server handles of the items are only unique within a group andnot 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
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET260 6GK1971-0BA00-0AA1
CreateEnumerat or ( riid, ppUnk )
Descr iption:
Creates an enumerator for the items of a group.
RemoveItems ( dwNumItems, phServer, ppErrors )
Descr iption:
Deletes one or more items from a group.
SetActiveState ( dwNumItems, phServer, bActive, ppErrors )
Descr iption:
Sets the active state of one or more items in a group.
SetClientHandl es ( dwNumItems, phServer, phClient, ppErrors )
Descr iption:
Sets the client handle of one or more items in a group.
SetDataty pes ( dwNumItems, phServer, pRequestedDatatypes, ppErrors )
Descr iption:
Sets the requested data type of one or more items in a group.
Notes:
See AddItem
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 261
Valid ateItems ( dwNumItems, pItemArray, bBlobUpdate, ppValidationResults,ppErrors )
Descr iption:
Checks the validity of an OPC item, for example whether it was addedto a group without any error occurring, and supplies information suchas the canonical data type.
Notes:
See AddItem
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET262 6GK1971-0BA00-0AA1
10.5.2 IOPCGroupStateMgt Interface
Overv iew The IOPCGroupStateMgt interface provides methods with whichgroups can be managed. It is possible to edit group-specificparameters and to copy groups.
Clon eGroup ( szName, riid, ppUnk )
Descr iption:
Creates a copy of a group. All group attributes are copied except forthe 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 isgenerated (see AddGroup).
GetState ( pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband,pLCID, phClientGroup, phServerGroup )
Descr iption:
Fetches the status of the group. The client application must inform theOPC server where the results are to be stored using a pointer.
Notes:
• The "pTimeBias" parameter is irrelevant for the OPC server forSIMATIC NET.
• The “pPercentDeadband” parameter has no significance for theOPC server for SIMATIC NET.
• The “LCID” parameter, in other words language-specific textualvalues in read/write, has no significance for SIMATIC variables.
SetName ( szName )
Descr iption:
Allows the name of a group to be changed. The name must always beunique.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 263
SetState ( pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias,pPercentDeadband, pLCID, phClientGroup )
Descr iption:
SetState allows various properties of the group to be changed.
Notes:
• The "pTimeBias" parameter is irrelevant for the OPC server forSIMATIC NET.
• The “pPercentDeadband” parameter has no significance for theOPC server for SIMATIC NET.
• The “LCID” parameter, in other words language-specific textualvalues 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.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET264 6GK1971-0BA00-0AA1
10.5.3 IOPCSyncIO Interface
Overv iew This interface provides methods for synchronous reading and writing.Synchronous means that the client waits until the read or writeoperation is completed and only then continues execution.
Use The use of synchronous calls is recommended when the client requiresthe result for further processing. Other clients are not blocked since theOPC server for SIMATIC NET starts a separate thread for each client.
In general, it is advisable to use the IData interface for processingvariable changes (or IAdviseSink on the client side). This interfaceguarantees the highest possible data throughput and also reduces theactual number of calls to the absolute minimum (only when changesoccur).
Read ( dwSource, dwNumItems, phServer, ppItemValues, ppErrors )
Descr iption:
Reads the values, status information or time stamp of one or moreitems in a group. The values can be read from the cache of the serveror 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. Thecorresponding configuration parameter is “Read/Write Timeout” (seeSection 7.4).
Write ( dwNumItems, phServer, pItemValues, ppErrors )
Descr iption:
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. Thecorresponding configuration parameter is “Read/Write Timeout” (seeSection 7.4).
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 265
10.5.4 IOPCAsyncIO Interface
Overv iew This interface of the Group class provides methods for asynchronousreading and writing of items. Asynchronous means that the clienttriggers a read or write operation and then continues operation.Asynchronous operations provide a transaction ID. When the serverhas completed the read or write operation, the client receives amessage sent to its IAdviseSink interface.
Cancel ( dwTransactionID )
Descr iption:
Cancels an outstanding job.
Read ( dwConnection, dwSource, dwNumItems, phServer, pTransactionID,ppErrors )
Descr iption:
Sends an asynchronous read command. The result is sent to theIAdviseSink interface of the client.
Notes:
The call is monitored by the timeout monitoring on the server. Thecorresponding configuration parameter is “Read/Write Timeout” (seeSection 7.4). If the timeout monitoring is aborted, there is a callbackwith hrStatus=E_ABORT.
Refresh ( dwConnection, dwSource, pTransactionID )
Descr iption:
Requests a current value for every active OPC item.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET266 6GK1971-0BA00-0AA1
Write ( dwConnection, dwNumItems, phServer, pItemValues,pTransactionID, ppErrors )
Descr iption:
Sends an asynchronous write command.
Notes:
The call is monitored by the timeout monitoring on the server. Thecorresponding configuration parameter is “Read/Write Timeout” (seeSection 7.4). If the timeout monitoring is aborted there is a callbackwith hrStatus=E_ABORT.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 267
10.6 IDataObject Inte rface
Overv iew The IDataObject interface is the standard interface of OLE for datatransmission. It contains methods for establishing a messageconnection between the client and a server group.
Descr iption of theMechanism
If the server wants to send a message to a client, the client mustprovide a partner for the server. This partner is the IAdviseSinkinterface of the client. A server sends a message to a client by callingthe OnDataChange method of the IAdviseSink interface of the client.
Schemat ic of theMechanism
The following schematic illustrates how the “IAdviseSink” interface onthe client and “IDataObject” on the server interact.
Client Server
IAdviseSink IDataObject
IAdviseSink::OnDataChange
IDataObject::DAdvise
DAdvise ( pFmt, adv, pSnk, pConnection )
Descr iption:
Establishes a connection between a server and the client. If a clientwants to receive a message, it must establish a connection using thismethod. It transfers a pointer to its IAdviseSink interface to the server.
DUnadvise ( Connection )
Descr iption:
Terminates an existing connection between a client and server.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET268 6GK1971-0BA00-0AA1
10.6.1 IEnumOPCItemAtt ributes Interface
Overv iew This interface based on the IEnum standard interface returns the itemsof a group. The interface is supplied only by“IOPCItemMgr:CreateEnumerator”. It is not obtainable withQueryInterface.
Clone ( ppEnumItemAttributes )
Descr iption:
Creates an identical copy of the enumerator.
Next ( celt, ppItemArray, pceltFetched )
Descr iption:
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 )
Descr iption:
Resets the list to the first item of the group.
Skip ( celt )
Descr iption:
Skips a number of items in the list.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 269
10.6.2 IAsyncIO2 Interface (Versio n 2.0)
Overv iew This interface in version 2.0 provides methods for asynchronousreading and writing of items. Asynchronous means that the clienttriggers a read or write operation and then continues operation. Version2 of the interface for asynchronous communication uses connectionpoints. This simplifies the processing of the transferred data.
Read ( dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors )
Descr iption:
Sends an asynchronous read command. The result is sent to the clientvia a connection point.
Notes:
The call is monitored by the timeout monitoring on the server. If the settime is exceeded, this is indicated by the status E_ABORT.
Write ( dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID,ppErrors )
Descr iption:
Sends an asynchronous write command. The message indicatingcompletion of the job comes via the specified connection point.
Notes:
The call is monitored by the timeout monitoring on the server. If the settime is exceeded, this is indicated by the status E_ABORT.
Cancel2 ( dwCancelID )
Descr iption:
Cancels an outstanding job.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET270 6GK1971-0BA00-0AA1
Refresh ( dwSource, dwTransactionID, pdwCancelID )
Descr iption:
Requests a current value for every active OPC item.
SetEnable ( bEnable )
Descr iption:
Activates messages via connection points. Messages generated by theRefresh method are sent regardless of these settings.
GetEnable ( pbEnable )
Descr iption:
Returns the current value of the flag for messages via connectionpoints.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 271
10.6.3 IConnectio nPointContainer Interface
Overv iew This interface is a standard COM interface for reporting asynchronousevents via connection points. For more detailed information aboutusing connection points, refer to the documentation of OLE or COM.
The OPC Custom Interface for Data Access
Introduction to the OPC Server for SIMATIC NET272 6GK1971-0BA00-0AA1
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 273
11 The OPC Automation Interface for Data Access
This chapter explains how the OPC Automation interface for Data Access is used. It alsolists the properties and methods of the OPC automation interface. This is not a detailedinterface description but contains supplementary information and notes relatingspecifically to the OPC server of SIMATIC NET.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET274 6GK1971-0BA00-0AA1
11.1 Versions of the Auto mation Inte rface
Int rodu ction The OPC automation interface was specified by the OPC Foundationin version 1.0. Certain aspects in this specification were unclear and itwas not approved. Some weaknesses of version 1.0 becameparticularly clear with the introduction of Visual Basic 5.0.
New Vers ion Since the start 1999, there is an approved version of the specificationof the automation interface available with version number 2.02.
The following descriptions relate to version 2.02 of the specification ofthe OPC automation interface.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 275
11.2 Creating and Using an OLE Object in Visual Basic
Overv iew Visual Basic from Microsoft is a development environment whichsupports the automation interface for the simple linking of OLE objects.The following sections show how the OPC server is used via theautomation interface 2.02 in Visual Basic. At least version 5 of VisualBasic is required.
Procedure
Step Descr iption
1 Declaring the Variables
2 Connecting to the OPC Server
3 Generating an OPC Group
4 Adding OPC Items
5 Synchronous Reading
Preparat ions Create a new Visual Basic project and the activate the reference forthe automation interface 2.02 of the OPC server in the "Project -References" menu.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET276 6GK1971-0BA00-0AA1
Step 1:Declaring aVariable of theObject Type
In Visual Basic or Visual Basic for Applications, a variable of the typeObject refers to an OLE object. The DIM statement declares an objectinstance.
Example
Dim ObjServer As OPCServer
Step 2:Creat ing andAssigning theObject
Creat ing an OPC Server ObjectVisual Basic programs are also OPC clients. To be able to access aprocess variable, the client must first create a server object and thenconnect to an OPC server.
ExampleThe following code section shows how a Visual Basic client canconnect to the OPC server for SIMATIC NET:
Set ObjServer = New OPCServerObjServer.Connect ("OPC.SimaticNET")
Step 3:Generat ing an OPCGroup
The next step is to create a group object to accommodate processvariables.
First, the group object is declared. A server object contains a collectionobject as a property with the name "OPCGroups". A group is createdby calling the Add method of the collection object.
ExampleThe following lines show how a group is created in Visual Basic:
'Declarations
Dim GroupObj As OPCGroupDim GroupCollection As OPCGroups
Set GroupObj = ObjServer.OPCGroups.Add("MyGroup")
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 277
Step 4:Adding OP C Items
OPC items will now be inserted in the created group object. The itemsrepresent the connections to the process variables, their parameterItemID specifies which variable will be addressed. The syntax of thisparameter is shown in Chapter 5.
The AddItems method allows several items to be inserted into a groupin one call. The transfer parameters and the return values aretherefore 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 thearrays "lServerHandles“, "lErrors“ and "ItemsObj“. The "IErrors“ arraycontains status information for each item inserted that indicatedwhether or not the item was successfully inserted.
ExampleThe following example creates two items in the previously createdOPC group "GrpObj“. The first item represents a DP variable, thesecond an FMS variable.
'DeclarationDim ItemServerHandles() As LongConst MAX_INDEX = 2Const OPC_DS_CACHE = 1Const OPC_DS_DEVICE = 2
Dim lNumItems As LongDim lClientHandles(MAX_INDEX) As LongDim perror() As Long
Dim szItemIDs(MAX_INDEX) As StringDim AccPath(MAX_INDEX) As StringDim ReqDataTypes(MAX_INDEX) As Integer
'Definition of ItemIDsszItemIDs(1) = "FMS:[DEMO]101"szItemIDs(2) = "DP:[DEMO]MyMotor"
AccPath(1) = ""AccPath(2) = ""
' Set requested datatypes for the ItemsReqDataTypes(1) = vbVLongReqDataTypes(2) = vbVString
' Set Client handleslClientHandles(1) = 1lClientHandles(2) = 2
'Add Items to GroupGroupObj.OPCItems.AddItems MAX_INDEX, szItemIDs, _
lClientHandles, ItemServerHandles, perror, _ReqDataTypes, AccPath
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET278 6GK1971-0BA00-0AA1
Step 5:SynchronousReading
In the last step, a synchronous read operation to read the processvariables of a group is executed. Synchronous means that the serveronly returns control to the Visual Basic program after the requiredresults have been returned via the communications system. Thismeans that the flow of communication is delayed by the time requiredfor this communication. The OPCDevice constant means that thevalues should be read directly from the device and not from the cacheof the OPC server.
ExampleJust like the AddItems command, OPCRead is also a group operation,in other words several process variables within a group can beaccessed with one call. The "lNumItems“ parameter specifies thenumber of variables to be read. The individual variables themselvesare described in the array "lServerHandles“ by the handle assigned bythe 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 ParameterDim vValues() As VariantDim pErrors() as Long
' Synchronous reading of 2 itemsGroupObj.SyncRead OPC_DS_Device, _
2, _ ItemServerHandles, _ vValues, _ pErrors
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 279
11.3 Further Info rmation about the Inte rface Desc ription for theOPC Auto mation Inte rface
Int rodu ction A detailed interface description of the OPC interfaces is beyond thescope of this manual. This is supplied as a file along with this productas an original English document from the OPC Foundation. You willfind the documents in the "DOC" folder in the product folder of theOPC servers for SIMATIC NET.
Object Mod el forthe Automat ionInterface
The object model for the OPC automation interface accordingspecification 2.0 differs from the model described in Section 4.4:Separate collection objects manage the objects OPC Group and OPCItem. The collection objects provide functions for counting the objectsassigned to them. The browsing functions are also brought together ina separate "OPC browser" object.
OPCServer
OPCGroups(Collection)
OPCGroup
1:1
OPCItem
OPCItems(Collection)
1:n
1:n
1:1
OPC-Browser
1:n
Structure of theDescr iption
The following supplementary information about the interfaces lists theobjects of the automation interface of OPC, their properties, methodsand events and points out particular characteristics of the OPC serverfor SIMATIC NET.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET280 6GK1971-0BA00-0AA1
Note:
Optional parameters must be transferred as variants for theautomation interfaces. In Visual Basic, the optional parameters should,however, be declared directly with the destination type. This ensuresthat the variant has the correct data type.The data types can be found in the descriptions of the methods in theOPC specification.
Example:Dim ReqDataTypes(MAX_INDEX) As IntegerReqDataTypes(1) = vbVLongReqDataTypes(2) = vbVString
Remember that according to the OPC specification, arrays alwaysbegin with the index 1. This must be defined in your program asfollows (as "General"):
Option Base 1 'ARRAYs are always Option Base 1'(see SPEC Chapter 2.6)
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 281
11.4 The “OPC Se rver” Object
Descr iption Objects of the OPC server class are created by the client. Theproperties of an OPC server contain general information about theserver. When an OPC server object is created, an OPCGroupcollection is also created as a property of the OPC server object.
11.4.1 Properties of "O PCServer“
Property Type Br ief Descr iption
StartTime Date Time at which the server was started (in UTC).
CurrentTime Date The current time (UTC), as supplied to theserver by the system.
LastUpdateTime
Date The time (UTC), at which the server sent the lastupdate 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 serveroutput texts
Bandwidth Long Bandwidth of the server.
OPCGroups OPCGroups
A collection of OPCGroup objects
PublicGroupNames
Variant The names of the public groups provided by thisserver.
ServerName String Name of the linked OPC server
ServerNode String Computer name of the node in the network onwhich the OPC server is run.
ClientName String Option of informing the OPC server of the nameof the client. Mainly intended for debugging andtrace.
Notes:
• The OPC server for SIMATIC NET provides the following as vendorinformation: "SIMATIC NET OPC-Server“
• Public groups are not supported by the OPC server for SIMATICNET.
• The Bandwidth property is not supported by the OPC server forSIMATIC NET.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET282 6GK1971-0BA00-0AA1
11.4.2 Methods of t he "OPCServer“
GetOPCServers (Optional Node as Variant) As Variant
Descr iption:
Provides the names (ProgIDs) of the registered OPC server on thelocal 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)
Descr iption:
Structure of a link to an OPC server.
Notes:
• The ProgID for the OPC server for SIMATIC NET is as follows:
OPC.SimaticNET
Disconnect ()
Descr iption:
Structure of the link to an OPC server.
Notes:
The OPC server for SIMATIC NET closes all communicationsconnections after the Disconnect of the last OPC client.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 283
CreateBro wser () As OPCBrowser
Descr iption:
Creates an object of the OPCBrowser class to investigate the addressarea of the server.
Notes:
Refer to the description of the OPCBrowser object in Section 11.5.
GetErrorStri ng (ErrorCode As Long) As String
Descr iption:
Supplies the error message for a specific error code.
Notes:
The OPC server for SIMATIC NET supports German and English errortexts. Errors detected by the Windows operating system are explainedin the language in which the operating system was installed.
QueryAvailableLoca leIDs
() As Variant
Descr iption:
Obtains the language codes available from the server as an array withlong values.
Notes:
The OPC server for SIMATIC NET supports German and English errortexts. Errors detected by the Windows operating system are explainedin the language in which the operating system was installed.
QueryAvailableProper ties
ItemID As String, ByRef Count As Long, ByRef PropertyIDs() as Long,ByRef Descriptions() As String, ByRef DataTypes() As Integer
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET284 6GK1971-0BA00-0AA1
Descr iption:
Obtains a list of property codes and the corresponding description textsfor the properties of the specified item.
Notes:
Properties are supported by the OPC server for SIMATIC NET.
GetItemProperti es (ItemID As String, Count As Long, ByRef PropertyIDs() as Long, ByRefPropertyValues() As Variant, ByRef Errors() As Long)
Descr iption:
Obtains a list with the values of the requested properties.
Notes:
Properties are supported by the OPC server for SIMATIC NET.
Lookup ItemIDs (ItemID As String, Count As Long, PropertyIDs() as Long, ByRefNewItemIDs() As String, ByRef Errors () As Long)
Descr iption:
Obtains a list of the ItemIDs corresponding to the transferredPropertyIDs. ItemIDs can be inserted for more efficient data acquisitionin OPC groups.
Notes:
The OPC server for SIMATIC NET does not supply PropertyIDs thatcould be represented as ItemIDs.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 285
11.4.3 Events of "O PCServer"
ServerShutDown (Reason As String)
Descr iption:
This event is triggered when the OPC server is closed down. Thelinked clients can react to the event, for example, by releasing itemsand groups.
Notes:
The OPC server for SIMATIC NET triggers this event when the closerequest is set in the configuration program (Section 7.10).
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET286 6GK1971-0BA00-0AA1
11.5 The "OPCBrowse r“ Object
Descr iption The OPCBrowser object is a collection object with which the addressarea of the OPC server can be investigated. An object of theOPCBrowser class must be created by the CreateBrowser method ofthe OPCServer object. It is possible to create several OPCBrowserobjects for one server.
11.5.1 Properties of "O PCBrowse r“
Property Type Access Br ief Descr iption
Organization Long Read-only Organizational structure of theaddress area: hierarchy or flat
Filter String Read/Write The filter effective for theShowBranches and ShowLeafsmethods.
DataType Integer Read/Write The data type required for theShowLeafs method. The defaultof this property is vbEmpty.
AccessRights Long Read/Write The access rights required forthe ShowLeafs method.
CurrentPosition String Read-only Current position in the tree of theaddress area. The value is "“when initialized in the root orwhen the organization structureis flat.
Count Long Read-only Property necessary for thecollection, provides the numberof entries.
Notes: • The structure of the address area of the OPC server for SIMATICNET 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 mustbe preceded by a backslash (\).
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 287
11.5.2 Methods of "O PCBrowse r"
Item (Key As Variant) As String
Descr iption:
Provides the name of the entry specified by the index "Key“.
ShowB ranches ()
Descr iption:
Enters the names of the branches of the current browse position intothe collection.
ShowLea fs (Optional Flat As Variant)
Descr iption:
Enters the names of the leaves of the current browse position into thecollection. If the parameter "Flat“ is true, the collection with all leavesof the current and deeper branches are filled starting from the currentbrowse position. The default for "Flat" is false.
MoveUp ()
Descr iption:
Moves the current position in the address area one level up.
MoveDo wn (Branch As String)
Descr iption:
Moves the current position in the address area into the current branch(one level deeper).
MoveToRoot ()
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET288 6GK1971-0BA00-0AA1
Descr iption:
Moves the current position in the address area to the root.
MoveTo (Branches() As String)
Descr iption:
Moves the current position in the address area to a specified, absoluteposition. The absolute position is specified as an array of branchnames starting from the root.
GetItemID (Leaf As String) As String
Descr iption:
The server converts the name to an ItemID that can be transferred tothe "Add" method of "OPCItems". The creation of this ID is based onthe current position of the browser, extended by the node with thename contained in the "Leaf" string.
GetAccessPa ths (ItemID As String) As Variant
Descr iption:
This provides the possibility of querying the access path of an ItemID.
Notes:
Not required for the OPC server for SIMATIC NET.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 289
11.6 The "OPCGroups“ Collection Object
Descr iption The OPCGroups object is a collection object for creating andmanaging OPC groups. The default properties of OPC groups specifydefault values for creating all OPC groups.
Public groups are not supported by the OPC server for SIMATIC NET.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET290 6GK1971-0BA00-0AA1
11.6.1 Properties of "O PCGroups“
Property Type Access Br ief Descr iption
Parent OPCserver
Read-onlyRead-only
Provides areference to thecorresponding OPCserver object.
DefaultGroupIsActive Boolean Read/Write Specifies the initialvalue for the"ActiveState“property of newlycreated OPCgroups. Default:True
DefaultGroupUpdateRate Long Read/Write Specifies the initialvalue for the"update rate“property of newlycreated OPCgroups. Default:1000 milliseconds.
DefaultGroupDeadband Single Read/Write Specifies the initialvalue for the"Deadband“property of newlycreated OPCgroups.
DefaultGroupLocaleID Long Read/Write Specifies the initialvalue for the "localeID“ property ofnewly created OPCgroups.
DefaultGroupTimeBias Long Read/Write Specifies the initialvalue for the "timebias“ property ofnewly createdOPCGroups.
Count Long Read-only Propertiesnecessary for thecollection, providesthe number ofentries.
Notes: • The DefaultGroupTimeBias property is not evaluated by the OPCserver for SIMATIC NET.
• DefaultGroupLocaleID is irrelevant for the OPC server forSIMATIC NET.
• The DefaultGroupDeadband property has no significance for theOPC server for SIMATIC NET.-
•
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 291
11.6.2 Methods of "O PCGroups“
Item (Key As Variant) As OPCGroup
Descr iption:
Provides a reference to the indexed object of the collection.
Add (Optional Name As Variant) As OPCGroup
Descr iption:
Creates a group in the server object.
Notes:
• If the Name parameter is empty or not specified, the OPC servergenerates a name that starts with an underscore (for example"_123456"). User-defined names should therefore not begin with theunderscore character.
GetOPCGroup (Key As Variant) As OPCGroup
Descr iption:
Provides the reference to an OPC group indicated by the name or theserver handle.
Remove (Key As Variant)
Descr iption:
Deletes a group on the server.
RemoveA ll ()
Descr iption:
Deletes all groups and items of the server.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET292 6GK1971-0BA00-0AA1
11.6.3 Events of "O PCGroups“
GlobalDataChange (TransactionID As Long, GroupHandle As Long, NumItems As Long,ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long,TimeStamps() As Date)
Descr iption:
This event simplifies the processing of events throughout all groups ofthe collection by reporting changes in the value and state of all items inall groups.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 293
11.7 The "OPCGroup“ Object
Descr iption The “OPC Group” class manages the individual process variables, theOPC items. Using these group objects, a client can form semanticallymeaningful units of OPC items and execute operations with them.
11.7.1 Properties of "O PCGroup“
Property Type Access Br ief Descr iption
Parent OPCServer
Read-onlyRead-only
Provides a reference to thecorresponding OPC serverobject.
Name String Read/Write The name of the group.
IsPublic Boolean Read-only Returns "True“ when this groupis a public group, otherwisefalse.
IsActive Boolean Read/Write Active state of the group.
An active group creates eventsfor all active items of the group.
IsSubscribed Boolean Read/Write Notification status of the groupspecifying whether or not thevariables of a group will bemonitored.
ClientHandle Long Read/Write A handle assigned by the clientand that can be used in theclient program to localize data(for example a row in a table)
ServerHandle Long Read-only A unique handle assigned forthe group by the server. Theclient must transfer this handlewith many methods thatinfluence the group (for exampleRemove).
LocaleID Long Read/Write Specifies the language ID forstrings supplied by the server(for example error texts)
TimeBias Long Read/Write Provides the time offset used tochange the time stamp of thedata to the local time.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET294 6GK1971-0BA00-0AA1
Property Type Access Br ief Descr iption
DeadBand Single Read/Write Specifies a bandwidth (as apercentage) within which valuechanges do not result in amessage.
UpdateRate Long Read/Write The fastest rate at which aclient is informed of changes invalues or states of items.
OPCItems OPCItems
Read-only Collections object "OPCItems“for managing the items of agroup
Notes: • The TimeBias property is not evaluated by the OPC server forSIMATIC NET.
• LocaleID is irrelevant for the OPC server for SIMATIC NET.
• The DeadBand property has no significance for the OPC server forSIMATIC NET.-
• To allow value changes of the items of a group to be signaled usingthe appropriate event, the properties " IsAct ive" a nd"IsSubscr ibed" must be set to "True".
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 295
11.7.2 Methods of "O PCGroup“
SyncRead (Source As Integer, NumItems As Long, ServerHandles() As Long, ByRefValues() As Variant, ByRef Errors() As Long, Optional ByRef Qualities AsVariant, Optional ByRef TimeStamps as Variant)
Descr iption:
Synchronous reading of the values, status information or time stamp ofone or more items in a group. The values can be read from the cacheof 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. Theduration is specified by a configuration parameter in the protocol-specific configuration file (Section 8).
SyncWrite (NumItems As Long, ServerHandles() As Long, Values() As Variant, ByRefErrors() As Long)
Descr iption:
Synchronous writing of values for one or more items of a group to thehardware.
Notes:
The call is monitored by the timeout monitoring on the server. Theduration 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)
Descr iption:
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. Theduration is specified by a configuration parameter in the protocol-specific configuration file (Section 8).
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET296 6GK1971-0BA00-0AA1
AsyncWrite (NumItems As Long, ServerHandles() As Long, Values() As Variant, ByRefErrors() As Long, TransactionID As Long, ByRef CancelID As Long)
Descr iption:
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. Theduration 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)
Descr iption:
Requests a current value for every active OPC item. The results arereturned by the "DataChange“ event.
AsyncCancel (TransactionID As Long)
Descr iption:
Cancels an outstanding asynchronous job.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 297
11.7.3 Events of "O PCGroup“
Descr iption The OPC automation interface supplies the changes to the values ofactive 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)
Descr iption:
The DataChange event occurs when it is detected that an active itemhas a change value or a change quality. Checking value changes istriggered by the UpdateRate timer. Events are generated only foractive items within an active group of events.
AsyncReadCo mplete (TransactionID As Long, NumItems As Long, ClientHandles() As Long,ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date,Errors() As Long)
Descr iption:
The AsyncReadComplete event is triggered when a read job iscompleted.
AsyncWriteComplete (TransactionID As Long, NumItems As Long, ClientHandles() As Long,Errors() As Long)
Descr iption:
The AsyncWriteComplete event is triggered when a write job iscompleted.
AsyncCance lComplete (TransactionID As Long)
Descr iption:
The AsyncCancelComplete event is triggered when a cancel job iscompleted.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET298 6GK1971-0BA00-0AA1
11.8 The "OPCItems“ Collection Object
Descr iption The OPCItems object is a collection object for creating and managingOPC items. The default properties of OPCItems specify default valuesfor all OPC items to be created.
11.8.1 Properties of "O PCItems“
Property Type Access Br ief Descr iption
Parent OPCGroup
Read Supplies areference to thecorrespondingOPCGroup object
DefaultRequestedDataType Integer Read/Write Specifies the initialvalue for the"RequestedDataType“ property ofnewly addeditems. The defaultis vbEmpty for thecanonical datatype of the server.
DefaultAccessPath String Read/Write Specifies the initialvalue for the"AccessPath“property of newlyadded items. Thedefault is anempty string.
DefaultIsActive Boolean Read/Write Specifies the initialvalue for the"Active State“property of newlyadded items.
The default valueis true.
Count Long Read-only Propertiesnecessary for thecollection,provides thenumber of entries.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 299
11.8.2 Methods of "O PCItems“
Item (ItemSpecifier As Variant) As OPCItem
Descr iption:
Provides a reference to the item of the collection described by theItemSpecifier index.(The "GetOPCItem“ method, on the other hand, provides a referenceto the server handle.)
GetOPCItem (ServerHandle As Long) As OPCItem
Descr iption:
Provides a reference to the server handle created by Add.
Add Item (ItemID As String, ClientHandle As Long)
Descr iption:
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 NETis described in Chapter 5.
• It is possible to add the same OPC item to the same group morethan once. In this case each of these items nevertheless has itsown server handle.The server handles of the items are only unique within a group andnot for all items of all groups.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET300 6GK1971-0BA00-0AA1
Add Items (Count As Long, ItemIDs() As String, ClientHandles() As Long, ByRefServerHandles() As Long, ByRef Errors() As Long, OptionalRequestedDataTypes As Variant, Optional AccessPaths As Variant)
Descr iption:
Inserts several items in the OPCItems collection of a group.
Notes:
• AddItems returns errors only using the "Errors" array, the errorvariable "Err" is not set.
• The structure of the ItemIDs for the OPC server for SIMATIC NETis described in Chapter 5.
• It is possible to add the same OPC item to the same group morethan once. In this case each of these items nevertheless has itsown server handle.The server handles of the items are only unique within a group andnot for all items of all groups.
Remove (Count As Long, ServerHandles() As Long, ByRef Errors() As Long)
Descr iption:
Deletes one or more items from a group.
Validate (Count As Long, ItemIDs() As String, ByRef Errors() As Long, OptionalRequestedDataTypes As Variant, Optional AccessPaths As Variant)
Descr iption:
Checks the validity of one or more OPC items; in other words whetherit was added to a group without any error occurring, and suppliesinformation such as the canonical data type.
Notes:
See AddItems
SetActive (Count As Long, ServerHandles() As Long, ActiveState As Boolean, ByRefErrors() As Long)
Descr iption:
Sets the active state of one or more items in a group.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 301
SetClientHandles (Count As Long, ServerHandles() As Long, ClientHandles() As Long, ByRefErrors() As Long)
Descr iption:
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)
Descr iption:
Sets the required data type of one or more items in a group.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET302 6GK1971-0BA00-0AA1
11.9 The "OPCItem“ Object
Descr iption An object of the class OPC item represents a link to a processvariable, for example to the input module of a programmablecontroller. A process variable is data of the process I/Os that can bewritten and/or read, for example the temperature of a tank. Eachprocess variable is associated with a value (variant data type), aquality, and a time stamp.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 303
11.9.1 Properties of "O PCItem“
Property Type Access Br ief Descr iption
Parent OPCGroup
Read-only Supplies a reference to theparent OPCGroup object.
ClientHandle Long Read/Write A handle that can be freelydefined by the user to allowsimpler assignment of theprocess variable in internaldata structures of the client.
ServerHandle Long Read-only A handle assigned uniquely tothe item by the server. Thishandle is required in severaloperations to identify an item.
AccessPath String Read-only The access path of the item asspecified in the Add function.
AccessRights Long Read-only Provides the access rights ofthe variable.
ItemID String Read-only The unique name of the itemas specified in the Addfunction.
IsActive Boolean Read/Write Specifies whether messageevents will be created for thisitem.
RequestedData
Type
Integer Read/Write The data type in which thevalue of the item will besupplied.
Value Variant Read-only The last valid value of thevariable (default property ofthe OPCItem object)
Quality Long Read-only The quality of the value lastread. The quality indicates thevalidity of the value of thevariable.
TimeStamp Date Read-only The time at which the lastvalue was acquired.
CanonicalDataType
Integer Read-only The original data type of theitem.
EUType Integer Read-only Identifies the unit of the value.If no units are available, thevalue is always "VT_EMPTY“.
EUInfo Variant Read-only Information about the unit ofthe value.
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET304 6GK1971-0BA00-0AA1
Notes:
The OPC server for SIMATIC NET does not support units (engineeringunits)
The OPC Automation Interface for Data Access
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 305
11.9.2 Methods of "O PCItem“
Read (Source As Integer, Optional ByRef Value As Variant, Optional ByRef QualityAs Variant, Optional ByRef TimeStamp As Variant )
Descr iption:
Reads the value, the quality, and/or the time stamp of this variable.
Write (Value As Variant)
Descr iption:
Sets the value of this variable synchronously.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET306 6GK1971-0BA00-0AA1
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 307
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 supplementaryinformation and notes relating specifically to SIMATIC NET.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET308 6GK1971-0BA00-0AA1
12.1 Supple ment to the Inte rface Desc ription of the OPCCustom Inte rface for Ala rms & Events
Int rodu ction A detailed interface description of the OPC interfaces is beyond thescope of this manual. This is supplied as a file along with this productas an original English document from the OPC Foundation. You willfind the documents in the "DOC" folder in the product folder of theOPC servers for SIMATIC NET.
Use in C/C++ The use of the OPC Custom interface for Alarms & Events isanalogous to the use of the custom interface for Data Access (seeSection 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 & Eventsin the product folder "Samples\S7\Custom\AlrmEvnt\SimpleAE".
Structure of theDescr iption
The following supplementary information about the interfaces lists theobjects of OPC, their interfaces and the methods defined in theseinterfaces and points out particular characteristics of the OPC serverfor SIMATIC NET.
Overv iew of theObjects a ndInterfaces
"OPC EventServer" Object
IOPCCommon
IOPCEventServer
IconnectionPointContainer
"OPC Event Subscription" Object
IOPCEventSubscriptionMgt
IconnectionPointContainer
"OPC Event Area Browser" Object*
IOPCEventAreaBrowser
*: not supported by SIMATIC NET
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 309
12.2 The "OPC Event Server" Object
Descr iption A client generates an object of the class "OPC Event Server" andaddresses this object to be able to use the Alarm&Event services. Itprovides a management interface via which a message object iscreated, various queries are executed and events are activated. Theclient can also set the language for output texts and logon to receiveserver-specific events.
ProgIDSIMATIC NET
The Alarm & Event server for SIMATIC NET has the ProgID
OPC.SimaticNETAlarms
Schemat ic The following schematic illustrates the “OPC server” object with itsinterfaces.
IUnknown
IOPCEventServer
OPC eventserver object
IOPCCommonIConnectionPointContainer
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET310 6GK1971-0BA00-0AA1
12.2.1 The " IOPCEventServer" Interface
Overv iew This is the central interface for use of the Alarm&Event functionality. Itis used to generate subscription objects and the area browser as wellas to investigate event categories and to manage conditions.
GetStatus (OPCEVENTSERVERSTATUS ** ppEventServerStatus)
Descr ip tion:
Provides current information about the status of the OPC server. Thestatus is returned as a structure (refer to the OPC Alarms & Eventsspecification).
Notes:
• The client must release the memory required for the structure andthe szVendorInfo.
CreateEventSubscr iption
(BOOL bActive, DWORD dwBufferTime, DWORD dwMaxSize,OPCHANDLE hClientSubscription, REFIID riid, LPUNKNOWN * ppUnk,DWORD * pdwRevisedBufferTime, DWORD * pdwRevisedMaxSize´)
Descr ip tion:
Creates a subscription for informing the client and returns therequested interface for access to the subscription object.
QueryAvailableFil ters (DWORD * pdwFilterMask)
Descr ip tion:
Provides information about the filter options supported by the OPCEvent server.
Notes:
• The OPC Event server for SIMATIC NET supports the followingfilters.
OPC_FILTER_BY_EVENTS 0x01OPC_FILTER_BY_CATEGORY 0x02OPC_FILTER_BY_SEVERITY 0x04OPC_FILTER_BY_SOURCE 0x16
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 311
QueryEventCategor ies (DWORD dwEventType, DWORD* pdwCount,DWORD** ppdwEventCategories, LPWSTR** ppEventCategoryDescs )
Descr iption:
Provides the event categories offered by the OPC Event server.
Notes:
• The OPC Event server for SIMATIC NET supplies event categoriesonly when the value OPC_SIMPLE_EVENT is set for the parameter"dwEventType".
• The OPC Event server for SIMATIC NET supports the followingevent categories.
S7_PROCESS_SCAN 0x01S7_PROCESS_ALARM 0x02
QueryCondition Names(DWORD dwEventCategory, DWORD* pdwCount, LPWSTR**ppszConditionNames)
Descr iption:
Provides the conditions offered by the OPC Event server for aparticular event category.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET.
QuerySubCondition Names(LPWSTR szConditionName, DWORD* pdwCount, LPWSTR**ppszSubConditionNames)
Descr iption:
Provides the subconditions offered by the OPC Event server forspecific event categories.
Notes:
Subconditions are not supported by the OPC Event server forSIMATIC NET.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET312 6GK1971-0BA00-0AA1
QuerySourceConditions(LPWSTR szSource, DWORD* pdwCount, LPWSTR**ppszConditionNames)
Descr iption:
Provides the conditions offered by the OPC Event server for a specificevent source.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET.
QueryEve ntAttr ibut es(DWORD dwEventCategory, DWORD* pdwCount, DWORD**ppdwAttrIDs, LPWSTR** ppszAttrDescs, VARTYPE** ppvtAttrTypes)
Descr iption:
Provides the attributes offered by the OPC server for a specific eventcategory. Additional information (for example associated values) aretransferred to the client using attributes.
Notes:
The attributes provided by the OPC Event server for SIMATIC NETare listed in Section 6.2.2.
TranslateToItemIDs (LPWSTR szSource, DWORD dwEventCategory LPWSTRszConditionName, LPWSTR szSubconditionName, DWORDdwCount, DWORD* pdwAssocAttrIDs, LPWSTR** ppszAttrItemIDs,LPWSTR** ppszNodeNames, CLSID** ppCLSIDs )
Descr iption:
Using this function, the OPCItems corresponding to an event attributefor use with an associated OPC Data Access server can be obtained.
Notes:
The attributes provided by the OPC Event server for SIMATIC NETcannot be represented as ItemIDs for use with the OPC Data Accessserver for SIMATIC NET.TranslateToItemIDs is not supported by the OPC Event server forSIMATIC NET.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 313
GetConditionSt ate (LPWSTR szSource, LPWSTR szConditionName, DWORDdwNumEventAttrs, DWORD* pdwAttributeIDs,OPCCONDITIONSTATE ** ppConditionState)
Descr iption:
Provides information about the state of a condition of an event source.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET. E_NOTIMPL is returned.
EnableCondition ByArea(DWORD dwNumAreas, LPWSTR* pszAreas)
Descr iption:
Activates all the conditions for all event sources within the specifiedarea.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET. E_NOTIMPL is returned.
EnableCondition BySource(DWORD dwNumSources, LPWSTR* pszSources)
Descr iption:
Activates all conditions for all specified event sources.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET. E_NOTIMPL is returned.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET314 6GK1971-0BA00-0AA1
DisableCondition ByArea(DWORD dwNumAreas, LPWSTR* pszAreas)
Descr iption:
Deactivates all the conditions for all the events sources within thespecified area.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET. E_NOTIMPL is returned.
DisableCondition BySource(DWORD dwNumSources, LPWSTR* pszSources)
Descr iption:
Deactivates all conditions for all specified event sources.
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET. E_NOTIMPL is returned.
AckCondition (DWORD dwCount, LPWSTR szAcknowledgerID, LPWSTRszComment, LPWSTR* pszSource, LPWSTR* pszConditionName,FILETIME* pftActiveTime, DWORD* pdwCookie, HRESULT**ppErrors )
Descr iption:
Transfers an event confirmation to the client. Only conditional eventscan be confirmed. An event is identified by the event source, the eventname, the activation time, and an additional information ("Cookie").
Notes:
Conditions are not supported by the OPC Event server for SIMATICNET.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 315
CreateAreaBr owser (REFIID riid, LPUNKNOWN* ppUnk)
Descr iption:
Creates an OPCEventAreaBrowser object for investigating the processarea.
Notes:
Areas and the browsing of areas is not supported by the OPC Eventserver for SIMATIC NET. E_NOTIMPL is returned.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET316 6GK1971-0BA00-0AA1
12.3 The "OPC Event Subsc ription" Object
Descr iption An object of the class "OPC Event Subscription" provides eventmessages for the client that uses the connection point container of thisevent object. A client can use several objects of the class "OPC EventSubscription". It could, for example define different filters for differentobjects.
An OPC event subscription is basically a subscription for definedevents.
The "OPC Event Subscription" object provides methods for selectingmessages.
Schemat ic The following schematic illustrates the “OPC server” object with itsinterfaces.
IUnknown
IOPCEventSubscriptionMgt
OPC eventsubscription
object
IConnectionPointContainer
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 317
12.3.1 The " IOPCEventSubsc riptio nMgt" Interface
Overv iew This is the central interface for managing the information via a specific"Event Subscription". On this interface, relevant events can beselected for the client among other things.
SetFilt er (DWORD dwEventType, DWORD dwNumCategories, DWORD*pdwEventCategories, DWORD dwLowSeverity, DWORDdwHighSeverity, DWORD dwNumAreas, LPWSTR* pszAreaList,DWORD dwNumSources, LPWSTR* pszSourceList)
Descr iption:
Provides a filter for selecting certain events for this "EventSubscription".
Notes:
The parameters for filtering have the following significance for theOPC Event server for SIMATIC NET:
Event Type Only the event type OPC_SIMPLE_EVENT issupported. Filtering is pointless
Event Categories Possible event categories are as follows:• S7_PROCESS_SCAN• S7_PROCESS_ALARM
Sever ity The default severity of the message is 600 forS7_PROCESS_ALARM and 300 forS7_PROCESS_SCAN, this can however bechanged using the configuration file.
Areas Areas are not supported
Source As the source, connection information can bespecified. (See Section 6.2.1 )
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET318 6GK1971-0BA00-0AA1
GetFilt er (DWORD* pdwEventType, DWORD* pdwNumCategories, DWORD**ppdwEventCategories, DWORD* pdwLowSeverity, DWORD*pdwHighSeverity, DWORD* pdwNumAreas, LPWSTR** ppszAreaList,DWORD* pdwNumSources, LPWSTR** ppszSourceList )
Descr iption:
Returns the currently used filter for selecting certain events for this"Event Subscription".
Notes:
The parameters for filtering have the same significance for the OPCEvent server for SIMATIC NET as explained in the description of the"SetFilter" method.
SelectReturnedAtt ribut es(DWORD dwEventCategory, DWORD dwCount, DWORD*dwAttributeIDs)
Descr iption:
Specifies the attribute for an event category to be supplied with theevent message.
Notes:
The possible attributes for the OPC Event server for SIMATIC NET aredescribed in Section 6.2.2.
GetReturnedAtt ribut es( DWORD dwEventCategory, DWORD * pdwCount, DWORD*pdwAttributeIDs)
Descr iption:
Returns the list with the attributes for an event category to be suppliedwith an event message.
Notes:
The possible attributes for the OPC Event server for SIMATIC NET aredescribed in Section 6.2.2.
Refresh (DWORD dwConnection )
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 319
Descr iption:
Sends all active and all inactive, unconfirmed condition messagescorresponding to the current filter setting to the client.
Notes:
Since the OPC Event server for SIMATIC NET supports only simpleevents, no event messages are sent with the refresh.
CancelRefresh (DWORD dwConnection )
Descr iption:
Cancels an active refresh.
Notes:
Since the OPC Event server for SIMATIC NET supports only simpleevents no event messages are sent during a refresh. A CancelRefreshtherefore has not effect.
GetState (BOOL * pbActive, DWORD * pdwBufferTime, DWORD *pdwMaxSize, OPCHANDLE * phClientSubscription)
Descr iption:
Returns the current status of the event subscription.
SetState (BOOL * pbActive, DWORD * pdwBufferTime, DWORD *pdwMaxSize, OPCHANDLE hClientSubscription DWORD *pdwRevisedBufferTime, DWORD * pdwRevisedMaxSize)
Descr iption:
Allows the setting of various properties of an event subscription.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET320 6GK1971-0BA00-0AA1
12.4 The Inte rfaces of the Client
Descr iption When using connection points to transfer events to a client, the clientmust 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 tothe IUnknown interface to the server.
Schemat ic The following schematic shows the object to be implemented by theclient for receiving messages and its interfaces.
IUnknown
IOPCEventSink
Event sinkclient object
IOPCShutdown
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 321
12.4.1 The " IOPCEventSink" Interface
Overv iew This is the central interface of the client for receiving messages. Itcontains a method called by the server to transfer events.
OnEvent (OPCHANDLE hClientSubscription, BOOL bRefresh, BOOLbLastRefresh, DWORD dwCount, ONEVENTSTRUCT* pEvents)
Descr iption:
Transfers one or more event messages to the client.
Notes:
The "*pEvents" structure contains one or more events. In the structureelements that follow, the SIMATIC NET OPC Event enters specificvalues:
SzSource Connection informationConversion to an ItemID for use in OPC DataAccess using TranslateToItemID provides noresult.
ftTime Time at which the event occurred on the partnerdevice. The time at which the message is receivedon the OPC Event server is entered in the"EVENT_ATTR_S7_PCTIME" attribute.
szMessa ge • SCAN<message number> or• ALARM<message number>
dwEventType OPC_SIMPLE_EVENT
dwEventCategory • S7_PROCESS_SCAN• S7_PROCESS_ALARM
pEventAtt ribut es The attributes provided are described in Section6.2.2.
All other structure elements are irrelevant.
The OPC Custom Interface for Alarms & Events
Introduction to the OPC Server for SIMATIC NET322 6GK1971-0BA00-0AA1
12.4.2 The " IOPCShutdow n" Interface
Overv iew Via the call interface based on this connection point, the server caninform its clients before it is closed down or before it closes down. Incritical situations, this allows the OPC server to inform its clients sothat, for example, they can close down correctly.
The interface contains one method:
Shutdown Request (LPWSTR szReason)
Descr iption:
Via this interface, the server can inform its clients when it is closed.
Notes:
The "Reason" (parameter szReason) can be set using the configurationprogram for the OPC server.
Where to Get Help
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 323
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
Where to Get Help
Introduction to the OPC Server for SIMATIC NET324 6GK1971-0BA00-0AA1
13.1 Help with Technical Questions
SIMATIC Custo mer Support Hot line
Available at all times worldwide:
SIMATIC Basic Hotline
NurembergSIMATIC BASIC Hotline SIMATIC Premium Hotline
(charged, only with SIMATIC card)
Local time: Mo to Fr 8:00 to 18:00 (CET)Phone: +49 (911) -895-7000Fax: +49 (911) -895-7002E-mail: [email protected]
Local time: Mo to Fr 0:00 to 24:00 (CET)Phone: +49 (911) -895-7777Fax: +49 (911) -895-7001
John son CitySIMATIC BASIC Hotline
Sing aporeSIMATIC BASIC Hotline
Local time: Mo to Fr 8:00 to 17:00Phone: +1 423 461-2522Fax: +1 423 461-2231E-mail: [email protected]
Local time: Mo to Fr 8:30 to 17:30Phone: +65 740-7000Fax: +65 740-7376E-Mail: [email protected]
Johnson C ityNuremberg
Singapo re
Where to Get Help
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 325
SIMATIC Customer Support On line Services
In its online services, SIMATIC Customer Support provides you with wide-rangingadditional 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 Supportmailbox 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 offertraining courses Please contact your regional training center or the central trainingcenter in D-90327 Nuremberg, Tel. 0911-895-3154.
Authorization
Please note that this software product can only be operated when you are inpossession 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 thedemonstration mode without a license to acquaint yourself with the functions.
Where to Get Help
Introduction to the OPC Server for SIMATIC NET326 6GK1971-0BA00-0AA1
Standard s and Appro vals
The S7-300 meets the requirements and criteria of IEC 1131, Part 2. The S7-300meets the requirements for CE marking. CSA, UL and FM approvals exist for theS7-300.
Recycling and Dispos al
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 AktiengesellschaftAnlagenbau und Technische DienstleistungATD ERC Essen Recyling/RemarketingFronhauser Str. 6945 127 Essen
Phone: 0201-816-1540 (Hotline)Telefax: 0201-816-1506
Where to Get Help
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 327
13.2 Who to Contact about T raining for SIMATIC NET Products
CourseRegistration
Siemens AGTrainings-Center für AutomatisierungstechnikAUT 959 Kursbüro
Östliche Rheinbrückenstraße 5076181 KarlsruheGermany
Telephone 0721 - 595 - 2917outside Germany +49 - 721 - 595 - 2917
Telefax 0721 - 595 - 6987outside Germany +49 - 721 - 595 - 6987
Where to Get Help
Introduction to the OPC Server for SIMATIC NET328 6GK1971-0BA00-0AA1
Glossary
Introduction to the OPC Server for SIMATIC NET6GK1971-0BA00-0AA1 329
14 Glossary
Appli cation Synonym for user programs
AS-Interface Actuator Sensor Interface - cable for direct connection of simple binarysensors and actuators (transfer of small amounts of information)
COM Component Object Model - specification from Microsoft for Windowsobjects, basis of OLE
DCOM Distributed COM - extension of the COM standard allowing thedistribution of COM objects in a network.
DLL Dynamic Link Library - selection of functions available to more thanone program. The DLL is only loaded in memory once(Windows/Windows NT property).
DP Proto col Protocol for data transmission to distributed I/Os via a DP network ->PROFIBUS
FMS Fieldbus Message Specification, -> PROFIBUS protocol for convenientcommunication on the basis of layer 7 of the ISO/OSI reference model
Indu strial Eth ernet Bus system for use in industry on the basis of Ethernet (previouslySINEC H1)
Network A network consists of one or more connected subnets with any numberof nodes. Several networks can exist parallel to each other.
OLE Object Linking and Embedding - central architectural principle of theWindows versions Windows 95, Windows NT and the basis ofWindows application software under Windows 3.x
OPC OLE for Process Control - industrial standard allowing vendor-independent access to industrial communication networks, defined onthe basis of OLE.
OPC Client User program that uses an OPC server via the OPC interface toaccess process data.
Glossary
Introduction to the OPC Server for SIMATIC NET330 6GK1971-0BA00-0AA1
OPC Server An OPC server is a product that provides the OPC client with wideranging functions allowing communication via industrial networks.
PLC Programmable Logic Controller - interface between sensors andproduction machines also used for communication and data transportbetween 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 indu strial communi cation s networks andnetwork components
SR Send/Receive, SIMATIC NET protocol for simple, but powerfulcommunication 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 astronomicaltime.
VBA Visual Basic for Applications - macro language of various officeapplications from Microsoft
Appendix ASIMATIC COMPUTING
iSIMATIC Computing6GK1971–0BA00–0AA1
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iiSIMATIC Computing
6GK1971–0BA00–0AA1
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. . . . . . . . . . . . . . . . . . . . . . .
A-1SIMATIC Computing6GK1971–0BA00–0AA1
SIMATIC Computing
A.1 Getting Started with Computing
Chapter Overview
The Computing software provides you with a simple way to access and to use datafrom a communication system such as a PROFIBUS–DP, a FMS Network or a S7programmable controller.
This chapter provides some easy programming examples to help you becomefamiliar with the power and flexibility that can be achieved by using the ActiveXcontrols provided by SIMATIC Computing.
!Warning
After you assign a variable to the Value property of a SIMATIC ActiveX control, thecontrol is able to access process data. When you change the value that isdisplayed in the control, you are changing the value in the actual process. Do notconnect these examples to a control engine that is connected to equipment.
Altering process data can cause unpredictable process operation, andunpredictable process operation could result in death or serious injury topersonnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could causeprocess equipment to operate erratically. Always install a physical emergency stopcircuit for your machineor process.
A
SIMATIC Computing
A-2SIMATIC Computing
6GK1971–0BA00–0AA1
Simatic Computing für WinAC und SlotPLC
The SIMATIC Computing software supplied with the OPC Server for SIMATIC NETcorresponds to SIMATIC Computing for the products Win AC and Slot PLC VersionV2.x. There are, however, the following differences:
– It is only possible to access variables via the SIMATIC NET communicationsystems.
– The names of the variables when using SIMATIC Computing with the OPCServer from SIMATIC NET differ from the variable names used in WinAC.
SIMATIC Computing
A-3SIMATIC Computing6GK1971–0BA00–0AA1
A.1.1 Overview
The examples in this chapter show some of the ways you can use the ActiveXcontrols provided by Computing. As shown in Figure A-1, this chapter providessamples of subroutines for the following applications:
� Create a user interface: You can use the SIMATIC controls with a third–partycontainer (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 inthis chapter.)
� Use a standard ActiveX control: You can use a standard control (such as aLabel control from Visual Basic) to access data in the control engine. SeeSection A.1.3.
� Load data from the control engine into standard software packages: You canload data into a Microsoft Office application (such as Microsoft’s Excel). SeeSection A.1.4.
I/O Panel
I 0.0
OFF
I 0.1
OFF
I 0.2
OFF
0 0 0
QB0 QB1 QB2
Standard ActiveX Control
Excel
Label control
Interface Panel
Third-party application
Figure A-1 Using Computing to Access Data in the Control Engine
SIMATIC Computing
A-4SIMATIC Computing
6GK1971–0BA00–0AA1
A.1.2 Creating a Sample I/O Panel
The Data control allows any OLE Container (such as Visual Basic 5.0) to accessprocess data. You can use the SIMATIC controls provided by Computing withVisual Basic to create a simple I/O Panel that interacts with a control engine.
To create this sample application, you need the following items:
� Microsoft Visual Basic 5 or higher
� 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 inthe 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 canbe used with other systems (S5, DP–Network, FMS–Devices) too.
SIMATIC Computing
A-5SIMATIC Computing6GK1971–0BA00–0AA1
Components
Insertable ObjectsControls
OK Cancel Apply
Designers
Browse...
Selected Items Only
Siemens S7vbButton ControlSiemens S7vbSlider ControlSiemens SIMATIC Data Control
Siemens S7DiagBF ControlSiemens S7Number ControlSiemens S7Panel Control
Third-Party Control...Third-Party Control...Third-Party Control...
� Click on the Data control, Numbercontrol, and the Button control.
� Click on the “Apply” button to add thecontrol to the VB toolbox.
� Click on the “OK” button to close the“Components” dialog box.
Siemens SIMATIC Data ControlLocation: C:\SIEMENS\Common\OCX\S7WCDATX.OCX
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 threeSIMATIC Button controls onto the Visual Basic form. See Figure A-3.
2. Create standard VB label controls to indicate the address that you haveassigned for each of the controls. See Figure A-3.
I/O Panel
EB0
OFF
EB1
OFF
EB2
OFF
0 0 0
Temp Power Flow
Data control
Label controls
Button controls
Number controls
Label controls
Figure A-3 Sample I/O Panel Created in Visual Basic
SIMATIC Computing
A-6SIMATIC Computing
6GK1971–0BA00–0AA1
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 thecontrol engine, you must assign a variable to the Value property (or to otherproperties) for each control. You use the Connection tab of “Properties” dialog boxfor the Data control to assign properties to the process variables in the controlengine. You cannot assign a process variable to the Value property of a control byusing 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-upmenu. From the pop-up menu, select the Properties menu command todisplay the “Properties” dialog box for the Data control.
2. Select the “Connections” tab. Click on the “+” symbol to expand the list ofcontrols.
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
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]EB0
Browse...
100
0
Update rate (ms):
Dead band:
Automati
Controls:
Add... Filter...
S7vbBttn1
OK Cancel Apply Help
Engine
ApplyDelete
EnabledFalseCaptionFalseColorFontToolTipTextTrueCaptionTrueColorValue
After you select the property from thehierarchy, enter the name of thevariable to be assigned to thatproperty
Name
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-7SIMATIC Computing6GK1971–0BA00–0AA1
Table A-1 Assigning Sample names to the SIMATIC Controls (for S7–protocol)
Control Name ofvariables
Description
S7Number1 S7:[DEMO]DemoTemperature
Alias for MW1
S7Number2 S7:[DEMO]DemoPower
Alias for DB10,W0
S7Number3 S7:[DEMO]DemoFlow
Alias for DB10,D0
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 withthe 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 controlengine. 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
Connections EventsGeneral
Tag Source
Connect via Tag Source
OK Cancel Apply Help
Engine
Direct Connect
PC Name
Control Engine @SimaticNet
Browse...
Enter @SimaticNet as the type ofcontrol engine
Name Select the option for a directconnection
Figure A-5 Connecting the Data Control to a Control Engine
SIMATIC Computing
A-8SIMATIC Computing
6GK1971–0BA00–0AA1
Operating of the I/O Panel Program
Before you run the I/O Panel program, make certain that the communcationsystem is ready.
1. Select the File Save Project menu command to save the program beforeswitching Visual Basic from Design mode to Run mode.
2. Click on the “Start” icon or select the Run Start menu command to switchVisual 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-9SIMATIC Computing6GK1971–0BA00–0AA1
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 Labelcontrol) to data in the control engine. To create this sample application, you needthe following items:
� Microsoft Visual Basic 5 or higher
� 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” menucommand to display the “New Project” dialog box, then select the “StandardEXE” icon and click on the “Open” button.
2. Add the Siemens SIMATIC Data control to the VB toolbox. For informationabout adding controls to the VB toolbox, see Section A.1.1 and Figure A-6.
Components
Insertable ObjectsControls
OK Cancel Apply
Designers
Browse...
Selected Items Only
Siemens S7vbButton ControlSiemens S7vbSlider ControlSiemens SIMATIC Data Control
Siemens S7DiagBF ControlSiemens S7Number ControlSiemens S7Panel Control
Third-Party Control...Third-Party Control...Third-Party Control...
Siemens SIMATIC Data ControlLocation: C:\SIEMENS\Common\OCX\S7WCDATX.OCX
� Click on the SIMATIC Data control.
� Click on the “Apply” button to add thecontrol to the VB toolbox.
� Click on the “OK” button to close the“Components” dialog box.
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 controlsonto the VB form, see Section A.1.1.)
4. Insert a VB label on your form. Change the Border Style property to “1–FixedSingle.”
5. Select the Data control and click the right mouse button to bring up the pop-upmenu. 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
A-10SIMATIC Computing
6GK1971–0BA00–0AA1
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 “AssignedVariable” field. A-7). Click on the “Apply” and “OK” buttons to enter the data andclose the “Properties” dialog box.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]MB0
Browse...
100
0
Update rate (ms):
Dead band:
Automati
Controls:
Add... Filter...
Label1
OK Cancel Apply Help
Engine
ApplyDelete
AlignmentAppearanceAutosizeBackColorBackStyleBorderStyle
DataField
Select the Caption propertyand enter S7:[DEMO]MB0 inthe “Assigned Variable” field.
Name
Caption
Figure A-7 Assigning a Variable to the Caption Property of a VB Label Control
SIMATIC Computing
A-11SIMATIC Computing6GK1971–0BA00–0AA1
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 MB0in the control engine.
Use the following procedure to configure the Data control for communicating withthe 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 controlengine. 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 sampleprogram.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Tag Source
Connect via Tag Source
OK Cancel Apply Help
Engine
Direct Connect
PC Name
Control Engine @SimaticNet
Browse
Enter @SimaticNet as the type ofcontrol engine
Name Select the option for a directconnection
Figure A-8 Connecting to the Control Engine (Label Control Example)
SIMATIC Computing
A-12SIMATIC Computing
6GK1971–0BA00–0AA1
A.1.4 Using Computing with Microsoft Excel 97
Using the Data control in an Excel spreadsheet allows you to access the values inthe control engine. To create this sample application, you need the following items:
� Microsoft Excel 97
Creating a Command Button in Excel 97
The first step in creating the sample Excel application is to create a commandbutton. Use the following procedure to create a command button:
1. Start the Excel application. (If prompted about whether to enable or disablemacros, 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 theControl toolbox.
4. Click on the “Design Mode” icon in the Control toolbox to put the spreadsheetinto 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 mousebutton 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 inExcel 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 theVisual Basic editor.
3. In the Properties window, select the Caption property of CommandButton 1 andenter 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 thefollowing code for the CommandButton1_Click() event:
UserForm1.show
5. Close the Code window for CommandButton1.
SIMATIC Computing
A-13SIMATIC Computing6GK1971–0BA00–0AA1
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 menuand 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 controlonto the toolbox.
4. Select the “Data control” icon in the “Toolbox” window and insert a Data controlonto UserForm1.
5. Select the Data control and click the right mouse button to bring up the pop-upmenu. From the pop-up menu, select the Properties menu command to displaythe properties for the Data control (S7Data1) in the Properties window.
6. In the Properties window for S7Data1, select the “(Custom)” property field andthen click on the expansion button to display the “Properties” dialog box for theData control.
Adding Events for the Data Control
1. In the ”Properties” dialog box for the Data control, select ”Events” tab. In the listunder 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 S7Data1control.
SIMATIC Computing
A-14SIMATIC Computing
6GK1971–0BA00–0AA1
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:Keys:
S7Soft1
S7Data1
Add...
OK Cancel Apply Help
Engine Name
Add
Add a new key:
CancelOK
MB0
Select the Data control and clickon the “Add” button to display the“Add” dialog box.
Enter MB0 in the “Add new key”field and click on the “OK” button.
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 theevent key “MB0” appears in boldface under S7Data1.
5. Enter new event keys for MB1 (Variable S7:[DEMO] MB1) and MB2 (VariableS7:[DEMO]MB2) by selecting S7Data1 again and repeating steps 2. and 3.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]MB0
Browse...
100
0
Update rate (ms):
Dead band:
Keys:
S7Soft1
S7Data1
Add... Delete
OK Cancel Apply Help
MB0
Engine Name
Select the event key (MB0).
Enter S7:[DEMO]MB0 in the“Assigned Variable” field and clickon the “Apply” button.
Figure A-10 Assigning a Variable to an Event Key
SIMATIC Computing
A-15SIMATIC Computing6GK1971–0BA00–0AA1
Configuring the Control Engine for the Data Control
1. In the “Properties” dialog box for the Data control, select the “Engine” tab toconfigure the control engine.
2. Deactivate the option “Auto Connect” and specify @SimaticNet as the controlengine. 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 thefollowing program:
Select Case PropertyCase ”MB0”
Worksheets(”Sheet1”).Range(”B1”).Value = ValueCase ”MB1”
Worksheets(”Sheet1”).Range(”B2”).Value = ValueCase ”MB2”
Worksheets(”Sheet1”).Range(”B3”).Value = ValueEnd 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 SubPrivate Sub UserForm_Deactivate
S7Data1.DisconnectEnd 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 inExcel.
SIMATIC Computing
A-16SIMATIC Computing
6GK1971–0BA00–0AA1
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 databeing controlled by a control engine such as a Simatic NetCommunicationsystem.You can use the standard SIMATIC controls provided withthe Computing software (see Table A-2), or you can connect any other ActiveXcontrol 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 othercontrols have access to the process data.
Button
OFF
Provides access to individual memory bits in thecontrol engine. The Button control accesses onlybits and has two values:
� Off = 0 (default color: red)
� On = 1 (default color: green)
Changing the state of the Button control changesthe state of the variable in your process that isassociated with the control.
If you configure the Button control to be read–only,then it functions like a lamp or LED.
Number0
Provides access to the variables on the controlengine.You can access bytes, words, ordouble-words, and you can manipulate individualbits of this data.
Entering a new value in the Number controlchanges 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 changesthe data in the control engine.
SIMATIC Computing
A-17SIMATIC Computing6GK1971–0BA00–0AA1
A.3 Accessing the Process Data with the SIMATIC Data Control
Chapter Overview
The SIMATIC Data control provides the connection between your ActiveX controlsand the control engine (for example, the protocol connection with S7).
The Data control has specific properties that you can configure:
� For container applications (such as MicroSoft Visual Basic): access theproperties as for any other control in that container (for example, by using theright mouse button). Open the context menu for the Data control by clicking theright mouse button and selecting the Properties menu command.
SIMATIC Computing
A-18SIMATIC Computing
6GK1971–0BA00–0AA1
A.3.1 Connecting the SIMATIC Controls to the Control Engine
!Caution
Failing to disable the timers in your program could cause timer-generatedconnections to remain connected, allowing these connections to continue to writedata to the control engine. This could cause the control engine to operateerratically, which could potentially cause damage to equipment and injury topersonnel.
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 therelationship between the Data control and the other SIMATIC controls.
You use the Connections tab of the Data control to assign a variable (the memorylocation) to the Value property of each SIMATIC control. The Data controlconfigures the control engine to check the assigned variables at a specified rate (inmilliseconds). If there is a change in the value, the new value is written to the Datacontrol. The Data control then writes the new value to the other controls.
OPC Client
Computing
OPC Server
SIMATIC Button control
SIMATIC Number control
Third-party control
SIMATIC Slider control
SIMATIC Data control
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-19SIMATIC Computing6GK1971–0BA00–0AA1
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 followingparameters for the connection to the control engine:
� Autoconnect (automatic connection): when this option is enabled, the Datacontrol automatically connects to the process variables in the control engine.When this option is disabled, the Data control connects to the variables onlywhen instructed by the program code (using a Connect method) that youassociated with the control.
� Autoconnect Timeout: time-out (in milliseconds) for the automatic connection:specifies the amount of time that the Data control waits between connecting tothe control engine and writing data.
Some containers may not provide a mechanism for telling the Data control towrite to the control engine. After the time-out that you specify, the Data controlstarts writing data.
� Default Update Rate (ms): specifies the rate that the control engine checks theprocess variables to see if change has occurred.
� Default Dead Band: specifies to the control engine the amount of change thatmust occur in a value before the control engine writes the new value to the Datacontrol. For example: if the dead band is 10 and the value in the control engineis 22, then the control engine does not write a new value until the valuebecomes either 33 or 11.
� Show Error Boxes: specifies whether to display the default error boxes whenthere is a user-generated error. Computing provides error messages in Englishonly. If you want to display messages in other languages, you must deselectthis option and write program code to react on the error event.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
100
100
AutoConnect Timeout (ms):
Default Update Rate (ms):
0Default Dead Band:
AutoConnect:
Show Error Boxes:
OK Cancel Apply Help
Engine Name
Figure A-12 SIMATIC Data Control Properties (General Tab)
SIMATIC Computing
A-20SIMATIC Computing
6GK1971–0BA00–0AA1
A.3.3 Selecting the Control Engine for the Data Control
Computing allows you to connect either to a single control engine or to severalcontrol engines. You can also connect to the control engine over a network, suchas a local area network (LAN). Use the Engine tab of the Properties dialog box toselect the control engine. See Figure A-13.
In the type of operation with Simatic Net communication systems as described inthis manual a control engine is a software module for binding a communicationprotocol.
� If you select the “Direct Connection” option, enter the name of the controlengine. If you are connecting to a control engine over a network, enter thecomputer name of the target computer in the “PC Name” field. Enter foroperating with Simatic Net the following strings in the “Control Engine” field:
– @SimaticNet
� 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 thatidentifies symbols for the variables and control engines to be accessed.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Tag Source
Connection via Tag Source
OK Cancel Apply Help
Engine
Direct Connection
PC Name
Control Engine @SimaticNet
Browse
Name
Figure A-13 SIMATIC Data Control Properties (Engine Tab)
SIMATIC Computing
A-21SIMATIC Computing6GK1971–0BA00–0AA1
As shown in Figure A-14, clicking on the “Browse” button allows you to search fora valid tag source (*.tsd). The tag source provides the symbolic identification thatallows you to access different control engines from one Data control.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Tag Source
Connection via Tag Source
OK Cancel
Engine
Direct Connection
PC Name
Control Engine @SimaticNet
Browse
Click on the Browse button toselect a specific tag file for theSIMATIC controls
Name
Figure A-14 Selecting a Tag File for the Data Control
After you select the type of connection (single control engine or multiple controlengines), click on the Apply button to enter your selections for the Data controlproperties.
SIMATIC Computing
A-22SIMATIC Computing
6GK1971–0BA00–0AA1
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 yourprogram 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 usesymbol names for the variables in the control engine.
To use symbol names, select the option for connecting to multiple control enginesand browse to a tag file that contains symbols for only one control engine.
PC 2PC 1
SIMATIC Button control
SIMATIC Number control
Third-party control
SIMATIC Slider control
DCOM
WinLC
SIMATIC Data control
Figure A-15 Connecting to a Specific Control Engine over DCOM
Use the following procedure to configure the SIMATIC Data control forcommunicating 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-23SIMATIC Computing6GK1971–0BA00–0AA1
3. Double–click on the Data control to display the ”Properties” dialog box for theData 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 (forexample, “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 withthe remote control engine.
All of the controls that you insert and connect through this Data control will accessthe 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
Connections EventsGeneral
Tag Source
Connection via Tag Source
OK Cancel Apply Help
Engine
Direct Connection
PC Name
Control Engine @SimaticNet
Browse
PC_2
Name
Select “Direct Connection” and enter thename of the server computer and thecontrol engine
Figure A-16 Configuring DCOM for a Specific Control Engine
SIMATIC Computing
A-24SIMATIC Computing
6GK1971–0BA00–0AA1
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 thecontrol engine.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
Browse...
Update rate (ms
Dead band:
Automatic write
Controls:
Add... Filter...
S7Data1
S7Soft1
S7vbBttn2
S7WCNumber1
S7WCNumber2
S7vbBttn1
OK Cancel Apply Help
Engine
Apply filterDelete
Click on the box with the “plus”sign (or double-click on thename of the Data control) toexpand the hierarchy of controlson the form.
Expand the controls to accessthe individual properties.
Name
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 thecontrol into your ActiveX container, you can use the Add button to add an instanceof the control to the Controls list. As shown in Figure A-18, click on the Add buttonto 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 canselect the instance from the list, choose the Add button again and add anyadditional properties. For instance, you could add a SIMATIC Number controlinstance to the connections list, and then add the Value property to the Numbercontrol in order to assign a variable to the Number control.
SIMATIC Computing
A-25SIMATIC Computing6GK1971–0BA00–0AA1
Note
If you have attached a tag file to the Data control or use the process variable fromSimatic Net, you can enter the symbols instead of the absolute addresses. Youcan also click on the Browse button to navigate to the symbol.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]Power
Browse...
100Update rate (ms):
Dead band:
Automati
Controls:
Add... Filter...
S7Data1S7vbBttn1
OK Cancel Apply Help
Engine
ApplDelete
EnabledFalseCaptionFalseColorFontToolTipTextTrueCaptionTrueColorValue
After you select the property from thehierarchy, enter the name of thevariable to be assigned to thatproperty
Name
Figure A-18 SIMATIC Data Control Properties (Connections Tab)
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
Browse...
100
0
Update rate (ms):
Dead band:
Automatic writ
Controls:
Add... Filter...
S7Data1
S7Soft1
S7vbBttn2
S7WCNumber1
S7vbBttn1
OK Cancel Apply Help
Engine
Apply filterDelete
EnabledValue
Click on the Browse button tocheck the process range.
Name
Figure A-19 SIMATIC Data Control Properties (Connections Tab)
SIMATIC Computing
A-26SIMATIC Computing
6GK1971–0BA00–0AA1
Deleting a Connection
If you remove a control from the ActiveX container, the connection remainsconfigured in the Data control. This means that the next time you place a control ofthe same name into the container, the connection that you configured for theprevious control of that name is automatically applied to the new control. Forinstance, if you remove a control called Number1, and later insert a new Numbercontrol, the default name for the new control is Number1, and the new controlinherits the existing Number1 connection. Use the Delete button if you want toprevent new controls from inheriting a previously configured connection: from theControls list, select the instance whose connection you want to delete, and click onthe Delete button.
Note
If you remove a control, or change your mind about adding a control after youhave already configured a connection for it using the Add button, you can onlydelete the connection to it if there is no control in the ActiveX container that usesthe name specified in the connection. Delete the connection before you add anyother control that uses the name that is specified in the connection. You cannotuse the Delete button to remove a connection to a control that is present in theActiveX container.
SIMATIC Computing
A-27SIMATIC Computing6GK1971–0BA00–0AA1
A.3.6 Filtering the Properties for the ActiveX Controls
The Data control provides a filter that allows you to display a subset of theproperties for the controls. For example, you may want to display only the“Enabled” and “Value” properties and avoid scrolling through all of the otherproperties 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
Connections EventsGeneral
Assigned Variable:
100
0
Update rate (ms):
Dead band:
Automatic write mode:
Controls:
Add... Filter...
S7Data1
S7Soft1
S7vbBttn2
S7WCNumber1
S7WCNumber2
S7vbBttn1
OK Cancel Apply Help
Engine
Apply filter to propertiesDelete
Click on the Filter button to selectthe properties to be displayed
Name
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 Addbutton. Use the Edit button to correct entries and the Delete button to removeentries.
4. As shown in Figure A-22, select the “Apply filter to properties” check box todisplay only the properties listed in the filter.
Use the “Apply filter to properties” check box to toggle the filter on and off.
SIMATIC Computing
A-28SIMATIC Computing
6GK1971–0BA00–0AA1
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
100
0
Controls:
Add...
S7Data1
S7Soft1
SIM
SIM
SIM
SIM
OK Cancel Apply Help
Engine
properties
Property Filter
Visible Properties:
Add... Delete
Enabled
OK Cancel
Edit
Value
Click on the Add button to enter aproperty to the filter
Name
mode:
Figure A-21 SIMATIC Data Control Properties (Connections Tab)
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
Browse...
Update rate (m
Dead band:
Automatic write mode:
Controls:
Add... Filter...
S7Data1
S7Soft1
S7vbButton2
S7WCNumber1
S7vbBttn1
OK Cancel Apply Help
Engine
Apply filter to propertiesDelete
EnabledValue
Click on the check box to togglethe property filter on and off
S7WCNumber1
Name
Figure A-22 SIMATIC Data Control Properties (Connections Tab)
SIMATIC Computing
A-29SIMATIC Computing6GK1971–0BA00–0AA1
A.3.7 Configuring Custom Events
As shown in Figure A-23, the Events tab allows you to add custom events that aretriggered by the Data control. You enter a key (string) and assign that key to aprocess variable. If that variable changes, then the Data control generates anevent 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 programthat responds to events.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
DP:[Demo]DemoPower
Browse...
100
0
Update rate (ms):
Dead band:
Keys:
S7Soft1
S7Data1
Add... Delete
OK Cancel Apply Help
OverflowWarning
Engine Name
Figure A-23 SIMATIC Data Control Properties (Events Tab)
Adding an Event
The Add button allows you to add user-specified events for controller valuechanges. You can write your own code to handle the event by handling theValueChanged event of a Data control. Select a Data control from the expandablelist under the “Keys” field and click on the Add button; then type any name youchoose 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 befired.
Figure A-23 shows an sample event that has been added. A change in the value ofthe 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 desiredevent, and click on the Delete button.
SIMATIC Computing
A-30SIMATIC Computing
6GK1971–0BA00–0AA1
A.3.8 Creating a Connection Table
The Data control uses a connection table for determining which property of thevarious controls are connected to specific process variables of the control engine.Each connection table contains an entry for each connection. Each entry containsthe following information:
� Property name: this field identifies the property that has an assigned variable.
� Data source: this field identifies the name of the process variable.
� Update rate: this field defines the update rate for the connection. If no value isentered in this field, the Data control uses the default update rate (which is thevalue stored in the DefaultUpdateRate property).
� Default Dead Band: this field defines the dead band for automatically writing tothe control engine or the control. If no value is entered in this field, the Datacontrol uses the default update rate (which is the value stored in theDefaultDeadBand property).
When you use the “Properties” dialog box to configure the Data control, the Datacontrol automatically creates a connection table. You can also create a program tomanually create connection tables. See Section A.3.9 for a sample program formanually creating a connection table.
SIMATIC Computing
A-31SIMATIC Computing6GK1971–0BA00–0AA1
A.3.9 Sample Program for Creating a Connection Table and an EventTable
You can write a program to create a table to define the connections (assignedvariables) 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 aspecific 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 thecontrol for the connection, the source (process variable of the assigned variable inthe control engine), the update rate, and the dead band value. In order toprogrammatically change connections with a connection table, you must firstdisconnect the data control (ending all connections) before you can reassignconnections and reconnect the Data control.
Note
Instead of creating a connection table, consider using the read and write methodsfor the Data control (ReadVariable, ReadMultipleVariables, WriteVariable, andWriteMultipleVariables). These methods allow you to access more data with justone line of code.
Table A-3 shows, how to assign the property caption of a label control with thename lblChange to the process variable S7:[DEMO]MW2 using program code.Thevalue 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 lblChangeControlTable (0) = ”Caption” ’Property<HR+>ControlTable (1) = ”S7:[Demo]MW2” ’Source (memory location)ControlTable (2) = ”100” ’Update rateControlTable (3) = ”0.0” ’Dead band
’Attach the connection table to S7Data1’S7Data1.ConnectObject lblChange, ControlTable
’Connect to the control engineS7Data1.Connect ’Connects to the control engine
SIMATIC Computing
A-32SIMATIC Computing
6GK1971–0BA00–0AA1
Using an Event Table
You can also create an event table to define events for the control engine. Theevent table corresponds to the “Events” tab on the “Properties” dialog box of theData control. Table A-4 provides the sample Visual Basic code for creating anevent table.
Section A.3.10 provides a sample program that responds to events. This sampleprogram 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 nameControlTable(1) = ”S7:[DEMO]m0.0” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_1” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.1” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_2” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.2” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_3” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.3” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_4” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.4” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_5” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.5” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_6” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.6” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_7” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.7” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
End
SIMATIC Computing
A-33SIMATIC Computing6GK1971–0BA00–0AA1
A.3.10 Sample Program for Responding to Events
You can create a program that responds to events in the control engine. In thissample program, eight lights correspond to the eight events which are defined in aconnection table. See Figure A-24. The events are connected to the status ofmemory location MB0: a change in the value stored in MB0 generates a set ofevents (named for each bit in the byte).
As shown in Figure A-24, the program also contains the following elements:
� Data control (S7Data4) for connecting to the control engine
� Timer (Timer1) that increments the value stored in MB0 (which then causes thecontrol engine to generate the events)
� Command button (cmdStartEvent) for starting or stopping the timer (therebystarting or stopping the generation of events)
Start Events
WinAC VB5 Programming ExampleLight(0) to Light(7): These VBshapes change color to displaythe events stored in MB0
Timer1: generates aReadVariable and WriteVariableat fixed intervals
S7Data4 Connects theseelements to the control engine
cmdStartEvent: This commandbutton starts (or stops) theevents
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-generatedconnections to remain connected, allowing these connections to continue to writedata to the control engine. This could cause the control engine to operateerratically, which could potentially cause damage to equipment and injury topersonnel.
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-34SIMATIC Computing
6GK1971–0BA00–0AA1
Creating an Event Table for the Sample Program
Your program can create an event table to define specific events in the controlengine.Table A-5 lists the code for creating a connection table for defining eventkeys 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 nameControlTable(1) = ”S7:[DEMO]m0.0” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_1” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.1” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_2” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.2” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_3” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.3” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_4” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.4” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_5” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.5” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_6” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.6” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
ControlTable(0) = ”m0_7” ’ Event nameControlTable(1) = ”S7:[DEMO]m0.7” ’ process variableControlTable(2) = ”500” ’ update rateControlTable(3) = ”0” ’ dead bandlResult = S7Data1.ConnectName(””, ControlTable)
End
SIMATIC Computing
A-35SIMATIC Computing6GK1971–0BA00–0AA1
Responding to the Events Generated by the Sample Program
The program listing in table A-6 shows how to respond to different events from thecontrol 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 occurredSelect Case Property
Case ”M0_0” ’Event M0_0 turns Light(0) greenIf Value = True Then
Light(0).FillColor = vbGreenElse
Light(0).FillColor = vbRedEnd If
Case ”M0_1” ’Event M0_1 turns Light(1) greenIf Value = True Then
Light(1).FillColor = vbGreenElse
Light(1).FillColor = vbRedEnd If
Case ”M0_2” ’Event M0_2 turns Light(2) greenIf Value = True Then
Light(2).FillColor = vbGreenElse
Light(2).FillColor = vbRedEnd If
Case ”M0_3” ’Event M0_3 turns Light(3) greenIf Value = True Then
Light(3).FillColor = vbGreenElse
Light(3).FillColor = vbRedEnd If
Case ”M0_4” ’Event M0_4 turns Light(4) greenIf Value = True Then
Light(4).FillColor = vbGreenElse
Light(4).FillColor = vbRedEnd If
Case ”M0_5” ’Event M0_5 turns Light(5) greenIf Value = True Then
Light(5).FillColor = vbGreenElse
Light(5).FillColor = vbRedEnd If
Case ”M0_6” ’Event M0_6 turns Light(6) greenIf Value = True Then
Light(6).FillColor = vbGreenElse
Light(6).FillColor = vbRedEnd If
SIMATIC Computing
A-36SIMATIC Computing
6GK1971–0BA00–0AA1
Table A-6 Sample Programm for Responding to Events in the Control Engine, continued
Case ”M0_7” ’Event M0_7 turns Light(7) greenIf Value = True Then
Light(7).FillColor = vbGreenElse
Light(7).FillColor = vbRedEnd If
End SelectEnd 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 changesthen causes the control engine to generate the events defined in the connectiontable (Table A-5).
� The command button (cmdStartEvents) starts or stops the timer (Timer1).
� 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-generatedconnections to remain connected, allowing these connections to continue to writedata to the control engine. This could cause the control engine to operateerratically, which could potentially cause damage to equipment and injury topersonnel.
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-37SIMATIC Computing6GK1971–0BA00–0AA1
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 = TruecmdStartEvents.Caption = ”Stop Events”
ElseTimer1.Enabled = FalsecmdStartEvents.Caption = ”Start Events”
End IfEnd Sub
Private Sub Timer1_Timer()Dim mb0 As VariantDim my_state As Long
S7Data4.ReadVariable ”S7:[Demo]MB0.0”, mb0, my_state, 0If mb0 < 254 Then
mb0 = mb0 + 1Else
mb0 = 0End IfLabel2.Caption = mb0S7Data4.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 thecontrol engine.
Reading a Single Variable in the Control Engine
The program listing in Table A-8 uses the ReadVariable method of the Data controlto read a single variable in the control engine.
Table A-8 Reading a Single Variable from the Control Engine
Visual Basic Code
Private Sub ReadSingleRealVariableDim rc As LongDim name_s As StringDim value_v As VariantDim state_l As LongDim timeout_l As Long
SIMATIC Computing
A-38SIMATIC Computing
6GK1971–0BA00–0AA1
Table A-8 Reading a Single Variable from the Control Engine, continued
’Read one valuename_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 BoxListBox1.ClearListBox1.AddItem ”RetCode = ” & Hex(rc)ListBox1.AddItem ” – ” & name_s & ” = ” & value_vListBox1.AddItem ” – State = ” & Hex(state_l)
End Sub
SIMATIC Computing
A-39SIMATIC Computing6GK1971–0BA00–0AA1
Writing a Single Variable to the Control Engine
The program listing in Table A-9 uses the WriteVariable method of the Data controlto write a single variable to the control engine.
Table A-9 Writing a Single Variable to the Control Engine
Visual Basic Code
Private Sub WriteSingleRealVariableDim rc As LongDim name_s As StringDim value_v As VariantDim timeout_l As Long
’Write one valuename_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 BoxListBox1.ClearListBox1.AddItem ”Wrote ” & name_s & ” = ” & value_vListBox1.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 Datacontrol 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 ReadArrayOfRealsDim rc As LongDim name_s As StringDim value_v As VariantDim state_1 As LongDim timeout_l As LongRandomize
’Read an array oof valuesname_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 BoxListBox1.ClearListBox1.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
A-40SIMATIC Computing
6GK1971–0BA00–0AA1
Writing an Array to the Control Engine
The program listing in Table A-10 uses the WriteVariable method of the Datacontrol 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 WriteArrayOfRealsDim rc As LongDim name_s As StringDim timeout_l As LongDim value_b(2) As Byte ’ for byte writeDim value_w(2) As Integer ’ for word writeDim value_r(2) As Single ’ for real write
’Read an array of valuesname_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 BoxListBox1.ClearListBox1.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-41SIMATIC Computing6GK1971–0BA00–0AA1
A.3.12 Sample Program for Reading and Writing Boolean Data
For reading and writing Boolean data, you must use the ReadMultiVariablesmethod or WriteMultiVariables method. Table A-12 provides a sample program forreading 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 StringDim vals_v As VariantDim states_v As VariantDim 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 StringDim myvals(7) As VariantDim states_v As VariantDim rc As Longmybools(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) = Falsemyvals(1) = Falsemyvals(2) = Falsemyvals(3) = Falsemyvals(4) = Falsemyvals(5) = Falsemyvals(6) = Falsemyvals(7) = False
rc = S7Data1.WriteMultiVariables(mybools, myvals, states_v)End Sub
SIMATIC Computing
A-42SIMATIC Computing
6GK1971–0BA00–0AA1
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 Datacontrol.
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 areestablished at runtime
AutoConnectTimeoutproperty
Specifies a timeout value
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
DefaultDeadbandproperty
Specifies the dead band used by the Data control, if no deadband is specified in the connection table
DefaultUpdateRateproperty
Specifies the update rate used by the SIMATIC DataControl, ifno 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 toseveral control engines
PCName property Specifies the network identification for a remote computer (forconnecting over a network)
PropertyChangedNamemethod
Notifies the Data control that the value of a property of aconnected control, referenced by Name, has changed
PropertyChangedObjectmethod
Notifies the Data control that the value of a property of aconnected control, referenced by Object, has changed
ReadMultiVariablesmethod
Reads the status of several variables in the control engine
ReadVariable method Reads the status of several variables in the control engine
ShowErrorBoxesproperty
Specifies whether to display the default error boxes when thereis a user-generated error
TagSource property Specifies the source (such as a tag file) of symbolic information
WriteMultiVariablesmethod
Writes new values to several variables in the control engine
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-43SIMATIC Computing6GK1971–0BA00–0AA1
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 noconnected event was specified on the call to the Connect method
When an error occurs in the Data control, the control generates a ConnectionErrorevent. Your program can capture this ConnectionError event and respond tospecific 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
A-44SIMATIC Computing
6GK1971–0BA00–0AA1
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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object canrespond 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-45SIMATIC Computing6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 withthree-dimensional effects if the BorderStyle property is set to “Fixed Single” (1). Ifthe 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the appearance ofobject.
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
A-46SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.4 AutoConnect Property
Applies to: SIMATIC Data
This property allows you to specify whether or not the configured connections areestablished at runtime.
Syntax:
object.AutoConnect [= value]
The AutoConnect property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object canrespond to user-generated events.
The settings for value are:
Setting Description
True (default) All configured connections will be established atruntime.
False The connections will be established with a call to theConnect method.
A.4.5 AutoConnectTimeout Property
Applies to: SIMATIC Data
This property allows you to specify a timeout. After the time specified, the SIMATICData Control issues a call to its Connect method if the AutoConnect property is setto 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value of the type Long, which states the timeout inmilliseconds.
SIMATIC Computing
A-47SIMATIC Computing6GK1971–0BA00–0AA1
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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the background colorof an object.
The settings for value are:
Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows SystemColors
Colors specified by system color constants (depending onthe container); for example, colors listed in the VisualBasic (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 arectangular border. If the property has the value None (0), no border will bedisplayed.
Note
This property determines whether the Appearance property has any effect.
Syntax:
object.BorderStyle [= value]
The BorderStyle property has these parts:
SIMATIC Computing
A-48SIMATIC Computing
6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 SIMATICcontrol) 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-49SIMATIC Computing6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the alignment of thelabel.
The settings for value are:
Setting Description
0 or Left (Default for the first label) The label is aligned to the leftside of the field.
1 or Right (Default for the second label) The label is aligned to theright 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 isdetermined by the Caption1BackColor property, and the second label isdetermined 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the background colorof object.
The settings for value are:
Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows SystemColors
Colors specified by system color constants (depending onthe container); for example, colors listed in the VisualBasic (VB) object library in the Object Browser
SIMATIC Computing
A-50SIMATIC Computing
6GK1971–0BA00–0AA1
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.Caption1Fontobject.Caption2Font
The Caption1Font and Caption2Font properties have these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 isdetermined by the Caption1ForeColor property, and the second label is determinedby 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the background orforeground colors of object.
The settings for value are:
Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows SystemColors
Colors specified by system color constants (depending onthe container); for example, colors listed in the VisualBasic (VB) object library in the Object Browser
SIMATIC Computing
A-51SIMATIC Computing6GK1971–0BA00–0AA1
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, thanit specifies the height (in twips) of the labels. If you do not specify a size (if youaccept the default value of -1), then the size will be calculated by the spacerequired 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that allows the user is to determine aspecific size for a label. The default value (-1) specifiesthat the size be determined by the length of the text for thelabel.
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 SIMATICcontrol) 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
A-52SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.15 ConnectName Method
Applies to: SIMATIC Data
This method establishes connections for the object that is specified by the name ofthe object on the form (such as S7Number1).
Note
A programmer who uses Visual Basic (or a similar programming language) woulduse the ConnectName method, while a programmer who uses Visual C (or asimilar 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 SIMATICcontrol) 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 anobject that should be connected. If this parameter is set toan empty String, the control generates the ValueChangedevent if a connected variable changes.
ConnectionTable (optional) Specifies a connection table. If this parameter isomitted, the control reads the ConnectionTable property ofthe ConnectedObject.
The connection table is declared as an array. Eachelement in the array has the following parts:
� Name of the element (such as “Value”)
� Memory location (such as MW100)
� Update rate or time-out value (in ms)
� Deadband value
For more information about the connection table, seeSection A.3.8.
Note
If the ConnectedObject and ConnectionTable parameters are both omitted, anerror is reported.
SIMATIC Computing
A-53SIMATIC Computing6GK1971–0BA00–0AA1
A.4.16 ConnectObject Method
Applies to: SIMATIC Data
This method establishes connections for a specified object which was declared inthe program.
Note
A programmer who uses Visual Basic (or a similar programming language) woulduse the ConnectName method, while a programmer who uses Visual C (or asimilar 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 SIMATICcontrol) 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 anobject that should be connected. If this parameter is set toan empty String, the control generates the ValueChangedevent if a connected variable changes.
ConnectionTable (optional) Specifies a connection table. If this parameter isomitted, the control reads the ConnectionTable property ofthe ConnectedObject.
The connection table is declared as an array. Eachelement in the array has the following parts:
� Name of the element (such as “Value”)
� Memory location (such as MW100)
� Update rate or time-out value
� Deadband value
Note
If the ConnectedObject and ConnectionTable parameters are both omitted, anerror is reported.
SIMATIC Computing
A-54SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.17 ControlEngine Property
Applies to: SIMATIC Data, SIMATIC Panel, S7DiagBF
This property stores the pathname or identification of the control engine connectedto the control.
Syntax:
object.ControlEngine [= value]
The ControlEngine property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A String that specifies the pathname or identification of thecontrol engine to be accessed by object.
SIMATIC Computing
A-55SIMATIC Computing6GK1971–0BA00–0AA1
A.4.18 ConvertedValue Property
Applies to: SIMATIC Number
This read-only property holds the value from the control engine (after data typingand range transformation have been performed). Use the following descriptions tounderstand the differences between the Value, ConvertedValue and Textproperties:
� The Value property is a Variant. It must be connected, by way of the SIMATICData Control, to a value in the control engine. It can hold values of differentdata types.
� The ConvertedValue property is also a Variant and contains the value from theValue property, but it is already scaled and converted to the specified data type(DataType property).
� 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 andConvertedValue is broken and changes to the Text or ConvertedValue property willnot 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 SIMATICcontrol) 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 usinga 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 typespecified in the “Assigned Variable” field of the SIMATIC Data Control.
SIMATIC Computing
A-56SIMATIC Computing
6GK1971–0BA00–0AA1
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 SIMATICcontrol) 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)
DoubleInteger
5 4 bytes Signed four-byte integer value
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 thedata being displayed in the SIMATIC control and the value of the data from thecontrol engine is larger than can be displayed by the data type, the value isdisplayed with ‘‘...’’ preceding it. For example, you can assign a double-wordvariable, 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 exceeds255 (the maximum value for a byte), “...” precedes the value. Before the value canbe changed from the SIMATIC Number Control, the ‘‘...’’ preceding the value mustbe deleted.
SIMATIC Computing
A-57SIMATIC Computing6GK1971–0BA00–0AA1
A.4.20 DefaultDeadband Property
Applies to: SIMATIC Data
This property allows you to specify the dead band used by the SIMATIC DataControl, 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), thecontrol 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 SIMATICcontrol) 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 Datacontrol, 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, theminimum default update rate is 100 ms.
Syntax:
object.DefaultUpdateRate [= value]
The DefaultUpdateRate property has these parts:
SIMATIC Computing
A-58SIMATIC Computing
6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 reportedimmediately.
> 0 Changes of the connected variable are reported after thistimeout.
A.4.22 Direction Property
Applies to: SIMATIC Slider
The Direction property sets the orientation (horizontal or vertical) of the SIMATICcontrol.
Syntax:
object.Direction [= value]
The Direction property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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-59SIMATIC Computing6GK1971–0BA00–0AA1
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 SIMATICcontrol) 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 propertyand fires events. If this property is False, then the control is disabled and does notreact on changes in the Value property and does not fire any event (except theerror event).
Syntax:
object.Enabled [= value]
The Enabled property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object canrespond 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
A-60SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.25 Factor Property
Applies to: SIMATIC Number
The Factor and Offset properties specify the scaling factor and the offset usedwhen the scale-by-formula option has been enabled.
Note
The ScaleMode property must be set to “ByFormula” (1) for the Factor and Offsetproperties to have any effect.
You can use a formula to scale the value. In the following formula, “PLC Value” issimilar to the contents of the Value property if the control is connected to thecontrol engine; “Scale” is the value of the Factor property; “Offset” is the value ofthe 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A floating-point value that defines the factor for the scalingformula.
Note
The default value of the factor is 1.0, and the default value of the offset is 0.0.
SIMATIC Computing
A-61SIMATIC Computing6GK1971–0BA00–0AA1
A.4.26 FalseCaption Property
Applies to: SIMATIC Button
This property determines the text that is displayed in the control when the Valueproperty 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 SIMATICcontrol) 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the background orforeground colors of an object.
The settings for value are:
Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows SystemColors
Colors specified by system color constants (depending onthe container); for example, colors listed in the VisualBasic (VB) object library in the Object Browser
SIMATIC Computing
A-62SIMATIC Computing
6GK1971–0BA00–0AA1
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 SIMATICcontrol) 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 textand graphics in an object.
Syntax:
object.ForeColor [= value]
The ForeColor property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the foreground colorsof object.
The settings for value are:
Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows SystemColors
Colors specified by system color constants (depending onthe container); for example, colors listed in the VisualBasic (VB) object library in the Object Browser
SIMATIC Computing
A-63SIMATIC Computing6GK1971–0BA00–0AA1
A.4.30 LargeChange Property
Applies to: SIMATIC Slider
The LargeChange property determines how far the slider indicator moves when thecontrol has focus and you press the Page Up or Page Down key. The Valueproperty is increased by LargeChange if you press the Page Up key or click to toright/top of the indicator. It is decreased by LargeChange if you press the PageDown 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 SIMATICcontrol) 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 thecontrol. When the layout type is Horizontal (0), caption 1 is on the left of the displayarea, and caption 2 on the right side of the display area. When the layout typeVertical (1), caption 1 is located above the display area, and caption 2 is below thedisplay area.
Syntax: object.LayoutType [= value]
The LayoutType property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 thedisplay area of the control
Vertical (1) Arranges the labels above and below the display area ofthe control
SIMATIC Computing
A-64SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.32 LimitCheck Property
Applies to: SIMATIC Number
This property determines whether to check that a value entered by the control iswithin specified limits and to define the range of values that determine the limits. Avalue 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 thesmallest number allowed, and the upper limit equals the largest number allowed). Ifan invalid value (a value which is outside of the range) is entered, the control doesnot write that value to the Value property.
If the limit-check fails, the Error event and the LimitCheckFailed events will befired. 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 LowerLimitproperties to have any effect.
Syntax:
object.LimitCheck [= value]
The LimitCheck property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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-65SIMATIC Computing6GK1971–0BA00–0AA1
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 anyvalues, but the current value is nevertheless shown. By default the control is not inlocked 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether object can beedited.
The settings for value are:
Setting Description
True You can scroll and highlight the text in the control, but youcannot edit it. The program can still modify the text bychanging the Value property. Changes to the Valueproperty are reflected: the control displays the values inthe 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 theuser is lower than the LowerLimit value or higher than the UpperLimit value, it willnot be written to the control engine.
You can specify a range of valid values for any entry. (The lower limit equals thesmallest 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 begenerated. The Error event will be generated only if the ShowErrorBoxes propertyis enabled (selected).
SIMATIC Computing
A-66SIMATIC Computing
6GK1971–0BA00–0AA1
Note
The LimitCheck property must be set to “Lower” (1) or “Both” (3) before theLowerLimit property can have an effect.
The LimitCheck property must be set to “Upper” (2) or “Both” (3) before theUpperLimit 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A floating-point value that defines the lower or upper limitused at limit checking.
A.4.35 Max Property
Applies to: SIMATIC Slider
The Max property determines the position of the slider indicator of the SIMATICcontrol. When the Value property is greater than or equal to Max, the indicator is inits rightmost (or top) position.
Syntax:
object.Max [= value]
The Max property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the maximum numberdisplayed.
SIMATIC Computing
A-67SIMATIC Computing6GK1971–0BA00–0AA1
A.4.36 Min Property
Applies to: SIMATIC Slider
The Min property determines the position of the slider indicator of the SIMATICcontrol. When the Value property is less than or equal to Min, the indicator is in itsleftmost (or bottom) position.
Syntax:
object.Min [= value]
The Min property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the minimum numberdisplayed.
A.4.37 MultipleEngines Property
Applies to: SIMATIC Data
This property specifies whether the control connects to a specific control engine orconnects 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether objectconnects to one or to several control engines.
The settings for value are:
Setting Description
True object connects to more than one control enginesimultaneously.
False (default) object connects only to the control enginespecified in the ControlEngine property.
SIMATIC Computing
A-68SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.38 Offset Property
Applies to: SIMATIC Number
The Factor and Offset properties specify the scaling factor and the offset usedwhen the scale-by-formula option has been enabled.
Note
The ScaleMode property must be set to “ByFormula” (1) for the Factor and Offsetproperties to have any effect.
You can use a formula to scale the value. In the following formula, “PLC Value” issimilar to the contents of the Value property if the control is connected to thecontrol engine; “Scale” is the value of the Factor property; “Offset” is the value ofthe 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A floating-point value that defines the factor or the offsetfor 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 acontrol engine over a network, such as a local area network (LAN).
Syntax:
object.PCName [= value]
The PCName property has these parts:
SIMATIC Computing
A-69SIMATIC Computing6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A String that specifies the pathname or identification of theremote 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 withprecision). In that case you can change the precision (number of digits behind thedecimal point) of the number. The number will be rounded at the specifiedprecision.
Note
The DataType property must be set to “Real” (6) before this property can have aneffect.
Syntax:
object.Precision [= value]
The Precision property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 aconnected control, referenced by the name of the object in the form (such asS7Number1), has changed. The SIMATIC Data Control reads the value from theproperty and writes it to the data source.
SIMATIC Computing
A-70SIMATIC Computing
6GK1971–0BA00–0AA1
Note
A programmer who uses Visual Basic (or a similar programming language) woulduse the PropertyChangedName method, while a programmer who uses Visual C(or a similar programming language) would use the PropertyChangedObjectmethod.
Syntax:
result = object.PropertyChangedName ConnectedObject, Property
The PropertyChangedName method has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 theconnected control whose property has changed.
Property A String value with the name of the property that haschanged.
A.4.42 PropertyChangedObject Method
Applies to: SIMATIC Data
This method notifies the SIMATIC Data Control that the value of a property of aconnected 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 thedata source.
SIMATIC Computing
A-71SIMATIC Computing6GK1971–0BA00–0AA1
Note
A programmer who uses Visual Basic (or a similar programming language) woulduse the PropertyChangedName method, while a programmer who uses Visual C(or a similar programming language) would use the PropertyChangedObjectmethod.
Syntax:
result = object.PropertyChangedObject ConnectedObject, Property
The PropertyChangedObject method has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 theconnected control whose property has changed.
Property A String value with the name of the property that haschanged.
A.4.43 Radix Property
Applies to: SIMATIC Number
This property defines the radix (binary, octal, decimal, or hexadecimal) for thenumber to be displayed. Any value entered must also be in the radix defined bythis property.
Syntax:
object.Radix [= value]
The Radix property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the radix used fordisplaying the value.
The settings for value are:
SIMATIC Computing
A-72SIMATIC Computing
6GK1971–0BA00–0AA1
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 tof, and A to F)
A.4.44 RangeRawMax, RangeRawMin, RangeScaledMax, andRangeScaledMin Properties
Applies to: SIMATIC Number
These properties define the ranges for scaling a value by a “range transformation”:
� RangeRawMax specifies the upper value of the source range.
� RangeRawMin specifies the lower value of the source range.
� RangeScaledMax specifies the upper value of the destination range.
� RangeScaledMin specifies the lower value of the destination range.
Note
The ScaleMode property must be set to “ByRange” (2) before these properties canhave an effect.
When you use a range transformation to scale the value, you specify a sourcerange (for the values in the control engine) and a destination range (for the valuesthat are displayed by the control). The values of one range will be transformed tothe other range. See Figure A-25. The source and destination ranges define a ratiofor the transformation; they do not define upper or lower limits. A value can belarger or smaller than the range; the transformation will use the two ranges toextrapolate the other value.
SIMATIC Computing
A-73SIMATIC Computing6GK1971–0BA00–0AA1
PLC value (in control engine)
RangeRawMax
RangeRawMin RangeScaledMin
RangeScaledMax
Value displayed by S7 control
Transformation ratio
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 propertieshave these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A floating-point value that defines the range boundaries forthe range mode scaling.
Note
The default value of the RangeRawMax is 255.0; the default value of theRangeRawMin is 0.0; the default value of the RangeScaledMax is 100.0; and thedefault value of the RangeScaledMin is 0.0.
SIMATIC Computing
A-74SIMATIC Computing
6GK1971–0BA00–0AA1
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 SIMATICcontrol) that evaluates to an object in the Applies To list.
VarNames A Variant that specifies the array of variables (memorylocations) to be read from the control engine.
VarValues A Variant that contains an array of the correspondingvalues 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
VariableName A String expression that specifies the variable (memorylocation) in the control engine to be read.
Value A Variant value containing the content of the specifiedvariable in the control engine.
State A Long value that provides the quality code for thevariable.
SIMATIC Computing
A-75SIMATIC Computing6GK1971–0BA00–0AA1
Part Description
TimeOut A Long value that determines the length of time (in ms)before generating a time-out error. (Not applicable for thisrelease). For the current release, this value should alwaysbe 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 valuescan also be specified at the Scale Property Tab. There are two choices for scalingmode:
� By formula: PLC Value * Factor + Offset = Displayed value
where: PLC Value is similar to the contents of the Value property if the control isconnected 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 ofthe Text property.
� By range transformation: you specify a source range (of PLC values) and adestination range (of displayed values), and the values of the one range aretransformed to the other range. See Figure A-25 and the Range properties.
SIMATIC Computing
A-76SIMATIC Computing
6GK1971–0BA00–0AA1
Note
The Scale Mode property determines whether the RangeRawMax, RangeRawMin,RangeScaledMax, RangeScaledMin, Factor, and Offset properties have anyeffect.
Syntax:
object.ScaleMode [= value]
The ScaleMode property has these parts:
Part Description
object An object expression (identifier for the specific SIMATICcontrol) 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 scalethe 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 thisproperty is enabled (True), any new value entered with the control must beconfirmed before it is written to the SIMATIC Data Control. Typing a new value inthe display field of the control enables the buttons. Clicking on the Enter buttonwrites the new value to the control engine; clicking on the Cancel button replacesthe new value with the value from the control engine. The default setting for thisoption is False (disabled).
Syntax:
object.ShowButtons [= value]
The ShowButtons property has these parts:
SIMATIC Computing
A-77SIMATIC Computing6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether or not todisplay buttons.
The settings for value are:
Setting Description
True Two buttons will be shown on the right side of the displayfield. When you enter a new value in the display field, thebuttons become active. To confirm the change and writethis value to the Value property (and to the control engine),click on the Enter button; to cancel the value, click on theCancel 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 auser-generated error. Every time an error occurs, an Error event will be generated.If the ShowErrorBoxes property is enabled (selected), a default error message boxwill 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 displaymessages in other languages, you must disable (deselect) the ShowErrorBoxesoption and write program code to react on the error event.
Syntax:
object.ShowErrorBoxes [= value]
The ShowErrorBoxes property has these parts:
SIMATIC Computing
A-78SIMATIC Computing
6GK1971–0BA00–0AA1
Part Description
object An object expression (identifier for the specific SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether the controldisplays 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 hasfocus and you press the up/down or right/left arrow keys. The Value property isincreased by SmallChange if you press the right (or up) arrow key. It is decreasedby 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the amount of change
SIMATIC Computing
A-79SIMATIC Computing6GK1971–0BA00–0AA1
A.4.51 TagServerName Property
Applies to: SIMATIC Number
This property determines the name of the SIMATIC Data Control which shall beused for a connection to the control engine. The TagServerName property appliesto the SIMATIC Number Control, but it is created automatically by the SIMATICData 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A String value that specifies the name of an availableSIMATIC Data Control.
A.4.52 TagSource Property
Applies to: SIMATIC Data
This property identifies the source of symbolic information to be used whenassigning 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A String that identifies the pathname to the source (suchas a tag file) of symbolic information to be used whenconfiguring the control for variables and control engines.
SIMATIC Computing
A-80SIMATIC Computing
6GK1971–0BA00–0AA1
A.4.53 Ticks Property
Applies to: SIMATIC Slider
This property sets the number of ticks, or unit markers, of the control. Forexample, 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A constant that determines the number of unit markers tobe displayed.
A.4.54 TrueCaption Property
Applies to: SIMATIC Button
This property determines the text that is displayed in the control when the Valueproperty 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A String value that specifies the text of the label.
SIMATIC Computing
A-81SIMATIC Computing6GK1971–0BA00–0AA1
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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant that determines the background orforeground colors of object.
The settings for value are:
Setting Description
Standard Colors Colors specified by using the RGB Color palette
Windows SystemColors
Colors specified by system color constants (depending onthe container); for example, colors listed in the VisualBasic (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 theuser 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 thelargest 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 begenerated. The Error event will be generated only if the ShowErrorBoxes propertyis enabled (selected).
SIMATIC Computing
A-82SIMATIC Computing
6GK1971–0BA00–0AA1
Note
The LimitCheck property must be set to “Lower” (1) or “Both” (3) before theLowerLimit property can have an effect.
The LimitCheck property must be set to “Upper” (2) or “Both” (3) before theUpperLimit 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A floating-point value that defines the lower or upper limitused at limit checking.
Note
The default value for the LowerLimit is 0.0, and the default value for theUpperLimit is 100.0.
SIMATIC Computing
A-83SIMATIC Computing6GK1971–0BA00–0AA1
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 thecontrol engine. It is bindable. Use the following descriptions to understand thedifferences between the Value, ConvertedValue, and Text properties:
� The Value property is a Variant. It must be connected, by way of the SIMATICData Control, to a value in the control engine. It can hold values of differentdata types.
� The ConvertedValue property is also a Variant and contains the value from theValue property, but it is already scaled and converted to the specified data type(DataType property).
� 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 andConvertedValue is broken. The result is that changes to the Text orConvertedValue 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Variant that specifies the value of the control.
SIMATIC Computing
A-84SIMATIC Computing
6GK1971–0BA00–0AA1
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 SIMATICcontrol) 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 newvalue. If the write mode is set to Automatic (0), the value (if valid) is writtenautomatically into the Value property (and to the control engine). If the write modeis Manual (1), the value is not written to the value property unless your programcode 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A value or constant expression that specifies whether thecontrol automatically passes entered values to the Valueproperty.
The settings for value are:
Setting Description
Automatic (0) (default) Automatically passes the new (input) value to theValue property
Manual (1) Does not write the new (input) value unless the controlprocesses a Write method
SIMATIC Computing
A-85SIMATIC Computing6GK1971–0BA00–0AA1
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 SIMATICcontrol) that evaluates to an object in the Applies To list.
VarNames A Variant that specifies the array of variables (memorylocations) in the control engine.
VarValues A Variant that contains an array of the correspondingvalues 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
VariableName A String expression that specifies the variable (memorylocation) in the control engine.
Value A Variant value containing the content to be written to thespecified variable in the control engine.
SIMATIC Computing
A-86SIMATIC Computing
6GK1971–0BA00–0AA1
Part Description
TimeOut A Long value that determines the length of time (in ms)before generating a time-out error. (Not applicable for thisrelease). For the current release, this value should alwaysbe 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 paddedwith 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 SIMATICcontrol) that evaluates to an object in the Applies To list.
value A Boolean expression that specifies whether or not thedisplayed number is filled with leading zeros.
The settings for value are:
Part Description
True Fills the number with leading zeros to the size specified bythe DataType property.
False (default) Does not fill the number with leading zeros.
SIMATIC Computing
A-87SIMATIC Computing6GK1971–0BA00–0AA1
A.5 Other SIMATIC Controls
Chapter Overview
SIMATIC Computing provides a collection of custom SIMATIC controls foraccessing data in the control engine:
� SIMATIC Button control reads and writes Boolean (single bit) values.
� SIMATIC Number control automatically converts the S7data types, allowing youto accurately read and write all of the S7 data types,
� SIMATIC Slider control provides a sliding indicator (“slider”) for entering ordisplaying dynamic data.
A.5.1 SIMATIC Button Control
The Button control allows you to associate a button display with data bit from yourprocess and to change them. You associate the button with your process byassigning a variable (namely, the desired bit location) to it. You can then toggle thebutton display to change the state of the bit; the button color also changesautomatically as the state of the bit changes within the process.
Figure A-26 shows the Button control. The Button control has two states ofanimation: 0 (off) or 1 (on). Clicking on the Button control changes the data in thecontrol engine.
ControlOFF
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, youassign a (single-bit) variable to the Value property of the Button control. DieVariable kann mit Hilfe des Dialogfeldes “Properties” des Button Controlsverbunden werden. Instead, use the Properties dialog box of the Data control andselect 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 theProperties dialog box of the Button control itself. Click the mouse button and selectthe Properties command for the control.
SIMATIC Computing
A-88SIMATIC Computing
6GK1971–0BA00–0AA1
!Warning
After you assign a variable to the Value property of a SIMATIC or a third-partyActiveX control, the control is able to access process data. When you change thevalue that is displayed in the control, you are changing the value in the actualprocess.
Altering process data can cause unpredictable process operation, andunpredictable process operation could result in death or serious injury topersonnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could causeprocess equipment to operate erratically. Always install a physical emergency stopcircuit for your machine or process.
Remember that the button control can be assigned only to an individual bit in thecontrol engine. The only valid data type for an Button control is BOOL.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]M0.0
Browse...
100
0
Update rate (ms):
Dead band:
Automatic write mode:
Controls:
Add... Filter...
S7Data1
S7vbBttn1
OK Cancel Apply Help
Engine
Apply filter to propertiesDelete
EnabledFalseCaptionFalseColorFontToolTipTextTrueCaptionTrueColorValue
Name
Figure A-27 Assigning Variables for the Button Control
SIMATIC Computing
A-89SIMATIC Computing6GK1971–0BA00–0AA1
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 thetwo labels for the Button control:
� “TrueCaption”: Enter the text to be displayed in the control when the bit is “true”(equal to 1 or “on”).
� “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 youselect this option, the control can actively access the control engine. Deselectingthis option deactivates the control: it does not access the memory location of thecontrol engine and does not react on any mouse clicks. It also does not generateevents while disabled. The default setting for this option is enabled (selected).
Siemens Button Control Properties
OK Cancel
General
Apply Help
Font Color
ONTrueCaption:
Enabled:
OFFFalseCaption:
Name
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 thetypeface and size for the labels of the Button control:
� “Font”: select the typeface for the label from a list of standard typefaces.
� “Size”: select the point size for the label or enter a specific point size for thelabel.
� “Effects”: select other typographical options (boldface, italic, underline, orstrike-through) for the label.
The “Sample Text” field displays the selection of the Font property.
SIMATIC Computing
A-90SIMATIC Computing
6GK1971–0BA00–0AA1
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 thecolors 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 displayedfor that state from the color palette. You can choose from a palette of standardcolors, or you can create custom colors.
Siemens Button Control Properties
OK Cancel
General
Apply Help
Font Color
Bold
MS Sans Serif
Effects
Italic
Underline
Strikeout
Font:
MS Sans Serif
Size:
8.25
Sample Text:
Font
Properties:
Figure A-29 Button Control Properties (Font Tab)
Siemens Button Control Properties
OK Cancel
General
Apply Help
Font Color
Color Set:
Standard Colors
Color Palette:
FalseColor
Edit Custom Color...
TrueColor
Gray
Green
Magenta
Red
Properties:
Figure A-30 Button Control Properties (Color Tab)
SIMATIC Computing
A-91SIMATIC Computing6GK1971–0BA00–0AA1
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 Buttoncontrol. Das Data Control reagiert auf die in Tabelle A-18 aufgelistetenEreignisse.
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 Valueproperty and fires events
FalseCaption property Determines the text that is displayed in the control when theValue property is False (equal to 0, or “Off”)
FalseColor property Determines the color of the control when the Value property isFalse (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 theValue property is True (equal to 1, or “On”)
TrueColor property Determines the color of the control when the Value property isTrue (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 themouse cursor is over the control
SIMATIC Computing
A-92SIMATIC Computing
6GK1971–0BA00–0AA1
A.5.3 SIMATIC Number Control
The Number control allows you to display process data in a numeric format and tomodify that data. You associate the number display with your process by assigninga variable (the process value) to it.
You can type a new value into the display; the display also updates automaticallywhen the variable associated with it changes within the process. Besteht eineVerknüpfung des Number Controls mit einer Prozeßvariablen, zeigt das Controlden Wert der Variablen an und die Prozeßvariable kann durch Eingabe einesWertes gesetzt werden.
The Number control provides access to the memory locations of the controlengine. Entering a new value in the control changes the data in the control engine.Figure A-31 shows the Number control.
ControlDisplay area
Enter button
Cancel button
Figure A-31 SIMATIC Number Control
Note
In order to connect the Number control to actual process data, you must establisha 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, youassign a variable to the Value property of the Number control. The variable cannotbe assigned within the Properties dialog box of the Number control. Instead, usethe Properties dialog box of the Data control and select the Number control fromthe expandable list of controls under the Connections tab. A-32
SIMATIC Computing
A-93SIMATIC Computing6GK1971–0BA00–0AA1
!Warning
After you assign a variable to the Value property of a SIMATIC or a third-partyActiveX control, the control is able to access process data. When you change thevalue that is displayed in the control, you are changing the value in the actualprocess.
Altering process data can cause unpredictable process operation, andunpredictable process operation could result in death or serious injury topersonnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could causeprocess equipment to operate erratically. Always install a physical emergency stopcircuit for your machine or process.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]MD100
Browse...
100
0
Update rate (ms):
Dead band:
Automatic write mode:
Controls:
Add... Filter...
OK Cancel Apply Help
Engine
Apply filter to propertiesDelete
S7Data1
Alignment
S7Number1
AppearanceBackColorBorderStyleCaption1
Value
Name
Figure A-32 Assigning Variables for the Number Control
To set properties for anything other than the Value property, you can use theproperties dialog box for the Number control itself. Use the Edit menu or right clickthe mouse button and select the Properties command for the control.
SIMATIC Computing
A-94SIMATIC Computing
6GK1971–0BA00–0AA1
Defining How the Data is Displayed (Using the General Tab)
The General tab of the Properties dialog box (see Figure A-33) allows you todefine the presentation of the data accessed by the Number control.
Siemens Number Control Properties
OK Cancel
General Style
Apply Help
Label
0Precision:
4 – Double WordData type:
Radix: Show Buttons
Zero Pad
ColorScaling Font
2 – Decimal
Show Error Boxes
Limit check: 0 – None
Upper limit: 100
Lower limit: 0
Alignment:
Figure A-33 Number Control Properties (General Tab)
The fields on the General tab allow you to define the following propertiesconcerning how the data will be displayed:
� “Data type” defines the size of the presentation for the data. Table A-19describes the sizes of the data types used by the Number control.
If you entered a specific data type for the assigned variable in the SIMATICData control, you must enter the same data type here.
� “Radix” configures the data to be accessed (display or entered) as a binary,octal, decimal or hexadecimal value.
� “Precision” defines the decimal place for the real (floating–point) number. (Thedefault value is three digits) This field is enabled only for the Real data type.
SIMATIC Computing
A-95SIMATIC Computing6GK1971–0BA00–0AA1
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)
DoubleInteger
5 4 bytes Signed four–byte integer value
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 theNumber control: aligned to the left side of the field, centered in the field, or alignedto the right side of the field.
You can also enable the Number control to check for upper and lower limits on thevalue that you enter. You can select limit checking for a maximum value, aminimum value, both maximum and minimum value, or for no limit checking.When you enable the Limit Checking option, the Number control does not write anout-of-range value (larger than the upper limit or smaller than the lower limit) to thecontrol engine. If the Number control has been configured to show the errormessages, the out-of-range value generates an error message.
Using the check boxes on the General tab, you can define other operations for thecontrol:
� “Zero Pad”: When you enable this option, the Number control fills out the datatype by inserting zeroes (0) to the left of the value. The default setting for thisoption is disabled (not selected).
� “Show Buttons”: When you enable this option, the Number control displays theEnter and Cancel buttons. (See Figure A-33.) When this option is checked, youmust confirm any new value in order to enter it. Typing a new value in thedisplay field of the control enables the buttons. Clicking on the Enter buttonwrites the new value to the control engine; clicking on the Cancel buttonreplaces the new value with the value from the control engine. The defaultsetting for this option is disabled (not selected).
You can also use the Return (or Enter) key on the keyboard instead of the Enterbutton, and the Escape (Esc) key instead of the Cancel button.
� “Show Error Boxes”: when you enable this option, the Number control displaysthe messages (“error boxes”) in response to pre-defined error conditions (forexample, for out-of-range or invalid numbers). The default setting for this optionis enabled (selected).
SIMATIC Computing
A-96SIMATIC Computing
6GK1971–0BA00–0AA1
Defining the Appearance of the Number Control
The Style tab of the Properties dialog box (see Figure A-34) provides you with thefollowing options for the appearance of the control:
� “Appearance”: If you set this property to 3D, the control will have athree-dimensional appearance. (You must also set the border style to FixedSingle to enable the three-dimensional appearance.) The other option is Flat,which displays a two-dimensional, rectangular border around the control.
� “Border Style”: If you set this property to Fixed Single, the control is displayedwith a rectangular border; if you set the property to None, no border will bedisplayed.
In addition to fields that determine the appearance of the control, the Style tab alsoincludes a “Write Mode” field that controls whether changes to the value are writtenautomatically to the control engine, or are written only when requested by theprogram code (using a Write command) that you associated with the Numbercontrol.
Siemens Number Control Properties
OK Cancel
General Style
Apply Help
Appearance:
Border Style:
1 – 3D
ColorScaling FontLabel
1 – Fixed Single
Write Mode: 0 – Automatic
Locked (read-only)
Enabled
Figure A-34 Number Control Properties (Style Tab)
Using the check boxes on the Style tab, you can define other operations for theNumber control:
� “Enabled”: When you select this option, the control can actively access thecontrol engine. Disabling this option deactivates the Number control: it does notaccess the memory location of the control engine and does not react on anymouse clicks. It also does not generate events while disabled. The defaultsetting for this option is enabled (selected).
� “Locked”: When you enable this option, the control becomes a : read-onlydisplay. you can view the value in the memory location of the control engine, butyou cannot change the values from this control. The default setting for thisoption is disabled (not selected).
SIMATIC Computing
A-97SIMATIC Computing6GK1971–0BA00–0AA1
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 alabel (or caption) for the control. You can define two different captions for thecontrol (“Caption 1” and “Caption 2”).
As shown in Figure A-36, the labels can be oriented either horizontally or verticallyin relationship to the Number control:
� If you select Horizontal, Caption 1 is on the left and Caption 2 is on the rightside of the control.
� 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 iscentered, 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 thebackground color of the label.
Siemens Number Control Properties
OK Cancel
General Style
Apply Help
Label
Layout Type
Caption2:Caption1:
Horizontal Vertical
ColorScaling Font
Control
–1
Size1:
–1
Size2:
Alignment1: Alignment2:
Figure A-35 Number control Properties (Label Tab)
You can also specify a specific width (for horizontal labels) or height (for verticallabels). 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 controlautomatically adjusts the size of the label to the amount text entered or to the fontsize for the caption.
Entering a specific size for the labels allows you to control the appearance of theNumber control. For example, you may want to align the display area for a seriesof Number controls, but the labels vary in length for each control. Choosing aconstant 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 ascreen-independent unit that ensures that the placement and proportion of screen
SIMATIC Computing
A-98SIMATIC Computing
6GK1971–0BA00–0AA1
elements are the same on all display systems. A twip is approximately 1/20 of aprinter’s point: 1440 twips=1 Inch. or 56.7 twips=1 mm when printed.)
Display area
Display area
Caption1 Caption 2Horizontal orientation
Vertical orientation
Caption1
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 definea scale for displaying the value in the memory location. This scaling factor is usedboth in reading a value from and writing a value to the control engine. You canselect one of three scaling options:
� No scaling of the data (default)
� Scaling by formula
� Scaling by ranges
If you choose to scale by formula, you enter the following information:
� Scale represents a percentage of change (scaling factor) from the value in thecontrol engine to the value in the Number control.
� Offset represents a fixed value to be added to the scaled result before beingdisplayed.
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 factorDisplay = the value displayed in the Number control
When the Number control writes data to the control engine, the inverse of theformula is used to scale the value.
SIMATIC Computing
A-99SIMATIC Computing6GK1971–0BA00–0AA1
Siemens Number Control Properties
OK Cancel
General Style
Apply Help
Label
Scale by formula
1
PLC value
x
Scale:
+
Offset:
=
Display
0
Scale by range transformation
Upper value:
Lower value:
ColorScaling Font
0 – No ScalingScale mode:
255
0
PLC value
Upper value:
Lower value:
100
0
Display
Figure A-37 Number Control Properties (Scaling Tab)
If you choose to scale by range transformation, you specifiy the upper and lowervalues for a source range (for the value in the control engine) and for a destinationrange (for the value displayed in the Number control or Display). The Numbercontrol then transforms the value from one range into the equivalent value for theother range.
These ranges define only the relationship between the data in the control engineand the data in the Number Control: if the value is above or below the rangesentered for the information, the transformation uses the formula to extrapolate thescaled 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 Numbercontrol. 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. TableA-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
A-100SIMATIC Computing
6GK1971–0BA00–0AA1
Table A-20 Properties and Methods of the Number Control, continued
Property or Method Description
Caption1 and Caption2properties
Specifies the displayed text of the first or second label
Caption1Alignment andCaption2Alignmentproperties
Specifies the alignment of the first or second label
Caption1BackColor andCaption2BackColorproperties
Returns or sets the background color for the first or secondlabel
CaptionFont property Returns a Font object for the labels
Caption1ForeColor andCaption2ForeColorproperties
Returns or sets the foreground color for the first or second label
Caption1Size andCaption2Size properties
Selects the size of the font for the text of the first or secondlabel
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 Valueproperty and fires events
Factor property Specifies the scaling factor used when the scale-by-formulaoption 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 andgraphics
LayoutType property Specifies how the labels are arranged around the display area
LimitCheck property Determines whether to check that a value is within specifiedlimits, 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 optionhas 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,RangeRawMin,RangeScaledMax, andRangeScaledMinproperties
Defines the ranges for scaling a value by a “rangetransformation” by specifying the upper and lower limits for thesource and the upper and lower limits for the destination
ScaleMode property Specifies the scaling mode to be used for scaling the values
ShowButtons property Displays the Enter and Cancel buttons for confirming theentering of new values
ShowErrorBoxesproperty
Specifies whether to display the default error boxes when thereis a user-generated error
SIMATIC Computing
A-101SIMATIC Computing6GK1971–0BA00–0AA1
Table A-20 Properties and Methods of the Number Control, continued
Property or Method Description
TagServerNameproperty
Determines the name of the Data control which shall be usedfor 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 Valueproperty
WriteMode property Selects whether to write new values automatically or manually
ZeroPad Determines whether the displayed number is padded withzeroes (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 themouse cursor is over the control
DblClick Occurs when a mouse button is double-clicked while the cursor isover 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 controlhas 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 isover the control
MouseMove Occurs when the mouse cursor moves over the control
MouseUp Occurs when a mouse button is released while the mouse cursor isover the control
SIMATIC Computing
A-102SIMATIC Computing
6GK1971–0BA00–0AA1
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 rangescaling. 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 notequal 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 isaccessing 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 inthe control. Normally, it means that the entered text contains characters thatare 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 Radixproperty.
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. Thecontrol is unable to access the other necessary parts that are needed for thesofware 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 neededfor 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 theupper limit.
This error can only appear if you are using the Number control with limitchecking (checking for upper and lower limit). In this case it is possible thatyou’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 limithas to be less than the upper limit.
SIMATIC Computing
A-103SIMATIC Computing6GK1971–0BA00–0AA1
A.5.5 SIMATIC Slider Control
The Slider control allows you to display process data in a visual format (as slidingindicator) and to modify that data. You associate the slider with your process byassigning a variable (the process value) to it. You can then adjust the sliderindicator in order to modify the process value; the slider also changes its indicatorposition automatically as the variable associated with it changes within theprocess.
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.
Control0 100
Figure A-38 SIMATIC Slider Control
Note
In order to connect the Slider control to actual process data, you must establish aconnection 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-partyActiveX control, the control is able to access process data. When you change thevalue that is displayed in the control, you are changing the value in the actualprocess.
Altering process data can cause unpredictable process operation, andunpredictable process operation could result in death or serious injury topersonnel, and/or damage to equipment.
Exercise caution to ensure that you do not access any data that could causeprocess equipment to operate erratically. Always install a physical emergency stopcircuit for your machine or process.
To establish a connection between the Slider control and your process data, youassign a variable to the Value property of the control. The variable cannot beassigned within the Properties dialog box of the Slider control. Instead, use theProperties dialog box of the SIMATIC Data control and select the slider from theexpandable list of controls under the Connections tab. (See FigureA-39).
SIMATIC Computing
A-104SIMATIC Computing
6GK1971–0BA00–0AA1
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Assigned Variable:
S7:[DEMO]MD10
Browse...
100
0
Update rate (ms):
Dead band:
Automatic write mode:
Controls:
Add... Filter...
OK Cancel Apply Help
Engine
Apply filter to propertiesDelete
S7Data1
DirectionS7vbSlid1
LargeChangeMaxMinShowMinMaxTicksValue
Name
Figure A-39 Assigning Variables for the Slider Control
To set properties for anything other than the Value property, you can use theProperties dialog box of the Slider control. Use the Edit menu or right click themouse 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 todefine the presentation of the data accessed by the Slider control.
The Properties dialog box also allow you to dermine the amount that the valuedisplayed by the Slider control increases or decreases when you press an arrowkey (SmallChange) or press the Page Up and Page Down keys (LargeChange).
SIMATIC Computing
A-105SIMATIC Computing6GK1971–0BA00–0AA1
Siemens Slider Control Properties
General
Show Min and Max ValueDirection
Horizontal
Vertical Ticks:
Max:
LargeChange:
Min:
SmallChange:
OK Cancel Apply Help
Enabled
Figure A-40 Slider Control Properties (General Tab)
Figure A-41 shows the other elements that are defined by the Properties dialogbox. You can enter the minimum (Min) and maximum (Max) values for the Slidercontrol, and you can choose whether or not to display these values. You can alsodefine the number of interim units (ticks) between the minimum and maximumvalues.
0 100
Ticks
Minimum value
Maximum value
Figure A-41 Elements of the Slider Control
As shown in Figure A-42, the Slider control can be displayed in a vertical orhorizontal orientation. You choose the orientation by selecting either a horizontal orvertical direction.
0 100
0
100
VerticalHorizontal
Figure A-42 Orientation of the Slider Control
SIMATIC Computing
A-106SIMATIC Computing
6GK1971–0BA00–0AA1
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 Slidercontrol. 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 Valueproperty and fires events
LargeChange property Determines how far the slider indicator moves when the controlhas focus and you press the Page Up or Page Down key
Max property Determines the value of the rightmost (or top) position of theslider indicator
Min property Determines the value of the rightmost (or top) position of theslider indicator
SmallChange property Determines how far the slider indicator moves when the controlhas 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 themouse cursor is over the control
DblClick event Occurs when a mouse button is double-clicked while the cursor isover 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 controlhas 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 isover 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 isover the control
SIMATIC Computing
A-107SIMATIC Computing6GK1971–0BA00–0AA1
A.6 Guidelines for Custom Controls and Third-Party Containers
Chapter Overview
The SIMATIC Data control can be used not only with other SIMATIC ActiveXcontrols, but also controls of other providers or custom ActiveX controls. To workwith a custom ActiveX control, the Data control requires that the control provide aminimum of code to respond to changes in the assigned variable.
You can also use other containers, such as Visual Basic, with the SIMATICControls. In order to use the SIMATIC controls in another container, the containermust support the requests of ”extended controls”. If the container does not supportthese functions, you must supply program code to perform these functions.
A.6.1 Guidelines for Using Third-Party Containers with the DataControl
For the SIMATIC Data control to work within a third-party container, the containermust support the “property browsing” functions of the Data control. To do this, thecontainer must support the functions for “extended controls” (as defined byMicrosoft for containers). An extended control is a partial control that wraps aroundanother control to support container-specific properties, methods and events.(Refer to Microsoft’s on–line documentation for more information about containersand extended controls.)
To provide the extended control functions, the container must support the followingmethods:
� IOleClientSize::GetContainer
� IOleContainer::EnumObjects
� IOleControlSite::GetExtendedControl
The extended control of the container must also support a Name property.
Visual Basic unterstützt extended Controls. Containers from other vendors (suchas Borland’s Delphi version 3.0) do not support extended controls. The Siemenscustomer support center can help determine if your container supports theextended control functions.
If your container does not support the extended control functions, you must provideprogram code to perform these functions. Contact the Siemens customer supportcenter for sample code that performs the extended control functions.
SIMATIC Computing
A-108SIMATIC Computing
6GK1971–0BA00–0AA1
A.6.2 Guidelines for Creating a Custom ActiveX Control
In order to create a custom ActiveX control that can be used with SIMATIC DataControl, the custom control must provide a property to which data can be writtenFor example, your custom control might have a value property: when the Valueproperty changes, then the control reacts.
Reading Data from the Data Control
If the container supports extended controls, the Data control automatically finds thecustom control and its properties. You use the “Properties” dialog box of the Datacontrol to assign a variable in the control engine to the property of the customcontrol. Whenever the value of the variable in the control engine changes, the Datacontrol updates the value of the property for the custom control.
The custom control should include a subroutine for handling the data written fromthe 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 controlengine, 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 Datacontrol.
Table A-25 Reading and Writing a Changed Value of a Property
Visual Basic Code
Public Property Get Value() As LongValue = Object1.Value
End Property
Public Property Let Value(ByVal New_Value As Long)Object1.Value() = New_ValuePropertyChanged “Value”
End Property
Private Sub Value_Change()PropertyChanged “Value”
End Sub
SIMATIC Computing
A-109SIMATIC Computing6GK1971–0BA00–0AA1
A.6.3 Using a Custom Control with the Data Control
You can create a custom ActiveX control that communicates through the Datacontrol to access the control engine. To create this sample application, you needthe following items:
� Microsoft Visual Basic 5 or higher
� SIMATIC Data control from Computing
� Sample program
Creating a Custom ActiveX Control for Accessing the Control Engine
Use the following procedure to use a standard VB horizontal scrollbar (HScrollBarcontrol) to create a custom ActiveX control:
1. Open a Visual Basic project for creating an ActiveX control: Use the File ”NewProject 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 menucommand, 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 itonto the UserControl1 form.
4. Select the scrollbar control. In the Properties window, select the Max propertyfor this control (HScroll1) and enter the following value:
255
5. Display the Code window for UserControl1 by selecting the View”Code menucommand. In the Code window, enter the program listed in Table.
6. Close both the code window and the Object window. Visual Basic adds thisActiveX control (UserControl1) to the toolbox.
SIMATIC Computing
A-110SIMATIC Computing
6GK1971–0BA00–0AA1
Table A-26 Sample Program for an ActiveX Control Used with Computing
Visual Basic Code
Public Property Get Value() As IntegerValue = HScroll1.Value
End Property
Public Property Let Value (ByVal New_Value As Integer)HScroll1.Value = New_ValuePropertyChanged ”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 displaythe “Add Project” dialog box, then select the Standard EXE icon and click onthe “Open” button. Visual Basic opens a new project with an empty form in theObject window.
The Project directory area now lists two projects: Project1 containsUserControl1, 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-upmenu. 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 itsproperties 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 thedata and close the “Properties” dialog box.
SIMATIC Computing
A-111SIMATIC Computing6GK1971–0BA00–0AA1
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 createdreflects the changing value stored in the selected process variable.
Use the following procedure to configure the Data control for communicating withthe control engine and for running the sample program.
1. Wählen Sie das Register “Engine” zur Einrichtung der Control Engine. SeeFigure 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 dialogbox.
3. Switch Visual Basic from Design mode to Run mode to run the sampleprogram.
Siemens SIMATIC Data Control Properties
Connections EventsGeneral
Tag Source
Connect via Tag Source
OK Cancel Apply Help
Engine
Direct Connect
PC Name
Control Engine @SimaticNet
Browse
Enter@SimaticNet as the type ofcontrol engine
Name Select the option for a directconnection
Figure A-43 Connecting to the Control Engine (Scrollbar Control Example)