A Transformer-based method and system for estimating the state of health of lithium batteries
Through the Transformer-based lithium battery health status estimation method, the model training and prediction is used for charging data, and the existing methods are solved in terms of accuracy and generalization capabilities, and a more efficient and accurate lithium battery health status estimation is achieved.
Patent Information
- Application Number
- CN202211639344.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-12-20
AI Technical Summary
The existing methods for estimating health status of lithium batteries have insufficient accuracy and generalization capabilities, especially when facing complex aging reactions and variable environmental conditions.
The health status estimation method based on Transformer is adopted to obtain charging data, segment data sets, train health status estimation model, and use the target optimization function to constrain the predicted value to achieve more accurate and generalized lithium battery health status estimation.
Through automatic feature extraction and deep learning methods, the accuracy and generalization ability of lithium battery health status estimation are significantly improved, the model development time is reduced, and the complex aging characteristics of lithium battery are adapted to.
Smart Images

Figure CN116299002B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of lithium battery detection, and particularly to a method and system for estimating the state of health of a lithium battery based on Transformer. Background Art
[0002] Lithium batteries have been widely used in fields such as electronic devices, new energy vehicles, and energy storage. Due to the complex mechanism of the internal aging reaction of lithium batteries and the great influence of the external environment and working conditions, accurately estimating the state of health (SOH) of lithium batteries is a difficult problem in battery management.
[0003] The state of health of a lithium battery is generally characterized by capacity attenuation. The estimation methods of the state of health include the following two types:
[0004] One is the model-based prediction method. This method not only requires a large amount of expert knowledge, but also the model has a high complexity. In the actual application process, it is affected by the actual outdoor temperature and outdoor environment, resulting in insufficient model accuracy and poor generalization ability.
[0005] The other is the big data-based prediction method. Traditionally, artificial extraction of big data features is used, which cannot guarantee the final accuracy of the model, and the prediction effects on lithium battery data from different sources will vary, and the generalization ability is poor.
[0006] Therefore, how to provide a method and system for estimating the state of health of a lithium battery based on Transformer to improve the accuracy and generalization ability of lithium battery state of health estimation has become an urgent technical problem to be solved. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a method and system for estimating the state of health of a lithium battery based on Transformer to improve the accuracy and generalization ability of lithium battery state of health estimation.
[0008] In the first aspect, the present invention provides a method for estimating the state of health of a lithium battery based on Transformer, including the following steps:
[0009] Step S10: Obtain a large amount of charging data of lithium batteries;
[0010] Step S20: Set a time duration threshold, and segment the charging data based on the time duration threshold to obtain a charging data set;
[0011] Step S30: Create a state of health estimation model based on Transformer, and train the state of health estimation model using the charging data set;
[0012] Step S40: Create a target optimization function and constrain the predicted values of the health state estimation model based on the target optimization function.
[0013] Step S50: Use the health state estimation model to estimate the health state of the lithium battery.
[0014] Further, in the step S10, the charging data includes charging current, charging voltage, charging SOC, and battery capacity attenuation rate.
[0015] Further, the step S20 is specifically as follows:
[0016] Set a time threshold of 500 seconds, segment the charging data based on the time threshold, fill the data with a short length less than the time threshold with 0, and construct a charging data set based on the segmented data.
[0017] Further, in the step S30, the health state estimation model includes a vector conversion module, a self-attention module, a sampling module, and a linear projection module; the vector conversion module, the self-attention module, the sampling module, and the linear projection module are connected in sequence;
[0018] The self-attention module includes three Transformer layers;
[0019] The vector conversion module is used to convert the charging data in the charging data set into feature vectors;
[0020] The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module;
[0021] The linear projection module is used to perform linear calculations on the output of the sampling module, and then obtain the predicted values of the health state estimation model.
[0022] Further, in the step S40, the formula of the target optimization function is:
[0023] F(x) = sigmoid(x) * (x high - x low ) + x low ;
[0024] sigmoid(x) = 1 / (1 + exp(-x));
[0025] where, F(x) represents the target optimization function; sigmoid(x) represents the activation function, which is used to map x to between 0 and 1; x high represents the constraint upper limit; x low represents the constraint lower limit; exp() represents the exponential function with the natural constant e as the base.
[0026] In a second aspect, the present invention provides a lithium battery health state estimation system based on Transformer, including the following modules:
[0027] A charging data acquisition module for acquiring a large amount of charging data of lithium batteries;
[0028] A charging data set construction module for setting a time duration threshold, segmenting the charging data based on the time duration threshold, and then obtaining a charging data set;
[0029] A health state estimation model creation module for creating a health state estimation model based on Transformer and training the health state estimation model using the charging data set;
[0030] A predicted value constraint module for creating an objective optimization function and constraining the predicted value of the health state estimation model based on the objective optimization function;
[0031] A health state estimation module for estimating the health state of a lithium battery using the health state estimation model.
[0032] Further, in the charging data acquisition module, the charging data includes charging current, charging voltage, charging SOC, and battery capacity attenuation rate.
[0033] Further, the charging data set construction module is specifically configured to:
[0034] Set a time duration threshold of 500 seconds, segment the charging data based on the time duration threshold, fill the data with a short length less than the time duration threshold with 0, and construct a charging data set based on the segmented data.
[0035] Further, in the health state estimation model creation module, the health state estimation model includes a vector conversion module, a self-attention module, a sampling module, and a linear projection module; the vector conversion module, the self-attention module, the sampling module, and the linear projection module are connected in sequence;
[0036] The self-attention module includes three Transformer layers;
[0037] The vector conversion module is used to convert the charging data in the charging data set into feature vectors;
[0038] The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module;
[0039] The linear projection module is used to perform linear calculations on the output of the sampling module to obtain the predicted value of the health state estimation model.
[0040] Further, in the prediction value constraint module, the formula of the target optimization function is as follows:
[0041] F(x) = sigmoid(x) * (x high - x low ) + x low ;
[0042] sigmoid(x) = 1 / (1 + exp(-x));
[0043] where F(x) represents the target optimization function; sigmoid(x) represents the activation function, which is used to map x to the range between 0 and 1; x high represents the constraint upper limit; x low represents the constraint lower limit; exp() represents the exponential function with the natural constant e as the base.
[0044] The advantages of the present invention are as follows:
[0045] By creating a health state estimation model through Transformer, the model structure is simple. The vector conversion module of the health state estimation model is used to convert the charging data into feature vectors and input them into the self-attention module. The self-attention module captures the features of the feature vectors. The sampling module performs average sampling and maximum sampling on the output of the self-attention module. That is, the method of automatically extracting features through deep learning replaces the traditional manual feature extraction. It can not only better capture the feature representation of long time series, but also reduce the development time of the model. And because deep learning fits the algorithm from a large amount of charging data, it has better generalization ability than traditional methods. Finally, it greatly improves the accuracy and generalization ability of the lithium battery health state estimation. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The present invention will be further described below with reference to the accompanying drawings in conjunction with embodiments.
[0047] Figure 1 FIG. is a flowchart of a method for estimating the health state of a lithium battery based on Transformer according to the present invention.
[0048] Figure 2 FIG. is a schematic structural diagram of a system for estimating the health state of a lithium battery based on Transformer according to the present invention.
[0049] Figure 3 FIG. is a schematic diagram of the health state estimation model according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0050] The overall idea of the technical solution in the embodiments of this application is as follows: By creating a health state estimation model with Transformer to automatically perform feature extraction instead of traditional manual feature extraction, it can better capture the feature representation of long time series. And since deep learning fits algorithms from a large amount of charging data, it has better generalization ability than traditional methods, so as to improve the accuracy and generalization ability of lithium battery health state estimation.
[0051] Please refer to Figures 1 to 3 As shown, a preferred embodiment of a method for estimating the health state of a lithium battery based on Transformer of the present invention includes the following steps:
[0052] Step S10: Obtain a large amount of charging data of lithium batteries;
[0053] Step S20: Set a duration threshold, and based on the duration threshold, segment the charging data to obtain a charging data set;
[0054] Step S30: Create a health state estimation model based on Transformer, and use the charging data set to train the health state estimation model;
[0055] Step S40: Create a target optimization function, and based on the target optimization function, constrain the predicted values of the health state estimation model;
[0056] Step S50: Use the health state estimation model to estimate the health state of the lithium battery.
[0057] In step S10, the charging data includes charging current, charging voltage, charging SOC, and battery capacity attenuation rate. The charging data is divided into three groups of data. The charging current is the first group of data, the charging voltage is the second group of data, and the charging SOC and battery capacity attenuation rate are the third group of data.
[0058] Step S20 is specifically:
[0059] Set a duration threshold of 500 seconds, segment the charging data based on the duration threshold, fill the data shorter than the duration threshold with 0, and construct a charging data set based on the segmented data. Since the input of the health state estimation model needs to be a vector of fixed length, it is necessary to segment the charging data according to the duration threshold and fill the data shorter than the duration threshold with 0; by segmenting the charging data, the feature expression of the entire data curve can be well retained.
[0060] In the step S30, the health state estimation model includes a vector conversion module (Embedding), a self-attention module, a sampling module (Mean pooling&Max Pooling), and a linear projection module (Linera); the vector conversion module, the self-attention module, the sampling module, and the linear projection module are connected in sequence;
[0061] The self-attention module includes three Transformer layers. By using the three Transformer layers, the expression ability of the model is greatly improved;
[0062] The vector conversion module is used to convert the charging data in the charging dataset into feature vectors;
[0063] The sampling module is used to perform average sampling and maximum value sampling on the output of the self-attention module, and the mathematical representation is:
[0064]
[0065]
[0066] Among them, represents the convolution window; x kpq represents the original value within the convolution window; the matrices obtained by calculating through this formula are concatenated, and finally converted into a matrix shape of [500, 128];
[0067] The linear projection module is used to perform linear calculations on the output of the sampling module, and then obtain the prediction value of the health state estimation model. The mathematical representation is:
[0068] Y = LN(Z 3 ) = Z 3 W + b;
[0069] The shape of the data sampled by the upper layer is [500, 128]. Then, the data is stretched into a one-dimensional vector by the straightening method, and finally converted into a matrix shape of [1];
[0070] The mathematical representation of the Transformer layer is:
[0071]
[0072] Z 2 = FFN(Z) = max(0, ZW 1 + b 1 )W 2 + b 2 ;
[0073] Among them, Q, K, and V are the same matrices, with a shape of [3, 128]; d k is the square root of 128; FFN() is a linear projection layer that finally transforms a matrix with a shape of [500, 128] into a matrix with a shape of [500, 256]; Z represents the output value of the Attention function, which is a matrix with a shape of [500, 128]; Z 2 represents the output value of the FFN function, which is a matrix with a shape of [500, 256]; W 1 represents parameter matrix 1, with a shape of [128, 256]; W 2 represents parameter matrix 2, with a shape of [128, 256]; b 1 represents bias vector 1 with a length of 500; b 2 represents bias vector 2 with a length of 500.
[0074] In the step S40, the formula of the target optimization function is:
[0075] F(x) = sigmoid(x) * (x high - x low ) + x low ;
[0076] sigmoid(x) = 1 / (1 + exp(-x));
[0077] Among them, F(x) represents the target optimization function; sigmoid(x) represents the activation function, which is used to map x to between 0 and 1; x high represents the constraint upper limit; x low represents the constraint lower limit; exp() represents the exponential function with the natural constant e as the base. Through the target optimization function, the predicted value of the health state estimation model is constrained within the interval [x high , x low .
[0078] A preferred embodiment of the lithium battery health state estimation system based on Transformer of the present invention includes the following modules:
[0079] Charging data acquisition module, which is used to acquire a large amount of charging data of lithium batteries;
[0080] Charging data set construction module, which is used to set a duration threshold, and based on the duration threshold, segment the charging data to obtain a charging data set;
[0081] Health state estimation model creation module, which is used to create a health state estimation model based on Transformer and train the health state estimation model using the charging data set;
[0082] A predicted value constraint module, configured to create a target optimization function and constrain the predicted value of the health state estimation model based on the target optimization function;
[0083] A health state estimation module, configured to estimate the health state of a lithium battery by using the health state estimation model.
[0084] In the charging data acquisition module, the charging data includes charging current, charging voltage, charging SOC, and battery capacity attenuation rate. The charging data is divided into three groups of data. The charging current is the first group of data, the charging voltage is the second group of data, and the charging SOC and the battery capacity attenuation rate are the third group of data.
[0085] The charging data set construction module is specifically configured to:
[0086] Set a duration threshold of 500 seconds, segment the charging data based on the duration threshold, fill the data with a length shorter than the duration threshold with 0, and construct a charging data set based on the segmented data. Since the input of the health state estimation model needs to be a vector with a fixed length, it is necessary to segment the charging data according to the duration threshold and fill the data with a length shorter than the duration threshold with 0; by segmenting the charging data, the feature expression of the entire data curve can be well retained.
[0087] In the health state estimation model creation module, the health state estimation model includes a vector conversion module (Embedding), a self-attention module, a sampling module (Mean pooling & Max Pooling), and a linear projection module (Linear); the vector conversion module, the self-attention module, the sampling module, and the linear projection module are connected in sequence;
[0088] The self-attention module includes three Transformer layers. By adopting the three Transformer layers, the expression ability of the model is greatly improved;
[0089] The vector conversion module is configured to convert the charging data in the charging data set into feature vectors;
[0090] The sampling module is configured to perform average sampling and maximum value sampling on the output of the self-attention module, and the mathematical representation is:
[0091]
[0092]
[0093] Wherein, represents the convolution window; xkpq Represents the original value within the convolutional window; the matrices obtained through this formula are concatenated and finally transformed into a matrix shape of [500, 128];
[0094] The linear projection module is used to perform linear calculations on the output of the sampling module to obtain the predicted value of the health status estimation model, which is mathematically expressed as:
[0095] Y = LN(Z 3 ) = Z 3 W + b;
[0096] The shape of the data obtained through upsampling in the upper layer is [500, 128]. Then, the data is stretched into a one-dimensional vector through the straightening method and finally transformed into a matrix shape of [1];
[0097] The mathematical representation of the Transformer layer is:
[0098]
[0099] Z 2 = FFN(Z) = max(0, ZW 1 + b 1 )W 2 + b 2 ;
[0100] Among them, Q, K, and V are the same matrices with a shape of [3, 128]; d k is the arithmetic square root of 128; FFN() is the linear projection layer, which finally transforms the matrix with a shape of [500, 128] into a matrix with a shape of [500, 256]; Z represents the output value of the Attention function, which is a matrix with a shape of [500, 128]; Z 2 represents the output value of the FFN function, which is a matrix with a shape of [500, 256]; W 1 represents the parameter matrix 1 with a shape of [128, 256]; W 2 represents the parameter matrix 2 with a shape of [128, 256]; b 1 represents the bias vector 1 with a length of 500; b 2 represents the bias vector 2 with a length of 500.
[0101] In the prediction value constraint module, the formula of the objective optimization function is:
[0102] F(x) = sigmoid(x) * (x high - x low ) + x low ;
[0103] sigmoid(x) = 1 / (1 + exp(-x));
[0104] where F(x) represents the objective optimization function; sigmoid(x) represents the activation function, which is used to map x to the range between 0 and 1; x high represents the upper bound of the constraint; x low represents the lower bound of the constraint; exp() represents the exponential function with the natural constant e as the base. Through the objective optimization function, the predicted value of the health state estimation model is constrained within the interval [x high , x low .
[0105] In summary, the advantages of the present invention are as follows:
[0106] By using Transformer to create a health state estimation model, the model structure is simple. The vector conversion module of the health state estimation model is used to convert the charging data into feature vectors and input them into the self-attention module. The self-attention module captures features from the feature vectors. The sampling module performs average sampling and maximum sampling on the output of the self-attention module. That is, the method of automatic feature extraction through deep learning is used instead of traditional manual feature extraction. It can not only better capture the feature representation of long time series, but also reduce the model development time. And because deep learning fits the algorithm from a large amount of charging data, it has better generalization ability than traditional methods, and finally greatly improves the accuracy and generalization ability of lithium battery health state estimation.
[0107] Although the specific embodiments of the present invention have been described above, those skilled in the art of this technology should understand that the specific embodiments we described are illustrative rather than used to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered by the scope protected by the claims of the present invention.
Claims
1. A method for estimating the health state of a lithium battery based on Transformer, characterized in that: It includes the following steps: Step S10: Obtain a large amount of charging data of lithium batteries; Step S20: Set a time duration threshold, and segment the charging data based on the time duration threshold to obtain a charging data set; Step S30: Create a health state estimation model based on Transformer, and use the charging data set to train the health state estimation model; The health state estimation model includes a vector conversion module, a self-attention module, a sampling module, and a linear projection module; the vector conversion module, the self-attention module, the sampling module, and the linear projection module are connected in sequence; The self-attention module includes three Transformer layers; The vector conversion module is used to convert the charging data in the charging data set into feature vectors; The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module; The linear projection module is used to perform linear calculations on the output of the sampling module to obtain the predicted value of the health state estimation model; Step S40: Create a target optimization function, and constrain the predicted value of the health state estimation model based on the target optimization function; Step S50: Use the health state estimation model to estimate the health state of the lithium battery.
2. The method for estimating the health state of a lithium battery based on Transformer according to claim 1, characterized in that: In step S10, the charging data includes charging current, charging voltage, charging SOC, and battery capacity attenuation rate.
3. The method for estimating the health state of a lithium battery based on Transformer according to claim 1, characterized in that: Step S20 is specifically: Set a time duration threshold of 500 seconds, segment the charging data based on the time duration threshold, fill the data shorter than the time duration threshold with 0, and construct a charging data set based on the segmented data.
4. The method for estimating the health state of a lithium battery based on Transformer according to claim 1, characterized in that: In step S40, the formula of the target optimization function is: F(x) = sigmoid(x) * (x high - x low ) + x low ; sigmoid(x) = 1 / (1 + exp(-x)); Among them, F(x) represents the objective optimization function; sigmoid(x) represents the activation function, which is used to map x to the range between 0 and 1; x high represents the upper bound of the constraint; x low represents the lower bound of the constraint; exp() represents the exponential function with the natural constant e as the base.
5. A system for estimating the health state of a lithium battery based on Transformer, characterized in that: It includes the following modules: A charging data acquisition module for obtaining a large amount of charging data of lithium batteries; A charging data set construction module for setting a time duration threshold and segmenting the charging data based on the time duration threshold to obtain a charging data set; A health state estimation model creation module for creating a health state estimation model based on Transformer and training the health state estimation model using the charging data set; The health state estimation model includes a vector conversion module, a self-attention module, a sampling module, and a linear projection module; the vector conversion module, the self-attention module, the sampling module, and the linear projection module are connected in sequence; The self-attention module includes three Transformer layers; The vector conversion module is used to convert the charging data in the charging dataset into feature vectors; The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module; The linear projection module is used to perform linear calculations on the output of the sampling module to obtain the predicted value of the health state estimation model; The predicted value constraint module is used to create an objective optimization function and constrain the predicted value of the health state estimation model based on the objective optimization function; The health state estimation module is used to estimate the health state of the lithium battery using the health state estimation model.
6. The lithium battery health state estimation system based on Transformer according to claim 5, wherein: In the charging data acquisition module, the charging data includes charging current, charging voltage, charging SOC, and battery capacity attenuation rate.
7. The lithium battery health state estimation system based on Transformer according to claim 5, wherein: The charging dataset construction module is specifically used for: Setting a duration threshold of 500 seconds, segmenting the charging data based on the duration threshold, filling the data shorter than the duration threshold with 0, and constructing a charging dataset based on the segmented data.
8. The lithium battery health state estimation system based on Transformer according to claim 5, wherein: In the predicted value constraint module, the formula of the objective optimization function is: F(x) = sigmoid(x) * (x high - x low ) + x low ; sigmoid(x) = 1 / (1 + exp(-x)); Among them, F(x) represents the objective optimization function; sigmoid(x) represents the activation function, which is used to map x to the range between 0 and 1; x high represents the upper bound of the constraint; x low represents the lower bound of the constraint; exp( ) represents the exponential function with the natural constant e as the base.
Citation Information
Patent Citations
Method, system and equipment for predicting initial capacity and health state of battery
CN112213643A
Transform-based energy storage battery life prediction algorithm
CN115267575A