Charging pile power distribution method and system based on depth-first algorithm
By adopting a power allocation method for charging piles based on a depth-first algorithm, the shortcomings of traditional charging piles in real-time demand adjustment and topology relationship processing are solved, realizing efficient, safe, and maintainable power allocation of the charging pile system, improving user experience and reducing operating costs.
Patent Information
- Application Number
- CN202511060684.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2025-11-11
AI Technical Summary
Traditional charging piles cannot flexibly adjust power distribution according to real-time demand, resulting in insufficient or excessive power distribution to some charging guns, which affects user experience and increases operating costs. At the same time, they do not take into account the complex power topology within the charging pile, which may cause equipment overload and safety issues.
A power allocation method for charging piles based on a depth-first search algorithm is adopted. By establishing a host power topology adjacency matrix and optimizing the real-time adjacency matrix, the depth-first search algorithm is used to calculate the charging path and path efficiency, eliminate inefficient paths, select the path with the highest weighted priority, and perform cross-validation to ensure the physical executability of the path.
It enables dynamic and flexible power allocation based on real-time charging demand, improving user experience, reducing operating costs, and facilitating maintenance when devices are expanded or the topology changes, thus enhancing the system's scientific nature and safety.
Smart Images

Figure CN120921964A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of charging pile power allocation technology, and relates to a charging pile power allocation method and system based on depth-first search algorithm. Background Technology
[0002] With the rapid development of the electric vehicle market, charging stations, as an important supporting infrastructure for electric vehicles, are increasing in number and their functional requirements are becoming increasingly complex and diverse. Charging station systems typically employ a model of one main unit paired with multiple terminals to meet the need for charging multiple electric vehicles simultaneously.
[0003] However, in actual operation, differences in battery characteristics, remaining charge, and user-set charging goals among various electric vehicles cause the real-time charging power demand of each charging gun to change dynamically and be difficult to predict accurately. Traditional charging piles often employ fixed power allocation strategies, which cannot be flexibly adjusted according to real-time demand. This results in some charging guns receiving insufficient power, prolonging vehicle charging time and affecting user experience; while other charging guns receive excessive power, leading to energy waste and increased operating costs.
[0004] Furthermore, charging piles have complex internal power topologies, with varying power transmission paths, line losses, and equipment load-bearing capacities between different terminals and the main unit. Existing technologies do not consider this factor when allocating power, resulting in a lack of scientific and rational power distribution. This fails to achieve optimal utilization of the overall power and may lead to safety issues such as equipment overload and damage due to improper power allocation. Summary of the Invention
[0005] In view of the shortcomings of existing technologies, the present invention aims to provide a charging pile power allocation method and system based on a depth-first algorithm.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: This invention provides a power allocation method for charging piles based on a depth-first search algorithm, comprising the following steps: establishing a host power topology adjacency matrix as an initial adjacency matrix; acquiring the host fault status and optimizing the initial adjacency matrix to obtain a real-time adjacency matrix; when a host fault status or a change in charging gun power demand is detected, taking each charging gun as a starting point, the real-time adjacency matrix calculates each charging path and its efficiency using a depth-first search algorithm; eliminating charging paths with efficiencies lower than a preset value, calculating the weighted priority of the remaining paths, and selecting the charging path with the highest weighted priority as the target path; performing cross-validation between the target path and the parallel contactor path, outputting the target path if the cross-validation is successful, otherwise outputting the path that was successfully validated in the last instance.
[0007] Furthermore, the path efficiency is: Path efficiency =
[0008] in, This represents the total number of units actually allocated. This represents the total number of available units.
[0009] Furthermore, the weighted priority rate is: Weighted priority = ×100% in, The total number of charging guns required. The total number actually allocated to charging gun g. The quantity required for the charging gun g. It is the product of the weighting factors of the charging gun g.
[0010] Furthermore, the weighting factor product of the charging gun g for:
[0011] in, For the charging gun g Each weighting factor This represents the total number of weighting factors.
[0012] Furthermore, the weighting factor product of the charging gun g This includes priority factors, health factors, and switching cost factors.
[0013] Furthermore, the optimization of the initial adjacency matrix includes: when a host failure is detected, removing the faulty node and all connecting edges from the initial adjacency matrix; when a contactor adhesion failure is detected, fixing the contactor edge as a permanent connection in the initial adjacency matrix; and when a contactor drive failure is detected, removing the contactor edge from the matrix.
[0014] Furthermore, the depth-first algorithm includes: recording the current path when the search depth reaches the required number of units; backtracking to the nearest valid branch node when encountering a faulty or occupied node; and outputting the path set of the charging gun after all branches have been traversed.
[0015] Furthermore, the cross-verification includes: verifying whether the command state and physical state of each contactor in the optimal path match; a contactor commanded to close must satisfy: non-drive failure and non-adhesive open circuit; a contactor commanded to open must satisfy: non-adhesive closure; when there is an adhesive fault contactor, it is assigned to the forced conduction path.
[0016] Furthermore, after outputting the path that was successfully verified last time, the method also includes: starting the fault diagnosis mode and recording the conflict points between the current fault matrix and the optimal path; if N consecutive verifications fail, triggering a system-level alarm and switching to the safe allocation mode; in the safe allocation mode, only the basic power module is allocated to the high-priority charging gun.
[0017] This invention also provides a charging pile power allocation system based on a depth-first search algorithm, comprising: an establishment module for establishing a host power topology adjacency matrix as an initial adjacency matrix; an optimization module for obtaining the host fault status and optimizing the initial adjacency matrix to obtain a real-time adjacency matrix; a first calculation module for calculating each charging path and its efficiency using a depth-first search algorithm, starting from each charging gun, when a host fault status or a change in charging gun power demand is detected; a second calculation module for eliminating charging paths with efficiency lower than a preset value, calculating the weighted priority of the remaining paths, and selecting the charging path with the highest weighted priority as the target path; and an output module for cross-validating the target path with the parallel contactor path, outputting the target path if the cross-validation is successful, and outputting the path that was successfully validated in the previous test otherwise.
[0018] Compared with the prior art, the present invention has the following beneficial technical effects: This invention discloses a power allocation method for charging piles based on a depth-first search algorithm. It can dynamically and flexibly adjust the power allocation according to the real-time changing charging power demand, ensuring that each electric vehicle can obtain charging power, avoiding prolonged vehicle charging time due to insufficient power allocation, improving user experience, and reducing the operating cost of charging piles.
[0019] This invention provides a power allocation method for charging piles based on a depth-first search algorithm. It optimizes the real-time adjacency matrix based on the host fault state to fully understand the actual power transmission status inside the charging pile. During the power allocation process, the depth-first search algorithm is used to calculate the charging path and efficiency, eliminate inefficient paths, and select the optimal path, thereby achieving optimal utilization of the overall power. This addresses the problem of the lack of scientific and rational power allocation in existing technologies.
[0020] This invention provides a power allocation method for charging piles based on a depth-first search algorithm. When the scale of charging piles expands, the number of terminals increases, or the power topology changes, only the ring topology needs to be adjusted accordingly. There is no need to make large-scale modifications to the power allocation search, which facilitates management and maintenance by maintenance personnel, reduces maintenance costs, and improves maintainability. Attached Figure Description
[0021] Figure 1 This is a flowchart of a power allocation method for charging piles based on a depth-first search algorithm according to the present invention. Figure 2This is a ring topology diagram of multiple charging guns in an embodiment of the present invention. Detailed Implementation
[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0023] Example 1 This invention discloses a power allocation method for charging piles based on a depth-first search algorithm, such as... Figure 1 As shown, the process includes: establishing a host power topology adjacency matrix as an initial adjacency matrix; acquiring the host fault status and optimizing the initial adjacency matrix to obtain a real-time adjacency matrix; when a host fault status or a change in charging gun power demand is detected, starting from each charging gun, the real-time adjacency matrix calculates each charging path and its efficiency using a depth-first search algorithm; eliminating charging paths with efficiencies lower than a preset value, calculating the weighted priority of the remaining paths, and selecting the charging path with the highest weighted priority as the target path; performing cross-validation between the target path and the parallel contactor path, and outputting the target path if the cross-validation is successful, otherwise outputting the path that was successfully validated in the last instance.
[0024] like Figure 2 As shown, K1-K6 represent 6 parallel contactors, and 1#-6# represent 6 charging guns and their respective 6 directly connected modules. Based on the power topology of each host, and using the general representation method of the adjacency matrix in an undirected, unweighted graph (for power modules of the same type), the initial adjacency matrix for this host type is established with the gun number of each gun as the vertex and the presence or absence of a direct parallel contactor connection between guns as their adjacency state. Under fault-free conditions, the initial adjacency matrix is the same as the real-time adjacency matrix. The initial adjacency matrix is shown in Table 1.
[0025] Table 1
[0026] From the table, we can see that the two adjacent charging guns of charging gun #1 are charging gun #2 and charging gun #6, the two adjacent charging guns of charging gun #2 are charging gun #1 and charging gun #3, and so on.
[0027] Under fault-free conditions, charging gun 1 starts charging with a requirement of 3 modules and charging gun 4 starts charging with a requirement of 4 modules. The charging paths of charging gun #1 and charging gun #4 are shown in Table 2.
[0028] Table 2
[0029] As shown in Table 2, there are 6 possible charging paths for charging gun #1, with a maximum requirement of 3 modules: charging gun #1, charging gun #1 and charging gun #2, charging gun #1, charging gun #2 and charging gun #3, charging gun #6 and charging gun #1, charging gun #5, charging gun #6 and charging gun #1, and charging gun #6, charging gun #1 and charging gun #2.
[0030] There are 8 possible charging paths for the #4 charging gun, with a maximum requirement of 4 modules: #4 charging gun, #4 charging gun and #5 charging gun, #4 charging gun, #5 charging gun and #6 charging gun, #3 charging gun and #4 charging gun, #2 charging gun, #3 charging gun and #4 charging gun, #3 charging gun, #4 charging gun and #5 charging gun, #2 charging gun, #3 charging gun, #4 charging gun and #5 charging gun, and #3 charging gun, #4 charging gun, #5 charging gun and #6 charging gun.
[0031] The possible charging paths of charging gun #1 and charging gun #4 are combined, resulting in 30 possible scenarios, as shown in Table 3.
[0032] Table 3
[0033] The path efficiency is: Path efficiency =
[0034] in, This represents the total number of units actually allocated. This represents the total number of available units.
[0035] The weighted priority is: Weighted priority = ×100% in, The total number of charging guns required. The total number actually allocated to charging gun g. The quantity required for the charging gun g. It is the product of the weighting factors of the charging gun g.
[0036] Taking path 2 as an example, there is one path for charging gun #1 and two paths for charging gun #4. Therefore, the total number of units actually allocated is... There are 3 available units. If there are 6 paths, the path efficiency is 50%. Taking path 14 as an example, there are 2 paths for charging gun #1 and 4 paths for charging gun #4. Therefore, the total number of units actually allocated is... There are 6 available units. If there are 6 paths, the path efficiency is 100%.
[0037] Taking path 2 as an example, the actual total number of charging guns #1 (g) allocated is 1. The required number of charging guns g is... There are 3 weighted factors, which are the product of the weights of the charging gun g. The actual total number of charging guns #1 and #4 (g) allocated is 2. The required number of charging guns (g) is... There are 4 weighted factors for the charging gun g. If the value is 1, then the weighted priority rate is... ×1× The percentage is 17%. Taking path 14 as an example, the actual total number of charging guns #1 (g) allocated is 2. The required number of charging guns g is... There are 3 weighted factors, which are the product of the weights of the charging gun g. The actual total number of charging guns g (1 and 4) allocated is 4. The required number of charging guns g is... There are 4 weight factors for the charging gun g. If the value is 1, then the weighted priority rate is... ×1× It is 67%.
[0038] In summary, paths 14, 23, 26, and 30 have the highest efficiency, and paths 26 and 30 have the highest weighted priority. Therefore, the optimal path allocation is paths 26 and 30. At this point, path 26 is output in order for subsequent verification and output.
[0039] If a fault is detected in the parallel contactor K2, indicating a malfunction in the host, the initial adjacency matrix is optimized to obtain a real-time adjacency matrix. The implemented adjacency matrix is shown in Table 4.
[0040] Table 4
[0041] As can be seen from the table, due to the fault of the parallel contactor K2, charging gun #2 and charging gun #3 will not perform power distribution.
[0042] The charging paths for charging gun #1 and charging gun #4 are shown in Table 5.
[0043] Table 5
[0044] As shown in Table 5, there are three possible charging paths for charging gun #1, with a maximum requirement of three modules: charging gun #1, charging gun #6 and charging gun #1, and charging gun #5, charging gun #6 and charging gun #1.
[0045] There are three possible charging paths for the #4 charging gun, with a maximum requirement of four modules: #4 charging gun, #4 charging gun and #5 charging gun, and #4 charging gun, #5 charging gun and #6 charging gun.
[0046] Combining the possible charging paths of charging gun #1 and charging gun #4, there are a total of 6 cases, as shown in Table 6.
[0047] Table 6
[0048] Taking path 3 as an example, there is one path for charging gun #1 and three paths for charging gun #4. Therefore, the total number of units actually allocated is... There are 4 available units. If there are 6 paths, the path efficiency is 67%. Taking path 5 as an example, there are 2 paths for charging gun #1 and 2 paths for charging gun #4. Therefore, the total number of units actually allocated is... There are 4 available units. If there are 6 paths, the path efficiency is 67%.
[0049] Taking path 3 as an example, the actual total number of charging guns #1 (g) allocated is 1. The required number of charging guns g is... There are 3 weighted factors, which are the product of the weights of the charging gun g. The actual total number of charging guns g (1 and 4) allocated is 3. The required number of charging guns g is... There are 4 weight factors for the charging gun g. If the value is 1, then the weighted priority rate is... ×1× The percentage is 25%. Taking path 5 as an example, the actual total number of charging guns #1 (g) allocated is 2. The required number of charging guns g is... There are 3 weighted factors, which are the product of the weights of the charging gun g. The actual total number of charging guns #1 and #4 (g) allocated is 2. The required number of charging guns (g) is... There are 4 weight factors for the charging gun g. If the value is 1, then the weighted priority rate is... ×1× It is 33%.
[0050] In summary, paths 3, 5, and 6 have the highest efficiency, and path 5 has the highest weighted priority. Therefore, path 5 is the optimal allocation path. At this point, path 5 will be output in sequence for subsequent verification and output.
[0051] The weight factor product of the charging gun g for:
[0052] in, For the charging gun g Each weighting factor This represents the total number of weighting factors.
[0053] In this embodiment, the weighting factor product of the charging gun g is... The value is 1.
[0054] A tree-structured power transmission network is constructed with the power source as the root node, contactors as intermediate control nodes, and charging guns as terminal demand nodes. During initialization, the central controller collects the physical state (closed / open) and fault type (drive failure, sticking open / closed) of each contactor in real time through sensors. Combined with the power demand of the charging guns (uploaded by the vehicle's BMS) and the remaining capacity of the power source, an initial network model containing node states and topological relationships is generated. When a new charging request is detected or an existing path is interrupted due to a fault, the system initiates a depth-first search algorithm: starting from the power source, it recursively searches downwards along unoccupied contactor branches. The search depth is based on the number of charging guns as a threshold. When the path depth reaches the required number of units and covers all target charging guns, the path is recorded as a candidate path. If a faulty node (or an occupied node) is encountered during the traversal, the current branch search is immediately terminated, and the system backtracks to the most recently incompletely traversed parent node, exploring other branch paths. Explored paths are deduplicated to avoid redundant calculations. After traversal, the output contains a set of all paths that meet the conditions of "no conflict, unoccupied, and power feasible."
[0055] To ensure the physical executability of the path, a three-level cross-validation is implemented for candidate paths: First, the consistency between the contactor command state and the physical state is verified. For contactors commanded to close, their physical state must be closed and free from drive failure or sticking open circuit faults. For contactors commanded to open, their physical state must be open and free from sticking closure faults. If a state conflict exists, the path is marked as invalid. Second, the forced conduction logic for contactors with sticking faults is handled. When a contactor is detected to be stuck closed, it will be forcibly included in the path and limited to a closing command, prohibiting it from participating in the opening operation to avoid path interruption due to mechanical failure. Finally, the total power of the path is verified to ensure that it does not exceed the remaining capacity of the power source. If it exceeds the limit, low-priority branches are pruned according to the charging gun priority. After the verification is passed, the path quality is evaluated based on indicators such as path length and contactor switching times, and the optimal path is selected as the power allocation scheme. If all paths fail the verification, the fault diagnosis mode is activated: the current fault matrix, including contactor status, power source capacity, line impedance and other parameters, is recorded to identify the conflict points with the target path, such as the physical location of the failed contactor or the specific value of the power source overload, and the fault code and location information are displayed through the human-machine interface.
[0056] When the system fails verification N times consecutively, it is determined to be a systemic fault, triggering a safety protection mechanism: First, maintenance personnel are notified via audible and visual alarms or remote communication. Simultaneously, the system automatically switches to a safe allocation mode. In this mode, the system only retains the power supply capacity of basic power modules (such as the smallest charging power unit) and provides basic charging services only to emergency charging vehicles or high-priority users according to the principle of "highest priority charging gun priority allocation." Second, all unnecessary contactors are isolated, maintaining only the path related to the highest priority charging gun, reducing system complexity and the risk of fault propagation. Finally, confirmed faulty nodes (such as stuck contactors or driver failure modules) are locked, prohibiting them from participating in subsequent power allocation until the fault is repaired and passes self-test. After fault repair, the system rescans the contactor status, updates the fault matrix, and restarts the deep search and cross-verification process, restoring the dynamic power allocation function.
[0057] Example 2 This invention also provides a charging pile power allocation system based on a depth-first search algorithm, comprising: an establishment module for establishing a host power topology adjacency matrix as an initial adjacency matrix; an optimization module for obtaining the host fault status and optimizing the initial adjacency matrix to obtain a real-time adjacency matrix; a first calculation module for calculating each charging path and its efficiency using a depth-first search algorithm, starting from each charging gun, when a host fault status or a change in charging gun power demand is detected; a second calculation module for eliminating charging paths with efficiency lower than a preset value, calculating the weighted priority of the remaining paths, and selecting the charging path with the highest weighted priority as the target path; and an output module for cross-validating the target path with the parallel contactor path, outputting the target path if the cross-validation is successful, and outputting the path that was successfully validated in the previous test otherwise.
[0058] The charging pile power allocation system based on the depth-first algorithm provided by this invention can implement the same method steps as the above method, so it will not be described again.
[0059] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention 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 the invention 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 a 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.
Claims
1. A power allocation method for charging piles based on a depth-first search algorithm, characterized in that, Includes the following steps: Establish the host power topology adjacency matrix as the initial adjacency matrix; Obtain the host fault status and optimize the initial adjacency matrix to obtain the real-time adjacency matrix; When a host malfunction or a change in the power demand of the charging gun is detected, the real-time adjacency matrix, starting from each charging gun, calculates each charging path and its efficiency using a depth-first algorithm. Eliminate charging paths with efficiency lower than a preset value, calculate the weighted priority of the remaining paths, and select the charging path with the highest weighted priority as the target path. The target path is cross-validated with the parallel contactor path. If the verification is successful, the target path is output; otherwise, the path that was successfully verified in the previous test is output.
2. The charging pile power allocation method based on depth-first search algorithm according to claim 1, characterized in that, The path efficiency is: Path efficiency = in, This represents the total number of units actually allocated. This represents the total number of available units.
3. The charging pile power allocation method based on depth-first search algorithm according to claim 2, characterized in that, The weighted priority is: Weighted priority = ×100% in, The total number of charging guns required. The total number actually allocated to charging gun g. The quantity required for the charging gun g. It is the product of the weighting factors of the charging gun g.
4. The charging pile power allocation method based on depth-first search algorithm according to claim 3, characterized in that, The weight factor product of the charging gun g for: in, For the charging gun g Each weighting factor This represents the total number of weighting factors.
5. The charging pile power allocation method based on depth-first search algorithm according to claim 4, characterized in that: The weight factor product of the charging gun g This includes priority factors, health factors, and switching cost factors.
6. The charging pile power allocation method based on depth-first search algorithm according to claim 1, characterized in that, The optimization of the initial adjacency matrix includes: When a host failure is detected, the failed node and all connecting edges are removed from the initial adjacency matrix; When a contactor adhesion fault is detected, the contactor edge is permanently connected in the initial adjacency matrix; When a contactor drive failure is detected, the contactor edge is removed from the matrix.
7. The charging pile power allocation method based on depth-first search algorithm according to claim 1, characterized in that: The depth-first search algorithm includes: When the search depth reaches the required number of units, record the current path; When encountering a faulty or occupied node, backtrack to the nearest valid branch node; After all branches have been traversed, output the set of paths for the charging gun.
8. The charging pile power allocation method based on depth-first search algorithm according to claim 1, characterized in that, The cross-validation includes: Verify whether the command state and physical state of each contactor in the target path match. The contactor commanded to close must meet the following requirements: no drive failure and no sticking open circuit; the contactor commanded to open must meet the following requirements: no sticking closure. When a contactor with an adhesion fault is present, it is assigned to a forced conduction path.
9. The charging pile power allocation method based on depth-first search algorithm according to claim 1, characterized in that, The output of the previously successfully verified path also includes: Start the fault diagnosis mode and record the conflict points between the current fault matrix and the target path; If N consecutive verifications fail, a system-level alarm will be triggered and the system will switch to secure allocation mode. In safe allocation mode, only the basic power module is allocated to the highest priority charging gun.
10. A power allocation system for charging piles based on a depth-first search algorithm, characterized in that, include: Establishment module: Used to establish the host power topology adjacency matrix, as the initial adjacency matrix; Optimization module: used to obtain the host fault status and optimize the initial adjacency matrix to obtain the real-time adjacency matrix; First calculation module: When a host failure state or a change in the power demand of the charging gun is detected, the real-time adjacency matrix, starting from each charging gun, calculates each charging path and its efficiency through a depth-first search algorithm. The second calculation module is used to eliminate charging paths with efficiency lower than a preset value, calculate the weighted priority of the remaining paths, and select the charging path with the highest weighted priority as the target path. Output module: Used to cross-validate the target path with the parallel contactor path. If the verification is successful, the target path is output; otherwise, the path that was successfully verified in the last verification is output.
Citation Information
Cited By
Power distribution method, device and equipment for direct current charging and storage medium
CN121291193A
Power distribution path determination method and device and computer readable storage medium
CN121848980A
Power allocation path determination method, apparatus, and computer readable storage medium
CN121848980B