Lithium ion battery state-of-charge estimation method based on LSTM-NBEATS algorithm
By fusing the LSTM and NBEATS models, using the feature extraction ability of LSTM and the multi-step prediction ability of NBEATS, the problems of low accuracy and poor generalization ability in SOC estimation are solved, and higher SOC estimation accuracy and adaptability are achieved.
Patent Information
- Application Number
- CN202510121531.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-05-30
AI Technical Summary
The single LSTM model has low accuracy and poor generalization capabilities in lithium battery SOC estimation, making it difficult to adapt to complex environments and large-scale data.
The LSTM-NBEATS fusion model is adopted, and the output of LSTM is used as the input of the NBEATS model. Through the series structure and residual connection design, more complex time series modes are extracted to improve the accuracy of SOC prediction.
It significantly improves the accuracy and efficiency of SOC estimation of lithium batteries, enhances the adaptability and flexibility of the model, and is suitable for various complex battery usage scenarios.
Smart Images

Figure CN120064991A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence algorithms and battery energy storage management, and particularly relates to a method for estimating the state of charge of a lithium-ion battery based on the LSTM-NBEATS algorithm. Background Art
[0002] With the rapid development of electric vehicles and renewable energy, the technology for estimating the state of charge (SOC) of lithium batteries has become increasingly important. Traditional methods rely on physical models and empirical formulas, but these methods have poor adaptability and accuracy in complex environments and are difficult to meet the actual application requirements. The rise of deep learning technology has provided a new solution for SOC estimation.
[0003] The LSTM model, with its advantage in processing time series data, can accurately capture the temporal characteristics of the SOC change of the battery. By maintaining long-term and short-term memories, LSTM can handle the non-linear dynamic changes during the charging and discharging processes of lithium batteries. However, a single LSTM model still has certain limitations in learning complex data patterns. Especially when facing large-scale data, its generalization ability and prediction accuracy still need to be improved.
[0004] To solve this problem, the output of LSTM is used as the input of the N-BEATS model for fusion. The N-BEATS model, with its block structure and residual connection design, can further extract the features generated by LSTM and capture more complex time series patterns. The fusion model can utilize the modeling ability of LSTM for time series, use LSTM as a feature extractor, and generate a more accurate intermediate representation of the SOC change. This intermediate representation can help N-BEATS better understand the structure of the data, thereby improving the accuracy of the final SOC prediction.
[0005] By combining the LSTM and N-BEATS models, the accuracy and efficiency of estimating the SOC of lithium batteries can be significantly improved. This fusion model provides strong technical support for the intelligence of lithium battery management systems and promotes the further development of the fields of electric vehicles and renewable energy. Summary of the Invention
[0006] The purpose of the present invention is to solve the current situation of low accuracy and poor generalization ability of a single LSTM model for SOC estimation. To provide the accuracy of SOC estimation of the LSTM model and improve its generalization ability for different data samples.
[0007] The technical solution adopted by the present invention is as follows: A method for estimating the state of charge of a lithium-ion battery based on the LSTM-NBEATS algorithm, including the following steps:
[0008] Step 1, construct an LSTM-NBEATS fusion model;
[0009] Step 1-1) Set up a cascaded LSTM-NBEATS fusion model, input the data set into the LSTM model, and successively pass through the forget gate, input gate, and output gate to generate the output of the LSTM model.
[0010] Step 1-2) The NBEATS model receives the output of the LSTM model as input, successively passes through the trend stack and seasonal stack, and finally generates the output of the cascaded LSTM-NBEATS fusion model.
[0011] Step 2: Design a battery charge and discharge experiment, and use the collected battery charge and discharge data to establish a training set and a test set.
[0012] Step 2-1) Install a lithium-ion battery with a rated capacity of Q mAh into an incubator, set the temperature of the incubator to T degrees Celsius, and measure the actual capacity of the battery at a charge and discharge rate of 0.9C.
[0013] Step 2-2) Discharge the fully charged battery to 80% of its actual capacity at a discharge rate of 0.9C. Perform cyclic discharges at intervals of 15% of the actual discharge capacity each time until 20% of the actual capacity is reached. After each cyclic discharge, the battery is left to stand for 1 minute.
[0014] Step 2-3) Collect the discharge data from 80%Q to 20%Q of the actual discharge capacity, including three types of information: voltage, current, and the true value of SOC.
[0015] Step 2-4) Repeat Steps 2-2 and 2-3 three times to obtain 3 sets of lithium battery discharge data.
[0016] Step 2-5) Randomly select two sets of data as the training set, and the remaining set as the test set.
[0017] Step 3: Use the training set to train the LSTM-NBEATS fusion model, and adopt the backpropagation algorithm to optimize the weights and biases in the network.
[0018] Step 3-1) Configure the data processing and model training parameters, and select the trend stack and seasonal stack for the NBEATS model stacking method.
[0019] Step 3-2) Input the current and voltage in the training set into the LSTM model, successively calculate through the forget gate, input gate, and output gate, output the hidden state of the last time step of each iteration, and then input this hidden state into a fully connected layer to obtain the final output of the LSTM model.
[0020] Calculation formula for the hidden state of the last time step of each LSTM iteration:
[0021] f s =σ(Wf [h s-1 ,x s ]+b f ),i s =σ(W i [h s-1 ,x s ]+b i ),
[0022] C′ s =tanh(W c [h s-1 ,x s ]+b c ), C s =f s *C s-1 +i s *C′ s ,
[0023] o s =σ(W o [h s-1 ,x s ]+b o ), h s =o s *tanh(C s );
[0024] W f , W i and W o Represents the weight matrices of the forget gate, input gate, and output gate at the current time step, b f 、b i and b o is the corresponding bias vector; C′ s and C s Represent the candidate cell state and cell state of the current time step respectively; x s 、h s-1 and h s Represent the input of the current time step, the hidden state of the previous time step, and the hidden state of the current time step respectively.
[0025] Step 3-3) Input the final output of the LSTM model into the NBEATS model, pass through the trend stack and seasonal stack in turn, generate backward prediction and forward prediction respectively, and accumulate all forward predictions as the forward propagation output y of the current iteration;
[0026] The calculation formulas for NBEATS backward prediction, forward prediction and final output y in step 3-3) are:
[0027] z m,1 =RELU(W m,1 xm +b m,1 ),z m,2 =RELU(W m,2 z m,1 +b m,2 ),
[0028] z m,3 =RELU(W m,3 z m,2 +b m,3 ),z m,4 =RELU(W m,4 z m,3 +b m,4 ),
[0029]
[0030] W m,i and b m,i respectively represent the weight matrix and bias vector of the i-th standard fully connected layer with RELU non-linearity in the m-th block, where i = 1, 2, 3, 4; and are the backward expansion coefficient and forward expansion coefficient of the m-th block respectively, and are the weight matrices of their corresponding calculation formulas, and are their corresponding basis vectors, and are the backward prediction and forward prediction generated correspondingly; as the input x 1 of the first block, it represents the input of the entire NBEATS model, and the input x m of the remaining blocks is the input x m-1 of the previous block minus the backward prediction of the previous block. The accumulated forward prediction y n of the M blocks is the prediction output of the current stack, and the accumulated prediction output of the N stacks is the final output y of the fusion model.
[0031] Step 3 - 4) Calculate the loss between the current iteration output y and the true SOC value for backpropagation, and simultaneously update the weights and biases of the LSTM model and the NBEATS model to optimize the network of the concatenated fusion model;
[0032] Step 3 - 5) Repeat Step 3 - 2, 3 - 3, and 3 - 4 until the training error reaches the expected error range set by the user, then complete the training of the network model.
[0033] Step 4, Use the trained LSTM - NBEATS fusion model for SOC prediction.
[0034] Step 4-1): Set the fusion model to the evaluation mode and disable gradient calculation;
[0035] Step 4-2): Input the test set into the fusion model for forward propagation, output the prediction result, and draw the SOC fitting image.
[0036] The beneficial effects of the present invention are as follows: By the above method, the present invention uses the LSTM model as a feature extractor and combines the multi-step prediction ability of the NBEATS model, enabling the fusion model to process various large-scale and multi-feature time series data. In terms of the SOC estimation of lithium-ion batteries, compared with a single model, the present invention can adapt to different types of lithium battery data, has strong adaptability, and can handle various complex battery usage scenarios. This makes the model have higher flexibility and reliability in practical applications and has good market prospects and potential for popularization and application. Description of the Drawings
[0037] Figure 1 It is a flow chart of the present invention;
[0038] Figure 2 It is a network model structure diagram of the present invention;
[0039] Figure 3 It is a fitting diagram of the SOC estimation of the lithium-ion battery of the present invention. Detailed Embodiments
[0040] The technical solutions in the embodiments of the present invention will be described in detail below with reference to the drawings. The following embodiments are applicable to the present invention, but do not limit the scope of the present invention.
[0041] A method for estimating the state of charge of a lithium-ion battery based on the LSTM-NBEATS algorithm includes the following steps:
[0042] Step 1, construct an LSTM-NBEATS fusion model;
[0043] Step 1-1): Set a cascaded LSTM-NBEATS fusion model, input the data set into the LSTM model, and successively pass through the forget gate, input gate, and output gate to generate the output of the LSTM model;
[0044] Step 1-2): The NBEATS model receives the output of the LSTM model as input, successively passes through the trend stack and the seasonal stack, and finally generates the output of the cascaded LSTM-NBEATS fusion model.
[0045] Step 2, use the collected battery charge and discharge data to construct a training set and a test set;
[0046] Step 2-1) Install a lithium-ion battery with a rated capacity of Q mAh into an incubator, set the temperature of the incubator to T degrees Celsius, and measure the actual capacity of the battery at a charge-discharge rate of 0.9C.
[0047] Step 2-2) Discharge the fully charged battery to 80% of its actual capacity at a discharge rate of 0.9C. Perform cyclic discharge at intervals of 15% of the actual discharge capacity each time until 20% of the actual capacity is reached. After each cyclic discharge, the battery will be left to stand for 1 minute.
[0048] Step 2-3) Collect the discharge data from 80%Q to 20%Q of the actual discharge capacity, including three types of information: voltage, current, and the true value of SOC.
[0049] Step 2-4) Repeat Steps 2-2 and 2-3 three times to obtain 3 sets of lithium battery discharge data.
[0050] Step 2-5) Randomly select two sets of data as the training set and the remaining one set as the test set.
[0051] Step 3, Train the model, and use the backpropagation algorithm to optimize the weights and biases in the network.
[0052] Step 3-1) Configure the data processing and model training parameters, and select the trend stack and seasonal stack for the NBEATS model stack method.
[0053] Step 3-2) Input the current and voltage in the training set into the LSTM model, and calculate through the forget gate, input gate, and output gate in turn. Output the hidden state of the last time step of each iteration, and then input this hidden state into a fully connected layer to obtain the final output of the LSTM model.
[0054] Step 3-3) Input the final output of the LSTM model into the NBEATS model, and go through the trend stack and seasonal stack in turn to generate backward prediction and forward prediction respectively. Accumulate all the forward predictions as the forward propagation output y of the current iteration.
[0055] Step 3-4) Calculate the loss between the output y of the current iteration and the true value of SOC for backpropagation, and at the same time update the weights and biases of the LSTM model and the NBEATS model to optimize the network of the series fusion model.
[0056] Step 3-5) Repeat Steps 3-2, 3-3, and 3-4 until the training error reaches within the expected error range set by the user, then the training of the network model is completed.
[0057] The calculation formula for the hidden state of the last time step of each iteration of LSTM in Step 3-2) is as follows:
[0058] f s =σ(W f [h s-1 ,x s ]+b f ),i s =σ(W i [h s-1 ,x s ]+b i ),
[0059] C′ s =tanh(W c [h s-1 ,x s ]+b c ), C s =f s *C s-1 +i s *C′ s ,
[0060] o s =σ(W o [h s-1 ,x s ]+b o ), h s =o s *tanh(C s );
[0061] W f , W i and W o Represents the weight matrices of the forget gate, input gate, and output gate at the current time step, b f , b i and b o is the corresponding bias vector; C′ s and C s Represent the candidate cell state and cell state of the current time step respectively; x s 、h s-1 and h s Represent the input of the current time step, the hidden state of the previous time step, and the hidden state of the current time step respectively.
[0062] The calculation formulas for NBEATS backward prediction, forward prediction and final output y in step 3-2) are:
[0063] z m,1 =RELU(W m,1 x m +b m,1 ), z m,2 =RELU(W m,2 z m,1 +b m,2),
[0064] z m,3 = RELU(W m,3 z m,2 + b m,3 ), z m,4 = RELU(W m,4 z m,3 + b m,4 ),
[0065]
[0066] W m,i and b m,i respectively represent the weight matrix and bias vector of the i-th standard fully-connected layer with RELU non-linearity in the m-th block, where i = 1, 2, 3, 4; and are the backward expansion coefficient and forward expansion coefficient of the m-th block respectively, and are the weight matrices of their corresponding calculation formulas, and are their corresponding basis vectors, and are the backward prediction and forward prediction generated correspondingly; as the input x 1 of the first block, it represents the input of the entire NBEATS model, and the input x m of the remaining blocks is the input x m-1 of the previous block minus the backward prediction of the previous block. The accumulated forward prediction y n of the M blocks is the prediction output of the current stack, and the accumulated prediction output of the N stacks is the final output y of the fusion model.
[0067] Step 4, use the trained fusion model for SOC prediction;
[0068] Step 4-1) Set the fusion model to evaluation mode and disable gradient calculation;
[0069] Step 4-2) Input the test set into the fusion model for forward propagation, output the prediction result, and draw the SOC fitting image.
[0070] Example 1:
[0071] The collected data sets are respectively fed into the LSTM network model and the LSTM-NBEATS network model for training. The LSTM network in the fusion model and the single LSTM network use the same data processing and model training parameters. After training, the same test set is tested and the SOC estimation fitting effect diagram is drawn, as shown in Figure 3As shown; the results show that the invented LSTM-NBEATS cascade fusion model can effectively improve the accuracy of lithium battery SOC estimation.
Claims
1. A method for estimating the state of charge of a lithium-ion battery based on the LSTM-NBEATS algorithm, characterized in that: The steps include: Step 1: Build the LSTM-NBEATS fusion model; Step 2: Design a battery charge and discharge experiment and use the collected battery charge and discharge data to create a training set and a test set. Step 3: Use the training set to train the LSTM-NBEATS fusion model, and use the back propagation algorithm to optimize the weights and biases in the network; Step 4: Use the trained LSTM-NBEATS fusion model to predict SOC.
2. A lithium-ion battery state of charge estimation method based on LSTM-NBEATS algorithm according to claim 1, characterized in that: The specific method in step 1 is: Step 1-1) Set up a serial LSTM-NBEATS fusion model, input the data set into the LSTM model and pass through the forget gate, input gate, and output gate in sequence to generate the output of the LSTM model; Step 1-2) The NBEATS model receives the output of the LSTM model as input, passes through the trend stack and seasonal stack in sequence, and finally generates the output of the concatenated LSTM-NBEATS fusion model.
3. A lithium-ion battery state of charge estimation method based on LSTM-NBEATS algorithm according to claim 1, characterized in that: The specific method in step 2 is: Step 2-1) Install a lithium-ion battery with a rated capacity of Q mAh into a constant temperature box, set the temperature of the constant temperature box to T degrees Celsius, and measure the actual capacity of the battery at a charge and discharge rate of 0.9C; Step 2-2) Discharge the fully charged battery to 80% of its actual capacity at a discharge rate of 0.9C. Perform cyclic discharge at intervals of 15% of the actual capacity each time until reaching 20% of the actual capacity. After each cyclic discharge, let the battery stand for 1 minute; Step 2-3) collecting discharge data from 80%Q to 20%Q of actual discharge capacity, including three types of information: voltage, current and SOC real value; Step 2-4) Repeat steps 2-2 and 2-3 three times to obtain 3 sets of lithium battery discharge data; Step 2-5) Randomly select two sets of data as training sets and the remaining set as test set.
4. The method for estimating the state of charge of a lithium-ion battery based on the LSTM-NBEATS algorithm according to claim 1, characterized in that: The specific method in step 3 is: Step 3-1) Configure data processing and model training parameters, and select trend stacking and seasonal stacking for the NBEATS model stacking method; Step 3-2) Input the current and voltage in the training set into the LSTM model, and output the hidden state of the last time step of each iteration through the calculation of the forget gate, input gate, and output gate in turn. This hidden state is then input to a fully connected layer to obtain the final output of the LSTM model. Step 3-3) Input the final output of the LSTM model into the NBEATS model, pass through the trend stack and seasonal stack in turn, generate backward prediction and forward prediction respectively, and accumulate all forward predictions as the forward propagation output y of the current iteration; Step 3-4) Calculate the loss between the current iteration output y and the true value of SOC for back propagation, and simultaneously update the weights and biases of the LSTM model and NBEATS model to optimize the network of the series fusion model; Step 3-5) Repeat steps 3-2, 3-3 and 3-4 until the training error reaches the expected error range set by the user, and the network model training is completed.
5. A lithium-ion battery state of charge estimation method based on LSTM-NBEATS algorithm according to claim 4, characterized in that: The hidden state calculation formula of the last time step of each iteration of LSTM in step 3-2) is: f s =σ(W f [h s-1 ,x s ]+b f ),i s =σ(W i [h s-1 ,x s ]+b i ), C s '=tanh(W c [h s-1 ,x s ]+b c ),C s =f s *C s-1 +i s *C s ', o s =σ(W o [h s-1 ,x s ]+b o ),h s =o s *tanh(C s ); W f , W i and W o Represents the weight matrices of the forget gate, input gate, and output gate at the current time step, b f 、b i and b o is the corresponding bias vector; C′ s and C s Represent the candidate cell state and cell state of the current time step respectively; x s 、h s-1 and h s Represent the input of the current time step, the hidden state of the previous time step, and the hidden state of the current time step respectively.
6. A lithium-ion battery state of charge estimation method based on LSTM-NBEATS algorithm according to claim 4, characterized in that: The calculation formulas for NBEATS backward prediction, forward prediction and final output y in step 3-3) are: With m,1 =RELU(IN m,1 x m +b m,1 ),With m,2 =RELU(IN m,2 With m,1 +b m,2 ), With m,3 =RELU(IN m,3 With m,2 +b m,3 ),With m,4 =RELU(IN m,4 With m,3 +b m,4 ), W m,i and b m,i Represent the weight matrix and bias vector of the i-th standard fully connected layer with RELU nonlinearity in the m-th block, where i = 1, 2, 3, 4; and are the backward expansion coefficient and forward expansion coefficient of the mth block respectively, and is the weight matrix of its corresponding calculation formula, and is its corresponding basis vector, and is the corresponding generated backward prediction and forward prediction; as the input x1 of the first block, it represents the input of the entire NBEATS model, and the input x of the remaining blocks m is the input x of the previous block m-1 Subtract the backward prediction of the previous block The forward prediction accumulation y of M blocks n is the predicted output of the current stack, and the predicted outputs of N stacks are accumulated as the final output y of the fusion model.
7. The method for estimating the state of charge of a lithium-ion battery based on the LSTM-NBEATS algorithm according to claim 1, characterized in that: In the step 4), the specific method is as follows: Step 4-1) Set the fusion model to evaluation mode and disable gradient operation; Step 4-2) Input the test set into the fusion model for forward propagation, output the prediction results, and draw the SOC fitting image.