A method, system and device for comparing the entire database between a real-time database and a configuration database
Through the multi-threaded parallel full-base comparison method, combined with the characteristics of the configuration library and the real-time library, the problem of inconsistency between the real-time library and the configuration library information in the substation monitoring system is solved, and efficient and accurate data comparison is achieved to ensure system stability and data consistency.
Patent Information
- Application Number
- CN202510733853.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-06-04
AI Technical Summary
In the prior art, the real-time library and configuration library of the substation monitoring system are prone to inconsistent information during the initial deployment or upgrade maintenance stage, resulting in abnormal display of monitoring screens and errors in control commands. The existing synchronization modules are difficult to meet the timeliness and scalability of the project site, and the traditional single-thread comparison method is insufficient in efficiency.
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, including multi-threaded concurrent comparison of object types, attribute sets and instances.
It significantly improves the comparison efficiency, ensures the accuracy and consistency of data verification, provides strong data consistency guarantees, and ensures the stable operation of the substation monitoring system.
Smart Images

Figure CN120256413B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of substation automation, and in particular to a full-library comparison method, system and equipment for a real-time library and a configuration library. Background Art
[0002] In the field of substation automation, the new generation of substation monitoring systems uses a layered data platform to support monitoring applications. This data platform includes a configuration library and a real-time library. The configuration library is built on a relational database, using a tree-like logical structure to store fixed substation information, such as substation equipment information, wiring topology, and screen configuration. The real-time library, on the other hand, uses a key-value (KV) in-memory database to store fixed information while dynamically maintaining real-time variables such as telemetry and telesignaling. The two maintain consistency of fixed information through a synchronization mechanism. However, during system initialization, deployment, or upgrade and maintenance, fixed information in the configuration library may be modified, such as by modifying, adding intervals, or adjusting equipment and signal associations. This can lead to information inconsistencies between the real-time and configuration libraries.
[0003] While existing synchronization modules can partially alleviate this problem, the lack of efficient consistency verification methods can still lead to risks such as abnormal monitoring screen displays and control command errors. To address the consistency verification issues between the real-time database and the configuration database of the substation monitoring system, each manufacturer has developed solutions tailored to the characteristics of their respective databases. Existing technologies attempt to address this issue through a tree-structured full-database comparison solution. However, due to the performance bottleneck of the configuration database read performance of relational databases, single-threaded comparison methods are unable to meet the timeliness requirements of engineering sites and are difficult to expand to multi-threaded parallel processing, resulting in insufficient verification efficiency and practicality. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, system, and device for full-library comparison between a real-time library and a configuration library in order to solve at least one of the above technical problems. This invention breaks through the architectural constraints of traditional comparison methods and combines the relational table characteristics of the configuration library with the KV storage characteristics of the real-time library. It is a full-library comparison solution that supports multi-threaded parallelism and low time complexity. By optimizing data reading strategies and establishing a heterogeneous structure mapping mechanism, it significantly improves comparison efficiency while ensuring verification accuracy, thereby providing reliable data consistency assurance for the stable operation of the substation monitoring system.
[0005] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0006] A full database comparison method for a real-time database and a configuration database is applied to a substation monitoring system and includes the following steps:
[0007] Compare the model information of the real-time library and the configuration library to obtain the model comparison results;
[0008] Loading the link relationship data of the configuration library and the number of instances of each object type based on the model comparison result;
[0009] Generate task information based on the link relationship data of the configuration library and the number of instances of each object type;
[0010] A comparison task is generated according to the task information, and multiple threads in the thread pool are started to concurrently execute the multiple comparison tasks to generate a comparison result.
[0011] Furthermore, the model information of the real-time library and the configuration library are compared to obtain the model comparison results, including:
[0012] Comparing the object type table to check whether the object type information in the real-time library is consistent with that in the configuration library;
[0013] If the object type information is consistent, then for each object type, the object type attribute set is compared to check whether each object type attribute set in the real-time library is consistent with that in the configuration library;
[0014] If each object type attribute set is consistent, a comparison is performed on the value range of each object type attribute to check whether the value range of each object type attribute in the real-time library and the configuration library is consistent.
[0015] Furthermore, loading the link relationship data of the configuration library and the number of instances of each object type based on the model comparison result includes:
[0016] When the model comparison result shows that the model information is consistent, the link relationship data of the configuration library and the number of instances of each object type are loaded; specifically, the steps include:
[0017] Obtain an object link relationship table, and store the object link relationship table in a memory in a hash table data structure; wherein the key of the object link relationship hash table is an 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 link object;
[0018] Obtain the instance quantity information of each object type and store the instance quantity information of each object type in memory in a hash table data structure; wherein the key of the instance quantity hash table of the object type is the object type ID, and the value of the instance quantity hash table of the object type is the number of instances existing in the object type.
[0019] 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;
[0020] Generate a comparison task according to the task information, including: traversing the instance quantity hash table of the object type, formulating the task information for each object type 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.
[0021] Furthermore, starting multiple threads in a thread pool to concurrently execute multiple comparison tasks to generate comparison results includes: multiple threads in the thread pool obtaining the task information from a task queue;
[0022] The thread executes the comparison task according to the task information.
[0023] Furthermore, the thread performs the comparison task according to the task information, including:
[0024] Reading instance information in batches from the configuration library according to the task information;
[0025] Traverse each instance, obtain the corresponding real-time library target instance from the real-time library according to the instance ID, and compare the attributes of the instance with the real-time library target instance to see if they are consistent; when the attribute is a link data type, directly obtain the link relationship of the configuration library from the object link relationship hash table, and mark the obtained real-time library target instance to prevent duplicate processing;
[0026] 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;
[0027] Each task result includes inconsistent instance information, and the inconsistent instance information includes an inconsistent type and an inconsistent instance ID;
[0028] Inconsistency types include: only exists in the real-time library, only exists in the configuration library, and the attributes of the real-time library and the configuration library are inconsistent.
[0029] Furthermore, the thread performs the comparison task according to the task information, including:
[0030] Continuously poll the task result list. When the task chain list under the object type is completed, mark the task of the object type as completed. Skip the task chain list in the next poll until all the task chain lists of all object types are completed and exit.
[0031] A full-library comparison system for a real-time library and a configuration library, for implementing any of the above-described full-library comparison methods for a real-time library and a configuration library, the full-library comparison system comprising:
[0032] The object type selection interface is used to select the object type to be compared. The default value is to compare instances of all object types.
[0033] The comparison result display interface is used to display the difference information between the real-time library and the configuration library, and displays the union of the real-time library object instances and the configuration library object instances in a tree structure. 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.
[0034] The comparison task management component is used to manage comparison tasks and implement multi-threaded concurrent execution of comparison tasks.
[0035] A full-library comparison system for a real-time library and a configuration library, for implementing any of the above-mentioned full-library comparison methods for a real-time library and a configuration library, wherein the full-library comparison system comprises: a real-time library, a configuration library, and a comparison tool;
[0036] The comparison tool can exchange information with the real-time library and the configuration library; the steps of performing the comparison by the comparison tool include:
[0037] The main thread generates comparison task information and pushes the task information to the task queue of the thread pool;
[0038] The multiple threads in the thread pool synchronously obtain the task information from the task queue and perform the comparison task according to the task information;
[0039] After each thread completes the comparison task, it pushes the task results into the task result hash table.
[0040] An electronic device comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the computer program implements any of the above-described methods for comparing the entire real-time library with the configuration library.
[0041] The beneficial effects of the present invention are:
[0042] By combining the relational table characteristics of the configuration library with the KV storage characteristics of the real-time library, the present invention designs a full-library comparison solution that supports multi-threaded parallel processing and has 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 while ensuring the accuracy of data verification.
[0043] This invention effectively addresses the architectural constraints inherent in traditional comparison methods, providing robust data consistency assurance for the stable operation of substation monitoring systems. Specifically, through refined model comparison, efficient in-memory data structure utilization, and multi-threaded concurrent execution, it rapidly identifies and displays discrepancies between the real-time and configuration repositories, including inconsistent object instances and their attributes. This facilitates the timely detection and repair of data inconsistencies, ensuring the accuracy and reliability of system data. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flow chart of a method for comparing the entire real-time library with the configuration library according to one embodiment of the present invention;
[0045] Figure 2 A flow chart of a method for comparing the entire real-time library with the configuration library according to another embodiment of the present invention;
[0046] Figure 3 A schematic diagram of the structure of a full-library comparison system for a real-time library and a configuration library according to an embodiment of the present invention;
[0047] Figure 4 This is a schematic diagram of the principle of a full-library comparison system for a real-time library and a configuration library according to one embodiment of the present invention. DETAILED DESCRIPTION
[0048] The present invention will now be discussed with reference to exemplary embodiments. It should be understood that the embodiments discussed are only intended to enable those skilled in the art to better understand and implement the present invention, rather than to imply any limitation on the scope of the present invention.
[0049] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including, but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment."
[0050] In the 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.
[0051] Object types include switches, busbars, and transformer windings. Each object type contains multiple attributes. For example, for a switch, its attributes include voltage level, open / close status, parent object link, and child object list. Each attribute has a specific value range. For example, the device status attribute of an IED device type is an enumerated data type with values such as disabled, running, debugging, and maintenance.
[0052] When storing substation data, the system creates object instances based on the model library. The configuration library uses relationship tables to store instance data for each object type. For example, data for switch devices in a substation is stored in the switch relationship table. The relationship table also stores the links between objects. These links logically form an object tree through parent-child links.
[0053] Based on the storage form of this configuration library, the present invention proposes a multi-threaded comparison framework, and accordingly realizes a full library comparison method and system for the real-time library and configuration library of the substation monitoring system.
[0054] Example 1
[0055] Figure 1 This is a flow chart of a method for comparing the entire real-time library with the configuration library according to an embodiment of the present invention. Figure 1 As shown, according to one embodiment of the present invention, a full library comparison method of a real-time library and a configuration library is applied to a substation monitoring system, comprising the following steps:
[0056] Step S102, comparing the model information of the real-time library and the configuration library to obtain a model comparison result;
[0057] Step S104, loading the link relationship data of the configuration library and the number of instances of each object type based on the model comparison result;
[0058] Step S106, generating task information based on the link relationship data of the configuration library and the number of instances of each object type;
[0059] Step S108: Generate a comparison task according to the task information, start multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results.
[0060] This embodiment proposes a full-library comparison method for a real-time database and a configuration database in a substation monitoring system, aiming to efficiently and accurately compare information in the two databases. This method first performs a model information comparison. By obtaining and comparing model information from the real-time and configuration databases, a model comparison result is generated. This ensures that the object types, attributes, and attribute values in the real-time database are consistent with those defined in the configuration database, providing a foundation for subsequent comparisons. Based on these model comparison results, the configuration database's link relationship data and the number of instances of each object type are loaded. This loading of link relationship data obtains the object tree structure, ensuring the correctness and completeness of parent-child link relationships between objects. Furthermore, the number of instances of each object type in the configuration database is counted, serving as a benchmark for comparing the number of instances in the real-time database. Next, specific task information is generated based on the configuration database's link relationship data and the number of instances of each object type. This task information details the specific content to be compared. Finally, a comparison task is generated based on this task information, and a thread pool is started to concurrently execute these comparison tasks using multiple threads to produce the final comparison result. The comparison task for each object type is split into independent subtasks and pushed to the thread pool for execution. This includes instance quantity comparison, attribute comparison, and attribute value comparison. The final comparison results are sent to system administrators or relevant maintenance personnel for subsequent processing and correction.
[0061] This invention, through a multi-threaded comparison framework and refined step design, achieves comprehensive and efficient comparison of substation monitoring system data. This not only ensures data consistency between the real-time and configuration libraries, but also improves system reliability and stability. Furthermore, the comparison method used in this invention is scalable and can be applied to different types of substation monitoring systems. It can also be integrated into the system's daily maintenance process, enabling automatic data comparison and discrepancy alerts.
[0062] According to one embodiment of the present invention, step S102 includes:
[0063] Step S1021, comparing the object type table to check whether the object type information in the real-time library is consistent with that in the configuration library;
[0064] Among them, the object type table is used to describe object type information;
[0065] Step S1022: If the object type information is consistent, then for each object type, the object type attribute set is compared to check whether each object type attribute set in the real-time library is consistent with that in the configuration library;
[0066] Among them, the object type attribute set is used to describe the object type attribute information;
[0067] Step S1023: If each object type attribute set is consistent, then a comparison is performed on the value range of each object type attribute to check whether the value range of each object type attribute in the real-time library is consistent with that in the configuration library.
[0068] In this embodiment, the content of the model information comparison between the real-time library and the configuration library in step S102 is further limited. First, by comparing the object type tables, a comprehensive check is made to see whether the object type information in the real-time library and the configuration library is consistent, ensuring that there are no omissions or differences in the definition of the object type between the two. The object type table, as the core of describing object type information, provides an accurate data basis for this comparison process. Then, if the object type information is confirmed to be consistent, a detailed comparison is performed on the attribute sets of each object type. This step is intended to verify whether the attribute definitions of each object type in the real-time library and the configuration library are completely consistent, 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, the level of attribute values is deepened to compare the value ranges of each object type attribute. In particular, for attributes of enumerated data types, a strict check is performed to see whether the value ranges of each object type attribute in the real-time library and the configuration library are completely consistent to ensure the accuracy and consistency of the data.
[0069] The present invention can comprehensively and accurately verify the consistency of the real-time library and the configuration library model information, providing a strong guarantee for the stable operation of the substation monitoring system.
[0070] According to one embodiment of the present invention, step S104 includes:
[0071] When the model comparison result shows that the model information is consistent, the link relationship data of the configuration library and the number of instances of each object type are loaded; specifically, the following are included:
[0072] Obtain an object link relationship table and store the object link relationship table in memory in a hash table data structure; wherein the key of the object link relationship hash table is an 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 link object;
[0073] Obtain the instance quantity information of each object type and store the instance quantity information of each object type in memory in a hash table data structure; wherein the key of the instance quantity hash table of the object type is the object type ID, and the value of the instance quantity hash table of the object type is the number of instances existing in the object type.
[0074] This embodiment details the process of loading the configuration library's link relationship data and the number of instances of each object type. First, to efficiently manage link relationships between objects, the object link relationship table is read from a relational database and stored in memory using a hash table data structure. In this hash table, the key is a unique ID formed by concatenating the object ID and the link type ID. This design ensures that each link relationship is uniquely and accurately identified; the value is the link object ID. This design allows for rapid retrieval of all linked objects associated with a specific object and link type. Next, to maintain real-time information about the number of instances of each object type in the configuration library, the instance count information for each object type is also read from the relational database and stored in memory using another hash table data structure. In this hash table, the key is the object type ID, which uniquely identifies an object type in the configuration library; the value is the number of instances of that object type in the configuration library. This information is crucial for system resource monitoring and management, as well as for optimizing performance.
[0075] By adopting the efficient data structure of hash table, the present invention can significantly improve the loading and processing speed of configuration library data, providing strong support for the stable operation and rapid response of the system.
[0076] According to one 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;
[0077] In step S108, a comparison task is generated according to the task information, including:
[0078] Step S1081, traverse the instance quantity hash table of the object type, formulate task information for each object type 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.
[0079] Start multiple threads in the thread pool to concurrently execute multiple comparison tasks to generate comparison results, including:
[0080] Step S1082: multiple threads in the thread pool obtain task information from the task queue;
[0081] Step S1083: The thread executes the comparison task according to the task information.
[0082] In this implementation, by traversing a hash table of instance quantities of object types, task information is generated for each object type based on the number of instances that need to be compared. This task information is then pushed to the task queue of the thread pool, awaiting execution. Next, multiple threads in the thread pool retrieve task information from the task queue in parallel and perform specific comparison tasks based on this information. Each thread works independently, utilizing the previously generated task information to efficiently compare the corresponding instances in the real-time library and the configuration library, thereby generating accurate comparison results. This process fully leverages the advantages of concurrent execution, significantly improving comparison efficiency.
[0083] The present invention achieves efficient comparison of instances in a real-time library and a configuration library by formulating task information including object type ID, number of comparison instances and starting offset, and concurrently executing these tasks with the help of a thread pool.
[0084] According to one embodiment of the present invention, step S1083 includes:
[0085] Reading instance information in batches from the configuration library according to the task information;
[0086] Traverse each instance and obtain the corresponding real-time library target instance from the real-time library based on the instance ID. Compare the attributes of the instance with those of the real-time library target instance to see if they are 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 duplicate processing.
[0087] Push the task execution results 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;
[0088] Each task result contains inconsistent instance information, including inconsistent types and inconsistent instance IDs.
[0089] Inconsistency types include: only exists in the real-time library, only exists in the configuration library, and the attributes of the real-time library and the configuration library are inconsistent.
[0090] Preferably, step S1083 further includes:
[0091] Continuously poll the task result list. When the task chain list under the object type is completed, mark the task of the object type as completed. Skip the task chain list in the next poll until all the task chain lists of all object types are completed and exit.
[0092] In this embodiment, the execution process of step S1083 is planned in detail: first, instance information is read in batches from the configuration library according to the task information; then, these instances are traversed, and the corresponding target instances are found in the real-time library through the instance ID, and the properties of the two are compared one by one to see if they are consistent. In particular, when the attribute is a linked data type, the link relationship of the configuration library will be directly obtained from the object link relationship hash table, and the processed real-time library target instance will be marked to avoid repeated operations. After the comparison is completed, the task execution results, including inconsistent instance information (covering 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, the process also includes the step of continuously polling the task result list. Once all tasks of a certain object type are completed, they are marked as completed and skipped in subsequent polling until all tasks of all object types are completed and the entire process ends.
[0093] This invention efficiently reads instance information in batches from the configuration repository and compares its attributes with target instances in the real-time repository. It optimizes processing for linked data types to avoid duplication. Furthermore, it stores task execution results in a structured hash table and continuously polls the task result list to ensure that tasks of all object types are executed, ultimately achieving efficient and accurate instance information comparison.
[0094] Example 2
[0095] Figure 2 This is a flow chart of a method for comparing the entire real-time library with the configuration library according to another embodiment of the present invention. Figure 2 As shown, according to one embodiment of the present invention, a full library comparison method of a real-time library and a configuration library is applied to a substation monitoring system; the method comprises the following steps:
[0096] Step S202, comparing the model information of the real-time library and the configuration library; specifically including:
[0097] Compare the object type table to check whether the object types in the real-time library and the configuration library are consistent;
[0098] If the object types are consistent, then for each object type, compare the attribute set of the object type to check whether the attribute set of each object type in the real-time library and the configuration library is consistent;
[0099] If the attribute sets of each object type are consistent, the value range of each object type attribute is compared. In particular, for attributes of enumerated data types, it is checked whether the value range of each object type attribute in the real-time library and the configuration library is consistent.
[0100] Step S204: Loading the configuration library object link relationship data; specifically including:
[0101] Read the object link relationship table from the relational database and store it in the memory in the form of a hash table data structure.
[0102] 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.
[0103] Step S206: Load the number of instances of each object type in the configuration library; specifically, including:
[0104] Read the instance quantity information of each object type from the relational database and store it in the memory in a hash table data structure.
[0105] The key of the hash table is the object type ID, and the value is the number of instances of the object type.
[0106] Step S208: Starting a thread pool for executing the comparison task; specifically, the following steps are performed:
[0107] Multiple threads in the thread pool obtain task information from the task queue;
[0108] Perform the comparison task based on the task information.
[0109] Among them, executing the comparison task based on the task information includes the following:
[0110] Batch read instance information from the configuration library based on task information such as object type ID, number of instances to be compared, and starting offset of instances in the instance table;
[0111] Traverse each instance in turn, obtain the corresponding instance from the real-time library based on the instance ID, and compare the consistency of each attribute. If the attribute is a 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 instance is marked to prevent the existence of duplicate configuration library instances;
[0112] The task execution results are pushed to the task result list, which is stored in a hash table structure. The hash table key is the object type ID, and the value is a linked list of task results. Each task result contains inconsistent instance information. Inconsistent instance information includes inconsistent types and inconsistent instance IDs. The main types of inconsistencies include: only existing in the real-time database, only existing in the configuration database, and inconsistent attributes between the real-time database and the configuration database.
[0113] Step S210: Pushing the comparison task to the thread pool; specifically including:
[0114] Create task information, traverse the hash table of object types and quantities, and for each object type, create task information based on the number of instances that each task should compare. Then, push the task information to the thread pool's task queue. The task information includes the object type ID, the number of instances to compare, and the starting offset of the instance in the instance table.
[0115] Step S212: monitoring the comparison results of each object type; specifically, including:
[0116] Continuously poll the task result list. When the task chain list under the object type is completed, mark the task of the object type as completed. Skip the task chain list in the next poll until all the task chain lists of all object types are completed and exit.
[0117] In this embodiment, a full-library comparison method between a real-time library and a configuration library for a substation monitoring system is proposed. The method first compares the model information of the real-time library and the configuration library, including the consistency of object types, attribute sets and attribute value domains; then loads the object link relationship data of the configuration library and the number of instances of each object type into the memory for fast access; then starts a thread pool to prepare for the execution of the comparison task, at which 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 task, the threads in the thread pool will batch read instance information from the configuration library according to the task information, compare it with the corresponding instances in the real-time library, and record inconsistent instance information; finally, by continuously polling the task result list, the comparison results of each object type are monitored to ensure that all tasks are completed and exit.
[0118] The present invention realizes comprehensive and efficient comparison of model information of real-time library and configuration library in the substation monitoring system, improves comparison efficiency, ensures data accuracy, and provides reliable guarantee for the stable operation of the system.
[0119] Example 3
[0120] Figure 3 This is a schematic diagram of the structure of the full library comparison system of the real-time library and the configuration library according to one embodiment of the present invention. Figure 3 As shown, according to one embodiment of the present invention, a full-library comparison system of a real-time library and a configuration library is used to implement the full-library comparison method of any real-time library and a configuration library of the present invention, and the full-library comparison system includes:
[0121] The object type selection interface is used to select the object type to be compared. The default value is to compare instances of all object types.
[0122] The comparison result display interface is used to display the difference information between the real-time library and the configuration library. It displays the union of the real-time library object instances and the configuration library object instances in a tree structure. 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.
[0123] The comparison task management component is used to manage comparison tasks and implement multi-threaded concurrent execution of comparison tasks.
[0124] In the present embodiment, a full-library comparison system for a real-time library and a configuration library is provided. The system is used to implement any of the full-library comparison methods for a real-time library and a configuration library of the present invention, and aims to provide an efficient and accurate comparison tool to meet the needs of application scenarios such as substation monitoring systems. The full-library comparison system includes: an object type selection interface for selecting the object type to be compared; comparing instances in all object types to ensure comprehensive coverage; providing flexibility, allowing users to select specific object types for comparison based on actual needs, and the default value is to compare instances in all object types. A comparison result display interface is used to display the difference information between the real-time library and the configuration library; the union of the real-time library object instance and the configuration library object instance is displayed in a tree structure, so that the user can intuitively understand the comparison results; clicking on each object instance can display its attribute values in the real-time library and the configuration library, which is convenient for the user to view and analyze in depth. The comparison result display interface also includes an inconsistent instance display list, which is used to list all inconsistent object instances, so that the user can quickly locate and handle problems. The comparison task management component manages the comparison tasks to ensure the smooth progress of the comparison process; multiple threads execute the comparison tasks concurrently to improve the comparison efficiency and ensure that the system can respond quickly and accurately complete the comparison tasks.
[0125] The present invention compares instances of all object types by default to ensure the comprehensiveness of the comparison; makes the comparison results more intuitive and easy to understand through tree structure and detailed attribute value display; uses multi-threaded concurrent execution of comparison tasks to improve comparison efficiency and meet real-time requirements; provides a display list of inconsistent instances to facilitate users to quickly locate and handle problems, thereby improving the practicality of the system.
[0126] Example 4
[0127] Figure 4 This is a schematic diagram of the principle of a full-library comparison system for a real-time library and a configuration library according to an embodiment of the present invention. Figure 4 As shown, according to one embodiment of the present invention, a full-library comparison system of a real-time library and a configuration library is used to implement any full-library comparison method of a real-time library and a configuration library of the present invention, and the full-library comparison system includes: a real-time library, a configuration library, and a comparison tool;
[0128] The comparison tool can exchange information with the real-time library and the configuration library. The steps of performing the comparison by the comparison tool include:
[0129] The main thread generates comparison task information and pushes the task information to the task queue of the thread pool;
[0130] Multiple threads in the thread pool synchronously obtain task information from the task queue and perform comparison tasks based on the task information;
[0131] After each thread completes the comparison task, it pushes the task results into the task result hash table.
[0132] This embodiment proposes a full-library comparison system for a real-time library and a configuration library. The system integrates the real-time library, the configuration library, and an efficient comparison tool. The comparison tool, as a core component, interacts with the real-time and configuration libraries to perform full-library comparisons. In the main thread, the main thread generates comparison task information (a comparison task list) and pushes it to the task queue of the thread pool. This task information includes the 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 retrieve the task information from the task queue, read relevant data from the real-time and configuration libraries based on the task information, and perform comparisons, including value ranges. After completing the comparison, each thread pushes the comparison results to a task result hash table. The key of the task result hash table is the object type ID (OType ID), and the value is a task result linked list. The task result linked list contains inconsistent instance information, specifically inconsistent types and inconsistent instance IDs. Inconsistency Type: Indicates the inconsistency of the instance, such as whether it exists only in the real-time library, only 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. This design makes 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 corresponding alarm mechanisms, or performing other automated operations. Through these subsequent processing steps, users can more intuitively understand the data differences between the real-time library and the configuration library, and take appropriate measures to correct and optimize them in a timely manner, thereby ensuring the stable operation of the substation monitoring system and the accuracy of the data.
[0133] The present invention realizes main thread task distribution and multi-thread synchronous comparison, effectively improves the comparison efficiency, can accurately identify and summarize inconsistent instance information, including inconsistent types and instance IDs, and provides strong support for data consistency verification.
[0134] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and media can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0135] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention herein is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the inventive concept. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features having similar functions disclosed in this application.
[0136] It should be understood that the size of the serial numbers of each step in the content of the invention and the embodiments of the present invention does not absolutely mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
Claims
1. A full database comparison method between a real-time database and a configuration database, applied to a substation monitoring system, characterized in that: The following steps are involved: Compare the model information of the real-time library and the configuration library to obtain the model comparison results; Loading the link relationship data of the configuration library and the number of instances 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 a comparison task according to the task information, start multiple threads in the thread pool and concurrently execute multiple comparison tasks to generate comparison results; Loading the link relationship data of the configuration library and the number of instances of each object type based on the model comparison result includes: When the model comparison result shows that the model information is consistent, the link relationship data of the configuration library and the number of instances of each object type are loaded; specifically, the steps include: Obtain an object link relationship table, and store the object link relationship table in a memory in a hash table data structure; wherein the key of the object link relationship hash table is an 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 link object; Obtain the instance quantity information of each object type, and store the instance quantity information of each object type in memory in a hash table data structure; wherein the key of the instance quantity hash table of the object type is the object type ID, and the value of the instance quantity hash table of the object type is the number of instances existing in the object type; 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 a comparison task according to the task information, including: traversing the instance quantity hash table of the object type, formulating the task information for each object type 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.
2. The full-library comparison method of the real-time library and the configuration library according to claim 1 is characterized in that: Compare the model information between the real-time library and the configuration library to obtain the model comparison results, including: Comparing the object type table to check whether the object type information in the real-time library is consistent with that in the configuration library; If the object type information is consistent, then for each object type, the object type attribute set is compared to check whether each object type attribute set in the real-time library is consistent with that in the configuration library; If each object type attribute set is consistent, a comparison is performed on the value range of each object type attribute to check whether the value range of each object type attribute in the real-time library and the configuration library is consistent.
3. The full-library comparison method of the real-time library and the configuration library according to claim 1 is characterized in that: Starting multiple threads in a thread pool to concurrently execute multiple comparison tasks to generate comparison results, including: multiple threads in the thread pool obtaining the task information from a task queue; The thread executes the comparison task according to the task information.
4. The full-library comparison method of the real-time library and the configuration library according to claim 3 is characterized in that: The thread performs the comparison task according to the task information, including: Reading instance information in batches 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 the attributes of the instance with the real-time library target instance to see if they are consistent; when the attribute is a link data type, directly obtain the link relationship of the configuration library from the object link relationship hash table, and mark the obtained real-time library target instance to prevent duplicate processing; 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; Each task result includes inconsistent instance information, and the inconsistent instance information includes an inconsistent type and an inconsistent instance ID; Inconsistency types include: only exists in the real-time library, only exists in the configuration library, and the attributes of the real-time library and the configuration library are inconsistent.
5. The method for comparing the entire real-time database with the configuration database according to claim 4, characterized in that: The thread performs the comparison task according to the task information, including: Continuously poll the task result list. When the task chain list under the object type is completed, mark the task of the object type as completed. Skip the task chain list in the next poll until all the task chain lists of all object types are completed and exit.
6. A system for comparing the entire real-time library with the configuration library, for implementing the method for comparing the entire real-time library with the configuration library as claimed in any one of claims 1 to 5, characterized in that: The full library comparison system includes: The object type selection interface is used to select the object type to be compared. The default value is to compare instances of all object types. The comparison result display interface is used to display the difference information between the real-time library and the configuration library, and displays the union of the real-time library object instances and the configuration library object instances in a tree structure. 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. The comparison task management component is used to manage comparison tasks and implement multi-threaded concurrent execution of comparison tasks.
7. A system for comparing the entire real-time library with the configuration library, for implementing the method for comparing the entire real-time library with the configuration library as claimed in any one of claims 1 to 5, characterized in that: The full library comparison system includes: a real-time library, a configuration library, and a comparison tool; The comparison tool can exchange information with the real-time library and the configuration library; the steps of performing the comparison by the comparison tool include: The main thread generates comparison task information and pushes the task information to the task queue of the thread pool; The multiple threads in the thread pool synchronously obtain the task information from the task queue and perform the comparison task according to the task information; After each thread completes the comparison task, it pushes the task results into the task result hash table.
8. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the method for comparing the entire real-time library with the configuration library as claimed in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method, configuration tool and system for dynamically expanding increment of real-time library of power system
CN111782628A
Cloud mobile phone multi-machine cloning cross-regional data transmission method and system
CN119342060A