![]() |
Platforms, Frameworks & Libraries »
COM / COM+ »
General
Intermediate
OPC TechnologyBy .SuchitCOM/OLE based technology for Process Control - An Overview. |
C++, Windows, Visual Studio, COM, Dev
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Contents
Figure 1.
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: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.
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.
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.
Figure 2.
Now, someone like me :) 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.
Figure 3.
As you observed correctly, the benefits are:
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.
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}.So OPC Foundation distributes a Windows Service called as OPCEnum.
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.
Figure 5.
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.
Figure 6.
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.
Figure 8.
Figure 9.
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.
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 18 Dec 2005 Editor: |
Copyright 2005 by .Suchit Everything else Copyright © CodeProject, 1999-2009 Web21 | Advertise on the Code Project |