Battery charging and discharging method, system and equipment based on MCU (Microprogrammed Control Unit) and storage medium

By adopting the MCU-based battery charging and discharging method in battery pack management, combining spatial coordinate data partitioning, clustering and deep reinforcement learning models, the problems of large computing load and slow response speed in traditional methods are solved, and more efficient and safer battery pack management is achieved.

CN119813479AActive Publication Date: 2025-04-11SHENZHEN LYNNYL TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Traditional battery pack management methods have large calculation load, slow response speed, poor robustness in large-scale battery packs, and are difficult to adapt to changes in battery packs under dynamic operating conditions, resulting in temperature imbalance and uneven energy distribution, affecting the service life and safety of the battery pack.

Method used

The battery charging and discharging method based on the MCU is adopted. By collecting the spatial coordinate data of all battery cells in the battery pack, partitioning, obtaining the numerical matrix of battery characteristics, K-means clustering and dynamic programming optimization, and combining the double-layer deep reinforcement learning model, a distributed charging and discharging control strategy is realized.

Benefits of technology

It improves the energy utilization efficiency and temperature balance of the system, improves control accuracy and response speed, enhances the scalability and reliability of the system, reduces communication overhead, and improves the tolerance for sensor failures and data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119813479A_ABST
    Figure CN119813479A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of battery charging and discharging, and discloses an MCU-based battery charging and discharging method, system and device and a storage medium, and the method comprises the steps: collecting the space coordinate data of all battery monomers in a battery pack based on an MCU, and carrying out the partition division, and obtaining the initial partitions of the battery monomers; performing polynomial fitting operation of charge and discharge characteristics on the single batteries to obtain a battery characteristic value matrix; performing K-means clustering to obtain a module group division result; calculating boundary battery monomers of adjacent module groups in a module group division result to obtain an optimal module group boundary position; and determining real-time state data of each module group and inputting the real-time state data into the double-layer deep reinforcement learning model to carry out charge and discharge control analysis to obtain a distributed charge and discharge control strategy of each module group, thereby realizing adaptive adjustment of module group boundaries, and effectively improving 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 MCU. Background Art

[0002] In large-scale battery pack management, traditional centralized control methods face problems such as large computational load, slow response speed, and poor robustness. Existing battery pack partitioning methods usually require calculating the state correlation between all battery cells, and the computational complexity grows quadratically with the size of the battery pack, which makes these methods inefficient when dealing with large battery packs.

[0003] The current battery pack charge and discharge control strategy is mainly based on simplified models or empirical rules, which are difficult to adapt to the dynamic characteristics of the battery pack under actual working conditions. Traditional control methods fail to fully consider the differences between battery cells, resulting in significant temperature imbalance and uneven energy distribution between cells during the charge and discharge process, affecting the service life and safety of the battery pack. In addition, the existing battery status monitoring methods mainly rely on the threshold judgment of a single parameter, lack of in-depth analysis of the coupling relationship of multiple parameters, and it is difficult to accurately identify potential abnormal conditions. In the case of sensor failure or data loss, the stability and reliability of the system will be seriously affected. 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: Based on the MCU, the spatial coordinate data of all battery cells in the battery pack are collected, and the battery cells are partitioned according to the spatial coordinate data to obtain initial partitions of the battery cells; 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; Performing K-means clustering based on the battery characteristic numerical matrix and combining the physical position constraint conditions of the battery cells to obtain a module group division result; 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 an 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 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.

[0006] In a second aspect, the present invention provides a battery charging and discharging system based on an MCU, wherein the battery charging and discharging system based on an MCU comprises: An acquisition module, used for acquiring 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; A calculation module, used for collecting charge and discharge characteristic data and performing polynomial fitting calculation on the battery cells in the initial partition to obtain a battery characteristic numerical matrix; A clustering module, used to perform K-means clustering based on the battery characteristic numerical matrix and obtain a module group division result in combination with the physical position constraint conditions of the battery cells; A planning module, used to perform 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 an optimal module group boundary position; The 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 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.

[0007] The 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.

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

[0009] In the technical solution provided by the present invention, by introducing a partitioning method with spatial position constraints, the complexity of partition 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 calculation 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 calculation load of the system is reduced, and the stability of the partitioning result is improved; by using a double-layer deep reinforcement learning model, the adaptive optimization of the charging and discharging strategy is realized, the control problem of the battery pack under dynamic conditions is effectively solved, and the control accuracy and response speed of the system are improved; 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. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0011] Figure 1 A schematic diagram of the steps of a battery charging and discharging method based on MCU in an embodiment of the present invention; Figure 2 It is a structural schematic diagram of a battery charging and discharging system based on MCU in an embodiment of the present invention; Figure 3 It is a schematic block diagram of the structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0012] Embodiments of the present invention provide a battery charging and discharging method, system, device and storage medium based on MCU. The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "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 that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0013] 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: 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; It is understandable that the execution subject of the present invention may be a battery charging and discharging system based on an MCU, or may be a terminal or a server, which is not specifically limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.

[0014] Specifically, the MCU is used as the core control unit to collect the three-dimensional spatial coordinates of each battery cell in the battery pack, and the positioning module or sensor installed on the battery cell is used to obtain its spatial position data inside the battery pack. The MCU collects these position data through a real-time communication protocol and stores them as a standardized three-dimensional coordinate point set. After obtaining the spatial position data of each battery cell, the spatial relationship between the battery cells is calculated based on these data. The Euclidean distance formula is used to calculate the distance between any two battery cells. This formula accurately represents the geometric straight-line distance between points, thereby constructing a spatial distance matrix between each battery cell and other battery cells around it. Through pair-by-pair calculations, a complete spatial distance relationship between battery cells is generated. Threshold analysis is performed on the spatial distance relationship. By setting a predefined distance threshold, battery cells with a distance less than the threshold are marked as adjacent cells, and an adjacent relationship graph of battery cells is established. The relationship graph is represented by a graph theory structure, in which each node corresponds to a battery cell, and the existence of an edge depends on whether the distance between the battery cells corresponding to the two nodes meets the condition of being less than the threshold. By analyzing the relationship graph, the spatial proximity of battery cells is identified, and a preliminary connection structure is constructed based on this. Based on the adjacent relationship graph of battery cells, the minimum spanning tree algorithm in graph theory is used to optimize the relationship graph. The minimum spanning tree is an acyclic subgraph containing all nodes and with the smallest sum of edge weights, which is used to represent the connection topology between battery cells. By calculating and counting the edge weights of the minimum spanning tree, the compactness of the battery cells in the spatial layout is reflected, thus providing a key reference for the number and boundaries of the partitions. By analyzing the structural characteristics of the minimum spanning tree and combining the mathematical method of cluster analysis, the connection topology is hierarchically clustered and the battery cells are divided into several preliminary partitions in a hierarchical manner. Hierarchical clustering analysis determines the reasonable number of partitions and boundary conditions by gradually merging or splitting monomer nodes. A local coordinate system is established according to the number and boundaries of the partitions. The local coordinate system is a coordinate framework redefined based on the relative position of the battery cells in the partition, which can map the battery cell position in the global three-dimensional space to a small range within the partition, thereby simplifying the subsequent calculation complexity. The battery cells in each partition are recoded so that they have independent number identification in the partition, and the initial partition of the battery cells is obtained.

[0015] 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; Specifically, a standard charge and discharge cycle is performed on the battery cells in the initial partition, and the voltage rise data, current change data and temperature change data of the charging process are collected to obtain the original characteristic data of each battery cell, reflecting the performance of the battery cell under specific operating conditions. In order to eliminate the noise interference in the acquisition process and improve the data quality, the original characteristic data is processed by digital filtering technology. By selecting a filtering algorithm, such as a low-pass filter or a Kalman filter, the effective part of the data is extracted to obtain the filtered data sequence of the battery cell. These filtered data sequences are used to calculate the dynamic characteristic parameters of the battery during the charging process, such as the voltage rise rate, current change rate and temperature change rate. Among them, the voltage rise rate can reflect the dynamic changes of the electrochemical reaction during the battery charging process, the current change rate represents the charge transfer rate inside the battery, and the temperature change rate is directly related to the thermal management performance of the battery. Based on the above dynamic characteristic parameters, in order to describe the characteristic curve of the battery cell, a polynomial fitting method is used to construct an n-order polynomial model. The coefficients of the fitting model are solved by the least squares method to ensure that the fitting curve can accurately reflect the trend of the data. By performing derivative analysis on the fitting equation, the slope and curvature at a specific target time point are calculated to determine the characteristic inflection point data of the battery cell characteristic change. The characteristic inflection point data reflects the critical moment of battery performance change, which helps to evaluate the battery's health status and charging and discharging efficiency. The statistical characteristic vector of the battery cell is calculated based on the characteristic inflection point data. In order to ensure that the characteristic vectors of different battery cells are numerically comparable, these statistical characteristic vectors are standardized to eliminate the 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 closeness of the battery cells in characteristic performance. By constructing a similarity matrix containing the similarity relationships of all battery cells, the performance similarity between battery cells is reflected. Finally, with the similarity matrix as the core, a complete battery characteristic numerical matrix is ​​formed.

[0016] Step S3, performing K-means clustering based on the battery characteristic numerical matrix and combining the physical position constraint conditions of the battery cells to obtain the module group division result; Specifically, the cluster center points are calculated based on the battery characteristic numerical matrix. In order to make the clustering process more representative and stable, multiple representative initial points are selected from the battery characteristic numerical matrix as the first cluster center based on the maximum distance principle. By increasing the distance between the initial center points, the phenomenon of slow convergence or local optimum caused by improper selection of the center point in the early stage of clustering is avoided. K-means iterative calculation is performed based on multiple first cluster centers. In each round of iteration, according to the characteristic value of each battery cell, its distance from each first cluster center is calculated, and the battery cell is attributed to the cluster center with the nearest distance to generate a category attribution label. As the attribution of more battery cells is determined, the cluster center position of each category is continuously updated to the centroid position of all battery cells in the category. By continuously adjusting the cluster center and category attribution, the clustering results are gradually optimized. After each round of iteration, the current clustering effect is evaluated to see if it meets expectations, and the silhouette coefficient is used to measure the effectiveness of clustering. The silhouette coefficient can quantify the degree of tightness within the category and the degree of separation between categories in the clustering results, thereby guiding further clustering optimization. If the effectiveness of the clustering results does not reach the expected threshold, the cluster center position is adjusted through the local search algorithm. The local search optimizes the distribution of the current cluster center by finding a new center position around the first cluster center, making the clustering results more balanced and reasonable. At this stage, the physical position constraints of the battery cells are also introduced. By converting the physical position coordinates of the battery cells into a distance constraint matrix, the relative position relationship of the battery cells in the physical space is clarified, and the consideration of physical space proximity is increased in clustering optimization. If some clustering results classify battery cells that are too far apart in physical distance into the same category, a penalty is imposed on this situation so that they are preferentially adjusted to a category that is more in line with the actual space during the clustering process. Based on the optimized cluster center points and distance constraints, the iterative process of K-means clustering is executed again. In the process of continuously adjusting the cluster center position and category attribution, the algorithm gradually converges, and finally obtains a clustering division result that satisfies the characteristic consistency and spatial rationality. The clustering results are processed by boundary smoothing. By analyzing the battery cells in the boundary area, their categories are adjusted 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.

[0017] Step S4, 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; Specifically, the boundary battery cells of each module group in the module group division result are marked to clarify which battery cells are located at the boundary between the module groups. These boundary battery cells have a great influence on the overall performance of the module group during the charging and discharging process, so their key state parameters are collected, including voltage value, temperature value and internal resistance value, and these parameters are recorded as a boundary state parameter set. According to the boundary state parameter set, the voltage difference value, temperature difference value and internal resistance difference value between the boundary battery cells of adjacent module groups are calculated to quantify the degree of performance inconsistency at the boundary of adjacent module groups. These difference values ​​are summarized to construct a difference value weight matrix, which is used to describe the degree of influence of each state parameter on the overall difference, so as to extract the difference characteristics of the boundary state. The boundary state difference characteristics are normalized to eliminate the influence of the dimension and numerical range between the parameters, and form a standardized difference feature vector. Based on the standardized difference feature vector, a dynamic programming state transition equation is constructed to optimize the boundary position. In the dynamic programming model, the position 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 converted into a mathematical model. The objective function is set to minimize the state difference between the boundaries of adjacent module groups, while taking into account the impact of boundary adjustment on the connectivity of the internal structure of the module group and the boundary smoothness. Constraints are used to limit the scope of boundary adjustment to ensure that the optimization results are feasible in practical applications. According to the constructed boundary optimization mathematical model, each module group boundary is traversed and searched. By traversing different boundary positions, the objective function value at each boundary position is calculated to generate a set of boundary adjustment candidate solutions. The set of these candidate solutions provides a variety of possible boundary optimization paths. For further screening and optimization, the 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 value function is constructed to comprehensively consider factors such as state difference, connectivity and smoothness to evaluate the pros and cons of each solution. The value iteration algorithm is used to solve the value function, and the optimal boundary adjustment strategy is selected from the candidate solution subset to obtain the boundary optimization trajectory. This trajectory represents the optimal path for boundary position adjustment in a series of iterative steps. Along this trajectory, the module group boundary is gradually adjusted. In each adjustment, the difference in state parameters of adjacent module groups is recalculated to verify whether the optimization has made progress, and based on this, it is decided whether to continue iterating. Through this process, the state difference between adjacent module groups is continuously reduced, so that the optimization gradually converges. Finally, when the state difference between adjacent module groups is minimized and the adjustment of the boundary meets the requirements of connectivity and smoothness, the optimal module group boundary position is obtained.

[0018] 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.

[0019] Specifically, 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 unify the data scale and eliminate unit differences. The standardized real-time state data can accurately reflect the operating status of each module group. The real-time state data is input into the high-level policy network of the two-layer deep reinforcement learning model to construct the state space of the policy network. Based on the state space, the action space is defined, which covers three dimensions, namely, charging mode selection, discharging mode selection and energy allocation ratio. The global charge and discharge strategy is obtained through deep reinforcement learning calculation of the high-level policy network. This strategy includes the working mode selection (such as charging or discharging) of each module group and the weight of energy allocation. The global charge and discharge strategy is parsed to extract the specific control targets of each module group, including the charging control target value and the discharging control target value. At the same time, these target values ​​are combined with the physical constraints of each module group (including temperature threshold, voltage threshold and power threshold), and the module-level control constraints are generated by constraint mapping. The module-level control constraints include the upper limit of charging current, the upper limit of discharging power and the threshold of balanced control, providing boundary conditions for the precise control of each module group. 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. In the charging control unit, the optimal charging current value of each module group in the current state is calculated by deep reinforcement learning. In order to ensure the maximum charging efficiency and balanced temperature distribution, the optimization objective function needs to balance the gradient change of energy input and module temperature at the same time to generate the initial charging control signal. The energy balance of the initial charging control signal is verified. By calculating the temperature gradient and internal resistance gradient between each module group, a dynamic compensation function is constructed, and the gradient descent method is applied to compensate the charging current in real time. The compensated charging current parameters are more in line with actual needs, effectively improving the problem of uneven temperature distribution between modules and improving charging efficiency. In the discharge control unit, the module-level control constraints and real-time status data are used as input, and the optimal discharge power value of each module group in the current state is calculated by deep reinforcement learning. The optimization of discharge power needs to meet the requirements of optimal discharge performance while taking into account the balance of charge state. Based on the initial discharge control signal, the charge state difference and power allocation ratio between each module group are calculated, the power adjustment function is constructed, and the discharge power is adjusted in real time using the quadratic programming method. The discharge power parameters obtained in this way can balance the charge state between module groups while ensuring discharge efficiency, thereby avoiding local over-discharge problems. Based on the coordinated optimization of charging current parameters and discharge power parameters, the dynamic relationship between charging and discharging is comprehensively considered, and the impact of both on the performance of the module group is balanced to obtain the final distributed charging and discharging control strategy.

[0020] By analyzing the distributed charge and discharge control strategy of each module group, the specific charging current parameters and discharge power parameters are extracted. These parameters are the core basis for the initialization configuration of the controller. Based on the extracted parameters, the distributed controller performs initialization configuration and generates initial control parameters, including the current regulation upper limit, power allocation ratio and initial control threshold of each module group. Through this process, it is ensured that the controller can generate initial control signals according to specific strategy requirements. Based on the initial control parameters, the charging current control signal and the discharge power control signal of each module group are generated. By analyzing these control signals, the power allocation coefficient and the energy transfer path between the module groups are calculated. The power allocation coefficient determines the energy allocation ratio of each module group during the charging and discharging process, while the energy transfer path clarifies the physical path of energy flow between the module groups, forming a specific distributed control instruction group. The distributed control instruction group is sent to the control system as a direct input for the execution action. In order to achieve independent control of each module group, the controller processes the distributed control instruction group in parallel. The power conversion circuit of each module group is independently adjusted through the PWM modulator to achieve precise control of voltage and current. In 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 of the module group. The feedback data includes the actual output parameters generated by each module group during the execution process, which provides a basis for subsequent correction and optimization. Based on the real-time control feedback data, the charging efficiency coefficient and the discharging efficiency coefficient of each module group are calculated. These efficiency coefficients reflect the energy conversion efficiency of the module group under the current operating conditions. According to the calculation results of the efficiency coefficient, the power allocation coefficient is corrected to generate an optimized power allocation scheme. The optimized power allocation scheme can dynamically adjust the energy allocation ratio between the module groups so that the overall efficiency is optimized. At the same time, the control instructions of each module group are updated according to the optimization scheme, and the control phases of all module groups are synchronously adjusted through the distributed phase lock to generate a phase-synchronized control signal, thereby avoiding the control error caused by phase asynchrony. The control signal after phase synchronization is further optimized by the PI control algorithm of the voltage loop and the current loop. In this process, the dual closed-loop feedback controller adjusts the real-time state to calculate the duty cycle parameters of each power conversion circuit. These duty cycle parameters are used to directly drive the power conversion circuit of the module group to make its output more accurate and achieve high efficiency and stability of closed-loop control. According to the closed-loop control calculation results, the soft start sequence and soft stop sequence of each module group are generated to ensure that the module group can smoothly transition when starting and stopping, and avoid current shock caused by sudden changes. At the same time, the distributed coordinator is responsible for switching the working mode of the module group and generating a coordinated control instruction sequence. These instruction sequences are used to coordinate the switching of each module group between different working modes, such as switching from charging mode to discharging mode or balancing mode, so as to meet diverse charging and discharging needs.Under the guidance of 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. These state parameters, including voltage, current, temperature, etc., are fed back to the distributed controller in real time to form the basic data for the next round of closed-loop optimization control. The distributed controller adjusts the control parameters according to the feedback data, optimizes the power allocation plan and execution strategy, and further improves the overall efficiency and consistency of the battery pack. Through this closed-loop control process, the coordinated control and efficient operation of the battery pack are finally achieved. The closed-loop control execution results can optimize the energy utilization during the charging and discharging process, balance the state differences between the module groups, and extend the service life of the battery pack.

[0021] In the embodiment of the present invention, by introducing a partitioning method with spatial position constraints, the complexity of 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 calculation 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 calculation load of the system is reduced, and the stability of the partitioning result is improved; by using a double-layer deep reinforcement learning model, the adaptive optimization of the charging and discharging strategy is realized, the control problem of the battery pack under dynamic conditions is effectively solved, and the control accuracy and response speed of the system are improved; by adopting a distributed control architecture, the 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 fault tolerance of the system 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.

[0022] In a specific embodiment, the process of executing step S1 may specifically include the following steps: Based on the MCU, the three-dimensional spatial coordinates of each battery cell in the battery pack are collected to obtain the spatial position data of each battery cell, and 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 whose distance is less than a preset threshold as adjacent cells, and obtaining an adjacent relationship diagram of the battery cells; Based on the adjacent 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. 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 partitions of the battery cells.

[0023] 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 expressed as ,in , and It is The position data of each battery cell in the three-dimensional coordinate system are obtained by the positioning sensor installed in the battery pack or by direct measurement. After completing the spatial coordinate acquisition, 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: ; in, Indicates The battery cell and The distance between the battery cells, and are their three-dimensional coordinates respectively. Using the above formula, a distance matrix is ​​constructed , whose elements Indicates and The distance between the 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 and The battery cells are marked as adjacent cells, and the adjacent relationship graph of the battery cells is generated. The adjacent 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 the threshold. Based on the adjacent 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 loop is formed. The weight of each edge of 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 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. According to 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 in the partition, thereby completing the initial partitioning of the battery cells.

[0024] In a specific embodiment, the process of executing step S2 may specifically include the following steps: 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 original characteristic data of the battery cells; Performing digital filtering on the original 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 of the charging process based on the filtered data sequence to obtain the dynamic characteristic parameters of the battery cell; An n-order polynomial fitting model is constructed according to the dynamic characteristic parameters, and the polynomial coefficients are solved by the least square method to obtain the characteristic curve equation of the battery cell. The characteristic curve equation is 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. 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; 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.

[0025] 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 a curve of voltage changing with time. , Curve of current changing with time And the temperature versus time curve These data reflect the dynamic behavior of the battery during the charging and discharging process. The raw characteristic data is digitally filtered. The filtering method includes a low-pass filter or a Kalman filter to remove high-frequency noise and retain the main trend of the data. The filtered data sequence is expressed as , and , are the filtered sequences of voltage, current and temperature respectively. The dynamic characteristic parameters of the battery are calculated through these filtered data sequences. For example, the voltage rise rate is expressed as: ; in, It represents the rate of change of voltage per unit time. Similarly, the rate of change of current and the rate of change of 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. , describing the speed of voltage change over time. According to the dynamic characteristic parameters, construct The polynomial fitting model 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: ; 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: ; in, It's the time point. is the value of the original data. By solving the above optimization problem, we 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, in the fitting function Based on the derivative calculation, the slope and curvature of the curve at the target time point are obtained. The slope is expressed as: ; The curvature is expressed as: ; in, is the first derivative of the characteristic curve, is the second-order derivative, Represents the curve at the time point The characteristic inflection point of the battery cell performance change is identified by calculating the slope and curvature at the target time point. Based on the characteristic inflection point data, the statistical characteristic vector of the battery cell is calculated. The statistical characteristic vector integrates the dynamic characteristic parameters and the 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 standardizing these characteristic values, a standardized characteristic matrix is ​​formed, which is expressed as: ; in, is the standardized feature matrix, Indicates 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 coefficients between battery cells in the initial partition are calculated. The similarity metric includes cosine similarity, which is formulated as: ; 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 and The similarity of each battery cell is calculated and finally a battery characteristic numerical matrix is ​​formed.

[0026] In a specific embodiment, the process of executing step S3 may specifically include the following steps: Calculating cluster centers based on the battery characteristic numerical matrix, and selecting initial positions of cluster centers by the maximum distance principle to obtain multiple first cluster centers; 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; 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; A threshold value is determined for the clustering effectiveness index, and the positions of multiple first clustering centers are adjusted by a local search algorithm to obtain multiple second clustering centers; The physical position 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; Based on the optimization objective function and 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 the clustering division result, and the clustering division result is subjected to boundary smoothing to obtain the module group division result.

[0027] Specifically, information is extracted from the battery characteristic numerical matrix and the location of the cluster center is calculated. Assume that the battery characteristic numerical matrix is ,in Indicates Battery Cell dimensional feature vector, matrix Include The characteristic data of each battery cell. In order to preliminarily determine the location of the cluster center point, 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 point. Randomly select an initial point , then recursively select the points The following conditions are met: ; in, Indicate point and The Euclidean distance of is a point in the selected center point set. By maximizing the distance from the point to the nearest center point, it can ensure that the initial cluster center points are 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: ; in, Indicates 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 After the classification is completed, the centroid coordinates of each cluster are recalculated as the cluster center for the next round of iteration. The calculation formula for the new centroid is: ; 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. In order to evaluate the clustering effect, the silhouette coefficient is introduced as an evaluation index. The definition of the silhouette coefficient is as follows: ; in, Indicate point The average distance to other points in the same cluster, Indicate point The average distance to the nearest neighbor cluster. For the entire data set, 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 cells, the physical position coordinates are converted into a distance constraint matrix Indicates and If some clustering results violate spatial proximity (i.e. the distance exceeds a certain threshold), ), then the penalty term is introduced To optimize the objective function: ; 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-class distance is maximized and the intra-class distance is minimized, and the optimized clustering division result is obtained. The clustering division result is subjected to boundary smoothing to ensure uniform transition of the boundary area of ​​the module group, and the module group division result is obtained.

[0028] In a specific embodiment, the process of executing step S4 may specifically include the following steps: 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; The voltage difference value, temperature difference value and internal resistance difference value between battery cells at the boundary of adjacent module groups are calculated according to the boundary state parameter set, and a difference value weight matrix is ​​constructed to obtain boundary state difference characteristics; 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, and obtain a boundary optimization mathematical model; 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; 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. 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.

[0029] 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 state parameters of these boundary battery cells, including voltage values ), temperature value And internal resistance ), forming a boundary state parameter set ,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 by the following formulas: ; in, , and Represents the battery cells at the boundary of the module group and By traversing all combinations of boundary monomers, a difference value weight matrix is ​​constructed. , the matrix elements Defined as a weighted sum of the difference values: ; 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 dimension difference of different physical quantities. The normalized difference feature is expressed as the standardized feature vector ,in Indicates The normalized difference characteristics of the boundary battery cells are constructed. Based on the standardized feature vector, a dynamic programming state transfer 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 the state transfer rules. The state transfer equation is expressed as: ; in, Yes Status Taking Action The value after It is an immediate reward. is the discount factor, From the state Transfer to By setting the boundary adjustment constraints, such as the minimization target of 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, each module group boundary is traversed and searched, and the objective function value at different boundary positions is calculated. The objective function is defined as: ; in, is the weighted sum of the boundary state differences, 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. A value function is constructed based on the candidate solution subset to comprehensively evaluate the effect of boundary adjustment. The value function is expressed as: ; in, is the weighted sum of state differences, is the boundary smoothness index, is the smoothness weight factor. The value iteration algorithm is used to solve the value function, iteratively update the value of each boundary position, and finally determine the optimal boundary adjustment strategy. Along the boundary optimization trajectory obtained by the solution, the module group boundary is gradually adjusted. In each iteration, corrections are made according to the current state difference and connectivity, and the boundary state parameters and difference characteristics are recalculated until the state difference of adjacent module groups is minimized and the boundary position converges, and the optimal module group boundary position is obtained.

[0030] In a specific embodiment, the process of executing step S5 may specifically include the following steps: 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 state data; The real-time state data is input into the state space of the high-level policy network in the two-layer deep reinforcement learning model, and the 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 obtained through deep reinforcement learning calculation. The global charging and discharging strategy includes the working mode and energy allocation weight of each module group. The global charge and discharge strategy is parsed to extract the charge control target value and discharge control target value of each module group, and the charge control target value and discharge control target value are combined with the temperature threshold, voltage threshold and power threshold of each module group. The module-level control constraint conditions are obtained through constraint mapping. The module-level control constraint conditions include the upper limit of the charging current, the upper limit of the discharge power and the balancing control threshold. 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. The optimal charging current value of each module group in 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 the initial charging control signal. 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 by the gradient descent method to obtain the charging current parameters; The module-level control constraints and real-time status 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 to obtain the initial discharge control signal. The power balance of the initial discharge control signal is verified, the state of charge difference and power allocation ratio between each module group are calculated, and the power adjustment function is constructed based on the state of charge difference. The discharge power is adjusted in real time through the quadratic programming method to obtain the discharge power parameters; Based on the coordinated optimization of charging current parameters and discharging power parameters, a distributed charging and discharging control strategy for each module group is obtained.

[0031] 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 They 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: ; in, and are the minimum and maximum values ​​of the state data, respectively. is the standardized real-time state data. The standardized 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, construct 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: ; 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 parsing 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 ), generate module-level control constraints through constraint mapping, which are defined as: ; in, is the upper limit of charging current, is the upper limit of discharge power, is the threshold of balancing control. The module-level control constraints and real-time status data are input into the low-level execution network in the two-layer deep reinforcement learning model to calculate the optimal charging current value and discharge power value respectively. In the charging control unit, deep reinforcement learning is used to optimize the objective function: ; Get the initial charging control signal To verify its energy balance, the temperature gradient and internal resistance gradient between module groups are calculated: ; 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: ; 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 optimized collaboratively, and the charging efficiency, temperature balance and charge state consistency are comprehensively considered to generate a distributed charging and discharging control strategy.

[0032] In a specific embodiment, the above-mentioned MCU-based battery charging and discharging method further includes the following steps: Analyze the distributed charging and discharging control strategy of each module group, and perform parameter initialization configuration on the distributed controller according to the charging current parameters and discharging power parameters of each module group to obtain the initial control parameters of the distributed controller; Generate a charging current control signal and a discharging power control signal for each module group based on the initial control parameters, and calculate the power allocation coefficient and energy transfer path of each module group according to the control signal 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 the PWM modulator, and the output voltage and output current of each power conversion circuit are collected to obtain the real-time control feedback data of the module group; The charging efficiency coefficient and the discharging efficiency coefficient of each module group are calculated according to 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; 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; 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; 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; 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 result of the battery pack.

[0033] Specifically, by analyzing the distributed charging and discharging 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 the discharging power control signal of each module group are generated. The generation formula of the charging current control signal is: ; in, Represents a module group In time The control current, is the target current. The generation formula of the discharge power control signal is: ; 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: ; in, Represents a module group The power allocation weight is The total number of module groups. 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 allocation coefficients of all module groups are integrated to generate a distributed control instruction group. The distributed controller processes the instruction groups in parallel and independently drives the power conversion circuit of each module group 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 of charging efficiency coefficient is: ; in, Is a module group The formula for the discharge efficiency coefficient is: ; Based on the efficiency factor, the power distribution factor is corrected: in, It is the comprehensive efficiency coefficient, combining the charging and discharging efficiencies. According to 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, and the phase-synchronized control signals are generated to ensure that the module groups are coordinated in phase and avoid power instability caused by phase asynchrony. The control signal after phase synchronization is processed by the dual closed-loop feedback controller, which performs PI control of the voltage loop and the current loop respectively, and calculates the duty cycle parameters of the power conversion circuit. , and its calculation formula is ; 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 to avoid 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 feed 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.

[0034] 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 MCU includes: The acquisition module is used to acquire the spatial coordinate data of all battery cells in the battery pack based on the MCU, and divide the battery cells into zones according to the spatial coordinate data to obtain the initial zones of the battery cells; 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; The clustering module is used to perform K-means clustering based on the battery characteristic numerical matrix and combine the physical location constraints of the battery cells to obtain the module group division results; A planning module is used to calculate the state parameter difference and perform dynamic planning 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; 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 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.

[0035] 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 amount of calculation 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, reduce the computational load of the system, and at the same time improve 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 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, the adaptive adjustment of the module group boundary is realized, which effectively improves the energy utilization efficiency and temperature balance of the system.

[0036] 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 3As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer 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 the 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 through a network connection. When the computer program is executed by the processor, the above method is implemented.

[0037] 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.

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

[0039] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention 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. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.

[0040] Those skilled in the art can 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.

[0041] If the integrated unit is implemented in the form of 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 is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0042] 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 aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may 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: Based on the MCU, the spatial coordinate data of all battery cells in the battery pack are collected, and the battery cells are partitioned according to the spatial coordinate data to obtain initial partitions of the battery cells; 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; Performing K-means clustering based on the battery characteristic numerical matrix and combining the physical position constraint conditions of the battery cells to obtain a module group division result; 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 an 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 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.

2. The battery charging and discharging method based on MCU according to claim 1, characterized in that: The MCU is used to collect the 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 the initial zones of the battery cells, including: Based on the MCU, the three-dimensional spatial coordinates of each battery cell in the battery pack are collected to obtain the spatial position data of each battery cell, and 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 whose distance is 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 the 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 charging and discharging characteristic data collection and polynomial fitting operation are performed on the battery cells in the initial partition to obtain a battery characteristic numerical matrix, including: Performing a standard charge and 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 original 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 of the charging process based on the filtered data sequence to obtain dynamic characteristic parameters of the battery cell; Constructing an n-order polynomial fitting model according to the dynamic characteristic parameters, solving the polynomial coefficients by the least square method to obtain a characteristic curve equation of the battery cell, and performing derivative analysis on the characteristic curve equation to calculate the slope and curvature at the 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 performing standardization processing on the statistical characteristic vector to obtain a standardized characteristic matrix; The similarity coefficients between battery cells in the same initial partition are calculated according to the standardized characteristic matrix, and a similarity matrix is ​​constructed to obtain a battery characteristic value matrix.

4. The MCU-based battery charging and discharging method 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 result, 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, calculating the Euclidean distance between each battery cell and each first cluster center, and obtaining a category attribution label of the battery cell; Calculating the centroid coordinates of each cluster according to the category attribution label, and evaluating the clustering result 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 clustering centers by a local search algorithm to obtain multiple second clustering centers; The physical position 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 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 MCU-based battery charging and discharging method 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 an 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 boundary of adjacent module groups according to 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; According to the boundary optimization mathematical model, each module group boundary is traversed and searched, and the objective function value at different boundary positions is calculated to obtain a set of boundary adjustment candidate solutions; Based on the boundary adjustment candidate solution set, the internal connectivity and boundary smoothness of the module group are calculated to obtain a candidate solution subset, a value function is constructed based on the candidate solution subset, 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 MCU-based battery charging and discharging method 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 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, 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; The real-time state data is input into the state space of the high-level strategy network in the double-layer deep reinforcement learning model, and an action space is constructed based on the state space, wherein the action space includes three dimensions: charging mode selection, discharging mode selection, and energy allocation ratio. A 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; The global charge and discharge strategy is parsed to extract the charge control target value and the discharge control target value of each module group, and the charge control target value and the discharge control target value are combined with the temperature threshold, the voltage threshold and the power threshold of each module group, and the module-level control constraint conditions are obtained through constraint mapping, and the module-level control constraint conditions include the charging current upper limit, the discharging power upper limit and the balancing control threshold; The module-level control constraint condition and the real-time state data are inputted into the charging control unit of the lower-level execution network in the two-layer deep reinforcement learning model, and the optimal charging current value of each module group in the current state is calculated by deep reinforcement learning. The optimal charging current value must simultaneously meet the requirements of maximizing charging efficiency and temperature balance, so as 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, dynamically compensating the charging current by a gradient descent method, and obtaining a charging current parameter; The module-level control constraint condition and the real-time state data are inputted into the discharge control unit of the lower-layer execution network in the two-layer deep reinforcement learning model, and the optimal discharge power value of each module group in the current state is calculated by deep reinforcement learning. The optimal discharge power value needs to simultaneously meet the requirements of optimal discharge performance and balanced state of charge, so as to obtain an initial discharge control signal; The power balance of the initial discharge control signal is verified, the state of charge difference and the power allocation ratio between the module groups are calculated, and a power adjustment function is constructed based on the state of charge difference, and the discharge power is adjusted in real time by a quadratic programming method to obtain a discharge power parameter; Based on the charging current parameter and the discharging power parameter, a distributed charging and discharging control strategy for each module group is obtained by collaborative optimization.

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 discharging power parameters of each module group to obtain the initial control parameters of the distributed controller; Generate a charging current control signal and a discharging power control signal for each module group based on the initial control parameters, and calculate a power allocation 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 the 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; The phase-synchronized control signal is subjected to voltage loop and current loop PI control, and the duty cycle parameters of the power conversion circuit of each module group are calculated by 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 a 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, used for acquiring 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; A calculation module, used for collecting charge and discharge characteristic data and performing polynomial fitting calculation on the battery cells in the initial partition to obtain a battery characteristic numerical matrix; A clustering module, used to perform K-means clustering based on the battery characteristic numerical matrix and obtain module group division results in combination with the physical position constraint conditions of the battery cells; A planning module, used to perform 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 an optimal module group boundary position; The 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 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.

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 described in 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

  • Intelligent battery management system based on data analysis

    CN116882981A

  • Charging and discharging control method of lithium ion battery pack, battery management system and charging and discharging method

    CN117423920A

  • Electric vehicle charging planning method and device

    CN118095783A

  • Intelligent agent construction method and system and energy storage system optimization method and system

    CN118378866A

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

    CN118693964A

Cited By

  • Charging and discharging optimization system based on energy storage battery

    CN121172924A