OPC server data acquisition system and method integrating fault processing and dynamic configuration
By designing an OPC server data acquisition system with integrated fault handling and dynamic configuration, the problems of low data acquisition efficiency, poor stability and excessive manual intervention in the existing technology are solved, and automated management, system stability improvement and data acquisition continuity are achieved. and flexibility.
Patent Information
- Application Number
- CN202411669189.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-21
AI Technical Summary
The existing data acquisition methods are inefficient, poor stability and have a lot of manual intervention, making it difficult to meet the requirements of modern industrial production for real-time, accuracy and efficient management of data acquisition. Especially when handling server connection disconnection or failure point management, manual intervention is required. , affects the continuity and stability of the system.
A data acquisition system for OPC server integrated troubleshooting and dynamic configuration is designed, including connection management module, group management module, fault point management module, data acquisition and release module and group point update module to realize automatic detection and reconnection of OPC server. , dynamically manage OPC groups and points, monitor and handle fault points, periodic data collection and release, and remote configuration management.
It improves data acquisition efficiency, reduces manual intervention, realizes automated management, enhances system stability, ensures the continuity and flexibility of data acquisition, and reduces manual management costs.
Smart Images

Figure CN119484283A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data acquisition, and in particular to an OPC server data acquisition system and method integrating fault processing and dynamic configuration. Background Art
[0002] In industrial automation systems, real-time data collection and accurate transmission are crucial for system monitoring and control. Existing data collection methods often have problems such as low efficiency, poor stability, and frequent manual intervention, which makes it difficult to meet the requirements of modern industrial production for real-time, accurate, and efficient management of data collection. For example, traditional methods often require manual intervention when dealing with server disconnection or fault point management, which not only affects the continuity and stability of the system, but may also cause data loss or delay. Summary of the invention
[0003] In view of the problems of low efficiency, poor stability and frequent manual intervention in the prior art, the present invention aims to provide an OPC server data acquisition system and method with integrated fault handling and dynamic configuration to ensure the real-time, accuracy, continuity and flexibility of data acquisition.
[0004] The present invention discloses an OPC server data acquisition system integrating fault processing and dynamic configuration, which comprises a connection management module, a group management module, a fault point management module, a data acquisition and publishing module and a group point update module; the connection management module and the group point update module are respectively connected to the group management module; the group management module is connected to the data acquisition and publishing module through the fault point management module; the group management module is also directly connected to the data acquisition and publishing module;
[0005] The connection management module is used to automatically detect the connection status of the OPC server and automatically try to reconnect when the connection is disconnected or not connected;
[0006] The group management module is used to automatically create, update and manage OPC groups based on the received group configuration information, dynamically add and remove OPC points within the group, and update the configuration of elements within the group;
[0007] The fault point management module is used to monitor the number of failed group points in the group and try to re-add failed group points when the preset threshold is reached; at the same time, it records and reports the relevant information of the fault points;
[0008] Data collection and publishing module, used to periodically read data from the OPC server and publish the data to the specified location through the callback function;
[0009] The group point update module is used to provide an independent thread to listen to the group point update request and dynamically adjust the configuration of the OPC group according to the request.
[0010] Furthermore, the connection management module is also used to:
[0011] By regularly detecting the status of the primary server, it automatically switches to the backup server when the primary server is unavailable; the heartbeat mechanism monitors the health status of the server in real time and dynamically selects the optimal server based on the priority strategy.
[0012] Furthermore, the connection management module is also used to:
[0013] Automatically detect the connection status of the OPC server. If the OPC server is found to be disconnected, set the group point, reconnect to the OPC server, set the global status, and the group management thread monitors the connection status and dynamically adds groups and points.
[0014] Furthermore, the fault point management module is specifically used to:
[0015] Detect the group point status. If the group point status is abnormal, traverse the group and obtain the failed group points. If the number of failed group points in the group reaches the preset threshold, call the group point addition interface and try to re-add the failed group points; at the same time, record and report the relevant information of the failed group point; the relevant information includes the name of the failed group point, the reason for failure and the number of retries.
[0016] Furthermore, the group management module is specifically used to:
[0017] Check the connection status and group point status of the OPC server. If the OPC server is connected, traverse the group and add the OPC group point. After successful addition, update the global group point handle, set the group point status, sleep for a specified time, and then check the connection status and group point status of the OPC server again; if adding the OPC group point fails, store the failed group point in the global dictionary.
[0018] Furthermore, the data collection and publishing module is specifically used for:
[0019] Determine the status of the group points. If the group points are normal, traverse the group to determine whether the group is deleting points. If the group is not deleting points, read the group point data, traverse to set the published data value, call the publishing interface to publish the point data, sleep for a sampling period, and re-determine the status of the group points. If the group points are abnormal, directly sleep for a sampling period and re-determine the status of the group points. If the group is deleting points, traverse the group again to determine whether the group is deleting points.
[0020] Furthermore, the group point update module is specifically used for:
[0021] Start UDP listening, loop waiting for requests, read request data, deserialize group point data, compare to get the group to be deleted, and delete the group; get the group points to be added and deleted by comparing the new group and the old group, call the group point adding interface to add the group to be added, and call the group point deleting interface to delete the group point. After sleeping and waiting, re-enter the loop waiting for requests.
[0022] The present invention also discloses an OPC server data acquisition method integrating fault processing and dynamic configuration, which is applicable to any of the above-mentioned OPC server data acquisition systems integrating fault processing and dynamic configuration, and comprises:
[0023] The connection management module automatically detects the connection status of the OPC server. If it finds that the OPC server is disconnected, it sets the group point and reconnects to the OPC server.
[0024] The group management module automatically creates, updates, and manages OPC groups based on the received group configuration information, dynamically adds and removes OPC points within the group, and updates the configuration of elements within the group;
[0025] The fault point management module monitors the number of failed group points in the group and attempts to re-add failed group points when the preset threshold is reached; it also records and reports relevant information about the fault points;
[0026] Data collection and publishing module, used to periodically read data from the OPC server and publish the data to the specified location through the callback function;
[0027] The group point update module provides an independent thread to listen to group point update requests and dynamically adjust the configuration of the OPC group based on the requests.
[0028] Furthermore, the fault point management module detects the group point status. If the group point status is abnormal, it traverses the group to obtain the failed group points. If the number of failed group points in the group reaches a preset threshold, it calls the group point adding interface to try to re-add the failed group points; at the same time, it records and reports the relevant information of the failed group points; the relevant information includes the name of the failed group point, the failure reason and the number of retries;
[0029] The group management module detects the connection status and group point status of the OPC server. If the OPC server is connected, it traverses the group and adds the OPC group point. After successful addition, it updates the global group point handle, sets the group point status, sleeps for a specified time, and then detects the connection status and group point status of the OPC server again. If the addition of the OPC group point fails, the failed group point is stored in the global dictionary.
[0030] Furthermore, the data collection and publishing module determines the group point status. If the group point is normal, it traverses the group to determine whether the group is deleting points. If the group is not deleting points, it reads the group data, traverses and sets the published data value, calls the publishing interface to publish, and re-judges the group point status after a dormant sampling period. If the group point is abnormal, it directly dormants for a sampling period and re-judges the group point status. If the group is deleting points, it traverses the group again to determine whether the group is deleting points.
[0031] The group point update module starts UDP listening, waits for requests in a loop, reads request data, deserializes group point data, compares the group to be deleted, and deletes the group; compares the new group with the old group to obtain the group points to be added and deleted, calls the group point adding interface to add the group to be added, and calls the group point deleting interface to delete the group point. After sleeping and waiting, it re-enters the loop waiting for requests.
[0032] Due to the adoption of the above technical solution, the present invention has the following advantages:
[0033] 1. Improve data collection efficiency, reduce manual intervention, and realize automated management.
[0034] 2. Enhance system stability and ensure the continuity of data collection through primary and backup server switching and fault handling mechanisms.
[0035] 3. Reduce manual management costs and realize automated group management and troubleshooting.
[0036] 4. Improve the flexibility of the system and realize flexible control and upgrade of the system through remote configuration management. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0038] Figure 1 The data acquisition system architecture shows the overall structure of the system and the interaction between modules.
[0039] Figure 2 This is a flowchart of the connection management module, showing the specific logic of switching between the primary and standby servers and reconnecting.
[0040] Figure 3 This is the structural diagram of the group management module, showing the creation, update and dynamic configuration process of the OPC group.
[0041] Figure 4This is the workflow diagram of the fault point management module, showing the detection, processing and reporting mechanism of the fault point.
[0042] Figure 5 This is the flow chart of the data acquisition and publishing module, showing the specific implementation of data reading and parallel processing.
[0043] Figure 6 This is a flowchart of the group point update module, showing the remote configuration management and dynamic adjustment process. DETAILED DESCRIPTION
[0044] The present invention is further described in conjunction with the accompanying drawings and embodiments, and the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field should fall within the scope of protection of the embodiments of the present invention.
[0045] See also Figure 1 The present invention provides an embodiment of an OPC (OLE for Process Control, information system software) server data acquisition system with integrated fault handling and dynamic configuration, which includes a connection management module, a group management module, a fault point management module, a data acquisition and publishing module and a group point update module; the connection management module and the group point update module are respectively connected to the group management module; the group management module is connected to the data acquisition and publishing module through the fault point management module; the group management module is also directly connected to the data acquisition and publishing module;
[0046] The connection management module is used to automatically detect the connection status of the OPC server and automatically try to reconnect when the connection is disconnected or not connected;
[0047] The group management module is used to automatically create, update and manage OPC groups based on the received group configuration information, dynamically add and remove OPC points within the group, and update the configuration of elements within the group;
[0048] The fault point management module is used to monitor the number of failed group points in the group and try to re-add failed group points when the preset threshold is reached; at the same time, it records and reports the relevant information of the fault points;
[0049] Data collection and publishing module, used to periodically read data from the OPC server and publish the data to the specified location through the callback function;
[0050] The group point update module is used to provide an independent thread to listen to the group point update request and dynamically adjust the configuration of the OPC group according to the request.
[0051] In this embodiment, the connection management module is also used to:
[0052] By regularly detecting the status of the primary server, it automatically switches to the backup server when the primary server is unavailable; the heartbeat mechanism monitors the health status of the server in real time and dynamically selects the optimal server based on the priority strategy.
[0053] In this embodiment, see Figure 2 , the connection management module is also used to:
[0054] Automatically detect the connection status of the OPC server. If the OPC server is found to be disconnected, set the group point, reconnect to the OPC server, set the global status, and the group management thread monitors the connection status and dynamically adds groups and points.
[0055] In this embodiment, see Figure 4 , the fault point management module is specifically used for:
[0056] Detect the group point status. If the group point status is abnormal, traverse the group and obtain the failed group points. If the number of failed group points in the group reaches the preset threshold, call the group point addition interface and try to re-add the failed group points; at the same time, record and report the relevant information of the failed group point; the relevant information includes the name of the failed group point, the reason for failure and the number of retries.
[0057] In this embodiment, see Figure 3 , group management module, specifically used for:
[0058] Check the connection status and group point status of the OPC server. If the OPC server is connected, traverse the group and add the OPC group point. After successful addition, update the global group point handle, set the group point status, sleep for a specified time, and then check the connection status and group point status of the OPC server again; if adding the OPC group point fails, store the failed group point in the global dictionary.
[0059] In this embodiment, see Figure 5 , data collection and publishing module, specifically used for:
[0060] Determine the status of the group points. If the group points are normal, traverse the group to determine whether the group is deleting points. If the group is not deleting points, read the group data, traverse and set the published data value, call the publishing interface to publish, sleep for a sampling period, and re-determine the status of the group points. If the group points are abnormal, directly sleep for a sampling period and re-determine the status of the group points. If the group is deleting points, traverse the group again to determine whether the group is deleting points.
[0061] In this embodiment, see Figure 6 , group point update module, specifically used for:
[0062] Start UDP (User Datagram Protocol) listening, loop waiting for requests, read request data, deserialize group point data, compare to get the group to be deleted, and delete the group; compare the new group with the old group to get the group points to be added and deleted, call the group point adding interface to add the group to be added, and call the group point deleting interface to delete the group point. After sleeping and waiting, re-enter the loop waiting for requests.
[0063] The present invention also provides an embodiment of an OPC server data acquisition method integrating fault handling and dynamic configuration, which is applicable to the OPC server data acquisition system integrating fault handling and dynamic configuration described in the above embodiment, and comprises:
[0064] The connection management module automatically detects the connection status of the OPC server. If it finds that the OPC server is disconnected, it sets the group point and reconnects to the OPC server.
[0065] The group management module automatically creates, updates, and manages OPC groups based on the received group configuration information, dynamically adds and removes OPC points within the group, and updates the configuration of elements within the group;
[0066] The fault point management module monitors the number of failed group points in the group and attempts to re-add failed group points when the preset threshold is reached; it also records and reports relevant information about the fault points;
[0067] Data collection and publishing module, used to periodically read data from the OPC server and publish the data to the specified location through the callback function;
[0068] The group point update module provides an independent thread to listen to group point update requests and dynamically adjust the configuration of the OPC group based on the requests.
[0069] In this embodiment, the fault point management module detects the group point status. If the group point status is abnormal, the group is traversed to obtain the failed group points. If the number of failed group points in the group reaches a preset threshold, the group point adding interface is called to try to re-add the failed group point; at the same time, the relevant information of the failed group point is recorded and reported; the relevant information includes the name of the failed group point, the failure reason and the number of retries;
[0070] The group management module detects the connection status and group point status of the OPC server. If the OPC server is connected, it traverses the group and adds the OPC group point. After successful addition, it updates the global group point handle, sets the group point status, sleeps for a specified time, and then detects the connection status and group point status of the OPC server again. If the addition of the OPC group point fails, the failed group point is stored in the global dictionary.
[0071] In this embodiment, the data collection and publishing module determines the group point status. If the group point is normal, it traverses the group to determine whether the group is deleting points. If the group is not deleting points, it reads the group data, traverses and sets the published data value, calls the publishing interface to publish, and re-judges the group point status after a dormant sampling period. If the group point is abnormal, it directly sleeps for a sampling period and re-judges the group point status. If the group is deleting points, it traverses the group again to determine whether the group is deleting points.
[0072] The group point update module starts UDP listening, waits for requests in a loop, reads request data, deserializes group point data, compares the group to be deleted, and deletes the group; compares the new group with the old group to obtain the group points to be added and deleted, calls the group point adding interface to add the group to be added, and calls the group point deleting interface to delete the group point. After sleeping and waiting, it re-enters the loop waiting for requests.
[0073] 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 above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. An OPC server data acquisition system integrating fault handling and dynamic configuration, characterized in that: It includes a connection management module, a group management module, a fault point management module, a data collection and release module and a group point update module; the connection management module and the group point update module are respectively connected to the group management module; the group management module is connected to the data collection and release module through the fault point management module; the group management module is also directly connected to the data collection and release module; The connection management module is used to automatically detect the connection status of the OPC server and automatically try to reconnect when the connection is disconnected or not connected; The group management module is used to automatically create, update and manage OPC groups based on the received group configuration information, dynamically add and remove OPC points within the group, and update the configuration of elements within the group; The fault point management module is used to monitor the number of failed group points in the group and try to re-add failed group points when the preset threshold is reached; at the same time, it records and reports the relevant information of the fault points; Data collection and publishing module, used to periodically read data from the OPC server and publish the data to the specified location through the callback function; The group point update module is used to provide an independent thread to listen to the group point update request and dynamically adjust the configuration of the OPC group according to the request.
2. The OPC server data acquisition system with integrated fault handling and dynamic configuration according to claim 1, characterized in that: The connection management module is also used to: By regularly detecting the status of the primary server, it automatically switches to the backup server when the primary server is unavailable; the heartbeat mechanism monitors the health status of the server in real time and dynamically selects the optimal server based on the priority strategy.
3. The OPC server data acquisition system with integrated fault handling and dynamic configuration according to claim 1, characterized in that: The connection management module is also used to: Automatically detect the connection status of the OPC server. If the OPC server is found to be disconnected, set the group point, reconnect to the OPC server, set the global status, and the group management thread monitors the connection status and dynamically adds groups and points.
4. The OPC server data acquisition system with integrated fault handling and dynamic configuration according to claim 1, characterized in that: The fault point management module is specifically used for: Detect the group point status. If the group point status is abnormal, traverse the group and obtain the failed group points. If the number of failed group points in the group reaches the preset threshold, call the group point addition interface and try to re-add the failed group points; at the same time, record and report the relevant information of the failed group point; the relevant information includes the name of the failed group point, the reason for failure and the number of retries.
5. The OPC server data acquisition system with integrated fault handling and dynamic configuration according to claim 1, characterized in that: The group management module is specifically used for: Check the connection status and group point status of the OPC server. If the OPC server is connected, traverse the group and add the OPC group point. After successful addition, update the global group point handle, set the group point status, sleep for a specified time, and then check the connection status and group point status of the OPC server again; if adding the OPC group point fails, store the failed group point in the global dictionary.
6. The OPC server data acquisition system with integrated fault handling and dynamic configuration according to claim 1, characterized in that: Data collection and publishing module, specifically used for: Determine the group point status. If the group point is normal, traverse the group to determine whether the group is deleting points. If the group is not deleting points, read the group point data, traverse and set the published data value, call the publishing interface to publish the point data, sleep for a sampling period, and re-determine the group point status. If the group point is abnormal, it will directly sleep for a sampling period and re-judge the group point status; if the group is deleting points, it will re-traverse the group to determine whether the group is deleting points.
7. The OPC server data acquisition system with integrated fault handling and dynamic configuration according to claim 1, characterized in that: Group point update module, specifically used for: Start UDP listening, loop waiting for requests, read request data, deserialize group point data, compare to get the group to be deleted, and delete the group; get the group points to be added and deleted by comparing the new group and the old group, call the group point adding interface to add the group to be added, and call the group point deleting interface to delete the group point. After sleeping and waiting, re-enter the loop waiting for requests.
8. An OPC server data acquisition method integrating fault handling and dynamic configuration, applicable to the OPC server data acquisition system integrating fault handling and dynamic configuration as claimed in any one of claims 1 to 7, characterized in that: include: The connection management module automatically detects the connection status of the OPC server. If it finds that the OPC server is disconnected, it sets the group point and reconnects to the OPC server. The group management module automatically creates, updates, and manages OPC groups based on the received group configuration information, dynamically adds and removes OPC points within the group, and updates the configuration of elements within the group; The fault point management module monitors the number of failed group points in the group and attempts to re-add failed group points when the preset threshold is reached; it also records and reports relevant information about the fault points; Data collection and publishing module, used to periodically read data from the OPC server and publish the data to the specified location through the callback function; The group point update module provides an independent thread to listen to group point update requests and dynamically adjust the configuration of the OPC group based on the requests.
9. The OPC server data acquisition method integrating fault handling and dynamic configuration according to claim 8, characterized in that: The fault point management module detects the group point status. If the group point status is abnormal, it traverses the group and obtains the failed group points. If the number of failed group points in the group reaches the preset threshold, it calls the group point addition interface to try to re-add the failed group points; at the same time, it records and reports the relevant information of the failed group points; the relevant information includes the name of the failed group point, the failure reason and the number of retries; The group management module detects the connection status and group point status of the OPC server. If the OPC server is connected, it traverses the group and adds the OPC group point. After successful addition, it updates the global group point handle, sets the group point status, sleeps for a specified time, and then detects the connection status and group point status of the OPC server again. If the addition of the OPC group point fails, the failed group point is stored in the global dictionary.
10. The OPC server data acquisition method integrating fault handling and dynamic configuration according to claim 8, characterized in that: The data collection and publishing module determines the group point status. If the group point is normal, it traverses the group to determine whether the group is deleting points. If the group is not deleting points, it reads the group data, traverses and sets the published data value, calls the publishing interface to publish, and re-determines the group point status after a dormant sampling period. If the group point is abnormal, it will directly sleep for a sampling period and re-judge the group point status; if the group is deleting points, it will re-traverse the group to determine whether the group is deleting points; The group point update module starts UDP listening, waits for requests in a loop, reads request data, deserializes group point data, compares the group to be deleted, and deletes the group; compares the new group with the old group to obtain the group points to be added and deleted, calls the group point adding interface to add the group to be added, and calls the group point deleting interface to delete the group point. After sleeping and waiting, it re-enters the loop waiting for requests.
Citation Information
Patent Citations
Method for connecting interfaces between object linking and embedding for process control (OPC) server and OPC application program
CN102346686A
Network communication method of MCGS configuration system in industrial control
CN105892344A
System and method for collecting OPC data
CN110806996A
Cross-platform OPC DA data acquisition system and method based on industrial Internet of Things gateway
CN118316989A
System accorded with OPC standard for monitoring remote configuration
CN1798141A
Cited By
Method for realizing disconnection reconnection in OPC protocol communication process
CN121691422A
Method for realizing disconnection and reconnection in OPC protocol communication process
CN121691422B