OLE for Process Control (OPC)
By Dr. Diew Koolpiruck
INC 448 Advanced Process Control, 2005
OPC Overview
OPC Common OPC Data Access OPC Alarms and Events Specification OPC Historical Data Specification Applications
INC 448 Advanced Process Control, 2005
Executive Summary
OPC is a set of standard commands collected in a software library (DLL) that can be called by client applications, written in Visual Basic, C# or other Microsoft programming languages, that allow to access automation devices (PLCs) in a uniform way, independently from their built or manufacturer. To that effect, the particularities of the automation devices are hidden by an OPC server running either on the same machine as the client program or on another machine, by using DCOM. The OPC Servers are supplied by the manufacturer of the PLC or by 3rd parties and can manage several PLCs of the same type. Several servers can run in parallel. The OPC library allows in particular to read and write process variables, read alarms and events and acknowledge alarms, and retrieve historical data from data bases according to several criteria. Automation platforms such as ABB's 800XA platform act as OPC clients to collect data from PLCs or databases through third-party OPC servers. Several automation platforms act themselves as an OPC server to publish their data, events and historical data. OPC is the preferred connectivity for 78% of MES, 75% of HMI / SCADA, 68% of DCS / PLC and 53% or ERP /Enterprise system level applications (according to Arc Advisory Group, 2004)" INC 448 Advanced Process Control, 2005
Where is OPC in a system?
Storage Configuration DB, Archives, Logfiles, etc.
Technologies
WAN
Supervision
SCADA
LAN ... Other systems (LHC, Safety, ...) LAN Controller/ PLC FieldBus
Process Management
OPC Communication Protocols PLC
VME
Experimental equipment
Field Management
Field buses Sensors/devices
SCADA = supervisory control and data acquisition OPC = OLE for process control PLC = Programmable logic controller Field buses = CAN, ProfiBus, WorldFip, ...
INC 448 Advanced Process Control, 2005
What is OPC ?
OPC (formerly: "OLE1 for Process Control", now: "Open Process Control") is an industry standard set up by the OPC Foundation specifying the software interface (objects, methods) to a server that collects data produced by field devices and programmable logic controllers. interfaces covered by the OPC standard
application (OPC client)
node
servers
OPC server X
OPC server (simulator)
OPC server Y
Ethernet (not covered) PLCs Brand X Sensors/Actors
Field bus (not covered) PLCs Brand Y
1) OLE (Object Linking and Embedding) is a Microsoft technology for connecting software components. It has since been extended by the COM / DCOM technology. It corresponds to Java Beans.
INC 448 Advanced Process Control, 2005
Before OPC
visualization history data base
MasterBus MMS driver
XWAY driver
Profinet driver
ABB PLCs
Tlmcanique PLCs
Siemens PLCs
INC 448 Advanced Process Control, 2005
With OPC: ABB Operator Workplace Connection
OperatorIT application software is written independently from the type of controller Historian (Information Manager)
the drivers still exist, but the clients do not see them anymore
AC800M OPC server
MMS
Schneider OPC server
XWAY
Siemens OPC server
ProfiNet
ABB AC800M
Tlmcanique TSX
Siemens S7
INC 448 Advanced Process Control, 2005
The main OPC Specifications
OPC Batch OPC HDA
batch system
history data base
OPC DX
OPC Data Access
OPC Alarms & Events OPC UA
INC 448 Advanced Process Control, 2005
Specification 1: OPC DA for Data Access
Process variables describe the plant's state, they are generated by the sensors or calculated in the programmable logic controllers (PLCs). Process variables can be sent upon a change, on demand or when a given time elapsed The OPC DA (Data Access) specification addresses collecting Process Variables. The main clients of OPC DA are visualization and (soft-) control.
INC 448 Advanced Process Control, 2005
Specification 2: OPC AE for Alarms and Events
Events are changes in the process that need to be logged, such as "production start" Alarms are abnormal states in the process that require attention, such as "low oil pressure OPC AE (Alarms and Events) specifies how alarms and events are subscribed, under which conditions they are filtered and sent with their associated messages. The main clients of OPC AE are the Alarms and Event loggers.
determine the exact time of change (time stamping) categorize by priorities log for further use acknowledge alarms (events are not acknowledged) link to clear text explanation
INC 448 Advanced Process Control, 2005
Specification 3: HDA for Historical Data Access
Historical Data are process states and events such as: process variables, operator actions, recorded alarms,... that are stored as logs in a long-term storage for later analysis. OPC HDA (Historical Data Access) specifies how historical data are retrieved from the logs in the long-term storage, filtered and aggregated (e.g. compute averages, peaks).
INC 448 Advanced Process Control, 2005
Specification 4:
OPC Batch
based on: IEC 61512-1 Batch Control Part 1: Models and Terminology (ANSI/ISA S88.01 1995) ISA-dS88.02-2000 draft 17 of May 2000
Procedure
allows to access: equipment capabilities, current operating conditions, historical and recipe contents
consists of an ordered set of Unit Procedure consists of an ordered set of Operation
consists of an ordered set of Phase
INC 448 Advanced Process Control, 2005
Beyond Microsoft: OPC UA
In a move to get more independence from Microsoft and use web technology, a new specification called " Unified Architecture" (formerly. OPC XML) that uses web services for all kinds of transactions: query, read, write, subscribe,... The classical OPC DA, AE and HDA are implemented with XML / SOAP /WSDL this allows encryption and authentication of process data. This does not only standardize the interfaces, but also the transmitted data.
INC 448 Advanced Process Control, 2005
OPC as a hub
OPC variables is also a convenient way to exchange data between applications on the same machine. OPC data can be easily read in any Microsoft Office application
source: Siemens WinCC
INC 448 Advanced Process Control, 2005
OPC connection to databases
Tools such as LifeWires allow to build an OPC DA interface to any ODBC equipped database. The database internal structure (exposed through queries) is reflected as a hierarchy of OPC items. This allows to give a unified access to simple items.
application (OPC client)
OPC server ODBC
DB
INC 448 Advanced Process Control, 2005
Server(s) and Client(s) in the same node
node
client application (OPC client) client application (OPC client)
OPC server
OPC server
OPC server
devices
devices devices
devices
Clients and servers run as parallel processes The OPC specification defines the interface between client and server in the form of objects and methods.
INC 448 Advanced Process Control, 2005
Direct and Fieldbus access
direct connection
client application (OPC client) (local) OPC server
fieldbus connection
client application (OPC client)
clients and servers run as parallel processes
(local) OPC server FB Manager fieldbus
I/O devices
can also be a point-topoint link
proprietary protocol
The OPC server is running all the time, as soon as at least one client is present
fieldbus FB agent PLC
fieldbus FB agent PLC
INC 448 Advanced Process Control, 2005
Full-fledged COM/DCOM across multiple nodes
connectivity node
Ethernet
app3 TCP/IP
TCP/IP
application 2 (OPC client)
application 1 (OPC client)
panel
OPC server for BrandZ
node 1
OPC server for BrandY
Fieldbus Y
OPC server for BrandX
OPC server for simulation
Fieldbus X
drivers
input / output to plant The OPC servers supports multiple clients and servers on the same, or on remote nodes. They run as separate processes (as soon as at least one client is requesting them)
INC 448 Advanced Process Control, 2005
OPC technologies
ActiveX Object Linking and Embedding (OLE) OLE for Process Control (OPC)
(Distributed) Component Object Model (COM / DCOM) only between nodes Transport (TCP-IP, UDP, Queued) Ethernet
OPC bases on Microsoft's COM/DCOM technology (i.e. it only works on Windows platforms). Effort to port it to other platforms (Linux) and web transport protocols (XML) are in progress. Advantages are the direct integration into all applications, such as Excel.
INC 448 Advanced Process Control, 2005
Structure of an OPC server
OPC/COM Interfaces OPC Group & Item Management Item Data Optimization and Monitoring Device Specific Protocol Logic Hardware Connection Management
INC 448 Advanced Process Control, 2005
OPC Overview
OPC Common OPC Data Access OPC Alarms and Events Specification OPC Historical Data Specification Applications
INC 448 Advanced Process Control, 2005
OPC DA: Scope of specification
OPC DA Client e.g. visualization OPC DA specified interface OPC DA Server OPC DA Client e.g. performance indicator An OPC DA Server is configured using the information coming from the development tools for the controllers Variables defined in the controllers are mirrored to the OPC DA server
e.g. Ethernet controllers controller plant measurement points controller
tags
field bus field devices
INC 448 Advanced Process Control, 2005
OPC DA: Example of access to a variable
OPC application
ReadItem ("OPC:Reactor1: Program2.MotorSpeed")
controller development
Reactor_1.Program2 MW%1003 MotorSpeed Temperature .
Value: 112
MW%1004
OPC server
Get (192.162.0.2), MW%1003)
load symbol table
Return (MW%1003, 112)
ra m ro g P Reactor_1 2
symbols code
Network
Marker: MW%1003
analog input to : IXD.11.2.1
Oven controller
INC 448 Advanced Process Control, 2005
OPC DA:
Process Line 1 Controller 1 Controller 2
Objects as viewed by the OPC server
An OPC server is structured as a directory with root, branches and leaves (items)
Tag Name
Level_1 Level_2 Ramp4
TAG TAG TAG
Controller_3.Prog_1 Controller_3.Prog_2 Cell 1 Machine 2
An item is identified by its "fully qualified ItemID",
e.g.
"Process_Line_1.Controller_2.Level_2"
the hierarchical position may differ from the fully qualified ItemID this will be detailed under browsing
Branches may contain other branches and items The structure may also be flat instead of hierarchical This structure is defined during engineering of the attached devices and sensor/actors. (Intelligent servers could configure themselves by reading the attached devices)
INC 448 Advanced Process Control, 2005
OPC DA: Objects as viewed by the OPC client
Each client structures its items by groups, independently from the server. Initially, the client browses the server structure to check if the items it is interested in exist. A client registers its groups and items at the server. The server keeps the structure of all its clients.
Server root Area 1 Oven_1 TAG TAG Tank_1 Area 2 Area 51 TAG TAG TAG Temperature Heat_On Level Empty_Valve Fill_Valve
clients Client1 GroupX Client2 GroupZ
Item1 Item2 Item3 Item1 Item2
server
INC 448 Advanced Process Control, 2005
OPC DA: Item properties
The process data are represented by three dynamic properties of an item: value: time-stamp: numerical or text the time at which this data was transmitted from the PLC to the server this time is UTC (Greenwich Winter time), not local time. validity of the reading (not readable, dubious data, o.k.)
quality:
(when writing, only the value is used)
INC 448 Advanced Process Control, 2005
OPC DA: Item types
Each item value has a type: Boolean, Character, Byte, (1 byte) Word, (2 bytes) Double Word, (4 bytes) Short Integer (2 bytes) Integer (4 bytes) Long Integer: Long Unsigned Integer Single Float (4 bytes) Double Float (8 bytes) Currency, Date, String, Array of "the above" When accessing an item, the client may request that it is returned with a specific type, which could be different from the server's type. (The server's type is returned by browsing) Type conversion is left to the server, there are no rules whether and how a server does the conversion. (use with caution) Care must be taken that the data types in the programming language or in the database match those of the OPC Server. Items also may have engineering units, but this option is not often used.
INC 448 Advanced Process Control, 2005
OPC DA: Program - initialising a connection
find out existing OPC servers create an OPCServer object connect to that OPC server create an OPCBrowser object create an OPCGroups object create an OPCGroup object build array of items
checking with the browser that these items exist in this server myDummyServer.GetOPCServers myServer = new OPCServer myServer.Connect Set myBrowser = myServer.Browser Set myGroups = myServer.Groups Set myGroup1 = myGroups.Add Set MyItems = MyGroup1.OPCItems FQItems1[1] = "Device1.Temp1" ClientHandle1[1] = 101 ReDim ServerHandle1(nrItems) ReDim ServerErrors1(nrItems) ReDim Value1(nrItems) myGroup1.AddItems myGroup1.IsActive myGroup1.IsSubscribed INC 448 Advanced Process Control, 2005
next group
add item array to the group activate and subscribe group
OPC DA: Libraries
The OPC DA specification is not formal, conformance can hardly be checked against this document. To ensure that the standard is observed, the OPC foundation distributes on its website the DLLs (opcdaauto.dll, opccomn_ps,) that contain the type libraries to access the OPC server. The vendors are not compelled to implement all features. For instance, the description of the variables is seldom used. Calling unimplemented functions causes exceptions that must be caught in Visual Basic with "On Error " statements. There exist three versions of DA, 1.0, 2.0 and 3.0, that behave differently, however, older servers do not have a property indicating which version they support.
INC 448 Advanced Process Control, 2005
OPC DA: Custom Interface
While the Automation Interface is easy to use and quite powerful, some OPC functions are missing and special operations can only be done in Visual C++ using the custom COM interface. This is only recommended for experienced programmers.
IOPCCommon IOPCServer IConnectionPointContainer IOPCItemProperties [IOPCServerPublicGroups] IConnectionPointContainer [IOPCBrowseServerAddressSpace] IPersistFile IOPCDataCallback IOPCServerShutdown
OPC client
OPC server
IOPCItemMgt IOPCGroupStateMgt [IOPCPublicGroupSteatMgt] IOPCSyncIO IOPCAsyncIO2 IConnectionPointContainer IEnumOPCItemAttributes IOPCSyncIO IDataObject
OPC group
INC 448 Advanced Process Control, 2005
OPC Overview
OPC Common OPC Data Access OPC Alarms and Events Specification OPC Historical Data Specification Applications
INC 448 Advanced Process Control, 2005
OPC AE: Configuration
OPC AE Client e.g. event logger OPC A&E specified interface OPC AE Client e.g. alarm printer An OPC AE Server is configured using the information coming from the development tools for the controllers Events defined in the controllers are mirrored to the OPC AE server
OPC AE Server
event notification e.g. Ethernet controllers controller plant measurement points controller field bus field devices events
INC 448 Advanced Process Control, 2005
OPC AE: Purpose
The controllers (PLC) generate events in response to changes in the plant variables. together with their precise time of occurrence, type, severity and associated message for the human operator. An OPC Event server registers these events and makes them available to several clients A particular class of events are the alarms, which are detailed events that may require acknowledgement. The OPC Alarms & Events Interface gives access to the OPC Event server, allowing to: - browse the OPC A&E Server for predefined events. - enable or disable alarms and events - subscribe to alarms and events of interest - receive the event and alarm notifications with the associated attributes - acknowledge alarms
INC 448 Advanced Process Control, 2005
OPC AE: Displaying Alarms and Events
Alarms and events are usually displayed differently on an operator screen. - Events are displayed in an event list that can become quite long (typically 1000 entries), entries are not cleared when the source of the event returns to normal - Alarms are displayed in a short list (typically 50 alarms) appearance changes when the alarm is acknowledged, an alarm line is cleared when the alarm signal is cleared.
Ack checkbox
INC 448 Advanced Process Control, 2005
OPC AE: Summary alarms and events
Event AE Client Alarm AE Client
OPC AE Server
OPC AE Server alarm notification (source, timestamp, message,
condition, subcondition, severity, type)
event notification (source, timestamp, message) message
timestamp
Event FB controller
message
Condition
controller
INC 448 Advanced Process Control, 2005
OPC Overview
OPC Common OPC Data Access OPC Alarms and Events Specification OPC Historical Data Specification Applications
INC 448 Advanced Process Control, 2005
OPC HDA: Historical Data Access
HDA Clients independent processes OPC HDA Server hidden calculations e.g. Trend Analysis e.g. Event Logger
history database
collector
raw and ordered data
OPC DA Server
proprietary data acquisition Field device
Field device
INC 448 Advanced Process Control, 2005
OPC HDA: Purpose
An OPC HDA server gives access to a historical data base (logs) in which data from the process have been collected and time-stamped, possibly through an OPC DA interface. The OPC HDA interface clients, such as trend analysis, product tracking or data mining, that require ordered access these data logs. The OPC HDA interface allows to: - browse the historical data base - retrieve data through proper filtering, e.g. by date range, by identity, by property - build aggregates over the retrieved data, such as average, minimum, maximum. - enter new entries, correct entries or remove entries - enter / delete annotations in the history data base
INC 448 Advanced Process Control, 2005
OPC HDA: Application
Parameters: log: how were time scale (with possible offset, zoom, pan) data sampled amplitude scale (low range, high range, scale units) style: smoothed, stepped, filled (several ways to display the same data) extrapolate: how to display values not received (e.g. because they did not yet change)
INC 448 Advanced Process Control, 2005
OPC HDA: Automation Interface summary
OPCHDAServer OPCHDAItems (col) OPCHDAItem OPCHDAItem OPCHDABrowsers
An instance of an OPC HDA Server. An OPCHDAServer object must be created to can get references to other objects. A collection containing all the OPCHDAItem objects this client has created within the scope of the OPCHDAServer object An object that maintains the items definition. Note the Custom Interface does not provide a separate Item Object. An object that browses item names in the servers configuration.
OPCHDAHistory
An collection containing a series of either OPCHDAValue or OPCHDAEntry objects, representing historical values of an item.
OPCHDAValue OPCHDAValue OPCHDAEntry OPCHDAEntry
An object that represents a discrete historical value for an item or an attribute.
An object that extends the OPCHDAValue object to include additional information
INC 448 Advanced Process Control, 2005
OPC Overview
OPC Common OPC Data Access OPC Alarms and Events Specification OPC Historical Data Specification Applications
INC 448 Advanced Process Control, 2005
Applications: OPC & SCADA
HMI ActiveX Command language & procedures Application functions
ODBC/SQL History data base OPC AE Reporting & Logging Historian
Remote Device Configuration
Alarm & Event handling
OPC DA FDT / DTM / XML Communication stream Data Acquisition Process data base Measurand processing
Field protocols: 101, 61850, HTTP
standards
INC 448 Advanced Process Control, 2005
Applications: OPC & SCADA
browser on same or other machine (IE, Netscape,)
web server
(IIS, TomCat)
page logic
code-behind (servlets, .NET
web-pages (HTM, JSP, ASP,..)
data base
scripts & code (Java, Perl, C#,..)
Model-Viewer-Controller
INC 448 Advanced Process Control, 2005
The .NET Framework
VB C++ C# JScript Visual Studio.NET Visual Studio.NET
Common Language Specification ASP.NET: Web Services and Web Forms Windows Windows Forms Forms
ADO.NET: Data and XML Base Class Library Common Language Runtime
INC 448 Advanced Process Control, 2005
Example of .NET application
INC 448 Advanced Process Control, 2005
Example of JAVA application
http://www.netmodule.com/e/produkte/jpc.asp
INC 448 Advanced Process Control, 2005
SUMMARY
Resource: http://www.matrikonopc.com/index.html
INC 448 Advanced Process Control, 2005