Power equipment topological graph generation and query method based on graph neural network
The topology diagram of power equipment is generated through the graph neural network, and the graph convolutional neural network and coordinate optimization model are used to solve the problem of low efficiency in generating topology diagrams of power equipment, achieving more efficient and real-time topology diagram generation and display.
Patent Information
- Application Number
- CN202510740617.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-06-05
AI Technical Summary
The generation efficiency of existing power equipment topology maps is low and the response time is long, making it difficult to reflect the dynamic changes of the power grid in real time, and has poor interactivity.
The graph neural network is used to generate topology maps, and the device topology relationship is updated through the graph convolution neural network, combining the coordinate optimization model and the loss function of multi-objective constraints, optimize the position of the device in the topology map, and dynamically divide the device areas using the clustering method to generate a more realistic topology map.
It improves the generation efficiency and response time of topology graphs, enhances the real-time and interactiveness of queries, reduces the intersection of connection lines between devices, and the generated topology graphs are clearer and more intuitive.
Smart Images

Figure CN120256468A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly to a method for generating and querying a topology map of power equipment based on a graph neural network. Background Art
[0002] A topology map of power equipment is a graphical representation used to show the connection modes of various equipment (such as generators and transformers) in a power grid. It plays an important role in the operation and management of a power system, and can help analyze the operation status of the power system, optimize energy distribution, and quickly locate faults.
[0003] With the expansion of the scale and the increase in complexity of the power grid, traditional topology maps of power systems are usually manually drawn. This method not only takes time and effort, but also is prone to omissions and difficult to reflect the latest status of the power grid in a timely manner.
[0004] Although some dynamic topology maps can display the status of the power grid in real time, each display is regenerated, with low efficiency and poor interactivity. Summary of the Invention
[0005] In view of the above analysis, embodiments of the present invention aim to provide a method for generating and querying a topology map of power equipment based on a graph neural network to solve the problems of low generation efficiency and long response time of existing topology maps of power equipment.
[0006] Embodiments of the present invention provide a method for generating and querying a topology map of power equipment based on a graph neural network, including the following steps: Update the feature matrix and adjacency matrix of the equipment according to the received new ledger data of the power equipment, and update the equipment topology relationship by using a graph convolutional neural network; According to the received query conditions, obtain the equipment to be displayed and its topology relationship from the updated equipment topology relationship, and identify whether there is a topology record for the query conditions. If there is no topology record, or if the difference between the equipment to be displayed and its topology relationship and the topology record exceeds a threshold, generate the coordinates of the equipment to be displayed by using a coordinate optimization model, and then render and generate a topology map, and save the topology record corresponding to the query conditions; otherwise, render and generate a topology map according to the topology record; the coordinate optimization model is constructed based on a graph attention network and introduces a loss function with multi-objective constraints.
[0007] Based on a further improvement of the above method, the topology record includes: query conditions, generation time, version number, equipment list, and edge list; the equipment list includes equipment identifiers and the coordinates of the equipment; the edge list includes the equipment identifiers at both ends of each edge; when the equipment to be displayed corresponding to the query conditions or the topology relationship of the equipment to be displayed changes, a new topology record is generated for the query conditions according to the new version number.
[0008] Based on further improvements to the above method, a topology graph is rendered according to the topology record, including: If the generation time of the topology record is later than the reception time of the ledger data, directly render and generate a topology graph based on the device list and edge list in the topology record; Otherwise, when the devices to be displayed and their topological relationships all exist in the topology record, obtain the coordinates of the devices to be displayed from the topology record, and render and generate a topology graph according to the topological relationships of the devices to be displayed; when there are newly added devices or topological relationships among the devices to be displayed and their topological relationships, obtain the devices to be adjusted, solidify the coordinates of other devices according to the topology record, generate the coordinates of the devices to be adjusted using the force-directed algorithm, and then render and generate a topology graph.
[0009] Based on further improvements to the above method, the coordinates of the devices to be displayed are generated using a coordinate optimization model, including: Based on the geographical locations of the power devices, the devices to be displayed are divided into multiple categories using a clustering method, and the coordinates of the devices to be displayed in each category are initialized; Take the initialized coordinates of the devices to be displayed as node features, construct an adjacency matrix according to the topological relationships of the devices to be displayed, input the node features and the adjacency matrix into the coordinate optimization model, optimize the initialized coordinates, and output the optimized coordinates of the devices to be displayed.
[0010] Based on further improvements to the above method, initializing the coordinates of the devices to be displayed in each category includes: Obtain the angles of the regions where each category is located according to the number of devices, the number of edges, and the length of the longest path in each category; According to the angles of the regions where each category is located, divide the regions clockwise or counterclockwise with the center point of the topology graph display interface, and calculate the vertices of the boundaries of each region; Initialize the coordinates of each candidate device according to the number of devices in each category and the vertices of the boundaries of each region.
[0011] Based on further improvements to the above method, the coordinate optimization model is constructed based on a graph attention network, and an input encoding layer, multiple graph attention layers, and a coordinate decoding layer are constructed in sequence; the input encoding layer converts the initialized coordinates of the input nodes into high-dimensional embedding vectors, performs edge encoding according to the adjacency matrix of the input nodes, and passes it to multiple graph attention layers; multiple graph attention layers perform topological information propagation, and the output of each layer is used by the next layer to update the node hidden state; the coordinate decoding layer maps the node hidden state to a coordinate adjustment amount through a fully connected layer, and outputs the finally optimized coordinates through residual connection with the input initialized coordinates.
[0012] Based on further improvements to the above method, the loss function of the multi-objective constraint in the coordinate optimization model is obtained by calculating the node distance loss, node overlap loss, edge crossing loss, and region constraint loss and performing weighted summation.
[0013] Based on the further improvement of the above method, the node distance loss and the node overlap loss are calculated respectively by the following formulas: , , where, represents the node distance loss, represents the node overlap loss, E represents the set of nodes, and represent the coordinates of node i and node j at both ends of the edge, represents the preset ideal distance between nodes, , r represents the radius of the node primitive; represents the smoothing factor, which is a preset positive number; represents the Euclidean distance between node i and node j.
[0014] Based on the further improvement of the above method, the edge crossing loss is used to impose a penalty on any two crossing edges belonging to the same class, and is calculated by the following formula: , where, represents the edge crossing loss, represents the k-th class generated by clustering, and represent two edges in, t and u represent the intersection parameters of edge and edge , and are obtained by solving the parametric equations of edge and edge . When , it means that edge and edge cross, represents the sigmoid function, represents the smoothing coefficient, .
[0015] Based on the further improvement of the above method, the region constraint loss is used to impose a penalty on the nodes that exceed the region where their class is located, and is calculated by the following formula: , where, represents the region constraint loss, represents the k-th class generated by clustering, represents the sum of the probabilities that the ray emitted horizontally to the right by node i intersects all the boundaries of the region where its class is located.
[0016] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects: 1. Utilize the graph convolutional neural network to learn the characteristics of power equipment and the topological relationship between equipment, so as to more accurately predict the connection situation between newly added or changed equipment, generate a more practical topological graph, and better adapt to the dynamic changes of the power system.
[0017] 2. By first querying whether there are topological records with the same query conditions, it avoids the repeated calculation of the equipment coordinates in the topological graph, saves computing resources and time, greatly shortens the response time, and improves the real-time performance and interactivity of the query.
[0018] 3. Dynamically constrain the equipment layout area through clustering, making different types of areas relatively independent and the same type of areas more dense, effectively reducing the problem of line connection crossing between equipment, reducing the overlap rate of the network topology, and better showing the equipment distribution and relative relationship; utilize the attention mechanism and the loss function with multi-objective constraints in the coordinate optimization model to more accurately capture the correlation between nodes and automatically determine the position of equipment in the topological graph, effectively avoiding problems such as node overlap and edge crossing, making the topological graph clearer and more intuitive.
[0019] In the present invention, the above technical solutions can also be combined with each other to achieve more preferred combination schemes. Other features and advantages of the present invention will be described in the following specification, and some advantages can be made obvious from the specification or understood by implementing the present invention. The objectives and other advantages of the present invention can be realized and obtained from the content specifically pointed out in the specification and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings are only for the purpose of showing specific embodiments and are not considered as limiting the present invention. Throughout the drawings, the same reference signs denote the same components; Figure 1 is a flowchart of a method for generating and querying a topological graph of power equipment based on a graph neural network in an embodiment of the present invention; Figure 2 is a schematic diagram of dividing various types of areas according to the clustering results in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] The following will specifically describe the preferred embodiments of the present invention with reference to the drawings, where the drawings form a part of the present application and are used together with the embodiments of the present invention to explain the principles of the present invention, rather than to limit the scope of the present invention.
[0022] A specific embodiment of the present invention discloses a method for generating and querying a topological graph of power equipment based on a graph neural network, as Figure 1 shown, including the following steps: S1. Update the feature matrix and adjacency matrix of the device according to the received new ledger data of the power equipment, and use the graph convolutional neural network to update the device topology relationship.
[0023] It should be noted that the ledger data of the power system includes: device identifier, device name, device type, voltage level, function category, geographical location, operating status, change time, and the connection relationship between devices. Among them, the connection relationship between devices includes: superior device identifier, inferior device identifier, and connection method between devices. Regularly receive ledger data through the interface to obtain the latest device information.
[0024] Considering that there may be errors, omissions, or incompleteness in the connection relationship between devices in the power dispatching system ledger. For example, during data entry, due to human negligence, the connection description between a newly added device and some historical devices may be omitted; or during the actual installation and commissioning of the device, the connection is temporarily adjusted; or the newly added device changes the power transmission path, and these dynamically changing connection relationships are difficult to update in real time in the ledger. At this time, relying solely on the "connection relationship between devices" information in the ledger will result in deviations. Therefore, in this embodiment, the graph convolutional neural network is trained by learning the device topology relationship in the historical ledger data, and the trained graph convolutional neural network is used to timely deduce the dynamically changing topological connection relationship between devices in the latest ledger, ensuring that the topological graph can accurately reflect the real-time state of the power system.
[0025] It should be noted that first, obtain the historical ledger data of the power system and perform preprocessing, including: removing data with duplicate and empty device identifiers; standardizing the device name and device type; converting the geographical location to a planar position coordinate according to the earth radius.
[0026] Furthermore, based on the preprocessed historical ledger data, each device is used as a node, and the connection between devices is used as an edge to construct a node feature matrix and a node adjacency matrix as input graph data. Among them, the node feature matrix is obtained by converting the features of each node into a numerical form, where each row corresponds to the feature vector of a node; the sample adjacency matrix represents the connection relationship between devices. If there is a connection between devices, the corresponding element in the matrix is 1, otherwise it is 0.
[0027] Specifically, the feature vector of the node is obtained by splicing the embedding vector of the device name, the planar position coordinate of the device, and the one-hot encoded device type. Exemplarily, a Bert model or a Word2Vec model is used to obtain the embedding vector of the device name.
[0028] The constructed Graph Convolutional Networks (GCN) sequentially includes a graph embedding layer, multiple stacked graph convolutional layers, a graph pooling layer, and an output layer. The input graph data is input into the graph convolutional neural network. The graph embedding layer directly maps the feature vectors of the nodes and encodes the edges according to the node adjacency matrix, so that subsequent graph convolution operations can utilize the topological information of the graph. In each graph convolutional layer, the feature vectors of each node are continuously updated by aggregating the information of the neighbor nodes in the adjacency matrix, capturing more extensive graph structure features and learning high-order topological semantics. The graph pooling layer reduces the dimension of the updated feature vectors of the nodes output by the graph convolutional layer through pooling operations to generate a hierarchical representation of the graph, facilitating a better understanding of the overall structure of the graph. Finally, the output layer outputs the probability values of the existence of connection relationships between nodes to obtain the deduced topological relationship.
[0029] Before training the graph convolutional neural network, the connection relationship between node pairs is marked with binary labels (0 / 1) as the actual topological relationship. During the training process, the cross-entropy loss function is used to evaluate the difference between the deduced topological relationship and the actual topological relationship. By continuously optimizing the parameters of the graph convolutional neural network to minimize the value of the loss function, the deduced topological relationship becomes more accurate and stable. Among them, the Adam optimizer is used to optimize the network parameters and adjust the weights to minimize the value of the loss function.
[0030] After the graph convolutional neural network is trained, after preprocessing the received new ledger data, by comparing it with the historical ledger data, the ledger information of the newly added devices is obtained, and the corresponding feature vectors are extracted. The dimension of the feature vectors is the same as that of the node feature vectors during training and is added to the node feature matrix. The newly added devices are added to the node adjacency matrix, and initial connections are established according to the connection relationships between the newly added devices and other devices in their ledger information. If not, it is set to 0. It can be understood that if the ledger information of some historical devices is changed, such as modifying the device name or the connection relationship of the device, correspondingly, the node feature matrix and the node adjacency matrix are updated.
[0031] The updated node feature matrix and node adjacency matrix are input into the trained graph convolutional neural network to obtain the latest topological relationship between each device.
[0032] S2. According to the received query conditions, obtain the devices to be displayed and their topological relationships from the updated device topological relationship, and identify whether there is a topological record for the query conditions. If there is no topological record, or if the difference between the devices to be displayed and their topological relationships and the topological record exceeds the threshold, use the coordinate optimization model to generate the coordinates of the devices to be displayed, and then render and generate a topological graph, and save the topological record corresponding to the query conditions; otherwise, render and generate a topological graph according to the topological record. The coordinate optimization model is constructed based on a graph attention network and introduces a loss function with multi-objective constraints.
[0033] It should be noted that since there are various power devices in the power system, the user enters query conditions in the interface section, and obtains the devices to be displayed and their topological relationships from the received new ledger data and the device topological relationship updated in step S1, and then displays the topological graph.
[0034] To avoid repeated calculation of the device coordinates in the topological graph and save computing resources and time, in this embodiment, first query the database according to the query conditions to check whether there is a topological record corresponding to the same query conditions. If there is, further identify whether the difference between the devices and their topological relationships in the topological record and the devices and their topological relationships in the new ledger data exceeds the threshold, so as to dynamically determine whether to use the stored topological record to shorten the response time and improve the real-time performance and interactivity of the query.
[0035] It should be noted that the topological record includes: query conditions, generation time, version number, device list, and edge list; the device list includes device identifiers and the coordinates of the devices; the edge list includes the device identifiers at both ends of each edge. When the topological graph is first generated and displayed for the devices to be displayed according to a certain query condition, save the topological record corresponding to the query condition to the database according to the initial version number; when the devices to be displayed corresponding to the query conditions or the topological relationships of the devices to be displayed change, generate a new topological record for the query conditions with a new version number (incrementing the initial version number).
[0036] When displaying the topological graph, (1) if there is no topological record, or if the difference between the devices to be displayed and their topological relationships and the topological record exceeds the threshold, use the coordinate optimization model to generate the coordinates of the devices to be displayed, including: Based on the geographical locations of the power devices, use a clustering method to divide the devices to be displayed into multiple categories, and initialize the coordinates of the devices to be displayed in each category; Take the initialized coordinates of the devices to be displayed as node features, construct an adjacency matrix according to the topological relationships of the devices to be displayed, and input the node features and the adjacency matrix into the coordinate optimization model to optimize the initialized coordinates and output the optimized coordinates of the devices to be displayed.
[0037] It should be noted that considering that devices with close geographical locations in the power dispatching center have a higher probability of physical connection, in this embodiment, according to the planar position coordinates of the devices to be displayed, a clustering algorithm is used to divide them into multiple categories to obtain the devices in each category. Preferably, the HDBSCAN (Hierarchical DBSCAN) algorithm is used to automatically select the optimal neighborhood radius, which is suitable for the scenario of dynamically changing device position distributions.
[0038] Furthermore, initialize the coordinates of each candidate device according to the clustering results, including: ① Obtain the angle of the region where each category is located according to the number of devices, the number of edges, and the length of the longest path in each category of the clustering results. Among them, the length of the longest path is the number of edges passed by the longest path.
[0039] Specifically, first, after normalizing the number of devices, the number of edges, and the length of the longest path in each category, the following formula is used to obtain the spatial weight of each category by weighted summation: , where, represents the spatial weight of the k-th category, 、 and respectively represent the data after normalizing the number of devices, the number of edges, and the length of the longest path in the k-th category, 、 and respectively represent the weights of the number of devices, the number of edges, and the length of the longest path, 。
[0040] Then, according to the ratio of the spatial weight of each category to the total spatial weight, the following formula is used to obtain the angle of the region where each category is located.
[0041] , where, represents the angle of the region where the k-th category is located.
[0042] ② According to the angles of the regions where each category is located, divide the regions clockwise or counterclockwise with the center point of the topological graph display interface, and calculate the vertices of the boundaries of each region.
[0043] It should be noted that in this embodiment, considering the situation of cross-category connections, the regions are divided clockwise or counterclockwise with the center point of the topological graph display interface.
[0044] Exemplarily, as Figure 2 shown, if 3 categories are clustered and divided counterclockwise, the angle range of the region where the first category is located is , the angle range of the region where the second category is located is , and the angle range of the region where the third category is located is 。
[0045] Further, obtain the length and width of the topological graph display interface, emit rays from the center point of the topological graph display interface along the angular directions of the regions where each category is located, and divide the display interface into multiple regions; calculate the intersection points of each ray with the boundary of the topological graph display interface; obtain the vertices of each region (irregular polygon) based on the center point, the intersection points, and the vertices of the display interface.
[0046] Exemplarily, Figure 2 the vertices of the 3 regions are: OEDF, OFAG, OGBCE.
[0047] Among them, when calculating the intersection points of each ray with the boundary of the topological graph display interface, first calculate, according to the length and width of the topological graph display interface, the angles of the rays emitted from the center point passing through the vertices of the topological graph display interface, calculate the angular ranges corresponding to the four boundaries in counterclockwise order, and then obtain the boundaries where the rays emitted along the angular directions of the regions where each category is located intersect, and calculate the intersection points with the corresponding boundaries.
[0048] ③ Initialize the coordinates of each candidate device according to the number of devices in each category and the vertices of the boundaries of each region.
[0049] In this embodiment, the triangulation method is adopted to decompose each region into multiple triangles, randomly select a triangle according to the area weight of each triangle, generate points inside the selected triangle, and obtain the coordinates of each candidate device.
[0050] Exemplarily, use the functions of the Earcut library to perform triangulation on the polygon.
[0051] Further, the coordinate optimization model is constructed based on the graph attention network, and an input encoding layer, multiple graph attention layers, and a coordinate decoding layer are constructed in sequence; among them, the input encoding layer converts the initialized coordinates of the input nodes into high-dimensional embedding vectors, performs edge encoding according to the adjacency matrix of the input nodes, and passes it to multiple graph attention layers; multiple graph attention layers perform topological information propagation, and each layer outputs for the next layer to use and updates the node hidden state; the coordinate decoding layer maps the node hidden state to a coordinate adjustment amount through a fully connected layer, and outputs the finally optimized coordinates through residual connection with the initialized coordinates of the input.
[0052] In the topological graph of this embodiment, the nodes are represented by circles. In order to ensure that there is a reasonable distance between the optimized nodes, the nodes do not overlap, the connections between the nodes do not cross, and each node does not exceed the region where its category is located, the coordinate optimization model adopts an unsupervised training method, and by adding corresponding penalty terms to the loss function, the optimized coordinates meet the layout quality and geometric constraints.
[0053] Specifically, the loss function L with multi-objective constraints is obtained by calculating the node distance loss , the node overlap loss , the edge crossing loss and the region constraint loss and performing a weighted sum. The formula is as follows: , where, , , and represent the weights of the node distance loss, node overlap loss, edge crossing loss, and region constraint loss respectively. Preferably, the weights of the node distance loss and node overlap loss are larger in the initial stage of training, and as the number of training times increases, the weights of the edge crossing loss and region constraint loss gradually increase.
[0054] It should be noted that the node distance loss is used to encourage the nodes at both ends of the edge to maintain a reasonable distance and avoid the distance being too long or too short. The formula is as follows: , where, E represents the set of nodes, and represent the coordinates of nodes i and j at both ends of the edge, represents the ideal distance between nodes preset, , r represents the radius of the node primitive; represents the Euclidean distance between nodes i and j.
[0055] The node overlap loss is used to apply repulsion to the nodes to avoid node primitive overlap. The formula is as follows: , where, represents the smoothing factor, which is a preset positive number to avoid division by zero.
[0056] The edge crossing loss is used to impose a penalty on the edges with crossings. To improve the calculation efficiency, only the edges between nodes of the same class are judged, and the sigmoid function is used for approximate calculation, and the smoothing coefficient is introduced, , to calculate the probability of edge crossing. The formula is as follows: , where, represents the k-th class generated by node clustering, and represent two edges in, t and u represent the edges and the intersection parameters of the edge When it indicates that the edge and the edge intersect. represents the sigmoid function, which is used to map a value to between 0 and 1.
[0057] and are used to verify whether the intersection point is inside the edge. When the product term is large. When is not in the range of [0, 1], the product term approaches 0 and the penalty is reduced. and are used to prevent the intersection point from being too close to the end point of the edge. When is close to 0 or 1, the product term approaches 0 and the penalty is reduced. Therefore, when the intersection point of two edges is on the edge, these four products are large and a large penalty is imposed; when the intersection point of two edges is near the end point, is close to 0 or 1, these four products are small and the penalty is reduced; when two edges do not intersect, is not in the range of [0, 1], these four products are small and the penalty is reduced.
[0058] Exemplarily, the two nodes forming the edge are and Then the parametric equation of is , , ; the two nodes forming the edge are and Then the parametric equation of is , , . The intersection point generated by the intersection of the edge and the edge simultaneously satisfies the parametric equations of these two edges. Therefore, when it indicates that the edge and the edge intersect.
[0059] Region constraint loss is used to constrain the nodes within the region where the class they belong to is located. Since the regions of each class generated by clustering are obtained by dividing a rectangular display interface by different central angles, a region is at most a heptagon, and there is at most one region that is a heptagon. Therefore, when determining whether a node is within the region by judging the node with each boundary of the region where it is located, the computational complexity will not be too high.
[0060] It should be noted that the traditional ray method determines whether a point is inside a polygon by counting the number of intersections of the ray with the polygon edges. The output result is a binary result, not a continuous value. This discrete judgment cannot provide gradient information and cannot be directly used for optimization in the loss function. Therefore, in this embodiment, a differentiable Sigmoid function is used to approximate the traditional ray method judgment. By introducing a smoothing coefficient , the smoothing degree of the approximation is controlled, so that the result not only retains the logic of the traditional ray method but also has differentiability, and thus can be used in the loss function.
[0061] Specifically, for a region boundary, ① the ordinate of the node is calculated by the following formula within the range of the region boundary of the probability : , where, and represent the minimum and maximum ordinate values of a vertex of a region boundary. If is within , is close to 1, otherwise close to 0.
[0062] ② The abscissa of the intersection point of the ray emitted horizontally to the right from the node with the region boundary is calculated by the following formula : , , where, and represent the two vertex coordinates of the region boundary of the k-th class, represents the parameter of the region boundary .
[0063] Further, when is within [0, 1] and the abscissa of the intersection point is on the right side of the node, the ray intersects the region boundary. The probability of the ray intersecting the region boundary is calculated by the following formula , where, if is within [0, 1] and the intersection point is on the right side of the ray, is close to 1, otherwise close to 0.
[0064] Therefore, the probability that a node intersects a regional boundary is obtained by multiplying the above and . Furthermore, the sum of the probabilities that the rays emitted by the node intersect all the boundaries of the region where it is located is calculated through the following formula : , where represents the number of boundaries of the region where the node is located.
[0065] It should be noted that based on the principle of the ray method, if a ray is emitted horizontally to the right from a node and the number of intersection points between the ray and the polygon sides is odd, the node is inside the region; if the number of intersection points is even, the node is outside the region. In this embodiment, according to the parity rule of the ray method, the following formula is used to approximately calculate whether the node is inside the region: , if the node is not within the region range, is close to 0, and a penalty is imposed to prompt the generation of internal coordinates.
[0066] The coordinate optimization model is trained through multiple iterations. After the training is completed, a trained coordinate optimization model is obtained.
[0067] During implementation, the initial coordinates of the device to be displayed are used as the corresponding node features, and the adjacency matrix of the device to be displayed is passed into the trained coordinate optimization model together. The optimized coordinates are output, and on the topological graph display interface, a topological graph is rendered and generated according to the coordinates of the device to be displayed and the connection relationship between devices. Exemplarily, the D3.js library is used to render and generate the topological graph.
[0068] (2) If there is a topological record and the difference between the device to be displayed and its topological relationship and the topological record is less than the threshold, then a topological graph is rendered and generated according to the topological record.
[0069] It should be noted that rendering and generating a topological graph according to the topological record includes: ① If the generation time of the topological record is later than the reception time of the ledger data, then a topological graph is directly rendered and generated according to the device list and edge list in the topological record; that is to say, after the topological record is generated and the ledger data has not been updated, then the topological record can be directly used.
[0070] ② Otherwise, when both the device to be displayed and its topological relationship exist in the topological record, obtain the coordinates of the device to be displayed from the topological record, and render a topological graph based on the topological relationship of the device to be displayed; when there are new devices or topological relationships among the device to be displayed and its topological relationship, obtain the devices to be adjusted, solidify the coordinates of other devices according to the topological record, generate the coordinates of the devices to be adjusted using the force-directed algorithm, and then render a topological graph.
[0071] Specifically, there are two cases where both the device to be displayed and its topological relationship exist in the topological record: the device to be displayed and its topological relationship are exactly the same as the device list and edge connections in the topological record, or the device to be displayed or its topological relationship is a part of the device list or edge connections in the topological record; at this time, obtain the coordinates of the device to be displayed from the topological record, and establish edges according to the latest topological relationship of the device to be displayed, so as to render a topological graph.
[0072] When there are new devices among the device to be displayed and its topological relationship, the coordinates of the new devices do not exist in the device list in the topological record. If there are new topological relationships, the new edges may cross the existing edges. At this time, the devices to be adjusted obtained include the new devices and the devices corresponding to the new topological relationships. Since the new devices and their topological relationships do not exceed the threshold at this time, that is, the change amount is relatively small, the coordinates of the devices in the topological record except the devices to be adjusted are solidified, the coordinates of the devices to be adjusted are quickly generated using the force-directed algorithm, and then combined with the coordinates of the solidified devices and the topological relationship of the device to be displayed, a topological graph is rendered in the topological display interface to improve the response speed of querying the topological graph.
[0073] Exemplarily, use the force-directed algorithm in the D3.js library to fix the coordinates of the devices in the topological record except the devices to be adjusted by setting the fx and fy attributes of the nodes.
[0074] Compared with the prior art, a method for generating and querying a topology map of power equipment based on a graph neural network provided by this embodiment uses a graph convolutional neural network to learn the characteristics of power equipment and the topological relationships between equipment, so as to more accurately predict the connection conditions between newly added or changed equipment, generate a more realistic topology map, and better adapt to the dynamic changes of the power system. By first querying whether there are topology records with the same query conditions, it avoids the repeated calculation of the coordinates of equipment in the topology map, saves computing resources and time, greatly shortens the response time, and improves the real-time performance and interactivity of the query. By clustering to dynamically constrain the equipment layout area, different types of areas are relatively independent, and areas of the same type are denser, effectively reducing the problem of overlapping connection lines between equipment, reducing the overlap rate of the network topology, and better showing the equipment distribution and relative relationships; using the attention mechanism and the loss function with multi-objective constraints in the coordinate optimization model to more accurately capture the correlation between nodes and automatically determine the positions of equipment in the topology map, effectively avoiding problems such as node overlap and edge crossing, making the topology map clearer and more intuitive.
[0075] Those skilled in the art can understand that all or part of the processes for implementing the methods of the above embodiments can be completed by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory, etc.
[0076] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention.
Claims
1. A method for generating and querying a topology map of power equipment based on a graph neural network, characterized in that, It includes the following steps: Update the feature matrix and adjacency matrix of the device according to the received new ledger data of the power device, and use the graph convolutional neural network to update the device topology relationship; According to the received query conditions, obtain the devices to be displayed and their topology relationships from the updated device topology relationship, and identify whether there is a topology record for the query conditions. If there is no topology record, or the difference between the devices to be displayed and their topology relationships and the topology record exceeds the threshold, use the coordinate optimization model to generate the coordinates of the devices to be displayed, and then render and generate a topology graph, and save the topology record corresponding to the query conditions; otherwise, render and generate a topology graph according to the topology record; The coordinate optimization model is constructed based on the graph attention network and introduces a loss function with multi-objective constraints.
2. The method for generating and querying the topological diagram of power equipment based on the graph neural network according to claim 1, characterized in that The topology record includes: query conditions, generation time, version number, device list, and edge list; the device list includes device identifiers and the coordinates of the devices; the edge list includes the device identifiers at both ends of each edge; when the devices to be displayed or the topology relationships of the devices to be displayed corresponding to the query conditions change, a new topology record is generated for the query conditions with a new version number.
3. The method for generating and querying the topology diagram of power equipment based on the graph neural network according to claim 2, characterized in that, The rendering and generating a topology graph according to the topology record includes: If the generation time of the topology record is later than the receiving time of the ledger data, directly render and generate a topology graph according to the device list and edge list in the topology record; Otherwise, when both the devices to be displayed and their topology relationships exist in the topology record, obtain the coordinates of the devices to be displayed from the topology record, and render and generate a topology graph according to the topology relationships of the devices to be displayed; when there are new devices or topology relationships among the devices to be displayed and their topology relationships, obtain the devices to be adjusted, solidify the coordinates of other devices according to the topology record, use the force-directed algorithm to generate the coordinates of the devices to be adjusted, and then render and generate a topology graph.
4. The method for generating and querying the topology diagram of power equipment based on the graph neural network according to any one of claims 1-3, characterized in that, The generating the coordinates of the devices to be displayed by using the coordinate optimization model includes: Based on the geographical locations of the power devices, use the clustering method to divide the devices to be displayed into multiple categories, and initialize the coordinates of the devices to be displayed in each category; Take the initialized coordinates of the devices to be displayed as node features, construct an adjacency matrix according to the topology relationships of the devices to be displayed, and pass the node features and the adjacency matrix into the coordinate optimization model to optimize the initialized coordinates and output the optimized coordinates of the devices to be displayed.
5. The method for generating and querying the topology diagram of power equipment based on the graph neural network according to claim 4, characterized in that, The initializing the coordinates of the devices to be displayed in each category includes: Obtain the angles of the regions where each category is located according to the number of devices, the number of edges, and the longest path length in each category; According to the angles of the regions where each category is located, divide the regions clockwise or counterclockwise with the center point of the topology graph display interface, and calculate the vertices of the boundaries of each region; According to the number of devices in each category and the vertices of the boundaries of each region, initialize the coordinates of each candidate device.
6. The method for generating and querying the topological diagram of power equipment based on the graph neural network according to claim 1, wherein, The coordinate optimization model is constructed based on the graph attention network, and sequentially constructs an input encoding layer, multiple graph attention layers, and a coordinate decoding layer; the input encoding layer converts the initialized coordinates of the input nodes into high-dimensional embedding vectors, performs edge encoding according to the adjacency matrix of the input nodes, and passes it to the multiple graph attention layers; the multiple graph attention layers perform topology information propagation, and each layer outputs for the next layer to use and updates the node hidden state; The coordinate decoding layer maps the node hidden state to a coordinate adjustment amount through a fully connected layer, and outputs the finally optimized coordinates through residual connection with the input initial coordinates.
7. The method for generating and querying the topological graph of power equipment based on the graph neural network according to claim 1 or 6, characterized in that The loss function with multi-objective constraints in the coordinate optimization model is obtained by calculating the node distance loss, node overlap loss, edge crossing loss, and region constraint loss and performing weighted summation.
8. The method for generating and querying the topological graph of power equipment based on the graph neural network according to claim 7, characterized in that, The node distance loss and node overlap loss are respectively calculated through the following formulas: , , Among them, represents the node distance loss, represents the node overlap loss, E represents the node set, and represent the coordinates of node i and node j at both ends of the edge, represents the preset ideal distance between nodes, , r represents the radius of the node primitive; represents the smoothing factor, which is a preset positive number; represents the Euclidean distance between node i and node j.
9. The method for generating and querying the topology diagram of power equipment based on the graph neural network according to claim 7, characterized in that, The edge crossing loss is used to impose penalties on any two crossing edges belonging to the same class and is calculated through the following formula: , Among them, represents the edge crossing loss, represents the k-th category generated by clustering, and represents two edges in, t and u represent the edges and the edge the intersection point parameters of, obtained by solving the parametric equations of the edge and the edge when, it means the edge and the edge cross, represents the sigmoid function, represents the smoothing coefficient, .
10. The method for generating and querying the topological diagram of power equipment based on the graph neural network according to claim 7, characterized in that, The region constraint loss is used to impose penalties on nodes that exceed the region where their belonging class is located and is calculated through the following formula: , Among them, represents the regional constraint loss, represents the k-th category generated by clustering, represents the sum of probabilities that the ray emitted horizontally to the right by node i intersects all boundaries of the region where the category it belongs to is located.
Citation Information
Patent Citations
Generation method and device for power system tidal current wiring diagram, and electronic equipment
CN107679276A
Network link attribute relation prediction method and device based on graph neural network
CN113988464A
Surveying and mapping geographic information data management method and system based on cloud computing
CN119557385A
Microgrid network topology flexible configuration method based on matrix topology
CN119651751A
Utilizing a graph neural network to identify supporting text phrases and generate digital query responses
US20210058345A1
Cited By
Ground identification line automatic association adjustment method based on block division
CN120782908A
Automatic association and adjustment method for ground marking lines based on block division
CN120782908B
Intelligent generation method and system for topological relation of canal system
CN121211629A
Method and system for testing transformer substation measurement and control device based on neural network
CN121766148A
Pipeline network spatial topological relation analysis method and system based on graph neural network
CN122113322A