OPCApplication of Communication Principles in data collection
OPC is short for Object Linking and Embedding (OLE) for process control. It is an application of Microsoft's object link and embedding technology in Process Control. OPC is based on OLE/COM/DCOM technology and adopts the customer/Server mode, providing unified standards for object-oriented development of industrial automation software, this standard defines how Microsoft Operating Systems Exchange automated real-time data between PC-based clients.
In the OPC Data Access specification, an OPC Data Access Server includes several types of objects (OPC server), groups (OPC group), and items (OPC item ). The OPC Server Object maintains information about the server and serves as the container of the OPC group object. The OPC Group Object maintains information about itself, provides a mechanism to accommodate OPC items, and manages OPC items.
The OPC server object mainly implements the iunknown and iopcserver interfaces. the OPC client communicates with the OPC object through the OPC server interface. The iopcserver interface provides a convenient and effective OPC group method for OPC customers. The OPC Group provides a means for the customer program to organize data. One or more OPC items can be defined in each group. There are two types of groups: public and local. A public group can be shared by multiple customers, while a local group can only be used by one customer. The OPC group has the following main attributes:
Name-group name;
Active-indicates the activation status of the group;
Update Rate OPC-the update rate at which the server submits data changes to the client program;
Percent deadband-data dead zone, which is the minimum data percentage that can cause data changes.
OPC indicates the connection to the data in the server. It is not a data source, but a connection to the data source.
Each item corresponds to the following main attributes:
Active item activation status;
Data of the value item, type: variant;
Quality indicates the reliability of the value. The type is short;
Time stamp indicates the data access time.
The OPC specification includes two sets of interfaces: Custom interface and automation interface ). A custom interface is a required interface of the OPC server. It describes the interface and method of the OPC component object and is suitable for the c ++ and PASCAL programming languages, the customer application that can achieve the best running performance, the custom interface does not have an item object, and its operations on the item are all performed by the group object that includes this item. An automatic interface is an optional interface that provides an interface for automatic configuration and access to process control data, it facilitates Visual Basic, Excel, and other advanced commercial software that can use OLE Automation server application interfaces.
The data acquisition card (Universal multi-serial port card, nic) is installed in the server, and the OPC server is installed in the software to detect, monitor, adjust, and diagnose various devices on the site.
Considering that the system has high requirements on real-time data, the data collection software installed on the client uses VC ++ 6.0 as the development tool, and the communication with the OPC server uses the OPC custom interface. The software consists of two modules: OPC data collection and data storage. The Win32 Multi-thread technology is used for communication between modules. OPC Data Collection is used as a working thread to run in the background. Data Storage is the primary thread of the system. The thread function of the worker thread cyclically reads data from the OPC server, and the data changes constantly start the writing events of the master thread. In addition, in order to ensure data security, the signal lamp synchronization object is used to coordinate the access of the two threads to the shared resources.
The DCS System of the device is cs3000 of Yoko Corporation of Japan and has a host computer software. cs3000 supports OPC communication and can communicate with the OPC server of cs3000 software package to obtain real-time data. For example, an industrial computer is used to collect real-time data. The data acquisition machine is installed with two NICs, one of which is connected to the PLC engineer station (PC), and the other is connected to the fiber optic network in the factory through a switch. In this way, the data collection machine communicates with the two networks at the same time, first obtains real-time data from the host computer through OPC, and then sends real-time data to the real-time database.
To sum up, the device currently uses some important technical indicators:
1. between the customer and the server, the customer interface and the active access communication mode are adopted;
2. Communication between the customer and the server is also an inter-process channel communication that does not occupy excessive CPU and memory resources;
3. data communication between the customer and the server reads Server Buffer data in read-only mode;
4. The collection number is 207;
5. The refresh frequency is 20 seconds.
Application of OPC communication principle in data collection