Method, device and medium for generating initial layout of power distribution network substation connection diagram
By generating a hierarchical tree through topological layering and adjacency lists, and placing nodes layer by layer, the problem of complex layout and increased number of intersections in the interconnection diagram of distribution network substations in existing technologies is solved, achieving a clear initial layout and efficient graph generation effect.
Patent Information
- Application Number
- CN202611296870.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies have several drawbacks when generating substation interconnection diagrams for distribution networks. These include a large number of nodes, complex topology leading to poor layout results, increased number of intersections, inability to reflect the hierarchical relationship between the main substation and surrounding substations, and inability to properly place special elements. Furthermore, they are prone to getting stuck in local optima.
A hierarchical tree is generated using topological layering and adjacency lists. Nodes are sorted according to subtree weights and connected components, and nodes are placed layer by layer. An initial layout is generated through expansion detection and fine-tuning to ensure spatial adjacency between nodes and a clear topological structure.
An initial layout that conforms to the power grid topology, is non-overlapping, and has clear semantics was generated, providing reliable input for subsequent optimization algorithms, improving mapping efficiency and avoiding local optima.
Smart Images

Figure CN123179618A_ABST
Abstract
Description
Technical Field
[0001] This application relates to, but is not limited to, the field of automatic generation technology of power distribution network graphics, and particularly to the method, equipment and medium for generating the initial layout of substation interconnection diagrams of power distribution networks. Background Technology
[0002] As an important tool for describing the structure of the distribution network, the distribution network interconnection diagram provides an intuitive and user-friendly visualization for distribution network control, operation and maintenance and planning. However, the overlapping and complex structure of the distribution network makes it difficult to draw the distribution network interconnection diagram.
[0003] Existing technologies based on force-oriented methods utilize force simulation and interaction principles to conduct node layout, which can be used to achieve efficient power grid topology design. By calculating the graphical coordinates of power grid nodes, force-oriented models are used to balance the node layout and generate a graph. However, when the complexity of the distribution network structure increases, the layout effect has limitations. Furthermore, since it is difficult to avoid line crossings in the distribution network, the number of crossings increases with the size of the interconnection graph. Therefore, with minimizing the number of crossings as the objective function, an optimization calculation method that comprehensively considers attraction, repulsion, gravity, and inertia is proposed to iteratively calculate all nodes in the graph. However, with the expansion of the power grid, the number of substations and their interconnections have become increasingly complex. Directly using force-oriented layout has the following problems: When there are many nodes and the topology has a center-radial characteristic, random initial positions require a large number of iterations to reveal the basic structure, resulting in extremely slow convergence; Force-oriented is a greedy physical simulation, which is prone to problems such as node overlap and severe edge crossing in mesh topologies, and cannot escape by continuing to iterate, thus getting trapped in local optima; It cannot reflect the hierarchical relationship between the main substation and the surrounding substations in the distribution network, as well as the radial power supply characteristics, resulting in the loss of topological semantics; When facing special elements such as tie switches and multi-directional virtual nodes in the tie diagram, it is still impossible to give reasonable spatial positions in the initial stage, and the number of crossings increases linearly with the size of the tie diagram. Summary of the Invention
[0004] The method, equipment, and medium for generating the initial layout of the distribution network substation interconnection diagram provided in this application embodiment can generate an initial layout that conforms to the power grid topology, is structurally clear, non-overlapping, and semantically explicit. This provides reliable input for subsequent force-oriented layout or other optimization algorithms, thereby improving the mapping effect while also taking into account mapping efficiency and avoiding getting trapped in local optima.
[0005] In a first aspect, embodiments of this application provide an initial layout generation method for a distribution network substation interconnection diagram, applied to an automatic power grid mapping system. The undirected graph adjacency list corresponding to the topology structure built into the automatic power grid mapping system includes substations, and the substations include main substations. The method includes: Starting from the main substation of the power grid, the undirected graph adjacency list is traversed to perform topological layering, resulting in a hierarchical tree and the subtree weights of each node in the hierarchical tree. Each level of the hierarchical tree is sorted according to the sum of the weights of the subtrees at that level, and the tree nodes within each level are identified based on adjacency relationships, and sorted according to the connected components and the subtree weights to obtain sorted nodes, wherein the sorted nodes include a first node and a second node. With the main substation placed at the center of the initial canvas, the first nodes of the level directly connected to the main substation are proportionally allocated within the preset angle range corresponding to the main substation according to the subtree weight of each first node to obtain a first sector, and the location of the first node is determined based on the first sector and the preset base radius. For the second node in the next level, determine that the second node is located in the parent node of the previous level. Determine the first range based on the angle range occupied by other nodes in the same level of the parent node. Within the first range, combine the subtree weight of the second node and the dynamic spacing corresponding to the level to determine the position of the second node. Repeat this process level by level until all sorted nodes in all levels are placed to obtain the first layout. The first layout node of the first layout is expanded and fine-tuned to obtain the second layout, and the second layout is aligned and regularized to obtain the initial layout.
[0006] Secondly, an electronic device provided according to an embodiment of this application includes: At least one processor; At least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the method for generating the initial layout of the distribution network substation interconnection diagram according to any one of the first aspects is implemented.
[0007] Thirdly, according to the embodiments of the application, a computer-readable storage medium is provided, storing computer-executable instructions, which are used to execute the initial layout generation method for the distribution network substation interconnection diagram as described in any of the first aspects.
[0008] In summary, the method for generating the initial layout of the distribution network substation interconnection diagram according to the above embodiments of this application includes: Starting with the main substation of the power grid, the undirected graph adjacency list is traversed to perform topological layering, obtaining a hierarchical tree and the subtree weights of each node in the hierarchical tree. Each level of the hierarchical tree is sorted according to the sum of the subtree weights of that level. Within each level, tree nodes are identified based on adjacency relationships, and then sorted according to the connected components and their subtree weights to obtain sorted nodes, which include first and second nodes. With the main substation placed at the center of the initial canvas, the first nodes of the levels directly connected to the main substation are proportionally distributed within a preset angle range corresponding to the main substation according to the subtree weights of each first node. The process begins by obtaining the first sector and determining the location of the first node based on the first sector and a preset base radius. For the second node at the next level, the process involves determining the parent node of the second node at the previous level and defining a first range based on the angle range occupied by other nodes at the same level as the parent node. Within this first range, the location of the second node is determined by combining the subtree weight of the second node with the dynamic spacing corresponding to the level. This process is repeated level by level until all sorted nodes at all levels are placed, resulting in the first layout. The first layout nodes of the first layout are then subjected to expansion detection and fine-tuning to obtain the second layout. Finally, the second layout is aligned and regularized to obtain the initial layout.The hierarchical tree in this embodiment can represent the topological level, parent node relationship, child node relationship, and subtree weight of each tree node relative to the main substation, and the subtree weight reflects the size of the subtrees under that node. Based on this, each level of the hierarchical tree is sorted according to the sum of the subtree weights of that level, and the tree nodes within each level are identified based on adjacency relationships, and sorted according to the connected components and subtree weights to obtain sorted nodes. Subsequent placement of these sorted nodes ensures that topologically connected nodes are also spatially adjacent, with edges between nodes only needing to cross adjacent angle intervals, effectively reducing edge crossings and intersections. Next, utilizing the characteristic that subtree weights reflect the size of the subtrees under that node, the preset angle range corresponding to the main substation is proportionally allocated according to the subtree weights of each first node to obtain the first sector. This allows nodes with larger weights to obtain wider sectors, providing sufficient space for lower-level nodes and avoiding crowding and overlap in densely populated areas. Then, the parent node of the second node at the previous level is determined, and the area occupied by other nodes placed at the previous level (excluding the parent node) is calculated. The first range is obtained by avoiding the angle range of the parent node, thus ensuring that the child nodes of each parent node (the child node is the second node) are strictly constrained to be allocated within the angle sector of the parent node. This fundamentally avoids the overlap and confusion of node positions between different branches. Then, the first range is divided proportionally according to the subtree weight of the second node. Next, the target radius is determined by combining the dynamic spacing corresponding to the level, and then the position of the second node is determined. This process is repeated level by level until all sorted nodes at all levels are placed, resulting in the first layout. In this way, the first layout reflects the hierarchical depth, primary and secondary relationships, and adjacency associations of the power grid topology, while avoiding the problem of overlapping and confusion of node positions between different branches. Finally, the node overlap that may be caused by the difference in primitive size in the first layout is eliminated by expansion detection and fine-tuning. Then, the nodes of the same level are arranged neatly in the radial direction through alignment and regularization. Finally, an initial layout that conforms to the power grid topology, has a clear structure, no overlap, and clear semantics is obtained. This provides reliable input for subsequent force-oriented layout or other optimization algorithms, thereby improving the mapping effect and mapping efficiency while avoiding getting trapped in local optima. Attached Figure Description
[0009] Figure 1 This is a flowchart illustrating the steps of an embodiment of the present application for generating an initial layout of a substation interconnection diagram for a power distribution network; Figure 2 This is a general flowchart of an embodiment of the present application providing a method for generating an initial layout of a substation interconnection diagram for a power distribution network; Figure 3 This is a schematic diagram of node classification provided in one embodiment of this application; Figure 4 This is a schematic diagram illustrating the construction of adjacency relationships according to an embodiment of this application; Figure 5 This application provides a schematic diagram of BFS layering and hierarchical tree construction in one embodiment; Figure 6 This application provides a schematic diagram of recursive angle sector allocation in one embodiment; Figure 7 This is a schematic diagram illustrating the constraint of the outer radiation sector and the maximum deployment angle limitation in one embodiment of this application; Figure 8 This application provides a schematic diagram of same-layer angle collision in one embodiment; Figure 9 This application provides a schematic diagram of collision between bounding boxes on the same layer, as one embodiment of the application. Figure 10 This application provides a schematic diagram of cross-layer boundary box collision in one embodiment; Figure 11 This application provides a schematic diagram comparing the optimization of a terminal substation before and after one embodiment. Figure 12 This application provides a schematic diagram of the layout of a handshake switch according to one embodiment; Figure 13 This application provides a schematic diagram of a multi-directional virtual node layout according to one embodiment; Figure 14 This application provides a schematic diagram comparing the canvas before and after dynamic adjustment, as shown in one embodiment. Figure 15 This application provides a typical distribution network substation interconnection diagram as one embodiment; Figure 16 This application provides a schematic diagram of a complex ring network with multiple parent nodes as one embodiment; Figure 17 This application provides a schematic diagram of a large-scale adaptive layout for a power distribution network, based on one embodiment. Figure 18 This is a hardware schematic diagram of an electronic device provided in one embodiment of this application. Detailed Implementation
[0010] 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.
[0011] It is understandable that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, or the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0012] As an important tool for describing the structure of the distribution network, the distribution network interconnection diagram provides an intuitive and user-friendly visualization for distribution network control, operation and maintenance and planning. However, the overlapping and complex structure of the distribution network makes it difficult to draw the distribution network interconnection diagram.
[0013] Existing technologies based on force-oriented methods utilize force simulation and interaction principles to conduct node layout, which can be used to achieve efficient power grid topology design. By calculating the graphical coordinates of power grid nodes, force-oriented models are used to balance the node layout and generate a graph. However, when the complexity of the distribution network structure increases, the layout effect has limitations. Furthermore, since it is difficult to avoid line crossings in the distribution network, the number of crossings increases with the size of the interconnection graph. Therefore, with minimizing the number of crossings as the objective function, an optimization calculation method that comprehensively considers attraction, repulsion, gravity, and inertia is proposed to iteratively calculate all nodes in the graph. However, with the expansion of the power grid, the number of substations and their interconnections have become increasingly complex. Directly using force-oriented layout has the following problems: When there are many nodes and the topology has a center-radial characteristic, random initial positions require a large number of iterations to reveal the basic structure, resulting in extremely slow convergence; Force-oriented is a greedy physical simulation, which is prone to problems such as node overlap and severe edge crossing in mesh topologies, and cannot escape by continuing to iterate, thus getting trapped in local optima; It cannot reflect the hierarchical relationship between the main substation and the surrounding substations in the distribution network, as well as the radial power supply characteristics, resulting in the loss of topological semantics; When facing special elements such as tie switches and multi-directional virtual nodes in the tie diagram, it is still impossible to give reasonable spatial positions in the initial stage, and the number of crossings increases linearly with the size of the tie diagram.
[0014] Based on this, the method, equipment, and medium for generating the initial layout of the distribution network substation interconnection diagram provided in this application embodiment can generate an initial layout that conforms to the power grid topology, is structurally clear, non-overlapping, and semantically explicit, providing reliable input for subsequent force-oriented layout or other optimization algorithms. This allows for improving the mapping effect while maintaining mapping efficiency and avoiding getting trapped in local optima.
[0015] This application provides an initial layout generation method for a distribution network substation interconnection diagram, applied to an automatic power grid mapping system. The undirected graph adjacency list corresponding to the built-in topology of the automatic power grid mapping system includes substations, and the substations include main substations. (Refer to...) Figure 1 and Figure 2 As shown, the method includes, but is not limited to, the following steps: Step S100: Starting from the main substation of the power grid, traverse the adjacency list of the undirected graph to perform topological layering, and obtain the hierarchical tree and the subtree weights of each tree node in the hierarchical tree. It is understandable that the tie line between any two substations is equivalent to both, enabling bidirectional load transfer. This means the electrical connections between substations in a distribution network are bidirectional and equal, making an undirected graph suitable for describing its topology. Furthermore, each substation is directly connected to only a few other substations, not mutually exclusive; thus, the distribution network is a typical sparse graph. Therefore, an adjacency list is used to record only existing edges, and during breadth-first search traversal, all neighbors of any given node can be directly retrieved. Based on this, a breadth-first search is performed starting from the main substation. The topology is layered according to the connection relationship between nodes, and the topological relationship between nodes is transformed into a hierarchical tree structure with depth, level, and parent-child relationship. The level determines the radius of the concentric circle in which each node is located in the layout, the parent node relationship determines the orientation of the child node's angle sector, and the subtree weight calculated based on the parent-child relationship determines the proportion of space obtained by each node in the angle sector allocation. This allows the subsequent sector allocation and node placement to proceed in an orderly manner, thus providing a data foundation for the subsequent initial layout to have topological semantics.
[0016] For example, an adjacency list for an undirected graph can be constructed through the following steps: I. Obtain the power grid topology. The topology data includes: a set of key nodes, a set of edges, and a set of channels. The set of key nodes includes substations, virtual nodes, tie switches, and channels. Substations include main substations and sub-substations. The set of edges represents the connections between nodes. Each channel in the channel set contains a virtual node and a list of connected substation IDs, representing the connections between nodes.
[0017] II. Reference Figure 3 As shown, based on the type of nodes and the number of substations they connect to, the topology data is divided into the following four categories: ① Main Substation: The node of type STATION that connects to the most substations; ② Sub Substations: Nodes of type STATION that are not main substations; ③ Multi-Connection Virtual Nodes: Virtual nodes that are associated with at least 3 substations through a channel; ④ Contact Switches: Connecting nodes between two substations.
[0018] III. Reference Figure 4As shown, the main substation, all substations, and all multi-directional virtual nodes are used as vertices of the graph. An undirected graph adjacency list is initialized, and the channels are traversed. When a channel connecting only two substations is encountered, a bidirectional adjacency relationship is established between the two substations. When a channel connecting at least three substations is encountered, a bidirectional adjacency relationship is established between the multi-directional virtual node and each substation. This process continues until all channels have been traversed, and an undirected graph adjacency list is generated.
[0019] In some embodiments, the topology further includes multi-directional virtual nodes, which connect at least three substations. Each substation also includes sub-substations. Starting from the main substation of the power grid, the topology is layered by traversing the adjacency list of the undirected graph to obtain a hierarchical tree and the subtree weights of each node in the hierarchical tree, including: Starting from the main substation, a breadth-first search is used to traverse the adjacency list of the undirected graph to perform topological layering, resulting in a hierarchical tree. The tree nodes of the hierarchical tree include the main substation, substations, and multi-directional virtual nodes. Tree nodes are divided into leaf nodes and non-leaf nodes based on whether they have child nodes; For any leaf node, take the larger value between the preset subtree weight and the parent node of the leaf node as the subtree weight of the leaf node. Recursively process each non-leaf node from bottom to top, accumulating the subtree weights of all child nodes of the non-leaf node, and then multiplying by the sum of the number of parent nodes of the non-leaf node to obtain the subtree weight of the non-leaf node, until all leaf nodes and non-leaf nodes have been traversed.
[0020] For example, refer to Figure 5 As shown, starting from the main substation, a standard breadth-first search is used to traverse the adjacency list of the undirected graph: Starting from the main substation with a level of -1, the current node in the queue is retrieved sequentially, and all its neighbors are traversed: For the first visited neighbor, its level is set to the current node's level plus 1, the current node is recorded as its parent node, and it is added to the queue; for a visited neighbor whose level is exactly equal to the current node's level plus 1, it means there is another path of equal length that can reach it, and the current node is appended as its parent node, forming a multi-parent node record; for a visited neighbor whose level is lower than the current node's level plus 1, it is determined as a back edge and is directly ignored. This process continues to generate a hierarchical tree, where the tree nodes include the main substation, substations, and multi-directional virtual nodes.
[0021] For example, the subtree weight reflects the size of the subtrees under the node and is used to determine the sector size during subsequent angular sector allocation. The subtree weight of each tree node is calculated in a bottom-up manner: the tree node is divided into leaf nodes and non-leaf nodes based on whether it has child nodes; for leaf nodes, the base weight of the leaf node is 1, and multiplied by the number of parent nodes as an additive factor to obtain the subtree weight of the leaf node, i.e., subtreeWeight = max(1,parentCount); for non-leaf nodes, the base subtree size of the non-leaf node is obtained by adding the preset subtree weight and the sum of the subtree weights of all child nodes of the non-leaf node, and the larger value between the number of parent nodes of the non-leaf node and the preset subtree weight is taken, and the base subtree size is multiplied by the larger value to obtain the subtree weight of the non-leaf node, i.e., (1 + ΣsubtreeWeight(child)) × max(1, parentCount).
[0022] Understandably, for nodes with multiple parent trees, which are more important in the topology due to their connection to multiple branches, higher weights are given when calculating subtree weights to ensure they are not easily pushed away in scenarios such as collision detection.
[0023] In this way, the topological hierarchy, parent node relationship, child node relationship, and subtree weight of each substation or multi-directional virtual node relative to the main substation can be determined.
[0024] Step S200: Sort each level of the hierarchical tree according to the sum of the weights of the subtrees at that level, and identify the connected components of the tree nodes in each level based on the adjacency relationship, and sort them according to the connected components and the weights of the subtrees to obtain sorted nodes, wherein the sorted nodes include the first node and the second node.
[0025] Considering that the initial layout of this application is a star-shaped layout centered on the main substation, nodes at the same level are arranged in an arc or a unit shape around the parent node, with each node occupying an angle interval on the arc. If two topologically connected nodes are assigned to positions far apart on the arc, their connection will act like a string spanning the entire sector, causing numerous intersections with other edges, resulting in visual clutter and severely reducing the readability of the layout. Therefore, this embodiment sorts each level according to the sum of the weights of its subtrees. Then, it extracts the adjacency relationships within the same level from the adjacency relationships, uses BFS to find all connected components (i.e., communities), and aggregates topologically coupled nodes into the same community, ensuring they are adjacent to each other when assigning angles. Within a community, the node with the largest weight is used as the central starting point, and the network expands bidirectionally towards the head and tail, prioritizing extension towards the side with the larger weight each time, so that the node weight naturally decreases from the center to both sides, forming a clear primary and secondary hierarchy. Communities are arranged from largest to smallest in total weight, ensuring that larger communities occupy more ample angle sectors. In this way, nodes that are connected topologically are also adjacent in space. The edges between nodes only need to cross adjacent angle intervals to become short edges, thereby effectively reducing the crossing and intersection of edges, making the overall layout present a clear structure, distinct layers, and stable main structure. At the same time, the first and second nodes generated by the sorting also naturally define the angular sector boundaries of each community, which facilitates the subsequent allocation of angle intervals.
[0026] Step S300: With the main substation placed at the center of the initial canvas, the first node of the layer directly connected to the main substation is proportionally allocated within the preset angle range corresponding to the main substation according to the subtree weight of each first node to obtain the first sector. The location of the first node is determined based on the first sector and the preset base radius.
[0027] Understandably, referring to Figure 6 As shown, nodes with high weights have large subtrees and many child nodes, requiring more angular space to expand their subordinate nodes. This embodiment utilizes subtree weights to reflect the size of the subtrees under a given node. The first sector is obtained by proportionally allocating the preset angular range corresponding to the main substation according to the subtree weights of each first node. This allows nodes with high weights to obtain wider sectors, providing ample space for subordinate nodes and avoiding congestion and overlap in densely populated areas. Simultaneously, it makes important nodes visually occupy more prominent positions and wider expansion areas, naturally guiding the user's gaze to key parts of the topology. This achieves a balance between topological importance and visual salience, improving readability.
[0028] For example, the main substation is placed near the center of the canvas, specifically at the location: centerX = canvasWidth (initial total canvas width) / 2.0 + 100, centerY = canvasHeight (initial total canvas height) / 2.0. The first node of the layer directly connected to the main substation is set as a Level-0 node, and its placement steps are as follows: Calculate the sum of the subtree weights of all Level-0 nodes (totalWeight); Calculate the preset angle range availableRange corresponding to the main substation, formed by the start angle (startAngle) and end angle (endAngle) configured by the system; Traverse each Level-0 node sequentially, allocate the sector size according to its subtree weight ratio, and obtain the first sector; Take the center angle of the first sector, and combine it with the preset base radius of Level-0 (radius = baseRadius), calculate the node coordinates of the first node: x = centerX + radius × cos(angle), y = centerY + radius × sin(angle). Here, sectorPadding is the inter-sector padding angle, used to prevent overlapping of adjacent node boundaries.
[0029] Step S400: For the second node of the next level, determine that the second node is located in the parent node of the previous level. Determine the first range based on the angle range occupied by other nodes in the same level of the parent node. Within the first range, combine the subtree weight of the second node and the dynamic spacing corresponding to the level to determine the position of the second node. Repeat this process level by level until all sorted nodes of all levels are placed to obtain the first layout.
[0030] Understandably, referring to Figure 6As shown, in this embodiment, the second node is first determined to be the parent node of the previous level. Then, the angle range occupied by other nodes placed in the previous level besides the parent node is calculated, and this angle range is avoided to obtain the first range. That is, the child nodes of each parent node (the child node is the second node) are strictly constrained to be allocated within the angle sector of the parent node. The sector of the child node is a subset of the sector of the parent node. That is, from the root to the leaf, the angle range of the node is gradually narrowed and subdivided. Nodes at any depth will not exceed the expansion area of their ancestor nodes in terms of angle, which fundamentally avoids the overlap and confusion of node positions between different branches. Then, the first range is divided proportionally according to the subtree weight of the second node. Then, the target radius is determined by combining the dynamic spacing corresponding to the level, and then the position of the second node is determined. This is recursively applied level by level until all sorted nodes at all levels are placed to obtain the first layout. In this way, the first layout reflects the hierarchical depth, primary and secondary relationships and adjacency associations of the power grid topology, while avoiding the problem of overlapping and confusion of node positions between different branches.
[0031] For example, for nodes with a level greater than 0, a layer-by-layer strategy is adopted to calculate the child node sector immediately after the parent node is placed: starting from Level-0, nodes are placed layer by layer; after all nodes in the current layer are placed, the child nodes of each newly placed node are calculated, which is the first range of the second node; within the first range, the child nodes are allocated sectors according to the subtree weight ratio; the next layer node is placed at the center angle of the sector allocated by its parent node, with a radius of baseRadius + level × levelSpacing.
[0032] For example, the dynamic spacing is adaptively calculated based on the maximum level and available space: availableRadius = min(canvasWidth, canvasHeight) / 2.0 - margin (reserved margin), levelSpacing = max(minLevelSpacing, (availableRadius - baseRadius) / maxLevel). Where baseRadius is the radius of the Level-0 node, and minLevelSpacing is the configured minimum level spacing.
[0033] Step S500: Perform expansion detection and fine-tuning on the first layout nodes of the first layout to obtain the second layout, and align and regularize the second layout to obtain the initial layout.
[0034] For example, by using dilation detection and fine-tuning to eliminate node overlap that may occur in the first layout due to differences in primitive size, and then by alignment and regularization to make nodes of the same level arranged neatly in the radial direction, an initial layout that conforms to the power grid topology, has a clear structure, no overlap, and clear semantics is finally obtained. This provides reliable input for subsequent force-oriented layout or other optimization algorithms, thereby improving the mapping effect while taking into account mapping efficiency and avoiding getting trapped in local optima.
[0035] In some embodiments, a first range is determined based on the angle range occupied by other nodes at the same level as the parent node, and the location of the second node is determined within the first range by combining the subtree weight of the second node and the dynamic spacing corresponding to the level, including: The avoidance nodes corresponding to the second node include the main substation, other nodes at the same level as the parent node, and all parent nodes at the previous level of the parent node. Calculate the angle range occupied by each avoidance node relative to the main substation, merge the angle ranges occupied by all avoidance nodes and take the complement to obtain the first range; The largest first range is allocated according to the subtree weights corresponding to each second node to obtain the second sector corresponding to each second node. The center direction of the second sector is taken as the initial placement angle of the second node relative to the main substation. When the second node has multiple parent nodes, the initial placement angle is corrected by merging the directions of the parent nodes to obtain the target placement angle of the second node; The target radius of the second node is determined based on the preset base radius and dynamic spacing, and the location of the second node is determined by combining the target placement angle.
[0036] For example, refer to Figure 6As shown, considering that the angle sectors of child nodes should not intrude into the territory of nodes whose positions are already determined and which are not directly related to the child node, the main substation is located at the center of the canvas. All node angle sectors revolve around it, occupying a core area, and must be avoided. Other nodes at the same level as the parent node that have already been placed have their angle ranges defined in the previous round of sector allocation. If a child node intrudes into its range, it will cause cross-branch connection intersections and node stacking. All parent nodes in the previous level of the parent node have also determined their angle positions in an earlier level. If a child node expands into the angle range of its grandparent, it will cause the connection between the three generations of the parent and child nodes to loop back to the direction of the grandparent, disrupting the topological hierarchy that radiates outward from the main station. Therefore, a set of nodes to be avoided by the second node is defined. This set includes: the main substation, other nodes at the same level as the parent node that have already been placed, and all parent nodes in the previous level of the parent node (i.e., all parent nodes of the parent node). Calculate the angle range occupied by each avoidance node relative to the main substation, merge the angle ranges occupied by all avoidance nodes, and take the complement of the merged set to obtain the first range. The first range may contain one or more continuous angle ranges. Select the largest continuous range as the basis for subsequent sector allocation. If the largest continuous range exceeds the preset maximum expansion angle, the range is truncated with the direction of the parent node relative to the main substation as the center to limit the available range within a reasonable range.
[0037] Next, within the selected first range, sectors are allocated according to the weight ratio of the subtrees corresponding to each second node, with a preset fill angle maintained between adjacent sectors, resulting in the second sector corresponding to each second node. The center direction of the second sector is taken as the initial placement angle of the second node relative to the main substation. If the second node has multiple parent nodes, the directions of all parent nodes relative to the main substation are merged (e.g., by taking the average or weighted direction of the directions of each parent node), and the initial placement angle is corrected with the merged direction so that the second node takes into account the position information of all its parent nodes in terms of angle, thus obtaining the target placement angle of the second node.
[0038] Finally, the target radius of the second node is determined based on the preset base radius and dynamic spacing, i.e., target radius = preset base radius + current level × dynamic spacing. Combined with the target placement angle, the coordinate position of the second node relative to the main substation is calculated through polar coordinate transformation, thus completing the placement of the second node.
[0039] For example, after the initial placement of a node, a parent-child spacing check is performed. The shortest edge distance `bboxDistance` between the bounding boxes of the parent and child nodes is calculated. If it is less than the safety distance `parentChildMinGap` (e.g., 30 pixels), the radius of the child node is increased along the current direction until the spacing requirement is met, ensuring that nodes do not overlap. This check is performed iteratively until no nodes need adjustment or the maximum number of iterations is reached.
[0040] In some embodiments, after merging the angle intervals occupied by all the avoidance nodes and taking the complement to obtain the first range, the method further includes: Taking the center direction of the first range as the center, expand to both sides according to the preset outer radiation sector half angle to form an outer radiation sector. Take the intersection of the first range and the outer radiation sector to obtain the first intersection. The first expansion angle is determined by multiplying the number of all second nodes corresponding to the parent node by the preset single node expansion angle. The smaller value between the first expansion angle and the preset maximum expansion angle upper limit is taken, and the smaller value angle is expanded to form a restricted expansion sector with the parent node's direction angle as the center. The first range is assigned as the intersection of the restricted expansion sector and the first intersection.
[0041] For example, refer to Figure 7 As shown, firstly, the azimuth angle of the parent node relative to the center of the main substation is calculated. Then, the azimuth angle is used as the center, and the azimuth angle of the preset outer radiation sector is extended to both sides to form an outer radiation sector interval. The first intersection is obtained by taking the intersection of the first range and the outer radiation sector. The usable angle range is limited to a limited sector centered on the azimuth angle of the parent node. The child nodes are always distributed on the side of the parent node extending outward, so that the connection between the parent and child nodes presents a natural outward trend, maintaining a clear sense of hierarchical progression. The child nodes of different branches will not cause cross-branch connection confusion due to being scattered in the azimuth area of other branches. If there is no intersection, the child nodes are returned to the outer radiation sector as the first intersection, thereby constraining the distribution of the child nodes to be near the direction of the parent node extending outward. Subsequently, a first expansion angle is determined by multiplying the number of child nodes corresponding to the parent node by a preset single-node expansion angle. The smaller value between this first expansion angle and the preset maximum expansion angle is taken as the actual expansion angle. The expansion is then carried out from the parent node's orientation angle as the center, expanding outwards at half of this actual expansion angle to form a restricted expansion sector. The first range is assigned the intersection of the first intersection and the restricted expansion sector, further preventing the sector from over-expanding when the number of child nodes is small. If the two still do not intersect, the range reverts to the restricted expansion sector as the final value of the first range. After this double constraint correction, the child nodes are both confined to the vicinity of the parent node's outward radiation direction to avoid going behind the parent node, and confined within a reasonable expansion angle to prevent excessive dispersion that would lead to sparse graphics and long lines, thus achieving a balance between directional rationality and layout compactness.
[0042] For example, the outer radial sector is defined as: `parentAngle = atan2(parent.y - centerY, parent.x - centerX)`, `halfSectorSize = outerSectorSize / 2`, `outerSector = [parentAngle - halfSectorSize, parentAngle + halfSectorSize]`. The intersection of the first range and the outer radial sector is taken; if there is no intersection, the outer radial sector is used as the default range. This constraint of the outer radial sector ensures that child nodes are distributed in the direction extending outward from the parent node.
[0043] For example, the restricted spread sector is defined as: suggestedSpreadAngle = min(maxChildrenSpreadAngle, 30° × childCount), halfSpread = suggestedSpreadAngle / 2, limitedSpreadSector = [parentAngle - halfSpread, parentAngle + halfSpread]. The intersection of the first range and the restricted spread sector is taken; if there is no intersection, the restricted spread sector is used as the default range. This limits the spread angle based on the number of child nodes, preventing child nodes from being too scattered.
[0044] In some embodiments, the initial placement angle is corrected by merging the orientation of the parent node to obtain the target placement angle of the second node, including: Calculate the direction angle from the main substation to each parent node, and map each direction angle to a two-dimensional vector on the unit circle, where the two-dimensional vector includes cosine and sine values; The average vector is obtained by summing the cosine and sine values corresponding to all parent nodes and then dividing each sum by the number of parent nodes. The angle extracted from the average vector by the arctangent function is used as the target placement angle of the second node.
[0045] For example, firstly, the direction angles from the center of the main substation to each parent node are calculated. Each direction angle is mapped to a two-dimensional vector on the unit circle. The cosine of the direction angle is taken as the horizontal component of the vector, and the sine is taken as the vertical component. Then, the horizontal components corresponding to all parent nodes are summed to obtain the total horizontal component, and the vertical components are summed to obtain the total vertical component. The total horizontal and vertical components are then divided by the number of parent nodes to obtain the arithmetic mean of each component. The two-dimensional vector corresponding to this mean is the vector average result of the direction of each parent node. Finally, the direction angle is extracted from this average vector using the arctangent function. The resulting angle is used as the target placement angle of the second node. In this way, when the parent nodes are distributed in different directions, the result of the vector average will fall between each direction, so that the connection between multiple parent nodes and each parent node maintains a relatively balanced geometric relationship, taking into account the positional constraints of each parent node. This allows multiple parent nodes to reasonably express their multiple attributes in a star-shaped layout, avoiding excessively long or abnormally oriented connection lines between them and secondary parent nodes due to following only a single main parent node.
[0046] For example, for a node with multiple parent nodes, its placement angle is obtained by merging the parent node directions. Specifically, the direction angle from the node to each parent node is calculated, and then these direction angles are vector averaged: sumX = Σ cos(parentAngle), sumY = Σ sin(parentAngle), mergedAngle = atan2(sumY / count, sumX / count).
[0047] In some embodiments, the first layout node is associated with a preset priority. Expanding and fine-tuning the first layout node of the first layout yields a second layout, including: When the difference in placement angle between any two first layout nodes in the same level is less than the preset minimum angle spacing, the first layout node with the lower preset priority is adjusted radially outward according to the preset adjustment rules. When the bounding box spacing between any two first layout nodes in the same level is detected to be less than the preset minimum bounding box spacing, if the difference in the preset priorities of the two first layout nodes is less than the preset boundary threshold, the two first layout nodes are simultaneously iteratively displaced along the away direction. Conversely, if the difference is not less than the preset boundary threshold, the combined direction of the attraction direction of the parent node of the first layout node with the lower preset priority and the away direction is calculated, and the first layout node with the lower preset priority is iteratively displaced along the combined direction. When the boundary box spacing between any two first layout nodes at different levels is less than the preset minimum boundary box spacing, the first layout node at the higher level and farther from the main substation is iteratively displaced outward along its current radial direction until all first layout nodes meet the spacing requirements or reach the preset maximum number of iterations, thus obtaining the second layout.
[0048] For example, after the nodes are placed, the layout result is checked and fine-tuned iteratively. Each iteration checks and processes three types of conflicts in turn until all nodes meet the spacing requirements or the preset maximum number of iterations is reached, as shown below: The basic rules are as follows: the more parent nodes there are, the higher the preset priority; when the number of parent nodes is the same, the greater the weight of the subtree, the higher the preset priority; when the weight of the subtree is the same, the lower the level, the higher the priority; nodes with high preset priority remain stationary during conflict resolution, while nodes with low preset priority are pushed away. For nodes that need to be moved, the gravitational direction of their parent nodes is determined by weighted average of the directions of all their parent nodes, with the lower the parent node level and the closer it is to the main substation, the greater its contribution to the gravitational direction; after each iteration of displacement or adjustment, the node is still confined to the sector range to which it belongs.
[0049] Based on these fundamental rules, the following three types of conflicts are addressed one by one: The first type is collision at the same angle: (Refer to...) Figure 8 As shown, this addresses the issue of adjacent nodes having excessively close angles after sector allocation. When the difference in placement angles between two nodes at the same level is less than the preset minimum angle spacing and the distance between their bounding boxes is still within an acceptable range, the angle is fine-tuned. Specifically, lower-priority nodes are pushed aside, the adjustment range for a single instance does not exceed the preset angle limit, and the adjusted angle is restricted to the sector range to which the node belongs. By fine-tuning the angle unidirectionally according to priority and limiting it within their respective sectors, congestion is alleviated and a chain reaction of boundary overflows caused by the adjustment of one node is avoided.
[0050] The second type is collisions between bounding boxes on the same layer: see [reference] Figure 9As shown, the collision handling for bounding boxes at the same level addresses the physical overlap problem that still exists even when the angular distribution is reasonable but the node size is large. When the distance between the bounding boxes of two nodes at the same level is less than the preset minimum bounding box distance, different strategies are adopted based on the priority difference. If the priority difference is significant, the node corresponding to the lower preset priority moves along the combined direction of the parent node's gravitational direction and the distance away direction of the two nodes. After the movement, it is still confined within its sector. If the distance requirement is still not met after the movement, the radial radius of the node is further increased. If the priorities are similar, the two nodes are pushed apart in both directions along the distance away direction. In this way, by introducing the combined movement of the parent node's gravitational direction and the distance away direction, the node is constrained to the vicinity of the parent node's radial direction while avoiding collisions, thus balancing spatial de-scratching and topological semantic preservation.
[0051] The third type is cross-layer bounding box collision: see [reference] Figure 10 As shown, when the boundary box spacing between nodes at different levels is less than the preset minimum boundary box spacing, the inner nodes are mostly more important parent nodes in the topology and their positions are already determined by multiple constraints, so they should not be easily changed. Therefore, the inner nodes are kept stationary, while the outer nodes, which are at higher levels and farther from the center of the main substation, are pushed outward along their current radial direction to increase the radius of their concentric circles, thereby widening the radial spacing to eliminate overlap.
[0052] The detection and adjustment of the above three types of conflicts are performed sequentially in each iteration. The iteration process continues until all node pairs meet the spacing requirements of each type or the preset maximum number of iterations is reached, so as to ensure that there is no overlap of bounding boxes between nodes in the final layout and that the angle distribution is reasonable.
[0053] In some embodiments, the topology includes a tie switch for connecting two substations, and aligns and regularizes the second layout to obtain an initial layout, including: The nodes of the non-main substations in the second layout are taken as terminal substations, and the original orientation angle of the terminal substations relative to the main substations is calculated. The terminal substations are sorted in ascending order of the deviation between the original direction angle and the preset target direction. For the sorted terminal substations, if the preset target direction is not occupied and the original direction angle is within the preset range, the preset target direction corresponding to the terminal substation is determined; otherwise, the terminal substation is associated with any unoccupied preset target direction. Keeping the distance between the terminal substation and the main substation constant, the coordinates of the terminal substation are adjusted to the corresponding preset target direction, and a connecting switch is placed on the connecting line between the interconnected substations to obtain the third layout. The canvas is dynamically adjusted on the third layout to obtain the initial layout.
[0054] Aligning and standardizing the second layout may include the following steps: First, traverse all nodes in the second layout and identify substations with level>=1 as terminal substations. For each terminal substation: determine its parent substation; calculate its original orientation angle (originalAngle) relative to the parent substation; mark whether it is a multi-parent node; find the virtual node between the terminal substation and its parent substation.
[0055] Then, the end substations are sorted in ascending order according to their original azimuth angle and the preset target direction, which can be a horizontal / vertical direction (0°, 90°, 180°, 270°). This ensures that end stations closer to the horizontal / vertical direction are processed first, to avoid the later-processed stations being unable to align due to the earlier stations occupying the direction.
[0056] Next, for each sorted terminal substation, if the preset target direction is not occupied and the original direction angle belongs to the preset range (taking the preset range of 0 to 40 degrees as an example), it is divided into Class A and Class B. Class A: The original direction angle is very close to a target direction (within the range of firstStageThreshold, default 15°) and the preset target direction is free, then the direction is directly assigned; Class B: The original direction angle is relatively close to a target direction (within the range of secondStageThreshold, default 40°) and the preset target direction is free, then the preset target direction is assigned; Conversely, if it does not belong to the preset range, when the forced use of free direction is enabled, any free direction is assigned.
[0057] It is understandable that the availability of the preset target direction is determined based on the direction already occupied by other child nodes of the parent substation: if other child nodes have already occupied a certain direction (angle difference less than 10°), then that direction is unavailable.
[0058] Finally, after determining the preset target direction, keeping the distance between the terminal substation and the parent substation constant, adjust their positions as follows: newX = parent.x + distance × cos(targetAngle), newY = parent.y + distance × sin(targetAngle). Therefore, referring to... Figure 11 As shown, keeping the end substation (a leaf with Level ≥ 1 or a node near a leaf), its parent substation, and the virtual tie switch in a horizontal or vertical relationship is beneficial for generating regular tie lines in the future.
[0059] Reference Figure 12 and Figure 13As shown, for the dual-station tie switch recorded in ContactSwitchConnection, it is placed at the midpoint of the connection between the two substations it connects to. This placement of the tie switch is completed after the substation node layout is finished. Furthermore, both the first and second nodes include multi-directional virtual nodes and substations; that is, for the multi-directional virtual nodes of the multi-station interlocking line group, they participate in the star topology layout as nodes of the same level as the substations. This ensures that the tie nodes and multi-directional virtual nodes are placed in a position consistent with the power grid topology, allowing them to be in a reasonable spatial position in the subsequent initial layout.
[0060] In some embodiments, the third layout is dynamically adjusted on the canvas to obtain an initial layout, including: Traverse the nodes of the third layout to obtain the smallest outer rectangle of the third layout; The initial canvas is adaptively expanded based on the minimum bounding rectangle to obtain the target canvas. The target location of the main substation is redefined based on the target canvas. The translation vector between the target location and the current location of the main substation is calculated. All third layout nodes are translated along the translation vector to generate the initial layout.
[0061] For example, refer to Figure 14 As shown, traverse all nodes in the third layout, calculate the minimum / maximum X and Y coordinates, the maximum node width and height, and after considering the half-width / half-height of the nodes, obtain the minimum outer rectangle of the third layout; based on the relationship between the minimum outer rectangle and the size of the initial canvas, calculate the distance to be expanded to the left, right, up, and down. The size of the target canvas is the original size plus the expansion distance in each direction; based on the size of the target canvas, calculate the target position of the main substation, and translate all nodes according to the translation vector so that the main substation is located slightly above the center of the target canvas.
[0062] For example, refer to Figure 15 As shown, taking a regional power distribution network as an example, it includes one main substation and 14 substations, with some substations having interconnecting switches or multi-station interlocking relationships. Following the steps above, data preparation, node classification, adjacency relationship construction, hierarchical tree construction, node placement, collision detection, end-substation optimization, interconnecting switch layout, and canvas adjustment are performed sequentially to finally generate a clear star-shaped initial layout.
[0063] For example, refer to Figure 16As shown, in some distribution networks, a substation may be connected to the main station through multiple paths, forming multiple parent nodes. The processing flow is as follows: During BFS layering, all parent nodes are recorded; the lowest-level parent node is selected as the primary parent node for tree structure and child node affiliation; when placing nodes, the vector averaging method is used to calculate the direction of the merging arc center of multiple parent nodes; when calculating subtree weights, the number of parent nodes is multiplied to increase the priority of multiple parent nodes in sector allocation and collision handling.
[0064] For example, refer to Figure 17 As shown, for large-scale distribution networks containing numerous substations and complex interconnections: community discovery sorting is enabled to ensure that interconnected nodes within the same level are angularly adjacent; dynamic interlayer spacing calculation ensures that deep nodes are also reasonably distributed within the canvas; and dynamic canvas adjustment prevents nodes from exceeding the boundaries.
[0065] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method for generating the initial layout of the distribution network substation interconnection diagram. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0066] Please see Figure 18 , Figure 18 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 to execute the initial layout generation method for the distribution network substation interconnection diagram of the embodiments of this application. The 903 input / output interface is used to implement information input and output. The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904); The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0067] In some embodiments, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for generating the initial layout of a substation interconnection diagram in a power distribution network.
[0068] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0069] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0070] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0071] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0072] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0073] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0074] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0075] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0076] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0077] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0078] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for generating the initial layout of a substation interconnection diagram in a power distribution network, characterized in that, An automatic power grid mapping system is applied, wherein the undirected graph adjacency list corresponding to the built-in topology of the automatic power grid mapping system includes substations, and the substations include main substations. The method includes: Starting from the main substation of the power grid, the undirected graph adjacency list is traversed to perform topological layering, resulting in a hierarchical tree and the subtree weights of each node in the hierarchical tree. Each level of the hierarchical tree is sorted according to the sum of the weights of the subtrees at that level, and the tree nodes within each level are identified based on adjacency relationships, and sorted according to the connected components and the subtree weights to obtain sorted nodes, wherein the sorted nodes include a first node and a second node. With the main substation placed at the center of the initial canvas, the first nodes of the level directly connected to the main substation are proportionally allocated within the preset angle range corresponding to the main substation according to the subtree weight of each first node to obtain a first sector, and the location of the first node is determined based on the first sector and the preset base radius. For the second node in the next level, determine that the second node is located in the parent node of the previous level. Determine the first range based on the angle range occupied by other nodes in the same level of the parent node. Within the first range, combine the subtree weight of the second node and the dynamic spacing corresponding to the level to determine the position of the second node. Repeat this process level by level until all sorted nodes in all levels are placed to obtain the first layout. The first layout node of the first layout is expanded and fine-tuned to obtain the second layout, and the second layout is aligned and regularized to obtain the initial layout.
2. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 1, characterized in that, The step of determining a first range based on the angle range occupied by other nodes at the same level as the parent node, and determining the position of the second node within the first range by combining the subtree weight of the second node and the dynamic spacing corresponding to the level, includes: The avoidance nodes corresponding to the second node include the main substation, other nodes at the same level as the parent node, and all the parent nodes at the previous level. Calculate the angle interval occupied by each of the avoidance nodes relative to the main substation, merge the angle intervals occupied by all the avoidance nodes and take the complement to obtain the first range; The largest first range is allocated according to the subtree weights corresponding to each second node to obtain the second sector corresponding to each second node, and the center direction of the second sector is taken as the initial placement angle of the second node relative to the main substation. When the second node has multiple parent nodes, the initial placement angle is corrected by merging the directions of the parent nodes to obtain the target placement angle of the second node; The target radius of the second node is determined based on the preset base radius and the dynamic spacing, and the location of the second node is determined by combining the target placement angle.
3. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 2, characterized in that, After merging the angle intervals occupied by all the avoidance nodes and taking their complements to obtain the first range, the method further includes: Taking the center direction of the first range as the center, expand to both sides according to the preset outer radiation sector half angle to form an outer radiation sector. Take the intersection of the first range and the outer radiation sector to obtain the first intersection. The first expansion angle is determined by multiplying the number of all second nodes corresponding to the parent node and the preset single-node expansion angle. The smaller value between the first expansion angle and the preset maximum expansion angle upper limit is taken, and the smaller value is expanded to form a restricted expansion sector with the direction angle of the parent node as the center. The first range is assigned as the intersection of the restricted expansion sector and the first intersection.
4. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 2, characterized in that, The step of correcting the initial placement angle by merging the directions of the parent node to obtain the target placement angle of the second node includes: Calculate the direction angle from the main substation to each of the parent nodes, and map each direction angle to a two-dimensional vector on the unit circle, wherein the two-dimensional vector includes a cosine value and a sine value; The average vector is obtained by summing the cosine and sine values corresponding to all the parent nodes and then dividing each sum by the number of parent nodes. The angle extracted from the average vector by the arctangent function is used as the target placement angle of the second node.
5. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 1, characterized in that, The topology also includes multi-directional virtual nodes, each connecting at least three of the substations. Each substation further includes sub-substations. Starting from the main substation of the power grid, the topology is layered by traversing the adjacency list of the undirected graph to obtain a hierarchical tree and the subtree weights of each node in the hierarchical tree, including: Starting from the main substation, a breadth-first search is used to traverse the adjacency list of the undirected graph to perform topological layering, resulting in the hierarchical tree. The tree nodes of the hierarchical tree include the main substation, the substation, and the multi-directional virtual node. The tree nodes are divided into leaf nodes and non-leaf nodes based on whether they have child nodes; For any leaf node, the larger value of the preset subtree weight and the parent node of the leaf node is taken as the subtree weight of the leaf node; Recursively process each non-leaf node from bottom to top, accumulating the subtree weights of all its child nodes, and then multiplying by the sum of the number of its parent nodes to obtain the subtree weight of the non-leaf node, until all leaf nodes and non-leaf nodes have been traversed.
6. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 1, characterized in that, The first layout node is associated with a preset priority. The step of performing expansion detection and fine-tuning on the first layout node of the first layout to obtain the second layout includes: When it is detected that the difference in placement angle between any two first layout nodes in the same level is less than the preset minimum angle spacing, the first layout node with the lower preset priority is adjusted radially outward according to the preset adjustment rule. When the bounding box spacing between any two first layout nodes in the same level is detected to be less than the preset minimum bounding box spacing, if the difference in the preset priority of the two first layout nodes is less than the preset boundary threshold, the two first layout nodes are simultaneously iteratively displaced along the away direction. Conversely, if the difference is not less than the preset boundary threshold, the gravitational direction of the parent node of the first layout node with the lower preset priority and the composite direction of the away direction are calculated, and the first layout node with the lower preset priority is iteratively displaced along the composite direction. When it is detected that the boundary box spacing between any two first layout nodes at different levels is less than the preset minimum boundary box spacing, the first layout node at a higher level and farther away from the main substation is iteratively displaced outward along its current radial direction until all first layout nodes meet the spacing requirement or reach the preset maximum number of iterations, thus obtaining the second layout.
7. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 1, characterized in that, The topology includes a tie switch for connecting two substations, and the second layout is aligned and regularized to obtain an initial layout, including: The nodes of the non-main substations in the second layout are taken as terminal substations, and the directional angle of the terminal substations relative to the main substations is calculated. The terminal substations are sorted in ascending order of the deviation between the direction angle and the preset target direction; For the sorted terminal substations, if the preset target direction is not occupied and the direction angle belongs to a preset range, the preset target direction corresponding to the terminal substation is determined; otherwise, the terminal substation is associated with any unoccupied preset target direction. Keeping the distance between the terminal substation and the main substation unchanged, the coordinates of the terminal substation are adjusted to the corresponding preset target direction, and the connecting switch is placed on the connecting line of the interconnected substations to obtain the third layout; The canvas is dynamically adjusted to obtain the initial layout.
8. The method for generating the initial layout of a distribution network substation interconnection diagram according to claim 7, characterized in that, The step of dynamically adjusting the canvas of the third layout to obtain the initial layout includes: Traverse the nodes of the third layout to obtain the minimum bounding rectangle of the third layout; The initial canvas is adaptively expanded based on the minimum bounding rectangle to obtain the target canvas. The target location of the main substation is redefined based on the target canvas. The translation vector between the target location and the current location of the main substation is calculated. All the third layout nodes are translated along the translation vector to generate the initial layout.
9. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the method for generating the initial layout of the distribution network substation interconnection diagram as described in any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are used to execute the initial layout generation method for the substation interconnection diagram of the distribution network according to any one of claims 1 to 8.
