Power grid equipment connection relationship construction method and system and ship power grid equipment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE 711TH RES INST OF CHINA STATE SHIPBUILDING CORP
- Filing Date
- 2026-03-19
- Publication Date
- 2026-06-19
Smart Images

Figure CN122246685A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of ship power system topology modeling technology, specifically to a method, system, and ship power grid equipment for constructing the connection relationship of power grid equipment. Background Technology
[0002] In the field of power grid equipment topology modeling, traditional modeling methods mostly adopt a static topology construction mode, which relies on manual maintenance of equipment connection relationship tables and describes the power grid structure through pre-defined node and branch mapping relationships.
[0003] However, when the status of equipment in the power grid changes or new equipment is added, the topology cannot be automatically detected and adjusted. The connection relationship data must be manually sorted and updated, which is not only inefficient, but also prone to human error, resulting in inconsistencies between the topology information and the actual power grid operation status. This can lead to safety hazards for subsequent work such as power grid dispatching and fault diagnosis. Summary of the Invention
[0004] This invention provides a method, system, and shipboard power grid equipment for constructing power grid equipment connection relationships, aiming to solve the problem of potential safety hazards in power grid operation caused by inaccurate adjustment of dynamic connection relationships of power grid equipment in related technologies.
[0005] Firstly, a method for constructing the connection relationship of power grid equipment is provided, including the following steps: In response to a control action trigger signal from the power grid, target nodes and target branches associated with the control action are determined in a pre-constructed power grid topology. The pre-constructed power grid topology consists of multiple nodes and branches. The nodes are devices in the power grid, and the branches consist of switching elements and their on / off states. The switching elements are used to make electrical connections with the devices. The target node and the target branch in the pre-constructed power grid topology are traversed and searched to determine the latest search results; Based on the latest search results, update the pre-built power grid topology and the connection relationships between the devices.
[0006] In some embodiments, a traversal search is performed on the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results, including: An iterative deepening depth-first search algorithm is used to perform a pruned depth-first search on the target node and the target branch to determine the latest search result.
[0007] In some embodiments, the iterative deepening depth-first search algorithm is used to perform a pruned depth-first search on the target node and the target branch to determine the latest search result, including: Initialize the search depth of the depth-first search algorithm with iterative deepening; Under the search depth limit, a pruned depth-first search is performed starting from a preset starting node. The pruned depth-first search is used to traverse the connected branches in the target branch. If the target node is not found, the search depth is iteratively increased and the search is repeated until the target node is found or the search depth reaches the preset upper limit of the search depth, and the latest search result is determined.
[0008] In some embodiments, a traversal search is performed on the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results, including: A non-recursive depth-first search algorithm is used to traverse and search the target node and the target branch to determine the latest search result. The non-recursive depth-first search algorithm uses an explicit stack to manage the target node to be visited.
[0009] In some embodiments, the step of employing a non-recursive depth-first search algorithm to traverse and search the target node and the target branch to determine the latest search result includes: Push the preset starting node onto the explicit stack; Pop the current node from the top of the display stack. If the current node has not been visited, push the adjacent nodes onto the explicit stack and mark the current node as visited. The adjacent nodes refer to nodes that are connected to the current node by a conductive branch and have not been visited.
[0010] In some embodiments, the attributes of the branch include at least the on / off state of the switching element and the logical relationship between the devices, wherein the type of the logical relationship includes at least one of feeder relationship, backup relationship, and load connection relationship.
[0011] In some embodiments, the device type of the device is constructed using object-oriented design, wherein the attributes of the device type include at least one of device identification information, device type information, device operating status, control mode, and a neighbor list, wherein the neighbor list is used to store pointers to devices on adjacent nodes, the on / off status of switching elements connected to the adjacent nodes, and the type of logical relationship.
[0012] In some embodiments, based on the latest search results, dynamically updating the pre-built power grid topology and the connection relationships between the devices includes: Based on the latest search results, determine the latest association information corresponding to the target node and the target branch. The latest association information includes at least the device connection status, logical relationship and control mode. Based on the latest correlation information, the range of areas where the power grid topology has changed is determined; Based on the latest associated information, the power grid topology and the connection relationships between the devices within the region are dynamically updated.
[0013] In some embodiments, the method further includes: In response to switching the control mode of any of the nodes, the state of the node in the power grid topology is updated according to the preset topology adaptation logic corresponding to different control modes, and the power grid topology is updated.
[0014] In some embodiments, after dynamically updating the pre-built power grid topology and the connection relationships between the devices based on the latest search results, the method further includes: The system visualizes and renders target information in the power grid topology, wherein the target information includes, but is not limited to, the connectivity status of each branch, the logical relationships between devices, and the on / off status of switching elements. Secondly, it provides a power grid device connection relationship construction system, comprising: A control and monitoring module is used to respond to a control action trigger signal from the power grid and determine the target node and target branch associated with the control action in a pre-constructed power grid topology. The pre-constructed power grid topology consists of multiple nodes and branches. The nodes are devices in the power grid, and the branches are composed of switching elements and their on / off states. The switching elements are used to make electrical connections with the devices. The search module is used to traverse and search the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results; An update module is used to update the pre-built power grid topology and the connection relationships between the devices based on the latest search results.
[0015] Thirdly, a marine electrical grid device is also provided, including a memory and a processor, wherein the memory stores a computer program, which, when executed by the processor, implements the steps of any of the above methods.
[0016] Fourthly, a computer-readable storage medium is also provided, on which a computer program is stored, the computer program being loaded by a processor to perform the steps of any of the methods described above.
[0017] Beneficial effects: This application, through a pre-constructed power grid topology and power grid control action trigger signals, can accurately respond to power grid control actions, quickly locate affected target nodes and branches, and obtain the latest association status between devices through targeted traversal search. This allows for dynamic updates to the power grid topology and device connection relationships, effectively solving the problems of traditional static topology modeling methods being unable to adapt to changes in power grid device status in real time and relying on manual maintenance, which is inefficient and prone to errors. Furthermore, by synchronously identifying power grid connectivity status, effective power supply paths, and redundant paths, it can improve the real-time performance, accuracy, and adaptability of the power grid topology, thereby ensuring the safe and stable operation of the power grid. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the method for constructing the connection relationship of power grid equipment provided in an exemplary embodiment of this disclosure; Figure 2 This is a schematic diagram of a power grid topology segment provided in an exemplary embodiment of this disclosure; Figure 3 This is a flowchart of the iteratively deepened depth-first search provided by an exemplary embodiment of this disclosure; Figure 4 This is a schematic diagram of a dynamically updated power grid topology scenario provided by an exemplary embodiment of this disclosure; Figure 5 This is a schematic diagram of the functional modules of the power grid equipment connection relationship construction system provided in an exemplary embodiment of this disclosure; Figure 6 This is a schematic diagram of the structure of a shipboard electrical grid equipment provided in an exemplary embodiment of this disclosure. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] In the description of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0022] "A and / or B" includes the following three combinations: A only, B only, and a combination of A and B.
[0023] The use of "applies to" or "configured to" in this application implies open and inclusive language, which does not exclude the applicability to or configuration to devices performing additional tasks or steps. Additionally, the use of "based on" implies openness and inclusivity, because processes, steps, calculations, or other actions "based on" one or more of the stated conditions or values may in practice be based on additional conditions or values beyond those stated.
[0024] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0025] On the one hand, this embodiment provides a method for constructing the connection relationship of power grid equipment, which can be applied to industrial scenarios such as ship power plant monitoring systems. Figure 1 As shown, it includes the following steps: Step 100: In response to the control action trigger signal of the power grid, determine the target node and target branch associated with the control action trigger signal in the pre-constructed power grid topology. The pre-constructed power grid topology consists of multiple nodes and branches. Nodes are devices in the power grid, and branches consist of switching elements and their on / off states. Switching elements are used to make electrical connections with the devices.
[0026] Specifically, in response to the power grid equipment connection relationship construction system receiving control action trigger signals for the power grid, such as receiving control action trigger signals related to the starting or stopping of generator sets, switchboards, loads and other equipment in the ship power station monitoring system, the closing or opening isolation of switching elements (such as circuit breakers), and the switching of system control modes.
[0027] First, a pre-built power grid topology is invoked. This topology is constructed based on graph theory to build node and branch models, combined with object-oriented design. In the hardware layer design of the actual application system architecture, embedded controllers deployed in the ship's power station collect device status and connection information. This information is periodically read via industrial communication protocols (such as Modbus RTU / TCP, CAN bus), including but not limited to the online or offline status of devices, the closed / open isolation status of switching elements, and the control mode of the devices. The raw data is then encapsulated into structured objects (such as DeviceStatus) and pushed to the system's modeling engine for device modeling.
[0028] For example, the code snippet for modeling power grid equipment is as follows: DeviceG1("G1","Generator"); / / Main generator DeviceG2("G2","Generator"); / / Backup generator DeviceDB1("DB1","DistributionBoard"); / / Distribution board DeviceL1("L1","Load"); / / Load G1.add_connection(&DB1,"On","Feeder"); G2.add_connection(&DB1,"Off","Spare"); DB1.add_connection(&L1,"On","Load"). An object-oriented design is adopted, defining attributes and behaviors for each device node. The device type declaration is as follows: class Device{ public: std::stringname; / / Device name (e.g., "G1", "DB1") std::stringtype; / / Device type (e.g., "Generator", "DistributionBoard", "Load") std::stringstatus; / / Device status (e.g., "online", "offline") std::string control_mode; / / Control mode (e.g., "auto", "semi-auto", "manual") std::vector<std::string> <std::tuple<Device*,std::string,std::string> `neighbors;` / / Neighbor list: {neighbor device pointers, circuit breaker status, logical relationship type} } As can be seen, in this example, various physical devices in the power grid, such as power generation equipment, distribution equipment, and electrical loads, are abstracted as nodes. Each node's attributes include device identifier, device type, operating status, control mode, and neighbor association information. Different types of nodes exhibit different behaviors. For example, if a device node is a generator set, its behaviors include starting, stopping, closing, and opening; if a device node is a distribution board, its behaviors include closing the jumper switch. The switching elements used to connect the devices and their on / off states are abstracted as branches. Each branch's attributes include the on / off state of the switching elements and the type of logical relationship between the devices. The on / off states of the switching elements include at least two states: closed (conducting) or open (isolating). The types of logical relationships between devices include at least one of the following: feeder relationship, standby relationship, and load connection relationship. These relationships characterize the functional associations and operational collaborations formed after various devices in the power grid are connected through switching elements.
[0029] Based on the above modeling relationships, such as Figure 2 As shown, for the main generator G1, standby generator G2, distribution board DB1, load L1, the circuit breaker states are On and Off, where On indicates closed conduction and Off indicates open isolation. From this diagram, it can be seen that the attributes of the branches containing G1 and DB1 indicate that the circuit breaker state is On, and the logical relationship is a feeder relationship; the attributes of the branches containing G2 and DB1 indicate that the circuit breaker state is Off, and the logical relationship is a standby relationship; the attributes of the branches containing DB1 and L1 indicate that the circuit breaker state is On, and the logical relationship is a load relationship.
[0030] Furthermore, feeder relationships refer to connection relationships determined by the direction of energy transmission, such as the connection relationship between power generation equipment and distribution equipment, and between distribution equipment and electrical loads, reflecting the power supply and demand relationship between equipment; standby relationships refer to the association relationship where equipment or branches are in a redundant standby state, such as the connection relationship between standby power generation equipment and main power supply equipment. Under normal circumstances, standby power generation equipment and its branch are in a disconnected state, and are only put into use when the main power supply equipment fails, the main power supply path fails, or the load is overloaded, reflecting the fault-tolerant cooperation logic relationship between main and standby power supply equipment; load connection relationships refer to the direct power supply relationship between distribution equipment and electrical loads. It should be noted that for the same equipment, there may be multiple logical relationships associated with it, or there may only be one logical relationship associated with it.
[0031] Then, in response to the specific content of the control action trigger signal, the nodes containing the devices affected by the control action trigger signal and the branches corresponding to the switching elements are selected from the topology and determined as target nodes and target branches, respectively, as the objects to be processed for dynamically updating the power grid topology. For example, control action trigger signal 1 is "update_topology(&G2,&DB1,"On");", indicating that G2 is put into production; control action trigger signal 2 is "switch_control_mode(&G1,"auto");", indicating that the control mode of G1 is switched to automatic control mode.
[0032] Step 200: Traverse and search the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results.
[0033] Specifically, based on a pre-built power grid topology, the system performs a directional traversal search on target nodes and target branches related to power grid control action trigger signals. The entire search process only effectively traverses branches in the target branches that are in the conducting state, eliminating interference from branches in the disconnected state on the search results.
[0034] The system uses key equipment nodes in the power grid, such as main generators and core switchboards, as the starting nodes for the power grid equipment nodes. Starting from these nodes, the search proceeds layer by layer using a depth-first search logic. During the search, visited target nodes are marked to avoid resource waste and redundancy caused by repeated traversal. Simultaneously, it accurately tracks the relationships between target nodes and connected branches, as well as the logical connections between nodes. Throughout the traversal, the system continuously collects the operating status of target nodes, the on / off information of target branches, and the linkage data between nodes and branches, until a complete traversal of all relevant target nodes and connected branches is completed. Finally, the system integrates these data to form the latest search results, which include valid connection paths between target nodes, the latest relationships between nodes and branches, and the local or global connectivity status of the power grid.
[0035] Step 300: Based on the latest search results, dynamically update the pre-built power grid topology and the connection relationships between devices.
[0036] Specifically, based on the latest search results, the pre-built power grid topology and the connection relationships between devices are dynamically adjusted through the system's topology update mechanism. When the latest search results show a change in the on / off state of switching elements—for example, the on / off state of the switching element corresponding to the backup generator in a ship power plant monitoring system changes from closed conduction to open isolation—the system's topology update function is invoked. This function iterates through the neighbor list of the target node, finds the associated entries for the corresponding adjacent nodes, and updates their on / off states. When the latest search results involve control mode switching, the control mode of the target node is updated through the control mode switching function, and the corresponding topology adaptation logic is executed. For example, if switching from manual mode to automatic mode, load balancing in automatic mode and user confirmation waiting in semi-automatic mode are executed.
[0037] Meanwhile, since the equipment type and control logic are decoupled, if the latest search results include information about new equipment or new control modes, the power grid topology can be adapted without modification, thereby realizing the dynamic reconstruction of the power grid topology and equipment connection relationships. The updated topology can synchronously reflect the latest power supply paths and logical relationships between various devices in the power grid.
[0038] In this embodiment, by using a pre-constructed power grid topology and power grid control action trigger signals, the system can accurately respond to power grid control actions, quickly locate affected target nodes and branches, and obtain the latest association status between devices through targeted traversal searches. This allows for dynamic updates to the power grid topology and device connection relationships, effectively solving the problems of traditional static topology modeling methods being unable to adapt to changes in power grid device status in real time and relying on manual maintenance, which is inefficient and prone to errors. Simultaneously, this process supports local or global topology reconstruction, and can simultaneously identify power grid connectivity status, effective power supply paths, and redundant paths. This improves the real-time performance, accuracy, and adaptability of the power grid topology, ensuring the safe and stable operation of the power grid and effectively enhancing the system's compatibility and scalability to different control modes and newly added device types.
[0039] In some embodiments, step 200 involves traversing and searching the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results, including: Step 210: Use the Iterative Deepening Depth-First Search (IDDFS) algorithm to perform a pruned depth-first search on the target node and target branch to determine the latest search result.
[0040] Specifically, the search depth of the iteratively deepening depth-first search algorithm is initialized; under the search depth constraint, a pruned depth-first search is executed starting from the preset starting node, and the pruned depth-first search is used to traverse the connected branches in the target branch; if the target node is not found, the search depth is iteratively increased and the search is repeated until the target node is found or the search depth reaches the preset upper limit of the search depth, and the latest search result is determined.
[0041] As an exemplary example, such as Figure 3 As shown, considering the practical needs of modeling ship power plant topology, to avoid the iteratively deepening depth-first search getting stuck in an infinite search in complex power grid topologies, this example initializes a search depth by balancing search efficiency and resource consumption, such as setting the search depth max_depth to 1. This initial depth ensures that it can quickly cover nearby target nodes and branches without causing excessive memory consumption due to an excessively large initial depth.
[0042] Under the current search depth constraint, a depth-first search with pruning is performed, starting from a preset starting node. During the search, only branches in the target branch where the switching elements are in a closed, conducting state are included in the traversal range, while branches in a disconnected, isolated state are ignored. At the same time, visited target nodes are marked to avoid repeated traversal, accurately filtering out valid connection paths related to control action trigger signals, ensuring that the search process is efficient and non-redundant, and quickly obtaining node connection relationships and logical association information under this depth constraint.
[0043] After completing the search at the current depth, determine whether the target node has been found. If the target node is not found, and the current search depth has not reached the preset maximum search depth limit, gradually increase the search depth `max_depth`, incrementing from 1 to 2, 3, etc., and repeat the depth-first search process with pruning. If the target node is found at one of the increased depths, or if the target node is not found even after reaching the preset maximum search depth, stop the iterative search, and integrate the final search path, node relationships, and logical relationships into the latest search results. If the target node is not found even after reaching the preset maximum search depth, return a search failure message to further optimize the algorithm's search logic.
[0044] For example, the C++ code implementation of using the IDDFS algorithm for depth-first search with pruning to determine the latest search result is as follows: bool iterative_deepening_dfs(Device*start,Device*target,intmax_depth) { for(intdepth=1;depth<=max_depth;++depth) { std::unordered_set<Device*>visited; if(dfs_with_depth_limit(start,target,depth,visited)) { return true; } } return false; } bool dfs_with_depth_limit(Device*current,Device*target,intdepth, std::unordered_set<Device*>&visited) { if(current==target)return true; if(depth<=0)return false; visited.insert(current); for(auto&[neighbor,breaker_status,relation]:current->neighbors) { if(breaker_status=="On"&&visited.find(neighbor)==visited.end()) { if(dfs_with_depth_limit(neighbor,target,depth-1,visited)) { return true; } } } return false; }. In this example, the IDDFS algorithm is used for a depth-first search with pruning, implemented in C++ to determine the latest search results. This leverages the high efficiency, flexible memory management, and strong hardware resource adaptability of the C++ compiled language, ensuring high-speed node and branch retrieval in power grid topology traversal scenarios. It is suitable for the resource-constrained environments of embedded systems and other real-world power grid applications. Furthermore, by combining the IDDFS algorithm with pruning logic, the search is performed only on nodes corresponding to connected branches during traversal, effectively avoiding resource consumption from invalid traversals. Simultaneously, the iterative deepening approach balances the path retrieval advantages of depth-first search with the completeness of breadth-first search, ensuring accurate and comprehensive finding of target nodes and valid connection paths, avoiding search omissions or getting stuck in an infinitely deep traversal. Meanwhile, the algorithm implemented in C++ has clear logic, strong maintainability, and is easy to integrate with other functional modules of power grid topology modeling. It can quickly output the latest search results containing effective power supply paths and node logical relationships, which helps to significantly improve the efficiency, accuracy and stability of power grid topology traversal search. It also adapts to the traversal requirements of complex power grid topologies, effectively balancing the completeness of the search and execution efficiency, and reducing hardware resource consumption.
[0045] In some embodiments, step 220, which involves traversing and searching the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results, further includes: Step 220: Employ a non-recursive depth-first search algorithm to traverse and search the target node and target branch, determining the latest search result. The non-recursive depth-first search algorithm uses an explicit stack to manage the target nodes to be visited; the explicit stack stores pointers to the target nodes to be visited.
[0046] Specifically, considering that the traditional recursive depth-first search (DFS) algorithm relies on the programming language's call stack to store recursion level information, when the power grid topology is complex, the number of nodes is large, or the traversal depth is large, the stack grows linearly with the recursion depth, which can easily lead to stack overflow due to the call stack depth exceeding the system limit, causing the program to crash. In contrast, the non-recursive depth-first search (DFS) algorithm implements a manually created explicit stack to manage the nodes to be visited. The size of the stack can be flexibly controlled, completely eliminating the dependence on the system call stack and adapting to resource-constrained hardware platforms such as embedded systems.
[0047] Meanwhile, the non-recursive DFS algorithm can manage the target nodes to be visited through an explicit stack. The explicit stack stores pointers to the target nodes, allowing for flexible adjustments to the logic of pushing and popping nodes during traversal. For example, it can accurately filter the nodes to be visited based on the on / off status of power grid branches and the logical relationships between devices. Furthermore, it can pause, resume, or terminate the search as needed during traversal. Compared to the recursive DFS algorithm, it is easier to integrate with functions such as topology updates and path filtering, adapting to the needs of dynamically changing power grid topologies. Moreover, since the explicit stack only stores node pointers, it significantly reduces memory usage, helping to improve the algorithm's operational stability in resource-constrained scenarios, making it particularly suitable for industrial scenarios like power grid topologies that require long-term stable and safe operation.
[0048] Based on this, this embodiment adopts a non-recursive DFS algorithm, which pushes the preset starting node onto the explicit stack; pops the current node from the top of the explicit stack; if the current node has not been visited, pushes the adjacent nodes that are connected to the current node through the conducting branch and have not been visited onto the explicit stack, and marks the current node as visited, thereby realizing the traversal search of the target node and the target branch and determining the latest search result.
[0049] As an exemplary example, a pre-constructed power grid topology is used to determine a preset starting node for traversal searching. This starting node is then abstracted using a node and branch model based on graph theory and object-oriented design, including attributes such as device identifier, device type, operating status, control mode, and neighbor list. The device type is constructed using object-oriented design, and its attributes include at least one of the following: device identifier information, device type information, device operating status, control mode, and neighbor list. The neighbor list stores pointers to devices on adjacent nodes, the on / off status of switching elements connected to adjacent nodes, and the type of logical relationship.
[0050] Then, the pointer of the preset starting node is pushed onto a pre-created explicit stack. The sequence of nodes to be visited is manually managed through the explicit stack, providing an initial traversal object for the traversal search. At the same time, the stack resource occupation problem that may be caused by traditional recursive calls is avoided, so as to adapt to the resource constraints of the embedded system.
[0051] Pop a node from the top of the explicit stack as the current node. First, check if the current node has been included in the access mark set. If the current node has not been visited, traverse its neighbor list, filter out unvisited adjacent nodes connected to the current node by a conducting branch, and push the pointers of these adjacent nodes onto the explicit stack in sequence. A conducting branch refers to a switching element in a closed conducting state. At the same time, add the current node to the access mark set, completing the access mark for the node. The entire process only stores the necessary node pointers. By manually managing the push and pop operations of the explicit stack, the peak memory usage is significantly reduced, avoiding the risk of stack overflow caused by excessive recursion. This ensures efficient and stable traversal of target nodes and target branches in complex power grid topologies, ultimately obtaining the latest search results including node connection paths and logical relationships.
[0052] For example, the C++ code implementation for determining the latest search result using a non-recursive DFS algorithm is as follows: void non_recursive_dfs(Device*start) { std::stack<Device*> stack std::unordered_set<Device*> visited? stack.push(start); while(!stack.empty()) { Device*current=stack.top(); stack.pop(); if(visited.count(current))continue; visited.insert(current); for(auto&[neighbor,breaker_status,relation]:current->neighbors) { if(breaker_status=="On"&&!visited.count(neighbor)) { stack.push(neighbor); } } } } In this example, a non-recursive Depth-First Search (DFS) algorithm is used for traversal and search, and the latest search results are determined through C++ code. This leverages the high performance, high execution efficiency, flexible memory manipulation, and strong adaptability to embedded hardware platforms of C++ as a compiled language, ensuring that the algorithm achieves high-speed target node and branch retrieval in power grid topology traversal scenarios. It adapts to the resource constraints of the power grid system and completely eliminates the dependence on the system call stack by manually managing the target nodes to be visited through an explicit stack. This fundamentally avoids the stack overflow risk caused by the complexity of the power grid topology and the large traversal depth of traditional recursive DFS, significantly improving the stability of the algorithm. Meanwhile, the non-recursive DFS implemented in C++ can precisely embed pruning logic during traversal, searching only unvisited nodes associated with connected branches. Combined with C++'s efficient container and pointer operations, it reduces resource consumption caused by invalid traversals, precisely controls peak memory usage, and the algorithm logic is highly adaptable to the node-branch abstract model of power grid topology modeling. It is easy to seamlessly integrate with other C++-developed functional modules such as topology updates and visualization rendering, and can quickly extract and output the latest search results containing valid device connection paths and logical relationships between nodes. In addition, the C++ code has strong maintainability and extensibility, and can flexibly adapt to the dynamic changes in power grid topology, significantly improving the efficiency, stability, and compatibility of topology traversal search in complex power grid scenarios, balancing retrieval speed and operational reliability.
[0053] In some embodiments, step 300, based on the latest search results, dynamically updates the pre-built power grid topology and the connection relationships between devices, including: Step 310: Based on the latest search results, determine the latest association information corresponding to the target node and the target branch. The latest association information includes at least the device connection status, logical relationship and control mode.
[0054] Specifically, based on the latest search results, the system extracts and integrates various key information related to the target node and target branch to form the latest association information. Among them, the device connection status indicates whether the target node and adjacent devices are in a valid conductive state through the branch; the logical relationship indicates the functional association type between devices, such as power supply, standby, load connection, parallel cooperation, etc.; the control mode indicates the current control mode of the target node, including automatic control mode, semi-automatic control mode, manual control mode, or a custom control mode extended by configuration. This embodiment does not impose specific restrictions on the type of control model to ensure that the latest association information can completely and accurately reflect the real-time status of the target node and target branch.
[0055] Step 320: Based on the latest correlation information, determine the area where the power grid topology has changed.
[0056] Specifically, based on the latest correlation information, the system compares and analyzes the latest correlation information with the original corresponding information in the pre-built power grid topology to identify the differences. By judging the number of target nodes, the range of target branches, and the scale of related equipment affected by the differences, the system determines the area where the power grid topology has changed: if only the control mode switching of a single target node or the on / off state change of a single target branch has occurred, and it has not affected the correlation between other nodes and branches, it is determined to be a local area change; if it involves the coordinated changes of multiple target nodes and multiple target branches, or the addition of new equipment, adjustment of core power supply paths, etc., and the scope of impact covers the local or global power grid, it is determined to be the corresponding expanded area.
[0057] Step 330: Based on the latest associated information, dynamically update the power grid topology and the connection relationships between devices within the region.
[0058] Specifically, based on the scope of the changed area and the latest related information, the power grid topology and the interconnections between devices are dynamically updated. For changes in a localized area, only the target nodes and branches within that area are adjusted, updating the control modes of the target nodes, the on / off states of the corresponding branches, and the logical relationships between devices, while keeping the topology outside the area unchanged. For changes in a larger area, all relevant nodes and branches within that area are traversed, updating the control modes and operating states of the nodes and the on / off states of the branches one by one. The logical relationships and connection information in the node neighbor association list are adjusted synchronously, and connectivity detection (such as island detection and redundant path identification) is performed to reconstruct the effective power supply paths within the area, ensuring that the updated power grid topology and device interconnections can reflect the actual operation of the power grid in real time and accurately.
[0059] In some embodiments, the method further includes step 400, specifically including: In response to switching the control mode of any node, the state of the node in the power grid topology is updated according to the preset topology adaptation logic corresponding to different control modes, and the power grid topology is updated.
[0060] Specifically, upon receiving an operation command to switch the control mode of any node in the power grid, the system first identifies the target node and the target control mode to be switched to. This target control mode can be one of the following: automatic control mode, semi-automatic control mode, or manual control mode, or a custom control mode that can be extended through configuration. Then, a preset control mode switching function is called to locate the device corresponding to the target node, update its original control mode to the target control mode, and simultaneously update the device status information of the node to ensure that the node attributes and control mode remain consistent. The control mode switching function is used to respond to the switching requirements of node control modes in the power grid, achieving accurate updates of device control modes and execution of corresponding topology adaptation logic, ensuring synchronous adaptation between the power grid topology and the control mode.
[0061] Based on the target control mode after the switch, the system executes the corresponding topology adaptation logic. In automatic control mode, automatic scheduling mechanisms such as load balancing are triggered to optimize power supply paths and resource allocation. In semi-automatic control mode, the system enters a state awaiting user confirmation, performing topology adjustments only after the user completes the relevant operations. In manual control mode, the system's automatic scheduling logic is disabled, requiring the user to manually manage node connections and topology structure. In custom control mode, the corresponding topology adaptation process is executed according to preset custom rules. Simultaneously, the switching of control modes triggers dynamic updates to the power grid topology. By traversing the target node's neighbor list and related branch information, the system adjusts the connection logic and power supply paths between nodes to ensure the entire power grid topology adapts to the current control mode, guaranteeing stable power grid operation.
[0062] In some embodiments, the method further includes: The power grid topology is dynamically updated in response to changes in the state of any branch.
[0063] Specifically, when the state of any branch in the power grid changes, for example, ... Figure 4 As shown, the initial state of the circuit breakers on the branches containing G2 and DB1 is "Off" (disconnected). Only the branch consisting of G1→DB1→L1 is a conducting path. When G2 starts and closes the circuit breaker, the system captures this state change signal in real time and locates the target node and target branch associated with this branch. It automatically identifies the newly added conducting path, namely the branch consisting of G2→DB1→L1. Then, it triggers the preset topology update mechanism, traversing the neighbor list of the target node through the topology update function, finding the associated entry corresponding to this branch, updating its original on / off state of the switching elements to the latest state, completing the dynamic adjustment of the connection relationship between devices, and thus realizing the real-time update of the power grid topology.
[0064] After the topology is updated, the system automatically triggers the path search process, selecting either an iterative depth-first search algorithm or a non-recursive depth-first search algorithm. Based on the updated topology, the system retraces the target nodes and branches, filters out valid conductive branches, identifies and generates the latest connection paths and logical relationships between devices, and finally obtains a topology that reflects the actual connection status of the current power grid, ensuring that operations such as power grid control, fault diagnosis, and load distribution can be performed based on accurate topology information.
[0065] For example, the C++ code implementation process for the topology update mechanism is as follows: void update_topology(Device*device,Device*neighbor,conststd::string&new_ status) { for(auto&[nbr,status,rel]:device->neighbors) { if (nbr == neighbor) { status = new_status; break } } } void switch_control_mode(Device*device,conststd::string&new_mode) { device->control_mode=new_mode; if(new_mode=="auto") { std::cout< <device->name << "Switched to automatic mode, performing load balancing...\n"; } elseif(new_mode=="semi-auto") { std::cout< <device->name << "Semi-automatic mode has been switched, awaiting user confirmation..."; } else if (new_mode=="manual") { std::cout< <device->name << "Switched to manual mode, automatic logic disabled...\n"; } else { std::cout< <device->name << "Switched to custom mode:" < <new_mode<<"\n"; } } Here, update_topology represents the function encapsulated based on the topology update mechanism, and switch_control_mode represents the control mode switching function.
[0066] This example demonstrates a topology update mechanism implemented in C++, which combines high update efficiency, data accuracy, operational stability, and scalability. It reduces resource consumption and improves update response speed through lightweight data structures and regionalized update logic, while accurately synchronizing the state changes of power grid equipment to ensure consistency between topology data and reality. Furthermore, leveraging the characteristics of the C++ language, it achieves seamless integration with other functional modules of the power grid topology system, adapting to resource-constrained industrial hardware platforms. This provides reliable dynamic topology data maintenance for various power grid operation and control procedures, effectively solving the problems of low efficiency and inconsistency with actual conditions in traditional static topology maintenance.
[0067] In some embodiments, after dynamically updating the pre-built power grid topology and the connection relationships between devices based on the latest search results, the method further includes: Visualize and render target information in the power grid topology, including but not limited to the connectivity status of each branch, the logical relationships between devices, and the on / off status of switching elements.
[0068] Specifically, after generating and updating the current power grid topology, the system initiates a topology visualization rendering process. This function is deployed on local human-machine interface (HMI) screens, remote terminals, or web front-ends. During the rendering process, based on the latest topology data, the system first restores the location distribution and connection relationships of all equipment nodes in the power grid, presenting the relationships between nodes in a clear graphical form.
[0069] Different visual styles are used to distinguish branches in different states. For example, branches in a closed conducting state are displayed with a preset identifier color (such as green) to intuitively show the effective connection between devices; branches in a disconnected isolation state are displayed with another preset identifier color (such as red) to clearly mark the invalid connection path. At the same time, based on the control mode and logical relationship type of the device nodes, active paths and backup paths are highlighted, and key information such as device name and control mode are displayed simultaneously, output in the form of logs and alarm information. This allows operators to intuitively grasp the real-time status of the power grid topology and provides a visual basis for subsequent control adjustments and fault diagnosis.
[0070] On the other hand, this embodiment provides a system for constructing the connection relationship of power grid equipment, such as... Figure 5 As shown, it includes: The control and monitoring module 501 is used to respond to the control action trigger signal of the power grid and determine the target node and target branch associated with the control action in the pre-built power grid topology. The pre-built power grid topology consists of multiple nodes and branches. The nodes are the equipment in the power grid, and the branches are composed of switching elements and their on / off states. The switching elements are used to make electrical connections with the equipment. The search module 502 is used to traverse and search the target nodes and target branches in the pre-built power grid topology and determine the latest search results. Update module 503 is used to update the pre-built power grid topology and the connection relationships between devices based on the latest search results.
[0071] This embodiment also provides a shipboard electrical grid device, such as... Figure 6 As shown, it includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements the method of any of the above embodiments.
[0072] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps of any of the methods in the above embodiments.
[0073] In the embodiments of this application, the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0074] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0075] The foregoing has provided a detailed description of a method, system, and shipboard power grid equipment for constructing a power grid connection relationship, as well as specific examples used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for constructing the connection relationship of power grid equipment, characterized in that, Includes the following steps: In response to a control action trigger signal from the power grid, target nodes and target branches associated with the control action are determined in a pre-constructed power grid topology. The pre-constructed power grid topology consists of multiple nodes and branches. The nodes are devices in the power grid, and the branches consist of switching elements and their on / off states. The switching elements are used to make electrical connections with the devices. The target node and the target branch in the pre-constructed power grid topology are traversed and searched to determine the latest search results; Based on the latest search results, update the pre-built power grid topology and the connection relationships between the devices.
2. The method for constructing the connection relationship of power grid equipment as described in claim 1, characterized in that, A traversal search is performed on the target node and the target branch in the pre-constructed power grid topology to determine the latest search result, including: An iterative deepening depth-first search algorithm is used to perform a pruned depth-first search on the target node and the target branch to determine the latest search result.
3. The method for constructing the connection relationship of power grid equipment as described in claim 2, characterized in that, The iterative deepening depth-first search algorithm performs a pruned depth-first search on the target node and the target branch to determine the latest search result, including: Initialize the search depth of the depth-first search algorithm with iterative deepening; Under the search depth limit, a pruned depth-first search is performed starting from a preset starting node. The pruned depth-first search is used to traverse the connected branches in the target branch. If the target node is not found, the search depth is iteratively increased and the search is repeated until the target node is found or the search depth reaches the preset upper limit of the search depth, and the latest search result is determined.
4. The method for constructing the connection relationship of power grid equipment as described in claim 1, characterized in that, A traversal search is performed on the target node and the target branch in the pre-constructed power grid topology to determine the latest search result, including: A non-recursive depth-first search algorithm is used to traverse and search the target node and the target branch to determine the latest search result. The non-recursive depth-first search algorithm uses an explicit stack to manage the target node to be visited.
5. The method for constructing the connection relationship of power grid equipment as described in claim 4, characterized in that, The non-recursive depth-first search algorithm is used to traverse and search the target node and the target branch to determine the latest search result, including: Push the preset starting node onto the explicit stack; Pop the current node from the top of the display stack. If the current node has not been visited, push the adjacent nodes onto the explicit stack and mark the current node as visited. The adjacent nodes refer to nodes that are connected to the current node by a conductive branch and have not been visited.
6. The method for constructing the connection relationship of power grid equipment as described in claim 5, characterized in that, The attributes of the branch include at least the on / off state of the switching element and the logical relationship between the devices, wherein the type of the logical relationship includes at least one of the following: feeder relationship, backup relationship, and load connection relationship.
7. The method for constructing the connection relationship of power grid equipment as described in claim 6, characterized in that, The device type is constructed using object-oriented design. The attributes of the device type include at least one of the following: device identification information, device type information, device operating status, control mode, and a neighbor list. The neighbor list is used to store pointers to devices on adjacent nodes, the on / off status of switching elements connected to the adjacent nodes, and the type of logical relationship.
8. The method for constructing the connection relationship of power grid equipment as described in claim 7, characterized in that, Based on the latest search results, the pre-built power grid topology and the connection relationships between the devices are dynamically updated, including: Based on the latest search results, determine the latest association information corresponding to the target node and the target branch. The latest association information includes at least the device connection status, logical relationship and control mode. Based on the latest correlation information, the range of areas where the power grid topology has changed is determined; Based on the latest associated information, the power grid topology and the connection relationships between the devices within the region are dynamically updated.
9. The method for constructing the connection relationship of power grid equipment as described in claim 8, characterized in that, The method further includes: In response to switching the control mode of any of the nodes, the state of the node in the power grid topology is updated according to the preset topology adaptation logic corresponding to different control modes, and the power grid topology is updated.
10. The method for constructing the connection relationship of power grid equipment as described in any one of claims 1 to 9, characterized in that, After dynamically updating the pre-built power grid topology and the connection relationships between the devices based on the latest search results, the method further includes: The target information in the power grid topology is visualized and rendered, wherein the target information includes, but is not limited to, the connectivity status of each branch, the logical relationship between devices, and the on / off status of switching elements.
11. A system for constructing connection relationships for power grid equipment, characterized in that, include: A control and monitoring module is used to respond to a control action trigger signal from the power grid and determine the target node and target branch associated with the control action in a pre-constructed power grid topology. The pre-constructed power grid topology consists of multiple nodes and branches. The nodes are devices in the power grid, and the branches are composed of switching elements and their on / off states. The switching elements are used to make electrical connections with the devices. The search module is used to traverse and search the target nodes and target branches in the pre-constructed power grid topology to determine the latest search results; An update module is used to update the pre-built power grid topology and the connection relationships between the devices based on the latest search results.
12. A shipboard electrical grid device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the computer program, when executed by the processor, implements the method for constructing the connection relationship of power grid equipment as described in any one of claims 1-10.