Sie sind auf Seite 1von 16

OPC Overview

OPC is the worlds most popular standards-based data-connectivity method The Industrys Requirements: Provide business applications with easy and common ACCESS to industrial plant floor DATA. Foster greater INTEROPERABILITY between automation and control applications, field devices, and business and office applications. The Answer: OPC = OLE for Process Control A standard INTERFACE which enables the development of interoperable servers and clients applications. Allows MULTI Client/Server Architecture. Allows Local and REMOTE Server access. Manages REAL TIME information. OPC stands for OLE for Process Control and is "a standard mechanism for communicating to numerous data sources, either devices on the factory floor, or a database in a control room." That is, OPC is a software interface standard that allows Windows programs to communicate with industrial hardware devices. OPC serves as an abstraction layer between Data Sources and Data Sinks - enabling intercommunication without either side having to know the others native protocol.

Based on Microsofts OLE (now ActiveX), COM (component object model) and DCOM (distributed component object model) technologies, OPC consists of a standard set of interfaces, properties, and methods for use in process-control and manufacturing-automation applications. OLE COM Automation provides a data access via local-area network, remote sites or the Internet enables the definition of Objects with Methods and Properties Local: the Server and the Client are on the same PC. Remote(DCOM): Server & Client are on different PCs.

OPCs hallmark plug-and-play approach to data connectivity lead to its rapid rise in popularity, making it the worlds most popular data-connectivity technology. Openness Productivity Connectivity Openness Productivity Connectivity Users are able to EASILY ACCESS real-time industrial plant floor DATA OPC is an OPEN standard, software and hardware manufacturers have to spend less time on communication and database integration issues End users will be able to use every OPC Client application (HMI, SCADA, MES, Custom...) with a broad range of automation devices

OPC Specification The OPC specification defines the interface between OPC Client and OPC Server in the form of objects and methods. Specification (Common Definitions and Interfaces) (Data Access Specification) (Alarms and Events Specification) (Historical Data Access Specification) (Batch Specification) (Security Specification) OPC XML (eXtensible Markup Language) OPC Architecture Description (Data Access Server)(Data Access Client) Windows NT Security XML OPC

Component

Description An OPC server is an implementation of an OPC interface. It is a software program that converts the hardware communication protocol used by a PLC into the OPC protocol.

OPC Server

An OPC server can be the direct reproduction of a process device or can


represent data which has already been processed by an application. OPC Servers are connectors that may be thought of as translators between the OPC world and a Data Sources native communication protocol or interface. An OPC client uses the standardized OPC interface of the OPC server to access process data. It software is any program that needs to connect to the hardware, such as an HMI. The OPC client uses the OPC server to get data from or send commands to the hardware.

Example of Service reading, changing or monitoring process variables (Data Access) monitoring of interrupts/alarms with optional filters (Alarm & Event) extracting or changing archive data (Historical Data Access) security and batch functions SCADA systems Manufacturing Execution Systems Microsoft Office Tools

OPC Client

OPC DA: Brief Used only to read and write REAL-TIME data Provides access to single-value data items called points Each point includes a value, a quality and a timestamp (1. Device, 2. OPC Server) Only uses latest values, not past values

OPC Interface Interface OPC Custom Interface OPC Automation Interface Description Designed for high volume/high throughput applications to attain maximum performance. More extended control Provided for ease of access to the data. Easier to use. Example Applications C++ Application VB Application (Visual Basic (VB) and Visual Basic for Applications (VBA))

The OPC Standard defines several objects with associated properties and methods. These objects are used to expose process data from a process control device in a standard manner. Every OPC server will make data available to clients using this model.

Structure of an OPC Server

OPC/COM Interfaces OPC Group & Item Management Item Data Optimization and Monitoring Device Specific Protocol Logic Hardware Connection Management
OPC Connections Connect Type OPC Aggregation OPC Tunnelling OPC Bridging Communication Mechanisms Mechanism Style Description Description Connect an OPC client to an OPC server on a single computer Connect an OPC client to several OPC servers. Connect an OPC client to an OPC server over a network. Connect an OPC server to another OPC server to share data.

Synchronous calls Polling NA Asynchronous calls

Pull Callback Push Data Model

Refresh Subscription

When a client issues a synchronous read the server does not release the control to the calling thread before the requested values are returned. Synchronous writes are also possible. When a client issues an asynchronous read, the server returns control immediately to the calling thread and later sends, using a predefined communication path, the requested values. Asynchronous writes are also possible. When a client issues a Refresh call, the OPC Server returns asynchronously the current values of the predefined set of data points using a predefined communication path. These calls are useful when a client switches from one view to another. Subscription is an event based mechanism. Servers notify clients when significant changes occur within a predefined set of data points

OPC Server OPC Server OPCServer, OPCGroup, OPCItem. OPCItem channel port OPCGroup OPCItem OPCItem OPCItem OPCServer OPCGroup OPCGroup Data Access Server Component OPC Server Object Description Manages an OPC Groups collection: hierarchical root of the OPC model. The OPC Server is responsible for acquiring the data requested by an OPC Client from the process control device. Each OPC Server Object contains a collection of OPC Group Objects. Manages an OPC Items collection: PLC variables list. The OPC Group Objects are logical collections of data to be gathered. The OPC Group Objects are used to organize the OPC Clients data access. The Group Objects represent collections of items. These items can be on different devices as long as the same server accesses all devices. The OPC Group object holds the OPC Item Objects that contain the values retrieved from the process control device. The OPC Group Objects can perform a repetitive read operation at a specified rate. The OPC Group Objects in an OPC Server may be shared by many OPC Clients or be private to a single OPC Client. The OPC Group Objects are created by the OPC Server object on behalf of OPC Clients. PLC Variable defined on a PLC and a communication network. The OPC Item Object represents a physical I/O point on a device network. The OPC Item Objects contain the actual value received from the process control device. The OPC Client specifies the OPC Item Object to the OPC Server through the OPC Item ID. The OPC Item ID is server specific. It uniquely identifies to the OPC server how to locate the value in the process control device. An OPC Item contains properties of the device including: the access path, value, time stamp, quality, and error

OPC Group Object

OPC Item Object

information associated with it. The access path identifies a recommended communication pathway to the device. The OPC Item Objects typically return a single value. The OPC Server may optionally return a timestamp and quality flag with the value. The OPC Item Objects can not be accessed directly through the OPC Data Access custom interface, but only via OPC Group objects. The OPC Item objects are created by the OPC Server object on behalf of OPC Clients. That is, the OPC Client adds OPC Item Objects to the OPC Group Objects.

A Data Access server component contains typically one OPC Server object which manages a set of OPC Item objects organized in OPC Group objects. An OPC Server can serve several OPC Clients. An OPC Client is implemented in a Data access client component. It can be connected to several OPC Servers. OPC Item and OPC Group objects are transient objects. By settings attributes of its OPC Group Objects, a OPC Client can parameterize its subscriptions.

The Type of OPC Group Objects Private Public

Description Created by a client for its exclusive use Created by the OPC Server or by an OPC Client which transforms one of its private groups

OPC DA: Objects as viewed by the OPC Server OPC (Data Access Server)(Object hierarchy)(Namespace) OPC (Root)(Node)(Item) OPC An OPC Server is structured as a directory with root, branches and leaves (items) An item (tag) is identified by its "fully qualified ItemID". Variables (tags) defined in the controllers are mirrored to the OPC DA Server.

OPC DA: Objects as viewed by the OPC Client An OPC Client builds its own hierarchy, using the OPC Servers hierarchical view. An OPC Client builds groups, populating them with items it is interested in. Items of a group are expected to have similar real-time requirements Items in the server are defined by the programmer of the PLC Each client may be interested in a different subset. Groups are not hierarchical, but flat.

OPC DA: Mapping items to groups 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.

OPC DA: Client Handle and Server handle The fully qualified item is not sufficient to identify an item, a client may subscribe the same item in different groups The pair { ClientHandle, ServerHandle } uniquely identifies an item.

OPC DA: Browsing: Fully Qualified ItemID and hierarchy A server has internally two ways to access the items: 1. the path shown when exploring the tree, and 2. the fully qualified ItemID, which is the internal path name used by the server. Clients usually search for an item though the hierarchical way. They position the browser on the corresponding branch and retrieve the fully qualified item ID, which is the name of the item as the server understands it. The fully qualified name is only used at configuration time, afterwards, objects are accessed over client handles and server handles The Tag ID uniquely identifies the OPC Item to the OPC Server. The actual OPC item name (tag) is compounded from the Address Space root. PLC t a g .

OPC DA: Item Properties ID Property V Description Q T D U

value time-stamp quality description engineering unit

Numerical or text (when writing, only the value is used) 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.) A text string describing the use and of the variable (optional) The unit in which the variable is expressed (optional)

OPC DA: Item Types 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"

OPC (Value) DCOM VARIANT (charshortlongbooleanfloatdoubleArrayString) (Timestamp) 2 bytes Value Good Uncertain Parameterization of the Communications The communications between OPC Data Access components and the behavior of an OPC Server can be controlled by Clients. Parameter Active state Mechanism Synchronous calls Asynchronous Description OPC Group and OPC Item objects have an "Active" attribute. A client can set or clear this attribute. By clearing the "Active" attribute, a client declares that it is no longer interested in an OPC Item or in any the OPC Item of a group. The OPC Server will then no longer return information about these items (when requested by read or when the corresponding

Cache / Device Enable / Disable

calls Refresh Subscription Synchronous calls Asynchronous calls Refresh Subscription Subscription

data items change). The OPC Server may equally stop reading the corresponding data items.

An OPC Server is expected to have a local copy - a cache - of its process data items. When issuing read and refresh calls, clients can specify if data shall be returned from the cache or from the devices.

A client can temporarily, suspend sending of subscription callbacks related to a group. This can be controlled by setting/clearing the "Enable" attribute of a group. If a client does not require receiving callback messages for small variations of analog data items, it can specify the minimum variation required to trigger OnDataChange callback messages. This "Dead band" attribute is a percentage which is applied group wide (on all analog OPC Item objects). OPC Items shall have significant minimum and maximum values defined. By settings the dead band of a group to 0, a client will be notified of any change provided the "Enable" attribute is set. The "UpdateRate" attribute is specified by a client. It determines the rate at which exception limits are checked within the server. Therefore, OnDataChange callback messages will not happen faster than the update rate.

Dead band

Subscription

Update Rate

Subscription

The update rate is a request from a client. Servers can select an update rate which is different. By specifying an update rate of 0, clients can request to be notified as soon as new information becomes available on their OPC Item objects. Update rates can be used by the server to determine how often the devices have to be read.

OPC DA: Transmission by subscription (events) The server notifies the client if an item changed in a particular group (myGroup_DataChange) or in any of the groups (myGroups_GlobalDataChange) In the second case, only the group in which the item changed will be sent. OPC DA: When are subscribed data transmitted? Situation myGroup.Refreshrate (called UpdateRate in DA 3.0) Rate at which the server samples the process values, expressed in seconds! (1/rate) earliest interval between changes of value are communicated to the client, but minimum rate at which the cache should be updated. (throttles changes, but may miss some) The server never sends data to a client at a rate faster than the client requests.

myGroup.Deadband

Applied only to analog values: deadband = % the range (in Engineering Units). Value is transmitted if the difference since last transmission exceeds deadband. Applies to all items of a group, DA 3.0 allows settings per group and per item.

Typical Scenarios Examples of interactions are given below. It should be noticed that a client which has subscribed to a group of OPC items can still issue read/write calls to access OPC Items belonging to this group. Communication Scenarios Steps 1. A Client connects to a Server; 2. The Client adds OPC Group objects with the appropriate Active attribute; 3. The Client adds OPC Item objects (with the appropriate Active attribute) to these groups; 4. The Client sends a synchronous read (Cache or Device) request for one or several OPC Items; 5. The Server returns the values of the requested OPC Items. 1. A Client connects to a Server; 2. The Client adds OPC Group objects with the appropriate Active attribute; 3. The Client adds OPC Item objects (with the appropriate Active attribute) to these groups; 4. The Client add a callback connection; 5. The Client sends an asynchronous read (Cache or Device) request for one or several OPC Items; 6. The Client sends another asynchronous read (Cache or Device) request for one or several OPC Items; 7. The Server returns the values of the requested OPC Items of the first call; 8. The Server returns the values of the requested OPC Items of the second call. 1. A Client connects to a Server; 2. The Client adds OPC Group objects with the appropriate Enable, Active, UpdateRate and DeadBand attributes; 3. The Client adds OPC Item objects (with the appropriate Active attribute) to these groups; 4. The Client add a callback connection; 5. The Server sends the values of the OPC Items of the OPC Groups which have changed significantly; 6. The server waits at least UpdateRate milliseconds, 7. The Server sends the values of the OPC Items of the OPC Groups which have changed significantly.

Synchronous reads

Asynchronous reads

Subscription

OPC DA: Communication Paradigm OPC DA works according to the shared memory paradigm. This means that a newer value overwrites the older one, no queues or history are kept. The server does not guarantee that different clients see the same snapshot of the plant. The server does not guarantee that all changes to variables are registered; changes may be missed if the polling period is too low.

OPC DA Client

OPC DA Client

OPC DA Server

OPC DA: Object Hierarchy at the Client OPCServer OPCGroups (collection) OPCGroup OPCItems (collection) OPCItem OPCBrowser An instance of an OPC Server. You must create an OPCServer object before you can get references to other objects. It contains the OPCGroups Collection and creates OPCBrowser objects. A collection containing all of the OPCGroup objects this client has created within the scope of the OPCServer that the Automation Application has connected to via OPCServer.Connect() An instance of an OPCGroup object. This object maintains state information and provides the mechanism to access data for the OPCItems Collection object that the OPCGroup object references. A collection containing all of the OPCItem objects this client has created within the scope of the OPCServer, and corresponding OPCGroup object that the Automation Application has created. An object that browses item names in the servers configuration. There exists only one instance of an OPCBrowser object per instance of an OPC Server object.

OPCServer OPCGroups (collection)

OPCGroup OPCGroup OPCItems (collection)

OPCItem OPCItem OPCItem OPCBrowser

OPC DA: Program - Initializing 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

Next group

Add item array to the group Activate and subscribe group

OPC DCOM OPC OPC OPC OPC (method) OPC COM -IUnknown Iunknown QueryInterfaceQueryInterface COM IUnknown QueryInterface COM IUnknown QueryInterfaceAddRef ReleaseQueryInterface IUnknown AddRef Release ( reference counting ) OPCServer IOPCCommon HRESULT HRESULT HRESULT HRESULT HRESULT IOPCServer HRESULT HRESULT HRESULT HRESULT HRESULT HRESULT AddGroup(szName, bActive, dwRequestedUpdateRate, hClientGroup, pTimeBias, pPercentDeadband, dwLCID, phServerGroup, pRevisedUpdateRate, riid, ppUnk) OPCGroup GetErrorString(dwError, dwLocale, ppString) GetGroupByName(szName, riid, ppUnk) OPCGroup GetStatus(ppServerStatus) OPCServer RemoveGroup(hServerGroup, bForce) OPCGroup CreateGroupEnumerator(dwScope, riid, ppUnk) OPCGroup

SetLocaleID ( dwLcid ) GetLocaleID ( pdwLcid ) QueryAvailableLocaleIDs ( pdwCount, pdwLcid ) ID GetErrorString ( dwError, ppString) SetClientName (szName) Clinet

IConnectionPointContainer EnumConnectionPoints( IEnumConnectionPoints ppEnum) Connection Points HRESULT HRESULT FindConnectionPoint( REFIID riid, IConnectionPoint ppCP) Connection Point

IOPCItemProperties QueryAvailableProperties(szItemID, pdwCount,ppPropertyIDs, ppDescriptions, ppvtDataTypes ); OPCItem HRESULT HRESULT HRESULT GetItemProperties (szItemID, dwCount, pdwPropertyIDs,ppvData, ppErrors ) OPCItem LookupItemIDs( szItemID, dwCount, pdwPropertyIDs,ppszNewItemIDs, ppErrors ) OPCItem ID

IOPCBrowseServerAddressSpace (optional) QueryOrganization(pNameSpaceType ) HRESULT HRESULT HRESULT HRESULT HRESULT ChangeBrowsePosition(dwBrowseDirection, szString ) BrowseOPCItemIDs( dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter, dwAccessRightsFilter, ppIEnumString ) OPCServer OPCItem GetItemID( szItemDataID, szItemID ) OPCItem ID BrowseAccessPaths( szItemID, ppIEnumString ) OPCItem

OPCGroup Object IOPCGroupStateMgt GetState(pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband, pLCID, phClientGroup, phServerGroup) OPCGroup HRESULT HRESULT HRESULT HRESULT IOPCSyncIO HRESULT HRESULT HRESULT IOPCAsyncIO2 HRESULT HRESULT Read(dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors,) OPCGroup OPCItem(s) callback SetState(pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias, pPercentDeadband, pLCID, phClientGroup) OPCGroup SetState(pRequestedUpdateRate, pRevisedUpdateRate, pActive, pTimeBias, pPercentDeadband, pLCID, phClientGroup) OPCGroup SetName(szName) OPCGroup CloneGroup(szName, riid, ppUnk) OPCGroup

Read(dwSource, dwCount, phServer, ppItemValues, ppErrors); OPCGroup OPCItem(s) GetItemProperties (szItemID, dwCount, pdwPropertyIDs,ppvData, ppErrors ) OPCItem Write(dwCount, phServer, pItemValues, ppErrors) OPCGroup OPCItem(s)

HRESULT HRESULT HRESULT HRESULT HRESULT IOPCItemMgt HRESULT HRESULT HRESULT HRESULT HRESULT HRESULT HRESULT Write(dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID, ppErrors) OPCGroup OPCItem(s) Cancel2 (dwCancelID) / Refresh2(dwSource, dwTransactionID, pdwCancelID) OPCGroup OPCItem(s) SetEnable(bEnable) OPCGroup Enable GetEnable(pbEnable) OPCGroup Enable

AddItems(dwCount, pItemArray, ppAddResults, ppErrors); OPCGroup OPCItem(s) ValidateItems(dwCount, pItemArray, bBlobUpdate, ppValidationResults, ppErrors) OPCItem(s) RemoveItems(dwCount, phServer, ppErrors) OPCGroup OPCItem(s) SetActiveState(dwCount, phServer, bActive, ppErrors) OPCItem(s) Avtive SetClientHandles(dwCount, phServer, phClient, ppErrors) OPCItem(s) handle SetDatatypes(dwCount, phServer, pRequestedDatatypes, ppErrors) OPCItem(s) CreateEnumerator(riid, ppUnk) OPCItems

IConnectionPointContainer EnumConnectionPoints( IEnumConnectionPoints ppEnum) Connection Points HRESULT HRESULT FindConnectionPoint( REFIID riid, IConnectionPoint ppCP) Connection Point

An event is a general change of state that is relevant to the OPC server. An event signals a change: 1. in the field device ("production started") 2. in the OPC server ("alarm acknowledged") 3. in the application ("operator action") OPC AE defines three kinds of events: 1. simple: process control system related events (change of a boolean variable) 2. condition-related: notifies a change of an alarm condition (CLEARED, ACKNOWLEDGED), (see later) 3. tracking-related: origin outside of the process (e.g. operator intervention) An event is identified by its source (the object that generates the event. e.g. Tank1) and the event name (which can be the same as in another object, e.g. HiLevelCond)

Das könnte Ihnen auch gefallen