Click here to Skip to main content
Click here to Skip to main content

OPC Technology

, 18 Dec 2005
Rate this:
Please Sign up or sign in to vote.
COM/OLE based technology for Process Control - An Overview.

Contents

Schematic of OPC Server.

OPC Schematic with Hardware Device & Client Application.
Figure 1.

<!------------------------------- STEP 3 ---------------------------> <!-- Add the article text. Please use simple formatting (

,

etc) -->

Introduction

COM/OLE applications are widely used in Industrial Automation and Process Control domains. Since not many programmers are aware of these technologies, I thought to share my experience in OPC and most developers would love to expand their knowledge about COM/OLE application areas.

This is my first ever article on Code Project, so if you feel anything needs to be improved, drop me a line. Your suggestions and comments are most welcome.

The goal of article: Give simple & understandable overview of OPC. More detailed information and specifications can be downloaded from OPC Foundation and websites mentioned in Resources section.

So first, about the above diagram...

Theory about Figure 1:
On left-bottom is a hardware device. It could be a PLC (programmable logic controller), a temperature sensor, roller belt controller, or just about any industrial device. Central part is the OPC server. Right side is the client that wants to operate the device. The OPC Server gives out standard COM interfaces so that any client aware of these OPC Interfaces can interface with server and operate the device - without programming device driver for that hardware. Hardware can be as varied as OPC server can handle and clients can still read and write from this hardware.
Now back to our OPC course. This article gives an overview of OPC and covers following topics. Source code is not available, since most of server code is specific to hardware. And client would still need a server to connect to. But yes, if you want to experiment with OPC, check out the Resources section below.

History of OPC

In 1996, a group of companies Rockwell Software, Intellution, et. al. came together to form a consortium that defined a standard for process control. SCADA and similar standardization efforts were being made at that time in process control and automation industry. This group created an initial draft that was based on Microsoft's Object Linking and Embedding (OLE). It was called OLE for Process Control (OPC). OPC Foundation publishes specifications and manages everything that goes into OPC technology.

Today more than 300 companies are part of OPC Foundation. Microsoft, GE, Siemens, Rockwell, ABB, Ford, Honeywell and more are members that actively contribute and consume OPC technology.

In 2005, OPC Foundation released OPC Unified Architecture draft. There are predecessor drafts released before - OPC HDA, OPC DX, OPC AE, OPC Commands, OPC Security. We will briefly study them in this article.

By now, you must have a question in your mind. Let me answer it below...

Why do we need OPC? its Benefits

I was also a first timer to OPC (coming from varied experience in DevTools, eLearning, CAD/PLM, Multimedia), and had no clue as to why do we need it. I found that learning it through a case study was very helpful, so I am going to do the same for you. To understand the need for standardization in process control industry, let me give you an actual case study performed by a giant organization in Petrochemicals business.

Refer to figure 2. It shows the devices and software application that were in action on this particular petrochemical plant.

Without OPC, Every Software Needs to Know Every Device.
Figure 2.

PLC, Vibration sensor, and Calculation engine work on different communication protocols - TSAA, Modbus, and DDE. So the software applications that need data from these devices also need to be aware of TSAA, Modbus, and DDE protocol. Additionally each device needs to serve all the three applications. The process historian, GUI application providing human machine interface and the machine condition monitor all communicating with all devices results in a complexity. This deployment took the company around 10 days. And its cost was approximately US $ 50,000.

Now, someone like me Smile | :) came to them and said, "hey guys, why don't we think smart and implement as in Figure 3?". Observe the reduced complexity. Now all software applications talk only to the OPC Servers. And all devices also respond only to the OPC server. OPC Server provides the Black Box for software applications around hardware.

With OPC, Every Software Needs to Know ONLY OPC Server.
Figure 3.

The new implementation took just 2 days to deploy and cost incurred was approximately US $10,000. They could have eliminated 2 OPC servers as well and implemented device drivers right inside a single OPC server. This is a tradeoff and off the shelf OPC servers may have standard protocols support like DDE, Modbus and TSAA.

As you observed correctly, the benefits are:

  • Reduced load on device.
  • Scalability of system has increased.
  • OPC server provides caching of data.
  • Client applications need not know hardware protocol details.
  • Increased life for device (it need not serve multiple clients anymore).
  • Interoperability (Unix/Linux and Windows - both platforms are supported by OPC)
  • Standardization
Now that you have some insight into OPC benefits and history, let's take one step ahead to understand OPC terminology and concepts.

OPC Concepts & Terminology

OPC specification defines a consistent terminology to identify various entities involved. The best analogy to OPC way of data representation is that of a file system hierarchy. OPC calls it as OPC Address Space. Within this address space every entity can be uniquely identified by its "full-path". For example, refer to figure 4.

OPC Address Space Hierarchy - much like File System.
Figure 4.

OPC Address Space is hierarchical. It starts with a root. Then there are logical folders and sub-folders. Leaf nodes are OPC Items or Tags. Generally your sensors and actuators form the leaf nodes. This is an important point to understand and we will spend some time on it. For example, you have a device that can sense temperature, Pressure, and Humidity. Then these attributes are generally mapped as leaf nodes under some folder-subfolder hierarchy. We will see what that hierarchy can be in a moment. If you have an actuator (say, Turn_ON_Boiler), then that also becomes a leaf node. You can write to Turn_ON_Boiler values of 1 or 0 for example, and necessary action will be taken - of course we just assumed that your hardware control mechanism behaves this way. You can read from Temperature to know sensed value.

Hope we are all clear till this point. Now let's understand this "logical" folder stuff. The logical folders and sub-folders are used to represent state of your Industrial Automation system. This configuration can actually map to some physical configuration or even geographical setup. Let's spend some time to understand this one as well. For example, in this diagram we have an ethernet communication channel to which a wireless meter is connected. And within wireless meter, there are two classes "Average" and "Channel1". These folders and sub-folders are very effective means of grouping your process control parameters and values.

This address space is "published" to all clients of OPC server. The OPC clients can be simple spreadsheets like Excel, process historians that keep record of data coming from various industrial plant entities. Every client can create a logical entity called as group inside OPC server. Each OPC Group can contain a set of OPC Items.

Synchronous & Asynchronous OPC Item reading
OPC specification supports synchronous as well as asynchronous reading and writing on hardware devices. Since not all hardware device operations are fast-enough, the asynchronous mechanism of reading and writing to a device comes very handy.

COM Interfaces & Component Categories

Well, so now suppose you wish to write your first OPC client. If you were developing a client that runs on local machine as that of server, and if you were aware of all OPC Server ProgIDs, then we would not have any worries. But since that is not possible, we need an enumeration mechanism. Following is an enumeration mechanism.
<font size=2>OPC Component Categories

Enumeration issue is addressed by requiring OPC servers to implement
component categories. For example, all servers that are OPC DA 1.0
(more about this in later sections) compliant implement COM category
with CatID {63D5F430-CFE4-11d1-B2C8-0060083BA1FB}. Similarly the
servers compliant with OPC Data Access 2.0 implement category with
CatID {63D5F432-CFE4-11d1-B2C8-0060083BA1FB}.</font>
So OPC Foundation distributes a Windows Service called as OPCEnum.
<font size=2>Enumerating OPC Servers
OPCEnum.exe runs as a Windows Service and provides enumeration
functionality. Using OPCEnum, the client applications can query
available OPC Servers on local as well as remote networked machines.
Now let's look at server component interfaces.

OPC Server COM Interfaces.
Figure 5.

There are various COM interfaces that OPC Server must support according the OPC Specification compliance required. These basic interfaces have specific functionality.

IOPCBrowse This interface has methods that allow browsing OPC Address Space. Client can query level by level folders and subfolders till the leaf nodes. The hierarchy looks like shown in figure 4.

IOPCItemIO Interface is used for performing OPC Item read and write operations.

Now let's understand how OPC Client interacts with the OPC Server. Important steps involved are summarized in figure 6, below.

Steps involved in interaction of OPC Client & Server.
Figure 6.

I know you must still be wondering about this OPC Group term. Let's spend some time understanding it. Every client when opens a session with OPC Server, needs to create a logical group of items that it wants to read or write. Client can maintain multiple groups. Each group is given a unique name and has following attributes:
  • Update rate [milliseconds] at which the values of items are read.
  • Active or In-active Flag [Boolean] only if group is active that the items are processed.
  • Deadband [%] variations inside this band are considered NULL.
  • IO Mode [Synchronous/ASynchronous] all operations performed are either sync or async.
  • Time Bias [time] local time band with respect to GMT.
The OPC Group component supports following interfaces.

OPC Group COM Interfaces.
Figure 7.

As you may have identified these IOPCSyncIO etc interfaces that are relevant for synchronous and asynchronous OPC Item read and write operations. OPC Group Components also support connection point container for events that are used for client notifications. At least you have some idea by now that OPC is just another COM application in action - just that it is a standard meaning all OPC Clients and OPC Servers are bound by design contract.

OPC Compliance

OPC Foundation provides compliance test applications. Using these suites one can execute certain number of test cases on OPC Server and determine their compliance to particular OPC Specifications. There are several OPC specifications available (explained in next section). A typical compliance report looks like as shown in figures 8 & 9.

OPC COM Interface Compliance.
Figure 8.

OPC Group Interfaces Compliance.
Figure 9.

OPC Compliance Test Suite also supports testing for performance whereby the OPC Server in question is loaded with multiple items read and write requests. These determine time required per item operation and also passed and failed test cases. Once compliance is achieved, the report can then be uploaded to OPC Foundation web site for public reference. So that customers buying OPC Server from a particular vendor can make sure that the server is compliant to a particular specification and may meet their integration need with other software packages used on the plant.

OPC Specifications

OPC Foundation is responsible for maintaining and releasing new specifications. It is a body made up of industry experts, companies that produce OPC products and organizations that consume OPC products. So far OPC Foundation has released following specifications.
  • OPC-DA (Data Access) Provides access to real-time data. We can query most recent values of temperature, pressure, density, acceleration, and other types of process control data from OPC-DA server.
  • OPC-HDA (Historical Data Access) Used to retrieve historical process data for analysis. This data is typically stored in archives, databases or remote telemetry systems.
  • OPC-AE (Alarms & Events) OPC AE servers are used to exchange and acknowledge process alarms and events.
  • OPC-DX (Data eXchange) Defines how one OPC server exchanges data with other OPC servers.
  • OPC-XML (XML Data Access) Defines schema and data representation format based upon XML standard. Makes it possible to share & manipulate process control data across all operating systems – Windows, Unix, Solaris, etc.
  • There were several efforts put onto - OPC Security, OPC Batch, OPC Commands, OPC for ERP.

Most recently OPC Foundation has released a draft for OPC Unified Architecture that attempts to provide even more integration of process control data and software with other industrial software systems like ERP.

Resources

There are plenty of resources available on the web about OPC. Hope you enjoyed knowing a bit of OPC in this article. If you have any questions or suggestions, please post them here or drop me a line. srt@Suchit-Tiwari.Org or Suchit.Tiwari@Ge.com Your suggestions and comments are most welcome. <!------------------------------- That's it! --------------------------->

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

.Suchit
Architect GE India Innovation Center
India India
Suchit is an Architect at GE India Innovation Center, Hyderabad.
 
He architected and developed portions of Proficy RX, a Process Analytical Technology (PAT) Solution of GE Fanuc Intelligent Platforms.
 
He also is the Architect of OPC Server for hardware devices of GE Sensing. These devices sense temperature, humidity, combustibles, fluid flow, pressure and various engineering parameters - primarily used in Industrial Automation & Process Control applications.
 
Interests: Computer Graphics, Mathematical Modeling, Scientific Applications Development.
 
He lives in Hyderabad India with his wife and 2 kidbots. Loves reading books if these 2 small buddies allow him to. Smile | :)
 
Homepage : http://www.Suchit-Tiwari.Org

Comments and Discussions

 
SuggestionOPC HMI Components Pinmemberthoahn18-Nov-13 0:42 
QuestionDeveloping your own OPC Server PinmemberRickNash17-Nov-13 23:46 
QuestionGood Article More UA info desired Pinmemberstixoffire2-Jul-13 6:10 
QuestionHelp Pinmemberjoseji887-Apr-13 15:40 
AnswerRe: Help Pinmember.Suchit11-Apr-13 6:00 
Hello Joseji,
 
You will need to write a Client Application in VB.NET to read from OPC Server. The client application must follow OPC protocol and thereby it will be called OPC Client. Without OPC there is no direct way to read from OPC server.
 
There are several OCP Client codes available for your reference on the web. Google for it.
 
Best Regards,
Suchit
AnswerRe: Help PinmemberZbynekZ23-Mar-14 23:26 
GeneralMy vote of 4 PinmemberNyi Myo Thu5-Jul-12 18:56 
GeneralRe: My vote of 4 Pinmember.Suchit11-Apr-13 5:58 
QuestionWhat is memory leak or heap curruption here? [modified] Pinmemberglitteringsound26-Feb-10 0:55 
QuestionHow to Send LPWSTR in GetItemHandles() PinmemberANURAG VISHNOI22-Apr-09 19:23 
GeneralOPC with C# Pinmemberghilsham17-Dec-08 15:31 
QuestionExploring OPC servers Pinmembersreejesh_s_warrier15-Oct-08 23:41 
GeneralRegarding OPCHDA client! Pinmemberjitendra.mitra29-Jul-08 2:38 
GeneralRe: Regarding OPCHDA client! Pinmemberjitendra.mitra29-Jul-08 23:24 
QuestionOPC without COM Pinmemberdhina@opc10-Jul-08 19:14 
QuestionOPC server architecture. Pinmemberdhina@opc9-Jul-08 20:46 
AnswerRe: OPC server architecture. Pinmember.Suchit10-Jul-08 2:57 
GeneralRe: OPC server architecture. Pinmemberdhina@opc10-Jul-08 18:47 
QuestionHow the communication between Client And server takes place...? PinmemberCodemastergabriel29-Jun-08 21:53 
AnswerRe: How the communication between Client And server takes place...? Pinmember.Suchit29-Jun-08 23:07 
GeneralProblem with Connect to Server Pinmemberstancrm23-Apr-08 5:30 
AnswerRe: Problem with Connect to Server Pinmember .Suchit 23-Apr-08 5:56 
GeneralRe: Problem with Connect to Server Pinmemberstancrm23-Apr-08 20:32 
GeneralRe: Problem with Connect to Server Pinmemberstancrm24-Apr-08 0:24 
QuestionGetting list of tags in a server PinmemberMikil Bhatkar13-Aug-07 22:25 
AnswerRe: Getting list of tags in a server Pinmember.Suchit28-Aug-07 0:22 
QuestionCOM in Unix? is it possible? PinmemberRameswara2-Jul-07 18:48 
AnswerRe: COM in Unix? is it possible? Pinmember.Suchit2-Jul-07 20:03 
QuestionInformation about ServerVersion? PinmemberBiasto1-Feb-07 1:23 
AnswerRe: Information about ServerVersion? PinmemberEdner6-Nov-07 0:45 
QuestionDA Server 3.0 versus DA Server 2.0 PinmemberBiasto25-Jan-07 22:24 
AnswerRe: DA Server 3.0 versus DA Server 2.0 Pinmember.Suchit26-Jan-07 22:38 
QuestionCoCreateInstanceEx doesn't work!!! PinmemberBiasto25-Jan-07 4:31 
AnswerRe: CoCreateInstanceEx doesn't work!!! PinmemberBiasto25-Jan-07 22:22 
GeneralOPC server not any more connected PinmemberNorGUI22-Jan-07 2:30 
AnswerRe: OPC server not any more connected Pinmember.Suchit22-Jan-07 17:04 
GeneralFramed Message and an Unframed Message Pinmemberflippydeflippydebop12-Jun-06 1:20 
AnswerRe: Framed Message and an Unframed Message [modified] Pinmember.Suchit12-Jun-06 22:12 
GeneralRe: Framed Message and an Unframed Message Pinmemberflippydeflippydebop13-Jun-06 5:15 
GeneralNeed More Help PinmemberAnant wakode6-Jun-06 19:49 
AnswerRe: Need More Help Pinmember.Suchit6-Jun-06 20:57 
GeneralRe: Need More Help Pinmemberflippydeflippydebop12-Jun-06 1:20 
GeneralRe: Need More Help PinmemberAnant wakode12-Jun-06 18:24 
GeneralDNP3 Pinmemberflippydeflippydebop28-Mar-06 6:08 
AnswerRe: DNP3 Pinmember.Suchit28-Mar-06 19:41 
GeneralRe: DNP3 Pinmemberflippydeflippydebop28-Mar-06 21:17 
Generalregd Implementation of OPC PinmemberQuickDeveloper1-Mar-06 1:44 
AnswerRe: regd Implementation of OPC Pinmember.Suchit1-Mar-06 19:05 
GeneralRe: regd Implementation of OPC PinmemberQuickDeveloper1-Mar-06 19:36 
AnswerRe: regd Implementation of OPC Pinmember.Suchit1-Mar-06 20:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 18 Dec 2005
Article Copyright 2005 by .Suchit
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid