Académique Documents
Professionnel Documents
Culture Documents
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
Slide 3
Corporate Systems
Integration and
Collaboration Platform
Corporate
Software Applications
Invensys and Third Party
Automation
Invensys and Third Party
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
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
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
Slide 13
Slide 14
Operation
Connect to the OPC Server or Launch the OPC Server
Access the OPC server
Request data to be polled
Slide 18
Slide 19
Slide 20
Slide 21
Slide 22
Slide 24
Slide 26
Slide 28
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
Slide 31
Slide 32
Default Protocols
Connection-oriented TCP/IP is all
that OPC requires
Slide 33
Slide 35
Slide 36
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
Slide 39
Problem #2:
Cant Connect to Remote OPC Server
Unrelated to OPCEnum browsing success
Errors in log like failed to activate remote server
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
Problem #4:
Slide 42
Slide 43
Advise Items
FSGateway connects to the OPC Server
FSGateway sets the client name
FSGateway
Create
FSGateway
Add
Connect
Items
Group
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
Slide 45
Set Client
Name
FSGateway sends
its name to the
OPC Server
Name of Group
The Group name is
the FSGateway OPC
object name and
the OPC Group
object name
separated by a
period.
Create group
as active
FSGateway creates
the group as active
Client Handle
FSGateway
provides the handle
for this group
Requested
Update Rate
FSGateway
specifies the rate at
which data changes
may be sent
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.
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.
dwCount: 1
Slide 53
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
dwCount: 1
Slide 54
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
dwCount: 1
Slide 55
AccessPath =
ItemID = port.plc.400001
ActiveState = 1
ClientHandle = 0x01000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 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
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.
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.
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.
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.
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.
Slide 62
Slide 63
AccessRights
OPC Server
indicates if this
item is read only,
write only or
read/write.
Slide 64
ServerHandle
The server handle
used to refer to this
item.
Slide 65
Can. DataType
The native data
type within the OPC
server for this item.
VT_UI2
Indicates a 2 byte
unsigned integer.
Slide 66
Slide 67
List of Client
Handles
List of client handles
for the items which
have changed
Slide 68
Number of
Items
The number of items
in the client handle
list
Slide 69
List of Values
and Data types
Contains the data
type and values for
the items which
have changed
Slide 70
List of
Timestamps
Slide 71
List of Quality
Values
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
Group
....
Pump Start
Write
Complete
OPC Server
Slide 73
Write a Value
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
dwCount: 1
Slide 89
AccessPath =
ItemID = port.plc.BadItem
ActiveState = 1
ClientHandle = 0x02000000
Blob size = 0
Requ. DataType = 0 (VT_EMPTY)
Reserved = 0
Error ID Return
Code
0xc0040008 indicates
an Invalid Item ID
Logger Message
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
Slide 94
Slide 95
Slide 96
0x00000000 S_OK
AccessRights = 3 (ReadWrite
(0x00000003))
BlobSize
=0
ServerHandle = 0x01000001
Can. DataType = VT_EMPTY
Reserved
=0
Slide 97
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
OPC Server
sends the Data
Type and value.
Questions?
Slide 101