experion mx opc link - balibago platform - experion mx/6510020407.pdfthis manual is intended for use...

42
Experion MX OPC Link User Manual 6510020407

Upload: others

Post on 20-Mar-2020

24 views

Category:

Documents


3 download

TRANSCRIPT

Experion MX OPC Link

User Manual

6510020407

Experion MX OPC Link User Manual

March, 2012

Confidentiality Statement

This manual is a product of Honeywell. It is intended for use only by Honeywell and customer personnel in connection with Honeywell products. It is strictly prohibited to copy this manual or any part thereof or to transfer this manual or any part thereof to any non-Honeywell person or entity, except customer personnel for use in connection with Honeywell products. Persons employed by a third-party service company shall not have access to this manual.

Notice

All information and specifications contained in this manual have been carefully researched and prepared according to the best efforts of Honeywell, and are believed to be true and correct as of the time of this printing. However, due to continued efforts in product improvement, we reserve the right to make changes at any time without notice.

Trademarks

All trademarks and registered trademarks are the properties of their respective holders.

Copyright

© 2012 Honeywell

All rights reserved. No part of this publication may be reproduced or translated, stored in a database or retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of Honeywell.

Contents

Introduction.............................................................................................................................................. iii

Audience ................................................................................................................................................ iii

About This Manual ................................................................................................................................ iii

Conventions ........................................................................................................................................... iv

1. Overview ............................................................................................................................................ 1-1

2. RAE HCI/OPC Server ...................................................................................................................... 2-1

2.1. Implementation ......................................................................................................................... 2-1

2.2. Installation................................................................................................................................. 2-3

2.3. Name Forms.............................................................................................................................. 2-3

2.4. RTDR Data Types..................................................................................................................... 2-3

2.5. Cache Data and Device Data .................................................................................................... 2-5

2.6. Additional Features ................................................................................................................... 2-7 2.6.1. Partial Array Access ..................................................................................................... 2-7 2.6.2. ObjectHasChanged Support.......................................................................................... 2-7 2.6.3. Alias Support ................................................................................................................ 2-8 2.6.4. Event Support................................................................................................................ 2-9

2.7. Configuration .......................................................................................................................... 2-10

3. HCI/OPC Client ................................................................................................................................ 3-1

3.1. Implementation ......................................................................................................................... 3-1

3.2. Determining Configured Servers .............................................................................................. 3-2

3.3. Configuration ............................................................................................................................ 3-2

3.4. Sample Audit File ..................................................................................................................... 3-6

4. OPC Browser ActiveX Control........................................................................................................ 4-1

5. General COM Issue........................................................................................................................... 5-1

P/N: 6510020407 3/26/12 i

Experion MX OPC Link User Manual Contents

3/26/12 P/N: 6510020407 ii

List of Figures Figure 1-1 OPC Client connectivity ........................................................................................................ 1-1 Figure 1-2 Applications accessing the server .......................................................................................... 1-3 Figure 2-1 RAE OutOfProc OPC Server (EXE) ..................................................................................... 2-1 Figure 2-2 FactorySoft OPC Client interacting with RAE Server .......................................................... 2-2 Figure 2-3 HMX Online Link Configuration tool ................................................................................... 2-8 Figure 2-4 ODX Server Events................................................................................................................ 2-9 Figure 4-1 RAE Browser Displaying Local OPC Servers....................................................................... 4-2 Figure 4-2 RAE Browser displaying RTDR............................................................................................ 4-3

List of Tables Table 1-1 OPC Interfaces supported by RAE Server .............................................................................. 1-3 Table 2-1 RTDR Data Types ................................................................................................................... 2-3 Table 2-2 Behavior of RAE Server and OPC Clients.............................................................................. 2-6 Table 2-3 OPC Server ID and Value ..................................................................................................... 2-10 Table 3-1 Link table................................................................................................................................. 3-2 Table 3-2 TransferGroup ......................................................................................................................... 3-5 Table 3-3 Variable ................................................................................................................................... 3-5

Introduction

The purpose of this manual is to provide an introduction to the OPC Support in RAE

Audience

This manual is intended for use by engineers or process engineers and assumes that the reader has some knowledge of the operation of a paper machine and a basic understanding of mechanical, electrical and computer software concepts.

About This Manual

This manual contains five chapters.

Chapter 1, Overview, describes OPC client connectivity

Chapter 2, RAE HCI/OPC Server, describes implementation and supported RTDR data types

Chapter 3, HCI/OPC Client, describes about HCI Link and OPCclients

Chapter 4, OPC Browser ActiveX Control, describes ActiveX Control for browsing RTDR

Chapter 5, General COM Issue, describes few of the COM issues

P/N: 6510020407 3/26/12 iii

Experion MX OPC Link User Manual Introduction

Conventions

The following conventions are used in this manual:

Text may appear in uppercase or lowercase except as specified in these conventions. Boldface Boldface characters in this special type indicate your input. Special Type Characters in this special type that are not boldfaced indicate system

prompts, responses, messages, or characters that appear on displays, keypads, or as menu selections.

Italics In a command line or error message, words and numbers shown in italics represent filenames, words, or numbers that can vary; for example, filename represents any filename. In text, words shown in italics are manual titles, key terms, notes, cautions, or warnings.

Boldface Boldface characters in this special type indicate button names, button menus, fields on a display, parameters, or commands that must be entered exactly as they appear.

lowercase In an error message, words in lowercase are filenames or words that can vary. In a command line, words in lowercase indicate variable input.

Type Type means to type the text on a keypad or keyboard. Press Press means to press a key or a button. [ENTER] or [RETURN]

[ENTER] is the key you press to enter characters or commands into the system, or to accept a default option. In a command line, square brackets are included; for example: SXDEF 1 [ENTER]

[CTRL] [CTRL] is the key you press simultaneously with another key. This key is called different names on different systems; for example, [CONTROL], or [CTL].

[KEY-1]-KEY-2 Connected keys indicate that you must press the keys simultaneously; for example, [CTRL]-C.

Click Click means to position the mouse pointer on an item, then quickly depress and release the mouse button. This action highlights or “selects,” the item clicked.

Double-click Double-click means to position the mouse pointer on an item, and then click the item twice in rapid succession. This action selects the item “double-clicked.”

Drag X Drag X means to move the mouse pointer to X, then press the mouse button and hold it down, while keeping the button down, move the mouse pointer.

Press X Press X means to move the mouse pointer to the X button, then press the mouse button and hold it down.

3/26/12 P/N: 6510020407 iv

Introduction Conventions

The attention icon appears beside a note box containing information that is important.

The caution icon appears beside a note box containing information that cautions you about potential equipment or material damage.

The warning icon appears beside a note box containing information that warns you about potential bodily harm or catastrophic equipment damage.

P/N: 6510020407 3/26/12 v

1. Overview

OLE for Process Control (OPC) is based on Microsoft’s OLE/ (Distributed) COM technology and is an open and interoperable interface standard. Based on this OPC provides interoperability between different vendors or can act as a common infrastructure for merging the various sub-systems of a large system.

To obtain a complete specification for OPC, please visit the OPC Foundation website http://www.opcfoundation.org/

Figure 1-1 OPC Client connectivity

P/N: 6510020407 3/26/12 1-1

Experion MX OPC Link User Manual Overview

An OPC Client can connect to OPC Servers provided by one or more vendors. The address space of these servers may be completely different from each other but can be accessed by the client in a uniform manner using the OPC interfaces. Any number of clients (within network and processor thresholds) can connect to a server at any one time. Servers are referenced by a combination of ComputerName and Program ID (ProgID). This allows Servers to be accessed on different machines, subject to DCOM security. ProgID is the Program ID for the server and this will be unique for each OPC Server type, but all instances of a given OPC Server use the same ProgID.

An OPC server is primarily comprised of three distinct objects: the server, group(s) and item(s). The OPC server object maintains information about the server, e.g. state information, last update time etc., and is a container for the OPC groups. The OPC group object maintains information about itself, e.g. update rate etc., and is a container for the OPC items. The OPC Items correspond to individual data points.

Each OPC group within a server has a unique name and provides a way to organize data. Groups can be active or inactive and have a specific update rate. The update rate is the rate at which the server will update active items in the cache for that group. The RAE Server allows a maximum update of 500 mSec per group. It is generally expected that 1 sec or more will be the usual update rate.

Data in a group can be read and written. Reads can occur from cache or from a device (in the RAE OPC Server the device is the RTDR), and can be synchronous, asynchronous or exception based using a callback mechanism. Writes can be synchronous or asynchronous and all writes are directly to the device. Items within the group can be enabled and disabled as needed. The RAE OPC server does not currently support public groups.

OPC items represent connections to data sources within the server, in the case of the RAE Server an OPC item corresponds to a fully qualified field in the RTDR. Under the OPC custom interface there is no external interface defined for an OPC item; all access to OPC items is through the group object that contains the item. Each item has a Value, Quality and Time Stamp. The value is described by an OLE VARIANT, and the Quality is similar to that specified by Fieldbus. TimeStamps are in the form of FILETIME, which are always in UTC.

The RAE OPC Server is provided in two forms:

InProc server (DLL)

OutOfProc (EXE) server

There is a unique ProgID for the InProc (Hmx.RaeServer_I) and OutOfProc (Hmx.RaeServer_O) versions. The reason that two different servers are been

3/26/12 P/N: 6510020407 1-2

Overview Implementation

provided is primarily for speed. If the client is on the same machine as the server then the InProc version can be used which results in a much faster access time. Clients from other machines must use the OutOfProc version in order to access the server.

OPC defines the specification in terms of two sets of interfaces; the OPC Custom Interfaces and the OPC Automation interfaces. The RAE Server supports both these interface sets. Typically C/C++ clients would access a server using the Custom Interfaces since these tend to be faster; with VB/JAVA/VB Scripts/.NET and others using the Automation Interfaces. It is expected that on most RAE platforms the RAE HciLink client will be used to access any server, this client uses the Custom interface set.

Figure 1-2 Applications accessing the server

Like all COM clients an OPC client connects and communicates with an OPC server through specified interfaces. The client sees only the interfaces. Refer Table 1-1 for the OPC Interfaces supported by the RAE Server.

Table 1-1 OPC Interfaces supported by RAE Server

Object Interface

Server IOPCServer IOPCCommon IOPCServerBrowseServerAddressSpace IconnectionPointContainer IOPCItemProperties

Group IOPCItemMgt IOPCGroupStateMgt IOPCSyncIO IOPCAsyncIO IOPCAsyncIO2 IDataObject IOPCItemMgtDisp IConnectionPointContainer

P/N: 6510020407 3/26/12 1-3

Experion MX OPC Link User Manual Overview

3/26/12 P/N: 6510020407 1-4

Item (Automation Only)

IOPCItemDisp

2. RAE HCI/OPC Server

2.1. Implementation

The RAE Server supports OPC V2.04 and is backwards compatible with V1.01A and was built using the Honeywell Communication Interface (HCI) toolkit. As such it supports a superset of OPC. Standard OPC clients may utilize the supported OPC interfaces but HCI clients can make use of the extra HCI interfaces such as IHciComponent and IHciCacheMgmt to manage server initialization and termination, cache manipulation etc.

Refer Figure 2-1 to see how the RAE Server looks in terms of the overall interfaces.

DSS Class Factory IClassFactory

IHciComp onent

IHciDeviceSpecific

Inst ances Mgmt

RAE O utO fProc O PC S erver (EXE)

Global Data Cache Resources

Hci Global

IHciCacheM gmt

IEnumUnknown

Generic OPC

IOPC... IHciGlobal

IHciAct iveList

IHciAttributes

RTDR Specific Server

Figure 2-1 RAE OutOfProc OPC Server (EXE)

P/N: 6510020407 3/26/12 2-1

Experion MX OPC Link User Manual RAE HCI/OPC Server

The key concepts to here are that the server contains multiple instances of RTDR specific server and has a global area for shared data such as a data cache. The server implements the IHciComponent interface that makes it possible to act as a TPS Managed Component.

The RAE Server does not use any IWhatever interfaces. The InProc version is similar to above except it cannot act as a managed component.

The RAE Server uses two different caches. There is the “standard” OPC Cache which servers are expected to provide which is used to cache item data, quality and timestamp; and there is another persistent cache which caches resolved item names, this results in faster access to the items on subsequent calls. These are discussed in more detail later.

The Server supports all the required OPC custom and automation interfaces and the optional IOPCServerBrowseServerAddressSpace interface. This allows the RTDR to be browsed hierarchically (OPC_NS_HIERARCHIAL) by any OPC Client that can use this interface. The BrowseAccessPaths method is not implemented since the Server currently does not use access paths. Figure 2-2 shows FactorySoft sample client browsing the RAE Server to select which items to read:

Figure 2-2 FactorySoft OPC Client interacting with RAE Server

3/26/12 P/N: 6510020407 2-2

RAE HCI/OPC Server Installation

A valid RTDR database is necessary in order for the RAE Server to initialize correctly.

2.2. Installation

The RAE OPC Server software package is designed to run on a RAE platform which has the Honeywell Communications Interface (HCI) runtime installed. The Server consists of the following components, which are installed to the Rae\bin directory:

OPCServer.DLL - InProc Server

OPCServer.EXE - OutOfProc Server

Browsing support has been moved from the browsesap.dll to be directly included in the OPC Server, as a result the browsesap.dll file has been removed

Both the above files represent ActiveX components, the install program registers them. Since the InProc Server is not available to remote machines it will not appear under DCOMCNFG (Mircosoft’s DCOM Configuration program) but the OutOfProc server appears as HMX RAE OPC COMPONENT – exe Server. Under a normally deployed RAE environment there should be no need to modify the DCOMCNFG settings to access RAE Servers on remote machines but if a different configuration this is the entry that needs to be modified.

2.3. Name Forms

Data points within the OPC Server address space are referenced as /record path/…/fieldname. This follows the normal RTDR addressing convention.

2.4. RTDR Data Types

Table 2-1 shows the RTDR data types that are supported, and how they are mapped into HCI/OPC data types. The server will perform any requested type conversions, all legal OLE type conversions are supported.

Table 2-1 RTDR Data Types

P/N: 6510020407 3/26/12 2-3

Experion MX OPC Link User Manual RAE HCI/OPC Server

RTDR Type Description

HCI/OPC Canonical Type

Byte Field VT_I2

Short Field VT_I2

Long Field VT_I4

Float Field VT_R4

Double Field VT_R8

Ascii Field VT_BSTR

Date Field VT_DATE

Single Dimensional Array of Bytes

VT_ARRAY (VT_I1)

Single Dimensional Array of Shorts

VT_ARRAY (VT_I2)

Single Dimensional Array of Longs

VT_ARRAY (VT_I4)

Single Dimensional Array of Floats

VT_ARRAY (VT_R4)

Single Dimensional Array of Doubles

VT_ARRAY (VT_R8)

Single Dimensional Array of Ascii

VT_ARRAY (VT_BSTR)

Single Dimensional Array of Dates

VT_ARRAY (VT_DATE)

As per the OPC specification only single dimensional arrays are supported and these as specified as OLE SafeArrays of the appropriate data type. Arrays within the server space are designed to be written to as a complete unit. All arrays within the server are zero based. The RAE OPC Server basically ignores the lower bound of the array if it is non zero. It is possible to write to an array where:

The number of elements being written is less than the number of elements in the array. In this case the array is updated element by element until the number of elements to be written is reached.

The number of elements being written is equal to the number of elements in the array. In this case the array is updated with a single atomic call.

The number of elements being written is greater than the number of elements in the array. In this case the array is updated element by element until the end of the array is reached.

NAN is allowed as a real value (VT_R4 and VT_R8) and when encountered the Quality for the item will read OPC_QUALITY_BAD.

3/26/12 P/N: 6510020407 2-4

RAE HCI/OPC Server Cache Data and Device Data

2.5. Cache Data and Device Data

OPC Servers are expected to maintain a cache, which holds the data, quality and timestamp information for each active item in a group. An item is active if the group itself is active and the individual item is marked as active. The cache is updated by the server based on the group update rate, providing the item changes beyond the specified group deadband. All write operations go directly to the device so writes are unaffected by the group update rate, deadband, active state or item active state although the completion of a write operation will cause a cache update to occur.

Most clients will typically read data from the cache as opposed to the device since access to Device data is expected to be slower, although in the case of the RAE server the cache is not significantly faster than the device (RTDR) access. The Cache reflects the latest value of the data (subject to specified update rate and deadband) as well as the quality and timestamp. There are several ways for a client to obtain cached data from the server, it is more performant to read a number of items per group as opposed to having multiple groups of single items:

It can perform a synchronous read from cache (simple and reasonably efficient). This may be appropriate for fairly simple clients who are reading relatively small amounts of data and where maximum efficiency is not a concern.

It can ‘subscribe’ to cached data using IAdviseSink which is more complex but very efficient. This is the recommended behavior for clients because it will minimize use of CPU and NETWORK resources. This is the mechanism HciLink uses.

It can perform Asynchronous reads from cache. This is considered to be both complex and inefficient and should be reserved for use with Device data.

As stated above there are a number of attributes within a group that can be used to manage resources used by the client and server. These are the Active flags, the report deadband and the Update Rate. They affect how often the cached data and quality information is updated and how often callbacks are made to the client’s IadviseSink (if an IDataObject connection has been made). Table 2-2 summarizes the behavior of the RAE server and OPC clients with respect to the Group and Item Active flags, and Cache and Device data.

Reads from the device are unaffected by group and/or item active settings.

P/N: 6510020407 3/26/12 2-5

Experion MX OPC Link User Manual RAE HCI/OPC Server

Table 2-2 Behavior of RAE Server and OPC Clients

Function Source Group Item Behavior & Return Codes

SyncRead Cache Active Active The cached Values and Quality for the requested items are returned.

Cache Active Inactive The requested items are returned with the quality flag set to OPC_QUALITY_OUT_OF_SERVICE.

Cache Inactive Active | Inactive

The requested items are returned with the quality flag set to OPC_QUALITY_OUT_OF_SERVICE.

Device Active | Inactive

Active | Inactive

The Values and Quality are obtained by the server from the physical data source and returned to the client.

AsyncRead Cache Active Active The valid cached values for the requested items are sent in the OnDataChange call.

Cache Active Inactive The requested items are sent in the OnDataChange call with the quality flag set to OPC_QUALITY_OUT_OF_SERVICE.

Cache Inactive Active | Inactive

The requested items are sent in the OnDataChange call with the quality flag set to OPC_QUALITY_OUT_OF_SERVICE.

Device Active | Inactive

Active | Inactive

The Values and Quality are obtained by the server from the physical data source and returned to the client in the OnDataChange call.

Refresh Cache Active Active The cached Values and Qualities for all Active items in the group are sent to the client in the OnDataChange call.

Cache Active Inactive The valid cached Values and Qualities for all Active items in the group are sent to the client in the OnDataChange call. Inactive items are not included. If there are no Active Items in the group then server returns E_FAIL on call.

Cache Inactive Active | Inactive

Server returns E_FAIL on call.

Device Active Active First, the Values and Quality are obtained by the server from the physical data source and used to refresh all Active cached values. Then the cached values and qualities for all Active items in the group are sent to the client in the OnDataChange call. (Same as Refresh from Cache)

Device Active Inactive As above. If there are no Active Items in the group then server returns E_FAIL on call.

Device Inactive Active | Inactive

Server returns E_FAIL on call.

Subscription Active Active The values and Qualitiy are obtained by the server from the physical data source for the

3/26/12 P/N: 6510020407 2-6

RAE HCI/OPC Server Additional Features

Active items in the group at the requested Update Rate. If the Quality has changed, the new quality and value are stored. Otherwise the current and previous CACHE values are compared using the DeadBand. If the deadband is exceeded then the new value is stored. If the value or quality of the data has changed from the last value provided to the client then the new value and quality are sent to the client in the OnDataChange call.

Active Inactive Server only acquires values from physical data sources for active items.

Inactive Active | Inactive

Server only acquires values from physical data sources for active items that are contained in active groups.

Note the difference between an AsyncRead and Subscription, quality information is returned for inactive items either at the item or the group level for the AsyncRead, where nothing is provided for the subscription services case (i.e. no callbacks occur). A Refresh forces an OnDataChange callback for all active items when using Subscription regardless of whether the data has changed or not.

Transitions from Inactive to Active will result in a change in quality, and will cause a subscription callback (OnDataChange) for the item(s) affected, a transition to Inactive state does not cause a callback.

2.6. Additional Features

2.6.1. Partial Array Access

In addition to accessing an array, e.g. /recordpath/fieldname, it is possible to directly access an individual element of the array with the following convention /recordpath/fieldname[n] where n is the zero-based index.

2.6.2. ObjectHasChanged Support

It is possible to trigger an ObjectHasChanged notification through the OPC Server. This is accomplished by adding an item with the following syntax ~/recordpath/. A read from this item will always return –1 and its type will always be VT_I4. When a write is performed on the item the value written will be the reason used by the server for the ObjectHasChanged which will occur on the /recordpath/ record.

P/N: 6510020407 3/26/12 2-7

Experion MX OPC Link User Manual RAE HCI/OPC Server

2.6.3. Alias Support

Some clients are not able to handle the rich hierarchical namespace supported by the RTDR, they either have a small finite item name length or cannot handle ‘/’ etc. To facilitate these clients it is possible to set up aliases so that appropriate short names can be mapped to the RTDR locations.

The aliases are exposed through the SQL based HMXConfiguration database, under the [Variable Aliases] table. Entries for this table can be generated by the Configuration browser or entered using HMX Online Link Configuration tool (see Figure 2-3). Also this tool can be used to view and modify the aliases online.

Figure 2-3 HMX Online Link Configuration tool

This tool can be found in C:\Program Files\Honeywell\Experion MX\RAE\Bin\Tools.

3/26/12 P/N: 6510020407 2-8

RAE HCI/OPC Server Additional Features

On double clicking the RtdrPath cell, a Path Selection dialog opens which shows the RTDR hierarchy. Right click on the variable and then click on Update button to refer the RTDR path.

2.6.4. Event Support

The OPC Server can emulate event based behavior. By overloading the group name it is possible to have reads only occur at the occurrence of an RTDR event (ObjectHasChanged) and to trigger events on the completion of a group write. The syntax is as follows:

Groupname:EventId

Where EventId is either an ID from the ID field of the standard events RTDR table or an EventName entry from the [Event Aliases] table in the HmxConfiguration table. Figure 2-4 shows how to configure events using HMX Online Link Configuration tool.

Figure 2-4 ODX Server Events

So an example of requesting data based on End of Scan could be

P/N: 6510020407 3/26/12 2-9

Experion MX OPC Link User Manual RAE HCI/OPC Server

Group_1:MyEos1.

The server does actually poll based on the group update rate (it is suggested a time of 500ms be used for event based reads). It checks for the occurrence of the appropriate event and if it occurs it reads the data and passes the data that has changed since the last event occurrence back through the standard OPC subscription mechanism. The [Event Aliases] table like the [Variable Aliases] table may be updated dynamically at any time.

Similarly using this mechanism the designated event could be triggered by the OPC Server when item(s) have been written to the group. Unlike the ~/recordname/ overloading above, this approach guarantees that all data will have been updated before the event is triggered.

2.7. Configuration

To The RAE Server uses the same registry style configuration as other TPS components. A RAE node ships with the following registry settings

HKEY_LOCAL_MACHINE\\SOFTWARE\\Honeywell\\MyTpsDomain\\HciComponents\\RaeInProcOpcServer\\MethodSecurity\\

HKEY_LOCAL_MACHINE\\SOFTWARE\\Honeywell\\MyTpsDomain\\HciComponents\\RaeOutOfProcOpcServer\\MethodSecurity

Table 2-3 shows the RaeInProcOpcServer / RaeOutOfProcOpcServer keys and value

Table 2-3 OPC Server ID and Value

ID Value

AutoStart No

BaseProgId Hmx.RaeServer_I *

HciPersistentFileSpec

HostName

TPSManaged ByPassSSM

* Depending on whether you are looking at the InProc or OutOfProc server, these fields will read either _I or _O respectively.

In order to improve performance the Server persistently caches all resolved items when they are initially added to a group. When an item is added to a group within the Server, the FastDataRecordRefNum for this item is resolved and placed into the server cache. Any subsequent additions or access to this item will use the cached FastDataRecordRefNum. The server persistently stores this cache in the

3/26/12 P/N: 6510020407 2-10

RAE HCI/OPC Server Configuration

P/N: 6510020407 3/26/12 2-11

file specified by “HciPersistentFileSpec”. It has been found that this feature is not required for the RTDR and due to occasional problems with the integrity of this file we currently suggest not using this option by leaving the HciPersistentFileSpec value blank.

If you have upgraded from a previous version of the OPCServer you should ensure that the HciPersistentFileSpec is set to “”.

Some clients cannot handle the long hierarchical names so we allow for an alias to be provided. This is ideally supported through the HMX Online Link Configuration tool.

3. HCI/OPC Client

3.1. Implementation

The RAE HCI/OPC Client is called HCILink, it can communicate with any OPC Server. It has been successfully used with TPN Server, Alcont TPA OPC Server, EPKS, MxOpen OPC Server and the RAE Server. The client is configured similar to all other links in RAE by populating the LINK table to describe the link. Each link is comprised of groups which contain configuration information and a list of symbols, which will be involved in the read/write transfers.

Once started the link program examines the LINKS table searching for all entries of type HCI. The program exits if no entries are found. On a running client a separate thread is started for each HCI link entry found. For each HCI link definition the program establishes a connection with the OPC Server, creates the necessary groups and after validating the symbols in each group, begins to transfer data. Any symbol in a group that does not get validated correctly will be dropped from the group, so it is important to initially check for errors relating to undefined symbols.

In order to communicate with a server, the server must be registered on the client machine. Since OPC is based on COM the Server ClassID and ProgID must be available for the client. Under normal operation each group will carry out its appropriate read/write operations and the link Status will be 6, for normal run mode. Any errors with a link are logged in the NT event log and the last error code will appear in the Error field for that link. If the link encounters a serious error (e.g. looses communication with the server) then that particular link shuts down and tries to re-establish the connection.

P/N: 6510020407 3/26/12 3-1

Experion MX OPC Link User Manual HCI/OPC Client

3.2. Determining Configured Servers

Running the link with a command line query will show a list of all OPC Servers currently registered on that machine.

3.3. Configuration

Table 3-1 can be used by the clients:

Table 3-1 Link table

Field Name Type Description

Parent[,Name] AsciiField Parent Name (e.g. /Links)

LinkType AsciiField Type of link - HCI

Hostname AsciiField HostName, This is the ProgID of the Server

Timebase LongField Polling time in millisec (e.g. 200). Used by link to check if groups should do any work etc.

Command LongField Command to Link 0 No Command (initial) 1 Stop Link

Status LongField Current Status of Link 0 Host needs to start 1 Host is starting 2 Looking up hostname 3 Connecting to Host 4 Unused 5 Validating symbols 6 Normal run mode 7 Disabled

Error LongField Last error encountered

Long Parameter 1 LongField Used to hold Thread Id

Long Parameter 2 LongField Unused

Ascii Parameter 1 AsciiField Holds optional remote server computer name

Ascii Parameter 2 AsciiField Access level to use when talking to a HCI Server

Tgroup ChildListField List of transfer groups for this link.

Adding records to the TRANSFERGROUP table configures the transfer groups. Each group will correspond directly to an OPC group in the server. Each TransferGroup has a ChildList describing all variables assigned to that group, variables are defined by a symbolname to rtdr path mapping. The parent of the

3/26/12 P/N: 6510020407 3-2

HCI/OPC Client Configuration

transfer groups should be the Tgroup ChildListField in the LINK table. The Transfer Group record describes the type of group and the RTDR records to be used as part of the RTDR subscription/objecthaschanged mechanism. The client supports four basic group types (all writes go directly to the RTDR):

Read On Rate

Read On Event

Write On Rate

Write On Event

Reads can be synchronous from device (SREAD) or asynchronous (READ/EVENT[_AC/_AD]) using Refresh, read from cache or read from device. A Read/Numericate rate creates an OPC subscription.

1. Read on Rate - Data arrives at a fixed periodic rate. For Function = READ this is achieved using the OPC subscription mechanism. The server polls the requested data at the specified rate but only informs the client of items that have changed within that period. This reduces the amount of traffic between the client and server. All data for a group is sent to the client on the initial connection. For Function = SREAD the client performs synchronous reads every n seconds. In both cases the client can optionally cause an RTDR ObjectHasChanged notification to occur any time that new data has successfully arrived; with READ since data is updated on exception this can be used very effectively.

Function = READ or SREAD

TriggerType = NumericRate

Rate Or Reason = n, where n is a number representing the periodic rate in secs (e.g. 2)

*Event Path = Record path to use as target of ObjectHasChanged

*Event Reason = Reason to be used for ObjectHasChanged

2. Read on Event - Read operation is scheduled from an RTDR ObjectHasChanged event. The client subscribes to a particular RTDR record and when signalled issues an OPC Refresh call for TriggerType = EVENT; an asynchronous read from cache for TriggerType =

P/N: 6510020407 3/26/12 3-3

Experion MX OPC Link User Manual HCI/OPC Client

EVENT_AC and an asynchronous read from device for TriggerType = EVENT_AD to perform the read. If Function = SREAD the client issues synchronous read requests each time an event is triggered. In all cases the client can optionally cause an RTDR ObjectHasChanged notification to occur any time that new data has successfully arrived.

Function = READ or SREAD

TriggerType = EVENT[_AC/_AD]

Trigger Variable = Record path specifies the RTDR record to subscribe to.

Rate Or Reason = n, where n is the event reason to use during subscription

*Event Path = Record path to use as target of ObjectHasChanged

*Event Reason = Reason to be used for ObjectHasChanged

All write operations are asynchronous and go directly to the server device. The transfer time for the group is updated after a successful OnWriteComplete callback from the server.

3. Write on Rate - Data is written at a fixed periodic rate.

Function = Write

TriggerType = NumericRate

Rate Or Reason = n, where n is a number representing the periodic rate in secs (e.g. 5)

4. Write on Event - Writes occur based on an RTDR ObjectHasChanged event.

Function = Write

TriggerType = Event

Trigger Variable = RTDR record path that the group subscribes to, write occurs when an ObjectHasChanged occurs on this record with a reason matching that specified in “Rate Or Reason”

Rate Or Reason = n, where n is the event reason to use during subscription

3/26/12 P/N: 6510020407 3-4

HCI/OPC Client Configuration

Any fields not shown above under each group type are not used by that configuration, * indicates optional fields

Table 3-2 shows the TransferGroup

Table 3-2 TransferGroup

Field Name Type Description

Parent[,Name] AsciiField Parent Name

Function AsciiField Read or Write

Trigger Type AsciiField How/When to transfer NumericRate : rate transfer Event: transfer on ojecthaschanged

Trigger Variable AsciiField Used by event transfers. Record path for event reads or event writes.

Rate Or Reason AsciiField Rate in seconds for NumericRate transfer Reason mask for read or write event based groups. Reason mask is a whole number.

Event Path AsciiField RTDR Event to schedule, this is the RTDR record path for reads .

Event Reason LongField Reason for ObjectHasChanged if read Unused by writes

Variable ChildListField List of all variables in this group

Transfer Time DoubleField Time stamp of read/write

Adding records to the HCIVARIABLE Table configures variables. The parent of the HCIVARIABLE table should be the Variable ChildListField in the LINK table. Variables are comprised of two parts, the device name that acts as the target for reads/writes from/to the server and an RTDR path that specifies data path to store/retrieve the value to/from.

Table 3-3 shows all the FieldName with its type

Table 3-3 Variable

Field Name Type Description

Parent AsciiField Parent Name

Symbol Name AsciiField Device symbol name

RTDBPath AsciiField Path to store returned data (reads) Path to outgoing data (writes)

ErrorCnt LongField Updated for every consecutive error on this item. Cleared on the next good operation.

WriteEnable AsciiField Determines if a write can happen on variable. If there is no entry that writes are enabled. If this field is 0/1 then a write on this item is disabled/enabled. If

P/N: 6510020407 3/26/12 3-5

Experion MX OPC Link User Manual HCI/OPC Client

this field points to another field then that field is checked for the 0/1 flag.

Error Code Path AsciiField Path in database to receive the HRESULT for the last operation on this variable.

Quality Code Path AsciiField Path in database to receive the vedor information and QQSSSLL for the last operation on this variable.

3.4. Sample Audit File

The following is an example audit for a HCI Client.

;

; Define the necessary LINK related tables

;

AddTable "LINK"

AddField "LINK","LINKTYPE","AsciiField",0

AddField "LINK","HOSTNAME","AsciiField",0

AddField "LINK","TIMEBASE","LongField",0

AddField "LINK","COMMAND","LongField",0

AddField "LINK","STATUS","LongField",0

AddField "LINK","ERROR","LongField",0

AddField "LINK","LONG PARAMETER 1","LongField",0

AddField "LINK","LONG PARAMETER 2","LongField",0

AddField "LINK","ASCII PARAMETER 1","AsciiField",0

AddField "LINK","ASCII PARAMETER 2","AsciiField",0

AddField "LINK","TGROUP","ChildListField",0

// add table to contain information about a specific transfer

AddTable "TRANSFERGROUP"

3/26/12 P/N: 6510020407 3-6

HCI/OPC Client Sample Audit File

AddField "TRANSFERGROUP","FUNCTION","AsciiField",0

AddField "TRANSFERGROUP","TRIGGER TYPE","AsciiField",0

AddField "TRANSFERGROUP","TRIGGER VARIABLE","AsciiField",0

AddField "TRANSFERGROUP","RATE OR REASON","AsciiField",0

AddField "TRANSFERGROUP","EVENT PATH","AsciiField",0

AddField "TRANSFERGROUP","EVENT REASON","LongField",0

AddField "TRANSFERGROUP","VARIABLE","ChildListField",0

AddField "TRANSFERGROUP","TRANSFER TIME","DoubleField",0

// add table to define odx variables

AddTable "HCIVARIABLES"

AddField "HCIVARIABLES","SYMBOL NAME","AsciiField",0

AddField "HCIVARIABLES","RTDBPATH","AsciiField",0

AddField "HCIVARIABLES","ERRORCNT","LongField",

AddField "HCIVARIABLES","WRITEENABLE","AsciiField",0

;

; Populate the tables

;

AddRecord "LINK",

"PARENT" = "/LINKS,TDC ",

"LINKTYPE" = "HCI",

"HOSTNAME" = "HCI.TPNSERVER",

"TIMEBASE" = "200",

"COMMAND" = "0",

"STATUS" = "0",

"ERROR" = "0",

P/N: 6510020407 3/26/12 3-7

Experion MX OPC Link User Manual HCI/OPC Client

"LONG PARAMETER 1" = "",

"LONG PARAMETER 2" = "",

"ASCII PARAMETER 1" = "\\REMOTE1",

"ASCII PARAMETER 2" = "PROGRAM"

//

// Read On Rate example

//

AddRecord "TRANSFERGROUP",

"PARENT" = "/TDC/TGroup,OneSecRateRead",

"FUNCTION" = "Read",

"TRIGGER TYPE" = "NumericRate",

"RATE OR REASON" = "1",

“EVENT PATH” = “/Completion Record1/”,

“EVENT REASON”=”1”

//

// Read On Event example

//

AddRecord "TRANSFERGROUP",

"PARENT" = "/TDC/TGroup,EventRead",

"FUNCTION" = "Read",

"TRIGGER TYPE" = "Event",

"TRIGGER VARIABLE"= "/Trigger record1/",

"RATE OR REASON" = "1"

//

// Write On Rate example

//

3/26/12 P/N: 6510020407 3-8

HCI/OPC Client Sample Audit File

AddRecord "TRANSFERGROUP",

"PARENT" = "/TDC/TGroup,FiveSecRateWrite",

"FUNCTION" = "Write",

"TRIGGER TYPE" = "NumericRate",

"RATE OR REASON" = "5"

//

// Write On Event example

//

AddRecord "TRANSFERGROUP",

"PARENT" = "/TDC/TGroup,EventWrite",

"FUNCTION" = "Event",

"TRIGGER TYPE" = "/Trigger record1/",

"RATE OR REASON" = "2"

;

; Add some data

;

AddField "/","PA DataTypes",ChildField,0

AddTable "PA list table"

AddField "PA list table","Data","ChildListField",0

AddRecord "PA list table",

"parent" = "/PA DataTypes,PA DataTypes"

AddTable "PA Data"

; ByteField Signed 8-bit integer

; ShortField Signed 16-bit integer

P/N: 6510020407 3/26/12 3-9

Experion MX OPC Link User Manual HCI/OPC Client

; LongField Signed 32-bit integer

; FloatField Single precision (32-bit) floating point

; DoubleField Double precision (64-bit) floating point

; AsciiField ASCII string (single byte character array)

;

AddField "PA Data","ASCII","ASCIIField",0

AddField "PA Data","BYTE","byteField",0

AddField "PA Data","INTEGER","SHORTField",0

AddField "PA Data","FLOAT","FLOATField",0

AddField "PA Data","DOUBLE","DoubleField",0

ADDRECORD "PA Data",

"PARENT" = "/PA DataTypes/data,Data Set 1",

"ASCII" = "PA TEST1",

"BYTE" = "0",

"Integer"= "1",

"Float" = "2.0",

"Double" = "3.0"

ADDRECORD "PA Data",

"PARENT" = "/PA DataTypes/data,Data Set 2",

"ASCII" = "PA1TEST2",

"BYTE" = "1",

"Integer"= "2",

"Float" = "3.0",

"Double" = "4.0"

3/26/12 P/N: 6510020407 3-10

HCI/OPC Client Sample Audit File

;

; Repeat for 3, 4 and 5 etc.

;

//

// OneSecRateRead

//

AddRecord "HCIVARIABLES",

"PARENT" = "/TDC/OneSecRateRead/Variable,loopattr",

"SYMBOL NAME" = "LOOP1.MODEATTR",

"RTDBPATH" = "/PA DataTypes/data set 1/ascii"

AddRecord "HCIVARIABLES",

"PARENT" = "/TDC/OneSecRateRead/Variable,loopsp",

"SYMBOL NAME" = "LOOP1.SP",

"RTDBPATH" = "/PA DataTypes/data set 1/float"

.

.

.

//

// EventRead

//

AddRecord "HCIVARIABLES",

"PARENT" = "/TDC/ EventRead /Variable,Var1",

"SYMBOL NAME" = "LOOP2.VOK",

P/N: 6510020407 3/26/12 3-11

Experion MX OPC Link User Manual HCI/OPC Client

3/26/12 P/N: 6510020407 3-12

"RTDBPATH" = "/PA DataTypes/data set 2/ascii"

AddRecord "HCIVARIABLES",

"PARENT" = "/TDC/EventRead/Variable,Var2",

"SYMBOL NAME" = "LOOP2.PV",

"RTDBPATH" = "/PA DataTypes/data set 2/double"

.

.

.

//

// FiveSecRateWrite

//

AddRecord "HCIVARIABLES",

"PARENT" = "/TDC/ FiveSecRateWrite /Variable,Var1",

"SYMBOL NAME" = "LOOP1.MODE",

"RTDBPATH" = "/PA DataTypes/data set 3/ascii"

AddRecord "HCIVARIABLES",

"PARENT" = "/TDC// FiveSecRateWrite /Variable,Var2",

"SYMBOL NAME" = "LOOP1.SP",

"RTDBPATH" = "/PA DataTypes/data set 3/double"

4. OPC Browser ActiveX Control

RAE ships with an ActiveX component that can be used to browse OPC Servers that support the IOPCServerBrowseServerAddressSpace interface and the OPC_NS_HIERARCHIAL option. The control is based on the standard Microsoft tree control and is written in ATL. The control uses a ProgID of “HMX.OPCBrowseCtrl.1” and appears as “OPCBrowser 1.0 Type Library “ in the insert list.

The control supports two methods:

BrowseOPCServer ([in] BSTR szProgID, [in] BSTR szComputerName), which takes the ProgID of the server you wish to view and the ComputerName of the machine the server is on. This should be NULL to access a server on the local machine.

GetFullOPCPath([out] BSTR* szPath), this returns the fully qualified OPC name for the currently selected item in the tree.

It supports one event:

ReturnFullOPCPath ([in] BSTR szFullPath), which is fired off a right mouse click on an item within the tree. SzFullPath is the fully qualified OPC name for the item that was clicked.

It supports one parameter:

ExpandOnUse – When set to TRUE this causes the tree to only retain the visible items in memory. When a node is collapsed all data/sub nodes beneath that node are removed and will and will re-add when the node is reopened. This has two benefits, (1) the tree appears to load faster since OPC calls are only made when needed and (2) it reduces the memory footprint for the control. When this is FALSE the entire tree is populated on the BrowseOPCServer call, depending on

P/N: 6510020407 3/26/12 4-1

Experion MX OPC Link User Manual OPC Browser ActiveX Control

the server address space and if the server is remote this may take some time.

This control can be used in any container and is built into the RAE BROWSER. If the OPC Browsing option is enabled then the Browser presents a list of all registered OPC Servers on the local machine and provides the ability to list the servers on remote machines. The RAE Browser provides this OPC support if the “raebrwsr.bsf” has the line “@BuildOPCServers” added to the end of the file. The following figures show the OPC capability of the Browser.

Figure 4-1 RAE Browser Displaying Local OPC Servers

Clicking on a particular server will replace the server list on the RHS with the OPCBrowser control and connect it to the server.

3/26/12 P/N: 6510020407 4-2

OPC Browser ActiveX Control Sample Audit File

Figure 4-2 RAE Browser displaying RTDR

P/N: 6510020407 3/26/12 4-3

P/N: 6510020407 3/26/12

5. General COM Issue

This section is primarily intended for developers who may be creating their own OPC client to use with the RAE Server, it is not necessary to understand this section if the HciLink client is been used. For a complete understanding of COM please see the Component Object Model (COM) Specification 0.9.

COM specifies that clients must free all memory associated with ‘out’ or ‘in/out’ parameters, see the IDL file or OPC Specification to determine which parameters are ‘out’ or ‘in/out’. This includes memory that is pointed to by elements within any structures. This is very important since memory leaks will occur if not adhered to. Regardless of success/failure, the server will always return well-defined values for ‘out’ parameters. This means that if the error result is any FAILED error such as E_, the OPC server will return NULL for all `out' pointers. Clients should also be coded to handle RPC_ error conditions.

All methods are guaranteed to be implemented on each required interface. Methods that are not required will return E_NOTIMPL or S_OK depending on the situation. This also applies to any supported optional interfaces. Note: clients should be careful with the use of the SUCCEEDED (hr) macro since this will return TRUE for an S_FALSE condition, it is advisable to check for S_OK explicitly.

All string parameters to the OPC Interfaces are UNICODE. The RAE Server uses the COM Free Threading model. Note that Null strings and Null pointers are not the same things. A NULL pointer is an invalid pointer (0), which will cause an exception if used whereas a NULL string is a valid (non-zero) pointer to a 1-character array where that character is a NULL (i.e. 0).

5-1