OPC Server Support

GainSeeker SPC supports OPC Servers.  Hertzler Systems is a member of the OPC Foundation. Several new template commands have been added to make this support possible.  GainSeeker SPC is the OPC client (the client requests data, the server provides data).  GainSeeker SPC talks to various OPC servers.

The OPC servers typically talk to hardware devices such as PLCs. Thus, the OPC Servers function as both a server (to OPC clients) and client (when asking the PLC for data). The OPC Servers contain groups of tags, or items.  

Each item contains a value and a quality (e.g. the value is good or bad).  Each item also contains a time stamp. It is recommended that you use the local workstation's clock for date/time information.  Some servers do provide a tag containing the date and time, or you can set up your own tag with the clock information if you want to get it from the server instead of the client.

Note:  GainSeeker sometimes produces error messages when trying to read OPC tags that are defined as uint ("unsigned integer", also known as a "word") data types on your OPC server. Best practice is to define numeric tags as long or integer data types on your OPC server.

Receive Mode

There are two options for retrieving data from an OPC Server.  Setting the receive mode lets you pick between the two options.  The first is subscription mode ( Y); the second is synchronous mode ( N).  Following are descriptions of when you might use each of the modes:

When to use subscription mode (receive mode = " Y")

Use the subscription mode when you want to poll OPC items on a frequent basis.  The subscription read method allows your client application to remain responsive because the client isn't polling the server and waiting for data to come back.  Instead, the server is doing the work.  The OPC Server can look at all of the items that have been requested of it and group them together by update rate, proximity of memory addresses, etc. to optimize how it polls the PLC to satisfy subscription requests.  Thus, the OPC Server can manage its priorities to provide optimal performance versus being constantly told what to do by the client, which is what happens with synchronous reads.  When many OPC clients will be communicating simultaneously, the importance of using subscription reads grows.  It is even more important if the PLC network or its protocol is generally slow to begin with.  If you need to have data polled in the PLC or field device at a fixed rate (e.g. 500ms), but you doubt the data will change often, subscription reads are the best use of overall computer, computer network, and PLC network resources.

When you use the subscription mode you should use the OPC_ReceiveValue and OPC_ReceiveQuality commands.  You may set up a channel for subscription mode and still use the OPC_TriggerValue command, but this creates unnecessary overhead.

When to use synchronous mode (receive mode = " N")

Use the synchronous mode when you need to read OPC items on demand, and you only want to read the item a finite number of times, e.g. when a user clicks on a button.  Use it when you want to read an OPC item's value NOW and not take other steps until you are sure the read is done.

When you use the synchronous mode you should use the OPC_TriggerValue and OPC_TriggerQuality commands.

List of known compatible OPC Servers

Following is a list of OPC Servers and their PROGIDs and CLSIDs.  You will need to use either the PROGID or the CLSID when connecting to an OPC Server with the OPC_CONNECT command.  This is a list of the OPC Servers that have been tested with GainSeeker SPC.  There are many other OPC Servers that will be compatible with GainSeeker SPC.  In fact, all OPC Servers should be compatible.  If your OPC Server is not on the list, use the OPC Server browser to test it.  See Using the OPC Server Browser for details.

Company name and Web site

PROGID

CLSID ( GUID)

Axeda FactorySoft

Axeda.com

FactorySoft Modbus OPC DA & AE

Example

{C00A5E02-E208-11d2-98F5-006008198FFA}

Hexatec

Hexatec.com

HexGen

{9AD77340-F693-11d3-B37C-0A398D000000}

 

Iconics

Iconics.com

OPC Simulator Server

{585DED25-936B-11D2-A8DC-00A024C111A3}

 

INGEAR AB OPC server

IngearOPC.com

CimQuestInc.IGOPCAB.1

{8CD3A634-654A-11D3-817F-0000C093E101}

Intellution

Intellution.com

(see Software Toolbox's product listings)

 

(see Software Toolbox's product listings)

IOServer

IOServer.com

IOServer

 

{24c0b5f1-1d30-11d1-90c2-0000e8cdced8}

KEPWare

OpcSource.com

KEPServer Ex

{6E6170F0-FF2D-11D2-8087-00105AA8F840}

Matrikon

Matrikon.com

Matrikon OPC Server for DDE

{F8582D06-88FB-11D0-B850-00C0F0104305}

MetaDynamics

Metadynamics.com

OPCServerX

{53F2A073-2202-41CB-88D2-79EB14D898F5}

Northern Dynamic

Nordyn.com

OPC Server Toolkit V3.0

{1E52DE00-FA5E-11d2-91C6-F8E932000000}

Rockwell

Rockwell.com

RSI.OPCEmulator.1

An example tag format for RS-Linx is:  [PLC5_40]N7:30

{D34EA6E4-9E72-11d1-9736-00C04FD9153E}

Softing

Softing.com

Softing OPC Toolbox Demo OPC DA Server

{2E565242-B238-11D3-842D-0008C779D775}

Software Toolbox

OPCActiveX.Com

SoftwareToolbox.Com

SWToolbox.TOPServer

{6E617103-FF2D-11D2-8087-00105AA8F840}

SST

MySST.Com

SSTech.On.Ca

OPC Simulation Server

{C5123F69-65AA-11D1-AE80-00609703A0D6}

Technosoftware

Technosoftware.Com

OCS Toolkit DA Sample V1.1 (Trace)

{6ba175d1-0970-11d5-81f2-00500418e690}

 

WinTech Software

Win-tech.Com

OPCSimSvr

 

{99b8f471-c027-11d2-80b8-0060975858be}

Even if your OPC Server is in the list, you should check the CLSID with the OPC Server Browser to verify that it is correct.  You should also browse the items (tags) to verify the names.  Remember, most item names are case-sensitive.

Using the OPC Server Browser

You can use the OPC Server Browser to test compatibility of your server with GainSeeker SPC.  To access the browser, pick the Browser utility menu item off the OPC Server menu in the Designer module.

From the browser you can either enter the name of the OPC Server in the Remote host name field or browse for your server by clicking the Browse button.

Once you have selected your server, click the Connect button to begin communicating with it.  The CLSID displayed is the one you will need to use in the OPC_Connect command.

Once connected, you may browse for the Item IDs.  With an Item ID selected, you can read and write data to the item with the Trigger and Write buttons.

Note:  The OPC Foundation has issued a technical bulletin documenting a known issue with browsing for OPC Servers on workstations with Microsoft Internet Explorer 6.0 installed.  The OPC Foundation is trying to find a work-around to the problem.  Previous versions of Microsoft Internet Explorer do not interfere with the browse functionality.  Browsing for items (tags) is not affected by this issue.  Contact Hertzler Systems for additional information..

 

 

 

 

OPC and DCOM

If you want to access an OPC Server on a remote computer, you must configure DCOM (Distributed COM) correctly on both the client and server machines.  The instructions for doing this are listed below.  For a more detailed description, visit the OPC Data Client - Custom Client Development website

Communicating across networks using DCOM

GainSeeker SPC's OPC interface allows you to communicate across networks using Windows NT's Distributed Component Object Model ( DCOM).  Before you can use GainSeeker with DCOM, you must use DCOM Configuration to set application properties, such as security and location.  On the computer running GainSeeker SPC, you must specify the location of the OPC server application (the application which responds to requests from SPC) that will be accessed or started.  For the OPC server application, you must specify the user account that will have permission to access or start the application, and the user accounts that will be used to run the application.

Configuring GainSeeker to use DCOM

Install GainSeeker on one PC (the client PC) and the OPC server on another (the server PC).  

Configure the server PC as follows:

  1. In the Windows Start menu, select Run..., type in dcomcnfg and click on the "OK" button.  This starts the Distributed COM Configuration Properties application.  (For Windows XP, now select Component Services, Computer, and then select your computer.  Next, right click on your computer's icon and select Properties from the menu.)

  2.  In the "Default Properties" tab:

    1. Select "Enable Distributed COM on this computer."

    2. Set the "Default Authentication Level" to "Connect."

    3. Set the Impersonation Level to Identify (default)

  3. In the "Default Protocols" tab:

    1. Make sure that "Connection-oriented TCP/IP" is in the list.

  4. In the "Default Security" tab (for Windows XP, select " COM Security"), for both "Access Permissions" and "Default Permissions":

    1. Click on "Edit Default"

    2. In the "Registry Value Permissions" dialog, click on "Add...".

    3. Select Everyone (or the appropriate subset of users) and click on Add.

    4. Select "SYSTEM" and click on "Add."

    5. Click on "OK" to return to the "Registry Value Permissions" dialog

    6. Click on "OK" to return to the "Distributed COM Configuration Properties" application

  5. In the Applications tab, select the server you want to use (e.g. "Software Toolbox OPC Power Server") and click on the "Properties" button.  (For Windows XP, select your computer, then select DCOM config, then select the correct application and right-click on it to get to the "Properties" menu item.)

  6. In the "(OPC Server name) Properties" dialog box:

    1. In the "Security" tab, select "Use default access permissions" and "Use default launch permissions".

    2. Select "Use custom configuration permissions" but do not edit the settings.

    3. In the "Identity" tab:  Select "The interactive user."  (That is, the user who is currently logged on to the computer.)

    4. In the "General" tab:  Set the "Authentication Level" to "Default".

    5. In the "Location" tab:  Check only "Run application on this computer".

  7. If you want to browse from remote computers for OPC Servers, follow these steps.  In the Applications tab, select " OPCEnum" (or "OPC ServerList Class" on some computers) and click on the "Properties" button.  In the " OPCEnum Properties" dialog box:

    1. In the "Security" tab, select "Use default access permissions" and "Use default launch permissions".

    2. Select "Use custom configuration permissions" but do not edit the settings.

    3. In the "Identity" tab:  Select "The interactive user."  (That is, the user who is currently logged on to the computer.)

    4. In the "General" tab:  Set the "Authentication Level" to "Default".

    5. In the "Location" tab:  Check only "Run application on this computer".

  8. Start the OPC server.

Configure the client PC as follows:

  1. In the Windows Start menu, select Run..., type in dcomcnfg and click on the "OK" button.  This starts the Distributed COM Configuration Properties application.  (For Windows XP, now select Component Services, Computer, and then select your computer.  Next, right click on your computer and select Properties from the menu.)

  2. In the "Default Properties" tab:

    1. Select "Enable Distributed COM on this computer."

    2. Set the "Default Authentication Level" to "Connect."

    3. Set the "Impersonation Level" to "Identify."  (This is the default setting.)

  3. In the "Default Protocols" tab make sure that "Connection-oriented TCP/IP" is in the list.

  4. In the "Default Security" tab (for Windows XP, select "Default COM Security"), for both "Default Access Permissions" and "Default Launch Permissions":

    1. Click on "Edit Default...".

    2. In the "Registry Value Permissions" dialog, click on "Add...".

    3. Select "Everyone" (or the appropriate subset of users) and click on "Add."

    4. Select "INTERACTIVE" and click on "Add."

    5. Select "SYSTEM" and click on "Add."

    6. Click on "OK" to return to the "Registry Value Permissions" dialog.

    7. Click on "OK" to return to the "Distributed COM Configuration Properties" application.

Things to keep in mind when using the DCOM Configuration application:

Files needed for OPC support

There are several files that need to be properly installed and registered in order for the OPC interface to work properly.  All of these files are installed and registered during the GainSeeker installation.

File Name

 Version

OPCDAAuto.DLL

2.0.1.0 or later

OPCProxy.DLL

2.0.0.1 or later

OPCComn_PS.DLL

1.0.0.2 or later

OPCSvrBr.OCX

1.0.0.1 or later

OPCDatX.OCX

1.0.0.1 or later

OPCEnum.Exe

1.0.0.1 (only),  size 60,416 bytes

 

Note:  A bad version of OPCEnum.exe is circulating on the Web.  It is v1.0.0.4.  It does not work correctly and is not authorized by the OPC Foundation.  There also exists a different file size of version 1.0.0.1.  This also works incorrectly.  The correct file size is 60,416 bytes.  GainSeeker installs the correct version of OPCEnum.exe during the installation.

 

 

 

COM errors which may occur with OPC

Below are some typical COM errors that may occur with GainSeeker OPC commands.

Error Number

 Error Description

80004002 or

-2147467262

Interface not supported - if you are trying to browse a server for available tags, the target OPC server does not support Item Browsing.

8007000E or

-2147024882

Not enough memory to complete the requested operation

80070057 or

-2147024809

 The value of one or more parameters was not valid

800706BA or

-2147023174

 Could not find the computer name you specified on the network

C0040001 or

-1073479679

An invalid handle was passed

C0040002 or

-1073479678

 A duplicate parameter was passed where one is not allowed

C0040003 or

-1073479677

The server does not support the specified locale ID

C0040004 or

-1073479676

The server cannot convert between the passed/requested data type and the canonical data type for this item

C0040005 or

-1073479675

The requested operation cannot be done on a public group

C0040006 or

-1073479674

 Item does not allow writes (or reads) - OPC error OPC_E_BADRIGHTS

C0040007 or

-1073479673

The item name requested is not found in the OPC server - check item name

C0040008 or

-1073479672

The item name is blank or does not conform to syntax - check item name

C004000A or

-1073479670

The item's access path is not known to the OPC server

C004000B or

-1073479669

A value passed to WRITE was out of range

 

Anything else

 Unknown error

Sample OPC template

The following is a very basic sample template to interface with an OPC Server.  This template will initialize one channel and connect to the OPC Server.  It will then loop until it gets a good quality value.  Once the quality if good, it will read the data value and then disconnect from the OPC Server.  See Template Commands in the appendices for more information on the commands used in the formulas.

Sample template flow:

  1. Initialize the channel in synchronous mode

  2. Connect to the OPC Server

  3. Read the value

  4. Check the quality of the value

  5. If the quality is not good, re-read the value and re-check the quality

  6. If the quality is good, set Data 1 column to the value

  7. Disconnect from the OPC Server

Sample template for one column:

Cell

Column Heading

Method

Formula

A1

Part Number

Keyboard

No formula

B1

Calculated

Formula

OPC_INIT 1, 1, "Card.Node.I2", -1, -1, "N"

C1

Calculated

Formula

OPC_CONNECT 1, "{C5123F69-65AA-11D1-AE80-00609703A0D6}", "NT_SERVER1"

D1

Calculated

Formula

NVAR 1 = OPC_TRIGGERVALUE 1, 1

E1

Calculated

Formula

IF (OPC_TRIGGERQUALITY 1, 1)  = 192, goto [F1], goto [D1]

F1

Data 1

Formula

NVAR 1

G1

Calculated

Formula

OPC_DISCONNECT 1