MCU-based battery charging and discharging method, system, device and storage medium

Through the MCU-based partitioning method and the double-layer deep reinforcement learning model, the problems of large computing load and slow response speed in battery pack management are solved, efficient and stable battery pack charging and discharging control are achieved, and the energy utilization efficiency and temperature balance of the system are improved.

CN119813479BActive Publication Date: 2025-08-22SHENZHEN LYNNYL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510286882.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-08-22
Estimated Expiration
2045-03-12

AI Technical Summary

Technical Problem

In traditional battery pack management, the calculation load is large, the response speed is slow, and the robustness is poor. There are temperature imbalance and uneven energy distribution problems during the charging and discharging process. The existing state monitoring methods lack in-depth analysis of the multi-parameter coupling relationship, which leads to the impact of system stability and reliability.

Method used

The partitioning method based on MCU is adopted, and the module group division results are generated through spatial coordinate data partitioning, polynomial fitting and K-means clustering, combined with physical position constraints, and a two-layer deep reinforcement learning model is used for charging and discharging control to realize a distributed control strategy.

Benefits of technology

It reduces the complexity of partition computing, improves the real-time and computing efficiency of the system, enhances control accuracy and response speed, reduces communication overhead, improves system scalability and robustness, and improves energy utilization efficiency and temperature equalization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119813479B_ABST
    Figure CN119813479B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of battery charging and discharging, and discloses a battery charging and discharging method, system, device and storage medium based on an MCU. The method comprises: collecting spatial coordinate data of all battery cells in a battery pack based on the MCU and performing partitioning to obtain initial partitions of the battery cells; performing polynomial fitting operations on the charge and discharge characteristics of the battery cells to obtain a battery characteristic numerical matrix; performing K-means clustering to obtain module group partitioning results; calculating boundary battery cells of adjacent module groups in the module group partitioning results to obtain optimal module group boundary positions; determining real-time status data of each module group and inputting the data into a two-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group. The present invention realizes adaptive adjustment of module group boundaries, effectively improving the energy utilization efficiency and temperature balance of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of battery charging and discharging, and in particular to a battery charging and discharging method, system, device and storage medium based on an MCU. Background Art

[0002] Traditional centralized control approaches for large-scale battery pack management face challenges such as heavy computational load, slow response, and poor robustness. Existing battery pack partitioning approaches typically require calculating the state correlations between all battery cells, resulting in computational complexity that grows quadratically with pack size, making these approaches inefficient for large battery packs.

[0003] Current battery pack charge and discharge control strategies are primarily based on simplified models or empirical rules, making them difficult to adapt to the dynamic characteristics of battery packs under actual operating conditions. Traditional control methods fail to fully account for the differences between battery cells, resulting in significant temperature imbalances and uneven energy distribution between cells during the charge and discharge process, affecting the battery pack's service life and safety. Furthermore, existing battery status monitoring methods primarily rely on threshold determination of a single parameter, lacking in-depth analysis of multi-parameter coupling relationships, making it difficult to accurately identify potential abnormal conditions. In the event of sensor failure or data loss, system stability and reliability can be severely impacted. Summary of the Invention

[0004] The present invention provides a battery charging and discharging method, system, device and storage medium based on MCU. The present invention realizes adaptive adjustment of module group boundaries, effectively improving the energy utilization efficiency and temperature balance of the system.

[0005] In a first aspect, the present invention provides a battery charging and discharging method based on an MCU, the battery charging and discharging method based on an MCU comprising:

[0006] The MCU collects spatial coordinate data of all battery cells in the battery pack, and divides the battery cells into zones according to the spatial coordinate data to obtain initial zones of the battery cells;

[0007] Performing charge and discharge characteristic data collection and polynomial fitting calculation on the battery cells in the initial partition to obtain a battery characteristic numerical matrix;

[0008] Performing K-means clustering based on the battery characteristic numerical matrix and combining the physical position constraints of the battery cells to obtain module group division results;

[0009] Performing state parameter difference calculation and dynamic programming optimization operation on boundary battery cells of adjacent module groups in the module group division result to obtain the optimal module group boundary position;

[0010] The real-time status data of each module group is determined based on the optimal module group boundary position, and the real-time status data is input into a two-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group.

[0011] In a second aspect, the present invention provides a battery charging and discharging system based on an MCU, the battery charging and discharging system based on an MCU comprising:

[0012] An acquisition module, configured to acquire spatial coordinate data of all battery cells in the battery pack based on the MCU, and partition the battery cells according to the spatial coordinate data to obtain initial partitions of the battery cells;

[0013] A calculation module, configured to collect charge and discharge characteristic data and perform polynomial fitting calculations on the battery cells in the initial partition to obtain a battery characteristic numerical matrix;

[0014] A clustering module, configured to perform K-means clustering based on the battery characteristic numerical matrix and combine the physical location constraints of the battery cells to obtain a module group division result;

[0015] A planning module, configured to calculate the state parameter difference and perform dynamic programming optimization on the boundary battery cells of adjacent module groups in the module group division result to obtain the optimal module group boundary position;

[0016] An analysis module is used to determine the real-time status data of each module group based on the boundary position of the optimal module group, and input the real-time status data into a two-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group.

[0017] A third aspect of the present invention provides a computer device comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the computer device executes the above-mentioned MCU-based battery charging and discharging method.

[0018] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, enable the computer to execute the above-mentioned MCU-based battery charging and discharging method.

[0019] In the technical solution provided by the present invention, the complexity of the partition calculation is reduced by introducing a partitioning method with spatial position constraints, so that the calculation amount is only linearly related to the number of battery cells, thereby improving the real-time performance and calculation efficiency of the system; a sub-module clustering method based on characteristic curve fitting is adopted to avoid directly calculating the timing correlation between all battery cells, reducing the calculation load of the system and improving the stability of the partitioning results; the adaptive optimization of the charging and discharging strategy is realized through a double-layer deep reinforcement learning model, which effectively solves the control problem of the battery pack under dynamic working conditions and improves the control accuracy and response speed of the system; a distributed control architecture is adopted to realize parallel control and collaborative optimization of each module group, reduce the communication overhead of the system, and enhance the scalability and reliability of the system; by introducing a multi-level state monitoring and anomaly detection mechanism, the system's fault tolerance to sensor failures and data missing is improved, and the robustness of the system is enhanced; based on the boundary optimization method of dynamic programming, adaptive adjustment of the module group boundary is realized, effectively improving the energy utilization efficiency and temperature balance of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 Schematic diagram of the steps of the MCU-based battery charging and discharging method according to an embodiment of the present invention;

[0022] Figure 2 Schematic diagram of the structure of the battery charging and discharging system based on MCU in an embodiment of the present invention;

[0023] Figure 3 It is a schematic block diagram of the structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0024] Embodiments of the present invention provide an MCU-based battery charging and discharging method, system, device, and storage medium. The terms "first," "second," "third," "fourth," and so forth (if any) in the specification and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. Furthermore, the terms "including," "having," and any variations thereof are intended to cover non-exclusive inclusions; for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.

[0025] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 An embodiment of the battery charging and discharging method based on MCU in the embodiment of the present invention includes:

[0026] Step S1: collecting spatial coordinate data of all battery cells in the battery pack based on the MCU, and partitioning the battery cells according to the spatial coordinate data to obtain initial partitions of the battery cells;

[0027] It is understandable that the execution subject of the present invention can be a battery charging and discharging system based on an MCU, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0028] Specifically, the MCU, acting as the core control unit, collects the three-dimensional spatial coordinates of each battery cell in the battery pack. Positioning modules or sensors mounted on the battery cells acquire their spatial position data within the battery pack. The MCU collects this position data via a real-time communication protocol and stores it as a standardized set of three-dimensional coordinate points. After obtaining the spatial position data for each battery cell, the spatial relationships between the cells are calculated based on this data. The Euclidean distance formula, which accurately represents the geometric straight-line distance between points, is used to calculate the distance between any two battery cells. This formula then constructs a spatial distance matrix between each battery cell and its surrounding cells. This pairwise calculation generates a complete spatial distance relationship between the battery cells. A threshold analysis is then performed on these spatial distance relationships. By setting a predefined distance threshold, battery cells with a distance less than the threshold are marked as neighbors, thereby constructing a battery cell neighbor graph. This graph uses a graph-theoretic structure, where each node corresponds to a battery cell, and the presence of an edge depends on whether the distance between the corresponding battery cells is less than the threshold. By analyzing the graph, the spatial proximity of the battery cells is identified, and a preliminary connection structure is constructed based on this. Based on the neighbor relationship graph of battery cells, the graph is optimized using the minimum spanning tree algorithm from graph theory. A minimum spanning tree is an acyclic subgraph containing all nodes with the minimum sum of edge weights, representing the topological structure of the connections between battery cells. By calculating and statistically analyzing the edge weights of the minimum spanning tree, the density of the battery cells in spatial arrangement is reflected, providing a key reference for the number and boundaries of the partitions. By analyzing the structural characteristics of the minimum spanning tree and combining it with mathematical methods of cluster analysis, a hierarchical cluster analysis is performed on the connection topology, hierarchically dividing the battery cells into several preliminary partitions. Hierarchical cluster analysis determines the appropriate number and boundary conditions of the partitions by gradually merging or splitting cell nodes. A local coordinate system is established based on the number and boundaries of the partitions. This local coordinate system is a coordinate framework redefined based on the relative positions of battery cells within a partition. It maps the battery cell positions in global three-dimensional space to a small range within the partition, simplifying subsequent computational complexity. The battery cells within each partition are recoded so that they have unique number identifiers within the partition, thus obtaining the initial partitions of the battery cells.

[0029] Step S2: collecting charge and discharge characteristic data and performing polynomial fitting calculations on the battery cells in the initial partition to obtain a battery characteristic numerical matrix;

[0030] Specifically, a standard charge-discharge cycle is performed on the battery cells in the initial partition. Data on voltage rise, current change, and temperature change during the charging process are collected to obtain raw characteristic data for each battery cell, reflecting its performance under specific operating conditions. To eliminate noise interference during the acquisition process and improve data quality, digital filtering techniques are used to process the raw characteristic data. By selecting a filtering algorithm, such as a low-pass filter or a Kalman filter, the valid portion of the data is extracted to obtain a filtered data sequence for each battery cell. This filtered data sequence is used to calculate dynamic characteristic parameters such as the voltage rise rate, current change rate, and temperature change rate during the charging process. The voltage rise rate reflects the dynamic changes in the electrochemical reaction during charging, the current change rate indicates the charge transfer rate within the battery, and the temperature change rate is directly related to the battery's thermal management performance. Based on these dynamic characteristic parameters, a polynomial fitting method is used to construct an nth-order polynomial model to describe the characteristic curve of the battery cell. The coefficients of the fitting model are solved using the least squares method to ensure that the fitting curve accurately reflects the data trend. By performing derivative analysis on the fitting equation and calculating the slope and curvature at specific target time points, the characteristic inflection point data of the battery cell characteristic changes are determined. The characteristic inflection point data reflects the critical moment of battery performance change and helps to assess the battery's health status and charge and discharge efficiency. The statistical eigenvectors of the battery cells are calculated based on the characteristic inflection point data. To ensure the numerical comparability of the eigenvectors of different battery cells, these statistical eigenvectors are standardized to eliminate differences in dimension and numerical range, and a standardized characteristic matrix is ​​generated. Based on the standardized characteristic matrix, the similarity coefficient between battery cells in the same initial partition is calculated using cosine similarity or Euclidean distance. The high or low similarity coefficient reflects the degree of similarity in the characteristic performance of the battery cells. By constructing a similarity matrix that contains the similarity relationships of all battery cells, the performance similarity between battery cells is reflected. Ultimately, with the similarity matrix as the core, a complete battery characteristic numerical matrix is ​​formed.

[0031] Step S3: performing K-means clustering based on the battery characteristic numerical matrix and combining the physical location constraints of the battery cells to obtain the module group division results;

[0032] Specifically, cluster centers are calculated based on the battery characteristic matrix. To make the clustering process more representative and stable, multiple representative initial points are selected from the battery characteristic matrix as the first cluster centers based on the maximum distance principle. By increasing the distance between the initial centers, slow convergence or local optimality caused by improper center selection in the early stages of clustering is avoided. K-means iterative calculations are performed based on multiple first cluster centers. In each iteration, the distance between each battery cell and each first cluster center is calculated based on its characteristic value. The battery cell is assigned to the cluster center with the closest distance, and a category affiliation label is generated. As more battery cells are assigned, the cluster center position of each category is continuously updated to the center of mass position of all battery cells in that category. By continuously adjusting the cluster centers and category affiliations, the clustering results are gradually optimized. After each iteration, the current clustering effect is evaluated to see if it meets expectations, and the silhouette coefficient is used to measure the effectiveness of the clustering. The silhouette coefficient quantifies the degree of compactness within the clustering results and the degree of separation between categories, thereby guiding further clustering optimization. If the effectiveness of the clustering results does not meet the expected threshold, the cluster center positions are adjusted using a local search algorithm. This local search optimizes the distribution of the current cluster centers by searching for new centers around the first cluster center, resulting in a more balanced and reasonable clustering result. During this phase, physical location constraints on the battery cells are also introduced. By converting the physical location coordinates of the battery cells into a distance constraint matrix, the relative positional relationships of the battery cells in physical space are clarified, and physical spatial proximity is taken into account in the clustering optimization. If some clustering results assign battery cells that are physically too far apart to the same category, a penalty is imposed to prioritize them in the clustering process, prioritizing them to categories that better reflect spatial realities. Based on the optimized cluster centers and distance constraints, the K-means clustering process is repeated. By continuously adjusting the cluster center positions and category assignments, the algorithm gradually converges, ultimately achieving a clustering result that satisfies both feature consistency and spatial rationality. The clustering results are smoothed by analyzing the battery cells in the boundary area and adjusting their categories to achieve a smooth transition of the module group boundary, making the module group division more reasonable and stable in practical applications, and obtaining the module group division results.

[0033] Step S4: performing state parameter difference calculation and dynamic programming optimization operation on the boundary battery cells of adjacent module groups in the module group division result to obtain the optimal module group boundary position;

[0034] Specifically, the boundary cells of each module group in the module group partitioning results are marked to clearly identify which cells are located at the boundary between module groups. These boundary cells have a significant impact on the overall performance of the module group during charging and discharging. Therefore, their key state parameters, including voltage, temperature, and internal resistance, are collected and recorded as a boundary state parameter set. Based on the boundary state parameter set, the voltage, temperature, and internal resistance differences between the boundary cells of adjacent module groups are calculated to quantify the degree of performance inconsistency at the boundaries of adjacent module groups. These difference values ​​are aggregated to construct a difference value weight matrix, which is used to describe the influence of each state parameter on the overall difference, thereby extracting the difference characteristics of the boundary state. The boundary state difference characteristics are normalized to eliminate the influence of the dimension and numerical range of each parameter, forming a standardized difference feature vector. Based on the standardized difference feature vector, a dynamic programming state transition equation is constructed to optimize the boundary location. In the dynamic programming model, the location of the module group boundary is regarded as a state, and the adjustment of the boundary is regarded as a state transition. By defining appropriate constraints and objective functions, the optimization problem is transformed into a mathematical model. The objective function is centered on minimizing the state differences between adjacent module groups' boundaries, while also considering the impact of boundary adjustments on the module group's internal structural connectivity and boundary smoothness. Constraints are used to limit the scope of boundary adjustments, ensuring the feasibility of the optimization results in practical applications. Based on the constructed boundary optimization mathematical model, a traversal search is performed on each module group boundary. By traversing different boundary positions and calculating the objective function value at each boundary position, a set of candidate boundary adjustment solutions is generated. This set of candidate solutions provides multiple possible boundary optimization paths. For further screening and optimization, the internal connectivity and boundary smoothness of the module group are calculated from the candidate solution set, and a subset of candidate solutions that meet the requirements is selected. Based on this subset, a cost function is constructed, comprehensively considering factors such as state differences, connectivity, and smoothness to evaluate the performance of each solution. A value iteration algorithm is used to solve the cost function, and the optimal boundary adjustment strategy is selected from the candidate solution subset, resulting in a boundary optimization trajectory. This trajectory represents the optimal path for boundary position adjustment over a series of iterative steps. Along this trajectory, the module group boundary is gradually adjusted. During each adjustment, the optimization progress is verified by recalculating the differences in state parameters between adjacent module groups. This serves as a basis for determining whether to continue iterations. This process continuously reduces the state differences between adjacent module groups, leading to gradual optimization convergence. Ultimately, when the state differences between adjacent module groups are minimized and the boundary adjustments meet the requirements for connectivity and smoothness, the optimal module group boundary position is obtained.

[0035] Step S5: Determine the real-time status data of each module group based on the optimal module group boundary position, and input the real-time status data into the double-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group.

[0036] Specifically, the state of charge (SOC) data, temperature distribution data, and internal resistance distribution data of each module group at the optimal module group boundary are periodically collected and standardized to unify the data scale and eliminate unit differences. This standardized real-time state data accurately reflects the operating status of each module group. The real-time state data is input into the high-level policy network of a two-layer deep reinforcement learning model to construct the policy network's state space. Based on the state space, an action space is defined, covering three dimensions: charging mode selection, discharging mode selection, and energy allocation ratio. Deep reinforcement learning calculations within the high-level policy network yield a global charge and discharge policy. This policy includes the operating mode selection (e.g., charging or discharging) and energy allocation weights for each module group. The global charge and discharge policy is parsed to extract specific control objectives for each module group, including charging and discharging control targets. These targets are then combined with the physical constraints of each module group (including temperature, voltage, and power thresholds) to generate module-level control constraints through constraint mapping. These module-level control constraints include upper limits for charging current, upper limits for discharging power, and thresholds for balancing control, providing boundary conditions for precise control of each module group. Module-level control constraints and real-time status data are input into the low-level execution network of a two-layer deep reinforcement learning model. In the charging control unit, deep reinforcement learning is used to calculate the optimal charging current for each module group in its current state. To ensure maximum charging efficiency and balanced temperature distribution, the optimization objective function must balance both energy input and module temperature gradients to generate an initial charging control signal. The initial charging control signal is then verified for energy balance. By calculating the temperature gradient and internal resistance gradient between each module group, a dynamic compensation function is constructed, and a gradient descent method is applied to compensate the charging current in real time. The compensated charging current parameters better meet actual requirements, effectively addressing uneven temperature distribution between modules and improving charging efficiency. In the discharging control unit, module-level control constraints and real-time status data are used as input, and deep reinforcement learning is used to calculate the optimal discharge power for each module group in its current state. Discharge power optimization must meet the requirement for optimal discharge performance while also considering state-of-charge (SOC) balance. Based on the initial discharge control signal, the SOC differences and power allocation ratios between each module group are calculated, and a power regulation function is constructed. Quadratic programming is used to adjust the discharge power in real time. The discharge power parameters obtained in this way can balance the state of charge between module groups while ensuring discharge efficiency, thus avoiding local over-discharge. Co-optimization of the charging current and discharge power parameters is performed, comprehensively considering the dynamic relationship between charging and discharging, and balancing their impact on module group performance to achieve the final distributed charge and discharge control strategy.

[0037] By analyzing the distributed charge and discharge control strategy for each module group, specific charging current and discharge power parameters are extracted. These parameters serve as the core basis for controller initialization configuration. Based on these extracted parameters, the distributed controller performs initial configuration and generates initial control parameters, including the current regulation upper limit, power allocation ratio, and initial control threshold for each module group. This process ensures that the controller can generate initial control signals according to specific strategy requirements. Based on the initial control parameters, charging current and discharge power control signals are generated for each module group. By analyzing these control signals, the power allocation coefficient and energy transfer path between module groups are calculated. The power allocation coefficient determines the energy allocation ratio within each module group during the charging and discharging process, while the energy transfer path defines the physical path of energy flow between module groups, forming a specific distributed control instruction set. The distributed control instruction set is sent to the control system as direct input for executing actions. To achieve independent control of each module group, the controller processes the distributed control instruction set in parallel. The PWM modulator independently adjusts the power conversion circuit of each module group to achieve precise voltage and current control. During this process, the output voltage and output current of each power conversion circuit are collected in real time to generate real-time control feedback data for the module group. Feedback data includes the actual output parameters generated by each module group during execution, providing a basis for subsequent correction and optimization. Based on real-time control feedback data, the charging and discharging efficiency coefficients are calculated for each module group. These efficiency coefficients reflect the module group's energy conversion efficiency under current operating conditions. Based on the calculated efficiency coefficients, the power allocation coefficients are corrected to generate an optimized power allocation scheme. This optimized power allocation scheme dynamically adjusts the energy distribution ratio between module groups to achieve optimal overall efficiency. Simultaneously, the control instructions for each module group are updated based on the optimized scheme, and a distributed phase-locked lock (PLL) synchronizes the control phases of all module groups to generate phase-synchronized control signals, thereby avoiding control errors caused by phase asynchrony. The phase-synchronized control signals are further optimized using the PI control algorithms for the voltage and current loops. During this process, a dual closed-loop feedback controller adjusts the real-time state to calculate the duty cycle parameters for each power conversion circuit. These duty cycle parameters are used to directly drive the power conversion circuits of the module groups, ensuring more precise output and achieving efficient and stable closed-loop control. Based on the closed-loop control calculation results, a soft-start and soft-stop sequence is generated for each module group to ensure smooth transitions during startup and shutdown, avoiding current surges caused by sudden changes. Simultaneously, the distributed coordinator is responsible for switching the module group's operating mode and generating coordinated control command sequences. These command sequences coordinate the switching of each module group between different operating modes, such as switching from charging mode to discharging mode or balancing mode, to meet diverse charging and discharging needs.Guided by a coordinated control instruction sequence, the charging and discharging processes of each module group are controlled, and the state parameters of each module group are collected through a real-time monitoring system. These state parameters, including voltage, current, and temperature, are fed back to the distributed controller in real time, forming the basis for the next round of closed-loop optimization control. Based on this feedback data, the distributed controller adjusts control parameters, optimizes the power allocation scheme and execution strategy, and further improves the overall efficiency and consistency of the battery pack. This closed-loop control process ultimately achieves coordinated control and efficient operation of the battery pack. The results of closed-loop control optimize energy utilization during charging and discharging, balance state differences between module groups, and extend the battery pack's service life.

[0038] In an embodiment of the present invention, by introducing a partitioning method with spatial position constraints, the complexity of the partitioning calculation is reduced, so that the calculation amount is only linearly related to the number of battery cells, thereby improving the real-time performance and computing efficiency of the system; by adopting a sub-module clustering method based on characteristic curve fitting, the direct calculation of the timing correlation between all battery cells is avoided, the computing load of the system is reduced, and the stability of the partitioning results is improved; by using a double-layer deep reinforcement learning model, the adaptive optimization of the charging and discharging strategy is realized, which effectively solves the control problem of the battery pack under dynamic working conditions and improves the control accuracy and response speed of the system; by adopting a distributed control architecture, parallel control and collaborative optimization of each module group are realized, the communication overhead of the system is reduced, and the scalability and reliability of the system are enhanced; by introducing a multi-level state monitoring and anomaly detection mechanism, the system's fault tolerance to sensor failures and data missing is improved, and the robustness of the system is enhanced; based on the boundary optimization method of dynamic programming, the adaptive adjustment of the module group boundary is realized, which effectively improves the energy utilization efficiency and temperature balance of the system.

[0039] In a specific embodiment, the process of executing step S1 may specifically include the following steps:

[0040] The MCU collects the three-dimensional spatial coordinates of each battery cell in the battery pack to obtain the spatial position data of each battery cell. The Euclidean distance between any two battery cells is calculated based on the spatial position data of each battery cell to obtain the spatial distance relationship between the battery cells.

[0041] Performing a threshold analysis on the spatial distance relationship, marking battery cells whose distance is less than a preset threshold as adjacent cells, and obtaining an adjacent relationship diagram of the battery cells;

[0042] Based on the neighbor relationship graph, a minimum spanning tree is constructed and the edge weights of the minimum spanning tree are calculated to obtain the connection topology of the battery cells. A hierarchical clustering analysis is performed on the connection topology to obtain the number and boundaries of the partitions.

[0043] A local coordinate system is established according to the number and boundaries of the partitions, and the battery cells in each partition are recoded to obtain the initial partition of the battery cells.

[0044] Specifically, the MCU (microcontroller unit) and related sensor modules are used to collect the three-dimensional spatial coordinates of each battery cell in the battery pack. Assume that the position of the battery cell in space is represented as ,in 、 and It is The position data of each battery cell in the three-dimensional coordinate system is obtained by positioning sensors installed in the battery pack or by direct measurement. After completing the spatial coordinate collection, the Euclidean distance between any two battery cells is calculated based on the spatial position data of each battery cell. The Euclidean distance is the straight-line distance between two points in spatial geometry, and its formula is:

[0045] ;

[0046] in, Indicates the The battery cell and The distance between battery cells, and are their three-dimensional coordinates respectively. Using the above formula, a distance matrix is ​​constructed , whose elements Indicates the Hedi The distance between battery cells. Perform threshold analysis on the distance matrix. Set a preset threshold , its physical meaning is the maximum distance between two battery cells that are considered adjacent. By traversing each element in the distance matrix, if , then the Hedi The battery cells are marked as adjacent cells, and a neighbor relationship graph of the battery cells is generated. The neighbor relationship graph is represented by an undirected graph, in which each node represents a battery cell. If two nodes are connected, it means that the distance between the corresponding battery cells is less than a threshold. Based on the neighbor relationship graph, a minimum spanning tree is constructed. The minimum spanning tree is a loop-free connected subgraph that covers all nodes and has the smallest sum of edge weights. The method for constructing the minimum spanning tree adopts the Kruskal or Prim algorithm. Taking the Kruskal algorithm as an example, the specific steps include sorting all edges from small to large according to weight, and adding them to the spanning tree in sequence to ensure that no loops are formed. The weight of each edge in the spanning tree is the distance between the corresponding battery cells. By calculating the sum of the edge weights of the minimum spanning tree, the preliminary connection topology of the battery cells is obtained, which is used to describe their mutual relationship in space. After the minimum spanning tree is constructed, a hierarchical clustering analysis is performed on the connection topology to determine the number and boundaries of the battery cell partitions. Hierarchical clustering forms a tree structure by continuously merging or splitting nodes. For example, by setting a cutting threshold, some edges in the minimum spanning tree are removed, thereby dividing multiple connected subgraphs, each of which is a preliminary partition. Based on the number of partitions and boundary conditions, a local coordinate system is established for each partition. The local coordinate system redefines the position of the battery cells in each partition to make their relative positions more centralized. For example, the centroid of the partition is used as the local origin, and the coordinates of each battery cell relative to the centroid are recalculated to simplify subsequent calculations and management. The battery cells in each partition are recoded and their numbers are updated to unique identifiers within the partition, thus completing the initial partitioning of the battery cells.

[0047] In a specific embodiment, the process of executing step S2 may specifically include the following steps:

[0048] Performing standard charge and discharge cycles on the battery cells in the initial partition, collecting voltage rise data, current change data, and temperature change data during the charging process, and obtaining the original characteristic data of the battery cells;

[0049] Perform digital filtering on the original characteristic data to obtain a filtered data sequence of the battery cell, and calculate the voltage rise rate, current change rate, and temperature change rate during the charging process based on the filtered data sequence to obtain the dynamic characteristic parameters of the battery cell;

[0050] An nth-order polynomial fitting model is constructed based on the dynamic characteristic parameters. The polynomial coefficients are solved using the least squares method to obtain the characteristic curve equation of the battery cell. The characteristic curve equation is then subjected to derivative analysis to calculate the slope and curvature at the target time point to obtain the characteristic inflection point data of the battery cell.

[0051] Calculate the statistical characteristic vector of the battery cell based on the characteristic inflection point data, and standardize the statistical characteristic vector to obtain a standardized characteristic matrix;

[0052] The similarity coefficients between battery cells in the same initial partition are calculated based on the standardized feature matrix, and a similarity matrix is ​​constructed to obtain a battery characteristic numerical matrix.

[0053] Specifically, a standard charge and discharge cycle is performed on each battery cell, and the voltage rise data, current change data, and temperature change data during the charging process are collected. These original characteristic data are respectively formed into a series of data sequences with time as the horizontal axis, such as the curve of voltage change over time. , Curve of current changing with time and the temperature versus time curve These data reflect the dynamic behavior of the battery during the charge and discharge process. The raw characteristic data are digitally filtered. Filtering methods include low-pass filters or Kalman filters to remove high-frequency noise and retain the main trends of the data. The filtered data sequence is represented as 、 and , are the filtered series of voltage, current, and temperature, respectively. The dynamic characteristic parameters of the battery are calculated using these filtered data series. For example, the voltage rise rate is expressed as:

[0054] ;

[0055] in, Indicates the rate of change of voltage per unit time. Similarly, the rate of change of current and temperature are expressed as and By performing differential or numerical differentiation on the filtered data, the time series of these dynamic characteristic parameters, such as the voltage rise rate series, are calculated. , describes the speed of voltage change over time. According to the dynamic characteristic parameters, construct The polynomial fitting model of order is used to describe the characteristic curve of the battery cell. The goal of polynomial fitting is to approximate the dynamic characteristic data with a function of the following form:

[0056] ;

[0057] in, is the fitted polynomial, are the coefficients of the polynomial, which are solved by the least squares method. The core of the least squares method is to minimize the sum of the square errors between the data points and the fitting curve. Its objective function is expressed as:

[0058] ;

[0059] in, It's the time point. is the value of the original data. By solving the above optimization problem, we can get the polynomial coefficients The fitted characteristic curve describes the dynamic behavior of the battery during the charge and discharge process. In order to analyze the characteristic curve, the fitting function Based on this, we can calculate the derivative and get the slope and curvature of the curve at the target time point. The slope is expressed as:

[0060] ;

[0061] The curvature is expressed as:

[0062] ;

[0063] in, is the first derivative of the characteristic curve, is the second-order derivative, Represents the curve at time point By calculating the slope and curvature at the target time point, the characteristic inflection point of the battery cell performance change is identified. Based on the characteristic inflection point data, the statistical eigenvector of the battery cell is calculated. The statistical eigenvector integrates dynamic characteristic parameters and curve inflection point information, such as the average voltage rise rate, the maximum temperature change rate, and the slope and curvature values ​​at the characteristic inflection point. After normalizing these eigenvalues, a standardized characteristic matrix is ​​formed, which is expressed as:

[0064] ;

[0065] in, is the normalized feature matrix, Indicates the The first battery cell The standardized eigenvalues, is the number of battery cells, is the feature dimension. Based on the standardized feature matrix, the similarity coefficient between battery cells in the initial partition is calculated. The similarity metric includes cosine similarity, which is formulated as:

[0066] ;

[0067] By calculating the similarity between all battery cells, a similarity matrix is ​​constructed to describe the performance relationship between battery cells in the initial partition. The elements of the similarity matrix are Indicates the Hedi The similarity of each battery cell is calculated and finally a battery characteristic numerical matrix is ​​formed.

[0068] In a specific embodiment, the process of executing step S3 may specifically include the following steps:

[0069] Calculating cluster centers based on the battery characteristic numerical matrix and selecting initial positions of the cluster centers using the maximum distance principle to obtain multiple first cluster centers;

[0070] Performing K-means iterative calculation based on multiple first cluster centers, calculating the Euclidean distance between each battery cell and each first cluster center, and obtaining a category label of the battery cell;

[0071] The centroid coordinates of each cluster are calculated according to the category attribution label, and the clustering results are evaluated based on the silhouette coefficient to obtain the clustering effectiveness index;

[0072] A threshold value is determined for the clustering effectiveness index, and the positions of multiple first cluster centers are adjusted by a local search algorithm to obtain multiple second cluster centers;

[0073] The physical location coordinates of the battery cells in the initial partition are converted into a distance constraint matrix, and the clustering results that do not meet the spatial proximity are penalized to obtain the optimization objective function;

[0074] Based on the optimization objective function and multiple second cluster centers, K-means clustering iteration is re-executed until the inter-cluster distance is maximized and the intra-cluster distance is minimized to obtain the clustering division result. The clustering division result is then subjected to boundary smoothing to obtain the module group division result.

[0075] Specifically, information is extracted from the battery characteristic matrix and the location of the cluster center is calculated. Assume that the battery characteristic matrix is ,in Indicates the Battery cells dimensional feature vector, matrix Include In order to preliminarily determine the location of the cluster center, the maximum distance principle is adopted, which aims to select points that are as far away from each other as possible as the initial center points. Randomly select an initial point , then recursively select the point The following conditions are met:

[0076] ;

[0077] in, Indicates a point and The Euclidean distance of By maximizing the distance from the point to the nearest center point, the initial cluster center points can be evenly distributed and cover the entire data space, generating the first cluster center set. After obtaining the first cluster center, the K-means clustering algorithm is executed. In each round of iteration, for each battery cell , calculate the Euclidean distance to each cluster center:

[0078] ;

[0079] in, Indicates the Battery cells to The distance between cluster centers, and are the characteristic vector and the center point respectively. According to the calculation results, each battery cell is assigned to the category where the nearest cluster center is located, and the category attribution label is generated. ,in Indicates the After the classification is completed, the centroid coordinates of each cluster are recalculated and used as the cluster center for the next iteration. The calculation formula for the new centroid is:

[0080] ;

[0081] in, It is The centroid of the cluster, is the number of battery cells belonging to the cluster. The above process is repeated iteratively until the location of the cluster center no longer changes significantly. To evaluate the clustering effect, the silhouette coefficient is introduced as an evaluation indicator. The silhouette coefficient is defined as follows:

[0082] ;

[0083] in, Indicates a point The average distance to other points in the same cluster, Indicates a point The average distance to the nearest neighbor cluster. For the entire dataset, the average value of the silhouette coefficient Measures the overall effectiveness of clustering. If If the preset threshold is not reached, the position of the first cluster center is adjusted through the local search algorithm to generate the second cluster center set. Further considering the physical space constraints of the battery cell, the physical position coordinates are converted into a distance constraint matrix Indicates the Hedi The physical distance between the battery cells. If some clustering results violate the spatial proximity (i.e. the distance exceeds a certain threshold ), then a penalty term is introduced To optimize the objective function:

[0084] ;

[0085] in, is the penalty coefficient, is the penalty value for violating proximity. By optimizing the above objective function, the K-means clustering iteration is re-executed until the inter-cluster distance is maximized and the intra-cluster distance is minimized, obtaining the optimized clustering result. The clustering result is subjected to boundary smoothing to ensure a uniform transition between the module group boundary areas, thus obtaining the module group division result.

[0086] In a specific embodiment, the process of executing step S4 may specifically include the following steps:

[0087] Mark the boundary battery cells of each module group in the module group division result, and collect the voltage value, temperature value and internal resistance value of the boundary battery cells to obtain a boundary state parameter set;

[0088] The voltage difference, temperature difference, and internal resistance difference between battery cells at the boundary of adjacent module groups are calculated based on the boundary state parameter set, and a difference value weight matrix is ​​constructed to obtain boundary state difference characteristics.

[0089] Normalize the boundary state difference characteristics to obtain a standardized difference feature vector, and construct a dynamic programming state transfer equation based on the standardized difference feature vector. Set the boundary adjustment constraints and objective function to obtain a boundary optimization mathematical model.

[0090] According to the boundary optimization mathematical model, the boundary of each module group is traversed and searched, the objective function value at different boundary positions is calculated, and a set of boundary adjustment candidate solutions is obtained;

[0091] Based on the set of boundary adjustment candidate solutions, the internal connectivity and boundary smoothness of the module group are calculated to obtain a subset of candidate solutions. Based on the subset of candidate solutions, a value function is constructed, and the value iteration algorithm is used to solve the optimal boundary adjustment strategy to obtain the boundary optimization trajectory.

[0092] The module group boundary is iteratively adjusted along the boundary optimization trajectory until the state difference between adjacent module groups is minimized, and the optimal module group boundary position is obtained.

[0093] Specifically, according to the module group division results, the boundary battery cells of each module group are marked. The boundary battery cells refer to the battery cells located between two module groups or close to the partition boundary. By collecting the key status parameters of these boundary battery cells, including voltage values ), temperature value and internal resistance ), forming a set of boundary state parameters ,in is the number of boundary battery cells. Based on the boundary state parameter set, the voltage difference, temperature difference, and internal resistance difference between adjacent module groups are calculated. These difference values ​​are calculated using the following formulas:

[0094] ;

[0095] in, 、 and Represents the battery cells at the module group boundary and By traversing all combinations of boundary monomers, a difference value weight matrix is ​​constructed. , the matrix elements It is defined as the weighted sum of the difference values:

[0096] ;

[0097] in, 、 and is the weight factor of voltage, temperature and internal resistance difference, which is set according to actual needs to reflect the relative importance of each parameter to the state difference. The difference value weight matrix is ​​normalized to eliminate the dimensional differences of different physical quantities. The normalized difference feature is expressed as the standardized feature vector ,in Indicates the The normalized difference characteristics of the boundary battery cells are calculated. Based on the normalized feature vectors, a dynamic programming state transition equation is constructed to optimize the module group boundary position. The core of dynamic programming is to find the optimal boundary adjustment strategy by setting state transition rules. The state transition equation is expressed as:

[0098] ;

[0099] in, is the status Taking action The value after It's an immediate reward. is the discount factor, From the state Transfer to By setting boundary adjustment constraints, such as minimizing the state difference between adjacent module groups and the connectivity constraints within the module group, the problem is transformed into a mathematical model for solution. In order to solve the boundary optimization mathematical model, a traversal search is performed on the boundary of each module group, and the objective function value at different boundary positions is calculated. The objective function is defined as:

[0100] ;

[0101] in, is the weighted sum of the differences in boundary states, is the penalty function for module group connectivity, is the penalty coefficient. By searching all possible boundary adjustment solutions, a set of boundary adjustment candidate solutions is obtained. Based on the candidate solution set, the connectivity and boundary smoothness within the module group are calculated, and a subset of candidate solutions that meet the constraints are selected. Based on the candidate solution subset, a value function is constructed to comprehensively evaluate the effect of boundary adjustment. The value function is expressed as:

[0102] ;

[0103] in, is the weighted sum of state differences, is the boundary smoothness index, is the smoothness weighting factor. A value iteration algorithm is used to solve the value function, iteratively updating the value of each boundary position to ultimately determine the optimal boundary adjustment strategy. Following the boundary optimization trajectory obtained, the module group boundaries are gradually adjusted. In each iteration, corrections are made based on the current state differences and connectivity, and boundary state parameters and difference characteristics are recalculated until the state differences between adjacent module groups are minimized and the boundary positions converge, resulting in the optimal module group boundary position.

[0104] In a specific embodiment, the process of executing step S5 may specifically include the following steps:

[0105] The state of charge data, temperature distribution data and internal resistance distribution data of each module group at the boundary position of the optimal module group are periodically collected and standardized to obtain real-time status data;

[0106] Real-time state data is input into the state space of the high-level policy network in the two-layer deep reinforcement learning model. An action space is constructed based on the state space. The action space includes three dimensions: charging mode selection, discharging mode selection, and energy allocation ratio. The global charging and discharging strategy is calculated through deep reinforcement learning. The global charging and discharging strategy includes the working mode and energy allocation weight of each module group.

[0107] The global charge and discharge strategy is parsed to extract the target charge and discharge control values ​​for each module group. These are then combined with the temperature, voltage, and power thresholds of each module group. Module-level control constraints are then derived through constraint mapping. These constraints include the upper limit for charge current, the upper limit for discharge power, and the balancing control threshold.

[0108] The module-level control constraints and real-time status data are input into the charging control unit of the lower-level execution network in the two-layer deep reinforcement learning model. Deep reinforcement learning is used to calculate the optimal charging current value for each module group under the current state. The optimal charging current value must simultaneously meet the requirements of maximizing charging efficiency and temperature balance to obtain the initial charging control signal.

[0109] The energy balance of the initial charging control signal is verified, the temperature gradient and internal resistance gradient between each module group are calculated, and a compensation function is constructed based on the temperature gradient and internal resistance gradient. The charging current is dynamically compensated using the gradient descent method to obtain the charging current parameters.

[0110] The module-level control constraints and real-time state data are input into the discharge control unit of the lower-level execution network in the two-layer deep reinforcement learning model. Deep reinforcement learning is used to calculate the optimal discharge power value of each module group in the current state. The optimal discharge power value must simultaneously meet the requirements of optimal discharge performance and balanced state of charge to obtain the initial discharge control signal.

[0111] The power balance of the initial discharge control signal is verified, and the state of charge differences and power allocation ratios between module groups are calculated. A power regulation function is constructed based on the state of charge differences. The discharge power is adjusted in real time using the quadratic programming method to obtain the discharge power parameters.

[0112] Based on the collaborative optimization of charging current parameters and discharging power parameters, a distributed charging and discharging control strategy for each module group is obtained.

[0113] Specifically, the state of charge (SOC) data, temperature distribution data, and internal resistance distribution data of each module group are periodically collected through the sensor network. , organize the collected state data into time series vectors ,in Indicates the average state of charge of the module group, and Respectively represent the temperature distribution and internal resistance distribution of each battery cell in the module group. To ensure the comparability of the data, these status data are standardized using the formula:

[0114] ;

[0115] in, and are the minimum and maximum values ​​of the status data, is the normalized real-time state data. The normalized real-time state data is input into the high-level policy network in the two-layer deep reinforcement learning model to construct the state space. The state space is defined as ,in Is the total number of module groups. Based on the state space, build the action space , the actions of each module group Contains three dimensions: charging mode selection , discharge mode selection and energy distribution ratio . Through deep reinforcement learning optimization, using the objective function:

[0116] ;

[0117] in, Represents a module group The charge and discharge efficiency, is the energy distribution ratio, and are the temperature gradient and internal resistance gradient within the module group, and is the weight factor. The optimization goal is to maximize the total reward , thus obtaining the global charge and discharge strategy, including the working mode and energy allocation weight of each module group. After analyzing the global charge and discharge strategy, the charge control target value and discharge control target value of each module group are extracted and recorded as and Combined with the physical constraints of the module group (such as temperature threshold , voltage threshold , power threshold ), module-level control constraints are generated through constraint mapping and are defined as:

[0118] ;

[0119] in, is the upper limit of charging current, is the upper limit of discharge power, is the threshold for balancing control. The module-level control constraints and real-time status data are input into the low-level execution network of the two-layer deep reinforcement learning model to calculate the optimal charging current and discharge power values ​​respectively. In the charging control unit, deep reinforcement learning is used to optimize the objective function:

[0120] ;

[0121] Get the initial charging control signal To verify its energy balance, the temperature gradient and internal resistance gradient between module groups are calculated:

[0122] ;

[0123] Build a compensation function based on these gradients , the charging current is dynamically compensated by the gradient descent method, and the charging current parameters are adjusted Similarly, in the discharge control unit, the optimal discharge power value of the module group in the current state is calculated When verifying power balance, calculate the charge state difference between module groups And power allocation ratio. Based on , construct the power regulation function:

[0124] ;

[0125] The discharge power is adjusted by the quadratic programming method to obtain the discharge power parameters Finally, the charging current parameters and the discharging power parameters are collaboratively optimized, and the charging efficiency, temperature balance, and state of charge consistency are comprehensively considered to generate a distributed charging and discharging control strategy.

[0126] In a specific embodiment, the above-mentioned MCU-based battery charging and discharging method further includes the following steps:

[0127] Analyze the distributed charge and discharge control strategy of each module group, and initialize the parameters of the distributed controller according to the charging current parameters and discharge power parameters of each module group to obtain the initial control parameters of the distributed controller;

[0128] Generate charging current control signals and discharging power control signals for each module group based on the initial control parameters, and calculate the power distribution coefficient and energy transfer path of each module group according to the control signals to obtain a distributed control instruction group;

[0129] The distributed control instruction group is processed in parallel, and the power conversion circuit of each module group is independently controlled through the PWM modulator. The output voltage and output current of each power conversion circuit are collected to obtain real-time control feedback data of the module group.

[0130] The charging efficiency coefficient and discharging efficiency coefficient of each module group are calculated based on the real-time control feedback data, and the power allocation coefficient is corrected based on the efficiency coefficient to obtain the optimized power allocation scheme;

[0131] Based on the optimized power allocation scheme, the control instructions of each module group are updated online, and the control phase of each module group is synchronously adjusted through a distributed phase-locked device to obtain a phase-synchronized control signal;

[0132] The voltage loop and current loop PI control are performed on the phase-synchronized control signal, and the duty cycle parameters of the power conversion circuit of each module group are calculated through the dual closed-loop feedback controller to obtain the closed-loop control parameters;

[0133] Generate soft start sequence and soft stop sequence of each module group according to closed-loop control parameters, and switch the working mode of each module group through the distributed coordinator to obtain a coordinated control instruction sequence;

[0134] The charging and discharging process of each module group is controlled based on the collaborative control instruction sequence, and the state parameters of each module group are collected through the real-time monitoring system. The state parameters are fed back to the distributed controller for the next round of closed-loop optimization control to obtain the closed-loop control execution results of the battery pack.

[0135] Specifically, by analyzing the distributed charge and discharge control strategy of each module group, its charging current parameters are extracted and discharge power parameters These parameters reflect the module group The charging and discharging requirements are the key basis for the configuration of distributed controller parameters. Based on the extracted parameters, the distributed controller is initialized and configured to generate the initial control parameter set. ,in Is the upper limit of the module group charging current, is the upper limit of the module group discharge power, is the energy allocation weight. Based on the initial control parameters, the charging current control signal and discharge power control signal of each module group are generated. The generation formula of the charging current control signal is:

[0136] ;

[0137] in, Represents a module group In time The control current, is the target current. The generation formula of the discharge power control signal is:

[0138] ;

[0139] in, is the discharge power control signal, is the state of charge of the module group. Based on these control signals, the power distribution coefficient of each module group is calculated and energy transfer paths. The power allocation coefficient is defined as:

[0140] ;

[0141] in, Represents a module group The power allocation weight, The energy transfer path is calculated based on the physical connection topology of the module group, and the optimal path for energy flow is determined by the path optimization algorithm. The control signals and power distribution coefficients of all module groups are integrated to generate a distributed control instruction group. The distributed controller processes the instruction group in parallel and drives the power conversion circuit of each module group independently through the PWM (pulse width modulation) modulator to adjust the charge and discharge current and power output. At the same time, the output voltage of each power conversion circuit is collected in real time. and output current , forming real-time control feedback data of the module group Calculate the charging efficiency coefficient of each module group based on real-time control feedback data and discharge efficiency coefficient The calculation formula for the charging efficiency coefficient is:

[0142] ;

[0143] in, Is a module group The formula for the discharge efficiency coefficient is:

[0144] ;

[0145] Based on the efficiency coefficient, the power distribution coefficient is corrected:

[0146]

[0147] in, It is the comprehensive efficiency coefficient, combining the charging and discharging efficiencies. Based on the optimized power allocation scheme, the control instructions in the distributed controller are updated online. The control phases of all module groups are synchronized by the distributed phase lock, generating phase-synchronized control signals to ensure that each module group is coordinated in phase and avoid power instability caused by phase asynchrony. The control signals after phase synchronization are processed by the dual closed-loop feedback controller, which performs PI control of the voltage loop and current loop respectively, and calculates the duty cycle parameters of the power conversion circuit. , and its calculation formula is

[0148] ;

[0149] in, and are proportional gain and integral gain respectively, The reference voltage is generated based on the closed-loop control parameters to generate soft start and soft stop sequences for each module group, ensuring a smooth transition of the module group during start and stop, and avoiding shocks caused by sudden changes. The distributed coordinator switches the working mode of each module group to form a coordinated control instruction sequence. Finally, under the guidance of the coordinated control instruction sequence, the charging and discharging process of each module group is controlled. The real-time monitoring system continuously collects the status parameters of each module group. and feeds it back to the distributed controller for the next round of closed-loop optimization control to obtain the closed-loop control execution result of the battery pack.

[0150] The above describes the battery charging and discharging method based on MCU in the embodiment of the present invention. The following describes the battery charging and discharging system based on MCU in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, a battery charging and discharging system based on an MCU includes:

[0151] An acquisition module is used to acquire spatial coordinate data of all battery cells in the battery pack based on the MCU, and to partition the battery cells according to the spatial coordinate data to obtain initial partitions of the battery cells;

[0152] A calculation module is used to collect charge and discharge characteristic data of the battery cells in the initial partition and perform polynomial fitting calculations to obtain a battery characteristic numerical matrix;

[0153] The clustering module is used to perform K-means clustering based on the battery characteristic numerical matrix and combine it with the physical location constraints of the battery cells to obtain the module group division results;

[0154] The planning module is used to calculate the state parameter difference and perform dynamic programming optimization on the boundary battery cells of adjacent module groups in the module group division results to obtain the optimal module group boundary position;

[0155] The analysis module is used to determine the real-time status data of each module group based on the optimal module group boundary position, and input the real-time status data into the two-layer deep reinforcement learning model for charge and discharge control analysis to obtain the distributed charge and discharge control strategy of each module group.

[0156] Through the collaborative cooperation of the above-mentioned components and the introduction of a partitioning method with spatial position constraints, the complexity of the partitioning calculation is reduced, so that the calculation amount is only linearly related to the number of battery cells, thereby improving the real-time performance and computational efficiency of the system; a sub-module clustering method based on characteristic curve fitting is adopted to avoid directly calculating the timing correlation between all battery cells, reducing the computational load of the system and improving the stability of the partitioning results; the adaptive optimization of the charging and discharging strategy is achieved through a two-layer deep reinforcement learning model, effectively solving the control problem of the battery pack under dynamic working conditions and improving the control accuracy and response speed of the system; the distributed control architecture is adopted to realize parallel control and collaborative optimization of each module group, reducing the communication overhead of the system and enhancing the scalability and reliability of the system; by introducing a multi-level state monitoring and anomaly detection mechanism, the system's fault tolerance to sensor failures and data missing is improved, and the robustness of the system is enhanced; the boundary optimization method based on dynamic programming realizes the adaptive adjustment of the module group boundary, effectively improving the energy utilization efficiency and temperature balance of the system.

[0157] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, memory, display screen, input device, network interface and database connected via a system bus. The processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the above method is implemented.

[0158] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device to which the solution of the present invention is applied.

[0159] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the above-described method when executed by a processor. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0160] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware using a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media provided herein and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM.

[0161] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0162] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0163] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A battery charging and discharging method based on MCU, characterized in that: The method comprises: The MCU collects spatial coordinate data of all battery cells in the battery pack, and divides the battery cells into zones according to the spatial coordinate data to obtain initial zones of the battery cells; Performing charge and discharge characteristic data collection and polynomial fitting calculation on the battery cells in the initial partition to obtain a battery characteristic numerical matrix; Performing K-means clustering based on the battery characteristic numerical matrix and combining the physical position constraints of the battery cells to obtain module group division results; Performing state parameter difference calculation and dynamic programming optimization operation on boundary battery cells of adjacent module groups in the module group division result to obtain the optimal module group boundary position; The real-time status data of each module group is determined based on the optimal module group boundary position, and the real-time status data is input into a two-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group.

2. The battery charging and discharging method based on MCU according to claim 1, characterized in that: The MCU is used to collect spatial coordinate data of all battery cells in the battery pack, and the battery cells are divided into zones according to the spatial coordinate data to obtain initial zones of the battery cells, including: The MCU collects the three-dimensional spatial coordinates of each battery cell in the battery pack to obtain the spatial position data of each battery cell. The Euclidean distance between any two battery cells is calculated based on the spatial position data of each battery cell to obtain the spatial distance relationship between the battery cells. Performing a threshold analysis on the spatial distance relationship, marking battery cells with a distance less than a preset threshold as adjacent cells, and obtaining an adjacent relationship diagram of the battery cells; Constructing a minimum spanning tree based on the adjacent relationship graph, calculating edge weights of the minimum spanning tree, obtaining a connection topology structure of the battery cells, and performing a hierarchical clustering analysis on the connection topology structure to obtain the number and boundaries of partitions; A local coordinate system is established according to the number and boundaries of the partitions, and the battery cells in each partition are recoded to obtain initial partitions of the battery cells.

3. The battery charging and discharging method based on MCU according to claim 2, characterized in that: The step of collecting charge and discharge characteristic data and performing polynomial fitting calculations on the battery cells in the initial partition to obtain a battery characteristic numerical matrix includes: Performing a standard charge-discharge cycle on the battery cells in the initial partition, collecting voltage rise data, current change data, and temperature change data during the charging process, and obtaining original characteristic data of the battery cells; Performing digital filtering on the raw characteristic data to obtain a filtered data sequence of the battery cell, and calculating the voltage rise rate, current change rate, and temperature change rate during the charging process based on the filtered data sequence to obtain dynamic characteristic parameters of the battery cell; Constructing an nth-order polynomial fitting model based on the dynamic characteristic parameters, solving the polynomial coefficients by the least squares method to obtain a characteristic curve equation of the battery cell, performing derivative analysis on the characteristic curve equation to calculate the slope and curvature at a target time point to obtain characteristic inflection point data of the battery cell; Calculating a statistical characteristic vector of the battery cell based on the characteristic inflection point data, and normalizing the statistical characteristic vector to obtain a normalized characteristic matrix; The similarity coefficients between battery cells in the same initial partition are calculated based on the standardized characteristic matrix, and a similarity matrix is ​​constructed to obtain a battery characteristic value matrix.

4. The battery charging and discharging method based on MCU according to claim 3, characterized in that: The K-means clustering is performed based on the battery characteristic numerical matrix, and combined with the physical position constraint conditions of the battery cells to obtain the module group division results, including: Calculating cluster centers based on the battery characteristic numerical matrix, and selecting initial positions of the cluster centers according to a maximum distance principle to obtain a plurality of first cluster centers; Performing K-means iterative calculation based on the multiple first cluster centers to calculate the Euclidean distance between each battery cell and each first cluster center to obtain a category label of the battery cell; Calculating the centroid coordinates of each cluster according to the category attribution label, and evaluating the clustering results based on the silhouette coefficient to obtain a clustering effectiveness index; Performing a threshold judgment on the clustering effectiveness index, and adjusting the positions of the multiple first cluster centers using a local search algorithm to obtain multiple second cluster centers; Converting the physical position coordinates of the battery cells in the initial partition into a distance constraint matrix, penalizing clustering results that do not meet spatial proximity, and obtaining an optimization objective function; Based on the optimization objective function and the multiple second cluster centers, K-means clustering iteration is re-executed until the inter-class distance is maximized and the intra-class distance is minimized to obtain a clustering division result, and the clustering division result is subjected to boundary smoothing to obtain a module group division result.

5. The battery charging and discharging method based on MCU according to claim 4, characterized in that: The step of performing state parameter difference calculation and dynamic programming optimization operation on boundary battery cells of adjacent module groups in the module group division result to obtain the optimal module group boundary position includes: Marking the boundary battery cells of each module group in the module group division result, and collecting the voltage value, temperature value and internal resistance value of the boundary battery cells to obtain a boundary state parameter set; Calculating voltage difference values, temperature difference values, and internal resistance difference values ​​between battery cells at the boundaries of adjacent module groups based on the boundary state parameter set, and constructing a difference value weight matrix to obtain boundary state difference characteristics; Normalizing the boundary state difference characteristics to obtain a standardized difference feature vector, constructing a dynamic programming state transfer equation based on the standardized difference feature vector, setting boundary adjustment constraints and an objective function, and obtaining a boundary optimization mathematical model; Traverse and search the boundary of each module group according to the boundary optimization mathematical model, calculate the objective function value at different boundary positions, and obtain a set of boundary adjustment candidate solutions; Based on the set of boundary adjustment candidate solutions, the internal connectivity and boundary smoothness of the module group are calculated to obtain a subset of candidate solutions, a value function is constructed based on the subset of candidate solutions, and a value iteration algorithm is used to solve the optimal boundary adjustment strategy to obtain a boundary optimization trajectory; The module group boundary is iteratively adjusted along the boundary optimization trajectory until the state difference between adjacent module groups is minimized, thereby obtaining the optimal module group boundary position.

6. The battery charging and discharging method based on MCU according to claim 5, characterized in that: The real-time status data of each module group is determined based on the optimal module group boundary position, and the real-time status data is input into a two-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group, including: Periodically collecting and standardizing the state of charge data, temperature distribution data, and internal resistance distribution data of each module group at the boundary position of the optimal module group to obtain real-time state data; Inputting the real-time state data into the state space of the high-level policy network in the two-layer deep reinforcement learning model, and constructing an action space based on the state space, wherein the action space includes three dimensions: charging mode selection, discharging mode selection, and energy allocation ratio. The global charging and discharging strategy is obtained through deep reinforcement learning calculation, and the global charging and discharging strategy includes the working mode and energy allocation weight of each module group; parsing the global charge and discharge strategy, extracting a charge control target value and a discharge control target value for each module group, combining the charge control target value and the discharge control target value with a temperature threshold, a voltage threshold, and a power threshold for each module group, and obtaining module-level control constraints through constraint mapping. The module-level control constraints include a charge current upper limit, a discharge power upper limit, and a balancing control threshold; The module-level control constraints and the real-time state data are input into the charging control unit of the lower-level execution network in the two-layer deep reinforcement learning model. The optimal charging current value of each module group under the current state is calculated through deep reinforcement learning. The optimal charging current value must simultaneously meet the requirements of maximizing charging efficiency and temperature balance to obtain an initial charging control signal; Performing energy balance verification on the initial charging control signal, calculating the temperature gradient and internal resistance gradient between each module group, constructing a compensation function based on the temperature gradient and internal resistance gradient, and dynamically compensating the charging current using a gradient descent method to obtain a charging current parameter; The module-level control constraints and the real-time state data are input into the discharge control unit of the lower-level execution network in the two-layer deep reinforcement learning model. The optimal discharge power value of each module group in the current state is calculated through deep reinforcement learning. The optimal discharge power value must simultaneously meet the requirements of optimal discharge performance and balanced state of charge, and an initial discharge control signal is obtained; Performing power balance verification on the initial discharge control signal, calculating the state of charge difference and power distribution ratio between each module group, constructing a power adjustment function based on the state of charge difference, and adjusting the discharge power in real time through a quadratic programming method to obtain a discharge power parameter; Based on the charging current parameter and the discharging power parameter, a coordinated optimization is performed to obtain a distributed charging and discharging control strategy for each module group.

7. The MCU-based battery charging and discharging method according to claim 6, characterized in that: The MCU-based battery charging and discharging method further includes: Analyzing the distributed charge and discharge control strategies of each module group, and initializing and configuring the parameters of the distributed controller according to the charging current parameters and the discharge power parameters of each module group to obtain the initial control parameters of the distributed controller; generating a charging current control signal and a discharging power control signal for each module group based on the initial control parameters, and calculating a power distribution coefficient and an energy transfer path for each module group according to the control signals to obtain a distributed control instruction group; The distributed control instruction group is processed in parallel, the power conversion circuit of each module group is independently controlled through a PWM modulator, and the output voltage and output current of each power conversion circuit are collected to obtain real-time control feedback data of the module group; Calculating the charging efficiency coefficient and the discharging efficiency coefficient of each module group according to the real-time control feedback data, and correcting the power allocation coefficient based on the efficiency coefficient to obtain an optimized power allocation scheme; Based on the optimized power allocation scheme, the control instructions of each module group are updated online, and the control phase of each module group is synchronously adjusted through a distributed phase lock to obtain a phase-synchronized control signal; Performing voltage loop and current loop PI control on the phase-synchronized control signal, calculating the duty cycle parameters of the power conversion circuit of each module group through a dual closed-loop feedback controller to obtain closed-loop control parameters; Generate a soft start sequence and a soft stop sequence for each module group according to the closed-loop control parameters, and switch the working mode of each module group through a distributed coordinator to obtain a coordinated control instruction sequence; Based on the collaborative control instruction sequence, the charging and discharging process of each module group is controlled, and the state parameters of each module group are collected through the real-time monitoring system. The state parameters are fed back to the distributed controller for the next round of closed-loop optimization control to obtain the closed-loop control execution result of the battery pack.

8. A battery charging and discharging system based on MCU, characterized in that: Used to execute the MCU-based battery charging and discharging method according to any one of claims 1 to 7, the MCU-based battery charging and discharging system comprising: An acquisition module, configured to acquire spatial coordinate data of all battery cells in the battery pack based on the MCU, and partition the battery cells according to the spatial coordinate data to obtain initial partitions of the battery cells; A calculation module, configured to collect charge and discharge characteristic data and perform polynomial fitting calculations on the battery cells in the initial partition to obtain a battery characteristic numerical matrix; A clustering module, configured to perform K-means clustering based on the battery characteristic numerical matrix and combine the physical location constraints of the battery cells to obtain a module group division result; A planning module, configured to calculate the state parameter difference and perform dynamic programming optimization on the boundary battery cells of adjacent module groups in the module group division result to obtain the optimal module group boundary position; An analysis module is used to determine the real-time status data of each module group based on the boundary position of the optimal module group, and input the real-time status data into a two-layer deep reinforcement learning model for charge and discharge control analysis to obtain a distributed charge and discharge control strategy for each module group.

9. A computer device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and is characterized in that when the processor executes the computer program, the battery charging and discharging method based on MCU according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the processor is enabled to execute the MCU-based battery charging and discharging method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Energy storage battery pack charging and discharging intelligent control method and system

    CN118693964A

  • Charging and discharging optimization method, device and equipment for energy storage battery of robot

    CN119519067A