Power grid equipment state query method and system based on AVL tree optimization

By using the AVL tree optimization method in the grid equipment status query, and using the online and offline timestamps to build a self-balancing tree, the problem of low efficiency of grid equipment status query in the existing technology is solved, and fast and accurate grid equipment status query is achieved .

CN119106061APending Publication Date: 2024-12-10GLOBAL ENERGY INTERCONNECTION RES INST CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410971665.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The prior art is not very querying when monitoring the up and down status of power grid equipment in real time, especially during large-scale data processing, it is necessary to access each device table multiple times, resulting in a long time consumption.

Method used

Adoption method based on AVL tree is adopted to build a self-balanced binary search AVL tree, and use the online time stamp and the offline time stamp to quickly query the collection of power grid equipment to improve query efficiency. The specific steps include receiving the query time range of the client, determining the device set in the first device set AVL tree based on the upper line timestamp, and determining the device set and the upper and lower line that meet the time range in the second device set AVL tree based on the lower line timestamp. state.

Benefits of technology

It realizes efficient and accurate query of the up and down states of power grid equipment, improves query efficiency, and can locate the target equipment collection within O(log n) time complexity, adapting to the processing needs of large power grid equipment data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106061A_ABST
    Figure CN119106061A_ABST
Patent Text Reader

Abstract

The invention provides a power grid equipment state query method and system based on AVL tree optimization. The method comprises the following steps: receiving online time and offline time; according to the online time, in a first equipment set self-balancing binary search AVL tree pre-constructed by the server, determining a first power grid equipment set of which the online time accords with an online timestamp; according to the off-line time and the first power grid equipment set, in a second equipment set self-balancing binary search AVL tree corresponding to a server, determining a second power grid equipment set of which the on-line and off-line time accords with a query time range, and on-line and off-line states of the second power grid equipment set; feeding back the second power grid equipment set and the online and offline state of the second power grid equipment set to the client; according to the method, the online and offline information of the power grid equipment is stored, the power grid equipment set and the online and offline state in the time range are efficiently and accurately queried in the AVL trees of the two equipment sets by querying the time range, and the online and offline query efficiency of the power grid equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The patent application of the present invention belongs to the field of data query technology, and specifically relates to a power grid equipment status query method and system based on AVL tree optimization. Background Art

[0002] With the development of smart grids, real-time monitoring of the online and offline status of grid equipment is crucial to ensuring stable grid operation and optimizing resource allocation.

[0003] Current data is all stored in relational databases. It takes a long time to find the device set corresponding to the upper and lower limit times. The machine needs to access each device table once to find the device set corresponding to a certain period of time. Therefore, the existing query method is not efficient when facing large-scale data processing. Summary of the invention

[0004] In order to overcome the above-mentioned deficiencies of the prior art, the present invention patent application proposes a power grid equipment status query method based on AVL tree optimization, comprising:

[0005] Receive a query time range from the client; the query time range includes: online time and offline time;

[0006] According to the online time, determining, in a first device set self-balancing binary search AVL tree pre-constructed by the server, a first power grid device set whose online time matches an online timestamp;

[0007] According to the offline time and the first power grid device set, in the second device set self-balancing binary search AVL tree corresponding to the server, determine the second power grid device set whose online and offline times are within the query time range, and the online and offline status of the second power grid device set; wherein the second power grid device set is the same as the first power grid device set, or is a subset of the first power grid device set;

[0008] The second power grid device set and the online and offline status of the second power grid device set are fed back to the client.

[0009] Preferably, the process of constructing the self-balancing binary search AVL tree of the first device set includes:

[0010] Taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition;

[0011] According to the nodes of the first equipment set self-balancing binary search AVL tree and the first balancing condition, completing the construction of the first equipment set self-balancing binary search AVL tree;

[0012] Among them, the node includes: the identification of the power grid device or a set of power grid devices, the online timestamp of the power grid device or a set of power grid devices, and the offline timestamp of the power grid device or a set of power grid devices; the power grid device set is composed of power grid devices with the same online timestamp and physical connection relationship within a preset range.

[0013] Preferably, the construction process of the second device set self-balancing binary search AVL tree includes:

[0014] Taking the offline timestamp of the power grid device or the set of power grid devices as the second balancing condition;

[0015] According to the changes in the offline timestamps of the power grid equipment or the power grid equipment set of each node in the self-balancing binary search AVL tree of the first equipment set, combined with the second balancing condition, the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the self-balancing binary search AVL tree of the first equipment set is completed.

[0016] Preferably, after completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree and combining the second balancing condition, it also includes:

[0017] When an online timestamp of a new power grid device or a new power grid device set is received through the client, the new power grid device or the new power grid device set is inserted into the first device set self-balancing binary search AVL tree according to the online timestamp;

[0018] When the offline timestamp of the new power grid device or the new power grid device set is different from the offline timestamp of the existing power grid device or the power grid device set in the node, if the node has a corresponding second equipment set self-balancing binary search AVL tree, the power grid devices or power grid device sets with different offline timestamps in the node are inserted into the corresponding second equipment set self-balancing binary search AVL tree; if the node does not have a corresponding second equipment set self-balancing binary search AVL tree, then the second equipment set self-balancing binary search AVL tree corresponding to the node is constructed.

[0019] Preferably, after completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree and combining the second balancing condition, it also includes:

[0020] When the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted is received through the client, according to the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted, in the first device set self-balancing binary search AVL tree, the node corresponding to the power grid device to be deleted or the set of power grid devices to be deleted is deleted;

[0021] If there is a corresponding second equipment set self-balancing binary search AVL tree for the node corresponding to the grid device to be deleted or the set of grid devices to be deleted, then according to the offline timestamp of the grid device to be deleted or the set of grid devices to be deleted, delete the grid device to be deleted or the set of grid devices to be deleted from the node corresponding to the second equipment set self-balancing binary search AVL tree.

[0022] Preferably, after completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree and combining the second balancing condition, it also includes:

[0023] Periodically performing a balancing operation on the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree, and using a cache mechanism to store hotspot query results;

[0024] Among them, when the number of queries in any query time range exceeds the preset number of queries, the second power grid device set corresponding to the query time range and the online and offline status of the second power grid device set are used as the hotspot query result.

[0025] Based on the same inventive concept, the patent application of the present invention also provides a power grid equipment status query system based on AVL tree optimization, including: a query time range receiving module, a first power grid equipment set determination module, a second power grid equipment set and an online and offline status determination module and a data feedback module;

[0026] The query time range receiving module is used to receive the query time range of the client; the query time range includes: online time and offline time;

[0027] The first power grid device set determination module is used to determine, according to the online time, a first power grid device set whose online time matches an online timestamp in a first device set self-balancing binary search AVL tree pre-constructed by a server;

[0028] The second power grid device set and online and offline status determination module is used to determine, according to the offline time and the first power grid device set, in the second device set self-balancing binary search AVL tree corresponding to the server, the second power grid device set whose online and offline time is within the query time range, and the online and offline status of the second power grid device set; wherein the second power grid device set is the same as the first power grid device set, or is a subset of the first power grid device set;

[0029] The data feedback module is used to feed back the second power grid device set and the online and offline status of the second power grid device set to the client.

[0030] Preferably, it also includes: a first device set self-balancing binary search AVL tree construction module, used to:

[0031] Taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition;

[0032] According to the nodes of the first equipment set self-balancing binary search AVL tree and the first balancing condition, completing the construction of the first equipment set self-balancing binary search AVL tree;

[0033] Among them, the node includes: the identification of the power grid device or a set of power grid devices, the online timestamp of the power grid device or a set of power grid devices, and the offline timestamp of the power grid device or a set of power grid devices; the power grid device set is composed of power grid devices with the same online timestamp and physical connection relationship within a preset range.

[0034] Preferably, it also includes: a second device set self-balancing binary search AVL tree construction module, used to:

[0035] Taking the offline timestamp of the power grid device or the set of power grid devices as the second balancing condition;

[0036] According to the changes in the offline timestamps of the power grid equipment or the power grid equipment set of each node in the self-balancing binary search AVL tree of the first equipment set, combined with the second balancing condition, the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the self-balancing binary search AVL tree of the first equipment set is completed.

[0037] Preferably, it also includes: a new device insertion module, used for:

[0038] When an online timestamp of a new power grid device or a new power grid device set is received through the client, the new power grid device or the new power grid device set is inserted into the first device set self-balancing binary search AVL tree according to the online timestamp;

[0039] When the offline timestamp of the new power grid device or the new power grid device set is different from the offline timestamp of the existing power grid device or the power grid device set in the node, if the node has a corresponding second equipment set self-balancing binary search AVL tree, the power grid devices or power grid device sets with different offline timestamps in the node are inserted into the corresponding second equipment set self-balancing binary search AVL tree; if the node does not have a corresponding second equipment set self-balancing binary search AVL tree, then the second equipment set self-balancing binary search AVL tree corresponding to the node is constructed.

[0040] Preferably, it also includes: an old device deletion module, which is used to:

[0041] When the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted is received through the client, according to the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted, in the first device set self-balancing binary search AVL tree, the node corresponding to the power grid device to be deleted or the set of power grid devices to be deleted is deleted;

[0042] If there is a corresponding second equipment set self-balancing binary search AVL tree for the node corresponding to the grid device to be deleted or the set of grid devices to be deleted, then according to the offline timestamp of the grid device to be deleted or the set of grid devices to be deleted, delete the grid device to be deleted or the set of grid devices to be deleted from the node corresponding to the second equipment set self-balancing binary search AVL tree.

[0043] Preferably, it also includes: a device set self-balancing binary search AVL tree periodic processing module, which is used to:

[0044] Periodically performing a balancing operation on the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree, and using a cache mechanism to store hotspot query results;

[0045] Among them, when the number of queries in any query time range exceeds the preset number of queries, the second power grid device set corresponding to the query time range and the online and offline status of the second power grid device set are used as the hotspot query result.

[0046] Preferably, the first device set self-balancing binary search AVL tree construction module is also used for:

[0047] Performing data verification and filtering on received power grid devices or power grid device collections;

[0048] When sensitive data exists in the power grid device or the power grid device set, the sensitive data is encrypted for storage and encrypted for transmission.

[0049] Based on the same inventive concept, the present patent application also provides a computer device, including: one or more processors;

[0050] A memory for storing one or more programs;

[0051] When the one or more programs are executed by the one or more processors, the above-mentioned method for querying the state of power grid equipment based on AVL tree optimization is implemented.

[0052] Based on the same inventive concept, the patent application of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed, a power grid equipment status query method based on AVL tree optimization as described above is implemented.

[0053] Compared with the closest prior art, the patent application of this invention has the following beneficial effects:

[0054] The patent application of the present invention provides a method and system for querying the status of power grid equipment based on AVL tree optimization, including: receiving a query time range of a client; the query time range includes: online time and offline time; according to the online time, in a first device set self-balancing binary search AVL tree pre-constructed by a server, determining a first power grid equipment set whose online time matches an online timestamp; according to the offline time and the first power grid equipment set, in a second device set self-balancing binary search AVL tree corresponding to the server, determining a second power grid equipment set whose online and offline times match the query time range, and the second power grid equipment set Online and offline status; wherein, the second power grid equipment set is the same as the first power grid equipment set, or is a subset of the first power grid equipment set; the online and offline status of the second power grid equipment set and the second power grid equipment set are fed back to the client; the first equipment set self-balancing binary search AVL tree and the second equipment set self-balancing binary search AVL tree of the present invention store the online and offline information of the power grid equipment, and by querying the time range, the power grid equipment set and the online and offline status within the time range can be efficiently and accurately queried in the two equipment set self-balancing binary search AVL trees, thereby improving the efficiency of the online and offline query of the power grid equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A flowchart of a method for querying the state of power grid equipment based on AVL tree optimization provided for the patent application of the present invention;

[0056] Figure 2 A schematic diagram of a power grid equipment status query system based on AVL tree optimization provided for the patent application of the present invention;

[0057] Figure 3A schematic structural diagram of an electronic device provided for the patent application of the present invention. DETAILED DESCRIPTION

[0058] The specific implementation methods of the patent application of the present invention are further described in detail below in conjunction with the accompanying drawings.

[0059] Embodiment 1:

[0060] The present invention patent application provides a method for querying the state of power grid equipment based on AVL tree optimization. Figure 1 As shown, including:

[0061] Step 1: Receive the query time range of the client; the query time range includes: online time and offline time;

[0062] Step 2: According to the online time, determine the first power grid device set whose online time matches the online timestamp in the first device set self-balancing binary search AVL tree (Athena Vortex Lattice, self-balancing binary search tree) pre-constructed by the server;

[0063] Step 3: According to the offline time and the first power grid device set, in the second device set self-balancing binary search AVL tree corresponding to the server, determine the second power grid device set whose online and offline time is within the query time range, and the online and offline status of the second power grid device set; wherein the second power grid device set is the same as the first power grid device set, or is a subset of the first power grid device set;

[0064] Step 4: Feedback the second power grid device set and the online and offline status of the second power grid device set to the client.

[0065] The embodiment of the present invention adopts a client-server architecture. The power grid equipment online and offline query method based on AVL tree optimization provided by the embodiment of the present invention is applied to the server. In the above step 1, the server uses two types of AVL trees (the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree) to store and manage the online and offline information of the power grid equipment. The client is responsible for providing a user interface and interacting with the server. Therefore, the client receives the query time range input by the user and sends it to the server. The query time range includes: online time and offline time. The online time generates an online timestamp, and the offline time generates a corresponding offline timestamp. The timestamp refers to the total number of seconds from 00:00:00 Greenwich time on January 1, 1970 (08:00:00 Beijing time on January 1, 1970) to the present.

[0066] The construction process of the first device set self-balancing binary search AVL tree in the above step 2 includes:

[0067] Taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition;

[0068] According to the nodes of the first equipment set self-balancing binary search AVL tree and the first balancing condition, completing the construction of the first equipment set self-balancing binary search AVL tree;

[0069] Among them, the node includes: the identification of the power grid device or a set of power grid devices, the online timestamp of the power grid device or a set of power grid devices, and the offline timestamp of the power grid device or a set of power grid devices; the power grid device set is composed of power grid devices with the same online timestamp and physical connection relationship within a preset range.

[0070] For example, there is only one self-balancing binary search AVL tree for the first device set. The self-balancing binary search AVL tree for the first device set uses the online timestamp of the power grid device or device set as the balancing condition. Each node contains the identifier, online timestamp and offline timestamp of the device or device set. The device set in the tree consists of devices with the same online timestamp and close physical connection relationship, so as to facilitate batch query and operation;

[0071] In one implementation, before taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition, the method further includes:

[0072] Performing data verification and filtering on received power grid devices or power grid device collections;

[0073] When sensitive data exists in the power grid device or the power grid device set, the sensitive data is encrypted for storage and encrypted for transmission.

[0074] For example, the server needs to verify and filter the power grid equipment or power grid equipment set or other information input by the user to prevent security issues such as injection attacks. At the same time, sensitive data is encrypted for storage and transmission to ensure data security; each node in the first device set self-balancing binary search AVL tree of the present invention stores the online and offline timestamps of the device, making the query results very accurate. Users can accurately obtain the online and offline status of the corresponding device or device set according to the provided time range.

[0075] In step 3, the construction process of the second device set self-balancing binary search AVL tree includes:

[0076] Taking the offline timestamp of the power grid device or the set of power grid devices as the second balancing condition;

[0077] According to the changes in the offline timestamps of the power grid equipment or the power grid equipment set of each node in the self-balancing binary search AVL tree of the first equipment set, combined with the second balancing condition, the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the self-balancing binary search AVL tree of the first equipment set is completed.

[0078] For example, there are multiple self-balancing binary search AVL trees for the second device set, and the second device set self-balancing binary search AVL tree is established in response to changes in the online and offline information of the device set in the first device set self-balancing binary search AVL tree. When the offline information of a device in the device set changes, all the empty offline timestamps in the device set are set to 0. The purpose of setting all the empty offline timestamps in the device set to 0 is to determine that the offline timestamps are the same. When the lower limit information of a device changes, the second device set self-balancing binary search AVL tree can be created according to the value of the offline timestamp, and the devices with the same offline timestamps can be used as the new device set. The second device set self-balancing binary search AVL tree uses the offline timestamp as the balancing condition. Each node contains the device's identifier, online timestamp, and offline timestamp, which is used to accurately manage the offline status of each device in the device set.

[0079] In one implementation, after completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree and combining the second balancing condition, it also includes:

[0080] When an online timestamp of a new power grid device or a new power grid device set is received through the client, the new power grid device or the new power grid device set is inserted into the first device set self-balancing binary search AVL tree according to the online timestamp;

[0081] When the offline timestamp of the new power grid device or the new power grid device set is different from the offline timestamp of the existing power grid device or the power grid device set in the node, if the node has a corresponding second equipment set self-balancing binary search AVL tree, the power grid devices or power grid device sets with different offline timestamps in the node are inserted into the corresponding second equipment set self-balancing binary search AVL tree; if the node does not have a corresponding second equipment set self-balancing binary search AVL tree, then the second equipment set self-balancing binary search AVL tree corresponding to the node is constructed.

[0082] For example, the client receives the online and offline times of a new device or device set input by the user and sends it to the server. The server inserts the new device or device set into the first device set self-balancing binary search AVL tree according to the online timestamp, and calculates the height difference of each path after the insertion. If the height difference exceeds the threshold, the structure of the tree is adjusted to maintain height balance. If the offline timestamp of the node where the new device set is located is different, if the node does not have a corresponding second device set self-balancing binary search AVL tree, then a second device set self-balancing binary search AVL tree is established with the offline timestamp as the balancing condition; if so, the devices or device sets with different offline timestamps are inserted into the second device set self-balancing binary search AVL tree.

[0083] In one implementation, according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first equipment set self-balancing binary search AVL tree, combined with the second balancing condition, after completing the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the first equipment set self-balancing binary search AVL tree, it also includes:

[0084] When the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted is received through the client, according to the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted, in the first device set self-balancing binary search AVL tree, the node corresponding to the power grid device to be deleted or the set of power grid devices to be deleted is deleted;

[0085] If there is a corresponding second equipment set self-balancing binary search AVL tree for the node corresponding to the grid device to be deleted or the set of grid devices to be deleted, then according to the offline timestamp of the grid device to be deleted or the set of grid devices to be deleted, delete the grid device to be deleted or the set of grid devices to be deleted from the node corresponding to the second equipment set self-balancing binary search AVL tree.

[0086] For example, the client receives the online and offline timestamps of the device or device set to be deleted input by the user, and sends it to the server. The server determines the node set where the device or device set to be deleted is located according to the online timestamp in the first device set self-balancing binary search AVL tree. If the node exists in the second device set self-balancing binary search AVL tree, the device or device set to be deleted is finally determined according to the offline timestamp. After deletion, the server recalculates the height of the affected path and rebalances the structure of the tree as needed; the method of the present invention allows users to flexibly insert and delete the online and offline events of power grid devices. Whether it is the online of new devices or the offline of old devices, it can be quickly and effectively reflected in the data structure; in the present invention, since the AVL tree is a self-balancing binary search tree, it automatically adjusts the structure to maintain balance when inserting and deleting nodes. This enables the method to adapt well to the increase or decrease in the number of power grid devices without the need for additional optimization or adjustment; the present invention uses the AVL tree as a storage structure to ensure that the height of the tree is always kept at the lowest possible value, thereby ensuring that the time complexity of query, insertion and deletion operations is O (log n). This greatly improves the efficiency of data processing for large power grid device data sets.

[0087] In one implementation, according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first equipment set self-balancing binary search AVL tree, combined with the second balancing condition, after completing the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the first equipment set self-balancing binary search AVL tree, it also includes:

[0088] Periodically performing a balancing operation on the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree, and using a cache mechanism to store hotspot query results;

[0089] Among them, when the number of queries in any query time range exceeds the preset number of queries, the second power grid device set corresponding to the query time range and the online and offline status of the second power grid device set are used as the hotspot query result.

[0090] For example, in order to improve the query efficiency, the server can periodically perform a balancing operation on the AVL tree to reduce the height of the tree. In addition, a cache mechanism can also be used to store hotspot query results to reduce the number of database accesses; the present invention realizes efficient and accurate online and offline status query of power grid equipment by constructing an online and offline query method for power grid equipment based on the AVL tree. By optimizing the design of system architecture, data storage, query processing, insertion processing, deletion processing, performance optimization and security assurance, the feasibility and reliability of the technical solution are ensured; the present invention is used to execute online and offline status query of power grid equipment or equipment collection, insertion of online and offline events of new equipment or equipment collection, and deletion of outdated equipment or equipment collection and its online and offline information. When querying, the height balance characteristic of the AVL tree is used to quickly locate the target node collection along the optimal path by comparing the node values, so as to quickly return the online and offline status list of the corresponding equipment or equipment collection. When inserting data, when inserting a new device or equipment collection, the height difference of each path after the new node is inserted is calculated, and the structure of the tree is adjusted according to the height difference to keep the height balance of the AVL tree. When deleting a device or a set of devices, the deletion module will recalculate the height of the affected path and rebalance the tree structure as needed; the online and offline query method of power grid equipment based on the AVL tree of the present invention has the advantages of high efficiency, accuracy, flexibility, and scalability, and provides an efficient and reliable solution for power grid equipment management; the present invention utilizes the self-balancing characteristics of the AVL tree to achieve rapid query and update of device status to improve data processing efficiency.

[0091] Embodiment 2:

[0092] Based on the same inventive concept, the present invention patent application also provides a power grid equipment status query system based on AVL tree optimization. Figure 2 As shown, it includes: a query time range receiving module, a first power grid device set determination module, a second power grid device set and an online and offline status determination module and a data feedback module;

[0093] The query time range receiving module is used to receive the query time range of the client; the query time range includes: online time and offline time;

[0094] The first power grid device set determination module is used to determine, according to the online time, a first power grid device set whose online time matches an online timestamp in a first device set self-balancing binary search AVL tree pre-constructed by a server;

[0095] The second power grid device set and online and offline status determination module is used to determine, according to the offline time and the first power grid device set, in the second device set self-balancing binary search AVL tree corresponding to the server, the second power grid device set whose online and offline time is within the query time range, and the online and offline status of the second power grid device set; wherein the second power grid device set is the same as the first power grid device set, or is a subset of the first power grid device set;

[0096] The data feedback module is used to feed back the second power grid device set and the online and offline status of the second power grid device set to the client.

[0097] Preferably, it also includes: a first device set self-balancing binary search AVL tree construction module, used to:

[0098] Taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition;

[0099] According to the nodes of the first equipment set self-balancing binary search AVL tree and the first balancing condition, completing the construction of the first equipment set self-balancing binary search AVL tree;

[0100] Among them, the node includes: the identification of the power grid device or a set of power grid devices, the online timestamp of the power grid device or a set of power grid devices, and the offline timestamp of the power grid device or a set of power grid devices; the power grid device set is composed of power grid devices with the same online timestamp and physical connection relationship within a preset range.

[0101] Preferably, it also includes: a second device set self-balancing binary search AVL tree construction module, used to:

[0102] Taking the offline timestamp of the power grid device or the set of power grid devices as the second balancing condition;

[0103] According to the changes in the offline timestamps of the power grid equipment or the power grid equipment set of each node in the self-balancing binary search AVL tree of the first equipment set, combined with the second balancing condition, the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the self-balancing binary search AVL tree of the first equipment set is completed.

[0104] Preferably, it also includes: a new device insertion module, which is used to: when an online timestamp of a new power grid device or a new power grid device set is received through the client, insert the new power grid device or the new power grid device set into the first device set self-balancing binary search AVL tree according to the online timestamp;

[0105] When the offline timestamp of the new power grid device or the new power grid device set is different from the offline timestamp of the existing power grid device or the power grid device set in the node, if the node has a corresponding second equipment set self-balancing binary search AVL tree, the power grid devices or power grid device sets with different offline timestamps in the node are inserted into the corresponding second equipment set self-balancing binary search AVL tree; if the node does not have a corresponding second equipment set self-balancing binary search AVL tree, then the second equipment set self-balancing binary search AVL tree corresponding to the node is constructed.

[0106] Preferably, it also includes: an old device deletion module, which is used to: when receiving the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted through the client, delete the node corresponding to the power grid device to be deleted or the set of power grid devices to be deleted in the first device set self-balancing binary search AVL tree according to the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted;

[0107] If there is a corresponding second equipment set self-balancing binary search AVL tree for the node corresponding to the grid device to be deleted or the set of grid devices to be deleted, then according to the offline timestamp of the grid device to be deleted or the set of grid devices to be deleted, delete the grid device to be deleted or the set of grid devices to be deleted from the node corresponding to the second equipment set self-balancing binary search AVL tree.

[0108] Preferably, it also includes: a device set self-balancing binary search AVL tree periodic processing module, which is used to:

[0109] Periodically performing a balancing operation on the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree, and using a cache mechanism to store hotspot query results;

[0110] Among them, when the number of queries in any query time range exceeds the preset number of queries, the second power grid device set corresponding to the query time range and the online and offline status of the second power grid device set are used as the hotspot query result.

[0111] Preferably, the first device set self-balancing binary search AVL tree construction module is also used for:

[0112] Performing data verification and filtering on received power grid devices or power grid device collections;

[0113] When sensitive data exists in the power grid device or the power grid device set, the sensitive data is encrypted for storage and encrypted for transmission.

[0114] Example 3

[0115] like Figure 3As shown, the present invention also provides an electronic device, which may be a computer device, a single-chip device, an intelligent mobile device, etc. The electronic device in this embodiment may include a processor, a memory, a transceiver component, etc. The memory, the processor, and the transceiver component are connected via a bus; the memory may be used to store an execution program, and an exemplary execution program may include instructions; the processor is used to execute the instructions stored in the memory. The memory may also be used to store data, which may be called and / or modified when the instructions are executed.

[0116] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in a storage medium to implement the corresponding method flow or corresponding functions, so as to implement the steps of a power grid equipment status query method based on AVL tree optimization in the above embodiment.

[0117] Example 4

[0118] Based on the same inventive concept, the present invention also provides a readable storage medium, specifically an electronic device readable storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It can be understood that the storage medium here can include both built-in storage media in electronic devices and, of course, extended storage media supported by electronic devices. The storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more execution programs (including program codes). It should be noted that the storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor loads and executes one or more instructions stored in the storage medium, which can implement the steps of a power grid equipment status query method based on AVL tree optimization in the above embodiment.

[0119] It should be understood by those skilled in the art that the embodiments of the present invention patent application can be provided as methods, systems, or computer program products. Therefore, the present invention patent application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention patent application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0120] The present invention patent application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present invention patent application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0121] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the patent application of the present invention rather than to limit its protection scope. Although the patent application of the present invention is described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the patent application of the present invention, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the application, but these changes, modifications or equivalent substitutions are all within the protection scope of the claims to be approved.

Claims

1. A method for querying power grid equipment status based on AVL tree optimization, characterized in that: include: Receive the query time range from the client; The query time range includes: online time and offline time; According to the online time, determining, in a first device set self-balancing binary search AVL tree pre-constructed by the server, a first power grid device set whose online time matches an online timestamp; According to the offline time and the first power grid device set, in the second device set self-balancing binary search AVL tree corresponding to the server, determine the second power grid device set whose online and offline times are within the query time range, and the online and offline status of the second power grid device set; wherein the second power grid device set is the same as the first power grid device set, or is a subset of the first power grid device set; The second power grid device set and the online and offline status of the second power grid device set are fed back to the client.

2. The method according to claim 1, characterized in that The process of constructing the self-balancing binary search AVL tree of the first device set includes: Taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition; According to the nodes of the first equipment set self-balancing binary search AVL tree and the first balancing condition, completing the construction of the first equipment set self-balancing binary search AVL tree; Among them, the node includes: the identification of the power grid device or a set of power grid devices, the online timestamp of the power grid device or a set of power grid devices, and the offline timestamp of the power grid device or a set of power grid devices; the power grid device set is composed of power grid devices with the same online timestamp and physical connection relationship within a preset range.

3. The method according to claim 2, characterized in that The construction process of the second device set self-balancing binary search AVL tree includes: Taking the offline timestamp of the power grid device or the set of power grid devices as the second balancing condition; According to the changes in the offline timestamps of the power grid equipment or the power grid equipment set of each node in the self-balancing binary search AVL tree of the first equipment set, combined with the second balancing condition, the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the self-balancing binary search AVL tree of the first equipment set is completed.

4. The method according to claim 3, characterized in that After completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree in combination with the second balancing condition, the method further includes: When an online timestamp of a new power grid device or a new power grid device set is received through the client, the new power grid device or the new power grid device set is inserted into the first device set self-balancing binary search AVL tree according to the online timestamp; When the offline timestamp of the new power grid device or the new power grid device set is different from the offline timestamp of the existing power grid device or the power grid device set in the node, if the node has a corresponding second equipment set self-balancing binary search AVL tree, the power grid devices or power grid device sets with different offline timestamps in the node are inserted into the corresponding second equipment set self-balancing binary search AVL tree; if the node does not have a corresponding second equipment set self-balancing binary search AVL tree, then the second equipment set self-balancing binary search AVL tree corresponding to the node is constructed.

5. The method according to claim 3, characterized in that After completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree in combination with the second balancing condition, the method further includes: When the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted is received through the client, according to the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted, in the first device set self-balancing binary search AVL tree, the node corresponding to the power grid device to be deleted or the set of power grid devices to be deleted is deleted; If there is a corresponding second equipment set self-balancing binary search AVL tree for the node corresponding to the grid device to be deleted or the set of grid devices to be deleted, then according to the offline timestamp of the grid device to be deleted or the set of grid devices to be deleted, delete the grid device to be deleted or the set of grid devices to be deleted from the node corresponding to the second equipment set self-balancing binary search AVL tree.

6. The method according to claim 3, characterized in that After completing the construction of the second device set self-balancing binary search AVL tree corresponding to each node in the first device set self-balancing binary search AVL tree according to the change of the offline timestamp of the power grid device or the power grid device set of each node in the first device set self-balancing binary search AVL tree in combination with the second balancing condition, the method further includes: Periodically performing a balancing operation on the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree, and using a cache mechanism to store hotspot query results; Among them, when the number of queries in any query time range exceeds the preset number of queries, the second power grid device set corresponding to the query time range and the online and offline status of the second power grid device set are used as the hotspot query result.

7. The method according to claim 2, characterized in that Before taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition, the method further includes: Verify and filter data on received power grid devices or power grid device collections; When sensitive data exists in the power grid device or the power grid device set, the sensitive data is encrypted for storage and encrypted for transmission.

8. A power grid equipment status query system based on AVL tree optimization, characterized in that: include: A query time range receiving module, a first power grid equipment set determining module, a second power grid equipment set and an online and offline status determining module, and a data feedback module; The query time range receiving module is used to receive the query time range of the client; The query time range includes: online time and offline time; The first power grid device set determination module is used to determine, according to the online time, a first power grid device set whose online time matches an online timestamp in a first device set self-balancing binary search AVL tree pre-constructed by a server; The second power grid device set and online and offline status determination module is used to determine, according to the offline time and the first power grid device set, in the second device set self-balancing binary search AVL tree corresponding to the server, the second power grid device set whose online and offline time is within the query time range, and the online and offline status of the second power grid device set; wherein the second power grid device set is the same as the first power grid device set, or is a subset of the first power grid device set; The data feedback module is used to feed back the second power grid device set and the online and offline status of the second power grid device set to the client.

9. The system according to claim 8, characterized in that Also includes: The first device sets a self-balancing binary search AVL tree building module for: Taking the online timestamp of the power grid device or the set of power grid devices as the first balancing condition; According to the nodes of the first equipment set self-balancing binary search AVL tree and the first balancing condition, completing the construction of the first equipment set self-balancing binary search AVL tree; Among them, the node includes: the identification of the power grid device or a set of power grid devices, the online timestamp of the power grid device or a set of power grid devices, and the offline timestamp of the power grid device or a set of power grid devices; the power grid device set is composed of power grid devices with the same online timestamp and physical connection relationship within a preset range.

10. The system according to claim 9, characterized in that Also includes: The second device sets a self-balancing binary search AVL tree building module for: Taking the offline timestamp of the power grid device or the set of power grid devices as the second balancing condition; According to the changes in the offline timestamps of the power grid equipment or the power grid equipment set of each node in the self-balancing binary search AVL tree of the first equipment set, combined with the second balancing condition, the construction of the second equipment set self-balancing binary search AVL tree corresponding to each node in the self-balancing binary search AVL tree of the first equipment set is completed.

11. The system according to claim 9, characterized in that Also includes: New device plug-in modules for: When an online timestamp of a new power grid device or a new power grid device set is received through the client, the new power grid device or the new power grid device set is inserted into the first device set self-balancing binary search AVL tree according to the online timestamp; When the offline timestamp of the new power grid device or the new power grid device set is different from the offline timestamp of the existing power grid device or the power grid device set in the node, if the node has a corresponding second device set self-balancing binary search AVL tree, the power grid devices or power grid device sets with different offline timestamps in the node are inserted into the corresponding second device set self-balancing binary search AVL tree; If the node does not have a corresponding second device set self-balancing binary search AVL tree, a second device set self-balancing binary search AVL tree corresponding to the node is constructed.

12. The system according to claim 9, characterized in that Also includes: Old device removal module for: When the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted is received through the client, according to the online timestamp of the power grid device to be deleted or the set of power grid devices to be deleted, in the first device set self-balancing binary search AVL tree, the node corresponding to the power grid device to be deleted or the set of power grid devices to be deleted is deleted; If there is a corresponding second equipment set self-balancing binary search AVL tree for the node corresponding to the grid device to be deleted or the set of grid devices to be deleted, then according to the offline timestamp of the grid device to be deleted or the set of grid devices to be deleted, delete the grid device to be deleted or the set of grid devices to be deleted from the node corresponding to the second equipment set self-balancing binary search AVL tree.

13. The system of claim 8, wherein: Also includes: Device set self-balancing binary search AVL tree periodic processing module for: Periodically performing a balancing operation on the first device set self-balancing binary search AVL tree and the second device set self-balancing binary search AVL tree, and using a cache mechanism to store hotspot query results; Among them, when the number of queries in any query time range exceeds the preset number of queries, the second power grid device set corresponding to the query time range and the online and offline status of the second power grid device set are used as the hotspot query result.

14. The system of claim 9, wherein: The first device set self-balancing binary search AVL tree building module is also used to: Verify and filter data on received power grid devices or power grid device collections; When sensitive data exists in the power grid device or the power grid device set, the sensitive data is encrypted for storage and encrypted for transmission.

15. An electronic device, characterized in that: include: at least one processor and memory; The memory and the processor are connected via a bus; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, a power grid device status query method based on AVL tree optimization as described in any one of claims 1 to 7 is implemented.

16. A readable storage medium, characterized in that: An execution program is stored thereon, and when the execution program is executed, a power grid equipment status query method based on AVL tree optimization as described in any one of claims 1 to 7 is implemented.