A lithium ion battery state of charge prediction method based on EKF combined CNN-BiLSTM-attention
By combining EKF with CNN-BiLSTM-Attention, a lithium-ion battery state-of-charge prediction model is constructed, which solves the problems of insufficient accuracy and poor robustness of lithium-ion batteries under complex operating conditions. It achieves adaptation to the strong nonlinearity and time-varying characteristics of the battery and avoids prediction drift, thereby improving prediction accuracy and interpretability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2026-02-11
- Publication Date
- 2026-05-29
AI Technical Summary
Existing methods for estimating the state of charge of lithium-ion batteries are insufficient in accuracy and robustness under complex operating conditions. They cannot adapt to the strong nonlinearity and time-varying characteristics of batteries, lack physical prior constraints, are prone to prediction drift, and are sensitive to noise and sensor errors.
We employ a method based on EKF combined with CNN-BiLSTM-Attention. By constructing a second-order Thevenin equivalent circuit model, we identify key parameters online using recursive least squares method, extract features by combining extended Kalman filter and convolutional neural network, and introduce attention mechanism and bidirectional long short-term memory network to capture temporal dynamic dependence, thereby achieving accurate prediction of battery state of charge.
It effectively reduces the impact of data noise and sensor errors, improves the accuracy and robustness of battery state of charge prediction, adapts to the strong nonlinearity and time-varying characteristics of batteries, avoids prediction drift in multiple operating conditions and boundary intervals, and enhances the interpretability of the model.
Smart Images

Figure CN122109842A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrochemical energy storage, specifically to a lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention. This method is used to solve the technical problems of insufficient accuracy and poor robustness of traditional lithium-ion battery state-of-charge estimation methods under complex operating conditions in energy storage power stations, electric vehicles, and other energy storage and supply scenarios that rely on lithium-ion batteries. Background Technology
[0002] Currently, the main methods for estimating the state of charge of lithium batteries include the ampere-hour integral method, Kalman filtering, and machine learning-based models.
[0003] The paper "Research on SOC Estimation of Lithium-ion Batteries Based on Extended Kalman Filter" (Lu Yicheng et al.) constructs a simulation model of a second-order RC equivalent circuit of a lithium-ion battery to improve the accuracy and stability of SOC estimation. The accuracy of the model is verified by an offline parameter identification method based on a custom exponential fitting. Subsequently, an extended Kalman filter (EKF) is used to estimate the SOC of the battery. However, the parameter identification of the second-order RC equivalent circuit model of the lithium-ion battery mainly adopts an offline method, which cannot update the parameters in real time. It still has certain limitations when dealing with the strong nonlinearity and time-varying characteristics of the battery. When the battery is under dynamic conditions such as aging and temperature fluctuations, the pre-fixed offline parameters are difficult to match the actual characteristics of the battery, which can easily lead to a decrease in model accuracy. Furthermore, it is sensitive to input data noise and sensor errors, which in turn affects the accuracy of SOC estimation.
[0004] The paper "Research on Joint Estimation of SOC and SOH of Lithium-ion Batteries Based on Data-Driven Approach" (by Wang Zhaokang) first analyzes the charge-discharge characteristics, aging characteristics, and influencing factors of lithium-ion batteries based on NASA and CALCE datasets. Then, it extracts five characteristic parameters of SOH (ICA curve peak value, constant current charging time, constant current charging time percentage, constant voltage rise time, and temperature). After removing outliers using Hampel filtering and performing dimensionality reduction preprocessing using Principal Component Analysis (PCA), an SOH estimation model combining Empirical Mode Decomposition (EMD) and Convolutional Gated Recurrent Unit (CNN-GRU) is constructed, with a Bidirectional Gated Recurrent Unit (BIGRU) selected as the basic neural network for SOC estimation. Subsequently, a joint SOC and SOH estimation model is established, keeping the root mean square error (RMSE) of SOC estimation within 0.02. However, this purely data-driven model lacks physical prior constraints, making it prone to prediction drift under various operating conditions and boundary SOC intervals, and its interpretability is insufficient.
[0005] The paper "Lithium-ion SOC Estimation Based on CNN-LSTM" (Liu Juan et al.) proposes a CNN-LSTM joint network method for SOC estimation. This method first extracts spatial correlation features of parameters such as voltage, current, and temperature using a one-dimensional CNN, then inputs these features into an LSTM network (with 300 neurons, using the Adam optimization algorithm, a learning rate of 0.025, and a batch size of 10) to capture the temporal relationships of the data, fully integrating the spatial and temporal characteristics of the data. In a large dataset of 30,000 data points, the average error of the CNN-LSTM joint network for SOC estimation is only 0.41%, and the prediction time for a single data point is less than 0.5ms, effectively improving the accuracy and stability of SOC estimation. However, this study does not fully consider the intrinsic correlations of ohmic resistance, electrochemical polarization impedance, and concentration polarization impedance, which characterize the essential electrical features of the battery.
[0006] The authorized patent CN114487844B, entitled "A Lithium-ion Battery SOC Estimation Method Based on Battery Capacity," proposes a lithium-ion battery SOC estimation method based on battery capacity. First, a brand-new lithium battery is fully charged under varying temperature conditions. Then, through constant current discharge, DST condition, FUDS condition, and US06 condition discharge experiments, the battery terminal voltage, current, temperature, and load voltage and current are repeatedly measured as the SOC decreases from 1 to 0. Next, the measured data is preprocessed to construct training and testing datasets. Finally, a 2DCNN is used to train and test the new dataset containing battery terminal voltage, current, temperature, discharge time, and estimated battery capacity, achieving real-time SOC estimation. However, this research only constructs the dataset based on experimental data from brand-new lithium batteries and does not consider time-varying characteristics such as capacity decay and internal resistance changes during battery aging, resulting in limited adaptability and estimation accuracy of the model throughout the battery's entire lifespan.
[0007] In summary, traditional battery state of charge prediction methods still have the following shortcomings: 1. There are still some limitations in dealing with the strong nonlinearity and time-varying characteristics of batteries: After battery operating conditions fluctuate or batteries are used for a long time, the offline parameter identification model cannot adapt to parameter changes, and the battery state of charge estimation error increases significantly.
[0008] 2. Lack of physical prior constraints makes it prone to prediction drift under various operating conditions and in the boundary range of battery state of charge, and its interpretability is insufficient: The pure data-driven model does not incorporate physical prior constraints on battery operation. When the operating conditions exceed the range of training data and the distribution of data features changes, the model will experience prediction drift due to the lack of physical rules to "correct" errors. In the boundary range of battery state of charge, the drift is more obvious due to the small sample size and drastic changes in characteristics, and the predicted value of battery state of charge may even exceed the reasonable range.
[0009] 3. Insufficient consideration of the intrinsic relationships between ohmic resistance, electrochemical polarization impedance, and concentration polarization impedance, which characterize the essential electrical features of a battery: The terminal voltage of a lithium battery is jointly determined by the open-circuit voltage, the voltage drop across the ohmic resistance, and the voltage drop across the polarization impedance. Furthermore, ohmic resistance, electrochemical polarization impedance, and concentration polarization impedance are not isolated; their intrinsic relationships directly affect the mapping relationship between the terminal voltage and the battery's state of charge. Existing methods often use a single type of impedance or ignore its dynamic relationships, resulting in models that cannot accurately fit the actual changes in terminal voltage.
[0010] 4. Sensitive to input data noise and sensor errors: This limitation exists in both traditional Kalman filtering and unoptimized pure data-driven models. The input data (current, voltage, temperature) for battery state-of-charge estimation are easily affected by environmental electromagnetic interference and transmission losses, and sensors have inherent accuracy limitations or aging biases. Pure data-driven models treat noise and errors as true features during learning, and the errors are amplified as the data accumulates. Summary of the Invention
[0011] The technical problem to be solved by this invention is the deficiency in the prior art. This invention provides a lithium-ion battery state of charge prediction method based on EKF combined with CNN-BiLSTM-Attention, which can adapt to the strong nonlinearity and time-varying characteristics of batteries. It integrates physical prior constraints and relies on the equivalent circuit model to reflect the essential electrical characteristics of the battery to accurately fit the terminal voltage change, effectively reducing the influence of data noise and sensor error, and achieving accurate prediction of lithium-ion battery state of charge. By constructing a second-order Thevenin equivalent circuit model, key parameters are identified online using the recursive least squares method with genetic factors, and then a pseudo-battery state of charge is obtained through EKF. After normalizing the current, voltage, temperature and pseudo-battery state of charge data, they are input into the convolutional neural network (CNN) layer to extract features. An attention mechanism layer is introduced to weight key features, which are then fed into the bidirectional long short-term memory (BiLSTM) network layer to capture temporal dynamic dependencies. Finally, the battery state of charge (SOC) estimate is obtained through ReLU nonlinear transformation in the fully connected layer.
[0012] The technical solution of the present invention is as follows: A method for predicting the state of charge (SOC) of lithium-ion batteries based on EKF combined with CNN-BiLSTM-Attention is disclosed for accurately estimating the SOC of lithium-ion batteries in energy storage systems. The system involved in the prediction method includes an equivalent circuit model, an Extended Kalman Filter (EKF) module, and a prediction model. The prediction model includes an input layer, a Convolutional Neural Network (CNN) layer, an Attention layer, a Bidirectional Long Short-Term Memory (BiLSTM) network layer, and a prediction output module. The method, assuming the lithium-ion battery is considered as a battery, includes the following steps: Step 1: Construct the equivalent circuit model of the battery and obtain five key parameters of the battery, namely: internal resistance in ohms. R 0 、 Electrochemical polarization resistance R 1 、 Electrochemically polarized capacitor C 1 、 Concentration polarization resistance R 2 and concentration polarization capacitance C 2 ; Step 2: By collecting observable data during battery operation, the recursive least squares method with forgetting factor is used to identify the five key parameters of the battery in the battery equivalent circuit model online. Step 3: Based on the parameters identified online in Step 2, obtain the pseudo battery state of charge estimate EKF-SOC through the Extended Kalman Filter (EKF) module; Step 4: Sample battery current, battery voltage, and battery temperature, and normalize and flatten the battery current, battery voltage, battery temperature, and the pseudo battery state of charge estimate EKF-SOC obtained in Step 3 to obtain the processed data. Step 5: Input the processed data into the convolutional neural network (CNN) layer through the input layer to extract the complex feature vector F1 of spatiotemporal intersection; Step 6: Through the Attention mechanism layer, calculate the correlation between the complex feature vector F1 and the battery state of charge, normalize the attention score using the softmax function, assign higher weights to key features, and obtain the weighted feature vector F2. Step 7: Input the weighted feature vector F2 into the Bidirectional Long Short-Term Memory (BiLSTM) network layer to model the forward and backward time series respectively. Combine historical and future information to capture the dynamic dependency between the current moment and different time points, and obtain the BiLSTM feature vector F3. Step 8: Input the BiLSTM feature vector F3 into the prediction output module. The prediction output module includes a fully connected layer and an output layer. The ReLU activation function is selected to achieve global fusion and nonlinear mapping of time-series features, and outputs the predicted battery state of charge. .
[0013] Preferably, the topology of the equivalent circuit model described in step 1 includes two parallel RC branches, an ohmic internal resistance R0, and the open-circuit voltage of the battery. U ocv One of the parallel RC branches is the electrochemical polarization resistor. R1 、 Electrochemically polarized capacitor C 1 The circuit is configured in parallel and denoted as the electrochemical polarization branch. Another parallel RC branch is the concentration polarization resistor. R 2 and concentration polarization capacitance C 2 The circuit is constructed in parallel and denoted as the concentration polarization branch; the concentration polarization branch is connected in series with the electrochemical polarization branch, the ohmic internal resistance R0 of the battery, and the open-circuit voltage. U ocv A complete circuit is formed; its expression is:
[0014]
[0015] in, U 1 represents the electrochemical polarization capacitor of the battery. C The voltage across 1. U 2 is the concentration polarization capacitor of the battery. C 2. Voltage across the terminals; i This refers to the charging and discharging current. For time.
[0016] Preferably, the expression for online parameter identification in step 2 is:
[0017] in, These are the first and second time constants of the battery equivalent circuit model, respectively. T The sampling period; These are the first and second denominator coefficients of the discrete transfer function, respectively. These are the first, second, and third numerator coefficients of the discrete transfer function, respectively. 。
[0018] Preferably, step 3 is performed as follows.
[0019] First, denoted as time k, the state-space equation and observation equation for the pseudo-battery state-of-charge estimate EKF-SOC are established in the extended Kalman filter (EKF) module, and their expressions are as follows:
[0020]
[0021] in, For the first The battery's terminal voltage at any given time; The first Battery state of charge at time 1 and the 2nd time The state of charge of the battery at any given time; For the first Open-circuit voltage at any given moment; The first Current at time and the first Current at any given moment; , They are respectively The electrochemical polarization voltage and concentration polarization voltage of the battery at any given time; , They are respectively The electrochemical polarization voltage and concentration polarization voltage of the battery at any given time; The sampling period of the system; C N Battery capacity; for Noise during the constant state of battery charge process; for Noise during the electrochemical polarization capacitor voltage process; for Noise during the concentration polarization capacitor voltage process; To measure the noise vector; Then, the state-space equation and observation equation of the pseudo-battery state-of-charge estimate EKF-SOC are recursively iterated using the Extended Kalman Filter (EKF) algorithm. The steps of the Extended Kalman Filter (EKF) algorithm are as follows: Step 3.1, in k At time =0, for the initial state variable Initial error covariance matrix Process error covariance matrix and measurement noise covariance matrix Perform initialization; Step 3.2, Prediction k Prior estimate of battery state of charge at time +1 and prior error covariance matrix : predict k The expression for the prior estimate of the battery's state of charge at time +1 is as follows:
[0022] in, for k Prior estimate of the battery state of charge at time +1; for k The posterior estimate of the battery's state of charge at time t; A kand B k The coefficient matrices for the first and second state equations are shown. i k for k Current at any given moment; predict k The expression for the error covariance matrix at time +1 is as follows:
[0023] in, P k for k The error covariance matrix at time t; for k The prior error covariance matrix at time +1; The process noise covariance matrix; Step 3.3, calculate the Kalman gain matrix. K k+1 Its expression is as follows:
[0024] in: for k The prior error covariance matrix at time +1; C k+1 The observation matrix; K k+1 The Kalman gain matrix; To measure the noise covariance matrix; Step 3.4, according to k Prior estimate of battery state of charge at time +1 Make corrections to obtain k Posterior estimate of battery state of charge at time +1 Its expression is as follows:
[0025] in: for k Posterior estimate of the battery state of charge at time +1; for k Prior estimate of the battery state of charge at time +1; This is the observation output vector at time k+1; To output the estimated value of the observation vector; K k+1 The Kalman gain matrix; Step 3.5, update the error covariance matrix, the expression of which is as follows:
[0026] in: for k The posterior error covariance matrix at time +1; I It is a third-order identity matrix; K k+1 The Kalman gain matrix; C k+1 The observation matrix; for k The prior error covariance matrix at time +1.
[0027] Step 3.6: Determine if the set number of iterations for the recursive loop has not been reached. If the set number of iterations for the recursive loop has not been reached, then... k Posterior estimate of battery state of charge at time +1 The previous time step's posterior state estimate of the battery charge state is used as the prior state estimate of the battery charge state required to predict the next time step; if the set number of recursive iterations is reached, this... k Posterior estimate of battery state of charge at time +1 The output is the pseudo-battery state of charge estimate EKF-SOC.
[0028] Preferably, the normalization process in step 4 includes unifying the numerical scale of battery current, battery voltage, battery temperature and pseudo-battery state of charge estimate EKF-SOC of different dimensions, and constructing a time series feature matrix for convolution operation by data tiling, so as to enhance the prediction model's ability to jointly model multi-source time series data and improve the stability of the training and prediction process.
[0029] Preferably, the convolutional neural network (CNN) layer in step 5 consists of a sequence of folded layers and two convolutional kernels with a size of [missing information]. The convolutional layer consists of two layers. First, the input sequence data is converted into a four-dimensional tensor for convolution calculation through a sequence folding layer. Then, two convolutional kernels with sizes of [size missing] are input sequentially. The processing is performed using convolutional layers, where the first convolutional layer contains 32 layers. The convolutional kernel outputs a 32-channel feature tensor T1, and the second convolutional layer contains 64 kernels. The convolution kernel outputs a 64-channel feature tensor T2; then, this 64-channel feature tensor T2 is used as the convolution output feature to obtain the complex feature vector F1.
[0030] Preferably, the attention mechanism layer in step 6 consists of a global average pooling layer, two fully connected network layers, a softmax normalization layer, and a channel-by-channel multiplication operation. The complex feature vector F1 obtained in step 5 is subjected to global average pooling to obtain channel statistics corresponding to each channel. The channel statistics are then sequentially input into the two fully connected network layers to calculate the attention weight coefficients corresponding to the number of channels. The attention weight coefficients are then normalized using the softmax function. Finally, the normalized weight coefficients are multiplied with the complex feature vector F1 channel by channel according to the channel correspondence to obtain the weighted feature vector F2.
[0031] Preferably, the BiLSTM bidirectional long short-term memory network layer in step 7 consists of a forward long short-term memory sub-network and a backward long short-term memory sub-network. The weighted feature vector F2 is input into the forward long short-term memory sub-network in chronological order and outputs a forward hidden state sequence. At the same time, the weighted feature vector F2 is input into the backward long short-term memory sub-network in reverse chronological order and outputs a backward hidden state sequence. Then, the forward hidden state and the backward hidden state corresponding to the same time step are concatenated and processed to obtain the BiLSTM feature vector F3.
[0032] Preferably, the fully connected layer in step 8 integrates the global temporal information of the BiLSTM by linearly weighting and combining the feature components of the BiLSTM feature vector F3, thus obtaining a linear mapping result. Its expression is:
[0033] in, These are the weight parameters of the fully connected layer. F3 is the bias parameter; F3 is the BiLSTM feature vector. Then the linear mapping result The input is a modified linear unit (ReLU) activation function, which performs a nonlinear transformation on the intermediate mapping result. When it is positive, it retains its original value; when... When the value is negative, its output is set to zero, thus obtaining the predicted value of battery state of charge. And output the predicted value of battery state of charge through the output layer. .
[0034] Compared with the prior art, the beneficial effects of the present invention include: 1. By fully considering the inherent electrical characteristics of the battery, this invention avoids prediction drift in multiple operating conditions and boundary battery state of charge intervals, thus improving model interpretability. Based on a second-order Thevenin equivalent circuit model, this invention accurately reflects the intrinsic relationship between the battery's open-circuit voltage, ohmic internal resistance, polarization impedance, and other inherent electrical characteristics with terminal voltage and battery state of charge.
[0035] 2. Adapting to the strong nonlinearity and time-varying characteristics of batteries, improving estimation accuracy under complex operating conditions. This invention employs a recursive least squares method with genetic factors to estimate the ohmic internal resistance of the battery in a second-order Thevenin equivalent circuit model. R 0 、 Electrochemical polarization resistance R 1 、 Concentration polarization resistance of the battery R 2 、 Electrochemical polarization capacitance of a battery C 1 、 Concentration polarization capacitor of battery C 2 Key parameters are identified online, and the battery parameters can be tracked in real time as they change with operating conditions and aging, effectively reducing estimation errors caused by parameter mismatch. Even under complex operating conditions, the battery state of charge estimation accuracy can still be maintained.
[0036] 3. Efficiently integrates spatiotemporal features and dynamic temporal dependencies to improve the accuracy of battery state of charge (SOC) prediction. This invention extracts features from the processed current, voltage, temperature, and pseudo-battery SOC estimates (EKF-SOC) using a convolutional neural network (CNN) layer, capturing complex multi-dimensional spatiotemporal features. It then utilizes a bidirectional long short-term memory (BiLSTM) network layer to model forward and backward time series data, combining historical and future information to capture dynamic dependencies, further improving the accuracy of battery SOC prediction.
[0037] 4. Effectively reduces the impact of data noise and sensor errors. This invention suppresses measurement noise during the initial battery state-of-charge estimation stage by using extended Kalman filtering. When extracting features using a convolutional neural network (CNN), the convolutional and pooling layers further filter out noise interference in the data. Combined with the attention mechanism layer, higher weights are assigned to key effective features, reducing the impact of noisy features on the model. Attached Figure Description
[0038] Figure 1 This is the equivalent circuit model diagram of the present invention.
[0039] Figure 2 This is a structural diagram of the prediction model of the present invention.
[0040] Figure 3 This is a diagram illustrating the algorithm steps of the Extended Kalman Filter (EKF) of this invention.
[0041] Figure 4 This is a flowchart of the method of the present invention. Detailed Implementation
[0042] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0043] Figure 4 This is a flowchart of the method of the present invention. Figure 4 As can be seen, this invention provides a method for predicting the state of charge (SOC) of lithium-ion batteries based on EKF combined with CNN-BiLSTM-Attention, for accurately estimating the SOC of lithium-ion batteries in energy storage systems. This prediction method first constructs a second-order Thevenin equivalent circuit model based on the physical characteristics of lithium-ion batteries, and identifies key parameters online using recursive least squares with genetic factors. An extended Kalman filter (EKF) is used to initially estimate the battery's SOC, yielding a pseudo-battery SOC estimate, EKF-SOC. Then, a complex feature vector F1 is extracted through a convolutional neural network (CNN) layer. An attention mechanism layer is then introduced, and the weighted feature vector F2, after being weighted by the attention mechanism layer, is fed into a bidirectional long short-term memory (BiLSTM) network layer to obtain a BiLSTM feature vector F3. Finally, a fully connected layer globally integrates the BiLSTM feature vector F3 and performs a nonlinear transformation using the ReLU activation function to obtain the final predicted SOC. pred .
[0044] The prediction method involves a system comprising an equivalent circuit model, an extended Kalman filter (EKF) module, and a prediction model. The prediction model includes an input layer, a convolutional neural network (CNN) layer, an attention mechanism layer, a bidirectional long short-term memory (BiLSTM) network layer, and a prediction output module. Taking a lithium-ion battery as an example, the prediction method includes the following steps: Step 1: Construct the equivalent circuit model of the battery and obtain five key parameters of the battery, namely: internal resistance in ohms. R 0 、 Electrochemical polarization resistance R 1 、 Electrochemically polarized capacitor C 1 、 Concentration polarization resistance R 2 and concentration polarization capacitance C 2。
[0045] In this embodiment, the topology of the equivalent circuit model includes two parallel RC branches, an ohmic internal resistance R0, and the open-circuit voltage of the battery. U ocv One of the parallel RC branches is the electrochemical polarization resistor. R 1 、 Electrochemically polarized capacitor C 1 The circuit is configured in parallel and denoted as the electrochemical polarization branch. Another parallel RC branch is the concentration polarization resistor. R 2 and concentration polarization capacitance C 2 The circuit is constructed in parallel and denoted as the concentration polarization branch; the concentration polarization branch is connected in series with the electrochemical polarization branch, the ohmic internal resistance R0 of the battery, and the open-circuit voltage. U ocv A complete circuit is formed; its expression is:
[0046]
[0047] in, U 1 represents the electrochemical polarization capacitor of the battery. C The voltage across 1. U 2 is the concentration polarization capacitor of the battery. C 2. Voltage across the terminals; i This refers to the charging and discharging current. For time.
[0048] Figure 1 This is the equivalent circuit model diagram of the present invention.
[0049] Step 2: By collecting observable data during battery operation, the recursive least squares method with forgetting factor is used to identify the five key parameters of the battery in the battery equivalent circuit model online. In this embodiment, the expression for online parameter identification is:
[0050] in, These are the first and second time constants of the battery equivalent circuit model, respectively. T The sampling period; These are the first and second denominator coefficients of the discrete transfer function, respectively. These are the first, second, and third numerator coefficients of the discrete transfer function, respectively. 。
[0051] In this embodiment, the discrete transfer function The expression is:
[0052] Where z is the complex variable of the Z-transform; T is the sampling period, the time interval used to discretize the continuous system.
[0053] The recursive least squares method with a forgetting factor updates historical sampling data by introducing a forgetting factor, thereby increasing the ohmic internal resistance of the battery in the battery equivalent circuit model. R 0. Electrochemical polarization resistance of the battery R 1. The identification results of the battery's concentration polarization resistance R2, electrochemical polarization capacitance C1, and concentration polarization capacitance C2 can be adjusted in real time according to changes in battery operating conditions and aging process, thereby providing dynamically updated model parameters for the extended Kalman filter (EKF) and improving the accuracy and stability of the pseudo-battery state of charge estimation (EKF-SOC) under complex operating conditions.
[0054] Step 3: Based on the parameters identified online in Step 2, obtain the pseudo-battery state of charge estimate EKF-SOC through the Extended Kalman Filter (EKF) module.
[0055] Figure 3 This is a flowchart illustrating the algorithm steps of the Extended Kalman Filter (EKF) of this invention. Figure 3 As can be seen, in this embodiment, step 3 is implemented as follows.
[0056] First, denoted as time k, the state-space equation and observation equation for the pseudo-battery state-of-charge estimate EKF-SOC are established in the extended Kalman filter (EKF) module, and their expressions are as follows:
[0057]
[0058] in: For the first The battery's terminal voltage at any given time; The first Battery state of charge at time 1 and the 2nd time The state of charge of the battery at any given time; For the first Open-circuit voltage at any given moment; The first Current at time and the first Current at any given moment; , They are respectively The electrochemical polarization voltage and concentration polarization voltage of the battery at any given time; , They are respectively The electrochemical polarization voltage and concentration polarization voltage of the battery at any given time; The sampling period of the system; C N Battery capacity; for Noise during the constant state of battery charge process; for Noise during the electrochemical polarization capacitor voltage process; for Noise during the concentration polarization capacitor voltage process; To measure the noise vector; Then, the state-space equation and observation equation of the pseudo-battery state-of-charge estimate EKF-SOC are recursively iterated using the Extended Kalman Filter (EKF) algorithm. The steps of the Extended Kalman Filter (EKF) algorithm are as follows: Step 3.1, in k At time =0, the initial state variables need to be adjusted. Initial error covariance matrix Process error covariance matrix and measurement noise covariance matrix Perform initialization; Step 3.2, Prediction k Prior estimate of battery state of charge at time +1 and prior error covariance matrix : predict k The expression for the prior estimate of the battery's state of charge at time +1 is as follows:
[0059] in, for k Prior estimate of the battery state of charge at time +1; for k The posterior estimate of the battery's state of charge at time t; A k and B k The coefficient matrices for the first and second state equations are shown. i k for k Current at any given moment; predict k The expression for the error covariance matrix at time +1 is as follows:
[0060] in, P k for k The error covariance matrix at time t; for k The prior error covariance matrix at time +1; The process noise covariance matrix; Step 3.3, calculate the Kalman gain matrix. K k+1 Its expression is as follows:
[0061] in: for k The prior error covariance matrix at time +1; C k+1 The observation matrix; K k+1 The Kalman gain matrix; To measure the noise covariance matrix; Step 3.4, according to k Prior estimate of battery state of charge at time +1 Make corrections to obtain k Posterior estimate of battery state of charge at time +1 Its expression is as follows:
[0062] in: for k Posterior estimate of the battery state of charge at time +1; for k Prior estimate of the battery state of charge at time +1; This is the observation output vector at time k+1; To output the estimated value of the observation vector; K k+1 The Kalman gain matrix; Step 3.5, update the error covariance matrix, the expression of which is as follows:
[0063] in: for k The posterior error covariance matrix at time +1; I It is a third-order identity matrix; K k+1 The Kalman gain matrix; C k+1 The observation matrix; for k The prior error covariance matrix at time +1.
[0064] Step 3.6: Determine if the set number of iterations for the recursive loop has not been reached. If the set number of iterations for the recursive loop has not been reached, then... k Posterior estimate of battery state of charge at time +1 The previous time step's posterior state estimate of the battery charge state is used as the prior state estimate of the battery charge state required to predict the next time step; if the set number of recursive iterations is reached, this... k Posterior estimate of battery state of charge at time +1 The output is the pseudo-battery state of charge estimate EKF-SOC.
[0065] Step 4: Sample battery current, battery voltage, and battery temperature, and normalize and flatten the battery current, battery voltage, battery temperature, and the pseudo-battery state of charge estimate EKF-SOC obtained in Step 3 to obtain the processed data.
[0066] In this embodiment, the normalization process includes unifying the numerical scale of battery current, battery voltage, battery temperature, and pseudo-battery state of charge (EKF-SOC) estimates with different dimensions, and constructing a time-series feature matrix for convolution operations through data tiling, so as to enhance the prediction model's ability to jointly model multi-source time-series data and improve the stability of the training and prediction process.
[0067] Step 5: Input the processed data into the convolutional neural network (CNN) layer through the input layer to extract the complex feature vector F1 of spatiotemporal intersection.
[0068] In this embodiment, the convolutional neural network (CNN) layer consists of a sequence of folded layers and two convolutional kernels with a size of [missing information]. The convolutional layer consists of two layers. First, the input sequence data is converted into a four-dimensional tensor for convolution calculation through a sequence folding layer. Then, two convolutional kernels with sizes of [size missing] are input sequentially. The processing is performed using convolutional layers, where the first convolutional layer contains 32 layers. The convolutional kernel outputs a 32-channel feature tensor T1, and the second convolutional layer contains 64 kernels. The convolution kernel outputs a 64-channel feature tensor T2; then, this 64-channel feature tensor T2 is used as the convolution output feature to obtain the complex feature vector F1.
[0069] Step 6: Through the Attention mechanism layer, calculate the correlation between the complex feature vector F1 and the battery state of charge, use the softmax function to normalize the attention score, assign higher weights to key features, and obtain the weighted feature vector F2.
[0070] In this embodiment, the attention mechanism layer consists of a global average pooling layer, two fully connected network layers, a softmax normalization layer, and a channel-by-channel multiplication operation. The complex feature vector F1 obtained in step 5 is subjected to global average pooling to obtain channel statistics corresponding to each channel. The channel statistics are then sequentially input into the two fully connected network layers to calculate the attention weight coefficients corresponding to the number of channels. The attention weight coefficients are then normalized using the softmax function. Finally, the normalized weight coefficients are multiplied with the complex feature vector F1 channel by channel according to the channel correspondence to obtain the weighted feature vector F2.
[0071] The Attention mechanism layer described in step 6 assigns channel-level weights to the multi-channel feature vectors output by the Convolutional Neural Network (CNN) layer, highlighting feature information that is highly correlated with changes in the battery's state of charge and suppressing noise features.
[0072] Step 7: Input the weighted feature vector F2 into the Bidirectional Long Short-Term Memory (BiLSTM) network layer to model the forward and backward time series respectively. By combining historical and future information, the dynamic dependency between the current moment and different time points is captured, and the BiLSTM feature vector F3 is obtained.
[0073] In this embodiment, the BiLSTM bidirectional long short-term memory network layer consists of a forward long short-term memory sub-network and a backward long short-term memory sub-network. The weighted feature vector F2 is input into the forward long short-term memory sub-network in chronological order and outputs a forward hidden state sequence. At the same time, the weighted feature vector F2 is input into the backward long short-term memory sub-network in reverse chronological order and outputs a backward hidden state sequence. Then, the forward hidden state and the backward hidden state corresponding to the same time step are concatenated and processed to obtain the BiLSTM feature vector F3.
[0074] The Bidirectional Long Short-Term Memory (BiLSTM) network layer is modeled based on the weighted feature vector F2 using historical and future time-series information to enhance the learning ability of the dynamic change trend of the battery state of charge, thereby improving the robustness of the prediction results in the boundary state of charge range and under multiple operating conditions.
[0075] Step 8: Input the BiLSTM feature vector F3 into the prediction output module. The prediction output module includes a fully connected layer and an output layer. The ReLU activation function is selected to achieve global fusion and nonlinear mapping of time-series features, and outputs the predicted battery state of charge. .
[0076] In this embodiment, the fully connected layer in step 8 integrates the global temporal information of the BiLSTM by linearly weighting and combining the feature components of the BiLSTM feature vector F3, thus obtaining a linear mapping result. Its expression is:
[0077] in, These are the weight parameters of the fully connected layer. F3 is the bias parameter; F3 is the BiLSTM feature vector. Then the linear mapping result The input is a modified linear unit (ReLU) activation function, which performs a nonlinear transformation on the intermediate mapping result. When it is positive, it retains its original value; when... When the value is negative, its output is set to zero, thus obtaining the predicted value of battery state of charge. And output the predicted value of battery state of charge through the output layer. .
[0078] Figure 2 This is a structural diagram of the prediction model of the present invention. Figure 2 As can be seen, the prediction model in this embodiment includes an input layer, a convolutional neural network (CNN) layer, an attention mechanism layer, a bidirectional long short-term memory (BiLSTM) network layer, a fully connected layer, and an output layer. The input layer receives n sets of data processed in step 4, with any one set designated as the i-th set, including the battery current I obtained from the i-th sampling. i Battery voltage U i Battery temperature T i And the pseudo-battery state of charge (SOC) sampled estimate EKF-SOC obtained through steps 1-3 and corresponding to the i-th sampling time. i , i=1,2,…,n.
[0079] The input layer takes in n sets of data, and the output layer outputs n predicted battery state of charge (SOC) values based on the output of the fully connected layer. pred And denote any one of them as SOC predi .
Claims
1. A method for predicting the state of charge (SOC) of lithium-ion batteries based on EKF combined with CNN-BiLSTM-Attention, used to accurately estimate the SOC of lithium-ion batteries in energy storage systems; characterized in that, The prediction method involves a system comprising an equivalent circuit model, an extended Kalman filter (EKF) module, and a prediction model. The prediction model includes an input layer, a convolutional neural network (CNN) layer, an attention mechanism layer, a bidirectional long short-term memory (BiLSTM) network layer, and a prediction output module. Taking a lithium-ion battery as an example, the prediction method includes the following steps: Step 1: Construct the equivalent circuit model of the battery and obtain five key parameters of the battery, namely: internal resistance in ohms. R 0 、 Electrochemical polarization resistance R 1 、 Electrochemically polarized capacitor C 1 、 Concentration polarization resistance R 2 and concentration polarization capacitance C 2 ; Step 2: By collecting observable data during battery operation, the recursive least squares method with forgetting factor is used to identify the five key parameters of the battery in the battery equivalent circuit model online. Step 3: Based on the parameters identified online in Step 2, obtain the pseudo battery state of charge estimate EKF-SOC through the Extended Kalman Filter (EKF) module; Step 4: Sample battery current, battery voltage, and battery temperature, and normalize and flatten the battery current, battery voltage, battery temperature, and the pseudo battery state of charge estimate EKF-SOC obtained in Step 3 to obtain the processed data. Step 5: Input the processed data into the convolutional neural network (CNN) layer through the input layer to extract the complex feature vector F1 of spatiotemporal intersection; Step 6: Through the Attention mechanism layer, calculate the correlation between the complex feature vector F1 and the battery state of charge, normalize the attention score using the softmax function, assign higher weights to key features, and obtain the weighted feature vector F2. Step 7: Input the weighted feature vector F2 into the Bidirectional Long Short-Term Memory (BiLSTM) network layer to model the forward and backward time series respectively. Combine historical and future information to capture the dynamic dependency between the current moment and different time points, and obtain the BiLSTM feature vector F3. Step 8: Input the BiLSTM feature vector F3 into the prediction output module. The prediction output module includes a fully connected layer and an output layer. The ReLU activation function is selected to achieve global fusion and nonlinear mapping of time-series features, and outputs the predicted battery state of charge. .
2. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention as described in claim 1, characterized in that, The topology of the equivalent circuit model described in step 1 includes two parallel RC branches, an ohmic internal resistance R0, and the open-circuit voltage of the battery. U ocv One of the parallel RC branches is the electrochemical polarization resistor. R 1 、 Electrochemically polarized capacitor C 1 The circuit is configured in parallel and denoted as the electrochemical polarization branch. Another parallel RC branch is the concentration polarization resistor. R 2 and concentration polarization capacitance C 2 The circuit is constructed in parallel and denoted as the concentration polarization branch; the concentration polarization branch is connected in series with the electrochemical polarization branch, the ohmic internal resistance R0 of the battery, and the open-circuit voltage. U ocv Form a complete circuit; Its expression is: in, U 1 represents the electrochemical polarization capacitor of the battery. C The voltage across 1. U 2 is the concentration polarization capacitor of the battery. C 2. Voltage across the terminals; i This refers to the charging and discharging current. For time.
3. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention as described in claim 1, characterized in that, The expression for online parameter identification in step 2 is: in, These are the first and second time constants of the battery equivalent circuit model, respectively. T The sampling period; These are the first and second denominator coefficients of the discrete transfer function, respectively. These are the first, second, and third numerator coefficients of the discrete transfer function, respectively.
4. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention as described in claim 1, characterized in that, The process of step 3 is as follows: First, denoted as time k, the state-space equation and observation equation for the pseudo-battery state-of-charge estimate EKF-SOC are established in the extended Kalman filter (EKF) module, and their expressions are as follows: in, For the first The battery's terminal voltage at any given time; The first Battery state of charge at time 1 and the 2nd time The state of charge of the battery at any given time; For the first Open-circuit voltage at any given moment; The first Current at time and the first Current at any given moment; , They are respectively The electrochemical polarization voltage and concentration polarization voltage of the battery at any given time; , They are respectively The electrochemical polarization voltage and concentration polarization voltage of the battery at any given time; The sampling period of the system; C N Battery capacity; for Noise during the constant state of battery charge process; for Noise during the electrochemical polarization capacitor voltage process; for Noise during the concentration polarization capacitor voltage process; To measure the noise vector; Then, the state-space equation and observation equation of the pseudo-battery state-of-charge estimate EKF-SOC are recursively iterated using the Extended Kalman Filter (EKF) algorithm. The steps of the Extended Kalman Filter (EKF) algorithm are as follows: Step 3.1, in k At time =0, for the initial state variable Initial error covariance matrix Process error covariance matrix and measurement noise covariance matrix Perform initialization; Step 3.2, Prediction k Prior estimate of battery state of charge at time +1 and prior error covariance matrix : predict k The expression for the prior estimate of the battery's state of charge at time +1 is as follows: in, for k Prior estimate of the battery state of charge at time +1; for k The posterior estimate of the battery's state of charge at time t; A k and B k The coefficient matrices for the first and second state equations are shown. i k for k Current at any given moment; predict k The expression for the error covariance matrix at time +1 is as follows: in, P k for k The error covariance matrix at time t; for k The prior error covariance matrix at time +1; The process noise covariance matrix; Step 3.3, calculate the Kalman gain matrix. K k+1 Its expression is as follows: in: for k The prior error covariance matrix at time +1; C k+1 The observation matrix; K k+1 The Kalman gain matrix; To measure the noise covariance matrix; Step 3.4, according to k Prior estimate of battery state of charge at time +1 Make corrections to obtain k Posterior estimate of battery state of charge at time +1 Its expression is as follows: in: for k Posterior estimate of the battery state of charge at time +1; for k Prior estimate of the battery state of charge at time +1; This is the observation output vector at time k+1; To output the estimated value of the observation vector; K k+1 The Kalman gain matrix; Step 3.5, update the error covariance matrix, the expression of which is as follows: in: for k The posterior error covariance matrix at time +1; I It is a third-order identity matrix; K k+1 The Kalman gain matrix; C k+1 The observation matrix; for k The prior error covariance matrix at time +1; Step 3.6: Determine if the set number of iterations for the recursive loop has not been reached. If the set number of iterations for the recursive loop has not been reached, then... k Posterior estimate of battery state of charge at time +1 The previous time step's posterior state estimate of the battery charge state is used as the prior state estimate of the battery charge state required to predict the next time step; if the set number of recursive iterations is reached, this... k Posterior estimate of battery state of charge at time +1 The output is the pseudo-battery state of charge estimate EKF-SOC.
5. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention according to claim 1, characterized in that, The normalization process described in step 4 includes unifying the numerical scale of battery current, battery voltage, battery temperature, and pseudo-battery state of charge (EKF-SOC) estimates with different dimensions, and constructing a time-series feature matrix for convolution operations through data tiling, so as to enhance the prediction model's ability to jointly model multi-source time-series data and improve the stability of the training and prediction process.
6. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention according to claim 1, characterized in that, Step 5 describes a convolutional neural network (CNN) layer consisting of a sequence of folded layers and two convolutional kernels with a size of [missing information]. The convolutional layer consists of two layers. First, the input sequence data is converted into a four-dimensional tensor for convolution calculation through a sequence folding layer. Then, two convolutional kernels with sizes of [size missing] are input sequentially. The processing is performed using convolutional layers, where the first convolutional layer contains 32 layers. The convolutional kernel outputs a 32-channel feature tensor T1, and the second convolutional layer contains 64 kernels. The convolution kernel outputs a 64-channel feature tensor T2; then, this 64-channel feature tensor T2 is used as the convolution output feature to obtain the complex feature vector F1.
7. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention as described in claim 1, characterized in that, The attention mechanism layer described in step 6 consists of a global average pooling layer, two fully connected network layers, a softmax normalization layer, and a channel-by-channel multiplication operation. The complex feature vector F1 obtained in step 5 is subjected to global average pooling to obtain channel statistics corresponding to each channel. The channel statistics are then sequentially input into the two fully connected network layers to calculate the attention weight coefficients corresponding to the number of channels. The attention weight coefficients are then normalized using the softmax function. Finally, the normalized weight coefficients are multiplied with the complex feature vector F1 channel by channel according to the channel correspondence to obtain the weighted feature vector F2.
8. The lithium-ion battery state-of-charge prediction method based on EKF combined with CNN-BiLSTM-Attention according to claim 1, characterized in that, Step 7 describes a Bi-LSTM network layer consisting of a forward LSTM sub-network and a backward LSTM sub-network. The weighted feature vector F2 is input into the forward LSTM sub-network in chronological order and outputs a forward hidden state sequence. Simultaneously, the weighted feature vector F2 is input into the backward LSTM sub-network in reverse chronological order and outputs a backward hidden state sequence. Then, the forward and backward hidden states corresponding to the same time step are concatenated and processed to obtain the BiLSTM feature vector F3.
9. A method for predicting the state of charge of lithium-ion batteries based on EKF combined with CNN-BiLSTM-Attention as described in claim 1, characterized in that, Step 8 describes a fully connected layer that integrates the global temporal information of the BiLSTM by linearly weighting and combining the feature components of the BiLSTM feature vector F3, thus obtaining a linear mapping result. Its expression is: in, These are the weight parameters of the fully connected layer. F3 is the bias parameter; F3 is the BiLSTM feature vector. Then the linear mapping result The input is a modified linear unit (ReLU) activation function, which performs a nonlinear transformation on the intermediate mapping result. When it is positive, it retains its original value; when... When the value is negative, its output is set to zero, thus obtaining the predicted value of battery state of charge. And output the predicted value of battery state of charge through the output layer. .