Vous êtes sur la page 1sur 101

PBWW234

Wonderware: Understanding &


Troubleshooting OPC Connectivity
Presented by:
Gary Alldredge and Dan Scott
November 2011

2010 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.
Slide 2

Invensys 00/00/00

Invensys proprietary & confidential

Slide 3

Corporate Systems

Integration and
Collaboration Platform

Manufacturing / Production Operations

Corporate

Invensys Enterprise Control Offerings

Software Applications
Invensys and Third Party

Automation
Invensys and Third Party

Enterprise Control System

Where The Offerings We Will Discuss Fit Within The


InFusion Enterprise Control System
Execution
Manufacturing Execution
Systems

Enterprise Asset
Management

Batch

Mobile Workforce
Management

Enterprise
Integratio
n
Workflow

Enterprise Manufacturing
Intelligence

Performance Measurement
and Reporting

Application
Toolkit

Quality

Advanced Process
Control

Design

Operator Training

Simulation /
Optimization

Control
DCS

PAC

SCADA

HMI

Safety
Safety Instrumented Systems

General Purpose Safety

Turbomachinery Control

Historian

Measurement &
Instrumentation
Instrumentation

Slide 4

Asset
Performance

Optimization

Open Device
Integration
Web
Portal

Visualization

Controllers

Recorders

Automation

Third-Party Offerings

Performance

Applications
Software Applications
Software

Integration &
Collaboration
Platform

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 5

Getting to Know OPC

Slide 6

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 Microsofts OLE
COM and DCOM technologies
providing a framework for third
party development

Slide 7

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 8

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 9

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.

Slide 10

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 11

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 12

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 13

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 14

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 15

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 16

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 17

Wonderware OPC Products

Slide 18

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 19

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 inproc and out-of-proc
Supports Block Reads and Writes

Slide 20

Wonderware OPC Client Solutions:


OPCLink
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 inproc and out-of-proc
Legacy application not supported on
current Operating Systems

Slide 21

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 22

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 23

Sample OPC Configuration


Tips and Tricks

Slide 24

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
Activate Server Out of Proc: If
checked OPC server is activated out
of proc. If unchecked OPC server is
activated in-proc
Slide 25

FSGateway OPC Configuration:


Create an OPC Group Object
Device Group Name: Name of the

topic that a DDE or SuiteLink client


will use. Value is the concatenation of
the OPC object name , an underscore
and the OPCGroup object name.
Update rate: Value in ms that

FSGateway will request the OPC


server to use as the fastest rate at
which data changes may be sent.
OPC Item ID Prefix: String prefixed

to all item names added to the OPC


group.

Slide 26

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 27

FSGateway OPC Configuration:


Device Item Alias
Device Items list is not required
Right column is OPC servers
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 28

Why Cant I Read Data


From My OPC Server?

Slide 29

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 30

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 31

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 32

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 33

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 34

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 35

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 36

Common OPC Problems


and Solutions

Slide 37

Problem #1:
Cant Browse for List of OPC Servers
Can be particularly difficult on remote servers
Utilizes OPCEnum to retrieve the list
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 38

Problem #1: Troubleshooting


Cant 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 39

Problem #2:
Cant 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 40

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 41

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 42

OPC Trace of FSGateway


To OPC Server
Communications

Slide 43

Advise Items
FSGateway connects to the OPC Server
FSGateway sets the client name

FSGateway
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 =
Tank Level
47
48
50
MotorLevel
Tank
Amps=
85.4
84.6
89.4
Motor Amps =
48.2
46.8
49.2
OPC Server

Slide 44

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 45

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 46

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 47

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 48

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 49

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 50

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 51

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 52

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 53

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 54

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 55

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 56

pItemArray
This contains the
OPC item
definitions.

AccessPath

AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0

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 57

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 58

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 59

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 60

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.

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

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 62

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 63

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 64

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 65

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 66

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 67

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 68

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 69

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 70

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 71

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 72

Client Handle of
the Group

Write a Value
FSGateway adds the item to the Group
FSGateway writes a value to the item
OPC Server sends a Write Complete to FSGateway

FSGateway
AddStart
Item
Remove
Pump
Pump
=
True
Start

FSGateway removes the item from the Group

Group
....
Pump Start

Write
Complete

OPC Server
Slide 73

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 74

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 75

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 76

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 77

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 78

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 79

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 80

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 81

List of results
Lists results for each
item written to.
Example return
result:
S_OK
OPC_E_BADRIGHTS
OPC_INVALIDHANDLE
OPC_E_UNKNOWNITE
MID

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 82

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 83

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 84

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 85

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 86

List of results
Lists results for each
item removed.
Example return
result:
S_OK
OPC_INVALIDHANDLE

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 87

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 88

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 89

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 90

Quality Values
FSGateway Diagnostics

Slide 91

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 92

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 93

hrMasterquality
S_OK if all item
qualities returned are
good, S_False is
returned otherwise.

pwQualities
Qualities for
individual items

Delayed Item Validation

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.

OPCDA standard recommends that clients be


prepared to deal with an initial return of VT_EMPTY.

Slide 94

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 95

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]
port.enet.bp.plc.array32[1]
ActiveState ==11
ActiveState
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
dwCount: 1

Slide 96

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 97

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 98

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 99

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 100

OPC Server
sends the Data
Type and value.

Questions?

Slide 101

Vous aimerez peut-être aussi