|On this page…|
OPC Toolbox™ software implements a hierarchical object-oriented approach to communicating with OPC servers using the OPC Data Access and Historical Data Access Standards. Using toolbox functions, you create OPC Data Access (DA) and Historical Data Access (HDA) Client objects which represent the connection between MATLAB® and an OPC server. Using properties of the client objects you can control various aspects of the communication link, such as time out periods, connection status, and storage of events associated with that client. Connect to OPC Data Access Servers and Connect to OPC HDA Servers describe how to create DA and HDA client objects respectively.
Once you establish a connection to an OPC DA server, you create Data Access Group objects (dagroup objects) that represent collections of OPC Data Access Items. You then add Data Access Item objects (daitem objects) to that group, for monitoring server item values from the OPC server and writing values to the OPC server. You can use the dagroup object to perform such actions as determining how often the items in the group must be updated, executing a MATLAB function when the server provides notification of changes in item state, and other tasks related to the group. Create OPC Toolbox Data Access Objects describes how to create and configure dagroup objects and add daitem objects to a group.
Using OPC Toolbox DA functionality, you can log records (a list of items that have changed, and their new values) from an OPC Data Access Server to disk or to memory, for later processing. The logging task is controlled by the dagroup object. Log OPC Server Data describes how to log data using the OPC Toolbox logging mechanism.
The HDA functionality allows for the retrieval and analysis of historical data from HDA OPC servers. Establishing a connection to an HDA server via the OPC HDA client object, allows you to retrieve historical data for a range of times or at a specific time. Both raw and aggregated data collections can be retrieved in the form of opc.hda.Data objects. These data objects provide numerous data manipulation and display operations.
To work with the data you acquire, you must bring it into the MATLAB workspace. When the records are acquired, the toolbox stores them in a memory buffer or on disk. The toolbox provides several ways to bring one or more records of data into the workspace where you can analyze or visualize the data.
You can enhance your OPC application by using DA event callbacks. The toolbox has defined certain OPC Toolbox software occurrences, such as the start of an acquisition task, as well as OPC server initiated occurrences, such as notification that an item's state has changed, as events. You can associate the execution of a particular function with a particular event.
When working in the Simulink® environment, you can use blocks from the OPC Toolbox block library to use live OPC data as inputs to your model and update the OPC server with your model outputs. The OPC Toolbox block library includes the capability of running Simulink models in pseudo real time, by slowing the simulation to match the system clock. You can prototype control systems, provide plant simulators, and perform optimization and tuning tasks using Simulink and the OPC Toolbox block library.
Open Process Control (OPC), also known as OLE for Process Control, is a series of seven specifications defined by the OPC Foundation ( http://www.opcfoundation.org ) for supporting open connectivity in industrial automation. OPC uses Microsoft® DCOM technology to provide a communication link between OPC servers and OPC clients. OPC has been designed to provide reliable communication of information in a process plant, such as a petrochemical refinery, an automobile assembly line, or a paper mill.
Before you interact with OPC servers using OPC Toolbox software, you should understand the OPC client-server relationship, how OPC servers organize their server items, and how clients can interact with those server items. Toolbox Object Hierarchy for the Data Access Standard explains these concepts in detail.
OPC Toolbox software is an OPC Data Access and Historical Data Access client application, capable of connecting to any OPC DA and HDA compliant server. By utilizing the OPC Foundation standards, the toolbox does not require any knowledge about the internal configuration and operation of the OPC server. Instead, the OPC Standard provides the common mechanism for the server and client to interact with each other.
An OPC server is identified by a unique server ID. The server ID is unique to the computer on which the server is located. A combination of the host name of the server computer, and the server ID of the OPC server, provides a unique identifier for an OPC server on a network of computers.
All OPC servers are required to publish a name space, consisting of an arrangement of the name of every server item (also known as an item ID) associated with that server. The name space provides the internal map of every device and location that the server is able to monitor and/or update.
The following figure shows a portion of the name space on a typical OPC server.
A server item represents a value on the OPC server that a client may be interested in. A server item could represent a physical measurement device (such as a temperature sensor), a particular component of a device (such as the set-point for a controller), or a variable or storage location in a supervisory control and data acquisition (SCADA) system. Each server item is uniquely represented on the server by a fully qualified item ID. The fully qualified item ID is usually made up of the path to that server item in the tree, with each node name separated by a period character. In Figure 1-1, , the fully qualified item ID for the highlighted server item might be Area01.UnitA.FIC01.PV.
Most OPC servers provide a hierarchical name space, where server items are arranged in a tree-like structure. The tree can contain many different categories (called branch nodes), each with one or more branches and/or leaf nodes. A leaf node contains no other branches, and often represents a specific server Item. The fully qualified item ID of a server item is simply the `path' to that leaf node, with a server-dependent separator.
Some OPC servers provide only a flat name space, where server items are all arranged in one single group. You could consider a flat name space as a name space containing only leaf nodes.
It is possible to convert a hierarchical name space into a flat name space. It is not always possible to convert a flat name space into a hierarchical name space.
For information on how to obtain the name space of an OPC server, see Browse the OPC Server Name Space.
OPC Toolbox software provides the Data Access client capabilities from within MATLAB. To use this toolbox functionality, you need access to an OPC server that supports the Data Access Specification version 2.05. In addition, you will need to ensure that you are able to connect to those OPC servers from the computer on which the toolbox software is installed. For more information on how to configure the client and server computers so that you can connect to an OPC server, see Set Up for OPC Toolbox Software.