Power flow diagram generation method and device, computer equipment and computer readable storage medium

CN122532984APending Publication Date: 2026-08-07CHINA SOUTHERN POWER GRID DIGITAL GRID GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA SOUTHERN POWER GRID DIGITAL GRID GRP CO LTD
Filing Date
2026-07-13
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]上述电力潮流图生成方式存在生成效率低下、对于电气特性的表征效果不佳的问题

Benefits of technology

[0019]上述电力潮流图生成方法、装置、计算机设备、计算机可读存储介质和计算机程序产品,通过构建电网属性图,并将该属性图依次输入图卷积网络模型和图注意力网络模型,自动完成节点布局坐标的预测与优化,最终通过可视化渲染输出完整的电力潮流图。整个过程无需人工干预,从原始数据输入到最终图形输出实现了端到端的自动化处理。采用双模型协同工作的架构,在通过第一模型确保相连节点在初步布局中彼此靠近,从而维持了电力潮流图的基本连通性,避免了新增节点“飞出”图形有效区域的全局性错误的基础上,通过第二模型的注意力机制根据电网属性图中的信息初始布局坐标进行调整,能够使电气联系紧密的节点在最终布局中彼此靠近,使电气联系疏松的节点适度远离,由此保证了电网拓扑结构的全局连通性和电气特性的局部一致性,解决了单一模型无法区分不同邻居节点重要性、导致布局与电气特性脱节的问题,能够推动电力系统可视化工具从“人工绘制”向“智能生成”的跨越,有助于提升电网运行的智能化水平和运维效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122532984A_ABST
    Figure CN122532984A_ABST
Patent Text Reader

Abstract

The application relates to a power flow diagram generation method and device, computer equipment and a computer readable storage medium. The method comprises the following steps: constructing a power grid attribute graph of a power system according to power grid topology data and system operation data; inputting the power grid attribute graph into a first model to obtain global topology characteristics of the power grid attribute graph and initial layout coordinates of each node in a to-be-generated power flow diagram; inputting the initial layout coordinates of each node and the power grid attribute graph into a second model to adjust the initial layout coordinates based on an attention mechanism of the second model, obtain target layout coordinates of each node in the to-be-generated power flow diagram, and visually render the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute graph to obtain a power flow diagram corresponding to the power system. The method can improve the generation efficiency and effect of the power flow diagram.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power technology, and in particular to a method, apparatus, computer equipment, and computer-readable storage medium for generating power flow diagrams. Background Technology

[0002] With the rapid development of power systems towards digitalization and intelligence, the continuous expansion of power grid scale, the large-scale integration of new energy power generation (such as wind power and photovoltaics), and frequent changes in power grid topology, higher demands are placed on power system operation monitoring, dispatching decisions, and operation and maintenance management. Power flow diagrams, as a single-line electrical schematic diagram used to display the connection relationships, power flow direction, and operating status between nodes in the power grid (such as power plants, substations, and loads), are an indispensable core visualization tool in power dispatch centers, substations, and distribution automation systems. Their intuitiveness and information density directly affect the efficiency of operation and maintenance personnel's perception of the power grid's operational status and the accuracy of fault diagnosis.

[0003] Currently, power flow diagram generation mainly relies on manual drawing or semi-automated assisted drawing methods. In manual drawing, maintenance personnel, based on the grid's geographical topology information or equipment ledgers, and combined with their own experience, manually assign coordinate positions to each equipment node in the drawing software and draw the connecting lines one by one. In semi-automated assisted drawing, the system can automatically generate an initial layout based on preset coordinate rules (such as latitude and longitude mapping based on geographical location), but maintenance personnel still need to make a lot of manual adjustments afterward to eliminate node overlaps, optimize line routes, and ensure the readability of the diagram.

[0004] The aforementioned methods for generating power flow diagrams suffer from low generation efficiency and poor representation of electrical characteristics. Therefore, how to efficiently generate power flow diagrams that are rationally laid out, can balance global topological connectivity and local electrical characteristics, and can intuitively reflect the electrical operating status is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for generating power flow diagrams that can improve the efficiency and rationality of power flow diagram generation, in order to address the aforementioned technical problems.

[0006] In a first aspect, this application provides a method for generating power flow diagrams, the method comprising:

[0007] The power grid topology data and system operation data of the power system are acquired, and a power grid attribute graph of the power system is constructed based on the power grid topology data and system operation data. The power grid attribute graph includes multiple nodes representing power equipment, edges representing power lines, the electrical characteristics of the power equipment, and the electrical characteristics of the power lines.

[0008] The power grid attribute graph is input into the first model to obtain the global topological features of the power grid attribute graph and the initial layout coordinates of each node in the power flow graph to be generated;

[0009] The initial layout coordinates of each node and the power grid attribute graph are input into the second model, so that the initial layout coordinates are adjusted by the second model based on the attention mechanism to obtain the target layout coordinates of each node in the power flow graph to be generated.

[0010] Based on the electrical characteristics of the equipment and the electrical characteristics of the line, the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute diagram are visualized and rendered to obtain the power flow diagram corresponding to the power system.

[0011] Secondly, this application also provides an apparatus for generating power flow diagrams, the apparatus comprising:

[0012] The acquisition module is used to acquire the power grid topology data and system operation data of the power system, and construct the power grid attribute map of the power system based on the power grid topology data and system operation data; the power grid attribute map includes multiple nodes representing power equipment, edges representing power lines, the electrical characteristics of the power equipment, and the electrical characteristics of the power lines;

[0013] The first input module is used to input the power grid attribute map into the first model to obtain the global topological features of the power grid attribute map and the initial layout coordinates of each node in the power flow diagram to be generated.

[0014] The second input module is used to input the initial layout coordinates of each node and the power grid attribute diagram into the second model, so that the second model can adjust the initial layout coordinates based on the attention mechanism to obtain the target layout coordinates of each node in the power flow diagram to be generated.

[0015] The rendering module is used to visualize and render the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute diagram based on the electrical characteristics of the equipment and the electrical characteristics of the line, so as to obtain the power flow diagram corresponding to the power system.

[0016] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps included in any of the foregoing method embodiments.

[0017] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps included in any of the foregoing method embodiments.

[0018] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps included in any of the foregoing method embodiments.

[0019] The aforementioned power flow diagram generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product automatically predict and optimize node layout coordinates by constructing a power grid attribute graph and sequentially inputting it into a graph convolutional network model and a graph attention network model. Finally, a complete power flow diagram is output through visualization rendering. The entire process requires no manual intervention, achieving end-to-end automation from raw data input to final graphical output. Employing a dual-model collaborative architecture, the first model ensures that connected nodes are close to each other in the initial layout, maintaining the basic connectivity of the power flow diagram and avoiding global errors such as newly added nodes "flying out" of the effective graphical area. The second model's attention mechanism adjusts the initial layout coordinates based on information from the power grid attribute graph. This ensures that electrically connected nodes are close to each other in the final layout, while loosely connected nodes are appropriately spaced. This guarantees the global connectivity of the power grid topology and the local consistency of electrical characteristics, solving the problem that a single model cannot distinguish the importance of different neighboring nodes, leading to a disconnect between layout and electrical characteristics. This enables power system visualization tools to move from "manual drawing" to "intelligent generation," contributing to improved power grid operation intelligence and maintenance efficiency. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is an application environment diagram of the power flow diagram generation method in one embodiment;

[0022] Figure 2This is a flowchart illustrating a power flow diagram generation method in one embodiment;

[0023] Figure 3 This is a structural block diagram of a power flow diagram generation device in one embodiment;

[0024] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0026] Before describing the embodiments of this application, the related technologies and their problems will be explained:

[0027] In related technologies, the generation of power flow diagrams mainly relies on manual drawing or semi-automated assisted drawing methods, which have at least the following problems:

[0028] First, the generation efficiency is low: For large-scale power grids containing hundreds or thousands of nodes, the process of manually drawing or adjusting node coordinates is extremely time-consuming, usually requiring several hours or even days to complete a complete power flow diagram. When the power grid topology changes (such as adding a substation or building a new transmission line), maintenance personnel need to manually readjust the layout of the relevant areas, which cannot achieve automated response and makes it difficult to meet the needs of real-time dynamic updates of the power system.

[0029] Second, the accuracy of predicting the layout coordinates of newly added nodes is low, and it is difficult to balance topological connectivity and electrical characteristics: In some related semi-automated methods, the coordinates of newly added nodes are usually predicted based on their geographical distance from existing nodes or simple topological rules (such as placing them near the midpoint of the line connecting adjacent nodes). This single-rule prediction method cannot simultaneously guarantee the connectivity of the global topology (i.e., the rationality of the overall power grid structure) and the consistency of local electrical characteristics (i.e., nodes with close electrical connections should be visually close to each other). For example, a heavy-load line carrying high-power transmission has nodes at both ends that are electrically closely connected, but in a traditional layout, they may be placed far apart due to consideration of geographical distance or topological connection. This makes it impossible for maintenance personnel to visually identify key transmission channels, affecting the ability of the power flow diagram to express the power grid's operating status.

[0030] Third, the visualization effect is poor, failing to intuitively reflect the electrical operating status: most power flow diagrams generated by related technologies only display the static topology of nodes and connections, failing to dynamically map the electrical parameters of nodes (such as voltage level and load power) and the operating status of lines (such as active power flow magnitude, load rate, and power flow direction) into graphical visual attributes (such as node size, connection thickness, connection color, and directional arrows). When viewing power flow diagrams, maintenance personnel still need to refer to data reports to determine the load status of equipment. The information carrying capacity of the graphics themselves is limited, which is not conducive to quickly identifying abnormalities in the operation of the power grid.

[0031] Therefore, how to efficiently generate power flow diagrams that are reasonably laid out, can take into account both global topological connectivity and local electrical characteristics, and can intuitively reflect the electrical operating status is a technical problem that urgently needs to be solved by those skilled in the art.

[0032] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0033] The power flow diagram generation method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0034] In one exemplary embodiment, such as Figure 2 As shown, a method for generating power flow diagrams is provided, which can be applied to... Figure 1Taking terminal 102 or server 104 as an example, the following steps are included:

[0035] Step 202: Obtain the power grid topology data and system operation data of the power system, and construct the power grid attribute map of the power system based on the power grid topology data and system operation data; the power grid attribute map includes multiple nodes representing power equipment, edges representing power lines, the electrical characteristics of the power equipment, and the electrical characteristics of the power lines.

[0036] Among them, power grid topology data refers to data describing the connection relationships between various power devices in the power system. System operation data refers to data describing the real-time or steady-state operation status of the power system, which may include: real-time telemetry values ​​collected by the SCADA (Supervisory Control And Data Acquisition) system, power flow calculation section data obtained by mode calculation, and archived data in the historical operation database.

[0037] A power grid attribute graph refers to a power grid model expressed in graph data structure, which can be denoted as G=(V, E, A_v, A_e). Here, V represents the set of nodes, with each node V_i corresponding to a power device or connection point in the power system. E represents the set of edges, with each edge E_ij representing a power line or transmission branch connecting node V_i and node V_j. Power devices can include: power plants, substations, converter stations, energy storage stations, busbars, load nodes, distributed generation access points, etc. Power lines can include: overhead transmission lines, cable lines, transformer windings, series compensation devices, tie lines, etc.

[0038] Equipment electrical characteristics (denoted as A_v) refer to the attribute data attached to each node in the power grid attribute diagram, used to describe the electrical characteristics and operating status of the power equipment corresponding to that node. Specifically, equipment electrical characteristics may include one or more of the following: equipment name (e.g., "Gaoxin Substation"), equipment type (e.g., "Substation", "Bus", "Load"), voltage level (e.g., 500kV, 220kV, 110kV, 35kV, 10kV), power supply zone identifier (e.g., "Gaoxin Power Supply Zone", "Science and Technology Park Power Supply Zone"), active power (unit: megawatt, MW), reactive power (unit: megavar, MVar), load power (for load nodes), and generating power (for generating nodes), etc. For example, a node representing a 220kV substation may have the following equipment electrical characteristics: equipment name = "Innovation Substation", equipment type = "Substation", voltage level = "220kV", power supply zone identifier = "Innovation Zone", active power = 350MW, reactive power = 120MVar.

[0039] Line electrical characteristics (denoted as A_e) refer to the attribute data attached to each edge in the power grid attribute diagram, used to describe the electrical parameters and operating status of the power line corresponding to that edge. Specifically, line electrical characteristics may include, but are not limited to, one or more of the following: line name (e.g., "Innovation-Science Park Double Circuit"), line impedance (unit: ohms, Ω, including resistance R and reactance X), line length (unit: kilometers, km), active power flow (unit: megawatts, MW, representing the active power transmitted on the current line), reactive power flow (unit: megavars, MVar), load factor (percentage, representing the ratio of the current active power flow to the line's rated transmission capacity), and operating status (e.g., "Operating", "Under Maintenance", "Hot Standby"). For example, a transmission line connecting "Innovation Station" and "Science Park Station" may have the following line electrical characteristics: line name = "Innovation-Science Park Line", line impedance = 0.05 + j0.8Ω, line length = 15km, active power flow = 280MW, load factor = 70%, and operating status = "Operating".

[0040] In this embodiment, the construction process of the power grid attribute map may include the following steps: First, the acquired power grid topology data and system operation data are parsed and cleaned. The parsing process uses corresponding parsers according to different data formats: for CIM / G files, an XML parser is used to extract power equipment objects and connection relationships; for PSS / E or BPA power flow files, a row format parser is used to read fixed-format card data; for CSV files, a comma-separated value parser is used to read table data. The cleaning process includes: removing redundant data with duplicate records, filling missing values ​​using mean or interpolation methods, identifying and filtering abnormal cross-section data that exceeds limits, and detecting and marking isolated nodes in topological islands.

[0041] Secondly, based on the parsed and cleaned data, node objects and edge objects are created. For each power device or connection point, a node object V_i is created, and the device's electrical characteristics are attached as attributes to the node object. For example, for "Innovation Substation," a node object is created with the device name "Innovation Substation" and a voltage level of 220kV. For each power line, an edge object E_ij is created, connecting the corresponding two node objects, and the line's electrical characteristics are attached as attributes to the edge object. For example, for "Innovation Science and Technology Line," an edge object is created, connecting the "Innovation Substation" node and the "Science and Technology Park Station" node, with a load rate of 70%.

[0042] Finally, all node and edge objects are organized into a power grid attribute graph G and stored in the server's memory or graph database. The resulting power grid attribute graph can serve as the input data carrier for subsequent processing steps, such as topology feature extraction, coordinate prediction, and layout optimization, all of which are performed on this attribute graph structure. By constructing the power grid attribute graph, the original, scattered, and heterogeneous power system data are unified into a structured graph model, laying the data foundation for subsequent graph neural network processing.

[0043] Step 204: Input the power grid attribute graph into the first model to obtain the global topology features of the power grid attribute graph and the initial layout coordinates of each node in the power flow graph to be generated.

[0044] The first model is used to extract the global topological features of the power grid attribute graph and generate a preliminary layout coordinate for each node. In this embodiment, the first model adopts a graph convolutional network model. A graph convolutional network model is a neural network model capable of performing convolution operations on graph-structured data. Its core idea is to update the representation of the current node by aggregating the feature information of neighboring nodes.

[0045] The input to the first model may include an adjacency matrix A and a node feature matrix X of the power grid attribute graph. The adjacency matrix A is an N×N matrix, where A_ij=1 indicates that there is an edge connection (i.e., a power line) between node i and node j, and A_ij=0 indicates that there is no direct connection. The node feature matrix X is an N×d matrix, where d is the initial feature dimension of each node. In this embodiment, the initial features of each node may include: voltage level, node type, equipment capacity, etc. If some nodes do not have initial features, preset default values ​​or random initialization can be used.

[0046] The process of the first model extracting global topological features is as follows: In the first layer of graph convolution, each node aggregates the features of its direct neighbors to generate a new node representation. At this point, each node's representation already contains information about its first-order neighbors. In the second layer of graph convolution, each node again aggregates the representations of its neighbors. Since the neighbors already contain information about their own neighbors, after the second layer of convolution, each node's representation indirectly contains information about its second-order neighbors. By stacking multiple layers of graph convolution, each node's representation can perceive the global topological structure of the entire power grid attribute graph.

[0047] The process of the first model outputting the initial layout coordinates is as follows: After the last graph convolution layer, a linear transformation layer maps the high-dimensional features of the nodes to a two-dimensional space, obtaining the initial x-coordinate and initial y-coordinate of each node in the power flow graph to be generated. The initial layout coordinates reflect the overall skeleton structure of the power grid topology, ensuring that connected nodes are close to each other in the initial layout, thus maintaining the basic connectivity of the power flow graph. For example, for a power grid attribute graph containing three voltage levels (500kV, 220kV, and 110kV), a total of 50 nodes, and 80 edges, after inputting it into the graph convolutional network model, the model outputs the initial layout coordinates of the 50 nodes. In these initial coordinates, the 500kV nodes are roughly distributed in the upper region of the image, the 220kV nodes are distributed in the middle region, and the 110kV nodes are distributed in the lower region; and the layout coordinates of nodes connected by lines are close to each other in the power flow graph to be generated. However, the relative distance between nodes at this point does not fully reflect the differences in electrical distance (for example, the nodes at both ends of a heavy-load line may not be "brought closer"). This initial coordinate will be further optimized in subsequent steps.

[0048] Step 206: Input the initial layout coordinates of each node and the power grid attribute map into the second model, so that the initial layout coordinates can be adjusted by the second model based on the attention mechanism to obtain the target layout coordinates of each node in the power flow diagram to be generated.

[0049] The second model is used to refine the initial layout coordinates output by the first model, so that the adjusted coordinates better reflect the electrical characteristics of the power grid. In this embodiment, the second model can adopt a graph attention network model. The graph attention network model is a graph neural network that introduces an attention mechanism. Its core idea is to allow each node to assign different attention weights to its different neighboring nodes, thereby focusing on neighboring nodes with closer electrical connections when aggregating information.

[0050] For each target node i in the power grid property graph, the second model first calculates the attention coefficient e_ij between it and each neighboring node j. The formula for calculating the attention coefficient e_ij can be expressed as: e_ij = LeakyReLU(α^T·[W·h_i || W·h_j || W_e·e_ij]). Here, h_i is the feature vector of node i (including its initial layout coordinates and equipment electrical characteristics); e_ij is the feature vector of the edge connecting node i and node j (including line electrical characteristics); W and W_e are learnable weight matrices; α^T is the learnable attention weight vector; || denotes vector concatenation; and LeakyReLU is a nonlinear activation function. By introducing the feature vector e_ij of the edge, the model can perceive electrical parameters such as line impedance and power flow, thus assigning higher weights to heavily loaded lines or short-impedance lines when calculating the attention weights.

[0051] After obtaining the attention coefficients e_ij, the second model uses the softmax function to normalize the attention coefficients of all neighboring nodes, obtaining the attention weights a_ij: a_ij = softmax(e_ij) = exp(e_ij) / Σ_{k∈N_i} exp(e_ik). Here, N_i represents the set of neighboring nodes of node i. The normalized attention weights a_ij satisfy Σ_{j∈N_i} a_ij = 1. Finally, the second model performs weighted aggregation on the features of neighboring nodes based on the normalized attention weights, generating the updated representation of node i and extracting the adjusted coordinates. The aggregation formula can be expressed as: h'i = σ( Σ{j∈N_i} a_ij · W·h_j ). Here, σ is the activation function (such as ELU), and h'_i is the updated node feature, containing the optimized layout coordinate information.

[0052] Through the above calculations, the second model can differentiate the visual distance between nodes based on the differences in electrical characteristics: for node pairs with close electrical connections (such as heavy-load lines and short electrical distances), the model will assign higher attention weights, making them closer to each other in the updated coordinates; for node pairs with loose electrical connections, the model will assign lower weights, and their relative distance in the coordinates will remain unchanged or be further increased.

[0053] Specifically, after inputting the initial layout coordinates and the power grid attribute map into the second model, the second model performs the following processing: First, the second model reads the initial layout coordinates of each node and uses them as part of the node features; second, the second model reads the equipment electrical features and line electrical features in the power grid attribute map to calculate the attention weights; then, the second model calculates the attention weights with neighboring nodes for each node, and the level of the attention weights depends on the line electrical parameters (such as impedance and power flow); finally, the model outputs the optimized target layout coordinates for each node.

[0054] For example, suppose in the initial layout coordinates, "Innovation Station" is located between "High-tech Station" and "Science Park Station". However, since the active power flow of the "Innovation Station - Science Park Station" line is 350MW (heavy load), while the active power flow of the "Innovation Station - High-tech Station" line is only 80MW (light load), the second model will assign a higher attention weight (e.g., 0.7) to "Science Park Station" and a lower attention weight (e.g., 0.3) to "High-tech Station" when calculating the attention weight. According to the weighted aggregation result, the target layout coordinates of "Innovation Station" are significantly pulled closer to "Science Park Station", making these two electrically connected nodes visually adjacent in the final power flow diagram, and more intuitively reflecting the difference in electrical distance between the corresponding devices.

[0055] Step 208: Based on the electrical characteristics of the equipment and the electrical characteristics of the line, visualize and render the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute diagram to obtain the power flow diagram corresponding to the power system.

[0056] Among them, visualization rendering refers to transforming the target layout coordinates and node-edge connection relationships into a visual graphic output. In this process, the visual style of the graphic is enhanced by utilizing the electrical characteristics of the equipment and the electrical characteristics of the lines, so that the generated power flow diagram can intuitively and in real time reflect the operating status of the power grid while displaying the topology of the power grid.

[0057] The specific process of visualization rendering may include the following sub-steps: First, draw the corresponding node icon on the canvas according to the target layout coordinates of each node. The icon style of the node can be determined according to the equipment type; for example, a rectangle is used to represent a substation, a horizontal or vertical line segment is used to represent a busbar, and an arrow or circle is used to represent a load. The size of the node icon can be dynamically scaled according to the load power or generating power in the equipment's electrical characteristics: the higher the power, the larger the icon. The node icon color can be distinguished according to the voltage level; for example, purple for 500kV, red for 220kV, blue for 110kV, green for 35kV, and orange for 10kV. The node label text includes the equipment name, voltage level, active / reactive power, etc., and the label position automatically avoids the node icon and connecting lines.

[0058] Next, based on the connection relationships between nodes, lines are drawn between the corresponding nodes. Specifically, the path planning of the lines can adopt an orthogonal routing algorithm: for each edge, a polyline path composed of horizontal and vertical line segments is planned, with each polyline inflection point at a 90-degree angle, which conforms to the drawing specifications of power flow diagrams in the power industry. Optionally, obstacle avoidance processing is performed when planning the path, so that the lines automatically bypass node icons and other existing lines to avoid visual overlap. For lines that cross voltage levels (such as lines connecting 500kV nodes and 220kV nodes), polyline smoothing is performed or differentiated line types such as dashed lines or different colors are used for labeling to distinguish lines within the same voltage level. For areas with dense line intersections, intersection reduction optimization is performed, reducing the line intersection rate by adjusting the local line direction or fine-tuning the coordinates of adjustment points.

[0059] Optionally, in addition to basic node and edge rendering, visual enhancements can be applied to the connections based on the electrical characteristics of the lines. For example, the pixel width of the connection can be dynamically mapped according to the active power flow value of the edge; the greater the active power flow, the thicker the connection, allowing users to intuitively identify heavily loaded lines in the power grid. The color of the connection can be dynamically mapped according to the load percentage of the edge; for example, green for load below 50%, yellow for 50%-75%, orange for 75%-90%, and red for above 90%, providing a clear overview of the load status. The actual direction of the power flow can be determined based on the positive or negative sign of the active power flow of the edge, and a directional arrow pointing from the sending node to the receiving node can be drawn during connection rendering, for example, an arrow icon can be drawn in the middle of the connection or near the receiving node. For edges with a load rate exceeding a preset alarm threshold (e.g., 80%), a highlighting or pulse flashing effect can be applied during rendering to attract the attention of maintenance personnel.

[0060] After basic rendering is completed, a visualized power flow diagram is generated. This diagram supports interactive functions such as zooming, panning, node filtering, and hovering to display detailed information. The final diagram can be exported as SVG (Scalable Vector Graphics, supporting subsequent editing), PNG (High-resolution Bitmap, suitable for report insertion), PDF (suitable for printing and archiving), or CIM / G (standard format for dispatch automation systems).

[0061] For example, after the above rendering process, the generated power flow diagram shows that in the 220kV voltage level, the "Innovation Station" node icon is located near the "Science Park Station" icon, and the line connecting the two is a thicker orange line (indicating a higher load rate) with an arrow pointing towards the "Science Park Station" (indicating the direction of active power flow); while the line connecting the "Innovation Station" and the "High-tech Station" is a thinner green line (indicating a lower load rate). This allows maintenance personnel to immediately identify the "Innovation-Science Park" line as a heavily loaded line, requiring monitoring of its operational status.

[0062] In some embodiments, the first model includes a graph convolutional network model; the second model includes a graph attention network model; the loss function of the graph convolutional network model and the graph attention network model includes a topology constraint loss term and / or an overlap constraint loss term; wherein, the topology constraint loss term is used to make the coordinate distance between the target layout coordinates of nodes that are directly connected by edges in the power grid attribute graph positively correlated with the electrical distance between the nodes that are directly connected by edges;

[0063] The overlap constraint loss term is used to penalize cases where the coordinate distance between the target layout coordinates of any two nodes is less than the minimum spacing threshold.

[0064] The step of inputting the initial layout coordinates of each node and the power grid attribute graph into the second model, and adjusting the initial layout coordinates through the second model based on an attention mechanism to obtain the target layout coordinates of each node in the power flow graph to be generated, includes:

[0065] The graph attention network model calculates the attention weights between neighboring nodes based on the power grid attribute graph using the attention mechanism.

[0066] The graph attention network model adjusts the initial layout coordinates according to the attention weights to obtain the target layout coordinates of each node.

[0067] The graph convolutional network model is used to extract global topological features from graph data. Through multi-layer convolutional operations, the feature representation of each node can perceive the connection skeleton of the entire power grid, thereby generating an initial layout that ensures reasonable overall connectivity. Correspondingly, the graph attention network model is used to assign differentiated attention weights to different neighboring nodes during information aggregation. This allows for fine-tuning of the visual distance between nodes based on electrical characteristics (such as line power flow and impedance), ensuring that electrically connected nodes are close to each other in the final layout.

[0068] To guide the two models in learning coordinates that conform to power system layout specifications, in this embodiment, the loss functions of the graph convolutional network model and the graph attention network model include topological constraint loss terms and / or overlap constraint loss terms. These two loss terms can be used individually or in a weighted combination to form the total loss function L_total = L_topology + λ·L_overlap, where λ is a preset weighting coefficient (e.g., λ=0.5) used to balance the importance of topological and overlap constraints. By minimizing the total loss function, the model is guided during the learning process to output layout coordinates that satisfy topological connectivity requirements while avoiding node overlap.

[0069] In power systems, two nodes (i.e., devices) directly connected by transmission lines are electrically associated, and the strength of this association can be quantified by electrical distance. A smaller electrical distance indicates a stronger electrical association between the two nodes (e.g., lower line impedance and higher transmission power). In a visual layout, these two nodes should be closer together so that maintenance personnel can intuitively identify strongly associated device pairs in the power grid. Conversely, a larger electrical distance necessitates a larger visual distance between nodes. Therefore, this embodiment introduces a topology constraint loss term, making the coordinate distance between the target layout coordinates of nodes directly connected by edges in the power grid attribute graph positively correlated with the electrical distance between the directly connected nodes.

[0070] Specifically, the calculation method for electrical distance can be flexibly selected according to the actual application scenario. In this embodiment, the electrical distance can be calculated and determined based on one or more of the following parameters: line impedance (unit: ohms, Ω), line length (unit: kilometers, km), branch power flow active power (unit: megawatts, MW), and branch load factor (percentage). For example, for a line, its electrical distance can be defined as the magnitude of the line impedance (√(R²+X²)); or as the normalized value of the line length; or as a value inversely proportional to the active power flow (the larger the power flow, the smaller the electrical distance). In a preferred implementation, the electrical distance D_ij = R_ij² + X_ij², that is, the square of the impedance magnitude. Lines with smaller impedances have shorter electrical distances and should be placed closer together in the layout.

[0071] The formula for calculating the topological constraint loss term L_topology can be expressed as: L_topology = Σ_{(i,j)∈E} | ||p_i - p_j|| - D_ij |;where (i,j) represents a pair of nodes directly connected by an edge in the power grid attribute graph; p_i and p_j are the target layout coordinates of node i and node j, respectively; ||p_i - p_j|| Represents the Euclidean distance (i.e., visual distance) between two node coordinates; D_ij is the electrical distance between node i and node j (after normalization, its value range is roughly the same as the Euclidean distance). This loss term penalizes the deviation between the visual distance and the electrical distance. When the visual distance and the electrical distance are inconsistent, the loss value increases, and the model adjusts the coordinate output through backpropagation to make them tend to be consistent.

[0072] By introducing the above topological constraint loss term, the model training process is guided as follows: for node pairs with small electrical distances (such as heavy-load lines, short-impedance lines), the model will make the Euclidean distance between their target layout coordinates also smaller, so that these two nodes are adjacent to each other in the finally generated power flow diagram; for node pairs with large electrical distances, their visual distances also increase accordingly. This mechanism makes the finally generated power flow diagram not only show the connection relationship between nodes, but also intuitively reflect the tightness of the electrical connection between devices through the proximity of visual distances, greatly improving the information density and readability of the power flow diagram.

[0073] Correspondingly, considering that in the power flow diagram, each node represents a power device, and the node icons need to maintain a certain distance so that the operation and maintenance personnel can clearly identify the annotation information and status of each device. If the coordinate distance between two nodes is too small, it will cause the node icons to overlap and the annotation texts to be mixed, seriously affecting the readability and usability of the graph. Therefore, an overlap constraint needs to be introduced to force a minimum safe distance between any two nodes.

[0074] Specifically, the specific calculation formula of the overlap constraint loss term L_overlap can be expressed as: L_overlap = Σ_{i<j} max(0, d_min - ||p_i - p_j|| ); where, i and j iterate over all node pairs (i < j) in the power grid attribute graph; p_i and p_j are the target layout coordinates of node i and node j respectively; ||p_i - p_j|| is the Euclidean distance between the two node coordinates; d_min is the preset minimum spacing threshold (the unit is the same as the coordinate unit, for example, in the normalized coordinate space, d_min = 0.05, corresponding to 10 pixels in the actual image).

[0075] The overlap constraint loss term is designed so that a positive loss value is generated only when the Euclidean distance between two nodes is less than the minimum spacing threshold. The loss value is equal to the difference between the threshold and the current distance. When the node spacing is greater than or equal to the threshold, the loss value is 0, and no penalty is applied. Through this design, the model actively "pushes away" nodes that are too close during training, maintaining a spacing of at least d_min. By introducing the overlap constraint loss term, the model automatically avoids node overlap when generating layout coordinates. During training, whenever the coordinate distance between two nodes is too close, the loss function generates a positive gradient, driving the model to adjust the node coordinates to increase the spacing. After training, the target layout coordinates output by the model naturally meet the anti-overlap requirements, requiring no further post-processing adjustments. This results in a neat and clear power flow diagram layout, conforming to the reading habits of power dispatchers.

[0076] Based on the above model configuration, in specific model applications, the graph attention network model receives a power grid attribute graph as input, including: the initial layout coordinates of nodes (from the output of the first model), the electrical characteristics of the node equipment (such as voltage level and equipment type), and the electrical characteristics of the edges (such as line impedance and active power flow). For each target node i in the power grid attribute graph, the model traverses all its neighboring nodes j (i.e., nodes directly connected to node i by edges) and calculates the attention coefficient e_ij. The calculation of the attention coefficient e_ij fully integrates node features and edge features, and the calculation formula is as follows:

[0077] e_ij = LeakyReLU( α^T·[ W·h_i || W·h_j || W_e·e_ij ] ); where h_i is the feature vector of node i, which is formed by concatenating the initial layout coordinates and the electrical features of the equipment; h_j is the feature vector of the neighboring node j; e_ij is the line electrical feature vector of the edge connecting node i and node j; W and W_e are learnable weight matrices used to map the original features to a high-dimensional space; α^T is a learnable attention weight vector; || represents the vector concatenation operation; LeakyReLU is a non-linear activation function.

[0078] By introducing the term W_e·e_ij, the model can perceive the attribute information of the edges. For example, for a heavily loaded line (90% load rate), the load rate dimension in its edge feature vector has a high value, which will produce a larger feature value after transformation, thus making the calculated attention coefficient e_ij larger. This means that the neighbor node j will be given higher attention in subsequent coordinate adjustments. After obtaining the attention coefficients of all neighbor nodes, the model uses the softmax function to normalize them, obtaining the attention weight a_ij:

[0079] a_ij = softmax(e_ij) = exp(e_ij) / Σ_{k∈N_i} exp(e_ik);

[0080] Here, N_i represents the set of all neighboring nodes of node i. The normalized attention weights a_ij satisfy Σ_{j∈N_i} a_ij = 1, that is, the sum of the attention weights of all neighboring nodes is 1.

[0081] Specifically, after obtaining the attention weights a_ij for each neighboring node, the model performs weighted aggregation of the features of the neighboring nodes to generate the updated feature representation h'_i for node i:

[0082] h'i = σ( Σ{j∈N_i} a_ij · W·h_j ); where σ is the activation function, and in this embodiment, the ELU (Exponential Linear Unit) function is used to accelerate model convergence and improve generalization ability; W is the shared weight matrix; h_j is the feature vector of neighbor node j (containing initial layout coordinates and equipment electrical features). The meaning of this weighted aggregation is that the larger the attention weight of a neighbor node, the greater the proportion of its features in the aggregation result, and the greater its influence on the updated node feature h'_i. Since the attention weight a_ij reflects the tightness of the electrical connection between node i and node j (e.g., high line load rate and low impedance result in high weight), h'_i encodes the dominant information from strongly electrically related neighbors. Extracting the coordinate part from h'_i yields the optimized target layout coordinates of node i.

[0083] The process by which the graph attention network model outputs the target layout coordinates can be understood by combining the effects of the aforementioned topological constraint loss term and overlap constraint loss term: During training, the model learns how to adjust coordinates according to the attention weights by minimizing the total loss function L_total. For node pairs with small electrical distances (i.e., close electrical connections), the model learns a larger attention weight a_ij, causing the updated coordinates of node i to "move closer" to node j; for node pairs with large electrical distances, the attention weight is smaller, and the coordinate adjustment magnitude is correspondingly reduced. Simultaneously, the overlap constraint loss term ensures that this "move closer" does not cause the node spacing to fall below a minimum threshold, thus avoiding visual overlap while tightly representing electrical connections.

[0084] For example, suppose in the initial layout coordinates, "Innovation Station" is located at coordinates (0.5, 0.5), "Science Park Station" at (0.6, 0.6), and "High-tech Station" at (0.4, 0.2). After calculation by the graph attention network model, due to the high load rate of the "Innovation Station-Science Park Station" line, the attention weight a_ij=0.7 for this edge; while the attention weight a_ij'=0.3 for the "Innovation Station-High-tech Station" line has a low load rate. After weighted aggregation, the updated coordinates of "Innovation Station" are pulled towards (0.57, 0.53), closer to "Science Park Station," while the distance from "High-tech Station" is relatively increased. At the same time, the overlap constraint ensures that the distance between "Innovation Station" and any other node is not less than d_min, avoiding overcrowding.

[0085] In this embodiment, through the collaborative work of the first and second models and the guidance of the constraint loss function, the layout coordinates simultaneously meet the dual requirements of topological connectivity (the distance between connected nodes is positively correlated with the electrical distance) and visual readability (no node overlap). Furthermore, through the attention mechanism, the strength of the electrical connection between nodes is automatically learned, so that the layout results can intuitively reflect the actual operating status of the power grid.

[0086] In some embodiments, to improve the layout standardization and electrical semantic expression accuracy of the power flow diagram, before inputting the power grid attribute diagram into the first model to obtain the global topological features of the power grid attribute diagram and the initial layout coordinates of each node in the power flow diagram to be generated, the process includes:

[0087] For each node, based on the voltage level of the power equipment represented by the current node, the current node is marked in the power grid attribute diagram as the target vertical arrangement level in the power flow diagram;

[0088] Based on the power supply zone identifier of the current node, mark the area block identifier to which the current node belongs in the power grid attribute map;

[0089] Based on the branch impedance and / or active power flow between the nodes, mark the electrical distance between each pair of connected nodes in the power grid attribute diagram;

[0090] Based on the power grid topology data, the primary / backup relationship and power supply path relationship between each node are identified and marked in the power grid attribute diagram.

[0091] Voltage level refers to the nominal voltage value in a power system, used to characterize the standard voltage at which power equipment (such as generators, transformers, transmission lines, and busbars) are designed and operated. Common voltage levels include, but are not limited to: 1000kV (UHV), 750kV, 500kV (EHV), 330kV, 220kV, 6kV, and 0.4kV (Low Voltage). Voltage levels can be determined as follows: The voltage level field is read from the original data source. For CIM / G format graphic files, the rated voltage value (unit: kV) can be obtained from the BaseVoltage element; for PSS / E or BPA power flow files, the reference voltage parameters can be read from the busbar card or node card; for CSV format topology tables, it can be directly read from the "Voltage Level" column. If voltage level information is missing from the original data, it can be inferred based on the equipment type and location. For example, outgoing lines from a 500kV substation typically correspond to a 500kV voltage level, and busbars from a 220kV substation typically correspond to a 220kV voltage level.

[0092] Vertical layer hierarchy refers to the hierarchical position of a node in the power flow diagram. Specifically, a mapping table between voltage levels and vertical layers can be maintained. For example, 500kV and above can be mapped to layer 4 (top layer), 220kV to layer 3, 110kV to layer 2, and 35kV and below to layer 1 (bottom layer). The mapping table can be configured according to actual business needs. For instance, in a distribution network scenario with only 220kV and 110kV, 220kV can be mapped to layer 2 (top layer), and 110kV to layer 1 (bottom layer). Based on the mapping results, a field "target_layer" is added to the node's electrical characteristics to indicate the vertical layer to which the node should belong in the generated power flow diagram (e.g., target_layer=3).

[0093] In this embodiment, nodes are arranged vertically in layers according to voltage levels: nodes with higher voltage levels are positioned higher in the graph (e.g., at the top of the canvas); nodes with lower voltage levels are positioned lower in the graph (e.g., at the bottom of the canvas). This layered arrangement aligns with the reading habits of power dispatchers, facilitating rapid identification of equipment and lines at different voltage levels. By marking the target vertical arrangement level for each node during the preprocessing stage, the subsequent GCN and GAT models can input this level information as part of the node features when generating layout coordinates. This allows them to learn the layout constraint that "nodes of the same voltage level should be at similar vertical heights," ensuring that the final generated power flow diagram naturally conforms to voltage layering specifications without relying on additional post-processing adjustments.

[0094] A power supply zone refers to a sub-region of the power grid divided according to geographical area, administrative division, operation and maintenance management unit, or substation power supply range. Equipment within the same power supply zone has strong correlation in electrical connection and business management, and is usually clustered in adjacent area blocks in the power flow diagram to form a visual effect of "compact within blocks and clear between blocks".

[0095] During preprocessing, for each node in the power grid property graph, the system reads the "Power Supply Zone Identifier" field from its equipment electrical characteristics. This identifier can come from the original data source (such as the "SubControlArea" attribute in the CIM / G file) or can be automatically calculated based on the node's geographic latitude and longitude coordinates using a spatial clustering algorithm. For nodes that do not have a power supply zone identifier, they can be marked as "default zone" or assigned a value based on the zone to which the nodes they are connected to belong.

[0096] Power supply zone identifiers are marking information used to identify sub-regions within a power system, divided by geographical area, administrative division, operation and maintenance management unit, or substation power supply range. Equipment within the same power supply zone has strong correlations in electrical connections and business management. Power supply zone identifiers can be determined as follows: The zone field can be directly read from the original data source. For CIM / G format graphic files, the zone name can be obtained from the SubControlArea or Substation element; for real-time databases of dispatch automation systems, it can be read from the "Dispatch Area" or "Operation and Maintenance Unit" field; for CSV format equipment ledgers, it can be directly read from the "Power Supply Zone" column. If the power supply zone identifier is missing from the original data, a spatial clustering algorithm based on geographic location (such as DBSCAN or K-Means algorithm) can be used to automatically calculate the zone affiliation based on the latitude and longitude coordinates of the nodes, or the region can be divided based on topological connectivity (grouping nodes closely connected by tie lines into the same zone).

[0097] Further, based on the read power supply partition identifier, the system generates a region block identifier (“block_id”) for each node. Specifically, the power supply partition identifier string is normalized (e.g., spaces are removed, and case is standardized) to generate a unique block number. Nodes within the same power supply partition have the same block_id. Optionally, for nodes belonging to the same power supply partition but geographically distant or with sparse topological connections, a subgraph segmentation algorithm (such as the Louvain community detection algorithm) can be used to further subdivide them into multiple sub-blocks, each assigned an independent block_id to maintain local compactness of the layout. The marked region block identifier is stored as a field of the node's device electrical characteristics.

[0098] This embodiment uses the identifier of the region block to allow the subsequent layout algorithm to impose a "compact arrangement" constraint (such as small node spacing and cohesive region boundaries) on nodes within the same region block when generating coordinates, and a "spaced arrangement" constraint (such as maintaining obvious blank intervals between regions) on nodes between different region blocks. This differentiated processing enables the generated power flow diagram to clearly display the power supply zoning structure of the power grid, making it easier for operation and maintenance personnel to quickly locate equipment and lines in specific areas.

[0099] Branch impedance refers to the resistance of a power line to alternating current. It consists of two parts: resistance R (unit: ohms, Ω) and reactance X (unit: ohms, Ω), and can be expressed in complex form as Z = R + jX. The branch impedance is determined as follows: For overhead transmission lines or cable lines, the total impedance (Z_total = Z_unit × L) can be calculated based on the line type, conductor cross-sectional area, impedance parameters per unit length, and line length. For transformer windings, the impedance value referred to the base capacity can be calculated from the short-circuit impedance percentage (Uk%) in the transformer nameplate parameters. For series compensation devices, it can be directly read from the parameter configuration of the compensation device. From the original data source, the branch impedance can be read from the resistance R and reactance X fields of the line card (such as L card, T card) in the PSS / E or BPA power flow file; from the CIM / G file, it can be obtained from the r and x attributes of the ACLineSegment element; from the CSV format topology table, it can be read from the "Line Impedance" column.

[0100] Branch active power flow refers to the active power transmitted through power lines at any given moment, typically measured in megawatts (MW). The sign of the value indicates the direction of power transmission (a positive value usually indicates flow from the transmitting end to the receiving end). Branch active power flow is determined as follows: It is read from real-time telemetry data collected by the SCADA system; obtained from power flow calculation section data obtained through mode calculation; the active power field of the line is read from the output of the PSS / E or BPA power flow file; and the "Active Power Flow" column is read from the CSV format operation data table.

[0101] Electrical distance is a quantitative indicator that measures the degree of electrical connection between two nodes, directly affecting the target value of the visual distance between nodes in the layout algorithm. As a supervisory signal, electrical distance guides the model to visually place pairs of nodes with small electrical distances closer together.

[0102] During preprocessing, for each edge E_ij (connecting node i and node j) in the power grid attribute graph, the system reads relevant parameters from its line electrical characteristics and calculates the electrical distance D_ij between the two nodes connected by the edge. The specific calculation method for the electrical distance can be flexibly selected according to the actual application scenario.

[0103] Electrical distance based on impedance: D_ij = R_ij² + X_ij², where R_ij is the line resistance and X_ij is the line reactance. The smaller the impedance, the smaller the electrical distance, indicating a tighter electrical connection between the two nodes.

[0104] Electrical distance based on line length: D_ij = L_ij / L_max, where L_ij is the line length (unit: km), and L_max is the maximum value of all line lengths (used for normalization). The shorter the line, the smaller the electrical distance.

[0105] Electrical distance based on power flow: D_ij = 1 / (1 + P_ij / P_base), where P_ij is the active power flow of the line (unit: MW), and P_base is the base power (e.g., 100MW). The larger the active power flow, the smaller the electrical distance, indicating that the line carries a heavier power transmission task and the electrical connection between the two ends is closer.

[0106] Comprehensive electrical distance: The above factors are combined in a weighted manner, such as D_ij = w1·(R_ij²+X_ij²) + w2·(L_ij / L_max) + w3·(1 / (1+P_ij / P_base)), where w1, w2, and w3 are configurable weight coefficients that satisfy w1+w2+w3=1.

[0107] After calculating the electrical distance D_ij, it is stored as an additional attribute of the edge in the power grid attribute graph, with the field name "electrical_distance". Since the subsequent topology constraint loss function needs to compare the visual distance with the electrical distance, and the value range of the visual distance depends on the canvas size and the number of nodes, the electrical distance can be normalized so that its value range roughly matches the expected visual distance (usually between 0 and 1).

[0108] By preprocessing and labeling the electrical distance, the topology constraint loss term can directly read this pre-calculated value from the power grid attribute graph as the supervision target, eliminating the need to calculate the electrical distance in real time during model training. This improves training efficiency while ensuring the consistency and configurability of the electrical distance calculation method.

[0109] In power systems, to improve power supply reliability, critical equipment is typically configured with primary and backup relationships (such as primary transformers and backup transformers, primary power sources and backup power sources). Simultaneously, electrical energy is transmitted from the generation side to the load side along specific power supply paths. Identifying these relationships helps placement algorithms highlight core equipment and critical paths when generating graphs.

[0110] During preprocessing, the system performs the following identification and labeling operations based on the power grid topology data:

[0111] The primary / backup relationship identification process may include: traversing the nodes in the power grid attribute diagram to identify equipment pairs with a "primary / backup" association. Identification rules may include: keyword matching in node names (e.g., "Main Transformer No. 1" and "Main Transformer No. 2", "Main Supply" and "Backup Supply"), identical equipment types connected to the same bus, or directly reading the "backup relationship" field from the original data source. For identified primary equipment nodes, mark "is_primary=true" in the node attributes; for backup equipment nodes, mark "is_backup=true" and simultaneously mark their corresponding primary equipment identifier "primary_id".

[0112] Graph traversal algorithms (such as depth-first search or breadth-first search) can be used to start from power source nodes (such as the high-voltage side bus of power plants and substations) and search along the transmission lines towards load nodes to identify the main power supply paths. For nodes and edges located on the same power supply path, a "path_id" field is added to the attributes to mark the power supply path to which they belong. For critical power supply paths (such as the main path of dual-circuit power supply), "is_critical=true" can be additionally marked.

[0113] By marking primary / backup relationships and power supply path relationships, subsequent layout algorithms and rendering modules can differentiate the processing of these critical devices and critical paths. For example, primary devices can be placed in a prominent central position within a block, while backup devices are placed on the sides; lines on critical power supply paths can be drawn with more eye-catching colors or line types. These processing methods enable the generated power flow diagram to not only meet basic layout specifications but also highlight the core structure of the power grid, providing a more intuitive reference for maintenance personnel in fault analysis and scheduling decisions.

[0114] The primary / standby relationship refers to the association between primary and standby equipment configured in a power system to improve power supply reliability. The identification process for the primary / standby relationship may include: directly reading the "standby relationship" or "primary / standby identifier" field from the original data source; performing pattern matching based on keywords in the node names, for example, nodes containing "No. 1," "Section I," or "Primary Supply" are marked as primary equipment, while nodes containing "No. 2," "Section II," "Standby Supply," or "Hot Standby" are marked as standby equipment, using the common parts of the names (excluding the serial number) as the matching basis; and inferring from the topology connection relationship, for example, two transformers connected to the same busbar and of the same equipment type can be identified as having a primary / standby relationship. For identified primary equipment nodes, "is_primary=true" is marked in the equipment's electrical characteristics; for standby equipment nodes, "is_backup=true" is marked, and the corresponding primary equipment identifier "primary_id" is also marked.

[0115] A power supply path refers to the sequence of nodes and edges through which electrical energy is transmitted from a power source node to a load node. Methods for identifying power supply paths include: using graph traversal algorithms (such as Depth-First Search (DFS) or Breadth-First Search (BFS)) to search along the transmission line towards the load node, starting from the power source node (such as the power plant's outlet bus or the provincial grid interconnection line inlet), until the load node or end device is reached, recording the sequence of nodes and edges along the search path. For complex topologies composed of double-circuit lines or ring networks, shortest path algorithms (such as Dijkstra's algorithm) are used to identify the main power supply paths. For nodes located on the same power supply path, a "path_id" field is added to the equipment's electrical characteristics to mark the power supply path to which it belongs; for edges located on the same power supply path, a "path_id" field is added to the line's electrical characteristics. For critical power supply paths (such as the main path of dual-circuit power supply or the only path supplying power to important loads), "is_critical=true" can be additionally marked.

[0116] By marking the primary / backup relationship and power supply path relationship, the subsequent layout algorithm and rendering module can differentiate these critical devices and critical paths, so that the generated power flow diagram can highlight the core structure of the power grid.

[0117] This embodiment systematically embeds professional knowledge from the power industry, such as voltage level hierarchical rules, power supply zoning rules, electrical distance constraint rules, and primary / backup relationship rules, into the power grid attribute graph. This allows the subsequent graph neural network model to perform coordinate prediction and layout optimization under the guidance of rich semantic information. The generated power flow graph is not only topologically correct but also conforms to the professional standards and reading habits of the power industry. Preprocessing labeling is a deterministic operation performed at the data level, independent of model learning, thus possessing good interpretability and configurability. Operation and maintenance personnel can adjust the mapping table parameters, electrical distance calculation formulas, or recognition rules according to actual needs, adapting to the layout requirements of different scenarios without retraining the model. By pre-labeling the vertical arrangement hierarchy and region block identifiers, the high-level layout specifications (such as horizontal arrangement of nodes at the same voltage level and compact aggregation of nodes in the same zone) that are difficult for purely data-driven models to learn are solved, reducing the learning difficulty of the model and improving the stability and predictability of the layout results. The pre-calculation of electrical distance provides accurate supervision signals for the topology constraint loss term, ensuring the alignment of the model output coordinates with electrical characteristics; the labeling of primary / backup relationships and power supply path relationships provides a data foundation for subsequent differentiated processing of visualization rendering, enhancing the information expression capability of the graph.

[0118] In some embodiments, to further improve the visual standardization and engineering practicality of the power flow diagram, after outputting the target layout coordinates of each node through the aforementioned second model (graph attention network model), it is also necessary to perform multi-stage constraint optimization processing on these target layout coordinates based on power industry standards. This optimization processing aims to solve the layout deviation problem that may be generated by the pure data-driven model, and ensure that the final generated power flow diagram meets the engineering requirements of "clear voltage layering, compact partition aggregation, reasonable topology distance, no node overlap, and regular and aligned graphics". The step of inputting the initial layout coordinates of each node and the power grid attribute graph into the second model, so that the second model adjusts the initial layout coordinates based on the attention mechanism to obtain the target layout coordinates of each node in the power flow diagram to be generated, includes:

[0119] Obtain the voltage level of each node, and divide the target layout coordinates of nodes belonging to the same voltage level threshold into the same vertical level;

[0120] Obtain the power supply zone identifier of each node, and aggregate the target layout coordinates of nodes belonging to the same power supply zone into the same area block. The interval between nodes within the same area block is smaller than the interval between different area blocks.

[0121] Overlap detection is performed on the target layout coordinates of all node pairs, the positions of overlapping node pairs are adjusted, and the nodes are center-aligned.

[0122] Hierarchical partitioning refers to classifying the target layout coordinates of nodes belonging to the same voltage level threshold into the same vertical hierarchy based on their voltage levels. The voltage level threshold refers to a pre-defined range of voltage values ​​used to group continuous or discrete voltage levels into a finite number of vertical hierarchies.

[0123] Specifically, the "Voltage Level" field in the electrical characteristics of each node's equipment can be read to obtain the nominal voltage value (unit: kV) corresponding to that node. Based on a preset voltage level threshold mapping table, the target vertical level number of each node is determined. For example, a node with a voltage level of 500kV belongs to level 4 according to the mapping table; a node with a voltage level of 220kV belongs to level 3; a node with a voltage level of 110kV belongs to level 2; and a node with a voltage level of 35kV or 10kV belongs to level 1. The vertical coordinates in the target layout coordinates of each node are uniformly adjusted: nodes belonging to the same level have their vertical coordinates adjusted to be near the reference vertical coordinates corresponding to that level. The values ​​of the reference vertical coordinates can be evenly distributed according to the level number; for example, the vertical coordinate of level 4 = 0.85 (relative coordinate, range 0-1), the vertical coordinate of level 3 = 0.65, the vertical coordinate of level 2 = 0.45, and the vertical coordinate of level 1 = 0.25. After adjustment, nodes at the same level are basically aligned vertically, while nodes at different levels form a clear stepped distribution vertically.

[0124] By hierarchically dividing the data, the generated power flow diagram forms a clear, stepped distribution along the voltage levels, enabling maintenance personnel to easily identify the high-voltage backbone network and the low-voltage distribution network, which aligns with the diagram reading habits of power dispatching systems. Furthermore, this deterministic operation does not rely on model learning, avoiding the "voltage level aliasing" problem that can occur with purely data-driven models.

[0125] Regional segmentation refers to aggregating the target layout coordinates of nodes belonging to the same power supply zone into the same regional block. A power supply zone refers to a sub-region of the power grid defined by geographical area, administrative division, operation and maintenance management unit, or substation power supply range. As mentioned earlier, power supply zone identifiers can be read from the original data source or automatically generated through spatial clustering or topology partitioning algorithms. Based on hierarchical segmentation, regional segmentation further groups and aggregates nodes within the same voltage level or across levels horizontally.

[0126] Specifically, the "block identifier" ("block_id") field in the device electrical characteristics of each node can be read to obtain the block number to which the node belongs. Next, for each block, the target layout coordinates of all nodes within that block are collected, and the geometric center of the block (i.e., the coordinates of the block's center point) is calculated. Then, a "centripetal tightening" adjustment is applied to the node coordinates within the same block: the coordinates of each node are moderately offset towards the geometric center of its region, with the offset proportional to the distance from the node to the region center, making the nodes within the same region appear as a compact cluster. Simultaneously, a "space expansion" adjustment is applied between different blocks: the bounding boxes (i.e., the minimum bounding rectangles of the regions) of different blocks are detected. If the distance between the bounding boxes of two blocks is less than a preset minimum inter-block spacing threshold (e.g., 0.05 in normalized coordinate space), a mutually repulsive displacement is applied to both blocks until the inter-block distance meets the threshold requirement. Optionally, a dashed border or background color block can be drawn around each block to enhance its visual recognizability.

[0127] By dividing the power supply into regions, nodes within the same power supply zone are aggregated into compact visual clusters, while clear intervals are maintained between different zones, making the power supply zone structure of the power grid readily apparent. This is particularly beneficial for the operation and maintenance management of multi-zone, large-scale power grids, allowing maintenance personnel to quickly locate equipment and lines within a specific zone, improving the efficiency of fault diagnosis and dispatching decisions.

[0128] Point constraint generation refers to adjusting the target layout coordinates of all nodes based on electrical distance and topological connectivity constraints. This ensures that the visual distance between connected nodes is positively correlated with their electrical distance, and prevents overall layout shifts. Electrical distance is a quantitative indicator measuring the degree of electrical connection between two nodes; its definition and calculation method are as previously described and will not be repeated here. For two nodes directly connected by an edge in the attribute graph, the Euclidean distance between their target layout coordinates should be positively correlated with the electrical distance between these two nodes. That is, the smaller the electrical distance (the closer the electrical connection), the smaller the visual distance between nodes should be; conversely, the larger the electrical distance, the larger the visual distance between nodes should be. Topological connectivity constraints require that nodes in the entire power grid attribute graph maintain their original topological connectivity structure after layout. Connected nodes should not be stretched too far apart, resulting in a visual "disconnection," and unconnected nodes should not be incorrectly clustered together, creating a false visual connection.

[0129] Specifically, each edge E_ij (connecting node i and node j) in the power grid attribute graph can be traversed, the pre-calculated electrical distance D_ij (field name "electrical_distance") can be read from the edge's attributes, and the Euclidean distance d_ij = ||p_i - p_j|| between the target layout coordinates of the current node i and node j can be calculated. Next, calculate the distance deviation Δ_ij = d_ij - D_ij (where D_ij has been normalized and its value range is consistent with d_ij). If Δ_ij > 0, it means the current visual distance is greater than the target electrical distance, and the node pair needs to move closer to each other; if Δ_ij < 0, it means the current visual distance is less than the target electrical distance, and the node pair needs to move away from each other. Based on the direction and magnitude of the distance deviation, calculate the adjustment vector acting on node i and node j: for node pairs with positive deviations (needing to move closer), the direction of the adjustment vector is from node j to node i (moving node i towards node j), and vice versa. The magnitude of the adjustment vector is related to the absolute value of the deviation Δ_ij and the preset learning rate (e.g., 0.1). Accumulate the adjustment vectors for all node pairs to obtain the comprehensive adjustment displacement for each node. Finally, apply this adjustment displacement to the coordinates of all nodes to complete one round of point constraint adjustment. The above process can be iteratively executed (e.g., 3-5 times) until the sum of the distance deviations of all node pairs converges to within the preset tolerance threshold.

[0130] Through point constraint generation, the target layout coordinates output by the model are further optimized, ensuring precise alignment between the visual and electrical distances between connected nodes. After this step, the two ends of heavily loaded or short-impedance lines appear significantly closer, while the two ends of lightly loaded or long-impedance lines are appropriately spaced further apart, making the electrical semantics conveyed by the graphics more accurate and intuitive. Simultaneously, the overall offset avoidance mechanism ensures that the entire power grid structure is centered on the canvas, preventing it from being biased towards any corner.

[0131] Collision avoidance and layout optimization refer to imposing minimum distance constraints and boundary constraints on nodes, performing overlap detection and automatic bounce adjustment, and performing layout processing such as row alignment, column alignment, and / or center alignment on nodes. Among them, the minimum distance refers to the minimum visual distance that should be maintained between any two nodes in the final power flow diagram, which is used to avoid the mutual occlusion of node icons and the overlap of annotation texts. The minimum distance threshold d_min can be dynamically calculated according to the size of the node icon and the length of the annotation text. For example, it can be set that d_min = (avg_icon_size + avg_text_width) / canvas_width, where avg_icon_size is the average pixel size of the icon, avg_text_width is the average pixel width of the annotation text, and canvas_width is the pixel value of the canvas width.

[0132] Boundary constraint means that the coordinates of all nodes should be kept within the valid area of the canvas to avoid nodes exceeding the canvas boundary or being truncated by the boundary. For example, the valid area of the canvas can be set as the normalized coordinate range of [0.05, 0.95], that is, a 5% margin is reserved.

[0133] Overlap detection refers to detecting whether the Euclidean distance between any two nodes is less than the preset minimum distance threshold d_min. If the distance between two nodes is less than d_min, it is determined that there is an overlap. Overlap detection can traverse all node pairs (i < j), calculate the Euclidean distance and compare it with d_min. For large-scale power grids (such as those with more than 500 nodes), a spatial index structure (such as a quadtree or grid partitioning) can be used to accelerate the detection and avoid the O(N²) complexity.

[0134] For each pair of overlapping nodes detected (node i and node j, distance d_ij < d_min), calculate the bounce vector: the direction is from node i to node j (or the opposite direction), and the bounce amplitude is (d_min - d_ij) / 2. Move the two nodes in opposite directions by the bounce amplitude respectively so that the distance after bouncing reaches d_min. When applying bounce adjustment to multiple overlapping node pairs simultaneously, an iterative method is used: first calculate the bounce vectors of all node pairs, then accumulate to obtain the total bounce displacement of each node, and then update the node coordinates uniformly. Repeat the above process until the distance between all node pairs is greater than or equal to d_min. To avoid the bounce process from destroying the overall structure of the hierarchical division and regional partitioning, the bounce amplitude between nodes within the same regional block can be moderately attenuated during bouncing, and the bounce amplitude between nodes between different regional blocks remains normal.

[0135] Regular alignment refers to fine-tuning the coordinates of nodes while maintaining their relative positions, so that they form a regular arrangement in the horizontal and vertical directions, thereby improving the overall visual effect and engineering standardization of the graphics.

[0136] Optionally, nodes at the same vertical level (same voltage level) can have their ordinates adjusted to the same or approximately the same value. Specifically, the average ordinate of all nodes within the same level is calculated, and the ordinate of each node in that level is then aligned with this average value (e.g., a weighted average, with a weight of 0.8 for the original coordinate and 0.2 for the target average), thus preserving individual differences while achieving overall alignment.

[0137] Optionally, nodes on the same vertical line (such as devices arranged vertically within the same substation) are identified, and their x-coordinates are adjusted to the same value. Column alignment can be identified by detecting whether there is a continuous connection between nodes and whether the differences in their x-coordinates are small.

[0138] Optionally, the entire area block or the entire canvas node set can be center-aligned to make the layout's center of gravity coincide with the canvas center. Specifically, the average center point of all node coordinates is calculated, the offset vector between this center point and the canvas center is calculated, and all node coordinates are shifted by the negative value of this offset vector to center the layout as a whole.

[0139] This embodiment eliminates node overlap through collision avoidance processing, ensuring that the icons and annotation text of each node are clearly readable. Through regular alignment processing, the graphics are visually more standardized and professional, meeting the power industry's requirements for power flow diagram layout. Maintenance personnel can quickly and accurately locate nodes and read information when viewing the power flow diagram without manual dragging and adjustment. Simultaneously, the automatic pop-up mechanism can adapt to power grids of different densities and scales, exhibiting good robustness and generalization capabilities.

[0140] In some embodiments, the electrical characteristics of the equipment include at least one of the following: equipment name, equipment type, voltage level, power supply zone identifier, active power, reactive power, load power, and power generation; the electrical characteristics of the line include at least one of the following: line name, line impedance, line length, active power flow, reactive power flow, load rate, and operating status.

[0141] The step of visually rendering the target layout coordinates and the connection relationships between nodes and edges in the power grid attribute diagram based on the electrical characteristics of the equipment and the electrical characteristics of the line to obtain the power flow diagram corresponding to the power system includes:

[0142] An orthogonal wiring algorithm is used to plan a polyline connection path consisting of horizontal and vertical line segments for each edge; during path planning, obstacle avoidance is performed to ensure that the connection lines bypass node icons and other connections.

[0143] Perform polyline smoothing or differentiated line type labeling on the connection between voltage levels;

[0144] With the goal of reducing the connection crossover rate, the connection coordinates or connection directions of the connection crossover areas in the power flow diagram are adjusted;

[0145] The electrical characteristics of the equipment and the electrical characteristics of the lines are mapped to visual attributes in a visualization graphic to obtain the power flow diagram.

[0146] In order to generate a power flow diagram that conforms to power industry standards and can intuitively reflect the operating status of the power grid, after obtaining the target layout coordinates of each node through the aforementioned steps, it is necessary to perform visualization rendering on the target layout coordinates and the connection relationships between nodes and edges in the power grid attribute diagram based on the electrical characteristics of the equipment and the electrical characteristics of the lines. The purpose of visualization rendering is to transform abstract coordinate data and electrical parameters into graphic elements with clear visual semantics, enabling operation and maintenance personnel to quickly obtain the topology and operating status of the power grid through the graphics themselves.

[0147] Equipment electrical characteristics refer to the attribute data attached to each node in the power grid attribute diagram, used to describe the electrical characteristics and operating status of the power equipment corresponding to that node. Specifically, equipment electrical characteristics may include one or more of the following: Equipment name: such as "Gaoxin Substation", used for labeling text on the diagram. Equipment type: such as "Substation", "Bus", "Load", "Generator", used to determine the shape of the node icon (e.g., rectangle for substations, horizontal line segment for buses, arrow or circle for loads). Voltage level: such as 500kV, 220kV, 110kV, 35kV, 10kV, used to determine the vertical arrangement hierarchy of the node and the icon color. Power supply zone identifier: such as "Gaoxin Power Supply Zone", "Science and Technology Park Power Supply Zone", used for the aggregation and differentiation of area blocks. Active power (unit: megawatt, MW), reactive power (unit: megavar, MVar), used for the numerical display of node labels. Load power (for load nodes), generating power (for generating nodes), used for dynamic scaling of node icon size.

[0148] Line electrical characteristics refer to the attribute data attached to each edge of the power grid attribute diagram, used to describe the electrical parameters and operating status of the power line corresponding to that edge. Specifically, line electrical characteristics may include one or more of the following: Line name: such as "Innovation-Science Park Double Circuit", used for labeling text on the diagram. Line impedance (unit: ohms, Ω, including resistance R and reactance X), used for electrical distance calculation and attention weight calculation. Line length (unit: kilometers, km), used for electrical distance calculation. Active power flow (unit: megawatts, MW), representing the active power currently transmitted on the line, used to determine the connection width and direction arrow. Reactive power flow (unit: megavars, MVar), used for labeling information. Load factor (percentage), representing the ratio of the current active power flow to the line's rated transmission capacity, used to determine the connection color and alarm status. Operating status: such as "Operating", "Under Maintenance", "Hot Standby", used to determine whether the connection is displayed and its display style (e.g., under maintenance status can be represented by a dashed line).

[0149] Orthogonal routing refers to planning a polyline connection path composed of horizontal and vertical line segments for each edge (i.e., power line) in a power grid attribute diagram. This results in clear, regular connection paths that conform to the power industry's power flow diagram drawing standards. Orthogonal routing is a connection path planning method characterized by generating polylines consisting only of horizontal and vertical line segments, with each polyline's inflection point forming a 90-degree angle. In this embodiment, for the edge connecting node i (coordinates (x_i, y_i)) and node j (coordinates (x_j, y_j)), the orthogonal routing path processing scheme may include the following:

[0150] Starting from node i, move horizontally to the same x-coordinate as node j, and then vertically to node j. The path is: starting point (x_i, y_i) → intermediate point (x_j, y_i) → ending point (x_j, y_j).

[0151] Starting from node i, move vertically to the same y-coordinate as node j, and then move horizontally to node j. The path is: starting point (x_i, y_i) → intermediate point (x_i, y_j) → ending point (x_j, y_j).

[0152] When the proposed route with two inflection points conflicts with existing nodes or connections, a third inflection point is introduced to bypass the conflict. For example: starting point (x_i, y_i) → first intermediate point (x_i + offset, y_i) → second intermediate point (x_i + offset, y_j) → ending point (x_j, y_j).

[0153] Path selection can be determined based on the following rules: if the x-coordinates of nodes i and j differ significantly but the y-coordinates differ slightly, the path is selected first horizontally and then vertically; if the y-coordinates differ significantly but the x-coordinates differ slightly, the path is selected first vertically and then horizontally; if both paths conflict with obstacles, the detour distance is calculated and the path with the shortest detour distance is selected.

[0154] When planning a path, obstacle avoidance processing is required to ensure that lines automatically bypass node icons and other existing lines. The obstacle avoidance process can be as follows: Define the area occupied by each node icon as a rectangular obstacle, the size of which is determined by the node icon size and the range of the labeled text. Define existing line paths as linear obstacles as well. For candidate path schemes, check each line segment to see if it intersects with any obstacle. If an intersection exists, the scheme is considered to have a conflict.

[0155] When a conflict is detected, an inflection point is added near the conflict location to generate a detour path. The detour offset can be preset to half the width of the node icon plus a preset margin (e.g., 10 pixels). The detour direction (up, down, left, right) can be automatically selected based on the availability of space around the obstacle, prioritizing the side with more space. For the generated detour path, redundant inflection point removal is performed. For example, if there are three consecutive points A, B, and C in the path, where line segment AB is in the opposite direction to BC (i.e., forming a "U" shape), then the middle point B is deleted, and A and C are directly connected (if the connection between A and C does not create a new conflict).

[0156] Connections linking nodes at different voltage levels (e.g., lines connecting 500kV and 220kV nodes) are called cross-voltage level connections. Since nodes at different voltage levels are located in different vertical layers, cross-voltage level connections often need to traverse long vertical distances and are prone to intersecting with other connections. For cross-voltage level connections, the following differentiation processing can be performed: At the corners of cross-voltage level connections, rounded edges or 45-degree chamfers can be used for smoothing, visually distinguishing them from connections at the same voltage level. The smoothing radius can be preset to 5 pixels. Cross-voltage level connections can be marked with dashed lines, dotted lines, or different colors for differentiation. For example, a cross-voltage level connection from 500kV to 220kV can be represented by a blue dashed line, while a connection at the same 220kV level can be represented by a black solid line. In cross-connection resolution optimization, cross-voltage level connections can be assigned a lower priority, allowing them to bypass conflicts and protecting the regularity of connections at the same voltage level.

[0157] For areas with densely intersecting lines, cross-reduction optimization is performed to reduce the cross-reduction rate by adjusting the coordinates or directions of the lines in the power flow diagram. The cross-reduction process may include the following: traversing all edge pairs (E_ij and E_kl) and determining whether two lines intersect (i.e., line segments intersect). For paths composed of orthogonal polylines, each pair of lines needs to be checked segment by segment. The cross-reduction rate is calculated as (number of intersecting edge pairs) / (total number of edge pairs). The goal is to reduce the cross-reduction rate to below a preset threshold (e.g., 5%). For detected cross-reduction points, the positions of the nodes involved in the cross-reduction are analyzed. If the cross-reduction occurs between two lines rather than at a node, the target layout coordinates of one of the nodes can be fine-tuned (within the range allowed by collision avoidance constraints) to eliminate the cross-reduction. The adjustment direction can be moving the node outside the cross-reduction area, with an adjustment increment of a preset step size (e.g., 0.01 in normalized coordinates), iterating until the cross-reduction is eliminated. If adjusting the node coordinates cannot effectively eliminate the cross-reduction, the direction of one of the lines can be modified. For example, alternatives can be made: Option 1 (horizontal first, then vertical) can be changed to Option 2 (vertical first, then horizontal), or inflection points can be added to make the connecting line detour from the other side. The A* pathfinding algorithm can then be used to search for the optimal, non-intersecting path in the gridded free space.

[0158] Through orthogonal cabling, all lines are composed of horizontal and vertical segments, resulting in neat, professional graphics that conform to power flow diagram drawing standards. Obstacle avoidance handling automatically detours around node icons and other lines, preventing visual obstruction. Differential processing of cross-level connections allows maintenance personnel to quickly identify critical interconnections across voltage levels. Cross-connection resolution optimization significantly reduces the cross-connection rate, greatly improving the readability and aesthetics of the graphics.

[0159] Semantic rendering refers to mapping the electrical characteristics of the equipment and lines into visual attributes in a visual graphic, so that the generated power flow diagram not only displays the topology but also intuitively reflects the operating status of the power grid. Specifically, this step dynamically maps electrical parameters (such as voltage level, load power, active power flow, and load rate) into visual attributes of graphic elements (such as position, size, thickness, color, and direction).

[0160] During rendering, the vertical coordinate arrangement level of a node on the canvas is determined based on its voltage level. Specifically, the "voltage level" field in the electrical characteristics of each node's device is read, and the node is assigned to the corresponding vertical level according to a preset voltage level-level mapping table. The mapping rules can be as follows: 500kV and above: mapped to level 4 (top layer), with a vertical coordinate of 0.85 (normalized coordinate). 220kV: mapped to level 3, with a vertical coordinate of 0.65. 110kV: mapped to level 2, with a vertical coordinate of 0.45. 35kV and below: mapped to level 1 (bottom layer), with a vertical coordinate of 0.25. Nodes within the same level can have their vertical coordinates fluctuate slightly around the baseline value (e.g., ±0.02) to preserve differentiated information. Through this mapping, nodes with higher voltage levels are automatically arranged at the top of the graphic, and nodes with lower voltage levels are arranged at the bottom, forming a clear voltage level hierarchy.

[0161] In some embodiments, mapping the electrical characteristics of the equipment and the electrical characteristics of the line to visual attributes in a visualization graphic to obtain the power flow diagram includes:

[0162] The display area of ​​the icon element corresponding to the node is determined based on the load power of the node; the display area is positively correlated with the load power.

[0163] The pixel width of the connecting element corresponding to the edge is determined based on the active power flow value of the edge; the active power flow value is positively correlated with the line thickness of the connecting line.

[0164] The color value of the connecting element corresponding to the edge is determined based on the load percentage of the edge;

[0165] Based on the power flow direction of the line represented by the edge, a direction identifier from the sending node to the receiving node is superimposed on the connecting element corresponding to the edge.

[0166] For edges whose load rate exceeds the preset alarm threshold, the corresponding connecting elements are highlighted.

[0167] Load power refers to the active power consumed by electrical equipment connected to the node, typically measured in megawatts (MW). Generation power refers to the active power output by power generation equipment (such as generators, photovoltaic power stations, and wind farms) connected to the node, also typically measured in megawatts (MW). Based on the node's load power or generation power, the display area of ​​the corresponding icon element is determined according to a preset proportional function. The mapping function can be designed as: Icon radius R_icon = R_min + (R_max - R_min) × (P / P_max), where: R_min is the minimum icon radius (e.g., 8 pixels), R_max is the maximum icon radius (e.g., 24 pixels), P is the current node's load power or generation power (unit: MW), and P_max is the maximum power among all nodes (used for normalization). For nodes that are both loads and power sources (such as load nodes containing distributed photovoltaics), the larger of the load power and generation power is taken. Through this mapping, nodes with higher power are displayed larger on the graph, allowing maintenance personnel to intuitively identify the main load centers and main power sources in the power grid. For example, the icon area of ​​a load node in a large industrial park is significantly larger than that of a load node in a typical residential area.

[0168] Active power flow refers to the active power transmitted through power lines at any given moment, typically measured in megawatts (MW). The active power flow is determined as follows: Active power measurement points of the lines are read from real-time telemetry data collected by the SCADA system; the active power field of the lines is obtained from the power flow calculation section data obtained through mode calculation; the active power value in the line power card is read from the output results of the PSS / E or BPA power flow file; and the "Active Power Flow" column is read from the CSV format operation data table. Active power flow values ​​can be positive or negative. Positive values ​​indicate that power flows from the starting node to the ending node of the line (according to a preset reference direction), while negative values ​​indicate that the power flow direction is opposite to the reference direction. When mapping to the line width, the absolute value of the active power flow is taken, because the width only indicates the power magnitude, not the direction (indicated by the arrow).

[0169] The calculation method for connection width: The mapping function for connection width can be designed as a linear mapping, square root mapping, or piecewise mapping. Based on the active power flow value of an edge, this value can be linearly or non-linearly mapped to the pixel width of the corresponding connection element. The mapping function can be designed as: Width_line = Width_min + (Width_max - Width_min) × (P_flow / P_flow_max), where: Width_min is the minimum line width (e.g., 1 pixel), and Width_max is the maximum line width (e.g., 8 pixels). P_flow is the absolute value of the active power flow of the current edge (unit: MW), and P_flow_max is the maximum value of the active power flow across all edges (used for normalization). For lines with active power flow close to 0, the minimum line width (e.g., a 1-pixel dashed line) is used to represent almost no power transmission. Through the above mapping, the larger the active power flow, the thicker the connection. Maintenance personnel can easily identify heavily loaded lines and main transmission channels in the power grid without having to check the labeled values ​​one by one. For example, a line that transmits 350MW has a line width of 8 pixels, while a line that transmits only 50MW has a line width of only 2 pixels.

[0170] Based on the load rate percentage of an edge, the RGB color value of the corresponding connecting element is determined by referring to the preset multi-level color scale. Load rate refers to the ratio of the current active power transmitted by the line to the line's rated transmission capacity, usually expressed as a percentage. The formula for calculating load rate is: Load Rate = (|P_flow| / P_rated) × 100%, where P_flow is the current active power flow of the line (unit: MW), and P_rated is the line's rated transmission capacity (unit: MW). The load rate can be determined as follows: Read the active power measurement point value and rated capacity value of the line from the SCADA system and calculate according to the formula; directly read the load rate field from the power flow calculation section data; or read the "Load Rate" column from the CSV format running data table. The load rate ranges from 0% to 100%, and may exceed 100% (e.g., reaching 120%) under special overload conditions. The multi-level color code design can adopt the color matching logic of traffic lights, conforming to human visual perception habits: Green (RGB: 0, 255, 0): Load rate < 50%, indicating that the line is operating normally and under light load. Yellow (RGB: 255, 255, 0): 50% ≤ Load rate < 75%, indicating that the line is in a heavy load warning state and needs attention. Orange (RGB: 255, 165, 0): 75% ≤ Load rate < 90%, indicating that the line is heavily loaded and needs close attention. Red (RGB: 255, 0, 0): Load rate ≥ 90%, indicating that the line is overloaded or exceeds limits, requiring immediate action.

[0171] The threshold for color coding can be customized according to the safety specifications of the power grid operator. For lines in the "under maintenance" status, they are uniformly displayed as gray dashed lines regardless of the load rate. Through this mapping, lines with higher load rates are more reddish, allowing maintenance personnel to quickly identify lines that require attention and achieve "at-a-glance perception" of their status.

[0172] During rendering, based on the power flow direction represented by the edge, a directional indicator pointing from the sending node to the receiving node is overlaid on the corresponding connecting element. The power flow direction is determined by the positive or negative sign of the active power flow. The directional indicator can be an arrow icon, drawn near the midpoint of the connecting line or close to the receiving node. The power flow direction can be determined as follows: Read the active power flow value P_flow (with positive or negative sign) of the edge. Convention: When P_flow is positive, it indicates that active power flows from node i to node j; when P_flow is negative, it indicates that active power flows from node j to node i (i.e., the power flow direction is opposite to the preset reference direction). Determine the actual sending and receiving nodes based on the sign of the active power flow. If P_flow > 0, the sending node is node i and the receiving node is node j; if P_flow < 0, the sending node is node j and the receiving node is node i. Draw an arrow icon on the connecting line, with the arrow pointing to the receiving node. For longer connecting lines, multiple arrows can be drawn (e.g., three arrows drawn at equal intervals) to enhance the directional indication effect. For lines with active power flow close to zero, no arrow needs to be drawn, indicating that the line transmits almost no power. For lines with bidirectional power flow (i.e., the power flow direction may change with the operating mode), a double arrow or a rotatable arrow design can be used, or a single arrow can be dynamically drawn based on the current real-time power flow direction. Through this mapping, maintenance personnel can intuitively understand the power transmission direction of each line, which is of great significance for identifying power backfeeding, ring network power flow distribution, etc.

[0173] For lines with a load rate exceeding the preset alarm threshold, the corresponding connection elements are highlighted to attract the attention of maintenance personnel. The alarm threshold is the load rate boundary value that triggers alarm rendering; the default value can be set to 80%, meaning that lines with a load rate ≥ 80% trigger an alarm. The alarm threshold can be customized according to the safety specifications of the power grid operator, allowing for different alarm rendering methods for different levels. The alarm threshold can be applied uniformly to all lines, or it can be set separately according to voltage level (e.g., a higher alarm threshold for 500kV lines (90%), and a lower alarm threshold for 110kV lines (70%)).

[0174] During rendering, the connecting elements corresponding to edges with load rates exceeding a preset alarm threshold are highlighted. Specific alarm rendering methods can include one or more combinations of the following: Highlighting: Increase the brightness of the connecting line color by 20% to make it more noticeable in the graphic. Color Changing: Switch the connecting line color from the normal color code to an alarm-specific color (such as flashing red or orange). Pulsating Flashing: Make the color or brightness of the connecting line change periodically at a certain frequency (such as twice per second) to attract the attention of maintenance personnel. Enhanced Labeling: Automatically add load rate labels (such as "85%)" near the connecting line and display them using the alarm color.

[0175] When the load rate is below the alarm threshold for multiple consecutive sampling periods (e.g., 3 periods, 5 seconds per period), it automatically reverts to the normal rendering style. Through alarm rendering, maintenance personnel can identify overloaded or over-limited lines as soon as the power grid load changes, and take timely adjustment measures to avoid equipment damage or large-scale power outages.

[0176] Through semantic rendering, electrical parameters are intuitively mapped into graphical visual attributes, upgrading the power flow diagram from a "static topology diagram" to a "dynamic situation diagram." Maintenance personnel no longer need to examine each data label individually; they can determine load levels by node size, identify heavily loaded lines by line width, judge load status by line color, identify power flow direction by arrows, and identify alarm lines by flashing arrows. This significantly improves the efficiency of fault diagnosis and dispatching decisions while reducing the cognitive burden on maintenance personnel.

[0177] The power flow diagram supports the following interactive functions: zooming and panning (via mouse wheel or gestures), node filtering (filtering display by voltage level or power supply zone), hover display of detailed information (a pop-up window displays complete equipment or line electrical characteristics when the mouse hovers over a node or connection), and automatic legend generation (generating legend descriptions based on the color scale and line width range used in the current rendering). The final graphic can be exported as SVG (Scalable Vector Graphics, supporting subsequent editing), PNG (High-resolution Bitmap, suitable for report insertion), PDF (suitable for printing and archiving), or CIM / G (standard format for dispatch automation systems), etc.

[0178] In some embodiments, the method further includes:

[0179] In response to update events of the power grid topology data and system operation data, determine the subgraph region in the power flow diagram that is associated with the update event;

[0180] The sub-graph region is updated based on the first model and the second model using the updated power grid topology data and system operation data to obtain the updated power flow diagram.

[0181] To adapt to the actual needs of continuous power system operation, frequent equipment switching, and dynamic changes in topology, and to address the technical problems of inefficient and unreal-time performance issues arising from the need to redraw the entire power flow diagram when the power grid topology changes, this method also includes an incremental dynamic update step. This step ensures that when the power grid topology changes or operating parameters change, the system only recalculates and updates the affected local area, without needing to reconstruct the entire power flow diagram. This significantly improves dynamic update efficiency and substantially reduces graphical maintenance costs.

[0182] Update events refer to changes in grid data that trigger the regeneration of the power flow diagram. Update events can include one or more of the following types: New node events: the creation of new substations, buses, load nodes, or distributed generation access points in the grid. The detection method is: the system periodically polls the data source (such as the real-time database of the dispatch automation system), compares the node list at the current time with that at the previous time, and discovers the newly added device identifiers (such as device IDs).

[0183] Node deletion event: Equipment in the power grid is decommissioned, removed, or taken out of operation. The detection method is: compare the node list and find the identifier of the missing equipment.

[0184] New branch event: Newly constructed transmission lines, transformer windings, or tie lines. Detection method: Compare the branch list to identify newly added line identifiers.

[0185] Branch deletion events: line decommissioning, disconnection, or withdrawal from operation. The detection method is: compare the branch list to identify the missing line identifier.

[0186] Node electrical attribute change events: These occur when equipment parameters change, such as voltage level adjustments, capacity changes, or power supply zone re-divisions. The detection method is to compare the electrical attribute fields of devices with the same identifier and identify changes in values ​​or status.

[0187] Branch line electrical parameter change event: The line operating parameters change, such as significant fluctuations in active power flow, exceeding the load limit, or a change in operating status (e.g., from "operating" to "maintenance"). The detection method is to compare the electrical parameter fields of the same line identifier and find that the value or status change exceeds the preset threshold (e.g., the active power flow change rate exceeds 10%).

[0188] Update event detection can be performed by a separate event listener service. This service can subscribe to change notifications from data sources (such as message queues or database triggers), or actively scan data sources and calculate differences at a preset polling interval (such as 5 seconds). When any update event is detected, the event listener service generates an event notification, carrying the identifier of the changed device or line and the change type, and passes it to the subsequent incremental update processing module.

[0189] In response to a detected update event, the system first determines the subgraph region in the power flow graph associated with the update event. A local subgraph region refers to the smallest subgraph area in the power grid attribute graph affected by topology or parameter changes; this subgraph region is the smallest computational unit for incremental updates.

[0190] Different subgraph range determination strategies are used depending on the type of update event:

[0191] When a node is added or deleted, the affected region includes the node itself and all its neighboring nodes (i.e., first-order neighbors directly connected to the node by edges), as well as all edges connecting the node to its neighbors. If the deletion operation involves multiple edges, these edges and their connected neighboring nodes are all included in the affected region. The determination method is as follows: starting from the changed node V_changed, perform a breadth-first search (BFS) with a depth limit of 1 to collect all nodes and edges directly connected to it. For example, when a new 220kV node "Innovation Station" is added and connected to "High-tech Station" and "Science Park Station" via two lines, the affected subgraph region includes "Innovation Station," "High-tech Station," "Science Park Station," as well as the "Innovation Station-High-tech Station" line and the "Innovation Station-Science Park Station" line.

[0192] When an edge is added or deleted, the affected area includes the edge itself and the two endpoints it connects to. Additionally, if the deleted edge is the only connecting edge to a node (causing the node to become isolated), that node is also included in the affected area. The determination method is as follows: take the two endpoints V_a and V_b of edge E_changed, and add V_a, V_b, and E_changed to the subgraph area. Optionally, the first-order neighbors of V_a and V_b are also included to ensure layout continuity. For example, when a new line "Innovation Science and Technology Line 2" connects "Innovation Station" and "Science Park Station," the affected subgraph area includes "Innovation Station," "Science Park Station," and the new line.

[0193] When the electrical attributes of a node (such as voltage level, load power, and power supply zone identifier) ​​change, the affected area includes the node itself. If the attribute change may lead to changes in layout rules (such as a change in voltage level causing a change in vertical hierarchy), then all neighboring nodes of that node also need to be included in the affected area. The determination method is as follows: take the changed node V_changed and add it to the subgraph area; if the attribute change affects the layout (such as a change in voltage level from 110kV to 220kV), then recursively collect all first-order neighboring nodes of V_changed.

[0194] When the electrical parameters of an edge (such as active power flow, load rate, and operating status) change, the affected area only includes the edge itself. This is because parameter changes only affect the visual rendering attributes of the edge (such as line width, color, and arrows), and do not affect the layout coordinates of the nodes. The determination method is as follows: add the changed edge E_changed to the subgraph region; the end nodes V_a and V_b are only used as rendering reference points and do not require recalculation of layout coordinates. For example, when the load rate of the "Innovation-Science Park" line increases from 70% to 85%, only the color (changing from orange to red) and line width (possibly with minor adjustments) of the line need to be recalculated; the coordinates of any nodes do not need to be moved.

[0195] To ensure seamless integration of the updated subgraph region with the unchanged global layout, the bounding box of the subgraph region needs to be determined. The bounding box is the smallest rectangle covering the coordinates of all nodes within the subgraph region, represented in normalized coordinate space as [min_x, min_y, max_x, max_y]. The bounding box is extended outwards by a preset margin (e.g., a normalized distance of 0.05) to ensure that nodes at the region's edge have sufficient space for adjustment. The coordinates of nodes located outside the bounding box in the original global layout remain unchanged.

[0196] By accurately identifying the affected local subgraph regions, computational redundancy caused by full graph reconstruction is avoided. For common changes in operating parameters (such as changes in load rate), only the edge itself needs to be re-rendered, with processing time in the millisecond range. For topology changes (such as adding nodes), only the changed node and its neighbors are rearranged, with a computational load far less than full graph recalculation, improving update speed by more than an order of magnitude.

[0197] Extract the subgraph data corresponding to this region from the global power grid attribute map. The subgraph data includes all nodes within the region (including node identifiers, equipment electrical characteristics, and target layout coordinates), all edges (including edge identifiers, line electrical characteristics, and connection relationships), and boundary conditions. Boundary conditions refer to the node coordinates on the boundary of the subgraph region. These coordinates are fixed to their original values ​​during the update process and serve as anchor points for the internal layout of the subgraph.

[0198] The updated power grid topology data and system operation data are integrated into the extracted subgraph data. Specifically:

[0199] For new nodes, create new node objects and perform preprocessing marking based on power knowledge rules (marking vertical layout level, marking the block identifier, etc.) according to their electrical characteristics (voltage level, power supply zone identifier, etc.). For new branches, create new edge objects and calculate and mark the electrical distance based on their line electrical characteristics (branch impedance, active power flow, etc.). For deleted nodes or branches, remove the corresponding objects from the subgraph data. For nodes or branches with changed attributes, update their corresponding electrical characteristics or electrical parameter fields.

[0200] The updated subgraph data is input into the first model (as shown in the convolutional network model) and the second model (as shown in the attention network model). Coordinate prediction is re-performed only for nodes within that subgraph region. The first model (GCN) extracts the global topological features of the subgraph and generates the initial layout coordinates for each node within the subgraph. The second model (GAT), based on the attention mechanism and electrical features, optimizes and adjusts the initial layout coordinates, outputting the target layout coordinates for each node within the subgraph.

[0201] During the re-prediction process, it is necessary to keep the node coordinates on the subgraph boundary unchanged (i.e., fixed to the coordinate values ​​in the original global layout) as anchor points for the internal layout of the subgraph. This constraint can be achieved by adding a boundary constraint loss term L_boundary = Σ_{i∈boundary_nodes} ||p'_i - p_i|| to the loss function. , where p'_i are the boundary node coordinates predicted by the model, and p_i are the original fixed boundary node coordinates. By applying boundary constraints, it is ensured that the updated subgraph can be seamlessly stitched with the original graph.

[0202] A four-stage constraint layout optimization (hierarchical partitioning, region segmentation, point constraint generation, collision avoidance, and regularization optimization) is performed on the re-predicted layout coordinates, but the optimization scope is limited to the subgraph region. During the optimization process, the coordinates of the boundary nodes remain fixed, and the optimization algorithm adjusts the positions of the internal nodes under the constraints of the boundary nodes. The optimized subgraph region is then stitched into the unchanged global layout according to the corresponding positions of the bounding boxes. The stitching process is as follows: For nodes within the subgraph region, the original coordinates are replaced with the newly predicted target layout coordinates. For edges within the subgraph region, the old connection paths are deleted, and the connection paths are replanned according to the new coordinates. For cross-boundary connections (i.e., connections with one end within the subgraph region and the other end outside the subgraph region), the coordinates of the outer endpoint remain unchanged, and only the connection path from the boundary of the subgraph region to the outer endpoint is replanned to ensure a smooth connection with the external graphics. Semantic rendering is performed on the updated subgraph region to generate updated graphic elements, and the display area is refreshed. For unchanged graphic regions, the original rendering results remain unchanged, and no redrawing is performed. This incremental rendering method can significantly reduce the computational load of graphics rendering.

[0203] This embodiment utilizes local re-prediction and seamless stitching to enable the system to respond to changes in power grid topology with minimal computational cost. For scenarios involving the addition of a new substation and its connecting lines, the system only needs to recalculate the layout coordinates of the substation and its neighboring nodes (typically 2-5 nodes), while the coordinates of the existing hundreds of nodes remain unchanged. In the updated graph, the newly added equipment is correctly displayed, and the original layout structure is fully preserved, avoiding visual abrupt changes and cognitive confusion caused by full-map reconstruction.

[0204] After completing the partial update and stitching, an updated complete power flow diagram is generated. This diagram can be pushed to the dispatch dashboard, operation and maintenance terminal, or mobile monitoring application in real time, allowing operation and maintenance personnel to view the latest grid topology and operating status. Optionally, the system can generate a change log, recording information such as the area involved in this update, the type of change, and the processing time, for use in operation and maintenance auditing and performance analysis.

[0205] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0206] Based on the same inventive concept, this application also provides a power flow diagram generation apparatus for implementing the power flow diagram generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more power flow diagram generation apparatus embodiments provided below can be found in the limitations of the power flow diagram generation method described above, and will not be repeated here.

[0207] In one exemplary embodiment, such as Figure 3 As shown, a power flow diagram generation device 300 is provided, comprising:

[0208] The acquisition module 302 is used to acquire the power grid topology data and system operation data of the power system, and construct the power grid attribute map of the power system based on the power grid topology data and system operation data; the power grid attribute map includes multiple nodes representing power equipment, edges representing power lines, the equipment electrical characteristics of the power equipment, and the line electrical characteristics of the power lines;

[0209] The first input module 304 is used to input the power grid attribute map into the first model to obtain the global topological features of the power grid attribute map and the initial layout coordinates of each node in the power flow diagram to be generated;

[0210] The second input module 306 is used to input the initial layout coordinates of each node and the power grid attribute diagram into the second model, so that the second model can adjust the initial layout coordinates based on the attention mechanism to obtain the target layout coordinates of each node in the power flow diagram to be generated.

[0211] The rendering module 308 is used to visualize and render the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute diagram based on the electrical characteristics of the equipment and the electrical characteristics of the line, so as to obtain the power flow diagram corresponding to the power system.

[0212] Each module in the aforementioned power flow diagram generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0213] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a power flow diagram generation method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0214] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0215] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps included in any of the foregoing method embodiments.

[0216] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps included in any of the foregoing method embodiments.

[0217] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps included in any of the foregoing method embodiments.

[0218] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0219] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-accessible storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0220] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0221] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for generating power flow diagrams, characterized in that, The method includes: The power grid topology data and system operation data of the power system are acquired, and a power grid attribute graph of the power system is constructed based on the power grid topology data and system operation data. The power grid attribute graph includes multiple nodes representing power equipment, edges representing power lines, the electrical characteristics of the power equipment, and the electrical characteristics of the power lines. The power grid attribute graph is input into the first model to obtain the global topological features of the power grid attribute graph and the initial layout coordinates of each node in the power flow graph to be generated; The initial layout coordinates of each node and the power grid attribute graph are input into the second model, so that the initial layout coordinates are adjusted by the second model based on the attention mechanism to obtain the target layout coordinates of each node in the power flow graph to be generated. Based on the electrical characteristics of the equipment and the electrical characteristics of the line, the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute diagram are visualized and rendered to obtain the power flow diagram corresponding to the power system.

2. The method according to claim 1, characterized in that, The first model includes a graph convolutional network model; the second model includes a graph attention network model; the loss function of the graph convolutional network model and the graph attention network model includes a topology constraint loss term and / or an overlap constraint loss term; wherein, the topology constraint loss term is used to make the coordinate distance between the target layout coordinates of nodes that are directly connected by edges in the power grid attribute graph positively correlated with the electrical distance between the nodes that are directly connected by edges; The overlap constraint loss term is used to penalize cases where the coordinate distance between the target layout coordinates of any two nodes is less than the minimum spacing threshold. The step of inputting the initial layout coordinates of each node and the power grid attribute graph into the second model, and adjusting the initial layout coordinates through the second model based on an attention mechanism to obtain the target layout coordinates of each node in the power flow graph to be generated, includes: The graph attention network model calculates the attention weights between neighboring nodes based on the power grid attribute graph using the attention mechanism. The graph attention network model adjusts the initial layout coordinates according to the attention weights to obtain the target layout coordinates of each node.

3. The method according to claim 1, characterized in that, Before inputting the power grid attribute graph into the first model to obtain the global topological features of the power grid attribute graph and the initial layout coordinates of each node in the power flow graph to be generated, the process includes: For each node, based on the voltage level of the power equipment represented by the current node, the current node is marked in the power grid attribute diagram as the target vertical arrangement level in the power flow diagram; Based on the power supply zone identifier of the current node, mark the area block identifier to which the current node belongs in the power grid attribute map; Based on the branch impedance and / or active power flow between the nodes, mark the electrical distance between each pair of connected nodes in the power grid attribute diagram; Based on the power grid topology data, the primary / backup relationship and power supply path relationship between each node are identified and marked in the power grid attribute diagram.

4. The method according to claim 3, characterized in that, The step of inputting the initial layout coordinates of each node and the power grid attribute graph into the second model, and adjusting the initial layout coordinates through the second model based on an attention mechanism to obtain the target layout coordinates of each node in the power flow graph to be generated, includes: Obtain the voltage level of each node, and divide the target layout coordinates of nodes belonging to the same voltage level threshold into the same vertical level; Obtain the power supply zone identifier of each node, and aggregate the target layout coordinates of nodes belonging to the same power supply zone into the same area block. The interval between nodes within the same area block is smaller than the interval between different area blocks. Overlap detection is performed on the target layout coordinates of all node pairs, the positions of overlapping node pairs are adjusted, and the nodes are center-aligned.

5. The method according to claim 1, characterized in that, The electrical characteristics of the equipment include at least one of the following: equipment name, equipment type, voltage level, power supply zone identifier, active power, reactive power, load power, and power generation; the electrical characteristics of the line include at least one of the following: line name, line impedance, line length, active power flow, reactive power flow, load rate, and operating status. The step of visually rendering the target layout coordinates and the connection relationships between nodes and edges in the power grid attribute diagram based on the electrical characteristics of the equipment and the electrical characteristics of the line to obtain the power flow diagram corresponding to the power system includes: An orthogonal wiring algorithm is used to plan a polyline connection path consisting of horizontal and vertical line segments for each edge; during path planning, obstacle avoidance is performed to ensure that the connection lines bypass node icons and other connections. Perform polyline smoothing or differentiated line type labeling on the connection between voltage levels; With the goal of reducing the connection crossover rate, the connection coordinates or connection directions of the connection crossover areas in the power flow diagram are adjusted; The electrical characteristics of the equipment and the electrical characteristics of the lines are mapped to visual attributes in a visualization graphic to obtain the power flow diagram.

6. The method according to claim 5, characterized in that, The process of mapping the electrical characteristics of the equipment and the electrical characteristics of the lines into visual attributes in a visualization graphic to obtain the power flow diagram includes: The display area of ​​the icon element corresponding to the node is determined based on the load power of the node; the display area is positively correlated with the load power. The pixel width of the connecting element corresponding to the edge is determined based on the active power flow value of the edge; the active power flow value is positively correlated with the line thickness of the connecting line. The color value of the connecting element corresponding to the edge is determined based on the load percentage of the edge; Based on the power flow direction of the line represented by the edge, a direction identifier from the sending node to the receiving node is superimposed on the connecting element corresponding to the edge. For edges whose load rate exceeds the preset alarm threshold, the corresponding connecting elements are highlighted.

7. The method according to claim 1, characterized in that, The method further includes: In response to update events of the power grid topology data and system operation data, determine the subgraph region in the power flow diagram that is associated with the update event; The sub-graph region is updated based on the first model and the second model using the updated power grid topology data and system operation data to obtain the updated power flow diagram.

8. A power flow diagram generation device, characterized in that, The device includes: The acquisition module is used to acquire the power grid topology data and system operation data of the power system, and construct the power grid attribute map of the power system based on the power grid topology data and system operation data; the power grid attribute map includes multiple nodes representing power equipment, edges representing power lines, the electrical characteristics of the power equipment, and the electrical characteristics of the power lines; The first input module is used to input the power grid attribute map into the first model to obtain the global topological features of the power grid attribute map and the initial layout coordinates of each node in the power flow diagram to be generated. The second input module is used to input the initial layout coordinates of each node and the power grid attribute diagram into the second model, so that the second model can adjust the initial layout coordinates based on the attention mechanism to obtain the target layout coordinates of each node in the power flow diagram to be generated. The rendering module is used to visualize and render the target layout coordinates and the connection relationship between nodes and edges in the power grid attribute diagram based on the electrical characteristics of the equipment and the electrical characteristics of the line, so as to obtain the power flow diagram corresponding to the power system.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.