A Spark-based power grid topology loop detection method and system
By building Graphx topology diagrams on the Spark platform and applying loop identification algorithms, the problem of inefficient power grid topology loop detection in the existing technology is solved, and efficient and fast topology loop detection is achieved, with good scalability and fault tolerance.
Patent Information
- Application Number
- CN202411675737.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-11-22
AI Technical Summary
When the prior art finds and outputs topological loops that may have problems in the power system, the calculation amount is large, complex and the computing resources are consumed too much, resulting in insufficiency of detection.
Using Spark-based power grid topology loop detection method, the Graphx topology diagram is constructed, and the topology loop is detected using loop recognition algorithm, and the detection results are applied to the display platform interface.
It realizes efficient and rapid detection of power grid topology loops on the Spark platform, makes full use of the computing resources of big data clusters, is highly scalable, fault-tolerant and versatile, and detects potential hidden dangers and problems early.
Smart Images

Figure CN119209926B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of power grid topology engineering, and particularly relates to a method and system for detecting power grid topology loops based on Spark. Background Art
[0002] A power grid topology loop is a set of connected lines or nodes that form a closed loop in the power grid. In a power system, these loops may be formed by substations, transmission lines, and distribution lines. The problem of power grid topology loops is usually related to the stability, fault tolerance, and security of the power system. Topology loops may cause unstable behaviors in the power grid, such as overcurrent, short circuit, and other problems. Therefore, when the power system is operating, it is very important to detect and identify potential topology loops.
[0003] In the case of topology loop problems, the power grid power system first needs to be abstracted into a graph model. Here, the graph model is used to represent the various components (such as generators, transformers, lines, loads, etc.) in the power system and their mutual relationships. Two key concepts in the graph model are nodes and edges. Among them, nodes represent the various devices in the power system, such as generators, transformers, loads, etc. Each node usually has a unique identifier. Edges represent the electrical connections between the various devices in the power system. This can be wires, cables, transformers, etc. According to the direction of the edges, the graph model can be divided into a directed graph and an undirected graph. In an undirected graph, each edge is bidirectional and has no clear direction. This means that the edge from node A to node B is the same as the edge from node B to node A. In the case of power grid topology loop problems, usually the edges are undirected.
[0004] In addition, in the power grid graph model, some loops are reasonable. For example, although there are loops, but the devices are separated by disconnectors, load switches, circuit breakers, etc., there will be no safety problems. Therefore, power grid topology loops usually require finding loops that do not contain specific devices.
[0005] The calculation of power grid topology conversion usually requires mapping and converting power grid data into data in the form of points and edges of a graph model, using graph calculation algorithms to solve for the loop set, and then mapping the calculation results back to the power grid data and outputting. Among them, the calculation of solving the loop set has the largest amount of calculation, the most complex calculation, and requires the most computing resources, which is the bottleneck of the entire calculation process. Summary of the Invention
[0006] In order to solve the deficiencies existing in the prior art, the present invention provides a method and system for detecting power grid topology loops based on Spark, so as to solve the technical problem of finding and outputting potential topology loops in the power system on Spark.
[0007] To solve the above technical problems, the present invention adopts the following technical solutions.
[0008] The present invention first discloses a method for detecting power grid topological loops based on Spark, and the method includes the following steps:
[0009] Step 1, constructing an original graph model library based on the power grid device information and connection information in the power grid full - volume real - time library;
[0010] Step 2, obtaining power grid topological data from the original graph model library, where the power grid topological data includes power grid topological relationships and topological device information, and constructing a Graphx topological graph in the Spark framework based on the power grid topological data;
[0011] Step 3, based on the Graphx topological graph, using a loop identification algorithm to detect topological loops, and applying the detected topological loops to the display platform interface.
[0012] The present invention further includes the following preferred solutions:
[0013] The original graph model library adopts a graph database storage system. The construction of the original graph model library based on the power grid device information and connection information in the power grid full - volume real - time library further includes:
[0014] Parsing the XML file of the full - volume power grid device information and connection information to obtain the point esv file and edge csv file required by the original graph model library, defining the Schema Json file of the Vertex and Edge entities of the graph database storage system, processing the power grid device information and connection information data table, and batch - importing it into the graph database storage system according to the defined Schema.
[0015] The construction of the original graph model library based on the power grid device information and connection information in the power grid full - volume real - time library further includes:
[0016] Pre - defining the point entities and edge entities of the graph model according to different device types and connection types, where the device types and connection types are associated with topological devices and topological connection relationships;
[0017] According to the defined point entities and edge entities, exporting data from the power grid full - volume real - time library, pre - processing the exported data, and storing it in the graph database storage system.
[0018] The construction of the Graphx topological graph in the Spark framework based on the power grid topological data further includes:
[0019] Reading the data of the topological device information table and the topological device information table in the Hive table through Spark, and abstractly converting them into the relationship RDD and point RDD of Graphx;
[0020] Construct the original Graphx topology graph based on the relationship RDD and the point RDD;
[0021] Filter out the points that do not involve calculations from the point RDD, and remove the edges associated with the points that do not involve calculations from the original topology graph to obtain the final Graphx graph.
[0022] Based on the Graphx topology graph, detecting topological loops using a loop identification algorithm further includes:
[0023] Step 3.1: Construct the spark Graphx graph G;
[0024] Step 3.2: Select a starting node in G, perform a breadth-first traversal starting from the starting node, mark the depth of each leaf node from its respective root node, and the corresponding subordinate parent node;
[0025] Step 3.3: Find an edge of a potential loop based on the root node and leaf node information. This edge is called the identification edge, and its endpoints are called identification points. If (u, v) is an identification edge, then u and v do not serve as each other's subordinate parent nodes, u and v are identification points, and it is set that u and v belong to the same unique loop ID;
[0026] Step 3.4: Trace back all the identification points along the parent nodes and collect the trace-back paths. If the current node receives a set of trace-back paths with the same loop ID and equal depth from the upstream node, then complete the loop trace-back for this loop ID, and take the sum of all the collected trace-back path sets as all the component paths of the loop with this loop ID;
[0027] Step 3.5: Collect all the loops, traverse all the edges, and output the edges of all the loops to the Hive database to form a topological loop result table.
[0028] Applying the detected topological loops to the display platform interface further includes:
[0029] Construct an application platform topological loop model library, preprocess the topological loops and store them in the application platform topological loop model library. The application platform topological loop model library is associated with the display platform, and thus apply the topological loops to the display platform interface.
[0030] Applying the topological loops to the display platform interface further includes:
[0031] Use the spark framework to read the topological loop result table and the topological device information table, where the topological loop result table belongs to the edge table, and each edge is a topological connection edge;
[0032] Read the topological connection edges, obtain the topological device entity table through the associated topological device information table, and store it in the application platform topological loop model library. One topological connection edge belongs to one or more topological loops, that is, the topological connection edge will be expanded into multiple topological connection edges, and the expanded topological connection edges belong to different topological loops;
[0033] Through the expanded processing of the topological loop result table, obtain the topological loop edge entity table and store it in the application platform topological loop model library.
[0034] The present invention also discloses a spark-based power grid topological loop detection system using the aforementioned spark-based power grid topological loop detection method, including:
[0035] A graph model library construction module, used to construct an original graph model library based on the power grid device information and connection information in the power grid full-scale real-time library;
[0036] A topological graph construction module, used to obtain power grid topological data from the original graph model library, where the power grid topological data includes power grid topological relationships and topological device information, and construct a Graphx topological graph in the spark framework based on the power grid topological data;
[0037] A topological loop identification module, used to detect topological loops based on the Graphx topological graph using a loop identification algorithm, and apply the detected topological loops to the display platform interface.
[0038] Correspondingly, the present application also discloses a terminal, including a processor and a storage medium;
[0039] The storage medium is used to store instructions;
[0040] The processor is used to operate according to the instructions to execute the steps of the aforementioned spark-based power grid topological loop detection method.
[0041] Correspondingly, the present application also discloses a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the steps of the aforementioned spark-based power grid topological loop detection method.
[0042] The beneficial effects of the present invention are that, compared with the prior art, the present invention provides a spark-based power grid topological loop detection method and system, which realizes the spark-based power grid topological loop detection, fully and flexibly utilizes the computing resources of the big data cluster according to the size of the data volume, detects the power grid topological loop more efficiently and quickly, discovers potential hidden dangers and problems early, and has high scalability, fault tolerance and versatility. Description of the Drawings
[0043] Figure 1It is a flow chart of the power grid topology loop detection method based on spark in the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present invention more clear, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0045] The embodiments described in this application are only some embodiments of the present invention, not all embodiments. Based on the spirit of the present invention, other embodiments obtained by ordinary technicians in this field without creative work are all within the protection scope of the present invention.
[0046] Apache spark is an open source, distributed framework for big data processing. It provides high-level APIs and built-in libraries to support a variety of big data processing tasks, including batch processing, interactive query, stream processing, and machine learning. The core data structure of spark is the Resilient Distributed Dataset (RDD), which represents an immutable, partitionable dataset distributed on a cluster. Spark is a pure memory computing framework that stores data in memory to increase processing speed. GraphX is spark's graph processing library, which provides APIs and algorithms for graph computing. It is built on spark's RDD, allowing users to naturally integrate graph algorithms with other spark tasks. In GraphX, a graph consists of VertexRDD and EdgeRDD. VertexRDD represents the nodes and node attributes of the graph, and EdgeRDD represents the edges and edge attributes of the graph. Through the spark computing framework, the resources of the big data platform can be maximized to efficiently and reliably complete the calculation of topological loops.
[0047] However, the graph computing engine GraphX that comes with the Spark computing framework uses the Pregel computing model, which is a point-centric computing model and cannot be directly used to solve graph mining algorithms such as loop enumeration.
[0048] In view of the shortcomings of the prior art, the present invention proposes a power grid topology loop detection method and system based on Spark, which effectively utilizes the massive computing resources, fault tolerance and elastic resource utilization capabilities of a large-scale Spark cluster, and uses the Spark computing framework to perform efficient parallel computing solutions to the topology loop problem of the power grid to find out and output topological loops that may have problems.
[0049] A cycle basis of an undirected graph is a set of basic loops, where each loop cannot be formed by a linear combination of other loops. This set of basic loops can be used to describe the cyclic structure in the graph. Since the number of loops in an undirected graph may be astronomical, it is not realistic to enumerate and output all loops in many cases. For the convenience of downstream task analysis, the present invention only enumerates and outputs all the basic loops included in the undirected graph cycle basis in the graph. Based on the undirected graph cycle basis, any loop in the graph can be obtained by a linear combination of one or more basic loops.
[0050] See Figure 1 As shown, the spark-based power grid topology loop detection method disclosed by the present invention includes the following steps:
[0051] Step 1: Construct an original graph model library based on the power grid device information and connection information in the power grid full-scale real-time library.
[0052] The original graph model library of the present invention adopts a graph database storage system. Parse the full-scale power grid device information and connection information XML file to obtain the point esv file and edge csv file required for the original graph model library. According to the application requirements, define the Schema Json file of the Vertex and Edge entities of the graph database storage system, process the power grid device information and connection information data tables, and batch import them into the graph database storage system according to the defined Schema.
[0053] Before constructing the original graph model library, define the point entity and edge entity of the graph model in advance according to different device types and connection types, and this device type and connection type are associated with the topological device and topological connection relationship.
[0054] According to the defined point entity and edge entity, export data from the power grid full-scale real-time library, preprocess the exported data, and store it in the original graph model library.
[0055] Step 2: Obtain the power grid topology data from the original graph model library. The power grid topology data includes the power grid topology relationship and topological device information, and construct a Graphx topology graph in the spark framework based on the power grid topology data.
[0056] First, based on the original graph model library, obtain the csv files of the topological device entity table and the topological connection edge entity table; preprocess the data of the topological device entity table and the topological connection edge entity table, and store them in the big data relational data table library to obtain the power grid topological data. The big data relational data table library uses the Hive database, and the Hive database has good integration with spark. Spark can quickly read the Hive data and map it to the RDD memory data type of spark. Read the csv file through Hive and perform field conversion processing to meet the input data format for Spark calculation.
[0057] Constructing a Graphx topological graph in the spark framework based on the power grid topological data further includes:
[0058] Read the data of the topological device information table and the topological device information table in the Hive table through spark, and abstractly convert them into the relational RDD (Edge RDD) and vertex RDD (Vertex RDD) of Graphx; construct the original Graphx topological graph based on the relational RDD and vertex RDD.
[0059] Filter out the Vertices that are not involved in the calculation from the Vertex RDD, which involve disconnecting switches, load switches, and circuit breakers. Remove the edges associated with the Vertices that are not involved in the calculation from the original topological graph to obtain the final Graphx graph.
[0060] Step 3: Based on the Graphx topological graph, use the loop identification algorithm to detect the topological loops, and apply the detected topological loops to the display platform interface.
[0061] Apply the loop identification algorithm in the Graphx topological graph to calculate all the loops. The topological loop algorithm is implemented through Graphx. Graphx is an API component of spark, and the underlying calculation is distributed computing. The graph of Graphx is a distributed property graph, and the core implementation of topological loop detection uses the Pregel function interface of Graphx for calculation. In a preferred embodiment, the entire process of the topological loop algorithm includes:
[0062] Step 3.1: Construct a spark Graphx graph G;
[0063] Step 3.2: Select a starting node in G, start a breadth-first traversal from the starting node, mark the depth of each leaf node from its respective root node, and the corresponding subordinate parent node;
[0064] Step 3.3: Find an edge of the potential loop based on the root node and leaf node information. This edge is called the identification edge, and its endpoints are called identification points. If (u, v) is an identification edge, then u and v are not each other's subordinate parent nodes, u and v are identification points, and it is set that u and v belong to the same unique loop ID;
[0065] Step 3.4: Trace back all the identification points along the parent nodes and collect the trace-back paths. If the current node receives a set of trace-back paths with the same loop ID and equal depth from the upstream node, the loop trace-back for this loop ID is completed, and the sum of all the trace-back path sets is used as all the component paths of the loop with this loop ID;
[0066] Step 3.5: Collect all the loops, traverse all the edges, and output the edges of all the loops to the Hive database to form a topological loop result table.
[0067] Applying the topological loop to the display platform interface further includes:
[0068] Construct an application platform topological loop model library, preprocess the topological loop and store it in the application platform topological loop model library, which is associated with the display platform, thereby applying the topological loop to the display platform interface.
[0069] The application process of the topological loop includes using the spark framework to read the topological loop result table and the topological device information table. The topological loop result table belongs to the edge table, and each edge is a topological connection edge. Read the topological connection edge, obtain the topological device entity table by associating with the topological device information table, and store it in the application platform topological loop model library. A topological connection edge belongs to one or more topological loops, that is, the topological connection edge will be expanded into multiple topological connection edges, and the expanded topological connection edges belong to different topological loops. By expanding and processing the topological loop result table, obtain the topological loop edge entity table and store it in the application platform topological loop model library.
[0070] In a specific embodiment, the underlying storage of the application platform topological loop model library uses Elasticsearch, and the application display of the topological loop is realized through the Elasticsearch indexing function.
[0071] The beneficial effects of the present invention are that, compared with the prior art, the present invention provides a method and system for detecting power grid topological loops based on spark, realizes the detection of power grid topological loops based on spark, fully and flexibly utilizes the computing resources of the big data cluster according to the size of the data volume, detects power grid topological loops more efficiently and quickly, discovers potential hidden dangers and problems early, and has high scalability, fault tolerance and generality.
[0072] The present invention can be a system, a method, and / or a computer program product. The present invention also discloses a Spark-based power grid topology loop detection system based on the aforementioned Spark-based power grid topology loop detection method, including:
[0073] A graph model library construction module, configured to construct an original graph model library based on the power grid device information and connection information in the power grid full-scale real-time library;
[0074] A topology graph construction module, configured to obtain power grid topology data from the original graph model library, where the power grid topology data includes power grid topology relationships and topology device information, and construct a Graphx topology graph in the Spark framework based on the power grid topology data;
[0075] A topology loop identification module, configured to detect topology loops based on the Graphx topology graph using a loop identification algorithm, and apply the detected topology loops to the display platform interface.
[0076] Based on the spirit of the present invention, those skilled in the art can easily think that a computer program product can be obtained based on the aforementioned Spark-based power grid topology loop detection method. The computer program product may include a computer-readable storage medium having computer-readable program instructions thereon for causing a processor to implement various aspects of the present disclosure. That is, the present application also includes a terminal, including a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the aforementioned Spark-based power grid topology loop detection method.
[0077] A computer-readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium can be, for example - but not limited to - an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punched card or raised structures in a groove having instructions stored thereon, and any suitable combination of the above. The computer-readable storage medium used herein is not construed as an instantaneous signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through an optical fiber cable), or electrical signals transmitted through wires.
[0078] The computer-readable program instructions described herein can be downloaded to various computing / processing devices from a computer-readable storage medium or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.
[0079] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state-setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, by using the state information of the computer-readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field-programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present disclosure.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: it is still possible to modify the specific implementation manners of the present invention or make equivalent replacements, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A power grid topology loop detection method based on Spark, characterized in that: The following steps are involved: Step 1: construct an original graph model library based on the grid equipment information and connection information of the full real-time database of the grid; Step 2, acquiring power grid topology data from the original graph model library, wherein the power grid topology data includes power grid topology relationships and topology device information, and constructing a Graphx topology graph in a spark framework based on the power grid topology data; Step 3, based on the Graphx topology graph, using a loop recognition algorithm to detect topological loops, and applying the detected topological loops to the display platform interface; The original graph model library adopts a graph database storage system, and the original graph model library is constructed based on the grid equipment information and connection information of the full grid real-time library, further comprising: Parse the full amount of power grid equipment information and connection information XML files, obtain the point esv files and edge csv files required by the original graph model library, define the Schema Json files of the Vertex and Edge entities of the graph database storage system, process the power grid equipment information and connection information data tables, and import them into the graph database storage system in batches according to the defined Schema; The construction of the original graph model library based on the grid equipment information and connection information of the full real-time database of the grid further includes: Predefine point entities and edge entities of the graph model according to different device types and connection types, wherein the device types and connection types are associated with topological devices and topological connection relationships; According to the defined point entities and edge entities, data is exported from the full real-time database of the power grid, the exported data is preprocessed, and stored in the graph database storage system; The step of constructing a Graphx topology graph in a spark framework based on the power grid topology data further includes: Read the topology device information table data and topology device information table in the Hive table through Spark, and abstractly convert them into Graphx relational RDD and point RDD; Construct a Graphx original topology graph based on the relationship RDD and the point RDD; Filtering the points not involved in the calculation from the point RDD, removing the edges associated with the points not involved in the calculation from the original topological graph, and obtaining the final Graphx graph; The detecting of topological loops by using a loop identification algorithm based on the Graphx topological graph further comprises: Step 3.1: Build the spark Graphx graph G; Step 3.2: Select a starting node in G, start breadth-first traversal from the starting node, mark the depth of each leaf node from its respective root node, and the corresponding subordinate parent node; Step 3.3: Find an edge of the potential loop based on the root node and leaf node information. This edge is called an identification edge, and its endpoint is called an identification point. If (u, v) is an identification edge, then u and v are not each other's subordinate parent nodes, u and v are identification points, and u and v are set to belong to the same unique loop ID; Step 3.4: Trace back all the identification points along the parent node and collect the backtracking paths. If the current node receives a backtracking path set with the same loop ID and the same depth as the upstream node, the loop backtracking of the loop ID is completed, and the sum of all the backtracking path sets is used as all the constituent paths of the loop of the loop ID. Step 3.5: Collect all loops, traverse all edges and output the edges of all loops to the Hive database to form a topological loop result table.
2. The power grid topology loop detection method based on spark according to claim 1, characterized in that: The step of applying the detected topological loop to the display platform interface further includes: An application platform topology loop model library is constructed, the topology loop is preprocessed and stored in the application platform topology loop model library, and the application platform topology loop model library is associated with the display platform, thereby applying the topology loop to the display platform interface.
3. The power grid topology loop detection method based on spark according to claim 2 is characterized in that: The applying the topology loop to the display platform interface further includes: Using the spark framework to read the topology loop result table and the topology device information table, wherein the topology loop result table belongs to an edge table, and each edge is a topology connection edge; Read the topology connection edge, obtain the topology device entity table by associating the topology device information table and store it in the application platform topology loop model library. A topology connection edge belongs to one or more topology loops, that is, the topology connection edge will be expanded into multiple topology connection edges, and the expanded topology connection edges belong to different topology loops; By expanding and processing the topological loop result table, a topological loop edge entity table is obtained and stored in the topological loop model library of the application platform.
4. A power grid topology loop detection system based on Spark, characterized in that: include: A graph model library construction module is used to construct an original graph model library based on the grid equipment information and connection information of the full real-time database of the grid; A topology graph construction module is used to obtain power grid topology data from the original graph model library, wherein the power grid topology data includes power grid topology relationships and topology device information, and to construct a Graphx topology graph in a spark framework based on the power grid topology data; A topological loop identification module, used to detect topological loops based on the Graphx topological graph using a loop identification algorithm, and apply the detected topological loops to the display platform interface; The original graph model library adopts a graph database storage system, and the original graph model library is constructed based on the grid equipment information and connection information of the full grid real-time library, further comprising: Parse the full amount of power grid equipment information and connection information XML files, obtain the point esv files and edge csv files required by the original graph model library, define the Schema Json files of the Vertex and Edge entities of the graph database storage system, process the power grid equipment information and connection information data tables, and import them into the graph database storage system in batches according to the defined Schema; The construction of the original graph model library based on the grid equipment information and connection information of the full real-time database of the grid further includes: Predefine point entities and edge entities of the graph model according to different device types and connection types, wherein the device types and connection types are associated with topological devices and topological connection relationships; According to the defined point entities and edge entities, data is exported from the full real-time database of the power grid, the exported data is preprocessed, and stored in the graph database storage system; The step of constructing a Graphx topology graph in a spark framework based on the power grid topology data further includes: Read the topology device information table data and topology device information table in the Hive table through Spark, and abstractly convert them into Graphx relational RDD and point RDD; Construct a Graphx original topology graph based on the relationship RDD and the point RDD; Filtering the points not involved in the calculation from the point RDD, removing the edges associated with the points not involved in the calculation from the original topological graph, and obtaining the final Graphx graph; The detecting of topological loops by using a loop identification algorithm based on the Graphx topological graph further comprises: Build the spark Graphx graph G; Select a starting node in G, start breadth-first traversal from the starting node, mark the depth of each leaf node from its respective root node, and the corresponding subordinate parent node; Find an edge of a potential loop based on the root node and leaf node information. This edge is called an identification edge, and its endpoint is called an identification point. If (u, v) is an identification edge, then u and v are not each other's subordinate parent nodes, u and v are identification points, and u and v are set to belong to the same unique loop ID; Backtrack all identification points along the parent node and collect the backtracking paths. If the current node receives a backtracking path set with the same loop ID and the same depth as the upstream node, the loop backtracking of the loop ID is completed, and the sum of all backtracking path sets is used as all constituent paths of the loop of the loop ID. Collect all loops, traverse all edges and output the edges of all loops to the Hive database to form a topology loop result table.
5. A terminal comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the Spark-based power grid topology loop detection method according to any one of claims 1-3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the Spark-based power grid topology loop detection method described in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Method of quickly analyzing topology of large grid based on Graphx
CN106339800A
Power grid loop detection method
CN107689628A