Whole library comparison method, system and equipment for real-time library and configuration library
Through the multi-threaded parallel full-base comparison method, combined with the characteristics of configuration libraries and real-time libraries, data reading and heterogeneous structure mapping are optimized, which solves the problem of low inconsistency verification between real-time libraries and configuration libraries in the substation monitoring system, and realizes efficient and accurate data comparison to ensure system stability and data consistency.
Patent Information
- Application Number
- CN202510733853.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-06-04
AI Technical Summary
In the prior art, the verification efficiency of information inconsistency between the real-time library and the configuration library of the substation monitoring system is low, which is difficult to meet the timeliness requirements of the engineering site. Moreover, the traditional single-thread comparison method is difficult to extend to multi-thread parallel processing, resulting in insufficient verification efficiency and practicality.
The multi-threaded parallel full-base comparison method is adopted, combining the relationship table characteristics of the configuration library and the KV storage characteristics of the real-time library, and by optimizing the data reading strategy and establishing a heterogeneous structure mapping mechanism, efficient data comparison is achieved, and the thread pool is used to perform the comparison tasks concurrently.
It significantly improves the comparison efficiency, ensures the consistency between real-time database and configuration database data, improves the stability and reliability of the substation monitoring system, can quickly identify and display data differences, and promptly detect and repair inconsistent problems.
Smart Images

Figure CN120256413A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of substation automation, and particularly to a full-library comparison method, system and device for a real-time database and a configuration database. Background Technique
[0002] In the field of substation automation, a new-generation substation monitoring system uses a hierarchical architecture data platform to support monitoring applications. This data platform is provided with a configuration database and a real-time database. The configuration database is built based on a relational database and stores the fixed information of the substation in a tree-like logical structure, such as substation equipment information, wiring topology, screen configuration, etc.; while the real-time database uses a key-value pair (KV) type in-memory database, which dynamically maintains real-time variables such as telemetry and telecontrol while storing fixed information. The two maintain the consistency of fixed information through a synchronization mechanism. However, during the system initialization deployment or upgrade and maintenance phase, the fixed information in the configuration database will be modified, for example: modification, addition of intervals, adjustment of the association between equipment and signals, etc., which will cause the inconsistency of information between the real-time database and the configuration database.
[0003] Although the existing synchronization module can partially alleviate this problem, it lacks an efficient consistency verification method and may still cause risks such as abnormal display of monitoring screens and incorrect control commands. In response to the consistency verification problem of the real-time database and the configuration database of the substation monitoring system, each manufacturer formulates a solution according to the characteristics of its own database. In the prior art, an attempt is made to solve this problem through a full-library comparison scheme with a tree structure. However, limited by the performance bottleneck of reading the configuration database of the relational database, the single-thread comparison method is difficult to meet the timeliness requirements of the engineering site and is difficult to scale to multi-thread parallel processing, resulting in insufficient verification efficiency and practicability. Summary of the Invention
[0004] The purpose of the present invention is to provide a full-library comparison method, system and device for a real-time database and a configuration database to solve at least one of the above technical problems. The present invention breaks through the architecture constraints of traditional comparison methods, combines the relational table characteristics of the configuration database and the KV storage characteristics of the real-time database, and is a full-library comparison scheme that supports multi-thread parallelism and low time complexity. By optimizing the data reading strategy and establishing a heterogeneous structure mapping mechanism, while ensuring the verification accuracy, the comparison efficiency is significantly improved, thereby providing reliable data consistency guarantee for the stable operation of the substation monitoring system.
[0005] The present invention realizes the above purpose through the following technical solutions: A full-library comparison method for a real-time database and a configuration database, applied to a substation monitoring system, includes the following steps: Compare the model information of the real-time database and the configuration database to obtain a model comparison result; Load the link relationship data of the configuration database and the instance quantity of each object type based on the model comparison result; Generate task information based on the link relationship data of the configuration library and the number of instances of each object type; Generate comparison tasks according to the task information, and start multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results.
[0006] Furthermore, compare the model information of the real-time library and the configuration library to obtain the model comparison result, including: Compare the object type table to check whether the object type information in the real-time library and the configuration library is consistent; If the object type information is consistent, for each object type, compare the object type attribute set to check whether each object type attribute set in the real-time library and the configuration library is consistent; If each object type attribute set is consistent, compare the value ranges of the values of each object type attribute to check whether the value ranges of each object type attribute in the real-time library and the configuration library are consistent.
[0007] Furthermore, load the link relationship data of the configuration library and the number of instances of each object type based on the model comparison result, including: When the model comparison result is that the model information is consistent, load the link relationship data of the configuration library and the number of instances of each object type; specifically including: Obtain the object link relationship table, and store the object link relationship table in memory in the data structure of a hash table; where the key of the object link relationship hash table is the ID formed by splicing the object ID and the link type ID, and the value of the object link relationship hash table is the ID of the linked object; Obtain the instance number information of each object type, and store the instance number information of each object type in memory in the data structure of a hash table; where the key of the instance number hash table of the object type is the object type ID, and the value of the instance number hash table of the object type is the number of existing instances in the object type.
[0008] Furthermore, the task information includes the object type ID, the number of instances to be compared, and the starting offset of the instance in the instance table; Generate comparison tasks according to the task information, including: traverse the instance number hash table of the object type, for each object type, formulate the task information according to the number of instances that each task should compare, and then push the task information to the task queue of the thread pool.
[0009] Furthermore, start multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results, including: multiple threads in the thread pool obtain the task information from the task queue; The thread executes the comparison task according to the task information.
[0010] Further, the thread performs a comparison task according to the task information, including: Batch reading instance information from the configuration library according to the task information; Traverse each instance, obtain the corresponding real-time library target instance from the real-time library according to the instance ID, and compare whether the attributes of the instance and the real-time library target instance are the same; when the attribute is of the link data type, the link relationship of the configuration library is directly obtained from the object link relationship hash table, and the obtained real-time library target instance is marked to prevent duplicate processing; Push the task execution result to the task result list; the task result list is stored in the structure information of a hash table, the key of the hash table is the object type ID, and the value is the task result linked list; Among them, each task result contains inconsistent instance information, and the inconsistent instance information includes the inconsistent type and the inconsistent instance ID; The inconsistent types include: only existing in the real-time library, only existing in the configuration library, and the attributes of the real-time library and the configuration library are inconsistent.
[0011] Further, the thread performs a comparison task according to the task information, including: Continuously poll the task result list. When the task linked list under the object type is executed, mark that the task of the object type has been executed, and skip the task linked list in the next poll until all the task linked lists of all object types are executed, and then exit.
[0012] A full-library comparison system for a real-time library and a configuration library, used to implement the full-library comparison method of the real-time library and the configuration library as described above. The full-library comparison system includes: An object type selection interface, used to select the object type to be compared, and the default value is to compare the instances in all object types; A comparison result display interface, used to display the difference information between the real-time library and the configuration library, and display the union of the real-time library object instances and the configuration library object instances in a tree structure; among them, clicking on each object instance displays its attribute values in the real-time library and the configuration library; the comparison result display interface also includes an inconsistent instance display list for listing inconsistent object instances; A comparison task management component, used to manage comparison tasks and implement multi-threaded concurrent execution of comparison tasks.
[0013] A full-library comparison system for a real-time library and a configuration library, used to implement the full-library comparison method of the real-time library and the configuration library as described above. The full-library comparison system includes: a real-time library, a configuration library, and a comparison tool; The comparison tool can interact with the real-time library and the configuration library; the steps for the comparison tool to perform comparison include: The main thread generates comparison task information and pushes the task information into the task queue of the thread pool; Multiple threads in the thread pool synchronously obtain the task information from the task queue and execute the comparison task according to the task information; After each thread finishes executing the comparison task, it pushes the task result into the task result hash table.
[0014] An electronic device includes a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the full-library comparison method of the real-time library and the configuration library as described in any one of the above.
[0015] The beneficial effects of the present invention are as follows: By combining the relationship table characteristics of the configuration library and the KV storage characteristics of the real-time library, the present invention designs a full-library comparison scheme that supports multi-threaded parallel processing and has a low time complexity. It not only optimizes the data reading strategy but also establishes a heterogeneous structure mapping mechanism, thereby greatly improving the comparison efficiency on the basis of ensuring the accuracy of data verification.
[0016] The present invention effectively solves the architecture constraint problem existing in the traditional comparison method and provides a strong guarantee for the stable operation of the substation monitoring system. Specifically, through refined model comparison, efficient application of in-memory data structures, and a multi-threaded concurrent execution mechanism, the present invention can quickly identify and display the difference information between the real-time library and the configuration library, including inconsistent object instances and their attributes, thereby helping to timely discover and repair data inconsistency problems and ensuring the accuracy and reliability of system data. Description of the Drawings
[0017] Figure 1 It is a flowchart of the full-library comparison method of the real-time library and the configuration library according to an embodiment of the present invention; Figure 2 It is a flowchart of the full-library comparison method of the real-time library and the configuration library according to another embodiment of the present invention; Figure 3 It is a schematic structural diagram of the full-library comparison system of the real-time library and the configuration library according to an embodiment of the present invention; Figure 4 It is a schematic principle diagram of the full-library comparison system of the real-time library and the configuration library according to an embodiment of the present invention. Detailed Embodiments
[0018] The content of the present invention will now be described with reference to exemplary embodiments. It should be understood that the described embodiments are only for enabling those of ordinary skill in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0019] As used herein, the term "comprising" and its variants are to be construed as open-ended terms meaning "including but not limited to". The term "based on" is to be construed as "at least partially based on". The terms "an embodiment" and "a kind of embodiment" are to be construed as "at least one embodiment".
[0020] In a substation monitoring system, the model library plays an important role. It comprehensively maintains all object type information, object attribute information, and object attribute value range information.
[0021] Object types include: disconnect switches, busbars, transformer windings, etc.; each object type contains multiple attributes. Taking the disconnect switch as an example, its attributes include voltage level, opening and closing state, parent object link, and child object list, etc. Each attribute has its specific value range. For example, the device status attribute of an IED device type is an enumerated data type, and its enumerated values include: out of service, running, in debugging, in maintenance, etc.
[0022] When storing substation data, the system creates object instances based on the model library. The configuration library stores the instance data of each object type through a relational table. For example, the disconnect switch data in the substation is stored in the disconnect switch relational table. At the same time, the relational table is also used to store the link relationships between objects, and these link relationships logically form an object tree through parent-child links.
[0023] Based on this storage form of the configuration library, the present invention proposes a multi-threaded comparison framework and accordingly implements a full-library comparison method and system for the real-time library and the configuration library of a substation monitoring system.
[0024] Embodiment 1
[0025] Figure 1 It is a flowchart of the full-library comparison method for the real-time library and the configuration library of an embodiment of the present invention. As Figure 1 shown, according to an embodiment of the present invention, a full-library comparison method for the real-time library and the configuration library, applied to a substation monitoring system, includes the following steps: Step S102, compare the model information of the real-time library and the configuration library to obtain the model comparison result; Step S104, load the link relationship data of the configuration library and the instance quantity of each object type based on the model comparison result; Step S106, generate task information according to the link relationship data of the configuration library and the instance quantity of each object type; Step S108: Generate comparison tasks based on the task information, and start multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results.
[0026] In this embodiment, a full-library comparison method for the real-time library and the configuration library applied to a substation monitoring system is proposed, aiming to efficiently and accurately compare the information in the two databases. This method first performs the comparison of model information. By obtaining the model information in the real-time library and the configuration library and comparing them, the model comparison result is obtained, ensuring that the object types, attributes, and attribute values in the real-time library are consistent with the definitions in the configuration library, providing a basis for subsequent comparisons. Based on these model comparison results, the link relationship data in the configuration library and the instance numbers of each object type are further loaded; by loading the link relationship data, the object tree structure is obtained, ensuring the correctness and integrity of the parent-child link relationships between objects; at the same time, the instance numbers of each object type in the configuration library are counted as the benchmark for comparing the instance numbers in the real-time library. Next, specific task information is generated according to the link relationship data in the configuration library and the instance numbers of each object type. These task information details the specific content that needs to be compared. Finally, comparison tasks are generated according to these task information, and a thread pool is started. Multiple threads are used to concurrently execute these comparison tasks to generate the final comparison results. The comparison tasks for each object type are split into independent subtasks and pushed to the thread pool for execution, including instance number comparison, attribute comparison, and attribute value comparison, etc. The final comparison results are sent to the system administrator or relevant maintenance personnel for their subsequent processing and correction.
[0027] Through the multi-threaded comparison framework and refined step design of the present invention, the comprehensive and efficient comparison of the data in the substation monitoring system is realized. It not only ensures the consistency of the data in the real-time library and the configuration library, but also improves the reliability and stability of the system. At the same time, the comparison method used in the present invention has scalability, can be applied to different types of substation monitoring systems, and can be further integrated into the daily maintenance process of the system to realize automatic data comparison and difference alarm.
[0028] According to an embodiment of the present invention, step S102 includes: Step S1021: Compare the object type tables to check whether the object type information in the real-time library and the configuration library is consistent; Among them, the object type table is used to describe the object type information; Step S1022: If the object type information is consistent, then for each object type, compare the object type attribute sets to check whether the object type attribute sets in the real-time library and the configuration library are consistent; Among them, the object type attribute set is used to describe the object type attribute information; Step S1023: If the attribute sets of each object type are consistent, then compare the value ranges of the attributes of each object type to check whether the value ranges of the attributes of each object type in the real-time database and the configuration database are consistent.
[0029] In this embodiment, the content of comparing the model information between the real-time database and the configuration database in step S102 is further defined. First, by comparing the object type tables, comprehensively check whether the object type information in the real-time database and the configuration database is consistent, ensuring that there are no omissions or differences in the definition of object types between the two. The object type table, as the core for describing object type information, provides an accurate data basis for this comparison process. Then, if the object type information is confirmed to be consistent, further conduct a detailed comparison of the attribute sets for each object type. This step aims to verify whether the attribute definitions of each object type in the real-time database and the configuration database are exactly the same, including key information such as attribute names and data types. Finally, when the attribute sets of each object type are also confirmed to be consistent, drill down to the level of attribute values and compare the value ranges of the attributes of each object type. Especially for attributes of the enumerated data type, strictly check whether the value ranges of the attributes of each object type in the real-time database and the configuration database are exactly the same to ensure the accuracy and consistency of the data.
[0030] The present invention can comprehensively and accurately verify the consistency of the model information between the real-time database and the configuration database, providing a strong guarantee for the stable operation of the substation monitoring system.
[0031] According to an embodiment of the present invention, step S104 includes: When the model comparison result is that the model information is consistent, load the link relationship data of the configuration database and the instance numbers of each object type; specifically including: Obtain the object link relationship table and store the object link relationship table in memory in the data structure of a hash table; wherein, the key of the object link relationship hash table is the ID formed by concatenating the object ID and the link type ID, and the value of the object link relationship hash table is the ID of the linked object. Obtain the instance number information of each object type and store the instance number information of each object type in memory in the data structure of a hash table; wherein, the key of the instance number hash table of the object type is the object type ID, and the value of the instance number hash table of the object type is the number of instances existing in the object type.
[0032] In this embodiment, the process of loading the link relationship data of the configuration library and the number of instances of each object type is elaborated in detail. First, in order to efficiently manage the link relationships between objects, the object link relationship table is read from the relational database and stored in memory in the data structure of a hash table. In this hash table, the key is a unique ID formed by concatenating the object ID and the link type ID, which can ensure that each link relationship can be uniquely and accurately identified; while the value is the ID of the linked object. Through this design, all linked objects associated with a specific object and link type can be quickly found. Next, in order to keep track of the number of instances of each object type in the configuration library in real time, the number of instance information of each object type is also read from the relational database and stored in memory in the data structure of another hash table. In this hash table, the key is the object type ID, which uniquely identifies an object type in the configuration library; while the value is the number of instances of this object type existing in the configuration library. This information is of great significance for system monitoring, resource management, performance optimization, etc.
[0033] By adopting the efficient data structure of the hash table, the present invention can significantly improve the loading and processing speed of the configuration library data, providing strong support for the stable operation and rapid response of the system.
[0034] According to an embodiment of the present invention, the task information includes the object type ID, the number of instances to be compared, and the starting offset of the instance in the instance table. In step S108, generating a comparison task according to the task information includes: Step S1081, traverse the hash table of the number of instances of the object type. For each object type, formulate task information according to the number of instances that each task should compare, and then push the task information into the task queue of the thread pool.
[0035] Starting multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results includes: Step S1082, multiple threads in the thread pool obtain the task information from the task queue. Step S1083, the thread executes the comparison task according to the task information.
[0036] In this embodiment, by traversing the instance quantity hash table of the object type, for each object type, task information is formulated according to the quantity of instances to be compared. These task information are then pushed into the task queue of the thread pool and wait to be executed. Then, multiple threads in the thread pool grab the task information from the task queue in parallel and execute specific comparison tasks according to this information. Each thread works independently, utilizes the previously formulated task information, efficiently compares the corresponding instances in the real-time library and the configuration library, and thus generates accurate comparison results. This process makes full use of the advantages of concurrent execution and significantly improves the comparison efficiency.
[0037] The present invention realizes the efficient comparison of instances in the real-time library and the configuration library by formulating task information including the object type ID, the quantity of comparison instances, and the starting offset, and concurrently executing these tasks with the help of a thread pool.
[0038] According to an embodiment of the present invention, step S1083 includes: Batch-read instance information from the configuration library according to the task information; Traverse each instance, obtain the corresponding real-time library target instance from the real-time library according to the instance ID, and compare whether each attribute of the instance and the real-time library target instance is consistent; when the attribute is a linked data type, the link relationship of the configuration library is directly obtained from the object link relationship hash table, and the obtained real-time library target instance is marked to prevent repeated processing; Push the task execution result into the task result list; the task result list is stored in the structure information of a hash table, the key of the hash table is the object type ID, and the value is the task result linked list; Among them, each task result contains inconsistent instance information, and the inconsistent instance information includes the inconsistent type and the inconsistent instance ID; The inconsistent types include: only existing in the real-time library, only existing in the configuration library, and the attributes of the real-time library and the configuration library are inconsistent.
[0039] Preferably, step S1083 further includes: Continuously poll the task result list. When the task linked list under the object type is executed, mark that the task of the object type has been executed, and skip the task linked list in the next poll until all the task linked lists of all object types are executed, and then exit.
[0040] In this embodiment, the execution process of step S1083 is detailed as follows: First, a batch of instance information is read from the configuration library according to the task information; then, these instances are traversed, and the corresponding target instances are searched in the real-time library through the instance IDs, and the attributes of the two are compared one by one. In particular, when the attribute is of the linked data type, the link relationship of the configuration library is directly obtained from the object link relationship hash table, and the processed target instances in the real-time library are marked to avoid repeated operations. After the comparison is completed, the task execution results, including the inconsistent instance information (covering the inconsistent types and instance IDs), are stored in a hash table structure with the object type ID as the key and the task result linked list as the value. In addition, this process also includes the step of continuously polling the task result list. Once all the tasks of a certain object type are completed, they are marked as completed and skipped in subsequent polls until all the tasks of all object types are completed, and the entire process ends.
[0041] The present invention realizes the efficient batch reading of instance information from the configuration library and the attribute comparison with the target instances in the real-time library. In particular, it is optimized for the linked data type to avoid repeated operations. At the same time, the present invention stores the task execution results in a structured hash table form and continuously polls the task result list to ensure that all tasks of all object types are executed, ultimately realizing the efficiency and accuracy of instance information comparison.
[0042] Embodiment 2
[0043] Figure 2 It is a flowchart of the full-library comparison method between the real-time library and the configuration library for another embodiment of the present invention. As Figure 2 shown, according to an embodiment of the present invention, a full-library comparison method between a real-time library and a configuration library is applied to a substation monitoring system; the method includes the following steps: Step S202, compare the model information of the real-time library and the configuration library; specifically including: Compare the object type tables to check whether the object types in the real-time library and the configuration library are the same; If the object types are the same, then for each object type, compare the attribute sets of the object type to check whether the attribute sets of each object type in the real-time library and the configuration library are the same; If the attribute sets of each object type are the same, then compare the value ranges of the attributes of each object type. In particular, for the attributes of the enumerated data type, check whether the value ranges of the attributes of each object type in the real-time library and the configuration library are the same.
[0044] Step S204, load the object link relationship data of the configuration library; specifically including: Read the object link relationship table from the relational database and store it in the memory in the data structure of a hash table.
[0045] Among them, the key of the hash table is the ID formed by concatenating the object ID and the link type ID, and the value is the ID of the link object.
[0046] Step S206, load the instance quantities of each object type in the configuration library; specifically including: Read the instance quantity information of each object type from the relational database and store it in memory in the data structure of a hash table.
[0047] Among them, the key of the hash table is the object type ID, and the value is the number of instances existing in the object type.
[0048] Step S208, start the thread pool for executing comparison tasks; specifically including: Multiple threads in the thread pool obtain task information from the task queue; Execute comparison tasks according to the task information.
[0049] Among them, executing comparison tasks according to the task information includes the following content: Batch read instance information from the configuration library according to task information such as object type ID, the number of instances to be compared, and the starting offset of the instance in the instance table; Traverse each instance in turn, obtain the corresponding instance from the real-time library according to the instance ID, compare whether each attribute is consistent. When the attribute is of the link data type, the link relationship in the configuration library is directly obtained from the object link relationship hash table, and the obtained real-time library instances are marked to prevent duplicate configuration library instances; Push the task execution results to the task result list. The task result list is stored in the structure information of a hash table. The key of the hash table is the object type ID, and the value is the task result linked list. Among them, each task result contains inconsistent instance information. The inconsistent instance information includes the inconsistent type and the inconsistent instance ID. The inconsistent types mainly include: only existing in the real-time library, only existing in the configuration library, and inconsistent attributes between the real-time library and the configuration library.
[0050] Step S210, push comparison tasks to the thread pool; specifically including: Formulate task information, traverse the hash table of object types and quantities. For each object type, formulate task information according to the number of instances that should be compared for each configured task, and then push the task information to the task queue of the thread pool. Among them, the task information includes: object type ID, the number of instances to be compared, and the starting offset of the instance in the instance table.
[0051] Step S212, monitor the comparison results of each object type; specifically including: Continuous polling task result list. When the task linked list under the object type is executed, mark the task of this object type as executed, skip this task linked list in the next poll until all task linked lists of all object types are executed, and then exit.
[0052] In this embodiment, a full-library comparison method for a real-time database and a configuration database applied to a substation monitoring system is proposed. This method first compares the model information of the real-time database and the configuration database, including the consistency of object types, attribute sets, and attribute value ranges; then loads the object link relationship data and the instance quantity of each object type in the configuration database into memory for quick access; then starts a thread pool to prepare to execute the comparison tasks. At this time, specific comparison tasks are formulated and pushed to the task queue of the thread pool, and the thread pool then starts to execute these tasks; when executing the comparison tasks, the threads in the thread pool will batch-read instance information from the configuration database according to the task information, compare it with the corresponding instances in the real-time database, and record the inconsistent instance information; finally, by continuously polling the task result list, monitor the comparison results of each object type, and exit after ensuring that all tasks are executed.
[0053] The present invention realizes a comprehensive and efficient comparison of the model information between the real-time database and the configuration database in the substation monitoring system, improves the comparison efficiency, ensures data accuracy, and provides a reliable guarantee for the stable operation of the system.
[0054] Embodiment III
[0055] Figure 3 It is a schematic structural diagram of a full-library comparison system for a real-time database and a configuration database according to an embodiment of the present invention. As Figure 3 shown, according to an embodiment of the present invention, a full-library comparison system for a real-time database and a configuration database is used to implement any full-library comparison method for a real-time database and a configuration database of the present invention. The full-library comparison system includes: An object type selection interface for selecting the object types to be compared, with the default value being to compare the instances in all object types; A comparison result display interface for displaying the difference information between the real-time database and the configuration database, and displaying the union of the real-time database object instances and the configuration database object instances in a tree structure; among them, clicking on each object instance displays its attribute values in the real-time database and the configuration database; the comparison result display interface also includes a list of inconsistent instance displays for listing inconsistent object instances; A comparison task management component for managing comparison tasks and realizing multi-threaded concurrent execution of comparison tasks.
[0056] In this embodiment, a full-library comparison system for a real-time library and a configuration library is provided. This system is used to implement any full-library comparison method of the real-time library and the configuration library of the present invention, aiming to provide an efficient and accurate comparison tool to meet the requirements of application scenarios such as substation monitoring systems. The full-library comparison system includes: an object type selection interface for selecting the object types to be compared; comparing instances in all object types to ensure comprehensive coverage; providing flexibility to allow users to select specific object types for comparison according to actual needs, with the default value being to compare instances in all object types. A comparison result display interface for displaying the difference information between the real-time library and the configuration library; presenting the union of real-time library object instances and configuration library object instances in a tree structure for easy visual understanding of the comparison results by users; clicking on each object instance can display its attribute values in the real-time library and the configuration library, facilitating in-depth viewing and analysis by users. The comparison result display interface also includes a list of inconsistent instance displays for listing all inconsistent object instances to facilitate users in quickly locating and handling problems. A comparison task management component for managing comparison tasks to ensure the smooth progress of the comparison process; executing comparison tasks concurrently with multiple threads to improve the comparison efficiency and ensure that the system can respond quickly and complete the comparison tasks accurately.
[0057] The present invention defaults to comparing instances in all object types to ensure comprehensiveness of the comparison; through the display of a tree structure and detailed attribute values, the comparison results are made more intuitive and understandable; using multi-threaded concurrent execution of comparison tasks to improve the comparison efficiency and meet real-time requirements; providing a list of inconsistent instance displays to facilitate users in quickly locating and handling problems and improving the practicality of the system.
[0058] Embodiment 4
[0059] Figure 4 is a schematic diagram of the principle of the full-library comparison system for the real-time library and the configuration library of an embodiment of the present invention. As Figure 4 shown, according to an embodiment of the present invention, a full-library comparison system for a real-time library and a configuration library is used to implement any full-library comparison method of the real-time library and the configuration library of the present invention. The full-library comparison system includes: a real-time library, a configuration library, and a comparison tool; The comparison tool can interact with the real-time library and the configuration library. The steps for the comparison tool to perform the comparison include: The main thread generates comparison task information and pushes the task information into the task queue of the thread pool; Multiple threads in the thread pool synchronously obtain task information from the task queue and execute comparison tasks according to the task information; After each thread finishes executing the comparison task, it pushes the task result into the task result hash table.
[0060] In this embodiment, a full-library comparison system for a real-time library and a configuration library is proposed. This system integrates a real-time library, a configuration library, and an efficient comparison tool. As the core component, the comparison tool can interact with the real-time library and the configuration library to perform the full-library comparison task. In the main thread, the main thread generates comparison task information (comparison task list) and pushes the task information to the task queue of the thread pool. Among them, the task information includes: object type ID (OType ID), the number of instances to be compared, and the starting offset of the instance in the instance table. Subsequently, multiple threads in the thread pool synchronously obtain the task information from the task queue, read the relevant data of the real-time library and the configuration library according to the task information, and perform comparison work such as value range comparison. After each thread completes the comparison, it pushes the comparison result to the task result hash table. Among them, the key of the task result hash table is the object type ID (OType ID), and the value is the task result linked list. The task result linked list contains inconsistent instance information, specifically including: inconsistent type and inconsistent instance ID. Inconsistent type: indicates the inconsistency of the instance, such as only existing in the real-time library, only existing in the configuration library, or the attributes of the real-time library and the configuration library are inconsistent; inconsistent instance ID: identifies the inconsistent instance. Such a design makes the subsequent result analysis and processing more convenient and efficient. Based on the information stored and summarized in the task result hash table, the system can perform further result analysis and processing. This includes generating a detailed comparison report, marking all inconsistent items, triggering the corresponding alarm mechanism, or performing other automated operations, etc. Through these subsequent processing steps, users can more intuitively understand the data differences between the real-time library and the configuration library, and take corresponding measures in a timely manner for correction and optimization, so as to ensure the stable operation of the substation monitoring system and the accuracy of data.
[0061] The present invention realizes the distribution of main thread tasks and multi-threaded synchronous comparison, effectively improves the comparison efficiency, and can accurately identify and summarize inconsistent instance information, including inconsistent types and instance IDs, providing strong support for data consistency verification.
[0062] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices and media can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0063] The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present application.
[0064] It should be understood that the magnitude of the sequence numbers of the steps in the content of the present invention and the embodiments does not absolutely mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Claims
1. A full-library comparison method for a real-time library and a configuration library, applied to a substation monitoring system, characterized in that It includes the following steps: Compare the model information in the real-time library and the configuration library to obtain the model comparison result; Load the link relationship data in the configuration library and the instance numbers of each object type based on the model comparison result; Generate task information according to the link relationship data in the configuration library and the instance numbers of each object type; Generate comparison tasks according to the task information, and start multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results.
2. The full-library comparison method of the real-time library and the configuration library according to claim 1, wherein Comparing the model information in the real-time library and the configuration library to obtain the model comparison result includes: Compare the object type table to check whether the object type information in the real-time library and the configuration library is consistent; If the object type information is consistent, for each object type, compare the object type attribute set to check whether each object type attribute set in the real-time library and the configuration library is consistent; If each object type attribute set is consistent, compare the value ranges of the values of each object type attribute to check whether the value ranges of each object type attribute in the real-time library and the configuration library are consistent.
3. The full-library comparison method for the real-time library and the configuration library according to claim 1, characterized in that Loading the link relationship data in the configuration library and the instance numbers of each object type based on the model comparison result includes: When the model comparison result is that the model information is consistent, load the link relationship data in the configuration library and the instance numbers of each object type; specifically including: Obtain the object link relationship table and store the object link relationship table in memory in the data structure of a hash table; where the key of the object link relationship hash table is the ID formed by concatenating the object ID and the link type ID, and the value of the object link relationship hash table is the ID of the linked object; Obtain the instance number information of each object type and store the instance number information of each object type in memory in the data structure of a hash table; where the key of the instance number hash table of the object type is the object type ID, and the value of the instance number hash table of the object type is the number of existing instances in the object type.
4. The full-library comparison method of the real-time library and the configuration library according to claim 3, characterized in that: The task information includes the object type ID, the number of instances to be compared, and the starting offset of the instance in the instance table; Generating comparison tasks according to the task information includes: traversing the instance number hash table of the object type, for each object type, formulating the task information according to the number of instances that each task should compare, and then pushing the task information to the task queue of the thread pool.
5. The full-library comparison method of the real-time library and the configuration library according to claim 4, wherein Starting multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results includes: multiple threads in the thread pool obtain the task information from the task queue; The thread executes the comparison task according to the task information.
6. The full-library comparison method between the real-time library and the configuration library according to claim 5, characterized in that, The thread executing the comparison task according to the task information includes: Batch read instance information from the configuration library according to the task information; Traverse each instance, obtain the corresponding real-time library target instance from the real-time library according to the instance ID, and compare whether each attribute of the instance and the real-time library target instance is consistent; when the attribute is of the link data type, the link relationship in the configuration library is directly obtained from the object link relationship hash table, and the obtained real-time library target instance is marked to prevent duplicate processing; Push the task execution result to the task result list; the task result list is stored in the structure information of a hash table, where the key of the hash table is the object type ID and the value is the task result linked list; Among them, each task result contains inconsistent instance information, and the inconsistent instance information includes the inconsistent type and the inconsistent instance ID; The inconsistent types include: only existing in the real-time library, only existing in the configuration library, and the attributes of the real-time library and the configuration library are inconsistent.
7. The full-library comparison method of the real-time library and the configuration library according to claim 6, characterized in that, The thread executes the comparison task according to the task information, including: Continuously polling the task result list. When the task linked list under the object type is executed, mark the task of the object type as executed, and skip the task linked list in the next poll until all the task linked lists of all object types are executed, and then exit.
8. A full-library comparison system for a real-time library and a configuration library, which is used to implement the full-library comparison method for the real-time library and the configuration library as described in any one of claims 1-7, characterized in that, The full-library comparison system includes: An object type selection interface for selecting the object type to be compared, and the default value is to compare the instances in all object types; A comparison result display interface for displaying the difference information between the real-time library and the configuration library, and displaying the union of the real-time library object instances and the configuration library object instances in a tree structure; among them, clicking on each object instance displays its attribute values in the real-time library and the configuration library; the comparison result display interface also includes an inconsistent instance display list for listing inconsistent object instances; A comparison task management component for managing comparison tasks and realizing multi-threaded concurrent execution of comparison tasks.
9. A full-library comparison system for a real-time library and a configuration library, which is used to implement the full-library comparison method of the real-time library and the configuration library as described in any one of claims 1-7, characterized in that, The full-library comparison system includes: a real-time library, a configuration library, and a comparison tool; The comparison tool can interact with the real-time library and the configuration library; the steps for the comparison tool to perform the comparison include: The main thread generates comparison task information and pushes the task information to the task queue of the thread pool; Multiple threads in the thread pool synchronously obtain the task information from the task queue and execute the comparison task according to the task information; After each thread finishes executing the comparison task, it pushes the task result to the task result hash table.
10. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the full-library comparison method of the real-time library and the configuration library as described in any one of claims 1-7.
Citation Information
Patent Citations
Method, configuration tool and system for dynamically expanding increment of real-time library of power system
CN111782628A
Real-time model and historical model data comparison method of automation system
CN112182079A
High-concurrency data storage method, server, storage medium and electronic equipment
CN117112579A
Cloud mobile phone multi-machine cloning cross-regional data transmission method and system
CN119342060A