OPC Server
OPC Server
OPC Server
OPC_server.doc Copyright 2004 Woodhead Software & Electronics. All rights reserved. http://www.woodhead.com
22/02/2005
Woodhead
Document Edition: 1.1 Date: February 9, 2005 This document applies to the OPC Data Access Server product. Copyright, This document and its contents are the proprietary and confidential property of Woodhead Industries Inc. and/or its subsidiaries and may not be used or disclosed to others without the express prior written consent of Woodhead Industries Inc. and/or its subsidiaries. applicom, Direct-Link and SST is a trademark of Woodhead Software & Electronics. All other trade names are trademarks or registered trademarks of their respective companies. At Woodhead, we strive to ensure accuracy in our documentation. However, due to rapidly evolving products, software or hardware changes occasionally may not be reflected in our documents. If you notice any inaccuracies, please contact us.
Written and designed at Woodhead Software & Electronics, 43 rue Mazagran, 76320 Caudebec-ls-Elbeuf, France.
OPC_server.doc Copyright 2004 Woodhead Software & Electronics. All rights reserved. applicom , Direct-Link, SST of Woodhead Industries, Inc. Other product names are trademarks of their respective owners. http://www.woodhead.com
TM
Woodhead
OPC_server.doc Copyright 2004 Woodhead Software & Electronics. All rights reserved. applicom , Direct-Link, SST of Woodhead Industries, Inc. Other product names are trademarks of their respective owners. http://www.woodhead.com
TM
Woodhead
Change Record
CCB #
OPC_server.doc Copyright 2004 Woodhead Software & Electronics. All rights reserved. applicom , Direct-Link, SST of Woodhead Industries, Inc. Other product names are trademarks of their respective owners. http://www.woodhead.com
TM
Woodhead
OPC_server.doc Copyright 2004 Woodhead Software & Electronics. All rights reserved. http://www.woodhead.com
22/02/2005
Woodhead
OPC_server.doc Copyright 2004 Woodhead Software & Electronics. All rights reserved. applicom , Direct-Link, SST of Woodhead Industries, Inc. Other product names are trademarks of their respective owners. http://www.woodhead.com
TM
Woodhead
Table of contents
1 2
Advanced functions.....................................................................27
6.1 6.2 Management of groups (OPC Group) ......................................................27 Deadband.................................................................................................28
Diagnostic interface.....................................................................29
Table of contents
Woodhead
7.1 7.2 Spy view of items .....................................................................................31 Messages view.........................................................................................33
Annexes........................................................................................35
8.1 8.2 Developing an OPC client ........................................................................35 Use through DCOM..................................................................................39
Support .........................................................................................56
9.1 Technical Support ....................................................................................56
10
Index .............................................................................................57
ii
Table of contents
Woodhead
1 Preface
Preface Sections:
Table of contents
Woodhead
Purpose of this Guide
This guide contains technical and product-related information on the OPC server Data Access for Woodhead Profibus product. This OPC Data Access server is in compliance with specifications 2.05 and 3.0 of the OPC foundation and enables you to access from any OPC client application the data in your profibus field bus through the communication cards of the Woodhead Profibus product.
Conventions
This guide uses stylistic conventions, special terms, and special notation to help enhance your understanding.
Style
The following stylistic conventions are used throughout this guide: Bold Italics CAPS Code Font Underlining > delimiter 0x indicates field names, button names, tab names, and options or selections indicates keywords (indexed) or instances of new terms and/or specialized words that need emphasis indicates a specific key selection, such as ENTER, TAB, CTRL, ALT, DELETE indicates command line entries or text that youd type into a field indicates a hyperlink indicates how to navigate through a hierarchy of menu selections/options indicates a hexadecimal value
Terminology
The following special terms are used throughout this guide: OPC Topic Ole for Process Control represents a data source available through the OPC server.
Table of contents
Woodhead
Special Notation
The following special notations are used throughout this guide:
Warning
Warning messages alert the reader to situations where particular attention is required. Warnings are accompanied by the symbol shown, and precede the topic to which they refer.
Caution
Caution messages alert the reader to situations where damage may result. Cautions are accompanied by the symbol shown, and precede the topic to which they refer.
Note
A note provides additional information, emphasizes a point, or gives a tip for easier operation. Notes are accompanied by the symbol shown, and follow the text to which they refer.
Table of contents
Woodhead
2 General information
OPC: What is it? OPC (OLE for Process Control) is a communication standard based on OLE/COM technology which constitutes a special means of exchanging data between MS-Windows applications. The COM model is intended to ensure interoperability between software components developed independently by different publishers. This interoperability is independent of the development languages used. COM can be considered as a "software bus" playing a "Plug and Play" role between software modules. The OPC foundation, which was created on the initiative of the main operators of the automation industry, publishes and maintains specifications satisfying more specifically the industrial requirements of this sector. These specifications are thus intended to provide maximum interoperability between control/command/supervision applications, industrial facilities (APIs, sensors and actuators) and office-based management applications. OPC Data Access is one of the specifications of the OPC foundation. It describes all the objects and their interfaces which every OPC Data Access server must implement in order to expose data for client applications. The latter can then access this data using generic methods. Access can be accomplished on a one-off basis (using a synchronous or asynchronous query) or in an eventrelated manner (subscription). For more information concerning OPC specifications you can visit the site of the OPC foundation http://www.opcfoundation.org.
Table of contents
Woodhead
2.2 Rapid presentation of the "Woodhead profibus" OPC server
The OPC server is an application ("PfbOpcServer.exe") playing the role of a server of data originating from the DP profibus network, with the following characteristics:
General characteristics: It is in compliance with OPC custom Data Access specifications 2.05a and 3.0 o It can thus be used easily from any application incorporating at base an OPC client interface (supervision applications, applicom communication ActiveX, applications written in C or C++)
It may be used locally (from a client application on the same machine) or remotely through DCOM (from a client application on another machine through by the network). It is compatible with the Windows NT4.0 SP6, Windows 2000 SP4 minimum, Windows XP SP1 minimum and Windows 2003 Server environments. It may be used as a simple executable file or in the form of a Windows NT service.
Profibus function The OPC server enables one to work simultaneously with one or more Profibus cards When a card is used as a Profibus DP master, the OPC server enables you to access the following data in the Profibus network: o o o I/O data (Data exchange/DP class1) I/O data (DP class2) in read-only mode of the shared facilities (managed by another master) slot/Index read/write DPV1 data. These accesses can be accomplished either in DP class 1 or DP class 2 for facilities in which the card plays the role of principal master in DP class 2 for shared facilities o diagnostic data (slave diag) of facilities in which the card plays the role of principal master
When a card is used as a DP slave, the OPC server enables you to access the following profibus data: o I/O data of the slave
Additional functions The items exposed by the OPC server are declared in the configuration console during the network configuration phase. Default items are added automatically when equipment or modules are added to the configuration. It is then possible, if necessary, to modify the parameter settings of these items, notably: o o o to rename them to change their type to define their limiting values
Table of contents
Woodhead
o to associate a particular property (BCD, signed, etc.) Even if the it configuration files are necessary for operation of the OPC server, it is perfectly possible to install the server on a machine without installing the configuration console, simply by transferring the appropriate files. If required, the OPC server has a complete diagnostic environment allowing current connections to be displayed, traces to be identified and a spy to be placed on a particular item. The server can operate in "Offline" mode, notably if the Profibus card is missing. This mode does enable you, however, to browse the items, enabling you to define all the connections in your client applications under development.
OPCServer IUnknown IOPCServer IOPCCommon IConnectionPointContainer IOPCItemProperties IOPCBrowse IOPCServerPublicGroups IOPCBrowseServerAddressSpace IOPCItemIO OPCGroup IUnknown IOPCItemMgt IOPCGroupStateMgt IOPCGroupStateMgt2 IOPCPublicGroupStateMgt IOPCSyncIO IOPCSyncIO2 IOPCAsyncIO2 IOPCAsyncIO3 IOPCItemDeadbandMgt IOPCItemSamplingMgt IConnectionPointContainer IOPCAsyncIO IDataObject
2.05a Required/supported Required/supported Required/supported Required/supported Required/supported N/A Optional /Not supported Optional/supported N/A
3.0 Required/supported Required/supported Required/supported Required/supported N/A Required/supported N/A N/A Required/supported
Required/supported Required/supported Required/supported N/A Optional/Not supported Required/supported N/A Required/supported N/A N/A N/A Required/supported Optional/ Not supported Optional/ Not supported
Required/supported Required/supported Required/supported Required/supported N/A Required/supported Required/ supported*(2) Required/supported Required/supported*(2) Required/supported Optional/supported*(1) Required/supported N/A N/A
*(1): IOPCItemSamplingMgt is supported but bufferisation is not *(2): Timestamp and quality writes are not supported.
Note
OPC specification DA 3.0 allows a write of the quality and the timestamp of items using interfaces IOPCItemIO, IOPCSyncIO2 and IOPCAsyncIO3. The OPC server does not implement these functions. In this case, the write will be rejected with an OPC_E_NOTSUPPORTED error, as defined in the specification.
Table of contents
Woodhead
2.3 Limitations
When in use the OPC server is considered as the single master application of the profibus network and, as such, prohibits any other application from accessing the card. In addition, at start-up, the OPC server will re-initialise the profibus interface and the network. Consequently, o o If another application is connected to the profibus card when the OPC server is started, the latter will start up "Offline" mode" (no real access) However, when the OPC server has already started, it is possible to start another application in read-only access mode. This notably allows the network diagnostic tool to be started.
The text type items returned by the OPC server, together with the entire graphical interface (diagnostic, log file, etc.) are exclusively in English.
The OPC server does not support OPC specification DA 1.0a, which is considered obsolete
Table of contents
Woodhead
3 Access to data
The OPC server is identified using its ProgID (program identifier): Woodhead.PfbOpcServer ;
To access the data from an OPC client the specification provides three methods:
Method Event-related
Comments The client subscribes to a group in order to be notified on an eventrelated basis of changes having occurred to the values of the items. Only active points of the group having changed are returned to the client. The group refreshment period determines the minimum period between two transmissions of values. The client asks explicitly for an item to be read or written. The client remains blocked during processing of their request. The client asks explicitly for an item to be read or written. The call is non-blocking. The result of the read or write will be returned subsequently.
Synchronous Asynchronous
When you are the user of an application package which is itself an OPC client, the latter generally manages the data access method in a completely transparent fashion, which is hidden for the user. If this is not the case, major elements must however be taken into account: The event-related mode generates minimum traffic between the server and the client since only variables which have changed are returned. It is thus the most efficient of the three modes.
10
Table of contents
Woodhead
In asynchronous mode, if the requests are made faster than the server is able to process them, they are queued. If too many queries are queued, requests may be refused.
The OPC specification stipulates that the client application should reference a variable using a string of characters named ItemID. For this OPC server, the OPC ItemID is the concatenation: of a "topic" name defining the location of the variable there are various types of topic representing data "sources" of different kinds o of "Device" topics representing the slave stations configured in the profibus network (master operation of the profibus card). The names of these topics can be configured in the configuration console a "Slave" topic representing the Profibus card used as a slave DP. The name of this topic can also be configured in the configuration console The "System" topic symbolising the OPC server itself and allowing access to internal server data (status, general meters),
o o
of a "category" defining the type of variable accessed This category field is used only for "Devices" topics (representing the slave stations of the network) and for certain types of data. It enables the nature of the accessed variable to be distinguished: o o DPV1 for DPV1 data for reading/writing of slots/Indices. DIAG for diagnostic data (slave diag) of facilities in which the card plays the role of principal master
of a "syntax" designating the variable For "Devices" or "Slave" topics, the syntaxes corresponding to the field bus data can be configured in the configuration console. Some predefined syntaxes also allow access to the communication statuses or meters relative to the topic.
Notes
Access to the DPV0 data (data exchange) does not require that an item category is specified In the string referencing the item, the field delimiter is point ".". The OPC specification also allows the possibility for a client to use an AccessPath. The OPC server requires no user. However, if the latter is not void, it will be concatenated with the ItemID string supplied by the client to make the ItemID which is finally used by the server. For example, if the client supplies as the AccessPath the string "TOPIC" and as itemID the string "ITEM", the server will use the string TOPIC.ITEM as ItemID.
11
Table of contents
Woodhead
3.4 Table summarising the supported items
Topic Name
System (predefined)
Categories
(void)
syntaxes
State StateStr StateMsg ItemCount ActiveItemCount ErrorCount (predefined) Status StatusError StatusLastError ItemCount ActiveItemCount ErrorCount (predefined) Syntaxes DPV0 configured (declared in the configuration console) Syntaxes DPV1 configured (declared in the configuration console) station station_not_ready cfg_fault ext not_supported invalid_slave_response prm_fault master_lock prm_req stat_diag WD_on freeze_mode sync_mode deactivated ext_overflow master_address ID_high ID_low ext_diag_length ext_diag (predefined) Status StatusError StatusLastError ItemCount ActiveItemCount ErrorCount (predefined) Syntaxes DPV0 configured (declared in the configuration console)
Comments
Diagnostic and control variables in the server see "predefined items of the System topic"
"Devices" topics (configured for each item of equipment in the field bus in the configuration console)
(void)
Diagnostic and control variables in the item of equipment see "predefined items of Devices and Slave topic"
(void)
DPV0/DataExchange class 1 data or I/O class 2 data (shared facilities) See "DPV0 items of Devices and Slave topics" DPV1 data for reading/writing class 1 or class 2 slots/Indices See "DPV1 items of Devices topics" Diagnostic data (SlaveDiag query) see "diagnostic items (slave diag) of Devices topic"
DPV1 (predefined)
DIAG (predefined)
"Slave" topic (configured for the local slave in the configuration console)
(void)
Diagnostic and control variables in the local DP slave see "predefined items of Devices and Slave topic"
(void)
DPV0/DataExchange data of the local slave See "DPV0 items of Devices and Slave topics"
12
Table of contents
Woodhead
Item State
StateStr
VT_BSTR read-only
StateMsg
VT_BSTR read-only
Description Binary indication of the operating mode of the OPC server: - 0: The OPC server is in Online mode - 1: The OPC server is in Offline mode see section "Offline mode/online mode" Indication in ASCII form of the operating mode of the OPC server: - "ONLINE": The OPC server is in Online mode - "OFFLINE": The OPC server is in Offline mode see section "Offline mode/online mode" Indication in ASCII form of the explanation of the operating mode of the OPC server: Possible values for ONLINE mode: PfbOpcServer OK, %s card(s) detected Possible values for OFFLINE mode: Card %s not detected (Card %s is not present) Connection Impossible for card %s: exclusive access right denied (Another application is already connected to card %s with write access rights) Connection Impossible for card %s: Card In Use (Another application is already connected to card %s) Access denied for card %s. Software protection issue (Card %s does not authorise use of the OPC server) Configuration file(s) not found (At least one necessary configuration file is not present) Impossible to connect to the Card %s : Status (An error occured during connection to the card(s) or during reinitialization Number of items (active and inactive) created by the OPC clients connected within the OPC server Number of active items created by the OPC clients connected within the OPC server Number of times when the connection status of an item of equipment has changed from OK to fault.
13
Table of contents
Woodhead
3.6 Predfined items of the "Devices" and "Slave" topics
item Status
Description Indication of the status of the connection with the item of equipment to which it is attached: For a device topic - 128: connection OK - 0: fault For a slave topic - 192: slave OK/ master in RUN mode - 128: slave OK/ master in STOP mode - 0: dfault Bit field specifying the status of the connection with the item of equipment to which it is attached The possible values depend on the type of topic ( Device , shared Device , or slave . Cet item la valeur 0 si tout est OK. To understand the meaning of this byte, refer to the firmware documentation Firmware/DLL Reference Guide
StatusError
VT_UI1 read-only
VT_UI1 read-only VT_UI4 ItemCount read-only ActiveItemCount VT_UI4 read-only VT_UI4 ErrorCount read-only StatusLastError
This item records the last error returned by the StatusError item Number of items (active and inactive) created by the OPC clients connected within the topic to which the item is attached Number of active items created by the OPC clients connected within the topic to which the item is attached Number of times when the status of connection with the item of equipment to which the item is attached has changed from OK to fault.
14
Table of contents
Woodhead
Note
The DPV0 item names useable in the OPC server are configured in the configuration console. For more specific information, please consult the configuration console manual.
When items of equipment and/or modules are declared, default items are generated automatically by the configuration console. It is then possible, if necessary, to modify the parameter settings of these items, notably: to rename them o o The following characters are not allowed :. & " ( - ) = + } ] @ \ ` | [ { ~ < > ? / ! * ^ % space nothing Names must have fewer than 32 characters.
to change their size. The following types may be used, as a simple variable or table:
Variable Boolean Byte 16-bit word 32-bit word IEEE floating point value
Canonical type by default VT_BOOL or VT_ARRAY| VT_BOOL VT_UI1 or VT_ARRAY| VT_UI1 VT_I2 or VT_ARRAY| VT_I2 VT_I4 or VT_ARRAY| VT_I4 VT_R4 or VT_ARRAY| VT_R4
to define limiting values (for non-Boolean items) o o o These limiting values will be used for calculating the deadband They are also taken into account in the qualities returned when a limits-exceeded appears. If no particular value is specified, the default values for the data type are used
to associate a particular property (depends on the data type) o o o BCD: enables the item to be processed as being a value in BCD format Signed: enables, if necessary, the default canonical type of the item to be changed, specifying that the data is of the signed type. Unsigned: enables, if necessary, the default canonical type of the item to be changed, specifying that the data is of the unsigned type.
15
Table of contents
Woodhead
Important note
DPV0 items can be used: In network facilities in which the card is the principal master. In this case: The DataExchange mechanisms are used. Performance specifications are maximum The output items can be read and written In network facilities in which the card is the secondary master (shared facilities). In this case: the class2 access mechanisms are used. Performance levels are then significantly less good. It is recommended to access these items only when needed via synchronous or asynchronous request and not to advise these items All items are accessibly only in read-only In the local slave. In this case Attention: output variables correspond to the input data of the remote master, and vice-versa
16
Table of contents
Woodhead
Note
The DPV1 item names useable in the OPC server are configured in the configuration console. For more specific information, please consult the configuration console manual.
When the item of equipment supports DPV1 functions, it is possible to declare one or more items within the configuration console, corresponding to the various Slot/Index offered by the equipment. The following properties must or can be entered: Name of item o o The following characters are not allowed :. & " ( - ) = + } ] @ \ ` | [ { ~ < > ? / ! * ^ % space nothing Names must have fewer than 32 characters.
Slot/Index number and size of variable o A single item must be configured for each slot/Index and the specified size must match the real size. Consult the documentation of your equipment to find precisely which Slot/Indices are exposed by the equipment
Access right (read/write, read-only) limiting values (for non-Boolean items) o o o These limiting values will be used for calculating the deadband They are also taken into account in the qualities returned when a limits-exceeded appears If no particular value is specified, the default values for the data type are used
to associate a particular property (depends on the data type) o o o BCD: enables the item to be processed as being a value in BCD format Signed: enables, if necessary, the default canonical type of the item to be changed, specifying that the data is of the signed type. Unsigned: enables, if necessary, the default canonical type of the item to be changed, specifying that the data is of the unsigned type.
17
Table of contents
Woodhead
Important note
DPV1 items can be used: In network facilities in which the card is the principal master. In this case, depending on the way in which the equipment's parameters have been set in the configuration console (properties of node DPV1 items), access can be accomplished Either by the class 1 access mechanisms. Either by the class 2 access mechanisms. In network facilities in which the card is the secondary master (shared facilities). In this case: The class 2 access mechanisms are used.
18
Table of contents
Woodhead
Warning
These items are available only for remote facilities in which the card plays the role of principal master The following items are supported. Their meaning is taken directly from the Profibus norm
Type/access
Byte 1/ bit 0. station does not exist Byte 1/ bit 1. Slave is not ready for data exchange Byte 1/ bit 2. Configuration data does not agree
ext
not_supported
Byte 1/ bit 4. Requested function is not supported in the slave Byte 1/ bit 5. Sets slave to O, fixed
prm_fault
master_lock
prm_req
stat_diag
WD_on
freeze_mode
sync_mode
deactivated
19
Table of contents
Woodhead
ext_overflow VT_BOOL/ read only Byte 3/ bit 7.
master_address
Byte 4. Master address after parameterisation (FF without parameterisation) Byte 5. ID high byte
ID_high
ID_low
ext_diag_length
ext_diag
20
Table of contents
Woodhead
The OPC supports browsing capacities (interfaces IOPCBrowseServerAddressSpace (optional) of specification DA 2.05 and IOPCBrowse of specification DA 3.0 ). They enable the client applications to undertake a search on the available items in the addressing space of the OPC server, supplying a classified list of valid itemIDs. The client application can use the browsing capacities even when the OPC server is in the "offline" status (no access to the cards)
Note
The addressing space of the OPC server is structured in hierarchical fashion: topic > category > syntax
With the OPC server, timestamping of a data item indicates the last time the value of the variable was changed, as detected by the server. If the client makes two successive read operations in synchronous or asynchronous mode in relation to a given variable the returned timestamping may be identical if the value has not changed in the mean time.
A quality is associated with each item returned to the client The following table indicates the various qualities used by the OPC server: Quality De c
0 20 24
Hexa
0x000 0 0x001 4 0x001 8 0x002
Bit
0000 0000 0001 0100 0001 1000
Meaning
The quality of the point is poor. The returned value is not useable. The quality of the point is poor. The returned value matches the last known value of good quality. The data element was not able to be read or written following a communication problem between the facilities and the server. The value of the returned data element is not useable. The data element is waiting for a first event-related return.
32
0010 0000
21
Table of contents
Woodhead
0 64 19 2 19 3 19 4 0x004 0 0x00C 0 0x00C 1 0x00C 2 0100 0000 1100 0000 1100 0001 1100 0010 The quality of the data element is uncertain. The returned value is not useable. The data element has been read correctly and any conversions have been able to be undertaken. The value of the data element is less than the minimum configured value. However, the value of the data element is correct and useable. The value of the data element is greater than the maximum configured value. However, the value of the data element is correct and useable.
Mode
description
Normal Authorises the contextual menu of the taskbar icon; the latter allows the graphical diagnostic environment to start Enables the way in which the OPC server interprets the PercentDeadband parameter for calculating the deadband to be modified. By default the server considers that the value received is between 0 and 100 (see section on management of the deadband) Enables the format used by the OPC server for the Boolean type to be modified. checked: The format used is compatible with OPC specification 2.05a and higher (-1 ; 0) unchecked: The format used is non-compatible with OPC specification 2.05a: (1; 0)
Expert
22
Table of contents
Woodhead
4.2 Configuration of topics and of items
The topic and item names useable in the OPC server are configured in the configuration console. Please consult the configuration console manual.
Note
Certain predefined topics and/or items, and item categories (DPV1, DIAG) cannot be renamed.
23
Table of contents
Woodhead
When it is started, the OPC server commences a start-up sequence to connect to the hardware interfaces, reinitialise the network and detect any operational anomaly. After this start-up sequence the server will then operate: Either in Online operational mode. The OPC server is then considered to be in normal operational condition, meaning that access to the Profibus network can operate normally. Or in Offline operational mode. The OPC server is considered as not being in normal operational condition.
Important notes
It is however possible to start up another application requesting to access the card in read-only following the start-up of the OPC server. This is, notably, the case of the "Woodhead Profibus" package network diagnostic The initialisation is undertaken on start-up of the OPC server and not on first connection of a client application. It is thus possible to control easily the moment of initialisation, either by manually starting the OPC server (simple executable), or by using the NT service form of the OPC server in automatic start-up mode.
24
Table of contents
Woodhead
5.1.2 Offline mode
After its start-up sequence, the OPC server is switched automatically into offline mode if the connection with at least one of the Profibus interfaces cannot be established correctly for one of the following reasons
Card not present One of the configuration cards is not present or is not detected in the PCI bus Another application is already connected to the Profibus card The OPC Server cannot then re-initialise the network. Close all applications using the card Protection problem The card does not have the rights allowing use of the OPC server. Run the ViewerKeyPfb3 tool to verify your rights, then consult your vendor. Configuration file not present At least one configuration file is not present in the configuration folder. When the console is used on another station, please transfer the configuration (see configuration console manual)
During operation in offline mode the OPC server has the following specific behaviour: OPC clients can connect to the server completely normally Items can be browsed and added within the client applications All items corresponding to network data will be returned with poor qualities
Important notes
The OPC client application can determine the operational mode of the OPC server using items System.State, System.StateStr and System.StateMsg. When the OPC server has started in offline mode, it is no longer possible to switch back to online mode without stopping and restarting the OPC server.
It is possible to install and use the OPC server on a machine where the network configuration console is not present. However, a configuration console must be able to be used on another machine in order to allow the network and the names of the useable topics and items to be configured. The OPC server relies of configuration files generated by the console to initialise the network and expose the appropriate items. It is thus essential that these files are present for the OPC server to be able to operate normally. It is necessary to make a configuration transfer to the station where the OPC server resides. To do so: The menu File>Export of the configuration console enables the active configuration of the configuration station to be copied to another PC or a physical support
25
Table of contents
Woodhead
The copy must be made to the sub-folder config/config01 of the installation folder of the OPC server
It is possible to use the OPC server in the form of a Windows NT service. It is, however, recommended that your client applications are set correctly in normal mode before switching to service mode. By default, after installing the OPC server, service mode is not installed. To install it, start the OPC server from the menu Start>Execute with the following option: "PfbOpcServer service" To switch back to simple executable mode, start the OPC server from the menu Start>Execute with the following option: "PfbOpcServer regserver"
Warning
To switch the OPC server from simple executable mode to service mode, and vice versa, you have to verify that the OPC server is stopped before to use the commands above. Otherwise, these commands will have no effect.
Note
In service mode it is not possible to activate the diagnostic environment
26
Table of contents
Woodhead
6 Advanced functions
For the client groups constitute a simple means of organising data they wish to access. This organisation is left entirely free for the client. Consequently, a group may contain completely varied variables collected in different facilities. When you are the user of an application package which is itself an OPC client, the latter generally manages groups of data in a completely transparent fashion, and one which is hidden for the user. If this is not the case, important elements must however be taken into account when creating groups: It is at group level that the client application has the possibility of setting the refreshment period. The application has the possibility of activating or deactivating a group, i.e. of authorising or prohibiting feedback of event-related data in relation to all the group data. The deadband can be managed at group level. OPC specification DA 3.0 allows, through interface IOPCItemDeadbandMgt, the deadband to be positioned for each item. The latter replaces of cancels any which might have been configured at group level.
Note
Some client applications set the group refreshment period to 0 (return of data as rapidly as possible). This can undermine general performance of the system due to the scale of the data flow between the server and the client. For this reason the OPC server uses a minimum refreshment period of 25 ms (minimalUpdateRate of the OPC specification)
27
Table of contents
Woodhead
Note
The OPC server, supportant OPC specification DA 3 .0, implements the optional interface IOPCSamplingMgt. This enables a sampling period to be defined for each item. The item will then be collected by the OPC server using the period configured in relation to the item, but the item notification "callback" will be sent only using the period configured for the group.
6.2 Deadband
The client application has the possibility of specifying a "deadband" Either at group level (it will then assign all the items contained in the group) Or in relation to the item (specification 3.0 only).
This parameter indicates the minimum change percentage which will cause the data element to be sent to the client application. It influences only the event-related information feedback mode. It has become apparent that not all OPC clients set this parameter in the same manner. For this reason the OPC server allows the range used to be defined for each configuration. It may thus be set, according to this choice, between: 0 and 100 (1% =1). This option is the default and matches the OPC specification Or between 0 and 1 (1% = 0.01). The very notion of "deadband" requires that the variable concerned is of the analog type and that it has a maximum value and a minimum value enabling a change percentage to be calculated. The data element will thus be fed back to the client application if: absolute value (last value fed back current value) > pPercentDeadband * (max value - min value) The min. value and the max. value of a data element may be configured within the configuration console (except for predefined items). If no particular configuration has been made, it is defined by its type:
0 to 255 -128 to 127 0 to 65535 -32768 to 32767 0 to 4294967295 -2147483648 to 2147483647 3.4e+38 to 3.4e+38 -1.79e+308 to 1.79e+308
28
Table of contents
Woodhead
7 Diagnostic interface
By default the OPC server has no graphical interface. It is however possible, when the server is used as a traditional application (simple executable) to activate a complete diagnostic environment notably enabling the internal behaviour of the OPC server to be analysed.
Note
The diagnostic interface is not available when the OPC server is used in the form of a Windows NT service. If required, it is thus necessary to change back to the form of a simple executable. If this proves impossible, consult our technical support
After it is started (as an executable), the presence of the server is made tangible by an icon inserted in the taskbar (if allowed by the DCOM security criteria). By default this icon has no contextual menu. It can however be activated from the box to configure the OPC parameters of the configuration console, by validating the option Enable Server Diagnostic View. This menu then allows you, by right-clicking the mouse: to display the diagnostic environment (Diagnostic menu). to close the server (Exit menu)
The diagnostic interface is useful only for the adjustment phases of your application. Using it consumes resources. It must not therefore be activated during operational phases. The diagnostic interface allows: files to be generated which can be used automatically by the application "DumpLogger.exe", containing data concerning the configuration and communications pending traces to be displayed with generation of a log file (pfbopcserver.log), thus enabling the general behaviour of the server to be checked along with communication with the client applications. spying more specifically on events occurring in relation to an item, with generation of a trace file (pfbopcserverspy.log)
29
Table of contents
Woodhead
Description of general commands Icon Description When you press this button, the file "dumpOPC.xml" is generated in the current configuration folder. The application "DumpLogger.exe" becomes activated and immediately loads this latter file, displaying in the items and groups overview, managed by the OPC server. This view is static. It is thus necessary to run the command again to update the data. Double-clicking one of the objects in the tree displays a box enabling the list of internal properties of the object to be displayed. When you press this button, the file "dumpTopic.xml" is generated in the current configuration folder. The application "DumpLogger.exe" becomes activated and immediately loads this latter file, displaying in the overview of topics which are configured, and thus useable within the OPC server Allows a list of items to be spied on. See section "Spy view of items" Closes the messages zone of the diagnostic environment. Activates the message zone by using a single display window, where all the messages are written, of whatever kind. See section "Viewing messages". Activates the message zone using several display windows, each containing different message categories. See section "Viewing messages". Displays information concerning the application.
30
Table of contents
Woodhead
This view is divided into three parts. At the top left a browser enables the various accessible data elements to be viewed. The bottom left part shows the list of items to be kept watch of, and the right-hand part displays the messages of events affecting the items in the list.
To spy on an item select the item to be kept watch on in the browser do a "slide move" of the browser to the list below if necessary complete the syntax (press F2 to rename) and click on the checkbox to select the item start the watch by pressing button: From this time, it is no longer possible to modify the items under active watch. It is however possible to add items to the list or to modify those which are not active. The watch may be stopped using the button:
31
Table of contents
Woodhead
Note
The command Logger parameters... in the Diagnostic menu allows all messages displayed in the view to be saved in a file "PfbOpcServerSpy.log" located in the configuration folder. Attention: these parameters are also applied to file "PfbOpcServer.log" allowing messages from the application to be saved.
Available commands Icon Description Create a new list of items to watch. If there is already a list which has not been saved, a message appears. Opens a list of items to be watched which was previously saved on the disk. If there is already a list which has not been saved, a message appears. Allows the active list of items to be watched to be saved to disk. Searches for a string of characters in the current window. It is case-insensitive. Deletes all messages in the message display window. Copies the selected text from the message window to the clipboard. It can then easily be pasted into any other text-type file. Puts all selected items in the list under watch. Stops watching of all items. Adds the selected item from the tree into the list. Deletes the selected item from the list. Selects the item (or items) to place a watch on it/them.
32
Table of contents
Woodhead
It is possible to stop tracing of messages in the windows by selecting the command Diagnostic > Output View > Stop Messages. The command Restart Messages allows traces to be resumed. Both these commands act on the all the message windows at the same time. On stoppage or resumption, a message is signalled in each of the tabs. The command Clear Output View allows all the messages of the visible tab to be deleted. The messages of the other tabs are not affected by this command.
Warning
All the messages issued by the server between stop (Stop Messages) and resumption (Restart Messages) are lost.
33
Table of contents
Woodhead
Note
The command Logger parameters... in the Diagnostic menu allows all messages displayed in the view to be saved in a file "PfbOpcServer.log" located in the configuration folder. Attention: these parameters are also applied to the file "PfbOpcServerSpy.log".
34
Table of contents
Woodhead
Annexes
Developments can be classified in two main categories: Developments using the custom interface. This interface can be used with languages of the C/C++ type. Its use requires complete knowledge of the OPC Data Access specification, OPC mechanisms in general and OLE/COM mechanisms.
Developments undertaken using the Automation DLL. This interface is more specifically intended for fast development tools such as VB, Delphi, offices tools, etc. It in fact constitutes an additional automation layer of the custom interface useable in languages of the C/C++ type. Its use requires complete knowledge of the Data Access Automation Interface specification and of OPC mechanisms in general. This DLL is not supplied in the package. If required, the Automation DLL sources can be obtained from the OPC foundation
35
Table of contents
Woodhead
The CLSID is the single and universal identifier of the server and it is independent of its version. The ProgID is a string of characters translated from the CLSID using the registers database. It constitutes a legible synonym of the CLSID. ProgID: Woodhead.PfbOpcServer CLSID: {283618B5-8349-11D0-8F82-0080C85344A1}
The OPC server is identified using its ProgID (program identifier) and its CLSID (class identifier), recorded in the registers database of the machine during installation. The CLSID is the single and universal identifier of the server and it is independent of its version. The ProgID is a string of characters translated from the CLSID using the registers database. It constitutes a legible synonym of the CLSID. ProgID: Woodhead.PfbOpcServer CLSID: {283618B5-8349-11D0-8F82-0080C85344A1} To instance the OPC server, the client application must: 1 Initialise the COM library 2 Obtain the CLSID from the OPC server from the ProgID 3 Create an OPCServer object 4 Call one or more functions of the OPCServer object 5 Release the interfaces used. This is an example of code undertaking the above stages (for the sake of code legibility error cases are not handled): //Stage 1: Initialise the COM library HRESULT hr; hr = CoInitialize(NULL); //Stage 2: Obtain the CLSID from the ProgID CLSID clsid; hr = CLSIDFromProgID((L" Woodhead.PfbOpcServer "),&clsid); //Stage 3: Create the OPCServer object and obtain the first interface (here IOPCServer) IOPCServer* pServer; hr = CoCreateInstance(clsid,NULL, CLSCTX_LOCAL_SERVER,IID_OPCServer,(void**)&pServer); //Stage 4: Call one of the functions of the interface. pServer->GetStatus(); //Stage 5: Release the interfaces
36
Table of contents
Woodhead
pServer->Release(); UnInitialize(); 8.1.3.2 Creation of an OPCGroup object
A group is created by the client using a call to the method AddGroup of the interface IOPCServer of the object OPCServer. The latter notably contains the following parameters: Name
szName dwRequestedUpdateRate
Description
Name of group. If it is not supplied, the server generates a unique one (in the form New_Group_x , where x is an incremental number). Refreshment period requested by the client. The period actually accepted by the server will be returned in the return parameter dwRequestedUpdateRate. This parameter is not used. This parameter allows return of the variable with a strong variation (see "Group management")
dwLCID pPourcentDeadBand
8.1.3.3
Managing items
Items are created by the client using a call to the method AddItem of the interface IOPCItemMgt of the object OPCGroup. Each item symbolises a connection to a physical variable. In fact the client describes the variable which interests it by means of a OPCITEMDEF structure. The fields of this structure are as follows: Name
szAccessPath szItemID bActive hClient dwBlobSize pblob vtRequestedDataTyp e
Description
Not actually used by the OPC server. If this field is used its content will be concatenated to that of the item (szItemID) to form the name of the item String of characters referencing the item. indicates the state of activation of the item at the time of its creation. Reference handle of point for the client. the "blob" mechanism is not used by the OPC server. the "blob" mechanism is not used by the OPC server. Type of variant requested by the client. The value VT_EMPTY designates the default type (decided by the server).
37
Table of contents
Woodhead
Notes
When a new item is added to a group using the method AddItems, the OPC server automatically determines the canonical type of the variable and returns it in the field vtCanonicalalDataType of the structure OPCITEMRESULT. If there is no specific requirement, it is thus recommended that the client application should always pass the value VT_EMPTY in the field vtRequestedDataType, thus allowing the server to determine itself the type of the variable .
38
Table of contents
Woodhead
Transparency
For the client, use of a COM object through DCOM or through the COM mechanisms locally is completely transparent. The operating system, through the COM library, manages the object and determines where it must be instanced according to the configuration associated with the object.
8.2.2 Installation
When implementing the OPC solution in DCOM, you will be undertake the following operations: Establishment of a "server station" (under Windows NT4, Windows 2000 or Windows XP) containing the OPC server and able to be accessed either from a local OPC client (running on the machine), or from a remote OPC client (running on another machine) Establishment of a "client station" (under Windows NT4, Windows 2000 or Windows XP) interrogating a remote station.
Establishing a "server station" The OPC server is installed by checking the corresponding option during the installation program. After installation, the OPC server can be accessed from any OPC client running on the local machine. To be sure that this is so, try to connect to the OPC server from the OPC client utility.
The package of the "OPC server" includes a file PfbOpcServer.reg allowing the server to be registered in the client station in the registers database, thus allowing it to be configured in the utility dcomcnfg. To register the OPC server, include the file PfbOpcServer.reg in the register database by double-clicking the file.
39
Table of contents
Woodhead
8.2.3 Configuring DCOM
The "DCOMCNFG" program Before a client is able to use a COM object on another machine, the properties of the COM object must be configured in the client machine and in the remote machine. DCOM and the COM objects used are configured using the program supplied with the system, dcomcnfg. After starting the program, for example by entering the command dcomcnfg in the dialogue box of the menu Start> Execute), four tabs are available for the DCOM configuration.
Specific features for Windows XP Under Windows XP, the utility dcomcnfg has the following form:
To obtain the box for configuring the general properties, select node My Computer in the tree under \Console Root\Component Services\Computers\, and then choose the option Properties in the contextual menu or in the menu Action. The properties box is then similar to that of dcomcnfg under Windows 2000 or NT4 and it contains tabs Default Properties and Default COM Security. Configuring these parameters is then identical to that described below.
Note
If you reduce the security parameters it will always be necessary to restart the system before they are taken into account.
40
Table of contents
Woodhead
Warning
The screen copies were made under Windows 2000; under N4 they may be slightly different. Under Windows XP, the DCOM configuration utility dcomcnfg is slightly different from the one present on a Windows 2000 or NT4 station. These differences will be described in detail if they could pose difficulties in finding the parameters to be configured. Only the tabs requiring modifications are described. The parameters specified in this documentation guarantee simply that the DCOM protocol will start. However, most of the security parameters of Windows NT have been reduced. To satisfy a higher security level, you must comply strictly with parameter settings in agreement with DCOM principles. For more information, refer to article number Q176799, Q158508 and Q169321 in the "Microsoft Knowledge Base".
41
Table of contents
Woodhead
8.2.3.1 Configuring the DCOM general properties in the server machine and the client machine "Default properties" tab The Default properties tab enables the basic DCOM properties to be specified.
To use DCOM with the OPC server: check Activate Distributed COM (DCOM) on this computer set the parameters to: Type of network controller Workgroup (no domain server available for the authentication) Domain server Authentication level Identity borrowing level None Anonymous Connection Identifier
42
Table of contents
Woodhead
"Default security" tab
Warning
Do not use this tab. The permissions of the OPC server will be set individually later.
The Default security tab enables the permissions for DCOM operations to be specified. These parameters certify that only clients with the necessary permissions will be able to use the server.
The following default permissions can be set to use DCOM. These permissions can also be set individually for each object and these default properties will then be ignored. Type of permissions Access permissions Information The Default access permissions enable it to be specified for all COM objects which user accounts will be able to access the object; in other words, to call its methods. The Default execution permissions enable it to be specified for all COM objects which user accounts will be able to create a new instance of the object. The Default configuration permissions enable it to be specified for all COM objects which user accounts will be able to modify the register database information.
Execution permissions
Configuration permissions
43
Table of contents
Woodhead
Specific features for Windows XP Under the node My Computer, expand the node DCOM Config to obtain all the COM objects available from the machine:
Then select the OPC server Woodhead OPCPfbServer and select the option Properties in the menu Action to start configuring the specific parameters of the OPC server. The same dialogue box containing the same tabs as under Windows 2000 is then found. Then undertake the same configuration for OpcEnum.
44
Table of contents
Woodhead
"Applications" tab The Applications tab displays all the COM objects available from the machine.
Select the OPC server Woodhead.OPCPfbServer and click the button Properties to start configuring the specific parameters of the OPC server. Then undertake the same configuration for OpcEnum.
45
Table of contents
Woodhead
8.2.3.2 Configuring 'applicom OPC Server' on the server machine "General" tab In the General tab you can change the level of authentication of an object.
46
Table of contents
Woodhead
"Location" tab The Location tab is used to specify the machine in which the server has started.
47
Table of contents
Woodhead
"Identity" tab The parameters of the Identity tab specify which accounts will be used to check the user's permissions in relation to this object.
There are several possibilities: Type The interactive user Action This choice is the one recommended by default for the OPC server. The account of the user having opened the current session is used. If, however, no user is logged on the machine there is no interactive user and the COM object cannot be created. In this case, select This user. The account of the user having initiated the OPC client is used. This user must then have the required permissions, and thus be included in the Security tab. This mode generally causes a server instance to be initiated for each executing user. This option must not be used with the OPC server. The account of the indicated user is used. This user must then have the required permissions, and thus be included in the Security tab. The user must have the default permissions assigned to the Users of the machine group; in other words, must belong to the Users group. This choice must be used for servers where no user is logged.
This user
48
Table of contents
Woodhead
"Security" tab You can specify the access permissions for the OPC server from the Security tab. For the three security aspects used by DCOM you can either: user the default permissions In this case, the account configured in the Identity tab must have the requisite permissions in the Default security tab (default access permissions, default execution permissions). use customised permissions for the selected object If you want one particular user not to be able to access all the available COM objects, you must use customised permissions.
To work with the OPC server, only the access permissions and the execution permissions need to be configured:
49
Table of contents
Woodhead
Choose Use customised access permissions Press Modify and set the following permissions:
Then choose Use customised execution permissions Press Modify and set the following permissions:
Note
On the server machine and on the client machine, the accounts of both logged persons must exist. Example: User Alpha is logged on the machine with the server and user Beta is logged on the machine with the client. To use DCOM a Beta account must exist on the server station (with the same password as on the client machine) and an Alpha account must exist on the client station (with the same password). If you work with a domain, it is recommended that a group containing user accounts is used. The permissions are then managed from the domain server.
50
Table of contents
Woodhead
8.2.3.3 Configuring 'applicom OPC Server' on the client machine For the client part, the screen copies below show a simple configuration enabling the OPC server to be used through DCOM
"General" tab
51
Table of contents
Woodhead
"Location" tab
52
Table of contents
Woodhead
"Identity" tab In the Identity tab you can specify which user account will be used for the client machine. It is logical to specify Interactive user, or in other words, the user logged on the machine.
53
Table of contents
Woodhead
"Security" tab
54
Table of contents
Woodhead
Access type: Allow access
55
Table of contents
Woodhead
9 Support
56
Table of contents
Woodhead
10 Index
A AccessPath, 11 Asynchronous, 10 B Browsing, 21 C category, 11 caution definition, 5 CLSID, 35 configuration files, 25 Configuration of topics and of items, 23 conventions special notation, 5 special terms, 4 style, 4 Custom interface, 35 D DCOM, 39 DCOMCNFG, 39 Deadband, 27, 28 Diagnostics, 29 DLL automation, 35 DPV0, 15 DPV1, 17 E Event-related, 10 F firmware definition, 4 Functions, 7
I initialisation, 24 Interfaces, 8 Item, 11, 37 ItemID, 11 Items diagnostic, 19 Items supported, 12 N note, definition, 5, 50 NT service, 26 O Objects, 8 Offline mode, 24, 25 Online mode, 24 OPC, 6 OPC Groups, 27, 37 OPC server, 6 OPC, definition, 4 P ProgID, 10, 35 purpose, of guide, 4 Q Quality, 21 Quick introduction, 7 R Reg file, 39 S Slave diag, 19 Start-up of OPC server, 24
57
Table of contents
Woodhead
State, 13 Status, 14 support, 56 Synchronous, 10 System, 13 T technical support, 56 Timestamping, 21 Topic, 11 topic Slave, 11 topic System, 11 topics Devices, 11 W warning definition, 5
58
Table of contents