Sie sind auf Seite 1von 69

Matrikon OPC Server for Modbus Devices

User's Manual
Matrikon OPC Server for Modbus Devices

Matrikon OPC Server for Modbus Devices - User's Manual

For additional information on this manual, this OPC server, or Matrikon, please contact:
Address: Matrikon
1800, 10405 Jasper Avenue
Edmonton, Alberta, Canada
T5J 3N4
Phone: 780-448-1010
Fax: 780-448-9191
Web: http://www.matrikon.com
Sales: drivers@matrikon.com
Support: support@matrikon.com

CONFIDENTIAL
The information contained herein is confidential and proprietary to Matrikon.
It may not be disclosed or transferred, directly or indirectly, to any third party without the
explicit written permission of Matrikon.
All rights reserved. No part of this document may be reproduced, stored in a retrieval system,
translated, or transmitted in any form or by any means, electronic, mechanical, photocopying,
recording, or otherwise, without prior written permission of Matrikon.

© Copyright 2001
Matrikon Inc.

Page 2 of 69
Matrikon OPC Server for Modbus Devices

TABLE OF CONTENTS
1. Introduction .......................................................................................................................................................................................................................5
1.1 OPC Overview ...............................................................................................................................................................................................................5
1.2 OPC Server Overview.........................................................................................................................................................................................6
2. Getting Started..................................................................................................................................................................................................................8
2.1 Installation .............................................................................................................................................................................................................8
2.1.1 Standard OPC Proxy/Stubs ......................................................................................................................................................................8
2.1.2 Standard OPC Server Browser...............................................................................................................................................................9
2.1.3 Matrikon OPC Common Components ................................................................................................................................................9
2.1.4 Matrikon OPC Explorer................................................................................................................................................................................9
2.1.5 Matrikon OPC Automation Component.............................................................................................................................................9
2.1.6 Installation Options...................................................................................................................................................................................10
2.2 Licensing................................................................................................................................................................................................................10
2.3 Command-Line....................................................................................................................................................................................................13
3. Configuration ..................................................................................................................................................................................................................14
3.1 Starting Up ............................................................................................................................................................................................................14
3.2 Server Configuration ......................................................................................................................................................................................16
3.3 Alias Configuration..........................................................................................................................................................................................18
3.4 Save the Configuration.................................................................................................................................................................................34
3.5 DCOM Configuration.......................................................................................................................................................................................35
3.6 Statistics...............................................................................................................................................................................................................35
3.7 Options ...................................................................................................................................................................................................................35
3.7.1 General.............................................................................................................................................................................................................36
3.7.2 Logging.............................................................................................................................................................................................................36
3.7.3 Advanced ........................................................................................................................................................................................................38
3.8 Shutting Down....................................................................................................................................................................................................38
4. Matrikon OPC Explorer...............................................................................................................................................................................................39
4.1 View Available OPC Servers .......................................................................................................................................................................39
4.2 Connect to an OPC Server............................................................................................................................................................................39
4.3 Add OPC Groups.................................................................................................................................................................................................40
4.4 Add OPC Items ....................................................................................................................................................................................................40
4.4.1 Item ID ...............................................................................................................................................................................................................41
4.4.2 Access Path....................................................................................................................................................................................................41
4.4.3 Browse the Server Address Space ...................................................................................................................................................41
4.4.4 Requested Data Type............................................................................................................................................................................... 42
4.4.5 Active State.................................................................................................................................................................................................... 42
4.4.6 Validate the OPC Items ........................................................................................................................................................................... 42
4.5 Read Real-time Values ................................................................................................................................................................................. 42
4.5.1 Update Rate ................................................................................................................................................................................................... 42
4.5.2 Active State.................................................................................................................................................................................................... 42
4.5.3 Data Display .................................................................................................................................................................................................. 42
4.5.4 I/O Method......................................................................................................................................................................................................43
4.5.5 Time Bias ........................................................................................................................................................................................................43

Page 3 of 69
Matrikon OPC Server for Modbus Devices
4.5.6 Dead-band...................................................................................................................................................................................................... 44
4.5.7 Advise Log....................................................................................................................................................................................................... 44
4.6 Write Control Values...................................................................................................................................................................................... 44
4.7 Options ...................................................................................................................................................................................................................45
4.7.1 General.............................................................................................................................................................................................................45
4.7.2 Data Transfer................................................................................................................................................................................................45
4.7.3 Data Display ..................................................................................................................................................................................................45
4.7.4 COM ....................................................................................................................................................................................................................45
4.8 Save the Session ..............................................................................................................................................................................................45
5. Matrikon OPC Automation Component ............................................................................................................................................................46
6. Troubleshooting ............................................................................................................................................................................................................47
Appendix A - Distributed COM (DCOM) ..........................................................................................................................................................................49
A.1 DCOM Configuration Utility....................................................................................................................................................................................55
A.2 Default Properties......................................................................................................................................................................................................55
A.3 Security Permissions...............................................................................................................................................................................................56
A.4 Server Identity..............................................................................................................................................................................................................58
A.5 Default Protocols........................................................................................................................................................................................................58
A.6 Remote Program ID ...................................................................................................................................................................................................59
Appendix B - OPC Compliance...........................................................................................................................................................................................60
B.1 OPC Server Object .......................................................................................................................................................................................................60
B.2 OPC Group Object........................................................................................................................................................................................................60
B.3 Server Registration....................................................................................................................................................................................................61
Appendix C - OPC Quality Flags .........................................................................................................................................................................................62
Appendix D - VARIANT Data Types....................................................................................................................................................................................64
Appendix E - OPC I/O Methods............................................................................................................................................................................................65
E.1 Synchronous Versus Asynchronous I/O ........................................................................................................................................................65
E.2 Device Versus Cache Reads.................................................................................................................................................................................65
E.3 OPC DA 2.0 versus 1.0a Asynchronous I/O ....................................................................................................................................................66
Appendix F - Alias Configuration ......................................................................................................................................................................................67
F.1 Scaling Expressions....................................................................................................................................................................................................67
F.2 Configuration CSV Format......................................................................................................................................................................................68

Page 4 of 69
Matrikon OPC Server for Modbus Devices
1. INTRODUCTION
The Matrikon OPC Server for Modbus PLCs is an OPC compliant server that enables data
interchange between OPC clients and Modbus PLCs. The server provides read and write access
to all basic PLC register types. As well, the server supports Concept style floating point analog
registers. The following communication methods are currently supported:
The Matrikon OPC Server for Modbus PLCs is an OPC compliant server that enables data
interchange between OPC clients and Modbus compliant PLCs. Each read/write with the PLC is
optimized to maximize throughput. This server includes support for:
• Modbus (using RS-232 Serial)
• Modbus Plus using an SA-85 card
• Modbus Ethernet (TCP/IP) using the Modicon NOE module
• Modbus Master and Modbus Slave configurations
• Modbus ASCII and Modbus RTU (binary) protocols
• Terminal Server
• Read and write access to all PLC register types
• Concept style floating point analog registers

2. SYSTEM REQUIREMENTS
This Matrikon OPC Server has the following minimum system requirements:
• Intel Pentium II 200MHz Processor
• 64 MB RAM
• 25 MB hard drive space
• Microsoft Windows 98 or Microsoft Windows NT 4.0 Service Pack 5 (or higher)

Page 5 of 69
Matrikon OPC Server for Modbus Devices

The server has the following additional requirements:


• For Ethernet communication with Modbus devices: Windows-compatible Ethernet network
card
• For serial communication with Modbus devices: At least one free COM port (RS-232, RS-
485, etc)
• For Modbus+ communication with Modbus devices:
• Schneider Automation SA85 card
• Schneider Automation 32-bit NETLIB driver (catalog number SW-LNET-NT)

2.1 OPC OVERVIEW


OLE for Process Control (OPC) was designed to bridge Windows based applications and process
control hardware and software applications. It is an open standard that permits a consistent
method of accessing field data from plant floor devices. This method remains the same
regardless of the type and source of data.
OPC servers provide a method for many different software packages to access data from a
process control device, such as a PLC or DCS. Traditionally, any time a package needed access
data from a device, a custom interface, or driver, had to be written. The purpose of OPC is to
define a common interface that is written once and then reused by any business, SCADA, HMI,
or custom software packages.
Client Client Client
Application Application Application

OPC Interface

OPC OPC OPC


Server Server Server

Device A Device B Device C

Once an OPC server is written for a particular device, it can be reused by any application that is
able to act as an OPC client. OPC servers use Microsoft’s OLE technology (also known as the
Component Object Model, or COM) to communicate with clients. COM technology permits a
standard for real-time information exchange between software applications and process hardware
to be defined.

2.2 OPC SERVER OVERVIEW


This OPC server follows the requirements of the OPC specification to provide data access to an
OPC client. This server implements OPC Data Access (DA) version 1.0a and 2.0 of the OPC
custom interface.

Page 6 of 69
Matrikon OPC Server for Modbus Devices
Also, the server is optimized for high performance and uses multithreaded technology to provide
efficient response to client requests. This approach allows multiple clients to connect to and
effectively use the resources of a server.
This Matrikon OPC server requires very little configuration after installation. It manages its
communication automatically, providing optimal device polling with no additional configuration
required by the user. This provides a flexible and powerful method to access data that is still
simple to manage.
This OPC server (as all of Matrikon’s OPC servers) is guaranteed to be 100% compliant with the
OPC DA 1.0a and 2.0 specification. In addition, since our applications are sold world wide,
either by vendors or directly by Matrikon, we have developed a comprehensive set of standards
and tools to ensure that our interfaces are:
• Easy to use
• Robust
• Reliable
• Efficient
• Complete with error checking and recovery procedures
The focus of Matrikon is to develop strong long-term relationships with our clients. To that
extent we make it a priority to become familiar with both the business and technical
requirements of all our clients. This enables us to provide innovative services and solutions to
enhance the technology direction selected by our clients within the framework in place today. At
Matrikon we aim to provide solutions to meet your requirements.

Page 7 of 69
Matrikon OPC Server for Modbus Devices
3. GETTING STARTED
This section guides you through the process of setting up a Matrikon OPC Server for real-time
data access. Please follow the instructions carefully to avoid problems.

3.1 INSTALLATION
The installation program for a Matrikon OPC Server comes on either CD-ROM or 3½” floppy
disks. Insert the media in the drive and choose Add/Remove Programs from the Control Panel.
Click Install and follow the instructions from the Installation Wizard.
The installation program copies all necessary files to the target computer, registers the various
software components, and creates short-cut icons in the Start menu.

3.1.1 MATRIKON OPC SERVER FOR MODBUS DEVICES


In addition to the standard Matrikon OPC Server files, the Matrikon OPC Server for Modbus
Devices installs the following files. These files are installed by default in the
MATRIKON\OPC\MODBUS directory under the Program Files folder.

Filename Description
OPCMODBUS.EXE Matrikon OPC Server for Modbus Devices Executable
PSTCFGMODICONLIB.OCX Configuration Panels ActiveX Component

The version-independent program ID for the server is "Matrikon.OPC.Modbus". The version-


specific program ID for this version of the server is "Matrikon.OPC.Modbus.1".
The Matrikon OPC Server for Modbus Devices uses a software key for licensing. Contact
Matrikon at drivers@matrikon.com to obtain the registration code for this server.

3.1.2 STANDARD OPC PROXY/STUBS


In compliance with OPC standards, Matrikon OPC Servers install and register the official OPC
proxy/stub DLL’s in the Windows NT SYSTEM32 directory. These files contain version
information so that they avoid overwriting newer files with outdated ones.

Filename Description
OPC Data Access 2.0 and 1.0a Interfaces Marshalling
OPCPROXY.DLL
Library
OPCCOMN_PS.DLL OPC Common 1.0 Interfaces Marshalling Library
OPC_AEPS.DLL OPC Alarms and Events 1.0 Interfaces Marshalling Library
Vendors were originally required to supply their own version of the OPC proxy/stub.
Unfortunately, this proved to cause conflicts between various versions of the DLL’s
when products from different vendors were installed on the same machine. To solve
Note this problem, the OPC Foundation created official DLLs and they now require that all
vendors install these instead. However, older OPC server installation programs may
still install the old DLLs, preventing new servers from functioning properly. If this

Page 8 of 69
Matrikon OPC Server for Modbus Devices
occurs, simply run a newer installation again to ensure that the official DLLs are
installed.

3.1.3 STANDARD OPC SERVER BROWSER


In compliance with OPC standards, Matrikon OPC Servers install and register the official OPC
Server Browser in the Windows NT SYSTEM32 directory. This file contains version
information to avoid overwriting a newer file with an outdated one. The installation program
also ensures that the ActiveX Interface Marshalling Library is on the target machine so that the
server functions properly.

Filename Description
ACTXPRXY.DLL ActiveX Interface Marshalling Library
OPCENUM.EXE OPC Server Browser

3.1.4 MATRIKON OPC COMMON COMPONENTS


Matrikon OPC Servers require the following files to function properly. These files are installed
by default in the MATRIKON\OPC\COMMON directory under the Program Files folder (except
for EXPREVAL.DLL, which is installed in the SYSTEM32 directory).

Filename Description
PSTCFG.EXE Matrikon OPC Server Configuration Client
PSTCFGPS.DLL Matrikon OPC Server Configuration Marshalling Library
OEM_Matrikon_OPC.DLL Matrikon OPC OEM Badge Library
EXPREVAL.DLL Expression Evaluation Library (for aliases)

3.1.5 MATRIKON OPC EXPLORER


Matrikon OPC Explorer is a general-purpose OPC client that is useful for testing the capabilities
of any OPC server. The file is installed by default in the MATRIKON\OPC\COMMON
directory under the Program Files folder. A shortcut icon for the program is added to the Start
menu (in the common group).

Filename Description
OPCEXPLORER.EXE Matrikon OPC Explorer (General-purpose OPC Client)

3.1.6 MATRIKON OPC AUTOMATION COMPONENT


The Matrikon OPC Automation Component enables developers to access OPC data from client
applications developed using Automation tools such as Visual Basic, VBA, and VB Script. This
component is installed by default in the MATRIKON\OPC\COMMON directory under Program
Files.

Filename Description
Page 9 of 69
Matrikon OPC Server for Modbus Devices
OPCDAAUTO.DLL Matrikon OPC Automation Component

3.1.7 INSTALLATION OPTIONS


Just before the installation program finishes, it offers two additional options. One option
specifies whether the server should be installed as an NT service instead of a local executable.
The other option provides a means to restore the older “ProcessX.OPC.Device” program ID to
retain compatibility for clients that were coded to use earlier versions of the server.

3.2 LICENSING
Most Matrikon OPC Servers require some form of license criteria to be met in order to function
fully. Licensing for a particular server can use either a hardware key or a software key. Without
an authorized license, most servers will run in ‘demo’ mode for a period of two hours or seven
days, depending on the specific OPC server.

3.2.1 HARDWARE KEY LICENSING


For servers requiring hardware licensing, a HASP hardware key coded to the particular server
can be purchased. This key must be securely fastened to the parallel port of the computer on
which the server is installed. It does not interfere with hardware keys from other vendors, nor
does it affect other normal parallel port applications, such as printing.
If a server uses hardware licensing, then the installation program will install a device driver for
HASP keys on the target system. When the server starts up, it will display a message box if it
does not detect the correct key. It will then function for a demonstration period of two hours
before “timing out”. At this point all device communication will cease.

3.2.2 SOFTWARE KEY LICENSING


Matrikon currently uses two different methods of software key licensing. The table below shows
which OPC servers use each method

OPC Server Licensing


Allen Bradley
DDE
Modbus 10-digit licensing
Moore APACS
Simatic TI5

Triconex Trident V2 Request/Authorization licensing

Page 10 of 69
Matrikon OPC Server for Modbus Devices
3.2.2.1 10-DIGIT LICENSING

For servers using this software authorization method, a special ten-digit number is supplied when
the server is purchased. This number must be entered in the Software Registration screen,
available from the About box for the server (see the section on configuration for instructions on
how to access the About box). The About box will include the words “UNREGISTERED
COPY” if the number is missing or incorrect.

Page 11 of 69
Matrikon OPC Server for Modbus Devices
3.2.2.2 REQUEST/AUTHORIZATION LICENSING

For servers using this software authorization method, a software license key is generated that is
specific to the machine on which it is installed. The key is based upon a ‘request’ file that is
generated during the installation process. You must send this request file to Matrikon for
processing, and we return to you an ‘authorization’ file that is used to license the server. The
following steps highlight this process. If you are installing an evaluation version only, refer to
‘When Evaluating” Steps’ section below:

When Purchasing…
1. The installation program prompts you for contact information, plus a transaction number
that you were provided by Matrikon after the purchase of the OPC server.
2. Based on the information provided by you, the installation program generates the license
request file AuthorizeRequest.MTK in the folder where the OPC server is installed.
3. The installation program optionally allows you to create a temporary 7-day license that
allows you to run the server in full function mode immediately, until the authorization
file can be processed by Matrikon. If you do not select this option during installation, you
can enable the 7-day authorization at a later time using the supplied Authorize.exe
application. Refer to Step 6 for more information.
4. After installation, email AuthorizeRequest.MTK to support-license@matrikon.com or call
our support desk and provide us with the details from this file.
5. Matrikon issues you the license authorization file Authorize.MTK by email, which you
copy into the directory where the OPC server is installed. If you do not have email
access, Matrikon can send you physical media or make the file available via FTP access.
6. Once you have the authorization file, run the supplied license authorization program
Authorize.exe, which is located in the OPC server installation directory. The program will
locate and read Authorize.MTK in the current directory, and license your server for
operation.

IMPORTANT: As noted in Step 3, if your run Authorize.exe before you have received
and copied Authorize.MTK into the install directory, you will be allowed a one-time
option to license the server for a 7 day period on the computer. When you later process
Authorize.MTK, the 7 day license option is ‘renewed’ if it was used previously. This
provides you with the ability to get your server running again in cases where a re-
installation is required, and the original authorization file has been lost or corrupted.
7. Make a backup copy of Authorize.MTK.

NOTE: The preceding process is NOT required if you have a site license for your OPC server.
In this case, the server will run immediately without any need for license authorization.

Page 12 of 69
Matrikon OPC Server for Modbus Devices
3.2.2.2.1 RE-INSTALLATION

In cases where you need to re-install the OPC server on the same computer, follow these steps:
1. If you have not yet done so, make a backup copy of Authorize.MTK from the existing
installation directory. See Step 6 if you do not have a backup copy of Authorize.MTK.
2. Uninstall the previous version, if possible.
3. Reinstall the software.
4. Copy the backed up version of Authorize.MTK into the new installation directory
5. Run Authorize.exe again and the server will licensed.
6. If you do not have a copy of Authorize.MTK available, and you need the server to be
functional immediately, simply run Authorize.exe and select the temporary 7-day license
option. Then contact Matrikon during regular business hours for another copy of
Authorize.MTK.

In cases where you need to re-install the OPC server on a different computer, follow the steps
for an original installation, as noted previously in section 3.2.2.2.

3.3 COMMAND-LINE
The installation program registers the Matrikon OPC Server to run as either a local executable or
an NT service (based on user choices) and creates a shortcut in the Start menu. Use this shortcut
to invoke the configuration utility, which will in turn start up the server. For reference purposes,
the command-line parameters for the OPC server executable are as follows.

Parameter Description
/REGSERVER Registers the OPC server to run as a local executable
–REGSERVER (uninstalling the NT service if necessary).
Registers the OPC server to run as an NT service. By default
/SERVICE
the service is set to run as the System account as an
–SERVICE
interactive process.
/UNREGSERVER Removes all registry entries for the OPC server (uninstalling
–UNREGSERVER the NT service if necessary).
Starts up a copy of the OPC server as a local executable. It is
(no parameters) preferable to start the server up from the configuration utility
or another OPC client instead of from the command line.

Page 13 of 69
Matrikon OPC Server for Modbus Devices
4. CONFIGURATION
Matrikon OPC Servers require a very small amount of configuration to function properly. This
section describes how to create a configuration for your OPC Server using the supplied PSTCFG
utility application. It begins with a generic discussion of using PSTCFG, and is followed by
specific details on configuring devices supported by this OPC Server.

4.1 STARTING UP
Choose the appropriate shortcut for the OPC server from the Start menu to invoke the PSTCFG
configuration utility. By default, the shortcut has the name “Matrikon OPC Server for Device”
and appears in “Matrikon OPC/Device” under the common section of the Programs folder.
If the OPC server is not currently running, then it will launch when the configuration utility is
started. If the server runs as a local executable, the splash screen is displayed and then a small
red X appears in the Tool Tray at the right-hand side of the Task Bar. Right-click on the X to
display the following menu.

Click “Show Control Panel” to display the control panel for the server. Double clicking on the X
accomplishes this as well. The control panel displays general statistics for the server, such as the

number of clients currently connected.


The control panel always stays on top of every other window on the desktop so that it can be
used to monitor the server at all times. Double-click on the title bar to make the control panel
“window shaded”. Click the X in the top right-hand corner to hide the control panel.
Click “configure” from the control panel or the pop-up menu to display the main configuration
window for the server. If the server runs as an NT service, the splash screen is not displayed, nor
does the X appear in the Tool Tray. Instead, the main configuration window is displayed
immediately.
Click “about” from the control panel, pop-up menu, or Help menu in the main configuration
window to display the About Box for the server. The About Box contains the server name and
version number as well as other information about the software and Matrikon. It may also
contain a link to a software registration screen for servers that use software licensing.
The shortcut to the configuration utility has the following syntax for command-line options.

Page 14 of 69
Matrikon OPC Server for Modbus Devices
PSTCFG.EXE PSTCFGMatrikon.OPC.Device.# Matrikon.OPC
The second parameter specifies which OPC server is to be configured. A mechanism in
the utility prevents more than one copy of itself from connecting to the same OPC
server.
Note
The main configuration window displays a tree-view of objects configured in the server. Select
an object to display its current configuration, which appears on the right-hand side of the
window.

If the server runs as a local executable, it will remain running even after the main configuration
window is closed, even if no clients are connected. Displaying the control panel or main
configuration window for the server will “lock” it so that it will not shut down while
configuration is being performed.
If the server runs as an NT service, it will remain running so long as there are clients connected
to it. Closing the main configuration window will shut down the configuration utility, but will
not interfere with the normal operation of the server.

Page 15 of 69
Matrikon OPC Server for Modbus Devices
4.2 SERVER CONFIGURATION
Select “Server Configuration” in the tree view and choose Define New… from the Edit menu.
The Insert New Object dialog box appears. Choose the desired type of object from the list and
click OK.
Different objects may be available depending on which object is currently selected in
the tree view.
Note

Once an object is selected, its configuration panel appears. Each type of configurable object has
its own configuration panel allowing users to enter object-specific information. Change the
configuration settings as desired and press OK to create the object.

Three fields are common to all types of object: Name, Description, and Enabled. The Name field
specifies a unique name for the object. It is used later as part of any item ID’s that refer to data

Page 16 of 69
Matrikon OPC Server for Modbus Devices
items under this object. Object names are automatically converted to title case for display
purposes. The Description field can contain up to 63 characters of text for reference purposes.
The Enabled checkbox specifies whether or not communication should be enabled for an object.
Normally it should be checked. It may be useful to disable certain objects, especially if the
devices that they refer to are disconnected or malfunctioning, in order to improve the
performance of communication with the other objects. Real-time values are not available from
disabled objects.
Once an object is created, select it in the tree view and change the settings in its configuration
panel to alter its configuration. Click Apply to accept the changes, or Cancel to discard them. To
remove an object, select it in the tree view and choose Delete from the Edit menu.

It may be useful to change the default settings for a new object to avoid repetitive work. Choose
Defaults from the View menu in order to alter the default settings for available object types.
Simply edit the settings in the various configuration panels and choose OK. The next time an
object of a particular type is created, it will use these default settings for initial values.

Page 17 of 69
Matrikon OPC Server for Modbus Devices
The upcoming section contains further information on the specific types of objects available for
this OPC server, and how to configure them.

4.3 MODBUS ETHERNET DEVICE

Field Description
Specify the Modbus slave address number for the device. Valid
Modbus Address
addresses are 1 to 247.
ASCII Mode Select to use the ASCII protocol instead of the RTU binary protocol.
Confirm Select to read register 0:00001 when connecting to confirm
Connection communication.
Host Name Specify either the host name (from HOSTS file or DNS provider) or
TCP/IP Address the IP address for the device.
Specify the TCP/IP port number for the device. This is usually 502 for
Port Number
Modbus.
Timeout Specify the time limit, in milliseconds, to wait for a response from the

Page 18 of 69
Matrikon OPC Server for Modbus Devices
device.
Specify the additional number of times to re-send a message after
Retries
failing to receive a response.
Specify the time, in seconds, to wait after a communication failure
Delay
before attempting to re-establish a connection to the device.
Max Registers and The maximum number of Analog (register type 3 or 4) data points and
Coil blocks per Digital blocks (16 coils per block, type 0 or 1) that will be read from
Transmission or written to in one Modbus data transmission.

Page 19 of 69
Matrikon OPC Server for Modbus Devices

4.4 MTL 8000 SERIAL DEVICE


This object enables communication with an 8000-series device (serial communication) from
Measurement Technology Limited. This device is a special case and uses its own variation of the
Modbus protocol.

Field Description
Specify the Modbus slave address number for the device. Valid
Modbus Address
addresses are 1 to 247.
Port Computer COM port that you are connecting with.
ASCII/RTU Select to use either the ASCII protocol or the RTU binary protocol
Specify the time limit, in milliseconds, to wait for a response from the
Timeout
device.
Specify the additional number of times to re-send a message after failing
Retries
to receive a response.
Specify the time, in seconds, to wait after a communication failure
Delay
before attempting to re-establish a connection to the device.

Page 20 of 69
Matrikon OPC Server for Modbus Devices

4.5 MODBUS+

4.5.1 SA85 CARD


Field Description
Card Number Specify the SA85 card number (0, 1, 2, or 3).
Modbus+ Address Specify the local Modbus+ address for the SA85 card.

Page 21 of 69
Matrikon OPC Server for Modbus Devices

4.5.2 MODBUS+ DEVICE

Field Description
Specify the Modbus+ routing path for the device, excluding the local
Modbus+ address. Select the checkboxes to expand the size of the
Modbus+ Routing
routing path. The last number should indicate the address for the device
at the end of the route.
Specify the time limit, in milliseconds, to wait for a response from the
Timeout
device.
Specify the additional number of times to re-send a message after failing
Retries
to receive a response.
Specify the time, in seconds, to wait after a communication failure
Delay
before attempting to re-establish a connection to the device.

Page 22 of 69
Matrikon OPC Server for Modbus Devices

4.6 MODBUS SERIAL

4.6.1 SERIAL PORT


Field Description
Port Specify the serial COMM port.
Baud Rate Regular serial communications baud rate
Data Bits Regular serial communications data bits
Parity Regular serial communications parity
Stop Bits Regular serial communications stop bits
Specify the time limit, in milliseconds, to wait for a response from a
Timeout
device.
Specify the additional number of times to re-send a message after failing
Retries
to receive a response.
Specify the time, in seconds, to wait after a communication failure
Delay
before attempting to re-establish a connection to a device.

Page 23 of 69
Matrikon OPC Server for Modbus Devices

4.6.2 SERIAL PORT (ADVANCED)

Field Description
DSR Flow Control Set data set ready flow control on or off
DSR Sensitivity Set data ser ready sensitivity on or off
CTS Flow Control Set clear to send flow control on or off
XON/XOFF Flow
Set XON/OFF flow control on or off
Control
RTS Control Disable or enable request to send
DTR Control Disable or enable data terminal ready

RTS Rise Delay Request to send rise delay


RTS Drop Delay Request to send drop delay

Page 24 of 69
Matrikon OPC Server for Modbus Devices

4.6.3

4.6.4 MODBUS SERIAL DEVICE


Field Description
Specify the Modbus slave address number for the device. Valid
addresses are 1 to 247. If Address is set to 0, writing to this PLC will
Modbus Address
cause a Modbus broadcast message to go out to all PLCs on the
communications port, writing to all devices simultaneously.
ASCII Mode Select to use the ASCII protocol instead of the RTU binary protocol.
Confirm Select to read register 0:00001 when connecting to confirm
Connection communication.
Specify the additional number of times to re-send a message after failing
Retries
to receive a response.
Specify the time, in seconds, to wait after a communication failure
Delay
before attempting to re-establish a connection to the device.
Max Registers and The maximum number of Analog (register type 3 or 4) data points and
Coil blocks per Digital blocks (16 coils per block, type 0 or 1) that will be read from or
Transmission written to in one Modbus data transmission.

Page 25 of 69
Matrikon OPC Server for Modbus Devices

Page 26 of 69
Matrikon OPC Server for Modbus Devices

4.7 MODBUS UDP

4.7.1 UDP PORT


Field Description
Host Name
Host name or TCP/IP address of device to connect to.
TCP/IP Address
Port Number Port number of device to connect to.
Specify the time limit, in milliseconds, to wait for a response from a
Timeout
device.
Specify the additional number of times to re-send a message after failing
Retries
to receive a response.
Specify the time, in seconds, to wait after a communication failure
Delay
before attempting to reestablish a connection to a device.

Page 27 of 69
Matrikon OPC Server for Modbus Devices

4.7.2 MODBUS UDP DEVICE


Field Description
Specify the Modbus slave address number for the device. Valid
Modbus Address
addresses are 1 to 247.
ASCII Mode Select to use the ASCII protocol instead of the RTU binary protocol.
Confirm Select to read register 0:00001 when connecting to confirm
Connection communication.
Max Registers and The maximum number of Analog (register type 3 or 4) data points and
Coil blocks per Digital blocks (16 coils per block, type 0 or 1) that will be read from or
Transmission written to in one Modbus data transmission.

Page 28 of 69
Matrikon OPC Server for Modbus Devices

Page 29 of 69
Matrikon OPC Server for Modbus Devices

4.7.3 MODBUS TCP/IP TERMINAL SERVER TCP/IP CONNECTION


Field Description
Hostname or IP Choose one of these to specify the network location of the Terminal
address Server.
Specify the TCP/IP port that the terminal server allows programs to
Port Number
connect to.
Port Computer COM port that you are connecting with.
Specify the time limit, in milliseconds, to wait for a response from the
Reply Timeout
device.

Page 30 of 69
Matrikon OPC Server for Modbus Devices

4.7.4 MODBUS TCP/IP TERMINAL SERVER PLC


Field Description
The Modbus address of the PLC you are connecting to. Valid
addresses are 1 to 247. If Address is set to 0, writing to this PLC will
Modbus address
cause a Modbus broadcast message to go out to all PLCs on the
communications port, writing to all devices simultaneously.
The number of times to retry a failed or garbled command before
Retries
failing
If disconnected from the RTU, how long to wait until a reconnection
Reconnect Delay
attempt is made.
Max Registers and The maximum number of registers or coils read in bulk. Setting this to
Coil Blocks per 0 will allow the program to choose the largest optimal number for
Transmission TCP/IP terminal servers.

Page 31 of 69
Matrikon OPC Server for Modbus Devices
4.8 ALIAS CONFIGURATION
Matrikon OPC Servers provide the ability to create user-defined aliases that can be used in place
of regular OPC items. This is particularly useful when the item path for a given server is very
complex or difficult to remember (i.e. "DEV0.98.76.5.4321=AI.CV"). Servers can also be
configured so that client applications have access to configured aliases only, rather than every
available item.
You can also use Aliases to create ‘holding registers’ by leaving the Item Path value blank. In
this case, the alias acts as a generic Read/Write variable for all clients connecting to the OPC
server. When using the Alias in this matter, you must explicitly define the data type when you
create the alias point, rather than using 'Default' data type, OR, define the data type when
writing/read values from the Alias via an OPC client, rather than using the Default data type.
To create an alias, select "Alias Configuration" in the tree view, choose Insert Alias Group from
the Edit menu, and enter a name for the group. It is usually better to create aliases in groups
rather than directly under the root. Select the newly created group and choose "Insert New Alias"
from the Edit menu.

In the "Insert New Alias" dialog box, enter a name for the alias and the item path (item ID) for
the OPC item that it references. Click the ellipsis button to browse for available item ID's on the
server. Click Save to save the alias, or click "Save & Create New" to configure another one.
Select the “Default to new” checkbox to make the “Save & Create New” button the default
control when you press Enter, rather than Save. Double-click an existing alias or press Enter
while it is selected to change its settings.

Page 32 of 69
Matrikon OPC Server for Modbus Devices

Additional options available when creating an alias are as follows. The Data Type drop-down
box allows the user to specify a "canonical" data type for the alias. The OPC item value is
coerced to this data type prior to being sent to the client. The Read-only checkbox prevents client
applications from writing to this item. The Update Rate and "Poll when inactive" fields work
together to ensure that data for the item is always received at a particular rate even if it is not
being read by the client.
Certain standard scaling formulas may also be applied to the alias. Click the button marked
"Scaling >>" to display the scaling portion of the dialog box. Click the tab corresponding to the
desired type of scaling and fill in the parameters as needed. Click "<< No Scaling" to hide the
scaling portion. When the scaling portion is not visible, no scaling is applied to the alias.
The four available types of scaling are Linear, Square Root, Gain/Offset, and Expression. For
each type of scaling, a different algorithm is applied to the incoming value before it is passed on
to the client. A reverse algorithm is applied to any values written to the alias before they are
passed on to the OPC item.

Scaling Algorithm Reverse Algorithm


æ Scaled High − Scaled Low ö æ Raw High − Raw Low ö
Linear (x − Raw Low )çç ÷ + Scaled Low
÷
(x − Scaled Low )çç ÷ + Raw Low
÷
è Raw High − Raw Low ø è Scaled High − Scaled Low ø

æ Scaled High − Scaled Low ö æ Raw High − Raw Low ö


x − Raw Low ç ÷ + Scaled (x − Scaled Low )2 çç ÷ + Raw
è (Scaled High − Scaled Low )
Square Root ç Raw ÷ Low 2 ÷ Low
è High − Raw Low ø ø

x − Offset
Gain/Offset Gain ⋅ x + Offset
Gain

Expression i.e. “SQRT(INPUT) + 5” i.e. “(OUTPUT – 5) * (OUTPUT – 5)”

Both Linear and Square Root scaling use the same parameter. Enter the high and low range for
the expected raw values and their corresponding high and low scaled values. Optionally, select
the corresponding checkboxes to "clamp" the value to its high or low limit to prevent it from

Page 33 of 69
Matrikon OPC Server for Modbus Devices
going out of range. Gain/Offset is a special type of linear scaling where only a scaling factor and
offset need to be specified (no limits are assumed). Incoming values must be numeric for these
scaling types to work.
Expression scaling provides the ability to enter simple text equations to be applied to incoming
and outgoing values. Enter the equation to be applied to incoming values in the Input field and
enter the equation to be applied to outgoing values in the Output field. Click one of the ellipsis
buttons to bring up the expression wizard to assist with the creation of a formula. See the Annex
for further information about expression syntax.
Select an alias group in the tree view to display the aliases configured in that group. The name,
item path, data type, access rights, and update rate for each alias are listed in the right-hand side
of the window.

The alias database can be exported to and imported from comma-delimited text files (CSV).
Choose Export Aliases from the File menu and choose a file location to export the current
configuration. Choose Import Aliases from the File menu and choose the desired file to import
aliases into the current configuration. See the Annex for a description of the alias CSV file
format.

Important Caveats:
1. You should specify a variant type (e.g. VT_UI2, VT_I4) when requesting data from
an alias; by default, a scaled alias becomes a variable of type REAL.
Note 2. Using Square Root scaling is not recommended for signed numbers. If the square
root expression becomes negative, the alias will return –1, bad quality.
3. Using illegal expressions, such as zero for the (high-low) range, may be fatal to the
OPC server, client, or communications.
4. It may be possible to make a configuration unloadable by using illegal expressions.
If this occurs, the OPC server may fail on startup. If it does, rename the
configuration save file to something else so that the OPC server will not load it on
startup, and create a new configuration file, or edit the XML file (if it is in XML) to
correct the bad alias settings.

4.9 SAVE THE CONFIGURATION


Once the server and alias configuration is complete, be sure to save the settings to disk. Choose
Save from the File menu and enter a file name and location. Choose New to clear the
configuration. Choose Load and select a file in order to restore the settings contained in that file.
See the section on the Options dialog for a description of how to set the server to load a
configuration file automatically at start-up.

Page 34 of 69
Matrikon OPC Server for Modbus Devices
4.10 DCOM CONFIGURATION
Choose DCOM Configuration from the Tools menu to edit DCOM settings in order to allow
clients on remote computers to connect to the server. DCOMCNFG is a standard Microsoft
utility and can be started from the command-line as well.
DCOM security settings are stored in the registry and loaded by COM when a server
starts up. Therefore, the OPC server must be shut down and restarted for DCOM
configuration changes to take effect. See the later section on Distributed COM for
Note further information on this subject.

4.11 STATISTICS
Select an object in the tree view under “Server Configuration”. If the statistics panel is not
already showing then choose Statistics from the View menu. The statistics panel appears just
below the object tree view. It displays any communication statistics that are supported for the
selected object. Different objects supply different statistics as appropriate. The possible values
are as follows.

Statistic Description
Sent The number of messages (requests) sent to the device.
Received The number of messages (responses) received from the
device.
Timed Out The number of timeout periods that have elapsed waiting for a
response.
Retried The number of messages re-sent to the device.
Failed The number of failed transactions (due to timeouts or
communication errors).
Overrun The number of times that the program failed to get a response
from the device before it needed to send out the next request.
Statistics can be useful for troubleshooting communication problems. If the server stops
supplying data for items under a particular device then check the statistics for that device to see
if any problems are occurring (such as Time Outs, Overruns, or Failures). Many device
configurations support tuning parameters for communication such as time out intervals and
maximum number of retries. Changing some of these settings may help to overcome
communication problems.
Click the “Reset Statistics” button at the bottom of the Statistics panel or choose “Reset
Statistics” from the View menu in order to reset the counters for the selected object to zero. The
displayed statistics are updated roughly once every second.

4.12 OPTIONS
Choose Options from the View menu to change the advanced options for the server. These
values are stored in the registry and loaded by the server at start-up. Therefore, the server must
be shut down and restarted in order for changes in this dialog to take effect. Click the Defaults
button to restore the original settings for the server.

Page 35 of 69
Matrikon OPC Server for Modbus Devices
4.12.1 GENERAL
The General tab contains settings related to the configuration of a server. Select the “Load
configuration on start-up” checkbox and enter a filename in the edit box below it to have the
server automatically use the specified configuration file when it is launched. Click the ellipsis
button next to the edit box to browse for the file. Select the “Save current configuration on
shutdown” to have the server automatically save any changes to the configuration when it shuts
down (not usually needed).

Select the “Launch configuration program on start-up” checkbox to have the server automatically
spawn the configuration utility when it starts up as a local executable. Otherwise, the
configuration utility will have to be started manually from the Start menu. The configuration
utility must always be started manually when the server runs as an NT service.
Select the “Restrict items to pre-configured aliases only” checkbox to prevent client applications
from connecting to anything except for configured aliases in the server. When this box is
selected, client applications will not be able to access any “raw” OPC items. This may be useful
for security reasons.

4.12.2 LOGGING
All Matrikon OPC Servers produce log files that record errors and debugging information. If
difficulties occur with a server then the log files can be extremely valuable for troubleshooting.
By default, the servers log very little information. The Logging tab of the Options dialog
contains settings to control server logging.

Page 36 of 69
Matrikon OPC Server for Modbus Devices

General Activity Logging records information about the internal workings of the OPC server. It
is useful for troubleshooting problems with configuration and device communication. Select the
“Enable activity logging” checkbox and choose the desired log level from the drop-down box.
Available log levels include Medium, Low, and None.
The higher the log level, the more information is recorded. However, server
performance may decrease at higher log levels. The recommended operating level is
Low.

Note
Enter a filename in the edit box or click the ellipsis button to browse for a file location. The
default log file is “PSTCFGMatrikon.OPC.Device.#.LOG” in the MATRIKON\COMMON
directory under the Program Files folder. Select the “Overwrite old log information” checkbox to
overwrite this file each time the server starts up. Otherwise, it will rename the old file to start
with an underscore.
Select “Display activity log on screen” to show the log messages in a console window as they
occur. This may have a negative effect on server performance especially at higher log levels.
Interface Activity Logging records information about the client/server OPC communication. It is
useful for troubleshooting compliance issues. Select the “Enable logging” checkbox and choose
the desired log level. The server will generate a separate log file for each client named
“PST###.tmp” in the directory where it is installed. Interface Activity Logging is not generally
used.
Select the “Commit all log file writes” checkboxes for either log file to ensure that its buffer is
flushed each time a message is logged. This can be useful when a fatal error that causes the
server program to crash is occurring regularly. However, it is not recommended for normal
operation as it greatly decreases the performance of the server.

Page 37 of 69
Matrikon OPC Server for Modbus Devices
More log levels are available for both types of logging which record more detailed information.
Contact Matrikon Technical Support for further instructions on how to enable the higher log
levels.
The Matrikon OPC Delegator is a useful tool for logging OPC client/server communication. It
enhances the server Interface Activity Logging by loading up in the client application and
recording the client-side transactions. It can also be used with other OPC servers. Contact the
Matrikon Sales department for further information about this product.

4.12.3 ADVANCED
The Advanced tab contains some special timing parameters sometimes used to improve the
performance of certain OPC servers. It is not usually a good idea to alter these settings unless
asked to do so by support staff. They have very little effect on device communication.

The first edit box specifies the minimum update rate that the server will allow for any OPC
group. This prevents client applications from requesting update rates that are impossible to
achieve or that cause heavy CPU loads. The default value is 100ms.
The second and third edit boxes work in conjunction to break up the scanning of items in large
groups with slow update rates in order to reduce CPU load. For every “OPC Items per Group
Scan (maximum)” number of items scanned, the scanning thread will pause for “OPC Group
Scan Pause (maximum)” number of milliseconds. The default values are zero, indicating that no
pause occurs in the scan loop.

4.13 SHUTTING DOWN


Click “shutdown” from the control panel, pop-up menu, or Shutdown Server from the File menu
to shut down the server if it runs as a local executable. A warning will appear if clients are
currently attached to the server. The shutdown command is not available for the server if it runs
as an NT service. Services can only be shut down from the Service Control Manager applet (in
the Windows NT Control Panel).

Page 38 of 69
Matrikon OPC Server for Modbus Devices
5. MATRIKON OPC EXPLORER
Matrikon OPC Explorer is a general-purpose OPC client. It is included with all Matrikon OPC
Servers to ensure that users always have a reliable means to test the capabilities of the software.
Choose Matrikon OPC Explorer from the Start menu, directly under the Programs folder, to start
the program.

5.1 VIEW AVAILABLE OPC SERVERS


Matrikon OPC Explorer is an OPC client application. It connects to OPC server applications and
displays real-time values as they are received. When OPC Explorer starts up, it searches the
registry on the local computer and generates a list of program ID’s for available OPC servers. It
displays this list in a drop-down box at the top left-hand corner of
the window.
Every OPC server has a unique program ID. This is a human-
readable text string that is converted to a globally unique
identification number which COM then uses to identify the server.
Each server may have a version-specific program ID (with a
number appended to the end of the string), a version-independent
program ID (no number), or both. All Matrikon OPC Servers have
both types, but only the version-independent program ID shows up in the list.
If an error occurs during the communication session between OPC Explorer and an OPC server,
a message box appears explaining this. Click the Details button to get a more descriptive
explanation of the error. Deselect the “Disconnect Server” checkbox to ignore the error and
continue without disconnecting from the server. Choose Error Log from the View menu to
display a log of past errors. Right-click on the window and choose “Clear Log” to clear the log.

5.2 CONNECT TO AN OPC SERVER


Select a program ID in the drop-down box. Choose Connect from the Server menu and then
choose either Local or Remote. The Local option will connect to a server running on the same
machine as the client while the Remote option will attempt to connect to an OPC server running
on another machine.
In the latter case, use the “Connect Remotely” dialog box to specify the remote machine. Remote
machines may be specified by UNC (i.e. “\\SYSDEV1”), DNS (i.e. “www.matrikon.com”), or IP
address (i.e. “198.162.0.1”). See the section on DCOM configuration for instructions on how to
configure OPC servers to receive remote connections.
COM will attempt to launch the OPC server if it is not currently running when the first client
attempts to connect to it. If the server runs as a local executable then COM will run it. If the
server runs as an NT service then COM will start it up.
Similarly, when the last client application disconnects from an OPC server, the server will shut
down. Matrikon OPC Servers wait for one minute before shutting down to avoid unnecessary
processing when client applications connect and disconnect frequently.

Page 39 of 69
Matrikon OPC Server for Modbus Devices
5.3 ADD OPC GROUPS
Choose “Add Group” from the Server menu to create a new OPC group on the connected OPC
server. Enter a name for the group. If the edit box is left blank then the OPC server will assign a
unique name for the group. Change the other settings as desired and click OK to create the
group. Choose Properties from the Group menu to change these settings after the group is
created. See the section on reading real-time values for a further explanation of what these
settings do.

5.4 ADD OPC ITEMS


An OPC groups serves as a logical collection of data items. Choose “Add Items” from the Group
menu to display Tag Studio – a utility for creating, validating, and adding OPC items.

To create an OPC item, enter an item ID in the edit box and click the right-pointing arrow. The
item appears in the list box on the right-hand side of the window. Double-click on an item to edit
its settings (the appearance of the arrow changes). Choose “Update and Return to Explorer” to
add the created items to the OPC group and return to Matrikon OPC Explorer.
In addition to an item ID, users can also specify an access path, a requested data type, and an
active state. The following sections describe these settings in further detail.

Page 40 of 69
Matrikon OPC Server for Modbus Devices
5.4.1 ITEM ID
All OPC items must be identified by an item ID. This identifier is a server-specific string of
characters that uniquely identifies a source of data to an OPC server. More than one OPC item
may refer to the same item ID at the same time. Enter the item ID in the Item ID edit box. Click
the button next to this edit box to bring up the Tag Generator – a utility for creating large
numbers of tags that follow a known pattern.
Some examples of item ID’s might be “PLC1.4:0001”, “North:FIC101/CV”,
“\\ARCSVR:DBTAG001”, etc. Check Appendix A for information about the specific syntax of
the item ID’s.

5.4.2 ACCESS PATH


Some OPC servers may allow clients to specify an access path in addition to an item ID. An
access path may suggest to the server how it should get the data for a particular item. For
example, it might specify the method of communication to use for accessing the data (i.e. radio,
satellite, or modem).
Servers are under no obligation to use the access path, although they will return errors if the
access path is invalid. Click the ellipsis button next to the Access Path edit box to browse the
access paths that are available for the selected item ID (if the server supports this feature).
Matrikon OPC Servers do not use access paths. Leave the access path blank if it is not used.

5.4.3 BROWSE THE SERVER ADDRESS SPACE


Some OPC server support browsing as a means of isolating users from the exact syntax of its
item ID’s. Browsing allows users of OPC clients to view the “contents” of a server to find a
particular data item and resolve it into a valid item ID. It is not primarily intended for auto-
generating OPC items. If the OPC server supports browsing then a tree view and list view appear
in tag studio.
The tree view displays “branches” in a hierarchical address space, while the list view displays the
“leaves” that are available under the selected “branch”. Each “leaf” either represents an actual
item or else it may provide a “hint” indicative of available items. For example, if there are
thousands of numbered items under a “branch”, the server might simply provide a single “leaf”
representing the range of numeric addresses available.
While browsing, the user may apply a number of filter criteria to search for a particular type of
item. The syntax of the filter is vendor-specific, but the algorithm recommended by the OPC
Foundation follows the same pattern as the Visual Basic “Like” function with respect to item
names. For example, “A*” filters out any item names that do not begin with the letter “A”. This
filter may also apply to branches.
Items may also be filtered by data type and access rights. Choosing a type other than
Empty/Default causes the browser to display only those items with the same canonical data type
as that selected. Access rights are non-exclusive. For example, selecting write access and
deselecting read access will display only items that can be written to, regardless of their read
accessibility. Selecting both should filter nothing out.
Double-click on a “leaf” and Tag Studio will place the fully qualified item ID for that item in the
edit box. If the item ID is a “hint” then change it to a “real” item, following the pattern provided
by the hint. Alternatively, right-click on the item and choose “Add to Tag List” to add the item
using the previous item’s settings. “Add All Items to Tag List” adds every item under the branch.

Page 41 of 69
Matrikon OPC Server for Modbus Devices
5.4.4 REQUESTED DATA TYPE
All OPC items have a native (“canonical”) data type. That is to say, there is a default format to
the data that the server supplies for an item. When creating OPC items, client applications can
specify a requested data type for each item. The OPC server will attempt to covert any data from
the item to this format if possible. If the requested and canonical data types are incompatible,
then the server will fail to validate the item when it is added.

5.4.5 ACTIVE STATE


Like groups, OPC items may be active or inactive. See the section on reading real-time values
for more information about this setting.

5.4.6 VALIDATE THE OPC ITEMS


Choose “Validate Tags” from the File menu to check the created items for validity. Tag Studio
will query the OPC server to determine whether the items are correct. A small red X next to an
item indicates that it did not validate properly. A green checkmark indicates that the item is
valid. A blue question mark indicates that the item has not been validated yet.

5.5 READ REAL-TIME VALUES


Once items are added to an OPC group, Matrikon OPC Explorer continually updates the display
for that group with real-time data. The data values appear in the list view on the right-hand side
of the window. Each item is listed along with its item ID, access path, active state, value, quality,
and timestamp.
When there are a number of groups created on an OPC server, use the group list view to navigate
between different groups and to view the items in those groups. Use the drop-down box to
navigate between the groups on different server connections.

5.5.1 UPDATE RATE


The OPC server tries to keep Explorer informed with values for an OPC group at the requested
update rate for that group. If the requested update rate is too fast for the server to handle then it
will return a revised update rate that it will use instead. Internally, the server tries to keep the
data items at least as “fresh” as indicated by the update rate. However, the server will send
values to the client no faster than the update rate in order to avoid overwhelming it.

5.5.2 ACTIVE STATE


OPC servers only update values for active items in active groups. When an individual item is set
inactive, the server stops sending updates for the item. When a group is set inactive, the server
stops sending values for any items in that group. Client applications (such as HMI applications)
can help to reduce the processing load on an OPC server by deactivating groups and items that
are not currently needed.
Choose Activate/Deactivate from the Group or Item menus at any time to change the active state
of an OPC group or individual OPC items.

5.5.3 DATA DISPLAY

Page 42 of 69
Matrikon OPC Server for Modbus Devices
Although the OPC server may supply data changes to Matrikon OPC Explorer at the update rate
of the group, a global setting specifies the refresh rate for the display in OPC Explorer. Choose
“Update Speed” from the View menu and select one of the four available options: High, Normal,
Low, or Paused. If the update speed is “Paused” then the user will have to refresh the display
manually (F5).

In the item display, the Value field shows the real-time value for the item. The Quality field
indicates whether or not this value is valid, and why (see the annex for a list of quality values).
The Timestamp field indicates how “fresh” the value is (the time that it was received from the
data source).
The information panel at the bottom of the window displays status information about the selected
server and group. Choose “Info Panel” from the view panel to hide and show this panel.

5.5.4 I/O METHOD


Matrikon OPC Explorer allows the user to specify the method of communication to use with a
group. Synchronous I/O is generally reserved for testing and special operations. Explorer also
allows the user to choose between the 1.0a or 2.0 style of asynchronous I/O. The normal
recommended setting is “Asynchronous I/O”, which attempts to use 2.0 first, and 1.0a if that
fails.

5.5.5 TIME BIAS


Some OPC client applications may use the OPC server time bias setting as a storage area for
time zone information. This information might be used to display server timestamps in a time
zone other than UTC or the local time zone. Matrikon OPC Explorer does not use this
information, but allows the user to write the information to the server as a test.

Page 43 of 69
Matrikon OPC Server for Modbus Devices
5.5.6 DEAD-BAND
Some OPC servers support dead-band for updates from analog data sources. The dead-band
value is a percentage of full-scale deflection and so the high and low limits for the item must be
known ahead of time. Dead-band only affects updates between an OPC client and a server. It has
no effect on communication between an OPC server and its respective device(s).

5.5.7 ADVISE LOG


Choose Advise Log from the View menu to display a log of ongoing I/O transactions. Right-
click on the window and choose “Clear Log” to clear the log. Use the options to keep the
window above all other windows in the desktop and to keep the most recent entry visible at all
times.

5.6 WRITE CONTROL VALUES


Matrikon OPC Explorer allows the user to write control values to items in an OPC group. Select
the desired items in the list view and choose “Write Values” from the Item menu. In the dialog
box, enter the control values to be written in the “New Value” column. Specify the data types of
for the control values in the “Data Type” column. Use the checkboxes to avoid writing to
individual items. When ready, click the OK or Apply button to perform the write.

Control values may be written to items regardless of whether they or the group that they
are in are active or inactive. If the items and the group containing the items are both
active then the written control value should appear when the next update occurs. Also,
Note some OPC servers may contain read-only item. Values written to these items will be
discarded.
Matrikon OPC Explorer also contains a Signal Generator to write ramping control values to OPC
items. Choose the “Signal Generator” tab in the “Write Values” dialog box. Enter the high and
low limits and the increment factor for the ramp wave. Finally, enter the time period in
milliseconds and press Start. Press Stop or close the dialog box to finish writing the ramp wave.

Page 44 of 69
Matrikon OPC Server for Modbus Devices
5.7 OPTIONS
Choose Options from the View menu to display the Options dialog box. Users can change certain
aspects of OPC Explorer’s behavior with these options. Click the Defaults button to restore the
original settings

5.7.1 GENERAL
Use the Errors checkboxes to specify whether the error dialog box should be displayed when
COM or OPC errors occur, or when errors occur for individual items. The sanity check option
ensures that the OPC server keeps track of lists of groups and items properly. At present, session
files may only be stored as text files, so the binary format is unavailable.

5.7.2 DATA TRANSFER


Use the Data Source radio button to specify the data source that OPC Explorer should use when
requesting values from the OPC Server. The data source should be CACHE for normal
operation. Only use DEVICE for special testing operations. DEVICE reads yield a serious
performance penalty and can prevent OPC servers from functioning properly if they are used too
often.
For 1.0a asynchronous I/O, select the “Request time stamps with notification” to receive
timestamps from the OPC server. Otherwise, OPC Explorer will assume the current time when it
receives new values.
Select “Request asynchronous refreshes” to use asynchronous refresh transactions when updating
the display. When grayed, OPC Explorer will use synchronous reads for 2.0 I/O or asynchronous
reads from CACHE for 1.0a I/O when updating the display. When unselected, OPC Explorer
simply receives values passively from the server.
Select “Respect access rights when writing values” to avoid including read-only items in the
Write Values dialog box. Otherwise, OPC Explorer will allow users to write values to any items.

5.7.3 DATA DISPLAY


Select “Display value qualities as text” to show a text description of the item quality in the
Quality field. Otherwise, OPC Explorer will display a numeric value. You might want to do the
latter if the quality value contains vendor-specific information in the upper byte. Deselect
“Display timestamps using local time zone” to display the timestamps in UTC rather than local
time.

5.7.4 COM
Use these checkboxes to specify the class context flags to be used when OPC Explorer attempts
to connect to an OPC server. Do not deselect any of these flags unless absolutely necessary.

5.8 SAVE THE SESSION


Choose Save from the File menu and enter a file location to save the current session
configuration, including all server connections, groups, and items. These session files may be
reloaded by choosing Open from the File menu and reselecting the saved file. Choose “New
Session” from the File menu to clear the session.

Page 45 of 69
Matrikon OPC Server for Modbus Devices
6. MATRIKON OPC AUTOMATION COMPONENT
The Matrikon OPC Automation Component enables developers to access OPC data from client
applications developed using Automation tools such as Visual Basic, VBA, and VB Script.
Developers should be proficient in Visual Basic before trying to use this component.
To use the component through early binding, add the “Matrikon OPC Automation 2.0” type
library to the list of references in the project. The objects supplied by the component appear
under “OPCAutomation” in the Object Browser. To create an OPCServer object through late
binding, call the CreateObject function with the program ID “Matrikon.OPC.Automation”.
Please refer to the OPC Data Access 2.0 Automation Interface Standard for more information
about the automation objects.

Page 46 of 69
Matrikon OPC Server for Modbus Devices
7. TROUBLESHOOTING
The following sections address some of the most common problems encountered while using this
OPC server. Please check the following list before contacting Matrikon Technical Support.
• Problem: The OPC server stops updating the client with item values after two hours.
Solution: The OPC server is licensed with a hardware key, and the demonstration period for
the server has expired. Check that the correct HASP hardware key is securely fastened to the
parallel port. If it is, run the HINSTALL program that is located in the
MATRIKON\COMMON directory under Program files with the “/I” parameter.
• Problem: The OPC server shuts down automatically after 5 minutes when no clients are
connected.
Solution: This is standard behavior for COM servers. However, you can override this
behavior as follows:
- In the registry, locate HKEY_CLASSES_ROOT\PSTCFGMatrikon.OPC.{server
name}.1\CLSID\ and obtain the class ID of the OPC server.
- In HKEY_CLASSES_ROOT\CLSID\{class ID of OPC server}\Options create a
string value named “LockServer”. To create a new value, select the Options key, and
then select Edit\New\String Value from the Registry menu.
- Set the value of the LockServer entry to “1”. To edit the value, select the entry and
select Edit\Modify from the Registry menu.
Eg. Simulation server’s CLSID is {F8582CEE-88FB-11D0-B850-00C0F0104305}

• Problem: There is more than one HASP hardware key from Matrikon attached to the
parallel port, but only the first one is recognized by the software.
Solution: HASP keys from the same vendor can not be chained together. Send an email to
technical support (please refer to the beginning of this manual) to obtain a HASP key
containing the combined codes of all installed Matrikon OPC servers.
• Problem: The server cannot be configured because there is no red ‘X’ in the System
Tray.
Solution: If the server is running as a service, you will not see the usual red ‘X’ in the system
tray that indicates the OPC server is running. To configure the server, start the configuration

Page 47 of 69
Matrikon OPC Server for Modbus Devices
utility by using the shortcut to the OPC server in the Start Menu (this shortcut starts the
Configuration utility as well as the OPC server).
• Problem: How do I remove the OPC server as a service?
Solution: Un-register and reregister the OPC server file, see the “Getting Started” section
under Command-Line for more information.
• Problem: Does the server need to be started manually when it is installed as a service?
Solution: No, the first OPC client that tries to connect will start the OPC server.
• Problem: The OPC client is unable to create or read items under a configured object
(device).
Solution: Check the object configuration. Ensure that the Enabled checkbox is selected.
• Problem: The OPC server does not retain its previous settings and needs to be
reconfigured each time it starts up.
Solution: In the configuration utility, choose Options from the View menu. Under the
General tab, ensure that the "Load configuration on startup" checkbox is selected and that the
correct file name appears in the edit box. See the section on configuration for more
information.
• Problem: The OPC server can not save the configuration in XML format.
Solution: Microsoft Internet Explorer 4.01 (or later) must be installed to use the .XML
format. If you do not have this software, you can still save the configuration in .PXC format,
which is the original Matrikon format.
• Problem: The OPC server does not show up in a list of locally available program ID's in
my OPC client application.
Solution: Make certain that the OPC server is installed by a user with local administrative
rights so that it can make the necessary entries in the registry. Also, especially for older OPC
clients that do not use the OPC Server Browser, make certain that the client is running as a
user that has read access to the registry.
• Problem: The OPC server does not show up in a list of remotely available program ID's
in my OPC client application.
Solution: Follow the steps found in the section on DCOM configuration to copy the program
ID from the server machine to the client machine.
• Problem: "Access Denied" error or time out trying to connect to a remote OPC server
via DCOM.
Solution: Ensure that the access and launch permissions for the OPC server are set correctly
on the server machine. See the Annex on DCOM for more information.
• Problem: A client tries to connect to the server and fails, or the server does not start up.
Solution: Ensure that the access and launch permissions for the OPC server are set correctly.
See the Annex on DCOM for more information.
• Problem: The splash screen and configuration utility do not show up when a remotely
connecting client or a client that runs as an NT service (such as Aspentech’s CIMIO
OPC Manager) tries to launch the OPC server.
Page 48 of 69
Matrikon OPC Server for Modbus Devices
Solution: Either set the identity for the OPC server to the interactive user, or else consider
run the server as an NT service. See the section on DCOM for more information.
• Problem: After installing an older OPC server, DA 2.0 asynchronous I/O no longer
works.
Solution: The old installation program installed and registered its own (older) version of the
OPC proxy/stub DLL. Reinstall the standard OPC proxy/stub DLL's using an up-to-date
installation program or re-register them using the REGSVR32 command-line utility. See the
section on server installation for more information.
• Problem: How can I get OPC data into Microsoft Excel, Microsoft Word, or another
application with support for Visual Basic, VBA, or VB Script?
Solution: Use the Matrikon OPC Automation Component to create a Visual Basic script that
connects to a server, creates groups and items, and receives data change updates. See the
installed files for examples of how to do this in Excel, Visual Basic, or an HTML document.
• Problem: How can I access individual bits from an integer item?
Solution: Create an alias that references the desired item and configure scaling for the alias to
use expression evaluation. Edit the input expression to use binary math to access a particular
bit (i.e. “IF((INPUT AND 4)=4, 1, 0)” to access bit 2). This method allows read access only.
• Problem: If using hardware key – I don’t think the server can find my hardware key
Solution: Try running the hasp.exe utility under C:\Program Files\Matrikon\OPC\Common\.,
a small dialog will pop up. With the hardware key plugged into the printer port on the back
of the computer, select “Check key” from the utilities menu. If an error message pops up (ie:
There is a problem with the hardware key setup), then there is a problem reading the
hardware key. You should see something like “GCOM OPC Server” in the dialog.

Page 49 of 69
Matrikon OPC Server for Modbus Devices
Appendix A - ITEM ID SYNTAX
A.1 GENERAL SYNTAX
Item ID’s for the Matrikon OPC Server for Modbus Devices use the following general syntax.
[PORT.]DEVICE.X:YYYYY{D|F|U}{S}{/ZZ}

Field Description
Name of the SA85 Card, Serial Port, or UDP Port under which the Modbus
PORT
device appears. Not required for Modbus Ethernet or MTL 8000 Serial devices.
DEVICE Name of the Modbus device.

Modbus register file number. Not all devices support all file types.

File Type Description Size Read Write


0 Digital Output Coil 1 bit ü ü
1 Digital Input Coil 1 bit ü
X 3 Analog Input Register 16 bits ü
4 Analog Output Register 16 bits ü ü
Non-Standard Analog Input
3W 32 bits ü
Register *
Non-Standard Analog Output
4W 32 bits ü ü
Register *
Modbus register address. Possible range is from 1 to 65535. The actual range
YYYYY
depends on the Modbus device configuration for the particular register file type.
Append a “D” to the end of an item ID to indicate that the 3X or 4X register
pairs up with the next register to form a 32-bit integer. For example, 4:00000D
D
reads the least significant word from 4:00000 and the most significant word
from 4:00001.
Append an “F” to the end of an item ID to indicate that the 3X or 4X register
F
pairs up with the next register to form a 32-bit IEEE floating-point real.
Append a “U” to the end of an item ID to indicate that the 3X or 4X register
U
should be treated as an unsigned rather than a signed 16-bit integer.
Append an “S” to the end of an item ID after a “D” or an “F” to swap the word
S order from the default (least significant word in lowest address) to reverse
format (most significant word in lowest address).
Append a forward slash followed by an integer to the end of an item ID to
access an individual bit in a 3X or 4X register. The valid range for the bit index
ZZ
is 0 to 15, or 0 to 31 if the “D” modifier is specified. These items are always
read-only.

Page 50 of 69
Matrikon OPC Server for Modbus Devices

* Registers 3W and 4W are provided in case your unit does not conform to standard Modbus
design. They should only be used if your Modbus unit uses the non-standard larger 32-bit
registers. Since 32-bit register design is not part of the standard Modbus protocol, we cannot
claim to successfully support this mode for any particular device.

Page 51 of 69
Matrikon OPC Server for Modbus Devices

A.2 EXAMPLES
Consider the sample configuration pictured in this image. Valid item ID’s for this configuration
might include the following.

Item ID Description
DO coil 56789 on Modbus+ device “Device1” (SA85 card
Card1.Device1.0:56789
“Card1”)
DI coil 43210 on Modbus+ device “Device2” (SA85 card
Card1.Device2.1:43210
“Card1”)
Com1.Rtu1.3:1 AI register 1 on serial device “Rtu1” (port “Com1”)
Com1.Rtu2.4:2 AO register 2 on serial device “Rtu2” (port “Com1”)
AI register 12345 on UDP device “Device1” (port “Udp1”) as a
Udp1.Device1.3:12345D
32-bit integer (paired with register 12346)
AO register 6789 on UDP device “Device2” (port “Udp1”) as a
Udp1.Device2.4:06789F
32-bit IEEE floating-point real (paired with register 6790)
AI register 3 on device “Mtl8000-1” as an unsigned 16-bit
Mtl8000-1.3:3U
integer
AO register 10 on device “Mtl8000-1” as a 32-bit integer with
Mtl8000-1.4:10DS the words swapped (register 11 contains the least significant
word)
AI register 7 on device “Ethernet1” as a 32-bit IEEE float-point
Ethernet1.3:7FS real with the words swapped (register 8 contains the least
significant word)
Ethernet1.4:9/0 Bit 0 of AO register 9 (least significant)

Page 52 of 69
Matrikon OPC Server for Modbus Devices
Bit 16 of AI register 16 as 32-bit integer (actually bit 0 of
Ethernet1.3:16D/16
register 17)
Bit 32 of AO register 20 as 32-bit integer (actually bit 15 of
Ethernet1.4:20DS/31
register 20 since the words are reversed)

Page 53 of 69
Matrikon OPC Server for Modbus Devices
Appendix B - PERFORMANCE
1872 3X or 4X registers per second
29952 0X or 1X coils per second

Page 54 of 69
Matrikon OPC Server for Modbus Devices
Appendix C - DISTRIBUTED COM (DCOM)
DCOM is an object protocol that enables COM components (such as OPC clients and servers) to
communicate directly with each other across a network. A certain amount of configuration is
required on the system where the OPC server is installed to allow remote clients to connect to it
over the network.
The following steps are suggestions only. Ask your Windows NT System
Administrator for more information about the settings that you should use, especially
between different domains.
Note
C.1 DCOM CONFIGURATION UTILITY
Start the DCOM configuration utility either from the server configuration utility or from the
command-line (DCOMCNFG). Answer "Yes" to any message boxes that appear, allowing the
utility to assign application ID entries to those servers that don't already have them.
The main window for DCOMCNFG allows the user to either configure default settings for all
COM servers or else to configure settings for a specific server chosen from the list. The former
will affect all servers configured to use the default settings. The latter will affect the selected
server only.

DCOM settings are stored in the registry and loaded by COM (and OPC) servers at
start-up. Therefore, server processes must be shut down and restarted in order for these
changes to take effect.
Note

C.2 DEFAULT PROPERTIES


The Default Properties tab contains settings that affect all DCOM communication on the
machine. First of all, ensure that the "Enable Distributed COM on this computer" is selected in
so that the machine is available to others via DCOM. Select the "Enable COM Internet Services
on this computer" to allow DCOM access to the machine from the Internet (check with your
administrator). In general, the other settings do not need to be changed.
The Authentication Level specifies when COM should authenticate the identity of calling clients
(each call, each packet, etc). Normally, it should be set to "Connect", indicating that COM
should authenticate clients when they first connect to a server. If it is set to "None" then COM
performs no authentication and ignores any access permission settings.
The Impersonation Level specifies whether servers can ascertain the identity of calling clients
and whether they can then perform operations on the client's behalf (as if the server is the client).
Normally, it should be set to "Identify", allowing the server to identify the calling client to see if
it is allowed access to a certain resource but not to actually access any of these resources as the
client.
Select the "Provide additional security for reference tracking" to make even the reference
counting on COM objects secure. This setting is not generally required.

Page 55 of 69
Matrikon OPC Server for Modbus Devices
C.3 SECURITY PERMISSIONS
The most important DCOM settings for an OPC server are the security permissions. Change the
default settings (not recommended) and make sure that the OPC server will use these or else
change the specific settings for the server (recommended). Either way, make certain that the
access and launch permissions for the server are correct.
To set the security permissions for an OPC Server first open the DCOM configuration utility.
After it is open click on the OPC server and then click Properties.

Click on the Security tab to set the Security for the Server.

Page 56 of 69
Matrikon OPC Server for Modbus Devices
The Access Permissions contain an Access Control List of principals that are allowed to interact
with objects supplied by a server. The Launch Permissions contain an Access Control List of
principals that are allowed to start up a server process or service. Include the names of users or
user groups from trusted domains that you wish to be able to use the OPC server on this
machine. Include the "Everyone" group to allow access to all users on a particular domain.
To set the Access permissions you would click “Use custom access permissions” and then click
edit. A screen similar to the following will appear:

To add users to the list click Add. Another screen similar to the following appears:

To add a user to the list click on that user and then click Add. If the user you wish to add does
not appear then click Show Users. When you are done adding users click OK to close “Add
Users and Groups”. You can then choose to “Allow Access” or “Deny Access” for each user.

Page 57 of 69
Matrikon OPC Server for Modbus Devices
The procedure to set the launch permissions is similar to the above, but instead of choosing
“Allow Access” for a user you would choose “Allow Launch”.
The Configuration Permissions contain an Access Control List of principals that are allowed to
modify the configuration information for a server. In other words, it indicates who is allowed to
alter the registry entries for installed servers as well as who is able to access the registry for the
purposes of installing new servers. It is usually simpler to install and configure servers as a user
with local administrative rights.
To connect to an OPC server from outside of the domain create a local user account on both the
server and the client machine with identical username and password. Then add the local user on
the OPC server to the DCOM permissions. Then use the local account on the client machine to
connect to the OPC server.

C.4 SERVER IDENTITY


The Identity tab for a selected COM (or OPC) server specifies the user account that should be
used when COM starts up the process. The available settings are different for servers that run as
local executables as opposed to those that run as NT services.
It is strongly recommended that OPC server should be installed to run as NT services if
they are going to be accessed by remote clients via DCOM. This ensures that the server
can always be accessed, even if no one is presently logged on to the machine, and only
Note one server process ever starts up. It also adds a greater degree of security in terms of
who is able to shut down the server process.
Servers that run as local executables have the option of running as the launching user (the calling
client –this is the default), the interactive user (the one currently logged onto the machine), or a
specified user. It is usually best to use the interactive user or a specified user. Otherwise, remote
clients might start up multiple separate server processes that are not accessible to others.
Servers that run as NT services should generally run as the local System account. Alternatively,
the server can be set to run as a specified user, although this is usually done from the Service
Control Manager applet rather than DCOMCNFG. Access and Launch permissions are
particularly important when installing a server to run as an NT service.

C.5 DEFAULT PROTOCOLS


The Default Protocols tab specifies the communication protocols available to DCOM. The order
that protocols appear in the list indicates the priority in which they will be used (the topmost
having the highest priority).
The more protocols that appear in the list, the better the chances of connecting to an OPC server
on an unknown remote machine (such as at an OPC Interoperability Workshop). However, it
may also take longer for DCOM to time out if a server machine is not present since it has to try
each protocol in turn.
For most situations it is best to remove all unused protocols from the list and only include those
that are necessary for your network. For example, on a TCP/IP network one would include the
"Connection-oriented TCP/IP" protocol. Contact your IT personnel for more information about
your network.

Page 58 of 69
Matrikon OPC Server for Modbus Devices
Evidence indicates that there are problems with the datagram-oriented protocols that
can cause memory leaks in DCOM. Therefore, it is strongly recommended that these
protocols not be used in the list of default protocols. Datagram-oriented protocols are
Note not supported under Windows 2000 (although the DCOM configuration utility allows
you to configure them).

C.6 REMOTE PROGRAM ID


Before the OPC Server Browser became available, OPC client applications had to search the
registry to generate a list of available OPC servers. Therefore, some older OPC clients need to
have a program ID in the local registry in order to connect to a particular OPC server.
The simplest solution is to install the OPC server software on the client machine even if it is not
used. Alternatively, use the following steps to copy a program ID to the client machine.

This method may not work for every OPC client. Please check the client documentation
for more information.
Note
1. On the server machine, run REGEDIT as a user that has access rights to the local registry.
2. Expand the HKEY_CLASSES_ROOT key.
3. Find the program ID(s) for the desired OPC server(s). In the case of Matrikon OPC Servers,
the ID has the form "Matrikon.OPC.Device". If you quickly type the first few letters then
REGEDIT should jump to the location of that key. Some servers may have both a version-
specific as well as a version-independent program ID. In this case both ID's should be copied
to the client machine.
4. For each program ID, select the key and choose "Export Registry File" from the Registry
menu. Enter a file name and choose Save. Be careful not to overwrite other export files that
you are creating.
5. Copy the exported REG files to the client machine.
6. Merge the REG files into the registry of the client machine. This should simply be a matter of
double clicking on the file from the desktop of the client machine. Alternatively, run
REGEDIT on the client machine and choose "Import Registry File" from the Registry menu,
selecting each file in turn. This must be done as a user who has write access to the local
registry.
7. Use REGEDIT to check that the program ID's have in fact been copied.
8. Delete the REG files since they are no longer needed.

Page 59 of 69
Matrikon OPC Server for Modbus Devices
Appendix D - OPC COMPLIANCE
All Matrikon OPC Servers comply fully with the OPC Data Access 2.0 Custom Interface
Standard. They also support some of the optional capabilities, including backward-compatibility
for the old style of asynchronous communication found in the 1.0a specification. The following
provides a technical description of supported features. Optional interfaces appear in square
brackets ([]).

D.1 OPC SERVER OBJECT


Interface Notes
ü IUnknown
ü IOPCCommon Locales Supported: English (United States)
ü IOPCServer
[IOPCServerPublicGroups] Public groups not supported.
ü [IOPCBrowseServerAddress Hierarchical, no access paths.
Space]
[IPersistFile] (not required)
ü IConnectionPointContainer
ü IConnectionPoint Multiple connections allowed.
(IOPCShutdown)
ü IOPCItemProperties All servers support the six OPC-specific properties. Some
may also support other standard or custom properties.

D.2 OPC GROUP OBJECT


Interface Notes
ü IUnknown
ü IOPCItemMgt
ü IOPCGroupStateMgt
[IOPCPublicGroupStateMgt] Public groups not supported.
ü IOPCSyncIO
ü IOPCAsyncIO2
ü IConnectionPointContainer
ü IConnectionPoint Multiple connections allowed.
(IOPCDataCallback)
ü [IOPCAsyncIO] (1.0a) Data streams support simple data types, strings, and one-
dimensional arrays of simple data types and strings.
ü [IDataObject] (1.0a) Multiple connections allowed for all three formats.

Page 60 of 69
Matrikon OPC Server for Modbus Devices
D.3 SERVER REGISTRATION
In compliance with the OPC and COM specifications, Matrikon OPC Servers make the
following registry entries under HKEY_CLASSES_ROOT when registered on a target system.
These entries are removed when the server is unregistered.

Registry Key Value


Matrikon.OPC.Device Matrikon OPC Server for Device
Matrikon.OPC.Device\CLSID {CLSID1}
Matrikon.OPC.Device\CurVer Matrikon.OPC.Device.#
Matrikon.OPC.Device\OPC\Vendor Matrikon Consulting Inc (780) 448-1010
http://www.matrikon.com
Matrikon.OPC.Device.# Matrikon OPC Server for Device
Matrikon.OPC.Device.#\CLSID {CLSID1}
CLSID\{CLSID1} Matrikon OPC Server for Device
CLSID\{CLSID1}\APPID {APPID}
CLSID\{CLSID1}\DefaultConfig (initially empty)
CLSID\{CLSID1}\ProgID Matrikon.OPC.Device.#
CLSID\{CLSID1}\VersionIndependantProgID Matrikon.OPC.Device
CLSID\{CLSID1}\LocalServer32 (path to server executable)
PSTCFGMatrikon.OPC.Device.# Matrikon OPC Server for Device
PSTCFGMatrikon.OPC.Device.#\CLSID {CLSID2}
PSTCFGMatrikon.OPC.Device.#\ShellPath (path to PSTCFG.EXE)
PSTCFGMatrikon.OPC.Device.#\HelpFile (path to .HLP file, if it exists)
CLSID\{CLSID2} Matrikon OPC Server for Device
CLSID\{CLSID2}\APPID {APPID}
CLSID\{CLSID2}\ProgID Matrikon.OPC.Device.#
CLSID\{CLSID2}\LocalServer32 (path to server executable)
APPID\{APPID} Matrikon OPC Server for Device
Matrikon OPC Servers also register themselves with the Microsoft Standard Component
Category Manager. After ensuring that the OPC 1.0 and 2.0 categories exist, the servers register
in both of these categories. The OPC Server Browser searches for servers that implement these
categories.

Page 61 of 69
Matrikon OPC Server for Modbus Devices
Appendix E - OPC QUALITY FLAGS
The OPC quality flags represent the quality of an item’s data value. The lower byte is a bit-field
used to convey standard quality values. The high byte is available for vendor-specific use
complementary to the standard values. The following table lists the range of valid quality values
(ignoring the vendor-specific bits). Please refer to the OPC DA 2.0 specification for further
information.

Binary Decimal Definition Description


The value is bad (no specific
00000000 0 Bad, Non-specific reason).

There is some server-specific


00000100 4 Bad, Configuration Error
problem with the configuration.
The input should to be logically
00001000 8 Bad, Not Connected connected to something but is
not.
A device failure has been
00001100 12 Bad, Device Failure
detected.
A sensor failure has been
00010000 16 Bad, Sensor Failure detected. The value may be
00010001 17 + Low Limit “pegged” as indicated by the
00010010 18 + High Limit limit field.
00010011 19 + Constant

Communications have failed.


00010100 20 Bad, Last Known Value The item value represents the
last known.
Communications have failed.
00011000 24 Bad, Comm Failure
There is no last known value.
The block is off-scan or
00011100 28 Bad, Out of Service otherwise locked, or the group
or item is inactive.
The value is uncertain (no
01000000 64 Uncertain, Non-specific
specific reason).
Whatever was writing this value
01000100 68 Uncertain, Last Usable Value has stopped doing so. The value
is “stale”.
Uncertain, Sensor Not The value may be “pegged” at
01010000 80
Accurate one of its limits or it is detected
01010001 81
+ Low Limit as being out of calibration.
01010010 82
+ High Limit
Binary Decimal Definition Description

Page 62 of 69
Matrikon OPC Server for Modbus Devices
01010100 84 Uncertain, EU Exceeded The returned value is outside of
01010101 85 + Low Limit the engineering unit limits
01010110 86 + High Limit defined for this parameter.
01010111 87 + Constant
The value is derived from
01011000 88 Uncertain, Sub-normal multiple sources, an insufficient
number of them are GOOD.
The value is good (no specific
11000000 192 Good, Non-specific
reason).
The value has been overridden
11011000 216 Good, Local Override and forced to a manually entered
setting.

Page 63 of 69
Matrikon OPC Server for Modbus Devices
Appendix F - VARIANT DATA TYPES
The following is a list of the constant numeric values for VARIANT data types.

Value Data Type Description


0 VT_EMPTY Default/Empty (Nothing)
2 VT_I2 2 byte signed integer
3 VT_I4 4 byte signed integer
4 VT_R4 4 byte real
5 VT_R8 8 byte real
6 VT_CY currency
7 VT_DATE date
8 VT_BSTR text
10 VT_ERROR error code
11 VT_BOOL Boolean (TRUE = -1, FALSE = 0)
17 VT_I1 1 byte signed character
18 VT_UI1 1 byte unsigned character
19 VT_UI2 2 byte unsigned integer
20 VT_UI4 4 byte unsigned integer
+8192 VT_ARRAY Array of values (i.e. 8200 = array of text values)

Page 64 of 69
Matrikon OPC Server for Modbus Devices
Appendix G - OPC I/O METHODS
The following sections contain a more detailed description between the different I/O methods
available from OPC servers. Please refer to the OPC DA 2.0 specification for further
information.

G.1 SYNCHRONOUS VERSUS ASYNCHRONOUS I/O


All OPC compliant servers must provide two distinct methods for real-time data access. OPC
clients can choose between synchronous and asynchronous I/O for their operations. All OPC
servers must support both synchronous I/O and at least one form of asynchronous I/O (2.0 or
1.0a) to be compliant. These terms only refer to communication between the client and the
server, and not between the server and its data source.
Synchronous operations are blocking calls made to an OPC server to either read or write a group
of OPC items. When an OPC client makes a synchronous call, it passes control to the OPC
server and does not continue processing until the call is complete. Synchronous operations are
only ever used for testing, special operations (generally involving DEVICE reads), or in
extremely simple OPC clients.
Asynchronous operations are non-blocking. OPC Client applications establish "call-back"
objects to which the OPC server can interface to deliver item updates. Once this "call-back" is
established, the OPC server continually informs the client of changes in value to OPC items as
they occur, being careful not to exceed the OPC group update rate and potentially overwhelm the
client.
OPC clients may also create asynchronous "transactions" to perform non-passive operations.
These transactions include reading from DEVICE, refreshing of all active items in an active
group, and writing control values. Once the client creates a transaction, it can carry on processing
until the OPC server informs it that the transaction is complete through the client's "call-back"
object. The server also returns an ID number when a transaction is created so that the client can
try to cancel it if it is taking too long.
Asynchronous I/O is the normal preferred method for continuous real-time data access.
However, synchronous I/O can be useful for scenarios involving infrequent or "one-shot" data
access operations.

G.2 DEVICE VERSUS CACHE READS


When an OPC client creates a group and adds items to it, the OPC server attempts to retrieve
values for active items from its source of data. Internally, it maintains a data "cache", which it
attempts to update at least as fast as indicated by the update rate of the group. The server
optimizes regular communication with its source of data for best performance while keeping the
cache "fresh".
However, the need may arise to retrieve real-time values directly from the data source, by-
passing the regular optimization routines of the CACHE and the time delays they might impose.
OPC provides the means to do this using DEVICE reads through either synchronous or
asynchronous I/O.
DEVICE reads may be performed at any time on specific items in a group. They ignore the
update rate and active state of the group or items involved. Due to the fact that they by-pass

Page 65 of 69
Matrikon OPC Server for Modbus Devices
normal optimization routines, reads from DEVICE should be used sparingly as they may incur a
severe performance penalty in the server.
A scenario where a synchronous read from DEVICE might be useful is in the case of a utility for
altering a series of set points in a device. The client application might create an inactive group
with the desired items and perform a DEVICE read it. When the call completes, the item values
are as current as possible. The utility can then display the values, allow the user to alter them,
and synchronously write them out to the device. This could be followed by a second DEVICE
read to ensure that the values were written.
Had a DEVICE read not been used, it could take some time before the server receives the first
values for the group after it is activated. Additionally, there is no guarantee that the values would
all arrive in the same update. A DEVICE read ensures that the values all arrive at the same time.
Technically, write operations are always DEVICE writes. However, there is no point in writing
to the CACHE, so this terminology is redundant.

G.3 OPC DA 2.0 VERSUS 1.0A ASYNCHRONOUS I/O


With the release of the OPC Data Access Version 2.0 Custom Interface Standard, the OPC
Foundation included a new method for asynchronous I/O intended to replace the version 1.0a
standard. While some OPC servers may continue to support the old method of asynchronous I/O,
they are under no obligation to do so. The new method is simpler, easier to implement, and
avoids certain errors that could occur with slow client applications using the old method.
Older OPC clients that require 1.0a interfaces will not be able to communicate properly with new
OPC servers that only support the 2.0 interfaces. Similarly, newer OPC clients that require 2.0
interfaces will not be able to communicate with old OPC servers that only support the 1.0a
interfaces. Vendors of software that require or support 1.0a interfaces are encouraged to update
to the 2.0 standard, which is intended to replace the 1.0a standard.
All Matrikon OPC Servers support both DA 2.0 and 1.0a asynchronous I/O. As such, OPC
clients that depend on either method are able to communicate with them. OPC clients such as
Matrikon OPC Explorer that support both methods generally attempt to use the 2.0 method first
and then resort to 1.0a if that fails.

Page 66 of 69
Matrikon OPC Server for Modbus Devices
Appendix H - ALIAS CONFIGURATION
H.1 SCALING EXPRESSIONS

Expression Description Examples


‘text’ Text value (enclosed in single ‘hello’
quotation marks). ‘Joe’’s Alias’
+ - * / Addition (or Append), Subtraction, (3 * 7 + 1) / 8 – 2
Multiplication, and Division ‘hi ‘ + ‘there’
= < > <> <= >= Equal To, Less Than, Greater 3<4
Than, Unequal To, Less or Equal
To, Greater or Equal To
Not And Or Logical Not, Logical And, Logical (7 >= 3) And (1 <> 0)
Or (12 And 5) = 4
May also be used for binary math.
TIME Current time as text ‘The time is ‘ + TIME
DATE Current date as text ‘Today is ‘ + DATE
INT(x) Returns the integer part of x INT(3.14) = 3
FRAC(x) Returns the fractional part of x FRAC(3.14) = 0.14
SQRT(x) Returns the square root of x SQRT(16) = 4
DIV(x, y) Divides x by y DIV(42, 7) = 6
IF(expression, x, y) Returns x if expression evaluates IF(6 <= 12, ‘OK’, ‘Bad’) = ‘OK’
to TRUE, otherwise returns y
TRUE FALSE Constant Boolean true and false (5 > 6) = FALSE
TYPEOF(x) Returns the data type of x as a text TYPEOF(‘hello’) = ‘STRING’
description (‘STRING’,
‘INTEGER’, ‘FLOAT,
‘BOOLEAN’, ‘ERROR’).
STR(x) Converts the numeric value x to STR(3.14) = ‘3.14’
text
UPPER(x) Converts the text value x to all UPPER(‘hello’) = ‘HELLO’
LOWER(x) upper case or lower case letters, or LOWER(‘HI THERE’) = ‘hi
PRETTY(x) the first letter upper case and the there’
rest lower PRETTY(‘ALARM’) = ‘Alarm’
COPY(x, start, Returns a sub-string of the x, COPY(‘FIDDLE’, 2, 4) = ‘IDDL’
length) copying length characters starting
at start

Expression Description Examples


Page 67 of 69
Matrikon OPC Server for Modbus Devices
FORMATNUMER Converts the numeric value x to FORMATNUMERIC('####.#',
IC(mask, x) text using the format mask 123.4567) = ‘123.5’
INPUT The incoming value read from INPUT * 3.1415
OPC
OUTPUT The outgoing value written to OPC OUTPUT / 3.1415

H.2 CONFIGURATION CSV FORMAT


Comma-delimited text files (CSV) contain records on each line. Commas separate the individual
fields in a record. If the data within a field contains commas or spaces in itself, then the data is
enclosed in double quotation marks (“”). If the data contains a double quotation mark within
itself, then two double quotation marks are used in place. Lines beginning with a hash mark (#)
are ignored as comments.
Each record in an alias CSV files has the following general format.
"Alias Group", "Alias Name", "Item Path", <data type>,
<read-only>, <poll always>, <update rate>, <scaling>
[, <scaling parameters>...]

For example: "North.FIC101","CV","Com1.Plc1.4:0001F",5,1,0,0,0

Field Description
The name of the alias group folder to add the alias item to.
Periods in this name indicate subfolders below the root (i.e.
"Alias Group"
North.FIC101 = folder "North" under the root and subfolder
"FIC101" under that).
The alias item name. To access a particular item from an
"Alias Name" OPC client, the full path name is delimited with periods (i.e.
North.FIC101.CV).
The fully qualified item ID for the OPC item to which this
"Item Path"
alias refers.
A number indicating the data type to convert the value to
before it is returned to the OPC client. This is also appears
as the "canonical" data type for the alias when browsing.
<data type>
Use as zero in this field for the default data type of the
referenced OPC item. See the annex for a list of possible
values.
The number one in this field indicates that the alias cannot
<read-only>
be written to. The number zero indicates that it can.
These values are used in conjunction to ensure that an OPC
item is always being scanned whether the client is presently
<poll always>,
using it or not. Set the "poll always" value to a one for the
<update rate>
item to be scanned continuously, and specify the update rate
in milliseconds. Otherwise, set both values to zero.
Field Description

Page 68 of 69
Matrikon OPC Server for Modbus Devices
Indicates which type of scaling is applied to the alias item.
The parameters that follow this value depend on the type
<scaling>
used. Possible scaling types are 0 (none), 1 (linear), 2
(square root), 3 (gain/offset), and 4 (expression).
<high raw>, Linear or square-root scaling parameters include the raw
<low raw>, high and low values, scaled high and low values, and a
<high scaled>, clamping option. Possible clamp types are 0 (none), 1
<low scaled>, (clamp low value), 2 (clamp high value), and 3 (clamp both
<clamp> high and low values).
<gain>, Gain/offset scaling parameters include a scaling factor and
<offset> an offset.
Expression scaling parameters include input and output
expressions. The input expression is applied to the value
"Input Expression","Output
from the OPC item when reading. The output expression is
Expression"
applied to values going to the OPC item when writing.
These equations should be reciprocals of each other.

Page 69 of 69

Das könnte Ihnen auch gefallen