Slide 1
WW TSS-12
Understanding and Troubleshooting
OPC Connectivity
Presented by:
Gary Alldredge
Dr. Peter von Tluck
October, 2012
© 2012 Invensys. All Rights Reserved. The names, logos, and taglines identifying the products and services of Invensys are proprietary
marks of Invensys or its subsidiaries. All third party trademarks and service marks are the proprietary marks of their respective owners.
Introduction
This presentation will give you a better understanding of what OPC is,
how it works internally, and how to troubleshoot problems when
integrating OPC communications into Wonderware products.
We will discuss some OPC configuration best practices, review some of
the common problems we see in customer systems, and share how we
typically solve those problems.
Slide 3
What is OPC?
• OPC is an acronym for OLE (Object Linking and Embedding) for Process
Control
• Open yet secure connectivity via open standard specifications for interfacing
process control (hardware) and manufacturing automation applications
(software)
• Originally based on Microsoft’s OLE COM and DCOM technologies providing a
framework for third party development
Slide 4
OPC Standards
Standards are formed by the OPC Foundation. Before standards, every
hardware vendor had to provide a customer driver to communicate to their
devices. This was costly and difficult to configure and maintain.
http://www.opcfoundation.org
Slide 5
OPC Standards
There are a variety of different OPC Standards that are used in
different ways and have different behaviors and interface methods.
• OPC Data Access: The original standards. Real-time data from PLCs,
DCS, etc. to HMI and other display clients. Currently supported by
Wonderware OPC products.
• OPC Alarms & Events: On-demand alarm and event notification
• OPC Batch: Specialized for batch processes
• OPC Data eXchange: Server/server communication instead of
client/server
Slide 6
OPC Standards
• OPC Historical Data Access: OPC access to historical archive data
• OPC XML-DA: Exposing plant floor data via XML. Leverages SOAP
and Web Services.
• OPC Unified Architecture (UA): New multi-spec standard, not
based on COM, for cross-platform communications. Future support is
planned for Wonderware products (planned for end of the year)
Slide 7
OPC Data Access Specification
This is currently the only specification available within Wonderware
products; however, there are different revisions of the specification.
• 1.0: Initial specification
• DA 1.0a: Data Access (DA) name adopted to differentiate from other
spec types being developed. Limited support by Wonderware.
• DA 2.0-2.05a: Numerous modifications and clarifications. Most
commonly utilized revision. Supported by Wonderware.
• DA 3.0: Further modifications and clarifications. Relatively new and
not widely utilized yet. Not currently supported by Wonderware.
Not all clients and servers are backwards compatible. 3rd party
products do exist to mediate revision compatibility.
Slide 8
OPC Server Activation Methods
An OPC Client uses one of two activation methods
Out-of-Process (Out-of-Proc; other terms: “exe” or “local”)
• An Out-of-Proc server is implemented as an exe. The executable is a
separate process from the client.
• Can be used for local or remote connections
• Allows for multiple concurrent clients
In-Process (In-Proc; other term: “DLL”)
• An In-Proc server is implemented in a Windows DLL and is mapped
directly into the address space of the process that uses it.
• Local connection by only one client
Slide 9
OPC Data Access
Communications Mechanisms
There are four different mechanisms for data requests and retrieval
Asynchronous Calls
• Client issues a read or write request and the thread is immediately
released
• The values are returned later
Synchronous calls (not supported by Wonderware products)
• Client issues a read or write request and the thread is not released
until the values are returned
Slide 10
OPC Data Access
Communications Mechanisms
Refresh (Pull callback mechanism)
• Client issues a refresh call, OPC server returns current values
asynchronously
• Useful when switching from one view to another
Subscription (Push callback mechanism)
• Lowers transactional overhead
• Client requests items of interest. Using event-based triggers, server
notifies client only when changes occur.
Slide 11
OPC Enumeration vs. Operation
There is a significant difference when you are browsing for servers and
items during configuration-time versus launching and accessing data
during run-time.
• OPCEnum (enumeration)
– Browse for available OPC servers on a node
– Browse items on that server
• Operation
– Connect to the OPC Server or Launch the OPC Server
– Access the OPC server
– Request data to be polled
Sometimes only one or the other works, sometimes both or neither.
Slide 12
COM: ProgID vs. CLSID
There are two different ways to uniquely identify an OPC Server
ProgID: PROGrammatic IDentifier
• Human readable name of component
• This is what is seen when browsing for a list of OPC Servers
CLSID: CLasS IDentifer (also referred to as GUID)
• Actual internal identifier used by interacting programs
• Can be located in Component Services, DCOM properties for OPC
Server. Appears on General tab as “Application ID.”
• Can be manually entered in OPC client if ProgID is not able to be
browsed due to broken OPCEnum. (Include the curly brackets)
Slide 13
Example Subscription OPC
Communications Scenario
• Client connects to server
• Client adds OPC group with requested update rate and deadband
• Client adds items
• Server validates items and returns success or failure
• Server polls field device
• Server sends initial update data type and VTQ. (Value, Time, Quality)
• Server polls the device at the requested rate for those items
• Server responds to client with VTQ when there is a change in the VTQ
Asynchronous read/write calls can be made at any time after
subscription is established
Slide 14
Wonderware OPC Products
Slide 15
Wonderware OPC Client Solutions:
FactorySuite Gateway (FSGateway)
• Supports OPC DA 2.05a
• Planned future support for OPC-UA
• Configured via DAServer Manager in the System Management Console (SMC)
• Supports Suitelink, OPC, DDE clients
• Supports activation of OPC server
in-proc and out-of-proc
Slide 16
Wonderware OPC Client Solutions:
OPCClient ArchestrA Device Integration Object
• Supports OPC DA 2.05a
• Planned future support for OPC UA
• Configured via ArchestrA IDE, deployed to platforms
• Provides data to ArchestrA galaxy objects via Message Exchange (MX)
protocol
• Supports activation of OPC server in-proc and out-of-proc
• Supports Block Reads and Writes
Slide 17
Wonderware OPC Client Solutions:
OPCLink - Legacy
• Supports OPC DA 1.0a and 2.05a
• Configured via its own user interface
• Supports Suitelink, DDE clients
• Item prefix is required to specify data type
• Supports activation of OPC server in-proc and out-of-proc
• Legacy application not supported on current Operating Systems
Slide 18
Wonderware OPC Server Solutions:
FSGateway
• Connects to various data sources
– Suitelink
– DDE
– InTouch View Application
– ArchestrA Galaxy objects (a Platform must be deployed locally)
– OPC servers
• Supports only Out-Of-Proc activation by clients
• Can be an OPC, Suitelink, or DDE server
– Cannot be OPC and DDE server at the same time
– DDE limitations on newer Operating Systems (see readme)
Slide 19
Wonderware OPC Server Solutions:
All Wonderware DAServers
• Connect to various 3rd party field devices
– Modbus
– Rockwell
– GE
– Siemens
– Many others
• Supports only Out-Of-Proc activation
• Toolkit available for custom DAS development to connect to other
devices
• Can be an OPC, Suitelink, or DDE server
Slide 20
Sample OPC Configuration
Tips and Tricks
Slide 21
FSGateway OPC Configuration:
Create an OPC Object
• Server Node: Computer Name or IP address hosting the OPC Server
• Server Name: ProgID or ClSID
• Reconnection Attempts: Number of times FSGateway attempts to reconnect to
the OPC Server
• Reconnect Period: Delay between reconnect attempts (use -1 for unlimited
reconnect attempts)
• Activate Server Out of Proc: If checked OPC server is activated out of proc. If
unchecked OPC server is activated in-proc
Slide 22
FSGateway OPC Configuration:
Create an OPC Group Object
• Use Group Name as Access Path: The name of the OPC group object is used
as the OPC Access Path for all items added to the OPC Group.
• Read Only: Makes all items in the OPC Group read only. Unchecking this box
only removes FSGateway imposed read-only qualifications, not read-only
items in the device.
• Demand Read After Poke: Forces FSGateway to read back all written values
after the write has been processed.
Slide 24
FSGateway OPC Configuration:
Device Item Alias
• Device Items list is not required
• Right column is OPC server’s required item syntax
• Allows you to shorten item names
• Allows FSGateway items to be browseable by OPC Clients
• Good tool for confirming proper item syntax
• Good tool for determining proper syntax for Item Prefix
Slide 25
Why Can’t I Read Data
From My OPC Server?
Slide 26
Death by DCOM
• DCOM security issues are by far the most common OPC-related issues we
encounter
• DCOM components are generally secure by default
• Resolving DCOM security is particularly difficult when dealing with multi-node
configurations that are not on a domain
Slide 27
DCOM Preparation for OPC:
Windows Security
• Temporarily disable Windows Firewall
• Setup transactional users
– All users and passwords must match
– Should be in Administrators group
– Common domain user is preferred
• Use loosened security to get setup, then tighten later
Slide 28
DCOM Preparation for OPC:
Simple File Sharing
• Disable Simple File Sharing
– Usually a workgroup problem
– In Explorer
• Tools/Folder Options, View tab
• Uncheck ‘Use Simple File Sharing’
– OR in Admin Tools - Local Security policies
• Security Options
• Set ‘Network Access: Sharing and security model for local accounts’ to ‘Classic’
Slide 29
DCOM Preparation for OPC:
Default Properties
• DCOMCNFG (Component Services)
– My Computer/Properties
– Default Properties
• Enable Distributed COM (reboot required)
• Default Authentication Level = ‘Connect’
• Default Impersonation Level = ‘Identify’
– Default Protocols
• Connection-oriented TCP/IP is all that OPC requires
Slide 30
DCOM Preparation for OPC:
Components Services Security
• DCOMCNFG (Component Services)
– My Computer/Properties
– COM Security
• Access Permissions/Edit Default
– Add ‘Everyone’
• Access Permissions/Edit Limits
– Add ‘Everyone’, ‘Anonymous Logon’
• Launch and Activation Permissions/Edit Default
– Add ‘Everyone’
• Launch and Activation Permissions/Edit Limits
– Add ‘Everyone’
Slide 31
DCOM Preparation for OPC:
OPCEnum
• Security
• Access Permissions/Customize
– Add ‘Everyone’
– Add ‘Network’
• Launch and Activation Permissions/Edit Default
– Add ‘Everyone’
– Add ‘Network’
• General
• Authentication Level
– None
• Identity
• The system account
Slide 32
DCOM Preparation for OPC:
OPC Server DCOM Security
• Locate the specific OPC server DCOM entry
– Properties
• Authentication level – sometimes needs to be None
• Identity
– Interactive: OPC server runs as logged-on user. Not recommended since someone
needs to be logged in.
– Launching User: OPC server runs as user who called for launch. If more than one
user calls for launch, multiple OPC server instances will be attempted, which can be
a problem. Must be admin user.
– This User: OPC server runs as specific user. Required by some OPC server vendors.
– System Account: Preferred, but not available if server is not a Windows Service.
Slide 33
DCOM Preparation for OPC:
Secure Communications
• Apply Security – Often overlooked if focus is on “get it working!”
– Re-enable Windows Firewall
• Add application exceptions
• TCP/135 will need to be open always at a minimum
– Tweak COM Security
• Remove Anonymous Logon access if desired
• Allow or Deny specific accounts
Slide 34
Common OPC Problems
and Solutions
Slide 35
Problem #1:
Can’t Browse for List of OPC Servers
• Can be particularly difficult on remote servers
• Utilizes OPCEnum to retrieve the list
• Add Network user via DCOMcnfg
• List contains ProgID
• Connection to OPC server is not made
• Does not mean OPC server is working
• If unable to resolve, you can manually enter the CLSID including
curly brackets
Slide 36
Problem #1: Troubleshooting
Can’t Browse for List of OPC Servers
OPCEnum is Not Installed
• Verify OPCEnum service is present on all servers and not disabled
(manual preferred)
• Usually installed along with an OPC client or server as a
redistributable
No Anonymous Logon access
• Required for OPCEnum with work
• Check if Anonymous Access is granted in the default Windows COM
Security
– DCOMCNFG/My Computer/COM Security
Slide 37
Problem #2:
Can’t Connect to Remote OPC Server
• Unrelated to OPCEnum browsing success
• Errors in log like ‘failed to activate remote server’
Possible causes and solutions
• Make sure OPC Server service is not disabled
• Review DCOM security for problems
• User executing FSGateway does not have launch and activate or
access privilege
• Simple File Sharing is enabled
• OPC Server DCOM Identity setting is wrong
• Firewall is blocking connection
Slide 38
Problem #3:
Connection Made, but Items Bad
• Message in log that connection to OPC Server was successful
• Sometimes get ‘failed to add item’ errors in the log
Possible causes and solutions
• Improper item syntax
– Try browsing for items and adding to basket
– Check Item Prefix settings
• End device is not accessible
– Check OPC Server for errors
• Delayed data-type validation failure
• Review DCOM security for problems
Slide 39
Problem #4:
Good Item Quality, but No Item Updates
• Message in log that connection to OPC Server was successful
• No ‘failed to add item’ errors
Possible causes and solutions
• Subscription-based means no change, no update
• Firewall blocking updates
• Simple File Sharing enabled
• Review DCOM security for problems
Slide 40
Problem #5:
Win2008 – Session ID
• If FSGateway is configured as Service: Session ID: O, Local system
Account
• If FS Gateway is running “not as a service” – Started from SMC:
Session ID 0, Network Account User
• If FSGateway is started from C:\Program
Files\Wonderware\DAServer\FSGateway\Bin: Session ID 1, Logged in
User
Why important?
In some cases OPC Servers don´t get started by FSGateway because
of the different Session ID.
Slide 41
OPC Trace of FSGateway
To OPC Server
Communications
Slide 42
Which tools are available???
Slide 43
•
Use Logflags in SMC
•
OPC Analyzer (OPC Foundation – for members only )
Using OPC Analyzer for Diagnostics
• OPC Analyzer from the OPC Foundation helps identify and analyze
communication and protocol issues between the OPC client and OPC
server. It is mainly used for client/server testing during development.
FSGateway/
Intouch
Slide 44
OPC Analyzer
OPC Server
Using OPC Analyzer for Diagnostics
• Configuration
Slide 45
Using OPC Analyzer for Diagnostics
• Configuration in FS Gateway
Slide 46
Using OPC Analyzer for Diagnostics
• Start FSGateway
• Start InTouch with some active items
• OPC Analyzer will be started automatically
Slide 47
Using OPC Analyzer for Diagnostics
Slide 48
Advise Items
• FSGateway connects to the OPC Server
FSGateway
• FSGateway sets the client name
Create
FSGateway
Add
Connect
Items
Group
• FSGateway adds a group to the OPC Server
• FSGateway adds item(s) to the Group
• OPC Server pushes data changes to FSGateway
Group (1000 ms)
Pump Speed = 50
47
48
Tank Level = 89.4
85.4
84.6
Motor Amps = 49.2
48.2
46.8
OPC Server
Slide 49
Advise One Item
FSGateway connects to the OPC Server
13:02:58.406 - IOPCCommon::SetClientName
General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: Wonderware FSGateway
Slide 50
Set Client Name
FSGateway sends its
name to the OPC Server
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 51
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 52
Name of Group
The Group name is the
FSGateway OPC object
name and the OPC
Group object name
separated by a period.
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 53
Create group as
active
FSGateway creates the
group as active
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 54
Client Handle
FSGateway provides the
handle for this group
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 55
Requested Update
Rate
FSGateway specifies the
rate at which data
changes may be sent
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 56
Revised Update Rate
The OPC Server returns
the value it will actually
use for the Update Rate.
This may differ from the
requested update rate.
Advise One Item
FSGateway adds a group to the OPC Server
13:02:58.421 - IOPCServer::AddGroup General:
HRESULT: 0x00000000 S_OK
In Parameters:
szName: OPC.Group
bActive: TRUE
riid: IID_IOPCItemMgt
pPercentDeadband: NULL
dwLCID: 0x0
LOCALE_NEUTRAL
hClientGroup: 0x1000000
pTimeBias: NULL
dwRequestedUpdateRate: 1000
Out Parameters:
pRevisedUpdateRate: 1000
phServerGroup: 0x195830
ppUnk: 0x195854
Slide 57
Server Handle
The OPC Server
generated handle to the
group. The client
(FSGateway) will use this
handle for functions
such as adding items to
the group.
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 58
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 59
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 60
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 61
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
pItemArray
This contains the OPC
item definitions.
AccessPath
There is no access path
defined in this example
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 62
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
ItemID
The name of the item in
the OPC Server.
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 63
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
ActiveState
Adds the item as active.
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 64
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
ClientHandle
The handle the client
associates with the item.
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 65
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
Requ. DataType
FSGateway requests the
data type as not
specified (VT_EMPTY).
Passing VT_EMPTY
means FSGateway will
accept the servers data
type that will be
returned.
The next version of
FSGateway will allow the
requested DataType to
be specified by adding a
“suffix” to the item
name.
Advise One Item - Suffix
A new [optional] item name suffix has been added to FSGateway to allow selection of the
requested data type in the OPCServer which FSGateway is connected to as a data source.
For example,
Appending " /VT_BSTR" to the item name will tell the OPC Server to add the specified item
as a String data type.
The following are the supported suffixes:
<item name><space>/<suffix>
Suffix
------VT_BOOL
VT_BSTR
VT_I1
VT_I2
VT_I4
VT_UI1
VT_UI2
VT_UI4
VT_UINT
VT_INT
VT_R4
VT_R8
VT_DATE
Slide 66
Description
----------Boolean; True=-1, False=0
Automation string
Char
2 byte signed int
4 byte signed int
unsigned char
2 byte unsigned int
4 byte unsigned int
Unsigned machine int
Signed machine int
4-byte real
8-byte real
time stamp
Advise One Item
FSGateway Subscribes to Items
13:02:58.593 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 67
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
dwCount
The number of items to
be added.
Advise One Item
FSGateway Subscribes to Items
Out Parameters:
ppErrors:
[000]
0x00000000 S_OK
ppAddResults:
Item 0:
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_UI2
Reserved
=0
Slide 68
Advise One Item
FSGateway Subscribes to Items
Out Parameters:
ppErrors:
[000]
0x00000000 S_OK
ppAddResults:
Item 0:
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_UI2
Reserved
=0
Slide 69
AccessRights
OPC Server indicates if
this item is read only,
write only or read/write.
Advise One Item
FSGateway Subscribes to Items
Out Parameters:
ppErrors:
[000]
0x00000000 S_OK
ppAddResults:
Item 0:
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_UI2
Reserved
=0
Slide 70
ServerHandle
The server handle used
to refer to this item.
Advise One Item
FSGateway Subscribes to Items
Out Parameters:
ppErrors:
[000]
0x00000000 S_OK
ppAddResults:
Item 0:
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_UI2
Reserved
=0
Slide 71
Can. DataType
The native data type
within the OPC server
for this item.
VT_UI2
Indicates a 2 byte
unsigned integer.
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000]
2011-09-07T20:02:59.968
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 72
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000]
2011-09-07T20:02:59.968
dwTransid: 0
phClientItems: [000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 73
List of Client Handles
List of client handles for
the items which have
changed
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000]
2011-09-07T20:02:59.968
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 74
Number of Items
The number of items in
the client handle list
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000] VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000]
2011-09-07T20:02:59.968
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 75
List of Values and
Data types
Contains the data type
and values for the items
which have changed
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000] 2011-09-07T20:02:59.968
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 76
List of Timestamps
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000]
2011-09-07T20:02:59.968
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000] 0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 77
List of Quality Values
Advise One Item
OPC Server Pushes Data Changes to FSGateway
13:02:59.593 – IOPCDataCallBack::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x195830
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_UI2 25185
dwCount: 1
hrMastererror:
0x00000000 S_OK
pftTimeStamps: [000]
2011-09-07T20:02:59.968
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0
OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 78
Client Handle of the
Group
Demo: Using OPC Analyzer
• Advise Items
• Suffix – Syntax for enforcing the canonical Datatype
• Injection
Slide 79
Write a Value
• FSGateway adds the item to the Group
• FSGateway writes a value to the item
FSGateway
Add
Item
Remove
Pump
Start
Pump
= True
Start
• OPC Server sends a Write Complete to FSGateway
• FSGateway removes the item from the Group
Group
....
Pump Start
Write Complete
OPC Server
Slide 80
Write a Value
FSGateway Adds the item
14:05:32.265 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 81
AccessPath =
ItemID = port.plc.400001
ActiveState = 0
ClientHandle = 0x04000001
Blob size = 0
Requ. DataType = 18 (VT_UI2)
Reserved = 0
FSGateway adds the
item.
The item is added to the
OPC Server even if it is
already subscribed.
Creating a new item for
writing is done to
prevent the value from
bouncing between the
read value and the
written value in the client
application.
Since we do not want to
read from this item, it is
not activated
Write a Value
FSGateway Writes to the Item
14:05:32.265 - IOPCAsyncIO2::Write
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemValues:
[000]
VT_UI2 248
dwCount: 1
phServer:
[000] 0x04000002
dwTransactionID: 67108864
Out Parameters:
pdwCancelID: 67108864
ppErrors:
[000]
0x00000000 S_OK
Slide 82
Write a Value
FSGateway Writes to the Item
14:05:32.265 - IOPCAsyncIO2::Write
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemValues:
[000] VT_UI2 248
dwCount: 1
phServer:
[000] 0x04000002
dwTransactionID: 67108864
Out Parameters:
pdwCancelID: 67108864
ppErrors:
[000]
0x00000000 S_OK
Slide 83
Value to be written
Can contain a single
item value or multiple
item values
Write a Value
FSGateway Writes to the Item
14:05:32.265 - IOPCAsyncIO2::Write
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemValues:
[000]
VT_UI2 248
dwCount: 1
phServer:
[000] 0x04000002
dwTransactionID: 67108864
Out Parameters:
pdwCancelID: 67108864
ppErrors:
[000]
0x00000000 S_OK
Slide 84
Server Handle of the
Item to be Written
Write a Value
FSGateway Writes to the Item
14:05:32.265 - IOPCAsyncIO2::Write
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemValues:
[000]
VT_UI2 248
dwCount: 1
phServer:
[000] 0x04000002
dwTransactionID: 67108864
Out Parameters:
pdwCancelID: 67108864
ppErrors:
[000]
0x00000000 S_OK
Slide 85
Transaction ID
This transaction ID is
used in the Write
complete information
returned from the OPC
Server
Write a Value
FSGateway Writes to the Item
14:05:32.265 - IOPCAsyncIO2::Write
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
pItemValues:
[000]
VT_UI2 248
dwCount: 1
phServer:
[000] 0x04000002
dwTransactionID: 67108864
Out Parameters:
pdwCancelID: 67108864
ppErrors:
[000] 0x00000000 S_OK
Slide 86
Errors returned by the
OPC Server
Lists errors for each item
written to.
Write a Value
OPC Server notifies Client of Write Complete
14:05:32.281 - IOPCDataCallback::OnWriteComplete
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
numCallbacks: 4
In Parameters:
hrMastererror: 0x00000000 S_OK
hGroup: 0x0
dwCount: 1
pErrors:
[000]
0x00000000 S_OK
dwTransid: 67108864
phClientItems:
[000] 0x04000001
Slide 87
Write a Value
OPC Server notifies Client of Write Complete
14:05:32.281 - IOPCDataCallback::OnWriteComplete
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
numCallbacks: 4
In Parameters:
hrMastererror: 0x00000000 S_OK
hGroup: 0x0
dwCount: 1
pErrors:
[000] 0x00000000 S_OK
dwTransid: 67108864
phClientItems:
[000] 0x04000001
Slide 88
List of results
Lists results for each item
written to.
Example return result:
S_OK
OPC_E_BADRIGHTS
OPC_INVALIDHANDLE
OPC_E_UNKNOWNITEMID
Write a Value
OPC Server notifies Client of Write Complete
14:05:32.281 - IOPCDataCallback::OnWriteComplete
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
numCallbacks: 4
In Parameters:
hrMastererror: 0x00000000 S_OK
hGroup: 0x0
dwCount: 1
pErrors:
[000]
0x00000000 S_OK
dwTransid: 67108864
phClientItems:
[000] 0x04000001
Slide 89
Client Item Handles
Lists the client item
handles for the items
which were written
Write a Value
OPC Server notifies Client of Write Complete
14:05:32.281 - IOPCDataCallback::OnWriteComplete
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
numCallbacks: 4
In Parameters:
hrMastererror: 0x00000000 S_OK
hGroup: 0x0
dwCount: 1
pErrors:
[000]
0x00000000 S_OK
dwTransid: 67108864
phClientItems:
[000] 0x04000001
Slide 90
Transaction ID
The Transaction ID
returned to the client.
Write a Value
FSGateway Removes the Item
14:05:32.281 - IOPCItemMgt::RemoveItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
dwCount: 1
phServer:
[000] 0x04000002
Out Parameters:
ppErrors:
[000]
0x00000000 S_OK
Slide 91
Write a Value
FSGateway Removes the Item
14:05:32.281 - IOPCItemMgt::RemoveItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
dwCount: 1
phServer:
[000] 0x04000002
Out Parameters:
ppErrors:
[000]
0x00000000 S_OK
Slide 92
Server Item Handles
Server Item Handles for
the items to be removed
Write a Value
FSGateway Removes the Item
14:05:32.281 - IOPCItemMgt::RemoveItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
dwCount: 1
phServer:
[000] 0x04000002
Out Parameters:
ppErrors:
[000] 0x00000000 S_OK
Slide 93
List of results
Lists results for each item
removed.
Example return result:
S_OK
OPC_INVALIDHANDLE
Demo: OPC Analyzer
• Write Value
• Demand read (restart Server)
Slide 94
Deactivate/Activate Item
FSGateway Deactivates an Item
14:01:08.812 - IOPCItemMgt::SetActiveState
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
bActive: FALSE
dwCount: 1
phServer:
[000] 0x01000001
Out Parameters:
ppErrors:
[000]
Slide 95
0x00000000 S_OK
Deactivate/Activate Item
FSGateway Deactivates an Item
14:01:08.812 - IOPCItemMgt::SetActiveState
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000000 S_OK
In Parameters:
bActive: FALSE
dwCount: 1
phServer:
[000] 0x01000001
Out Parameters:
ppErrors:
[000]
Slide 96
bActive
True = Activate
False = Deactivate
dwCount
Number of items to be
affected
phServer
Server Item Handles
ppErrors
0x00000000 S_OK
List of results from the OPC
Server
Advise a Bad Item
FSGateway subscribes to a Bad Item
14:08:32.890 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x195830
HRESULT: 0x00000001 S_FALSE
In Parameters:
pItemArray:
Item 0:
dwCount: 1
Slide 97
AccessPath =
ItemID = port.plc.BadItem
ActiveState = 1
ClientHandle = 0x02000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
Advise a Bad Item
FSGateway subscribes to a Bad Item
Out Parameters:
ppErrors:
[000] 0xc0040008
OPC_E_INVALIDITEMID
ppAddResults:
Item 0:
AccessRights = 0 (None
(0x00000000))
BlobSize
=0
ServerHandle = 0x00000000
Can. DataType = VT_EMPTY
Reserved
=0
Error ID Return Code
0xc0040008 indicates an
Invalid Item ID
Logger Message
Shows the Itemname,
which group the item
belongs to and the Error ID
Return code from the OPC
Server.
DASProtFail FSGateway Failed to add Item 'port.plc.BadItem' to OPC Group 'OPC.Group', HRESULT = c0040008
Slide 98
Quality Values
FSGateway Diagnostics
Slide 99
Quality Values
OPC Server Pushes Data Changes to FSGateway
14:59:22.421 - IOPCDataCallback::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 2
GroupServerHandle: 0x195718
In Parameters:
hrMasterquality: 0x00000001 S_FALSE
pvValues:
[000] VT_R4 3.402823E+38
dwCount: 1
hrMastererror: 0x00000000 S_OK
pftTimeStamps:
[000] 2011-09-07T21:59:22.421
phClientItems:
[000] 0x02000000
hGroup: 0x1000000
pwQualities:
[000] 0x0040 OPC_QUALITY_UNCERTAIN
pErrors:
[000] 0x00000000 S_OK
Slide 100
Quality Values
OPC Server Pushes Data Changes to FSGateway
14:59:22.421 - IOPCDataCallback::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 2
GroupServerHandle: 0x195718
In Parameters:
hrMasterquality: 0x00000001 S_FALSE
pvValues:
[000] VT_R4 3.402823E+38
dwCount: 1
hrMastererror: 0x00000000 S_OK
pftTimeStamps:
[000] 2011-09-07T21:59:22.421
phClientItems:
[000] 0x02000000
hGroup: 0x1000000
pwQualities:
[000] 0x0040 OPC_QUALITY_UNCERTAIN
pErrors:
[000] 0x00000000 S_OK
Slide 101
hrMasterquality
S_OK if all item qualities
returned are good, S_False
is returned otherwise.
pwQualities
Qualities for individual
items
Delayed Item Validation
Slide 102
•
Some servers are unable to determine the Native
Datatype at the time an item is added or validated.
•
It is common practice for such servers to return
VT_EMPTY as the native datatype.
•
Such servers will return the data in the requested or
native type when the data becomes available and the
actual type can be determined.
•
OPC DA standard recommends that clients be
prepared to deal with an initial return of VT_EMPTY.
Delayed Item Validation
FSGateway Adds and Activates an Item
14:13:14.031 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x1956f8
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
AccessPath =
ItemID = port.enet.bp.plc.array32[1]
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
dwCount: 1
Slide 103
Delayed Item Validation
FSGateway Adds and Activates an Item
14:13:14.031 - IOPCItemMgt::AddItems
General:
GroupName: OPC.Group
GroupServerHandle: 0x1956f8
HRESULT: 0x00000000 S_OK
In Parameters:
pItemArray:
Item 0:
AccessPath =
ItemID == port.enet.bp.plc.array32[1]
ItemID
port.enet.bp.plc.array32[1]
ActiveState ==11
ActiveState
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
dwCount: 1
Slide 104
Delayed Item Validation
FSGateway Adds and Activates an Item
Out Parameters:
ppErrors:
[000]
ppAddResults:
Item 0:
0x00000000 S_OK
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_EMPTY
Reserved
=0
Slide 105
Delayed Item Validation
FSGateway Adds and Activates an Item
Out Parameters:
ppErrors:
[000]
ppAddResults:
Item 0:
0x00000000 S_OK
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_EMPTY
Reserved
=0
Slide 106
Data Type is returned
as VT_Empty because
the OPC Server does
not yet know the
Data Type
Delayed Item Validation
OPC Server Pushes Data Changes to FSGateway
IOPCDataCallback::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x1956f8
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
[000]
VT_BOOL -1
dwCount: 1
hrMastererror: 0x00000000 S_OK
pftTimeStamps:
[000]
2011-09-07T21:13:16.109
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0 OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 107
Delayed Item Validation
OPC Server Pushes Data Changes to FSGateway
IOPCDataCallback::OnDataChange
General:
HRESULT: 0x00000000 S_OK
GroupName: OPC.Group
numCallbacks: 1
GroupServerHandle: 0x1956f8
In Parameters:
hrMasterquality: 0x00000000 S_OK
pvValues:
pvValues:
[000]
[000]
VT_BOOL -1
VT_BOOL
-1
dwCount: 1
hrMastererror: 0x00000000 S_OK
pftTimeStamps:
[000]
2011-09-07T21:13:16.109
dwTransid: 0
phClientItems:
[000] 0x01000000
hGroup: 0x1000000
pwQualities:
[000]
0x00c0 OPC_QUALITY_GOOD
pErrors:
[000]
0x00000000 S_OK
Slide 108
OPC Server sends
the Data Type and
value.
Questions?
THANK YOU
Slide 109