A two-stage lithium battery combined state estimation method and system
By constructing a differentiated two-stage deep learning model and improving the Grey Wolf algorithm to optimize hyperparameters, the difficulties of model homogenization and hyperparameter optimization in lithium battery state estimation are solved, achieving high-precision joint estimation of lithium battery SOH and SOC, and improving the state awareness capability of the battery management system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGXI UNIV OF SCI & TECH
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-21
AI Technical Summary
Existing lithium battery state estimation methods suffer from model homogenization and hyperparameter optimization difficulties, resulting in insufficient accuracy and generalization ability in SOH and SOC estimation, making it difficult to adapt to different battery types and complex operating conditions.
A two-stage deep learning model with differentiated internal structures is constructed to model the long-term slow-change characteristics of SOH and the short-term fast-change characteristics of SOC respectively. Hyperparameters are optimized by improving the Grey Wolf algorithm, and joint estimation is performed by combining the coupling relationship between SOH and SOC.
It achieves high-precision and robust online joint estimation of SOH and SOC of lithium batteries, improves the state perception accuracy and reliability of battery management system, and supports the safe and efficient operation and life prediction of batteries.
Smart Images

Figure CN122430722A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of lithium battery state estimation, and in particular to a method and system for joint state estimation of a two-stage lithium battery. Background Technology
[0002] With the rapid development of new energy vehicles, energy storage systems, and portable electronic devices, lithium batteries have become core energy storage components due to their high energy density, long cycle life, and low self-discharge rate. The battery management system (BMS), as the key to ensuring the safe, efficient, and long-life operation of lithium batteries, has the core task of accurately and reliably estimating the internal state of the battery online. Among these, the State of Health (SOH) and State of Charge (SOC) are two of the most critical state parameters. SOH reflects the degree of battery aging and remaining lifespan; its changes are slow and closely related to the battery's long-term usage history and material degradation mechanisms. SOC, on the other hand, characterizes the battery's real-time remaining usable capacity; its changes are rapid and strongly dependent on short-term real-time operating data such as current, voltage, and temperature. Accurate estimation of SOH and SOC is not only a prerequisite for achieving optimal charge and discharge control, thermal management, and equalization management of the battery, but also the foundation for ensuring system safety, preventing overcharging and over-discharging, assessing battery value, and formulating maintenance strategies.
[0003] Traditionally, methods for estimating State of Health (SOH) and State of Charge (SOC) have primarily employed filtering methods based on electrochemical models or statistical methods based on empirical data. However, these methods have significant limitations: electrochemical model parameters are difficult to identify online, and model accuracy is greatly affected by operating conditions; while statistical methods rely on large amounts of experimental data, resulting in limited generalization ability. In recent years, deep learning technologies, represented by convolutional neural networks, long short-term memory networks, and their variants, have demonstrated great potential in the field of lithium-ion battery state estimation due to their powerful nonlinear fitting and temporal feature extraction capabilities. Researchers have begun exploring the construction of end-to-end deep learning models to jointly estimate SOH and SOC directly from raw or preprocessed operational data, aiming to achieve higher estimation accuracy and stronger adaptability.
[0004] However, existing joint estimation schemes based on deep learning still face two key challenges. First, the homogenization of model architecture. While SOH and SOC differ fundamentally in time-varying characteristics, data dependencies, and physical meaning, most existing joint models use a single or similar structure to handle both. This uniform design fails to fully consider the significant differences between the long-term health characteristics upon which SOH relies and the short-term real-time time-series data upon which SOC relies, resulting in models that cannot be finely designed for their respective optimal estimation modes, limiting further improvements in individual and overall estimation accuracy. Second, the hyperparameter optimization dilemma. The performance of deep learning models heavily depends on the selection of hyperparameters such as network structure parameters (e.g., number of layers, number of neurons) and training parameters (e.g., learning rate). For complex two-stage models composed of CNNs, BiLSTMs, and Self-Attention, the hyperparameter space is enormous and the parameters are strongly coupled. Traditional grid search and random search methods are inefficient, computationally expensive, and prone to getting trapped in local optima, making it difficult for the model to achieve its theoretically optimal performance. This also severely restricts the model's generalization ability and engineering practicality under different battery types and complex, variable operating conditions.
[0005] To improve model performance and achieve automated hyperparameter optimization, metaheuristic optimization algorithms have been introduced into this field. Among them, the Grey Wolf algorithm has attracted attention due to its simple structure, few parameters, and strong global search capability. However, the standard Grey Wolf algorithm still suffers from problems such as an imbalance between exploration and exploitation capabilities, premature convergence, and rapid decline in population diversity when dealing with high-dimensional and complex deep learning model hyperparameter optimization problems. This makes it difficult to find globally optimal or near-optimal hyperparameter combinations stably and efficiently. Therefore, designing a high-performance deep learning model that fully considers the differences between SOH and SOC in lithium batteries, and matching it with a robust and efficient automated hyperparameter optimization algorithm, has become an urgent technical problem to be solved. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a two-stage joint state estimation method for lithium batteries. This method first constructs a two-stage deep learning model with differentiated internal structures to accurately model the long-term, slowly varying characteristics of the State of Health (SOH) and the short-term, rapidly varying characteristics of the State of Charge (SOC), thus solving the model homogenization problem in joint estimation. Simultaneously, an improved Grey Wolf algorithm is proposed, integrating nonlinear convergence factors, differential mutation, and arithmetic crossover operations to enhance global optimization capabilities and achieve efficient, automated global optimization of hyperparameters for complex models, overcoming the difficulties of manual parameter tuning and the tendency to get trapped in local optima. Finally, through a sequential process of first estimating the SOH and then incorporating it as prior information into the SOC estimation, high-precision and robust online joint estimation of the two states is achieved.
[0007] Another objective of this invention is to provide a two-stage lithium battery joint state estimation system.
[0008] The objective of this invention is achieved through the following technical solution:
[0009] A method for joint state estimation of a two-stage lithium battery includes the following steps:
[0010] Obtain historical charge-discharge cycle data of lithium batteries, extract features from the historical charge-discharge cycle data of lithium batteries, and filter them to obtain the data set for solving the state of health (SOH) of lithium batteries.
[0011] Obtain real-time operating data of lithium battery, and obtain a real-time dataset for solving the state of charge (SOC) of lithium battery based on the real-time operating data of lithium battery.
[0012] A two-stage deep learning model is constructed based on the CNN-BiLSTM-SelfAttention deep learning model; the two-stage deep learning model includes a first-stage deep learning model for calculating the SOH estimate and a second-stage deep learning model for calculating the SOC estimate;
[0013] The standard gray wolf algorithm is improved by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes, thus constructing an improved gray wolf algorithm.
[0014] An improved gray wolf algorithm is used to perform global automated optimization of hyperparameters of a two-stage deep learning model. A fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective is constructed. The optimal hyperparameter combination of the two-stage deep learning model is solved iteratively based on the fitness function, and the optimal hyperparameter combination is configured into the two-stage deep learning model to obtain the best-performing two-stage deep learning model.
[0015] The SOH solution dataset and the real-time SOC solution dataset are input into the best-performing two-stage deep learning model. Based on the SOH solution dataset, the SOH estimate is calculated using the first-stage deep learning model in the best-performing two-stage deep learning model. Then, based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated using the second-stage deep learning model in the best-performing two-stage deep learning model, thus realizing the two-stage joint state estimation of lithium battery SOH and SOC.
[0016] Furthermore, historical charge-discharge cycle data of lithium batteries were obtained, and features were extracted and filtered from this data to obtain a dataset for calculating the State of Health (SOH) of lithium batteries, as detailed below:
[0017] Obtain historical charge-discharge cycle data of lithium batteries;
[0018] An initial health feature set was extracted from historical charge-discharge cycle data of lithium batteries. ,in, This represents the m-th health characteristic; for the n-th cycle, the extracted health characteristics include: capacity, internal resistance, voltage characteristics, and self-discharge rate.
[0019] By calculating the m-th health characteristic With capacity retention absolute value of Pearson correlation coefficient The most effective subset of health characteristics is selected as shown in the following formula:
[0020] ;
[0021] In the formula, Represents the m-th health characteristic With lithium battery capacity retention The absolute value of the calculated Pearson correlation coefficient; Represents the health characteristics in the nth iteration. The value; Indicates health characteristics The mean; This represents the capacity retention rate in the nth cycle; This represents the mean capacity retention rate; N represents the total number of cycles.
[0022] Select The top K health features with the highest values form the health feature sequence matrix that is ultimately input into the first-stage deep learning model. The SOH solution dataset is obtained as shown in the following formula:
[0023] ;
[0024] In the formula, This represents the health feature value in the Kth column and Nth row of the health feature sequence matrix.
[0025] Furthermore, real-time operating data of the lithium battery is obtained, and a real-time dataset for solving the state of charge (SOC) of the lithium battery is obtained based on the real-time operating data, as follows:
[0026] During the online operation of the lithium battery, a fixed sampling frequency is used. Synchronous voltage acquisition Current and temperature The signal, where k is the discrete-time index;
[0027] During the data acquisition process, a sliding time window of length L is set. , This refers to the window duration.
[0028] At any current moment when SOC needs to be estimated The data within the window is extracted to construct the input vector, resulting in the real-time dataset for SOC solving, as shown in the following formula:
[0029] ;
[0030] In the formula, , , These represent time-series vectors constructed from real-time acquired voltage, current, and temperature data, respectively. , , They represent Voltage, current, and temperature data are collected in real time.
[0031] Furthermore, the first-stage deep learning model is used to extract the lithium battery aging trend from historical health feature sequences. Its structure consists of: a first CNN layer, a first BiLSTM layer, a first Self-Attention layer, and a first fully connected layer. The first-stage deep learning model captures the slow change pattern of SOH through the long-range memory capabilities of the first CNN layer and the first BiLSTM layer with 7-15 convolutional kernels, thereby calculating the SOH estimate. Specifically, as follows:
[0032] The first CNN layer is used to extract macro trends, and its calculation formula is as follows:
[0033] ;
[0034] In the formula, This represents the feature map output by the first CNN layer; This represents the input health feature sequence matrix, i.e., the SOH solution dataset, with dimensions of . , For sequence length, For feature dimensions; This represents a one-dimensional convolution operation; and These represent the convolutional kernel weight matrix and bias vector of the first CNN layer, respectively. For activation functions; This represents the max pooling operation;
[0035] The first BiLSTM layer aims to model long-range temporal dependencies by enhancing the memory capacity of its forgetting gate. Its calculation formula is as follows:
[0036] ;
[0037] In the formula, Indicates the Gate of Oblivion; Indicates the input gate; Indicates candidate memory units; Represents a memory unit; Indicates the output gate; This indicates the hidden state at the current time step; The input represents the time step t; This indicates the hidden state of the previous time step; This indicates the cell state at the previous time step; This represents the sigmoid activation function; Represents the hyperbolic tangent activation function; This represents element-wise multiplication; , , , and , , , These represent the trainable weight matrix and bias vector corresponding to each gating unit, respectively.
[0038] The first BiLSTM layer forms an encoded sequence by concatenating the final hidden states after bidirectional processing. The calculation formula is as follows:
[0039] ;
[0040] In the formula, express , , , Four trainable weight matrices; express , , , Four bias vectors;
[0041] The first Self-Attention layer enables the model to adaptively focus on the most important historical moments for estimating the current SOH state, and its calculation formula is as follows:
[0042] ;
[0043] ;
[0044] ;
[0045] ;
[0046] In the formula, This represents the query vector of the first-stage deep learning model. This represents the key vector of the first-stage deep learning model; This represents the value vector of the first-stage deep learning model. This represents the weighted context vector output by the first Self-Attention layer of the first-stage deep learning model. , , This represents a trainable linear projective weight matrix; Represents the dimension of the key vector, used for scaling the dot product; This represents the row-normalization function;
[0047] The first fully connected layer maps the context vector of the first Self-Attention layer to the final SOH estimate, and the calculation formula is as follows:
[0048] ;
[0049] In the formula, This represents the estimated SOH value; and This represents the weight matrix and bias vector of the first fully connected layer; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOH estimate.
[0050] Furthermore, the structure of the second-stage deep learning model is as follows: a second CNN layer, a second BiLSTM layer, a second Self-Attention layer, and a second fully connected layer. The second-stage deep learning model captures local fine features of real-time temporal data by stacking a second CNN layer with 3-5 convolutional kernels, and introduces a gating mechanism in the second Self-Attention layer to dynamically focus on key time segments, thereby calculating the SOC estimate; specifically as follows:
[0051] The second CNN layer uses multiple stacked 3-5 size one-dimensional convolutional kernels to extract local fine features of real-time temporal data. The calculation formula for its l-th layer is as follows:
[0052] ;
[0053] In the formula, This represents the feature map output by the l-th CNN layer of the second-stage deep learning model; This represents the feature map output by the (l-1)th CNN layer of the second-stage deep learning model; and Let represent the weight matrix and bias vector of the l-th convolutional layer, respectively; This represents a one-dimensional convolution operation; This represents the activation function; when l=1, , This represents the augmentation input matrix of the second-stage deep learning model;
[0054] The second BiLSTM layer is used to encode short-term temporal dynamics, and its calculation formula is as follows:
[0055] ;
[0056] In the formula, Indicates the Gate of Oblivion; Indicates the input gate; Indicates candidate memory units; Represents a memory unit; Indicates the output gate; This indicates the hidden state at the current time step; The input represents the time step t; This indicates the hidden state of the previous time step; This indicates the cell state at the previous time step; This represents the sigmoid activation function; Represents the hyperbolic tangent activation function; This represents element-wise multiplication; , , , and , , , These represent the trainable weight matrix and bias vector corresponding to each gating unit, respectively.
[0057] The output of the second BiLSTM layer encodes the hidden state sequence of short-term dependencies. The calculation formula is as follows:
[0058] ;
[0059] In the formula, express Four trainable weight matrices; express The bias vector corresponding to each gating unit;
[0060] The second Self-Attention layer introduces a gated loop mechanism, the calculation formula of which is:
[0061] ;
[0062] ;
[0063] ;
[0064] ;
[0065] ;
[0066] In the formula, , , , , Indicates trainable parameters; This represents the final hidden state of the second BiLSTM layer at the previous estimation time. This represents the element-wise natural logarithm operation; This represents the query vector for the second-stage deep learning model. This represents the key vector of the second-stage deep learning model; This represents the value vector of the second-stage deep learning model; This represents the gating vector introduced in the second Self-Attention layer of the second-stage deep learning model; Represents the dimension of the key vector, used for scaling the dot product; This represents the weighted context vector output by the second-stage deep learning model from the second Self-Attention layer; This represents the sigmoid activation function; Indicates matrix transpose;
[0067] The second fully connected layer is used to regress the final SOC estimate. The calculation formula is as follows:
[0068] ;
[0069] In the formula, and These represent the weight matrix and bias vector of the second fully connected layer, respectively. This represents the activation function, which constrains the output value to... Within the range, that is, the limited range of the SOC estimate.
[0070] Furthermore, the standard Grey Wolf algorithm is improved by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes. The improved Grey Wolf algorithm is constructed as follows:
[0071] Three improvements are made to the standard Grey Wolf algorithm to construct an improved Grey Wolf algorithm;
[0072] The first improvement is to introduce a nonlinear convergence factor, modifying the update of the nonlinear convergence factor 'a' to a nonlinear strategy based on the cosine function, as shown in the following equation:
[0073] ;
[0074] In the formula, and These represent the initial and final values of the nonlinear convergence factor a, respectively. Indicates the current iteration number; Indicates the maximum number of iterations; This represents a shape adjustment factor greater than 0;
[0075] The second improvement is to add a differential mutation operation, which is performed after each generation of the population update, using probability... Perform differential mutation on non-alpha wolf individuals; for each individual's position vector, generate a mutated individual. As shown in the following formula:
[0076] ;
[0077] In the formula, , , This represents three distinct individuals randomly selected from the current population. This represents a scaling factor between 0 and 2;
[0078] The third improvement is to add an arithmetic crossover operation for mutated individuals. Compared with the original individual position vector Perform arithmetic crossover to generate test individuals. Its j-th dimension parameter The calculation formula is as follows:
[0079] ;
[0080] In the formula, express Uniformly distributed random numbers within an interval; Indicates the crossover probability; This indicates a randomly selected dimension index; Represents the j-th dimension parameter Under the condition The calculated value obtained below; This indicates that the condition is not met. The j-th dimension parameter The calculated value obtained.
[0081] Furthermore, an improved Grey Wolf algorithm is used to perform global automated optimization of the hyperparameters of the two-stage deep learning model. A fitness function is constructed with the joint estimation accuracy of SOH and SOC as the optimization objective. The optimal hyperparameter combination of the two-stage deep learning model is iteratively optimized based on the fitness function, and the optimal hyperparameter combination is configured into the two-stage deep learning model, thereby obtaining the two-stage deep learning model with the best performance, as follows:
[0082] Encode all the hyperparameters to be optimized in the two-stage deep learning model into a D-dimensional decision vector. The hyperparameters include: the number of filters in the first CNN layer of the first-stage deep learning model. Number of filters in the second CNN layer of the second-stage deep learning model The number of hidden units in the first BiLSTM layer of the first-stage deep learning model. Number of hidden units in the second BiLSTM layer of the second-stage deep learning model The number of self-attention heads in the first Self-Attention layer of the first-stage deep learning model. Number of self-attention heads in the second Self-Attention layer of the second-stage deep learning model ; and learning rate and batch size ;
[0083] Construct a fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective. As shown in the following formula:
[0084] ;
[0085] In the formula, and These represent the use of hyperparameters. The root mean square error of the trained model's estimates of SOH and SOC on the validation set; The mean absolute error of the SOC estimate; , , These are non-negative weighting coefficients used to balance various error indicators;
[0086] To perform iterative optimization and determine the optimal solution, first initialize a set containing... A population of individual gray wolves, each representing a random hyperparameter vector. Then, iterative optimization is initiated to obtain the optimal hyperparameter combination of the two-stage deep learning model;
[0087] By configuring the optimal combination of hyperparameters into the two-stage deep learning model, the best-performing two-stage deep learning model can be obtained.
[0088] Furthermore, iterative optimization is initiated to obtain the optimal hyperparameter combination of the two-stage deep learning model. The specific steps are as follows:
[0089] For each individual Decode and instantiate the corresponding two-stage deep learning model, and train it using the training data;
[0090] Evaluate the trained model on an independent validation set and calculate its fitness value. ;
[0091] The alpha wolf in the current population is determined by sorting the alpha wolves according to their fitness values.
[0092] Based on the position update formula of the standard gray wolf algorithm, and combined with the nonlinear convergence factor, differential mutation operation and arithmetic crossover operation of the improved gray wolf algorithm, the position of all individuals, i.e. the hyperparameter vector, is updated.
[0093] Repeat the above steps until the maximum number of iterations is reached. ;
[0094] The final output is the individual with the smallest fitness value throughout the entire search history. That is, the optimal combination of hyperparameters.
[0095] Furthermore, the SOH solution dataset and the real-time SOC solution dataset are input into the optimal two-stage deep learning model. Based on the SOH solution dataset, the SOH estimate is calculated using the first-stage deep learning model in the optimal two-stage deep learning model. Then, based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated using the second-stage deep learning model in the optimal two-stage deep learning model, thus achieving two-stage joint state estimation of lithium battery SOH and SOC, as detailed below:
[0096] The SOH solution dataset is input into the first stage of the optimal two-stage deep learning model. Macro-feature extraction is performed first, as shown in the following equation:
[0097] ;
[0098] In the formula, This represents the feature map output by the first CNN layer of the deep learning model in the first stage of any solution process; This represents the input health feature sequence matrix, i.e., the SOH solution dataset, with dimensions of . , For sequence length, For feature dimensions; This represents a one-dimensional convolution operation; and These represent the weight matrix and bias vector of the first CNN layer of the first-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. For activation functions; This represents the max pooling operation;
[0099] Next, long-range timing coding is performed, as shown in the following formula:
[0100] ;
[0101] In the formula, This represents the encoded sequence output by the first BiLSTM layer of the deep learning model in the first stage of any solution process; This represents the trainable weight matrix of the first BiLSTM layer of the first-stage deep learning model, optimized using the improved Grey Wolf algorithm. This represents the bias vector of the first BiLSTM layer of the first-stage deep learning model, optimized using the improved Grey Wolf algorithm.
[0102] Finally, feature focusing and regression are performed, as shown in the following formula:
[0103] ;
[0104] In the formula, This represents the estimated SOH value; and These represent the weight matrix and bias vector of the first fully connected layer of the first-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. This represents the weighted context vector output by the first Self-Attention layer of the deep learning model in the first stage of any solution process; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOH estimate;
[0105] The SOH estimate is used as a prior state variable and fused with the real-time dataset for SOC solution. The fused solution formula is as follows:
[0106] ;
[0107] In the formula, Represents the SOH vector; This represents a vector of length L consisting entirely of 1s.
[0108] Then the SOH vector The real-time data vectors from the SOC-solved real-time dataset are concatenated along the feature dimension to form an enhanced input matrix. This matrix integrates real-time operating information and long-term health status information of lithium batteries, as shown in the following formula:
[0109] ;
[0110] In the formula, These represent time-series vectors constructed from real-time acquired voltage, current, and temperature data, respectively.
[0111] Enhance the input matrix The second stage of the two-stage deep learning model, which is the best performing model, is first fed into the model to extract local detail features, as shown in the following equation:
[0112] ;
[0113] In the formula, This represents the feature map output by the l-th CNN layer of the second-stage deep learning model in any solution process; This represents the feature map output by the (l-1)th CNN layer of the second-stage deep learning model during any solution process; and These represent the weight matrix and bias vector of the second CNN layer of the second-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. This represents a one-dimensional convolution operation; Indicates the activation function;
[0114] Next, short-term dynamic coding is performed, as shown in the following formula:
[0115] ;
[0116] In the formula, This represents the encoded sequence output by the second BiLSTM layer of the second-stage deep learning model during any solution process; This represents the feature map output by the second CNN layer of the second-stage deep learning model in any solution process; This represents the trainable weight matrix of the second BiLSTM layer of the second-stage deep learning model, optimized using the improved Grey Wolf algorithm. This represents the bias vector of the second BiLSTM layer of the second-stage deep learning model, optimized using the improved Grey Wolf algorithm.
[0117] Finally, gated attention regression is performed, as shown in the following equation:
[0118] ;
[0119] In the formula, This represents the estimated SOC value; and These represent the weight matrix and bias vector of the second fully connected layer of the second-stage deep learning model after optimization using the improved Grey Wolf algorithm; This represents the weighted context vector output by the second Self-Attention layer of the second-stage deep learning model during any solution process; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOC estimate;
[0120] Finally, the output is the state pair calculated by the first-stage deep learning model and the second-stage deep learning model. This enables the completion of a two-stage joint state estimation of the lithium battery's state of health (SOH) and state of charge (SOC).
[0121] Another objective of this invention is achieved through the following technical solution:
[0122] A two-stage lithium battery joint state estimation system, used to implement the aforementioned two-stage lithium battery joint state estimation method, includes,
[0123] The data acquisition module is used to acquire historical charge-discharge cycle data and real-time operating data of lithium batteries.
[0124] The data preprocessing module is used to extract and filter features from historical charge-discharge cycle data of lithium batteries to obtain a dataset for solving the state of health (SOH) of lithium batteries; and to obtain a real-time dataset for solving the state of charge (SOC) of lithium batteries based on real-time operating data of lithium batteries.
[0125] A two-stage deep learning model construction module is used to construct a two-stage deep learning model based on the CNN-BiLSTM-SelfAttention deep learning model; the two-stage deep learning model includes a first-stage deep learning model for calculating the SOH estimate and a second-stage deep learning model for calculating the SOC estimate;
[0126] The Grey Wolf Algorithm Improvement Module is used to improve the standard Grey Wolf Algorithm by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes, thereby constructing an improved Grey Wolf Algorithm.
[0127] The optimal two-stage deep learning model determination module is used to perform global automated optimization of the hyperparameters of the two-stage deep learning model using the improved Grey Wolf algorithm. It constructs a fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective, iteratively optimizes the optimal hyperparameter combination of the two-stage deep learning model based on the fitness function, and configures the optimal hyperparameter combination into the two-stage deep learning model to obtain the best-performing two-stage deep learning model.
[0128] The two-stage joint state estimation module is used to input the SOH solution dataset and the real-time SOC solution dataset into the optimal two-stage deep learning model; based on the SOH solution dataset, the SOH estimate is calculated through the first-stage deep learning model in the optimal two-stage deep learning model; then based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated through the second-stage deep learning model in the optimal two-stage deep learning model, thus realizing the two-stage joint state estimation of lithium battery SOH and SOC.
[0129] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0130] 1. This invention constructs a two-stage deep learning model with differentiated internal structures, and performs specialized design for the long-period slow-changing characteristics of SOH and the short-period rapid-changing characteristics of SOC respectively. This effectively overcomes the limitation of model homogeneity in existing joint estimation methods and improves the estimation accuracy from the source.
[0131] 2. This invention improves the standard Grey Wolf algorithm by incorporating nonlinear convergence factors, differential mutation, and arithmetic crossover mechanisms. This significantly enhances the global optimization capability and convergence efficiency, enabling efficient and automated global optimization of hyperparameters in complex models. It solves the problems of difficult manual parameter tuning and susceptibility to local optima. Furthermore, while retaining the advantages of the original standard Grey Wolf algorithm, the improved algorithm outperforms the traditional standard Grey Wolf algorithm and other types of optimization algorithms in solving the lithium battery state estimation problem.
[0132] 3. This invention fully utilizes the coupling relationship between states by first solving the State of Oxygen (SOH) and then fusing and estimating the State of Charge (SOC). Combined with a high-performance model with optimized parameters, it finally achieves high-precision and robust online joint estimation of SOH and SOC of lithium batteries, providing a more reliable state-aware solution for battery management.
[0133] In summary, this invention can significantly improve the state perception accuracy and reliability of battery management systems, providing key technical support for the safe and efficient operation, life prediction, and value assessment of batteries. Attached Figure Description
[0134] Figure 1 This is a flowchart of the method of the present invention.
[0135] Figure 2 This is a flowchart of the improved gray wolf algorithm of the present invention. Detailed Implementation
[0136] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0137] Example 1:
[0138] like Figure 1 , Figure 2 As shown, this embodiment provides a two-stage lithium battery joint state estimation method, including the following steps:
[0139] S1. Obtain historical charge-discharge cycle data of lithium batteries, extract and filter features from the historical charge-discharge cycle data of lithium batteries to obtain the lithium battery state of health (SOH) solution dataset. This step is an offline stage; details are as follows:
[0140] Obtain historical charge-discharge cycle data of lithium batteries;
[0141] An initial health feature set was extracted from historical charge-discharge cycle data of lithium batteries. ,in, This represents the m-th health characteristic; for the n-th cycle, the extracted health characteristics include: capacity, internal resistance, voltage characteristics, and self-discharge rate.
[0142] By calculating the m-th health characteristic With capacity retention absolute value of Pearson correlation coefficient The most effective subset of health characteristics is selected as shown in the following formula:
[0143] ;
[0144] In the formula, Represents the m-th health characteristic With lithium battery capacity retention The absolute value of the calculated Pearson correlation coefficient; Represents the health characteristics in the nth iteration. The value; Indicates health characteristics The mean; This represents the capacity retention rate in the nth cycle. , This represents the discharge capacity during the nth charge-discharge cycle. Indicates the rated capacity of the lithium battery; The value represents the mean capacity retention rate; N represents the total number of cycles, which in this embodiment is [value missing]. ;
[0145] Select The top K health features with the highest values form the health feature sequence matrix that is ultimately input into the first-stage deep learning model. The SOH solution dataset is obtained as shown in the following formula:
[0146] ;
[0147] In the formula, This represents the health feature value in the Kth column and Nth row of the health feature sequence matrix.
[0148] S2. Obtain real-time operating data of the lithium battery. Based on the real-time operating data, obtain the real-time dataset for solving the state of charge (SOC) of the lithium battery. This step is an offline stage; details are as follows:
[0149] During the online operation of the lithium battery, a fixed sampling frequency is used. Synchronous voltage acquisition Current and temperature The signal is defined as follows: k is the discrete-time index, and the sampling frequency is set in this embodiment. ;
[0150] During the data acquisition process, a sliding time window of length L is set. In this embodiment This corresponds to extracting 5 minutes of real-time running data. This refers to the window duration.
[0151] At any current moment when SOC needs to be estimated The data within the window is extracted to construct the input vector, resulting in the real-time dataset for SOC solving, as shown in the following formula:
[0152] ;
[0153] In the formula, , , These represent time-series vectors constructed from real-time acquired voltage, current, and temperature data, respectively. , , They represent Voltage, current, and temperature data are collected in real time.
[0154] S3. Construct a two-stage deep learning model based on the CNN-BiLSTM-SelfAttention deep learning model. This model is constructed based on Convolutional Neural Network (CNN), Bidirectional Long Short-Term Memory (BiLSTM), and Self-Attention. This step is an offline stage. The two-stage deep learning model is used to achieve joint state estimation of the lithium battery's State of Health (SOH) and State of Charge (SOC). It includes a first-stage deep learning model for calculating the SOH estimate and a second-stage deep learning model for calculating the SOC estimate. The two stages share the basic network topology, but the internal components are designed differently to adapt to the long-term slow-changing characteristics of SOH and the short-term fast-changing characteristics of SOC, respectively.
[0155] The first-stage deep learning model is used to extract the lithium battery aging trend from historical health feature sequences. Its structure consists of: a first CNN layer, a first BiLSTM layer, a first Self-Attention layer, and a first fully connected layer. The first-stage deep learning model captures the slow variation pattern of SOH (Solar Health Occurrence) through the long-range memory capabilities of the first CNN layer and the first BiLSTM layer with 7-15 large-size convolutional kernels, achieving accurate calculation of the SOH estimate. Specifically:
[0156] The first CNN layer is used to extract macro trends, and its calculation formula is as follows:
[0157] ;
[0158] In the formula, This represents the feature map output by the first CNN layer; This represents the input health feature sequence matrix, i.e., the SOH solution dataset, with dimensions of . , For sequence length, For feature dimensions; This represents a one-dimensional convolution operation; and These represent the convolutional kernel weight matrix and bias vector of the first CNN layer, respectively. For activation functions; This represents the max pooling operation;
[0159] The purpose of designing the first CNN layer is to effectively filter high-frequency noise in the healthy feature sequence by using large-sized convolutional kernels and pooling operations, and to extract macroscopic, low-pass trend features that characterize the slow decay of battery capacity throughout its life cycle, thus providing robust computational features for subsequent time series modeling.
[0160] The first BiLSTM layer aims to model long-range temporal dependencies by enhancing the memory capacity of its forgetting gate. Its calculation formula is as follows:
[0161] ;
[0162] In the formula, Indicates the Gate of Oblivion; Indicates the input gate; Indicates candidate memory units; Represents a memory unit; Indicates the output gate; This indicates the hidden state at the current time step; The input represents the time step t; This indicates the hidden state of the previous time step; This indicates the cell state at the previous time step; This represents the sigmoid activation function; Represents the hyperbolic tangent activation function; This represents element-wise multiplication; , , , and , , , These represent the trainable weight matrix and bias vector corresponding to each gating unit, respectively.
[0163] The purpose of designing the first BiLSTM layer is to use the forget gate bias vector. Initializing to a large positive value makes the network tend to retain longer historical information in the early stages of training, thereby specifically enhancing its ability to remember and model the ultra-long-term pattern of battery capacity slowly degrading over hundreds or even thousands of cycles; the first BiLSTM layer forms an encoding sequence by concatenating the final hidden states after bidirectional processing. The calculation formula is as follows:
[0164] ;
[0165] In the formula, express , , , Four trainable weight matrices; express , , , Four bias vectors.
[0166] The first Self-Attention layer enables the model to adaptively focus on the most important historical moments for estimating the current SOH state, and its calculation formula is as follows:
[0167] ;
[0168] ;
[0169] ;
[0170] ;
[0171] In the formula, This represents the query vector of the first-stage deep learning model. This represents the key vector of the first-stage deep learning model; This represents the value vector of the first-stage deep learning model. This represents the weighted context vector output by the first Self-Attention layer of the first-stage deep learning model. , , This represents a trainable linear projective weight matrix; Represents the dimension of the key vector, used for scaling the dot product; This represents the row-normalization function;
[0172] The purpose of the first Self-Attention layer is to dynamically evaluate the influence weight of health features at different time steps (i.e., different loop counts) on the current overall SOH, thereby achieving feature focusing and reducing interference from non-critical information.
[0173] The first fully connected layer maps the context vector of the first Self-Attention layer to the final SOH estimate, and the calculation formula is as follows:
[0174] ;
[0175] In the formula, This represents the estimated SOH value; and This represents the weight matrix and bias vector of the first fully connected layer; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOH estimate.
[0176] The structure of the second-stage deep learning model is as follows: a second CNN layer, a second BiLSTM layer, a second Self-Attention layer, and a second fully connected layer. This second-stage deep learning model captures fine-grained local features of real-time temporal data by stacking a second CNN layer with 3-5 small-sized convolutional kernels, and introduces a gating mechanism in the second Self-Attention layer to dynamically focus on key time segments, thereby achieving accurate calculation of the SOC estimate. Specifically, as follows:
[0177] The second CNN layer uses multiple stacked 3-5 size one-dimensional convolutional kernels to extract local fine features of real-time temporal data. The calculation formula for its l-th layer is as follows:
[0178] ;
[0179] In the formula, This represents the feature map output by the l-th CNN layer of the second-stage deep learning model; This represents the feature map output by the (l-1)th CNN layer of the second-stage deep learning model; and Let represent the weight matrix and bias vector of the l-th convolutional layer, respectively; This represents a one-dimensional convolution operation; This represents the activation function; when l=1, , This represents the augmentation input matrix of the second-stage deep learning model;
[0180] The purpose of designing the second CNN layer is to extract local details and instantaneous dynamic features from voltage and current signals layer by layer with high resolution by stacking multiple layers of small convolutional kernels, thereby providing rich contextual information for the instantaneous estimation of SOC.
[0181] The second BiLSTM layer is used to encode short-term temporal dynamics, and its calculation formula is as follows:
[0182] ;
[0183] In the formula, Indicates the Gate of Oblivion; Indicates the input gate; Indicates candidate memory units; Represents a memory unit; Indicates the output gate; This indicates the hidden state at the current time step; The input represents the time step t; This indicates the hidden state of the previous time step; This indicates the cell state at the previous time step; This represents the sigmoid activation function; Represents the hyperbolic tangent activation function; This represents element-wise multiplication; , , , and , , , These represent the trainable weight matrix and bias vector corresponding to each gating unit, respectively.
[0184] The output of the second BiLSTM layer encodes the hidden state sequence of short-term dependencies. Its design purpose is to capture the short-term dynamic relationships and historical dependencies between voltage, current, and temperature over tens to hundreds of sampling points. The calculation formula is as follows:
[0185] ;
[0186] In the formula, express Four trainable weight matrices; express The bias vector corresponding to each gating unit.
[0187] The second Self-Attention layer introduces a gated loop mechanism, the calculation formula of which is:
[0188] ;
[0189] ;
[0190] ;
[0191] ;
[0192] ;
[0193] In the formula, , , , , Indicates trainable parameters; This represents the final hidden state of the second BiLSTM layer at the previous estimation time. This represents the element-wise natural logarithm operation; This represents the query vector for the second-stage deep learning model. This represents the key vector of the second-stage deep learning model; This represents the value vector of the second-stage deep learning model; This represents the gating vector introduced in the second Self-Attention layer of the second-stage deep learning model; Represents the dimension of the key vector, used for scaling the dot product; This represents the weighted context vector output by the second-stage deep learning model from the second Self-Attention layer; This represents the sigmoid activation function; Indicates matrix transpose;
[0194] The purpose of the second Self-Attention layer is to dynamically adjust the attention to each time step of the current input sequence based on the previous operating state of the lithium battery, thereby achieving adaptive focusing and improving the tracking accuracy of the SOC under dynamic conditions.
[0195] The second fully connected layer is used to regress the final SOC estimate. The calculation formula is as follows:
[0196] ;
[0197] In the formula, and These represent the weight matrix and bias vector of the second fully connected layer, respectively. This represents the activation function, which constrains the output value to... Within the range, that is, the limited range of the SOC estimate.
[0198] In this embodiment, in the first stage of solving the problem, the parameters of the first CNN layer are set as follows: 16 one-dimensional convolutional kernels of size 11 are used, with a stride of 1, followed by max pooling with a stride of 2; the first BiLSTM layer has 32 hidden units and the forget gate bias is initialized to 1; the first Self-Attention layer uses single-head attention; and the first fully connected layer adjusts the values obtained from the three parts to a dimension of 1, while using the Sigmoid activation function to output the SOH estimate. In the second stage of solving, firstly, the enhanced input matrix is... The input is fed into the second-stage solution network. In the second CNN layer, two stacked convolutional layers are used, each employing 32 one-dimensional convolutional kernels of size 3; the second BiLSTM layer has 64 hidden units; the second Self-Attention layer introduces a gating mechanism, first checking the hidden state from the previous time step. Generate gate vector The first layer performs gated attention calculation; the second fully connected layer, similar to the first stage, adjusts the values obtained from the three parts into a 1-dimensional output, and uses the Sigmoid activation function to output the SOC estimate. .
[0199] S4. To address the issues of numerous hyperparameters, strong coupling, low efficiency of manual tuning, and difficulty in obtaining the global optimum in two-stage models, a three-pronged improvement is made to the standard Grey Wolf algorithm by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes. This results in an improved Grey Wolf algorithm with stronger global optimization capabilities, called the GWO_NCM algorithm. This step is the offline stage; details are as follows:
[0200] The first improvement is to introduce a nonlinear convergence factor, modifying the update of the nonlinear convergence factor 'a' to a nonlinear strategy based on the cosine function, as shown in the following equation:
[0201] ;
[0202] In the formula, and These represent the initial and final values of the nonlinear convergence factor a, respectively. Indicates the current iteration number; Indicates the maximum number of iterations; This represents a shape adjustment factor greater than 0;
[0203] Regarding the role of improving the nonlinear convergence factor, by improving the nonlinear convergence factor, in the early stage of the algorithm iteration, the value of 'a' decreases slowly, enabling the algorithm to maintain a strong global exploration capability, extensively search the hyperparameter space, and avoid getting trapped in local optima too early; in the later stage of the iteration, the value of 'a' decreases rapidly, prompting the algorithm to quickly switch to fine local development, thereby more intelligently balancing exploration and development as a whole, improving optimization efficiency and the quality of the final solution.
[0204] The second improvement is to add a differential mutation operation, which is performed after each generation of the population update, using probability... Perform differential mutation on non-alpha wolf individuals; for each individual's position vector, generate a mutated individual. As shown in the following formula:
[0205] ;
[0206] In the formula, , , This represents three distinct individuals randomly selected from the current population. This represents a scaling factor between 0 and 2;
[0207] The improvement effect of increasing the difference mutation operation is achieved by introducing a difference vector. , , The random perturbations introduced actively inject new and diverse solution information into the population, effectively helping the algorithm escape from the local optimum region it may be stuck in, enhancing its global search capability, and overcoming the premature convergence problem.
[0208] The third improvement is to add an arithmetic crossover operation for mutated individuals. Compared with the original individual position vector Perform arithmetic crossover to generate test individuals. Its j-th dimension parameter The calculation formula is as follows:
[0209] ;
[0210] In the formula, express Uniformly distributed random numbers within an interval; Indicates the crossover probability; This indicates a randomly selected dimension index; Represents the j-th dimension parameter Under the condition The calculated value obtained below; This indicates that the condition is not met. The j-th dimension parameter The calculated value obtained;
[0211] The improvement of the addition arithmetic crossover operation can selectively integrate the new characteristics brought by the mutated individuals with the historical superior characteristics of the original individuals, promote the exchange and recombination of excellent gene patterns within the population, and thus accelerate the process of the population as a whole converging towards the global optimal region.
[0212] S5. The improved Grey Wolf algorithm is used to perform global automated optimization of the hyperparameters of the two-stage deep learning model. This step is an offline stage. A fitness function is constructed with the joint estimation accuracy of SOH and SOC as the optimization objective. The optimal hyperparameter combination of the two-stage deep learning model is iteratively optimized based on the fitness function. The optimal hyperparameter combination includes the structural parameters and training parameters of each layer in the first-stage and second-stage deep learning models. Then, the optimal hyperparameter combination is configured into the two-stage deep learning model, thus obtaining the best-performing two-stage deep learning model. Specifically, as follows:
[0213] Encode all the hyperparameters to be optimized in the two-stage deep learning model into a D-dimensional decision vector. The hyperparameters include: the number of filters in the first CNN layer of the first-stage deep learning model. Number of filters in the second CNN layer of the second-stage deep learning model The number of hidden units in the first BiLSTM layer of the first-stage deep learning model. Number of hidden units in the second BiLSTM layer of the second-stage deep learning model The number of self-attention heads in the first Self-Attention layer of the first-stage deep learning model. Number of self-attention heads in the second Self-Attention layer of the second-stage deep learning model ; and learning rate and batch size ;
[0214] Construct a fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective. As shown in the following formula:
[0215] ;
[0216] In the formula, and These represent the use of hyperparameters. The root mean square error of the trained model's estimates of SOH and SOC on the validation set; The mean absolute error of the SOC estimate; , , These are non-negative weighting coefficients used to balance various error indicators;
[0217] To perform iterative optimization and determine the optimal solution, first initialize a set containing... A population of individual gray wolves, each representing a random hyperparameter vector. Then, iterative optimization is initiated to obtain the optimal hyperparameter combination of the two-stage deep learning model; the specific steps are as follows:
[0218] Step 1: For each individual Decode and instantiate the corresponding two-stage deep learning model, and train it using the training data;
[0219] Step 2: Evaluate the trained model on an independent validation set and calculate its fitness value. ;
[0220] Step 3: Sort the alpha wolves in the current population according to their fitness values;
[0221] Step 4: Based on the position update formula of the standard gray wolf algorithm, and combined with the nonlinear convergence factor, differential mutation operation and arithmetic crossover operation of the improved gray wolf algorithm, update the position of all individuals, i.e. the hyperparameter vector.
[0222] Step 5: Repeat steps 1 to 4 above until the maximum number of iterations is reached. ;
[0223] The final output is the individual with the smallest fitness value throughout the entire search history. That is, the optimal combination of hyperparameters;
[0224] By configuring the optimal combination of hyperparameters into the two-stage deep learning model, the best-performing two-stage deep learning model can be obtained.
[0225] In this embodiment, the key hyperparameters to be optimized in the first-stage and second-stage deep learning models are encoded into individual vectors, including 10 parameters such as the number of convolutions (16 and 32) in the two-stage CNNs, the number of hidden units (32 and 64) in the two-stage BiLSTMs, the learning rate (0.001), and the batch size (32). The relevant parameters of the improved Grey Wolf algorithm are set, and the population size is set to... The maximum number of iterations is Nonlinear convergence factor parameters , Probability of mutation Crossover probability A fitness function is used on the independent validation dataset. Perform fitness calculation; run the improved gray wolf algorithm, and after 50 iterations, output the optimal hyperparameter combination corresponding to the individual with the lowest fitness, as the optimal configuration of the final model.
[0226] S6. Input the SOH solution dataset and the real-time SOC solution dataset into the best-performing two-stage deep learning model. This step is the online stage. Based on the SOH solution dataset, calculate the SOH estimate using the first-stage deep learning model in the best-performing two-stage deep learning model. Then, based on the SOH estimate and the real-time SOC solution dataset, calculate the SOC estimate using the second-stage deep learning model in the best-performing two-stage deep learning model, thus achieving two-stage joint state estimation of lithium battery SOH and SOC. Specifically, as follows:
[0227] The SOH solution dataset is input into the first stage of the optimal two-stage deep learning model. Macro-feature extraction is performed first, as shown in the following equation:
[0228] ;
[0229] In the formula, This represents the feature map output by the first CNN layer of the deep learning model in the first stage of any solution process; This represents the input health feature sequence matrix, i.e., the SOH solution dataset, with dimensions of . , For sequence length, For feature dimensions; This represents a one-dimensional convolution operation; and These represent the weight matrix and bias vector of the first CNN layer of the first-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. For activation functions; This represents the max pooling operation;
[0230] Next, long-range timing coding is performed, as shown in the following formula:
[0231] ;
[0232] In the formula, This represents the encoded sequence output by the first BiLSTM layer of the deep learning model in the first stage of any solution process; This represents the trainable weight matrix of the first BiLSTM layer of the first-stage deep learning model, optimized using the improved Grey Wolf algorithm. This represents the bias vector of the first BiLSTM layer of the first-stage deep learning model, optimized using the improved Grey Wolf algorithm.
[0233] Finally, feature focusing and regression are performed, as shown in the following formula:
[0234] ;
[0235] In the formula, This represents the estimated SOH value; and These represent the weight matrix and bias vector of the first fully connected layer of the first-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. This represents the weighted context vector output by the first Self-Attention layer of the deep learning model in the first stage of any solution process; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOH estimate;
[0236] The SOH estimate is used as a prior state variable and fused with the real-time dataset for SOC solution. The fused solution formula is as follows:
[0237] ;
[0238] In the formula, Represents the SOH vector; This represents a vector of length L consisting entirely of 1s.
[0239] Then the SOH vector The real-time data vectors from the SOC-solved real-time dataset are concatenated along the feature dimension to form an enhanced input matrix. This matrix integrates real-time operating information and long-term health status information of lithium batteries, as shown in the following formula:
[0240] ;
[0241] In the formula, These represent time-series vectors constructed from real-time acquired voltage, current, and temperature data, respectively.
[0242] Enhance the input matrix The second stage of the two-stage deep learning model, which is the best performing model, is first fed into the model to extract local detail features, as shown in the following equation:
[0243] ;
[0244] In the formula, This represents the feature map output by the l-th CNN layer of the second-stage deep learning model in any solution process; This represents the feature map output by the (l-1)th CNN layer of the second-stage deep learning model during any solution process; and These represent the weight matrix and bias vector of the second CNN layer of the second-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. This represents a one-dimensional convolution operation; Indicates the activation function;
[0245] Next, short-term dynamic coding is performed, as shown in the following formula:
[0246] ;
[0247] In the formula, This represents the encoded sequence output by the second BiLSTM layer of the second-stage deep learning model during any solution process; This represents the feature map output by the second CNN layer of the second-stage deep learning model in any solution process; This represents the trainable weight matrix of the second BiLSTM layer of the second-stage deep learning model, optimized using the improved Grey Wolf algorithm. This represents the bias vector of the second BiLSTM layer of the second-stage deep learning model, optimized using the improved Grey Wolf algorithm.
[0248] Finally, gated attention regression is performed, as shown in the following equation:
[0249] ;
[0250] In the formula, This represents the estimated SOC value; and These represent the weight matrix and bias vector of the second fully connected layer of the second-stage deep learning model after optimization using the improved Grey Wolf algorithm; This represents the weighted context vector output by the second Self-Attention layer of the second-stage deep learning model during any solution process; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOC estimate;
[0251] Finally, the output is the state pair calculated by the first-stage deep learning model and the second-stage deep learning model. This enables the completion of a two-stage joint state estimation of the lithium battery's state of health (SOH) and state of charge (SOC).
[0252] In this embodiment, during the offline phase, the first 400 cycles of historical cyclic data and their corresponding SOH labels, as well as some dynamic working condition data and their corresponding SOC labels, are used to train a two-stage deep learning model according to the determined optimal hyperparameter combination configuration until the model converges on the validation set from the 401st to the 450th cycles and the corresponding dynamic data, and the trained model parameters are solidified.
[0253] In the online phase, the State of Health (SOH) estimate is first calculated. When SOH estimation is required, the latest health feature sequence, such as the four health features from the last 100 iterations, is input into the pre-trained first-stage deep learning model. After forward propagation, the model directly outputs the current SOH value. For example, a State of Health (SOH) estimate of 0.92 indicates that the lithium battery's state of health is 92% of its rated capacity; the State of Charge (SOC) estimate is then input into the enhancement input matrix. The system then moves to the pre-trained second-stage deep learning model. The model utilizes its gated attention mechanism, incorporating the state from the previous time step. The system performs forward calculations and outputs the estimated SOC value for the current moment; for example, 0.65 indicates that the lithium battery has 65% remaining charge. Finally, the system synchronously outputs the state pairs calculated from the first and second stages. This enables a two-stage joint and accurate estimation of the state of health (SOH) and state of charge (SOC) of lithium batteries.
[0254] Example 2:
[0255] This embodiment provides a two-stage lithium battery joint state estimation system to implement the two-stage lithium battery joint state estimation method of Embodiment 1, including:
[0256] The data acquisition module is used to acquire historical charge-discharge cycle data and real-time operating data of lithium batteries.
[0257] The data preprocessing module is used to extract and filter features from historical charge-discharge cycle data of lithium batteries to obtain a dataset for solving the state of health (SOH) of lithium batteries; and to obtain a real-time dataset for solving the state of charge (SOC) of lithium batteries based on real-time operating data of lithium batteries.
[0258] A two-stage deep learning model construction module is used to construct a two-stage deep learning model based on the CNN-BiLSTM-SelfAttention deep learning model; the two-stage deep learning model includes a first-stage deep learning model for calculating the SOH estimate and a second-stage deep learning model for calculating the SOC estimate;
[0259] The Grey Wolf Algorithm Improvement Module is used to improve the standard Grey Wolf Algorithm by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes, thereby constructing an improved Grey Wolf Algorithm.
[0260] The optimal two-stage deep learning model determination module is used to perform global automated optimization of the hyperparameters of the two-stage deep learning model using the improved Grey Wolf algorithm. It constructs a fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective, iteratively optimizes the optimal hyperparameter combination of the two-stage deep learning model based on the fitness function, and configures the optimal hyperparameter combination into the two-stage deep learning model to obtain the best-performing two-stage deep learning model.
[0261] The two-stage joint state estimation module is used to input the SOH solution dataset and the real-time SOC solution dataset into the optimal two-stage deep learning model; based on the SOH solution dataset, the SOH estimate is calculated through the first-stage deep learning model in the optimal two-stage deep learning model; then based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated through the second-stage deep learning model in the optimal two-stage deep learning model, thus realizing the two-stage joint state estimation of lithium battery SOH and SOC.
[0262] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope disclosed in the present invention, based on the technical solution and inventive concept of the present invention, shall fall within the scope of protection of the present invention.
Claims
1. A method for joint state estimation of a two-stage lithium battery, characterized in that, Including steps, Obtain historical charge-discharge cycle data of lithium batteries, extract features from the historical charge-discharge cycle data of lithium batteries, and filter them to obtain the data set for solving the state of health (SOH) of lithium batteries. Obtain real-time operating data of lithium battery, and obtain a real-time dataset for solving the state of charge (SOC) of lithium battery based on the real-time operating data of lithium battery. A two-stage deep learning model is constructed based on the CNN-BiLSTM-SelfAttention deep learning model; the two-stage deep learning model includes a first-stage deep learning model for calculating the SOH estimate and a second-stage deep learning model for calculating the SOC estimate; The standard gray wolf algorithm is improved by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes, thus constructing an improved gray wolf algorithm. An improved gray wolf algorithm is used to perform global automated optimization of hyperparameters of a two-stage deep learning model. A fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective is constructed. The optimal hyperparameter combination of the two-stage deep learning model is solved iteratively based on the fitness function, and the optimal hyperparameter combination is configured into the two-stage deep learning model to obtain the best-performing two-stage deep learning model. The SOH solution dataset and the real-time SOC solution dataset are input into the best-performing two-stage deep learning model. Based on the SOH solution dataset, the SOH estimate is calculated using the first-stage deep learning model in the best-performing two-stage deep learning model. Then, based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated using the second-stage deep learning model in the best-performing two-stage deep learning model, thus realizing the two-stage joint state estimation of lithium battery SOH and SOC.
2. The method for joint state estimation of a two-stage lithium battery according to claim 1, characterized in that, Historical charge-discharge cycle data of lithium batteries were obtained, and features were extracted and filtered from this data to obtain the State of Health (SOH) dataset for lithium batteries, as detailed below: Obtain historical charge-discharge cycle data of lithium batteries; An initial health feature set was extracted from historical charge-discharge cycle data of lithium batteries. ,in, This represents the m-th health characteristic; for the n-th cycle, the extracted health characteristics include: capacity, internal resistance, voltage characteristics, and self-discharge rate. By calculating the m-th health characteristic With capacity retention absolute value of Pearson correlation coefficient The most effective subset of health characteristics is selected as shown in the following formula: ; In the formula, Represents the m-th health characteristic With lithium battery capacity retention The absolute value of the calculated Pearson correlation coefficient; Represents the health characteristics in the nth iteration. The value; Indicates health characteristics The mean; This represents the capacity retention rate in the nth cycle; This represents the mean capacity retention rate; N represents the total number of cycles. Select The top K health features with the highest values form the health feature sequence matrix that is ultimately input into the first-stage deep learning model. The SOH solution dataset is obtained as shown in the following formula: ; In the formula, This represents the health feature value in the Kth column and Nth row of the health feature sequence matrix.
3. The method for joint state estimation of a two-stage lithium battery according to claim 1, characterized in that, Obtain real-time operating data of the lithium battery, and obtain a real-time dataset for solving the state of charge (SOC) of the lithium battery based on the real-time operating data, as follows: During the online operation of the lithium battery, a fixed sampling frequency is used. Synchronous voltage acquisition Current and temperature The signal, where k is the discrete-time index; During the data acquisition process, a sliding time window of length L is set. , The window duration; At any current moment when SOC needs to be estimated The data within the window is extracted to construct the input vector, resulting in the real-time dataset for SOC solving, as shown in the following formula: ; In the formula, , , These represent time-series vectors constructed from real-time acquired voltage, current, and temperature data, respectively. , , They represent Voltage, current, and temperature data are collected in real time.
4. The dual-stage lithium battery joint state estimation method according to claim 1, characterized in that, The first-stage deep learning model is used to extract the lithium battery aging trend from historical health feature sequences. Its structure consists of: a first CNN layer, a first BiLSTM layer, a first Self-Attention layer, and a first fully connected layer. The first-stage deep learning model captures the slow variation pattern of SOH (Solar Health Occurrence) through the long-range memory capabilities of the first CNN layer and the first BiLSTM layer with 7-15 convolutional kernels, thus calculating the SOH estimate. Specifically: The first CNN layer is used to extract macro trends, and its calculation formula is as follows: ; In the formula, This represents the feature map output by the first CNN layer; This represents the input health feature sequence matrix, i.e., the SOH solution dataset, with dimensions of . , For sequence length, For feature dimensions; This represents a one-dimensional convolution operation; and These represent the convolutional kernel weight matrix and bias vector of the first CNN layer, respectively. For activation functions; This represents the max pooling operation; The first BiLSTM layer aims to model long-range temporal dependencies by enhancing the memory capacity of its forgetting gate. Its calculation formula is as follows: ; In the formula, Indicates the Gate of Oblivion; Indicates the input gate; Indicates candidate memory units; Represents a memory unit; Indicates the output gate; This indicates the hidden state at the current time step; The input represents the time step t; This indicates the hidden state of the previous time step; This indicates the cell state at the previous time step; This represents the sigmoid activation function; Represents the hyperbolic tangent activation function; This represents element-wise multiplication; , , , and , , , These represent the trainable weight matrix and bias vector corresponding to each gating unit, respectively. The first BiLSTM layer forms an encoded sequence by concatenating the final hidden states after bidirectional processing. The calculation formula is as follows: ; In the formula, express , , , Four trainable weight matrices; express , , , Four bias vectors; The first Self-Attention layer enables the model to adaptively focus on the most important historical moments for estimating the current SOH state, and its calculation formula is as follows: ; ; ; ; In the formula, This represents the query vector of the first-stage deep learning model. This represents the key vector of the first-stage deep learning model; This represents the value vector of the first-stage deep learning model. This represents the weighted context vector output by the first Self-Attention layer of the first-stage deep learning model. , , This represents a trainable linear projective weight matrix; Represents the dimension of the key vector, used for scaling the dot product; This represents the row-normalization function; The first fully connected layer maps the context vector of the first Self-Attention layer to the final SOH estimate, and the calculation formula is as follows: ; In the formula, This represents the estimated SOH value; and This represents the weight matrix and bias vector of the first fully connected layer; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOH estimate.
5. The dual-stage lithium battery joint state estimation method according to claim 1, characterized in that, The structure of the second-stage deep learning model is as follows: a second CNN layer, a second BiLSTM layer, a second Self-Attention layer, and a second fully connected layer. The second-stage deep learning model uses a second CNN layer with stacked 3-5 size convolutional kernels to capture local fine features of real-time temporal data, and introduces a gating mechanism in the second Self-Attention layer to dynamically focus on key time segments, thereby calculating the SOC estimate. Specifically, as follows: The second CNN layer uses multiple stacked 3-5 size one-dimensional convolutional kernels to extract local fine features of real-time temporal data. The calculation formula for its l-th layer is as follows: ; In the formula, This represents the feature map output by the l-th CNN layer of the second-stage deep learning model; This represents the feature map output by the (l-1)th CNN layer of the second-stage deep learning model; and Let represent the weight matrix and bias vector of the l-th convolutional layer, respectively; This represents a one-dimensional convolution operation; Indicates the activation function; When l=1, , This represents the augmentation input matrix of the second-stage deep learning model; The second BiLSTM layer is used to encode short-term temporal dynamics, and its calculation formula is as follows: ; In the formula, Indicates the Gate of Oblivion; Indicates the input gate; Indicates candidate memory units; Represents a memory unit; Indicates the output gate; This indicates the hidden state at the current time step; The input represents the time step t; This indicates the hidden state of the previous time step; This indicates the cell state at the previous time step; This represents the sigmoid activation function; Represents the hyperbolic tangent activation function; This represents element-wise multiplication; , , , and , , , These represent the trainable weight matrix and bias vector corresponding to each gating unit, respectively. The output of the second BiLSTM layer encodes the hidden state sequence of short-term dependencies. The calculation formula is as follows: ; In the formula, express Four trainable weight matrices; express The bias vector corresponding to each gating unit; The second Self-Attention layer introduces a gated loop mechanism, the calculation formula of which is: ; ; ; ; ; In the formula, , , , , Indicates trainable parameters; This represents the final hidden state of the second BiLSTM layer at the previous estimation time. This represents the element-wise natural logarithm operation; This represents the query vector for the second-stage deep learning model. This represents the key vector of the second-stage deep learning model; This represents the value vector of the second-stage deep learning model; This represents the gating vector introduced in the second Self-Attention layer of the second-stage deep learning model; Represents the dimension of the key vector, used for scaling the dot product; This represents the weighted context vector output by the second-stage deep learning model from the second Self-Attention layer; This represents the sigmoid activation function; Indicates matrix transpose; The second fully connected layer is used to regress the final SOC estimate. The calculation formula is as follows: ; In the formula, and These represent the weight matrix and bias vector of the second fully connected layer, respectively. This represents the activation function, which constrains the output value to... Within the range, that is, the limited range of the SOC estimate.
6. The dual-stage lithium battery joint state estimation method according to claim 1, characterized in that, The standard Grey Wolf algorithm is improved by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes. The improved Grey Wolf algorithm is constructed as follows: Three improvements are made to the standard Grey Wolf algorithm to construct an improved Grey Wolf algorithm; The first improvement is to introduce a nonlinear convergence factor, modifying the update of the nonlinear convergence factor 'a' to a nonlinear strategy based on the cosine function, as shown in the following equation: ; In the formula, and These represent the initial and final values of the nonlinear convergence factor a, respectively. Indicates the current iteration number; Indicates the maximum number of iterations; This represents a shape adjustment factor greater than 0; The second improvement is to add a differential mutation operation, which is performed after each generation of the population update, using probability... Perform differential mutation on non-alpha wolf individuals; for each individual's position vector, generate a mutated individual. As shown in the following formula: ; In the formula, , , This represents three distinct individuals randomly selected from the current population. This represents a scaling factor between 0 and 2; The third improvement is to add an arithmetic crossover operation for mutated individuals. Compared with the original individual position vector Perform arithmetic crossover to generate test individuals. Its j-th dimension parameter The calculation formula is as follows: ; In the formula, express Uniformly distributed random numbers within an interval; Indicates the crossover probability; This indicates a randomly selected dimension index; Represents the j-th dimension parameter Under the condition The calculated value obtained below; This indicates that the condition is not met. The j-th dimension parameter The calculated value obtained.
7. The dual-stage lithium battery joint state estimation method according to claim 1, characterized in that, An improved Grey Wolf algorithm is used to automatically optimize the hyperparameters of a two-stage deep learning model globally. A fitness function is constructed with the joint estimation accuracy of SOH and SOC as the optimization objective. The optimal hyperparameter combination of the two-stage deep learning model is iteratively optimized based on the fitness function, and the optimal hyperparameter combination is configured into the two-stage deep learning model, thus obtaining the two-stage deep learning model with the best performance, as detailed below: Encode all the hyperparameters to be optimized in the two-stage deep learning model into a D-dimensional decision vector. The hyperparameters include: the number of filters in the first CNN layer of the first-stage deep learning model. Number of filters in the second CNN layer of the second-stage deep learning model The number of hidden units in the first BiLSTM layer of the first-stage deep learning model. Number of hidden units in the second BiLSTM layer of the second-stage deep learning model The number of self-attention heads in the first Self-Attention layer of the first-stage deep learning model. Number of self-attention heads in the second Self-Attention layer of the second-stage deep learning model ; and learning rate and batch size ; Construct a fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective. As shown in the following formula: ; In the formula, and These represent the use of hyperparameters. The root mean square error of the trained model's estimates of SOH and SOC on the validation set; The mean absolute error of the SOC estimate; , , These are non-negative weighting coefficients used to balance various error indicators; To perform iterative optimization and determine the optimal solution, first initialize a set containing... A population of individual gray wolves, each representing a random hyperparameter vector. Then, iterative optimization is initiated to obtain the optimal hyperparameter combination of the two-stage deep learning model; By configuring the optimal combination of hyperparameters into the two-stage deep learning model, the best-performing two-stage deep learning model can be obtained.
8. The method for joint state estimation of a two-stage lithium battery according to claim 7, characterized in that, Initiate iterative optimization to obtain the optimal hyperparameter combination of the two-stage deep learning model. The specific steps are as follows: For each individual Decode and instantiate the corresponding two-stage deep learning model, and train it using the training data; Evaluate the trained model on an independent validation set and calculate its fitness value. ; The alpha wolf in the current population is determined by sorting the alpha wolves according to their fitness values. Based on the position update formula of the standard gray wolf algorithm, and combined with the nonlinear convergence factor, differential mutation operation and arithmetic crossover operation of the improved gray wolf algorithm, the position of all individuals, i.e. the hyperparameter vector, is updated. Repeat the above steps until the maximum number of iterations is reached. ; The final output is the individual with the smallest fitness value throughout the entire search history. That is, the optimal combination of hyperparameters.
9. The method for joint state estimation of a two-stage lithium battery according to claim 1, characterized in that, The SOH (State of Health) solution dataset and the real-time SOC (State of Charge) solution dataset are input into the best-performing two-stage deep learning model. Based on the SOH solution dataset, the SOH estimate is calculated using the first-stage deep learning model in the best-performing two-stage deep learning model. Then, based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated using the second-stage deep learning model in the best-performing two-stage deep learning model. This achieves two-stage joint state estimation of lithium battery SOH and SOC, as detailed below: The SOH solution dataset is input into the first stage of the optimal two-stage deep learning model. Macro-feature extraction is performed first, as shown in the following equation: ; In the formula, This represents the feature map output by the first CNN layer of the deep learning model in the first stage of any solution process; This represents the input health feature sequence matrix, i.e., the SOH solution dataset, with dimensions of . , For sequence length, For feature dimensions; This represents a one-dimensional convolution operation; and These represent the weight matrix and bias vector of the first CNN layer of the first-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. For activation functions; This represents the max pooling operation; Next, long-range timing coding is performed, as shown in the following formula: ; In the formula, This represents the encoded sequence output by the first BiLSTM layer of the deep learning model in the first stage of any solution process; This represents the trainable weight matrix of the first BiLSTM layer of the first-stage deep learning model, optimized using the improved Grey Wolf algorithm. This represents the bias vector of the first BiLSTM layer of the first-stage deep learning model, optimized using the improved Grey Wolf algorithm. Finally, feature focusing and regression are performed, as shown in the following formula: ; In the formula, This represents the estimated SOH value; and These represent the weight matrix and bias vector of the first fully connected layer of the first-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. This represents the weighted context vector output by the first Self-Attention layer of the deep learning model in the first stage of any solution process; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOH estimate; The SOH estimate is used as a prior state variable and fused with the real-time dataset for SOC solution. The fused solution formula is as follows: ; In the formula, Represents the SOH vector; This represents a vector of length L consisting entirely of 1s. Then the SOH vector The real-time data vectors from the SOC-solved real-time dataset are concatenated along the feature dimension to form an enhanced input matrix. This matrix integrates real-time operating information and long-term health status information of lithium batteries, as shown in the following formula: ; In the formula, These represent time-series vectors constructed from real-time acquired voltage, current, and temperature data, respectively. Enhance the input matrix The second stage of the two-stage deep learning model, which is the best performing model, is first fed into the model to extract local detail features, as shown in the following equation: ; In the formula, This represents the feature map output by the l-th CNN layer of the second-stage deep learning model in any solution process; This represents the feature map output by the (l-1)th CNN layer of the second-stage deep learning model during any solution process; and These represent the weight matrix and bias vector of the second CNN layer of the second-stage deep learning model after optimization using the improved Grey Wolf algorithm, respectively. This represents a one-dimensional convolution operation; Indicates the activation function; Next, short-term dynamic coding is performed, as shown in the following formula: ; In the formula, This represents the encoded sequence output by the second BiLSTM layer of the second-stage deep learning model during any solution process; This represents the feature map output by the second CNN layer of the second-stage deep learning model in any solution process; This represents the trainable weight matrix of the second BiLSTM layer of the second-stage deep learning model, optimized using the improved Grey Wolf algorithm. This represents the bias vector of the second BiLSTM layer of the second-stage deep learning model, optimized using the improved Grey Wolf algorithm. Finally, gated attention regression is performed, as shown in the following equation: ; In the formula, This represents the estimated SOC value; and These represent the weight matrix and bias vector of the second fully connected layer of the second-stage deep learning model after optimization using the improved Grey Wolf algorithm; This represents the weighted context vector output by the second Self-Attention layer of the second-stage deep learning model during any solution process; As an activation function, constrain the output value to Within the range, that is, the limited range of the SOC estimate; Finally, the output is the state pair calculated by the first-stage deep learning model and the second-stage deep learning model. This enables the completion of a two-stage joint state estimation of the lithium battery's state of health (SOH) and state of charge (SOC).
10. A two-stage lithium battery joint state estimation system, characterized in that, A method for implementing a two-stage lithium battery joint state estimation method according to any one of claims 1 to 9 includes, The data acquisition module is used to acquire historical charge-discharge cycle data and real-time operating data of lithium batteries. The data preprocessing module is used to extract and filter features from historical charge-discharge cycle data of lithium batteries to obtain the lithium battery state of health (SOH) solution dataset. And obtain the real-time dataset for solving the state of charge (SOC) of the lithium battery based on the real-time operating data of the lithium battery; A two-stage deep learning model construction module is used to construct a two-stage deep learning model based on the CNN-BiLSTM-SelfAttention deep learning model; the two-stage deep learning model includes a first-stage deep learning model for calculating the SOH estimate and a second-stage deep learning model for calculating the SOC estimate; The Grey Wolf Algorithm Improvement Module is used to improve the standard Grey Wolf Algorithm by introducing a nonlinear convergence factor to balance the algorithm's exploration and development capabilities, a differential mutation operation to increase population diversity, and an arithmetic crossover operation to accelerate the fusion of superior genes, thereby constructing an improved Grey Wolf Algorithm. The optimal two-stage deep learning model determination module is used to perform global automated optimization of the hyperparameters of the two-stage deep learning model using the improved Grey Wolf algorithm. It constructs a fitness function with the joint estimation accuracy of SOH and SOC as the optimization objective, iteratively optimizes the optimal hyperparameter combination of the two-stage deep learning model based on the fitness function, and configures the optimal hyperparameter combination into the two-stage deep learning model to obtain the best-performing two-stage deep learning model. The two-stage joint state estimation module is used to input the SOH solution dataset and the real-time SOC solution dataset into the optimal two-stage deep learning model; based on the SOH solution dataset, the SOH estimate is calculated through the first-stage deep learning model in the optimal two-stage deep learning model; then based on the SOH estimate and the real-time SOC solution dataset, the SOC estimate is calculated through the second-stage deep learning model in the optimal two-stage deep learning model, thus realizing the two-stage joint state estimation of lithium battery SOH and SOC.