A multi-source fusion OPC data acquisition system and method based on Dao system

The multi-source fusion OPC data acquisition system on the Dao system addresses the lack of cross-platform data acquisition by integrating various modules for efficient and scalable data collection from multiple servers and measurement points, ensuring real-time data handling.

CN118642872BActive Publication Date: 2024-12-17CHINA STATE SHIPBUILDING CORP NO 707 RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411116847.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-17
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

There is no OPC data acquisition system developed based on the Dao operating system, which is urgent for replacing the VxWorks real-time system, necessitating a solution that supports cross-platform communication and data acquisition for different scenarios.

Method used

A multi-source fusion OPC data acquisition system and method utilizing Dao system, incorporating engineering management, configuration management, thread pool management, OPC UA and OPC DA client middleware, and data protocol conversion, enabling connection and data acquisition with external servers and supporting protocol conversion.

Benefits of technology

The system achieves high flexibility and scalability, supporting simultaneous collection of multiple servers and measurement points, ensuring real-time data grasp and stable operation, with verified performance in actual environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642872B_ABST
    Figure CN118642872B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data transmission, and specifically discloses a multi-source fusion OPC data acquisition system and method based on a system, the system comprising an engineering management module, a configuration management module, a remote monitoring module, a thread pool management module, an OPC UA client middleware, an OPC DA client middleware and an OPC data protocol conversion middleware, the OPC UA client middleware is used to create a connection channel between a client and an OPC UA server and perform data acquisition; the OPC DA client middleware is used to create a connection channel between a client and an OPC DA server and perform data acquisition; the remote monitoring module is used to receive, parse and display in real time the OPC data after protocol conversion. The present invention realizes connection communication and data acquisition with external server platforms of different OPC protocol types, and supports the conversion of internal network protocols to meet the application requirements of different scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and in particular to a multi-source fusion OPC data acquisition system and method based on a channel system. Background Art

[0002] With the rapid development of industrial Internet of Things, embedded real-time operating systems have become the core basic software for data acquisition, which has a vital impact on the function, performance, security controllability, maintainability and sustainable development of data communication and the full life cycle management of equipment. However, the original industrial data acquisition in key areas is mostly based on the vxworks real-time system. Due to the sensitivity and security of data in these areas, the replacement of the operating system is imminent. The "Dao" operating system is an embedded real-time operating system for general electronic equipment, with the main features of supporting multi-core and multi-process and full compatibility with Vx Works6.x. It includes operating system kernel, file system, network protocol stack, VxWorks compatibility layer, USB protocol stack and other functional components, providing software platform support for equipment data acquisition in the industrial field.

[0003] OPC (OLE for Process Control) is a communication specification for data exchange between devices and applications in industrial automation systems. Two common OPC standards are OPC DA (Data Access) and OPC UA (Unified Architecture).

[0004] OPC DA (Data Access) is an earlier OPC standard used to read and write real-time data between devices and applications from different manufacturers. It relies on the COM (Component Object Model) technology of the Windows platform. OPC DA is mainly used for traditional real-time data transmission, with a fast data transmission speed, and is suitable for scenarios with high real-time requirements such as industrial control systems. OPC DA is based on the COM technology of the Windows platform, so it has limited support for other operating systems and platforms.

[0005] OPC UA (Unified Architecture) is a more modern and comprehensive OPC standard that enables data exchange between different platforms and operating systems, and no longer relies on a specific operating system or development platform. OPC UA provides network-based communication, supports multiple transmission protocols such as TCP / IP, HTTP, etc., and provides data models and security mechanisms. OPC UA uses a network-based communication mechanism to enable data exchange on different operating systems and platforms.

[0006] Thread pool is a commonly used technology in concurrent programming. It is used to manage and reuse threads. When the application starts, a certain number of threads are created and stored in the thread pool. When a task needs to be executed, an idle thread is obtained from the thread pool to avoid the overhead of frequent creation and destruction of threads, and to control the number of concurrently executed threads, thereby improving system performance and resource utilization.

[0007] Data caching is an important means to improve data access efficiency. Caching technology is widely used in various systems and applications, such as operating systems, database systems, and applications, helping to improve overall performance and user experience.

[0008] At present, OPC data acquisition is mostly based on vxworks real-time system, and there is no OPC data acquisition system developed based on Dao system. Summary of the invention

[0009] The present invention aims to solve the problem that it is urgent for Dao system to replace VxWorks real-time system, but there is no OPC data acquisition system developed based on Dao system. To this end, the present invention provides a multi-source fusion OPC data acquisition system and method based on Dao system, which realizes connection communication and data acquisition with external server platforms of different OPC protocol types, and supports the conversion of internal network protocols to meet the application requirements of different scenarios. The present invention comprehensively uses Dao system, OPC UA and OPCDA communication, thread pool technology and data caching technology to effectively control the key data acquisition of core equipment, make full use of system resources, and improve the performance and response speed of the program.

[0010] The present invention provides a multi-source fusion OPC data acquisition system based on a road system, and the adopted technical scheme is as follows: comprising: an engineering management module, a configuration management module, a remote monitoring module, a thread pool management module, an OPC UA client middleware, an OPC DA client middleware and an OPC data protocol conversion middleware, wherein the engineering management module is connected with the configuration management module, the thread pool management module is respectively connected with the configuration management module, the OPC UA client middleware and the OPC DA client middleware, the OPC data protocol conversion middleware is respectively connected with the OPC UA client middleware, the OPC DA client middleware and the remote monitoring module,

[0011] The project management module is used to create, delete and maintain collection projects;

[0012] The configuration management module is used to create and maintain configuration information of the acquisition project;

[0013] The thread pool management module is used to parse the configuration information, obtain the OPC server object, create threads according to the number of OPC server objects, and save them in the thread pool. When executing OPC connection and data collection, an idle thread is obtained from the thread pool;

[0014] The OPC UA client middleware is used to create a connection channel between the client and the OPC UA server and perform data collection;

[0015] The OPC DA client middleware is used to create a connection channel between the client and the OPC DA server and perform data collection;

[0016] The OPC data protocol conversion middleware is used to convert the OPC data collected by the client into a protocol type that can be parsed by the remote monitoring module;

[0017] The remote monitoring module is used for receiving, analyzing and real-time displaying the OPC data after protocol conversion.

[0018] Furthermore, the configuration information includes acquisition service configuration and data service configuration; the acquisition service configuration includes the OPC Sever's IP, protocol type, Clsid, progId, data reading cycle and first data tag; the data service configuration mainly includes local IP and port, remote IP and port, data sending cycle, status sending cycle and second data tag.

[0019] Furthermore, the working process of the OPC UA client middleware is:

[0020] S11: parsing the nodes to be collected stored in the tree structure in the configuration information through a node relationship parser, and constructing an address space;

[0021] S12: Load the network-related header files in the Dao system in the acquisition project, comment or delete the network-related header files in the original library, use the sokcet() interface provided by the Dao system to replace the creation of the socket in the original library, and complete the OPC UA client initialization;

[0022] S13: Read the configuration file, create a connection request message of the application layer based on the TCP / IP protocol according to the standard defined by OPC UA, use the connect() interface provided by the system to connect, and modify the network stack parameters in the original library;

[0023] S14: Call ua_client_call_async() to send a request to the OPC UA server to read the data corresponding to the specified OPC tag, and the calling process returns immediately; obtain the response status of the asynchronous call by cyclically calling the ua_client_getCallResponse() interface, and determine whether the OPC UA server has completed the read operation, and then return the result in the form of a client callback.

[0024] Furthermore, in S13, multiple tasks are created through the taskSpawn() interface to enable the OPC UA client to connect to multiple OPC UA servers and collect data.

[0025] Further, the OPC DA client middleware includes:

[0026] The DCOM component module based on Dao System is used to initialize and release the COM runtime environment using a ring buffer through the user_memory address space, and to create a COM object instance on the OPC DA server, using ProgID as the unique object identifier for each COM class, setting the value of the port connected to the external OPC DA server to a random value, and initializing ProgID in a way that the IP is automatically assigned;

[0027] The server list query module is used to query the server's CLSID list by calling the List interface of the OPC DA server provided by the delta_opc_dcom module to complete the correspondence between ProgID and CLSID;

[0028] The server connection module is used to configure permissions, security attributes and policies by calling the connection_config provided by the delta_opc_dcom module, and then calling the dcom_connect() interface, passing in the ProgID and CLSID to create a connection with the COM component of the OPC DA server;

[0029] The tree query module is used to perform hierarchical queries on the OPC DA server by calling the opcGroup and opcItem interfaces provided by the delta_opc_dcom module and save the query results in a tree structure.

[0030] Furthermore, the OPC data protocol conversion middleware includes two protocol converters, corresponding to the OPC UA protocol and the OPC DA protocol respectively.

[0031] Furthermore, the remote monitoring module is also used to create, delete, and modify configuration files that store the acquisition projects.

[0032] Furthermore, the connection channel data cache management module is connected to the OPC UA client middleware and the OPC DA client middleware respectively.

[0033] The connection channel data cache management module is used to build an OPC acquisition data model, and perform network cache configuration, encryption, setting of first-level cache, and dynamic allocation of internal acquisition tasks on the connection channel based on the OPC acquisition data model;

[0034] The OPC acquisition data model includes data channel encoding, OPC protocol type, channel priority, and network channel cache. The data channel encoding encrypts the server's CLSID, IP, port, and random string by string fusion and performs MD5 encryption. The first five characters are intercepted as the data transmission key, and the last five characters are intercepted as the unique identifier of the connection channel. The network channel cache of OPC UA type data is ( , where H represents the protocol header length, Indicates Detailed information of each data item, N represents the total number of data items, F represents the frequency of data collection, P represents the channel priority, and m is the coefficient factor; the network channel cache of OPC DA type data is obtained by grabbing through network analysis tools or using set values;

[0035] The strategies for network cache configuration include cache partition strategy, cache priority strategy and cache cleanup strategy;

[0036] The encryption is to send a data transmission key when a connection request of the connection channel is sent, and to notify the OPC server to encrypt the OPC data;

[0037] The first-level cache is used to store the original OPC data received by the connection channel, and each connection channel is provided with one, and the size of the first-level cache is set to k times the size of the corresponding network channel cache;

[0038] Dynamically allocate internal collection tasks to allocate internal collection tasks to each connection channel based on the OPC data collection model combined with the priority-based preemption mechanism of the system, perform real-time detection of the external connectivity of each connection channel, and immediately release the cache space occupied and applied by the corresponding collection task of the connection channel after monitoring the disconnection of the connection channel from the external connection timeout, and dynamically allocate the released cache space to the remaining collection tasks according to the OPC collection data model.

[0039] Furthermore, it also includes a DCOM protocol stack simulation module connected to the OPC DA client middleware, the DCOM protocol stack simulation module includes a protocol stack simulation module, an interface conversion module, and a data conversion module, and the protocol stack simulation module, the interface conversion module, and the data conversion module are all compiled in the system image in the form of a static library.

[0040] The protocol stack simulation is used to directly connect with the system.

[0041] The interface conversion module is used to set up an interface conversion layer between the system and the third-party library.

[0042] The data conversion module is used to convert the data acquired by the system into a format that can be processed by the client.

[0043] The present invention also provides a multi-source fusion OPC data acquisition method based on a channel system, and the technical solution adopted is as follows: comprising:

[0044] Creating a collection project according to the configuration file, and creating configuration information of the collection project according to the collection project;

[0045] Parse the configuration information, obtain the OPC server object, create threads according to the number of OPC server objects, and save them in the thread pool;

[0046] When executing OPC connection and data collection, an idle thread is obtained from the thread pool. According to the OPC protocol type corresponding to the OPC connection and data collection, the OPC UA client middleware is called to create a connection channel between the client and the OPC UA server and perform data collection; or the OPC DA client middleware is called to create a connection channel between the client and the OPC DA server and perform data collection;

[0047] The OPC data collected by the client is converted into a protocol type that can be parsed by the remote monitoring module, and then the OPC data after protocol conversion is received, parsed and displayed in real time.

[0048] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:

[0049] The present invention is developed based on the embedded Dao operating system. The present invention realizes cross-platform communication supporting two OPC protocols by designing OPC UA client middleware and OPC DA client middleware based on the Dao system. The present invention has high flexibility and scalability, supports the number of servers for simultaneous collection to be no less than 5, the number of measurement points for simultaneous collection to be no less than 10,000, and real-time grasp of data changes during the collection process. It has been run and verified in the actual environment, and the system functions normally and the data collection is stable.

[0050] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 It is a structural block diagram of the system provided by the present invention.

[0053] Figure 2 It is a flow chart of the method provided by the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.

[0055] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0056] Combine the following Figure 1 and Figure 2 The present invention is further described in detail, and a multi-source fusion OPC data acquisition system and method based on a channel system of the present invention are described:

[0057] In this embodiment, Figure 1As shown, a multi-source fusion OPC data acquisition system based on a road system is provided, including: an engineering management module, a configuration management module, a remote monitoring module, a connection channel data cache management module, a thread pool management module, an OPC UA client middleware, an OPC DA client middleware and an OPC data protocol conversion middleware, wherein the engineering management module is connected to the configuration management module, the thread pool management module is respectively connected to the configuration management module, the OPC UA client middleware and the OPC DA client middleware, the OPC data protocol conversion middleware is respectively connected to the OPC UA client middleware, the OPC DA client middleware and the remote monitoring module, and the connection channel data cache management module is respectively connected to the OPC UA client middleware and the OPC DA client middleware.

[0058] The project management module, configuration management module, remote monitoring module, and connection channel data cache management module constitute the OPC acquisition management subsystem. The OPC acquisition management subsystem is developed based on the C / S architecture and is mainly responsible for the management of acquisition projects, the maintenance of configuration information, and the real-time monitoring of acquired data. The thread pool management module, OPC UA client middleware, OPC DA client middleware, and OPC data protocol conversion middleware constitute the OPC data acquisition subsystem. The OPC data acquisition subsystem reads and parses the configuration information, establishes a thread pool, and autonomously calls the corresponding OPC client middleware (OPC UA client middleware and OPC DA client middleware). It has self-diagnosis and self-recovery features, real-time detection of the OPC server operating status, and automatic reconnection to the OPC server, realizing multi-source fusion OPC data acquisition and forwarding.

[0059] The project management module is used to create, delete and maintain collection projects and generate a project list. Each collection project corresponds to different usage scenarios and external environments. Through the project management module, the collection project can be flexibly switched according to the changes in the scenario, so as to achieve high reuse and unified management of the collection function. Each collection project includes a collection service and a data service. The collection service is used for the configuration and management of data collection, and the data service is used for the configuration and management of data forwarding. The collection service configures the parameters of the external OPC server by creating a connection channel. The OPC server is divided into an OPC DA server and an OPC UA server. The data service manages the forwarding processing of the data collected by the channel by creating a channel that corresponds one to one with the channel in the collection service. The relevant personnel save the specific information of the collection project in the db.xml configuration file, and upload the configuration file to the corresponding path of the system through the upload function of the system. The project management module reads the configuration file and creates, deletes and maintains the collection project according to the content in the file.

[0060] The configuration management module is used to create and maintain the configuration information of the collection project. The configuration management module creates configuration information according to the content of the collection project, and the configuration information includes the collection service configuration and the data service configuration. The collection service configuration includes the IP, protocol type, Clsid (Class Identifier), progId (Program Identifier), data reading cycle and the first data tag of the OPC Sever, which realizes the software definition of the external server. Among them, the first data tag configures the information of the required tag points on the external OPC server to be collected, and the link of each tag point must correspond to the tag point on the OPC server to realize data collection on demand. The information of the first data tag supports two methods: batch upload through csv files and manual individual addition. The data service configuration mainly includes local IP and port, remote IP and port, data sending cycle, status sending cycle and second data tag. Among them, the second data tag configures the information of the tag point of the channel in the collection service to be forwarded, and each tag point is linked to the data tag in the channel of the collection service, realizing data forwarding on demand.

[0061] The configuration management module is the foundation of the entire multi-source fusion OPC data acquisition system. It creates and maintains the configuration information of the acquisition project in a visual way, solving the problem that applications in embedded systems cannot be configured visually.

[0062] The thread pool management module is used to parse the configuration information, obtain the OPC server object, and store it in the OPC server object list, create threads according to the number of OPC server objects, and save them in the thread pool. When executing OPC connection and data collection, an idle thread is obtained from the thread pool to avoid excessive consumption of system resources due to frequent creation and cancellation of threads. The thread pool management module calls the corresponding client middleware according to the OPC protocol type corresponding to the OPC connection and data collection. That is, when the OPC protocol type is OPC UA, the OPC UA client middleware is called; when the OPC protocol type is OPC DA, the OPC DA client middleware is called.

[0063] The OPC UA client middleware is used to create a connection channel between the client and the OPC UA server and collect data. Since the Dao operating system does not provide OPC UA components and services, it is necessary to use the mature OPC UASDK to develop an OPC UA client based on the Dao system. By creating a Downloadable Kernel Module Project project, the OPC UA SDK is encapsulated and tailored, and the data is converted into information. Through fully object-oriented functions, even the most complex multi-level structures can be modeled and extended. Data types and structures can be defined in the configuration file. It provides external APIs such as client creation, server connection, server address space traversal, node information acquisition, data node writing, and data encryption. Then it is compiled into a delta_opc_ua_client.out dynamic library file, stored in the project path, and loaded when the system starts, solving the problem of OPC UA communication under the Dao system.

[0064] The working process of the OPC UA client middleware is as follows:

[0065] S11: Node and address space management: The nodes to be collected are stored in a tree structure in the configuration information through the node relationship parser to construct the address space. Specifically, the nodes to be collected are first stored in the configuration file in a tree structure, and then based on the data model construction method provided by the system, a node relationship parser for collecting data is constructed. When the system is initialized, the address space is directly constructed by parsing the configuration information through the node relationship parser, which improves the efficiency of node construction. The nodes mainly include corresponding object nodes and method nodes and other data models. Each node has specific attributes and data types, and cooperates with the corresponding encoding and decoding mechanisms to ensure that the data can be correctly parsed and stored.

[0066] S12: Initialize the client: The OPC UA client is essentially a network socket. The general OPC UASDK creates a POSIX socket, while the socket in the DAO system follows the standard network programming interface and only supports the Internet domain address family, not the Unix domain address family. Therefore, first of all, you need to load the network-related header files in the DAO system in the acquisition project, including sockLib.h, inetLib.h, and hostLib.h. Secondly, comment or delete the network-related header files in the original library to avoid errors reported by the DAO system during the compilation process due to the inability to find these files. Finally, use the sokcet() interface provided by the DAO system to replace the creation of the socket in the original library. Complete the initialization of the OPC UA client.

[0067] S13: Establish connections with multiple OPC UA servers: By reading the IP address and port information of the OPC UA server in the configuration file, and creating a connection request message of the application layer based on the TCP / IP protocol according to the standard defined by OPC UA, finally use the connect() interface provided by the Dao system to connect, and modify the network stack parameters in the original library to create a channel for subsequent data exchange. The present invention also supports connection with multiple external OPC UA servers, using the multi-task concept provided by the Dao system, creating multiple tasks through the taskSpawn() interface, based on the task management and scheduling mechanism, effectively ensuring the concurrent execution of multiple tasks, and realizing the connection and data collection between the OPC UA client and multiple OPC UA servers.

[0068] S14: Request sending and asynchronous reading: The OPC UA client combines the underlying protocol of the system to reconstruct the request, response and other message serialization provided by the OPC UASDK, and converts them into binary format for transmission. Call ua_client_call_async() to send a request to the OPC UA server to apply for reading the data corresponding to the specified OPC tag, and the calling process returns immediately. Then, the ua_client_getCallResponse() interface is called in a loop to obtain the response status of the asynchronous call, and after determining whether the OPC UA server has completed the read operation, the result is returned in the form of an OPC UA client callback.

[0069] The OPC DA client middleware is used to create a connection channel between the client and the OPC DA server and perform data collection.

[0070] Since the OPC DA protocol is based on Microsoft's COM and DCOM technical specifications and its scope of use is limited to the Windows operating system, it is necessary to first create a DCOM component under the Dao system in order to achieve communication with the OPC DA server under the Dao system. By capturing and analyzing a large number of OPC DA communication messages, and making full use of the EntireX DCOM software development kit of DCOM under the Linux system, combined with the support of the Dao system's underlying protocol stack, the present invention creatively develops a DCOM component based on the Dao system and compiles it in the system image in the form of a static library. After enabling the DCOM function, the client running on it can communicate with the DCOM server on the Windows platform. Based on the DCOM component, the present invention implements the delta_opc_da_client.out dynamic library file, which contains the DCOM module delta_opc_dcom and the OPC operation module delta_opc_lib based on the Dao system. delta_opc_dcom mainly implements the interactive function with DCOM and provides an API for accessing DCOM. delta_opc_lib simplifies the OPC interface program, provides services such as server connection, basic server browsing, and server tree query, and realizes cross-platform communication of OPC DA.

[0071] The OPC DA client middleware includes:

[0072] The DCOM component module based on the Dao system is used to initialize and release the COM runtime environment using a ring buffer through the user_memory address space, and create a COM object instance on the OPC DA server, use ProgID as the unique object identifier of each COM class, set the value of the port connected to the external OPC DA server to a random value, and initialize ProgID in a way of automatically allocating IP. According to a thorough analysis of the EntireX DCOM software development kit, the present invention designs a DCOM component module based on the Dao system. The user_memory address space provided by the Dao system is used to initialize and release the COM runtime environment using a ring buffer, and create a COM object instance on the OPC DA server, so that remote service calls can be implemented later through the instance. Among them, each COM class has a unique object identifier. The present invention uses the ProgID provided by the Dao system as the unique object identifier. In actual applications, it is found that only one can connect successfully when connecting to multiple external OPC DA servers. The reason is that the Dao system returns a fixed port and the same ProgID. By changing the port value to a random value and changing the initialization method of the ProgID from a fixed IP to an automatically assigned IP, the identification conflict problem is solved to ensure that the local COM class and the COM class of the OPC DA server can correspond one to one. In addition, interfaces such as remote object query, remote connection, customized data stream and remote call management are encapsulated to provide underlying support for subsequent data communication.

[0073] The server list query module is used to query the OPC DA server on the destination IP. It queries the server's CLSID list by calling the OPC DA server's List interface provided by the delta_opc_dcom module, completes the correspondence between ProgID and CLSID, and realizes the connection between local COM and remote COM.

[0074] The server connection module is used to realize the connection and session management between the client and the OPC DA server. It configures the permissions, security attributes, policies and other information by calling the connection_config provided by the delta_opc_dcom module, and then calls the dcom_connect() interface to pass in the ProgID and CLSID information to create a connection with the COM component of the OPC DA server.

[0075] The tree query module is used to return the server objects, group objects and item objects on the OPC DA server in a tree structure through the treeBrowser() interface call. Different object types are classified and stored in the corresponding data model for subsequent data processing. Its implementation principle is to perform hierarchical queries on the OPC DA server by calling the opcGroup and opcItem interfaces provided by the delta_opc_dcom module, and save the query results in a tree structure. For the application layer, it realizes the function of querying all measurement point information by calling one interface, which greatly simplifies the development process of the application layer.

[0076] The OPC data protocol conversion middleware is used to convert the OPC data collected by the client into a protocol type that can be parsed by the remote monitoring module, which is the TCP protocol in this embodiment.

[0077] The OPC data protocol conversion middleware contains two protocol converters, corresponding to the OPC UA protocol and the OPCDA protocol. For different OPC protocol types, the OPC data protocol conversion middleware autonomously calls the corresponding protocol converter, which strips the protocol header and parses the data content based on the key-value format, and sends the final data to the OPC collection management subsystem as a TCP Client.

[0078] The remote monitoring module is used for receiving, analyzing and real-time displaying the OPC data after protocol conversion.

[0079] The remote monitoring module realizes the visualization of OPC data collection and data forwarding. By formulating the internal interface protocol of the remote monitoring module, the collected and forwarded data tags are forwarded to the remote monitoring module through the TCP protocol in the format of key-Value. The remote monitoring module is responsible for receiving, parsing and real-time display of OPC data messages, which are divided into collection service data visualization and data service data visualization. Collection service data visualization is responsible for monitoring and displaying the link status and data tag information during the data collection process, mainly including the connection information of the OPC server and the current value of the tag point, collection time, quality stamp, and number of changes. Data service visualization is responsible for monitoring and displaying the information of the data tag during data forwarding, mainly including the current value of the tag point, collection time, quality stamp, and number of changes.

[0080] The remote monitoring module is also used to create, delete, and modify the configuration files that store the acquisition projects. In the Dao system, it is not possible to directly create, delete, and maintain the acquisition projects through the project management module. Therefore, the remote monitoring module is used to create, delete, and modify the configuration files that store the acquisition projects, and the configuration files are saved in the corresponding path of this system.

[0081] The connection channel data cache management module is used to build an OPC acquisition data model, and perform network cache configuration, encryption, setting of first-level cache, and dynamic allocation of internal acquisition tasks on the connection channel based on the OPC acquisition data model;

[0082] The OPC acquisition data model includes data channel encoding, OPC protocol type, channel priority, and network channel cache. The data channel encoding encrypts the server's CLSID, IP, port, and random string by string fusion and performs MD5 encryption. The first five characters are intercepted as the data transmission key, and the last five characters are intercepted as the unique identifier of the connection channel. The network channel cache of OPC UA type data is ( , where H represents the protocol header length, Indicates Detailed information of each data item, N represents the total number of data items, F represents the frequency of data collection, P represents the channel priority, and m is the coefficient factor; the network channel cache of OPC DA type data is obtained by grabbing through network analysis tools or using set values;

[0083] The strategies for network cache configuration include cache partition strategy, cache priority strategy and cache cleanup strategy;

[0084] The encryption is to send a data transmission key when a connection request of the connection channel is sent, and to notify the OPC server to encrypt the OPC data;

[0085] The first-level cache is used to store the original OPC data received by the connection channel, and each connection channel is provided with one, and the size of the first-level cache is set to k times the size of the corresponding network channel cache;

[0086] Dynamically allocate internal collection tasks to allocate internal collection tasks to each connection channel based on the OPC data collection model combined with the priority-based preemption mechanism of the system, perform real-time detection of the external connectivity of each connection channel, and immediately release the cache space occupied and applied by the corresponding collection task of the connection channel after monitoring the disconnection of the connection channel from the external connection timeout, and dynamically allocate the released cache space to the remaining collection tasks according to the OPC collection data model.

[0087] Specifically: Construct an OPC acquisition data model: First, store all data acquisition information in the configuration file. After the system starts, the connection channel data cache management module reads the information in the configuration file to construct an OPC acquisition data model including data channel encoding, OPC protocol type, channel priority, and network channel cache. Among them, the data channel encoding encrypts the server's CLSID, IP, port, and random string through string fusion and MD5 encryption, intercepts the first five characters as the data transmission key, and intercepts the last five characters as the unique identifier of the connection channel, ensuring that the server CLSID information is not stolen. Among them, for OPC UA type data, the network channel cache is calculated based on the OPC protocol type, combined with the frequency, number of data items, and data storage length of each item. The calculation method for each network channel cache is ( , where H represents the protocol header length, Indicates Detailed information of each data item, N indicates the total number of data items, F indicates the frequency of data collection, P indicates the channel priority, and m is the coefficient factor, which defaults to 1. If the calculated result of the network channel cache is less than the value of OPC_MIN_Buffer, the coefficient will be increased to ensure that at least one packet of data can be received for data with many measurement points, reducing the process of splitting packets; for data with few measurement points, multiple packets of data can be stored for the upper layer to read at one time, reducing the reading frequency. For OPC DA type data, the data is converted into COM structure data and then transmitted. The object reference may contain additional information such as binding and offset, which can be obtained through network analysis tools or specified in the configuration file using set values.

[0088] Creating a connection channel for personalized OPC data based on the acquisition data model: The acquisition process of OPC can be based on a variety of underlying network protocols, and the Dao system optimizes and adapts the TCP network protocol, which has greatly improved the real-time performance compared to other desktop systems. Therefore, the OPC acquisition of the present invention uses the TCP protocol. The Dao system provides a default network channel cache for each TCP network connection. However, due to the different characteristics of the OPC acquisition channel corresponding to each connection, the requirements and encryption requirements for the actual network channel cache are different. Therefore, the present invention configures and encrypts the network cache for the connection channel based on the OPC acquisition data model. In terms of network cache, further encapsulation is performed on the interface of the network API provided by the Dao system, and a network cache configuration strategy is provided, which mainly includes a cache partition strategy, a cache priority strategy, and a cache cleanup strategy. The cache partition strategy sets different cache sizes for connection channels with different application characteristics, including setting different caches for the sending cache area and the receiving cache area according to different protocol types. The cache priority strategy is to assign different cache priorities to different network connections, and a high-priority connection channel can obtain a higher-priority cache resource. The cache clearing strategy mainly configures whether the cache data is cleared due to expiration and the clearing ratio. If this strategy is configured, the timeout is determined by periodically detecting the change of the cache identifier. After the timeout, the cache data is cleared in a first-in-first-out manner according to the set clearing ratio. Through the above-mentioned configuration strategy, the connection channel resources are reasonably allocated, and the rapid transmission of key data is prioritized to ensure that network data can be received with the most appropriate overhead and delay. In terms of data security, since the default security mechanism provided by OPC brings a large network overhead, the present invention provides an additional security configuration mechanism for OPC data items. When the connection request of the connection channel is sent, the data transmission key calculated by the OPC acquisition data model is sent, and the OPC server is notified to encrypt each OPC data. After the client receives the OPC data, it decrypts it during data preprocessing, achieving a balance between the security and real-time performance of OPC data transmission in a closed network environment.

[0089] Multi-channel cache configuration mechanism: If data processing tasks are created for each acquisition channel, the functions are redundant and the system overhead is large. If a unified processing task is set, the network transmission speed is high because the system is optimized and adapted to the TCP protocol, resulting in data reception speed faster than data processing speed, which will cause data forwarding packet loss. To address this problem, a first-level cache is set for each connection channel to store the original OPC data received by each connection channel. According to the actual operation situation, the size of the first-level cache is set to 3 times the size of the corresponding network channel cache. Each acquisition task performs data preprocessing on the first-level cache of each channel in turn, decrypts the data item data according to the OPC data model, and then uses the data channel code as an identifier to strip the data item name and data value collected by each connection channel into a new linked list and store it in the second-level cache. The data forwarding task will read the second-level cache and then forward it according to the specified protocol. Through the connection channel data cache management module, the entire client forms a cache configuration of channel network cache, channel preprocessing cache and unified forwarding cache, which greatly reduces the pressure of OPC data processing.

[0090] Dynamic allocation of internal acquisition tasks: Since the acquisition characteristic parameters of each connection channel are different, in view of the rapidity of the interrupt response of the channel system, the certainty of task scheduling and the limited system resources, the present invention designs a system resource dynamic tuning method based on real-time detection. The method mainly allocates internal acquisition tasks to each connection channel based on the OPC data acquisition model combined with the priority-based preemption mechanism of the channel system, performs real-time detection of the external connectivity of each connection channel, and immediately releases the cache space occupied and applied for by the corresponding acquisition task of the connection channel after monitoring the disconnection of the connection channel from the external connection timeout, and dynamically allocates the released cache space to the remaining acquisition tasks according to the OPC acquisition data model. The implementation method is that during the execution of the remaining acquisition tasks, if it is detected that its network connection is normal but the task is in an idle state, the acquisition task is notified through a semaphore, and after the corresponding cache is released, the cache value of the network channel cache in the OPC acquisition data model is added to the cache value to be allocated to the connection channel, and the cache is re-applied according to the new cache value, and then the acquisition task is restarted, thereby avoiding the waste of memory resources due to the long-term disconnection of a certain connection channel. After the network external connection of the disconnected connection channel is restored, each collection task is notified through a semaphore. After processing the data in the current cache, each collection task is immediately released and the cache is recreated according to the original network channel cache. After the reallocated resources of all collection tasks are recovered, the collection task of the disconnected connection channel is re-established.

[0091] In order to realize OPC DA communication between the Dao system and the OPC server of the external Windows system, it is necessary to simulate the DCOM protocol stack based on the Dao system. The present invention designs a DCOM protocol stack simulation module, which is connected to the OPC DA client middleware and is called when the OPC DA client middleware creates a connection channel. Different from the nested architecture of the DCOM protocol stack of the Windows system, the DCOM simulation based on the Dao system adopts a layered architecture, and the DCOM protocol stack simulation module includes a protocol stack simulation module, an interface conversion module, and a data conversion module. The protocol stack simulation is placed at the bottom layer and directly docked with the Dao system, which can quickly and accurately collect and preliminarily process data to ensure the efficiency of the data source. The protocol stack simulation module mainly defines the data generation, processing, transmission process and data encapsulation and decapsulation operations. Its implementation is mainly based on the simulation protocol quantitative analysis method. On the basis of the deep adaptation of the open source third-party library to the Dao system, a large number of simulation protocols are captured for quantitative analysis, and quantitative comparison is gradually performed with the protocol message of the client under the Windows system, and finally synchronization is achieved, realizing the OPC DA communication of heterogeneous systems. The interface conversion module is placed in the middle layer, responsible for setting up the interface conversion layer between the Dao system and the third-party library, shielding the differentiation problem caused by the inconsistency of the interfaces between the two. The data conversion module uses an adaptive data format conversion method to smoothly convert the data obtained by the Dao system into a format that can be processed within the client. These three modules are compiled in the Dao system image in the form of static libraries. The interfaces provided by these three modules will be called in the process of creating an OPC DA client for data collection and processing. It is not necessary to participate in the specific collection and conversion process, but only focus on the subsequent processing of the collected data, thus realizing the decoupling of the client and the underlying modules.

[0092] In this embodiment, Figure 2 As shown, a multi-source fusion OPC data acquisition method based on a channel system is provided, using the multi-source fusion OPC data acquisition system based on a channel system, including the following steps:

[0093] Step 1: Create a collection project according to the configuration file, and create configuration information of the collection project according to the collection project;

[0094] Step 2: Parse the configuration information, obtain the OPC server object, create threads according to the number of OPC server objects, and save them in the thread pool;

[0095] Step 3: When executing OPC connection and data collection, get an idle thread from the thread pool, call the OPC UA client middleware according to the OPC protocol type corresponding to the OPC connection and data collection, create a connection channel between the client and the OPC UA server and perform data collection; or call the OPC DA client middleware to create a connection channel between the client and the OPC DA server and perform data collection;

[0096] Step 4: Convert the OPC data collected by the client into a protocol type that can be parsed by the remote monitoring module, and then receive, parse and display the OPC data after protocol conversion in real time.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A multi-source fusion OPC data acquisition system based on a channel system, characterized in that: include: The project management module, the configuration management module, the remote monitoring module, the thread pool management module, the OPC UA client middleware, the OPC DA client middleware and the OPC data protocol conversion middleware are connected. The project management module is connected to the configuration management module. The thread pool management module is connected to the configuration management module, the OPC UA client middleware and the OPC DA client middleware respectively. The OPC data protocol conversion middleware is connected to the OPC UA client middleware, the OPC DA client middleware and the remote monitoring module respectively. The project management module is used to create, delete and maintain collection projects; The configuration management module is used to create and maintain configuration information of the acquisition project; The thread pool management module is used to parse the configuration information, obtain the OPC server object, create threads according to the number of OPC server objects, and save them in the thread pool. When executing OPC connection and data collection, an idle thread is obtained from the thread pool; The OPC UA client middleware is used to create a connection channel between the client and the OPC UA server and perform data collection; The OPC DA client middleware is used to create a connection channel between the client and the OPC DA server and perform data collection; The OPC DA client middleware includes: The DCOM component module based on the Dao system is used to initialize and release the COM runtime environment using a ring buffer through the user_memory address space, and to create a COM object instance on the remote server. The ProgID is used as the unique object identifier of each COM class. The value of the port connected to the external OPC DA server is set to a random value, and the ProgID is initialized in a way that the IP is automatically assigned; The server list query module is used to query the server's CLSID list by calling the List interface of the OPC DA server provided by the delta_opc_dcom module to complete the correspondence between ProgID and CLSID; The server connection module is used to configure permissions, security attributes and policies by calling the connection_config provided by the delta_opc_dcom module, and then call the dcom_connect() interface, passing in the ProgID and CLSID to create a connection with the COM component of the OPCDA server; The tree query module is used to perform hierarchical queries on the OPC DA server by calling the opcGroup and opcItem interfaces provided by the delta_opc_dcom module, and save the query results in a tree structure; The OPC data protocol conversion middleware is used to convert the OPC data collected by the client into a protocol type that can be parsed by the remote monitoring module; The remote monitoring module is used for receiving, analyzing and real-time displaying the OPC data after protocol conversion.

2. A multi-source fusion OPC data acquisition system based on a channel system as claimed in claim 1, characterized in that: The configuration information includes acquisition service configuration and data service configuration; the acquisition service configuration includes the OPC Sever's IP, protocol type, Clsid, progId, data reading cycle and first data tag; the data service configuration mainly includes the local IP and port, remote IP and port, data sending cycle, status sending cycle and second data tag.

3. A multi-source fusion OPC data acquisition system based on a channel system as claimed in claim 1, characterized in that: The working process of the OPC UA client middleware is as follows: S11: parsing the nodes to be collected stored in the tree structure in the configuration information through a node relationship parser, and constructing an address space; S12: Load the network-related header files in the Dao system in the acquisition project, comment or delete the network-related header files in the original library, use the sokcet() interface provided by the Dao system to replace the creation of the socket in the original library, and complete the OPC UA client initialization; S13: Read the configuration file, create a connection request message of the application layer based on the TCP / IP protocol according to the standard defined by OPC UA, use the connect() interface provided by the system to connect, and modify the network stack parameters in the original library; S14: Call ua_client_call_async() to send a request to the OPC UA server to read the data corresponding to the specified OPC tag. The calling process returns immediately. The ua_client_getCallResponse() interface is called cyclically to obtain the response status of the asynchronous call. After determining whether the OPC UA server has completed the read operation, the result is returned in the form of a client callback.

4. A multi-source fusion OPC data acquisition system based on a channel system as claimed in claim 3, characterized in that: In S13, multiple tasks are created through the taskSpawn() interface to enable the OPC UA client to connect to multiple OPC UA servers and collect data.

5. The multi-source fusion OPC data acquisition system based on the channel system as claimed in claim 1 is characterized in that: The OPC data protocol conversion middleware includes two protocol converters, corresponding to the OPC UA protocol and the OPC DA protocol respectively.

6. The multi-source fusion OPC data acquisition system based on the channel system as claimed in claim 1, characterized in that: The remote monitoring module is also used to create, delete, and modify configuration files that store acquisition projects.

7. The multi-source fusion OPC data acquisition system based on the channel system as claimed in claim 1, characterized in that: The connection channel data cache management module is connected to the OPC UA client middleware and the OPC DA client middleware respectively. The connection channel data cache management module is used to build an OPC acquisition data model, and perform network cache configuration, encryption, setting of first-level cache, and dynamic allocation of internal acquisition tasks on the connection channel based on the OPC acquisition data model; The OPC acquisition data model includes data channel encoding, OPC protocol type, channel priority, and network channel cache. The data channel encoding encrypts the server's CLSID, IP, port, and random string by string fusion and performs MD5 encryption. The first five characters are intercepted as the data transmission key, and the last five characters are intercepted as the unique identifier of the connection channel. The network channel cache of OPC UA type data is ( , where H represents the protocol header length, Indicates Detailed information of each data item, N represents the total number of data items, F represents the frequency of data collection, P represents the channel priority, and m is the coefficient factor; the network channel cache of OPC DA type data is obtained by grabbing through network analysis tools or using set values; The strategies for network cache configuration include cache partition strategy, cache priority strategy and cache cleanup strategy; The encryption is to send a data transmission key when a connection request of the connection channel is sent, and to notify the OPC server to encrypt the OPC data; The first-level cache is used to store the original OPC data received by the connection channel, and each connection channel is provided with one, and the size of the first-level cache is set to k times the size of the corresponding network channel cache; Dynamically allocate internal collection tasks to allocate internal collection tasks to each connection channel based on the OPC data collection model combined with the priority-based preemption mechanism of the system, perform real-time detection of the external connectivity of each connection channel, and immediately release the cache space occupied and applied by the corresponding collection task of the connection channel after monitoring the connection channel and the external connection are disconnected for timeout, and dynamically allocate the released cache space to the remaining collection tasks according to the OPC collection data model.

8. The multi-source fusion OPC data acquisition system based on the channel system as claimed in claim 1, characterized in that: It also includes a DCOM protocol stack simulation module connected to the OPC DA client middleware, the DCOM protocol stack simulation module includes a protocol stack simulation module, an interface conversion module, and a data conversion module, and the protocol stack simulation module, the interface conversion module, and the data conversion module are all compiled in the system image in the form of a static library. The protocol stack simulation is used to directly connect with the system. The interface conversion module is used to set up an interface conversion layer between the system and the third-party library. The data conversion module is used to convert the data acquired by the system into a format that can be processed by the client.

9. A multi-source fusion OPC data acquisition method based on a channel system, characterized in that: Using a multi-source fusion OPC data acquisition system based on a channel system as claimed in any one of claims 1 to 8, comprising: creating an acquisition project according to a configuration file, and creating configuration information of the acquisition project according to the acquisition project; Parse the configuration information, obtain the OPC server object, create threads according to the number of OPC server objects, and save them in the thread pool; When executing OPC connection and data collection, an idle thread is obtained from the thread pool. According to the OPC protocol type corresponding to the OPC connection and data collection, the OPC UA client middleware is called to create a connection channel between the client and the OPC UA server and perform data collection; or the OPC DA client middleware is called to create a connection channel between the client and the OPC DA server and perform data collection; The OPC DA client middleware includes: The DCOM component module based on the Dao system is used to initialize and release the COM runtime environment using a ring buffer through the user_memory address space, and to create a COM object instance on the remote server. The ProgID is used as the unique object identifier of each COM class. The value of the port connected to the external OPC DA server is set to a random value, and the ProgID is initialized in a way that the IP is automatically assigned; The server list query module is used to query the server's CLSID list by calling the List interface of the OPC DA server provided by the delta_opc_dcom module to complete the correspondence between ProgID and CLSID; The server connection module is used to configure permissions, security attributes and policies by calling the connection_config provided by the delta_opc_dcom module, and then call the dcom_connect() interface, passing in the ProgID and CLSID to create a connection with the COM component of the OPCDA server; The tree query module is used to perform hierarchical queries on the OPC DA server by calling the opcGroup and opcItem interfaces provided by the delta_opc_dcom module, and save the query results in a tree structure; The OPC data collected by the client is converted into a protocol type that can be parsed by the remote monitoring module, and then the OPC data after protocol conversion is received, parsed and displayed in real time.

Citation Information

Patent Citations

  • An OPC agent connection system and a connection method based on a key

    CN108989302A

  • Multi-source heterogeneous numerical control system monitoring server based on OPC UA

    CN114077633A