A Lithium Battery Aging Prediction Method and System Based on Multi-Task Learning
By using multi-task learning method and Transformer model in lithium battery aging prediction, combining mean square error and cosine similarity loss function for training, the problem of insufficient accuracy, speed and generalization of the existing lithium battery aging prediction methods is solved, and a more efficient multi-task prediction effect is achieved.
Patent Information
- Application Number
- CN202211639313.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-12-20
AI Technical Summary
The existing lithium battery aging prediction methods have problems with insufficient accuracy, speed and generalization, especially the single-task prediction model cannot effectively utilize the correlation between multiple tasks, resulting in poor prediction accuracy and generalization.
Using a multi-task learning method, a multi-task online charging data set is constructed, and an aging prediction model is created using Transformer, combining mean square error loss function and cosine similarity loss function for training to achieve mutual supervision and feature extraction between multi-task labels.
It improves the accuracy, speed and generalization of lithium battery aging prediction, and can simultaneously predict the battery health status, the number of equivalent charge and discharge cycles and capacity attenuation trends, avoiding the disadvantages of independent models in traditional methods.
Smart Images

Figure CN116298902B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of lithium battery detection, and particularly to a lithium battery aging prediction method and system based on multi-task learning. Background Art
[0002] Due to the advantages of high energy density, low self-discharge rate, low price, and long service life, lithium batteries have become a widely used energy tool. However, as the usage time of lithium batteries increases, the actual available capacity decreases and the remaining life reduces accordingly. If the aging of lithium batteries cannot be accurately predicted, it will bring certain safety hazards to the use of lithium batteries.
[0003] The aging prediction of lithium batteries includes the estimation of the state of health (SOH) of the battery and the prediction of the capacity attenuation trend. There are two traditional prediction methods as follows:
[0004] 1. Theoretical modeling method: It is divided into an electrochemical model and an equivalent circuit model. The electrochemical model simplifies the lithium battery into a system composed of a positive electrode, a negative electrode, a separator, and an electrolyte, and establishes a battery model based on electrochemical theories such as electrochemical reactions, ion diffusion, and polarization effects inside the lithium battery to analyze and master the battery laws. The equivalent circuit model refers to using basic electrical components such as capacitors, resistors, and voltage sources to describe the dynamic output characteristics of lithium batteries, and most of the equivalent circuit models are created based on Kirchhoff's voltage law and current law.
[0005] However, the model construction of this method is difficult, it is also difficult to obtain high prediction accuracy, and due to the large differences between lithium battery monomers, good model generalization cannot be obtained.
[0006] 2. Deep learning method: The deep neural network model is a multi-layer hidden neuron network used to describe the strong non-linear relationship between input and output. Therefore, the deep neural network model can be trained or learned to extract the potential characteristics inside the lithium battery from big data.
[0007] Although this method will obtain higher accuracy and generalization than the theoretical modeling method through the training of a large dataset, currently, the lithium battery aging prediction based on deep learning is mostly single-task prediction. One model can only predict one battery characteristic. For example, to predict the capacity attenuation rate and the remaining cycle life, two models are required respectively. This not only increases the training cost of the neural network, but also increases the storage cost and calculation cost during model deployment, and reduces the prediction speed. In addition, the single-task prediction model does not consider that simultaneous learning of multiple tasks can not only supervise each other and reduce noise, but also the correlation between multiple tasks helps the model extract more generalizable features, resulting in suboptimal overall prediction accuracy and generalization.
[0008] Therefore, how to provide a lithium battery aging prediction method and system based on multi-task learning to improve the accuracy, speed, and generalization of lithium battery aging prediction has become an urgent technical problem to be solved. Summary of the Invention
[0009] The technical problem to be solved by the present invention is to provide a lithium battery aging prediction method and system based on multi-task learning to improve the accuracy, speed, and generalization of lithium battery aging prediction.
[0010] In a first aspect, the present invention provides a lithium battery aging prediction method based on multi-task learning, including the following steps:
[0011] Step S10: Obtain a large amount of lithium battery charging data, construct an online charging data set with multiple tasks based on each piece of the lithium battery charging data, and divide the online charging data set into a training set and a test set;
[0012] Step S20: Preprocess the lithium battery charging data in the training set and the test set;
[0013] Step S30: Create an aging prediction model based on Transformer;
[0014] Step S40: Set the loss function of the aging prediction model, and train and test the aging prediction model based on the training set, the test set, and the loss function;
[0015] Step S50: Use the aging prediction model that has passed the test to predict the aging of the lithium battery.
[0016] Further, the step S10 specifically includes:
[0017] Step S11: Obtain a large amount of lithium battery charging data recorded under standard working condition cycle tests, including charging voltage, charging current, SOC, rated voltage, rated capacity, capacity attenuation rate, and charging time;
[0018] Step S12: Simulate the online charging scenario of the lithium battery based on each piece of the lithium battery charging data, and extract a three-element time series including charging voltage, charging current, and SOC within any SOC interval;
[0019] Step S13: Extract the capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law corresponding to the three-element time series based on the lithium battery charging data;
[0020] Step S14: Construct several task labels with charging voltage, charging current, and SOC as inputs and capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law as outputs, and construct an online charging data set based on each of the task labels;
[0021] Step S15: Set a ratio threshold, and divide the online charging dataset into a training set and a test set based on the ratio threshold.
[0022] Further, the specific steps of step S20 are as follows:
[0023] Divide the charging voltage in the training set and the test set by the rated voltage to normalize it to the range of [0, 1], and divide the charging current in the training set and the test set by the rated capacity to normalize it into a charging rate curve;
[0024] Perform equal-length processing on the lithium battery charging data in the normalized training set and test set.
[0025] Further, in step S30, the aging prediction 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;
[0026] The self-attention module includes three Transformer layers;
[0027] The vector conversion module is used to convert the lithium battery charging data in the online charging dataset into feature vectors;
[0028] The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module;
[0029] 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 aging prediction model.
[0030] Further, the specific steps of step S40 include:
[0031] Step S41: Set the loss function of the aging prediction model and set a loss threshold; the formula of the loss function is:
[0032] loss = mse + similarity;
[0033] where loss represents the loss function; mse represents the mean square error loss function; similarity represents the cosine similarity loss function;
[0034] Step S42: Use the training set to train the aging prediction model;
[0035] Step S43: Use the test set to test the aging prediction model, and determine whether the loss value calculated by the loss function is less than the loss threshold. If so, go to step S50; if not, expand the training set and go to step S42.
[0036] In a second aspect, the present invention provides a lithium battery aging prediction system based on multi-task learning, including the following modules:
[0037] An online charging dataset construction module, configured to obtain a large amount of lithium battery charging data, construct a multi-task online charging dataset based on each of the lithium battery charging data, and divide the online charging dataset into a training set and a test set;
[0038] A data preprocessing module, configured to preprocess the lithium battery charging data in the training set and the test set;
[0039] An aging prediction model creation module, configured to create an aging prediction model based on Transformer;
[0040] An aging prediction model training module, configured to set a loss function for the aging prediction model, and train and test the aging prediction model based on the training set, the test set, and the loss function;
[0041] An aging prediction module, configured to perform aging prediction on a lithium battery by using the aging prediction model that has passed the test.
[0042] Further, the online charging dataset construction module specifically includes:
[0043] A lithium battery charging data acquisition unit, configured to obtain a large amount of lithium battery charging data recorded under standard working condition cycle tests, including charging voltage, charging current, SOC, rated voltage, rated capacity, capacity attenuation rate, and charging time;
[0044] A ternary time series extraction unit, configured to simulate the online charging scenario of a lithium battery based on each of the lithium battery charging data, and extract a ternary time series including charging voltage, charging current, and SOC within any SOC interval;
[0045] An output data extraction unit, configured to extract the capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law corresponding to the ternary time series based on the lithium battery charging data;
[0046] A task label construction unit, configured to construct a plurality of task labels with input being charging voltage, charging current, and SOC and output being capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law, and construct an online charging dataset based on each of the task labels;
[0047] A data division unit, configured to set a ratio threshold, and divide the online charging dataset into a training set and a test set based on the ratio threshold.
[0048] Further, the data preprocessing module is specifically configured to:
[0049] Divide the charging voltage in the training set and the test set by the rated voltage to normalize it into the range of [0, 1], and divide the charging current in the training set and the test set by the rated capacity to normalize it into a charging rate curve;
[0050] Perform equal-length processing on the lithium battery charging data in the normalized training set and test set.
[0051] Further, in the aging prediction model creation module, the aging prediction 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;
[0052] The self-attention module includes three Transformer layers;
[0053] The vector conversion module is used to convert the lithium battery charging data in the online charging dataset into feature vectors;
[0054] The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module;
[0055] 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 aging prediction model.
[0056] Further, the aging prediction model training module specifically includes:
[0057] A loss function setting unit, used to set the loss function of the aging prediction model and set a loss threshold; the formula of the loss function is:
[0058] loss = mse + similarity;
[0059] Among them, loss represents the loss function; mse represents the mean square error loss function; similarity represents the cosine similarity loss function;
[0060] A training unit, used to train the aging prediction model using the training set;
[0061] A testing unit, used to test the aging prediction model using the test set, and determine whether the loss value calculated by the loss function is less than the loss threshold. If so, enter the aging prediction module; if not, expand the training set and enter the training unit.
[0062] The advantages of the present invention are:
[0063] Construct a number of task labels with input being charging voltage, charging current, and SOC and output being capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law through lithium battery charging data. Then, construct an online charging dataset based on each task label. Next, use the online charging dataset to train an aging prediction model created based on Transformer. Finally, use the aging prediction model to predict the aging of the lithium battery. That is, by training the aging prediction model with multi-task labels, the correlation between each task label can be used to mutually supervise the training of the aging prediction model, reduce the influence brought by noise, and improve the generalization of the aging prediction model. Moreover, Transformer can effectively capture the potential relationship of the information before and after a sequence, can efficiently fuse the implicit features between different time series, and can extract more general high-dimensional space features. By combining the mean square error loss function and the cosine similarity loss function to construct the loss function of the aging prediction model, the overall distribution similarity between two vectors can be calculated, enabling the aging prediction model to learn in a more favorable direction. The trained aging prediction model can simultaneously predict the battery health state (capacity attenuation rate), equivalent charge-discharge cycle times, and capacity attenuation trend (attenuation law), without the need to predict through independent models as in the traditional way, ultimately greatly improving the accuracy, speed, and generalization of lithium battery aging prediction. Brief Description of the Drawings
[0064] The present invention will be further described below with reference to the accompanying drawings in conjunction with embodiments.
[0065] Figure 1 It is a flowchart of a lithium battery aging prediction method based on multi-task learning of the present invention.
[0066] Figure 2 It is a schematic structural diagram of a lithium battery aging prediction system based on multi-task learning of the present invention.
[0067] Figure 3 It is a schematic structural diagram of the aging prediction model of the present invention.
[0068] Figure 4 It is a schematic curve diagram of the attenuation law of the present invention.
[0069] Figure 5 It is a comparison schematic diagram between the multi-task learning model and the single-task learning model of the present invention. Detailed Embodiments
[0070] The overall idea of the technical solution in the embodiments of this application is as follows: The aging prediction model is trained through multi-task labels, and the training of the aging prediction model is mutually supervised by using the correlation between each task label, reducing the influence brought by noise, improving the generalization of the aging prediction model, that is, enhancing the generalization of lithium battery aging prediction; The aging prediction model is created through Transformer to extract more general high-dimensional space features, and the loss function of the aging prediction model is constructed by combining the mean square error loss function and the cosine similarity loss function, enabling the aging prediction model to learn in a more favorable direction to improve the accuracy of lithium battery aging prediction; The aging prediction model is trained through multi-task labels, so that the trained aging prediction model can simultaneously predict the battery health state (capacity attenuation rate), equivalent charge and discharge cycle times, and capacity attenuation trend (attenuation law), so as to improve the speed of lithium battery aging prediction.
[0071] Please refer to Figures 1 to 5 As shown in the figure, a preferred embodiment of a lithium battery aging prediction method based on multi-task learning according to the present invention includes the following steps:
[0072] Step S10: Obtain a large amount of lithium battery charging data, construct a multi-task online charging data set based on each of the lithium battery charging data, and divide the online charging data set into a training set and a test set;
[0073] Step S20: Preprocess the lithium battery charging data in the training set and the test set;
[0074] Step S30: Create an aging prediction model based on Transformer;
[0075] That is, through Transformer, high-dimensional fusion features are extracted from the charging voltage, charging current, and SOC curves in any SOC interval, and then the high-dimensional fusion features are respectively input into three parallel fully connected layers FC1, FC2, and FC3 to obtain the capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law; The attenuation law is as Figure 4 shown. Starting from the current capacity attenuation rate A until the capacity attenuation rate drops to 80% (E), three points B, C, and D are equally spaced in the middle. The cycle numbers c1, c2, c3, and RUL (rest useful life, the remaining service life, referring to the number of cycles that the lithium battery can still be used from the current state to 80% capacity attenuation rate) of B, C, D, and E relative to the current point A are obtained, and then the capacity attenuation trend (attenuation law) is obtained through curve smoothing fitting;
[0076] Step S40: Set the loss function of the aging prediction model, and train and test the aging prediction model based on the training set, test set, and loss function; the trained aging prediction model is a multi-task model, which can not only predict the capacity attenuation rate of the current lithium battery, but also predict the capacity attenuation trend, providing users with more dimensional information to help users more intuitively understand the state of the lithium battery;
[0077] Step S50: Use the aging prediction model that has passed the test to perform aging prediction on the lithium battery, that is, predict the capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law.
[0078] Traditionally, for the online detection of lithium batteries during the charging of new energy vehicles, only time series signals such as voltage, current, and temperature within a limited and non-fixed charging SOC interval can be obtained. Therefore, it is impossible to calculate the current capacity of the lithium battery using the ampere-hour integration method or the OCV model, etc., and it is even more impossible to obtain its subsequent capacity attenuation trend, while the present invention can exactly overcome the traditional drawbacks.
[0079] The specific steps of step S10 include:
[0080] Step S11: Obtain a large amount of lithium battery charging data recorded under standard working condition cycle tests, including charging voltage, charging current, SOC, rated voltage, rated capacity, capacity attenuation rate, and charging time;
[0081] Step S12: Simulate the online charging scenario of the lithium battery based on each lithium battery charging data, and randomly extract a three-element time series including charging voltage, charging current, and SOC within any SOC interval;
[0082] Step S13: Extract the capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law corresponding to the three-element time series based on the lithium battery charging data;
[0083] Step S14: Construct a number of task labels with input of charging voltage, charging current, and SOC and output of capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law, and construct an online charging data set based on each task label;
[0084] Step S15: Set a ratio threshold, and divide the online charging data set into a training set and a test set based on the ratio threshold; the ratio threshold can be selected as 8:2 or 7:3.
[0085] The specific step of step S20 is:
[0086] Divide the charging voltage in the training set and the test set by the rated voltage to normalize it to the interval of [0, 1], and divide the charging current in the training set and the test set by the rated capacity to normalize it into a charging rate curve;
[0087] Perform equal-length processing on the lithium battery charging data in the normalized training set and test set.
[0088] During online charging, it may be in any SOC interval. Therefore, the lengths of the input charging voltage, charging current, and SOC are arbitrary, while the input length of the aging prediction model is preset. For example, the set value is 2048. Therefore, for those with a length less than 2048, they need to be padded with 0s at the back, and for those with a length greater than 2048, the extra part needs to be truncated and discarded, so that the dimension of the input variable is [batch_size, 3, 2048], where batch_size is the batch size for training the aging prediction model.
[0089] In step S30, the aging prediction 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, self-attention module, sampling module, and linear projection module are connected in sequence;
[0090] The self-attention module includes three Transformer layers. By using these three Transformer layers, the expression ability of the model is greatly improved;
[0091] The vector conversion module is used to convert the lithium battery charging data in the online charging dataset into feature vectors;
[0092] The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module, and the mathematical expression is:
[0093]
[0094]
[0095] where represents the convolutional window; x kpq represents the original value within the convolutional window; the matrices obtained by calculating through this formula are concatenated, and finally transformed into a matrix shape of [2048, 512];
[0096] 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 aging prediction model. The mathematical expression is:
[0097] Y = LN(Z3) = Z3W + b;
[0098] The shape of the data after upsampling is [2048, 512]. Then, the data is stretched into a one-dimensional vector by the straightening method and finally transformed into a matrix shape of [1, n], where n is the number of points for linear regression.
[0099] The mathematical representation of the Transformer layer is as follows:
[0100]
[0101] Z2 = FFN(Z) = max(0, ZW1 + b1)W2 + b2;
[0102] Among them, Q, K, and V are the same matrices with a shape of [3, 512]; d k is the square root of 512; FFN() is a linear projection layer that finally transforms a matrix with a shape of [2048, 512] into a matrix with a shape of [2048, 1024]; Z represents the output value of the Attention function, which is a matrix with a shape of [2048, 512]; Z2 represents the output value of the FFN function, which is a matrix with a shape of [2048, 1024]; W1 represents parameter matrix 1 with a shape of [512, 1024]; W2 represents parameter matrix 2 with a shape of [512, 1024]; b1 represents bias vector 1 with a length of 2048; b2 represents bias vector 2 with a length of 2048.
[0103] Step S40 specifically includes:
[0104] Step S41: Set the loss function of the aging prediction model and set a loss threshold; the formula of the loss function is:
[0105] loss = mse + similarity;
[0106] Among them, loss represents the loss function; mse represents the mean squared error loss function; similarity represents the cosine similarity loss function;
[0107] The smaller the loss value calculated by the loss function, the better the training effect of the aging prediction model. The aging prediction model continuously optimizes the parameters through the backpropagation algorithm to optimize the loss value in the direction of continuous decrease;
[0108] The formula of the mean squared error loss function is:
[0109]
[0110] The formula of the cosine similarity loss function is:
[0111]
[0112] Among them, f(x) represents the predicted value; y represents the target value; A represents a vector composed of n points regressed by three FC layers; B represents the target vector;
[0113] Step S42: Use the training set to train the aging prediction model;
[0114] Step S43: Use the test set to test the aging prediction model, and determine whether the loss value calculated by the loss function is less than the loss threshold. If so, go to step S50; if not, expand the training set and go to step S42.
[0115] A preferred embodiment of a lithium battery aging prediction system based on multi-task learning according to the present invention includes the following modules:
[0116] An online charging dataset construction module, configured to obtain a large amount of lithium battery charging data, construct a multi-task online charging dataset based on each of the lithium battery charging data, and divide the online charging dataset into a training set and a test set;
[0117] A data preprocessing module, configured to preprocess the lithium battery charging data in the training set and the test set;
[0118] An aging prediction model creation module, configured to create an aging prediction model based on Transformer;
[0119] That is, through Transformer, high-dimensional fusion features are extracted from the curves of charging voltage, charging current, and SOC in any SOC interval, and then the high-dimensional fusion features are respectively input into three parallel fully connected layers FC1, FC2, and FC3 to obtain the capacity attenuation rate, the equivalent charge and discharge cycle times, and the attenuation law; the attenuation law is as Figure 4 shown. Starting from the current capacity attenuation rate A, until the capacity attenuation rate drops to 80% (E), three points B, C, and D are equally spaced in the middle, and the cycle numbers c1, c2, c3, and RUL (rest useful life, the remaining service life, referring to the number of cycles that the lithium battery can still be used from the current state to 80% capacity attenuation rate) of B, C, D, and E relative to the current point A are obtained, and then the capacity attenuation trend (attenuation law) is obtained through curve smoothing fitting;
[0120] An aging prediction model training module, configured to set the loss function of the aging prediction model, and train and test the aging prediction model based on the training set, the test set, and the loss function; the trained aging prediction model is a multi-task model, which can not only predict the capacity attenuation rate of the current lithium battery, but also predict the capacity attenuation trend, providing users with more dimensional information to help users more intuitively understand the state of the lithium battery;
[0121] An aging prediction module, which is used to predict the aging of a lithium battery by using the aging prediction model that has passed the test, that is, to predict the capacity attenuation rate, the equivalent charge and discharge cycle times, and the attenuation law.
[0122] Traditionally, for the on-line detection of lithium batteries during the charging of new energy vehicles, only time series signals such as voltage, current, and temperature within a limited and non-fixed charging SOC range can be obtained. Therefore, it is impossible to calculate the current capacity of the lithium battery by using the ampere-hour integration method or the OCV model, etc., and it is even more impossible to obtain its subsequent capacity attenuation trend. However, the present invention can exactly overcome the traditional drawbacks.
[0123] The on-line charging data set construction module specifically includes:
[0124] A lithium battery charging data acquisition unit, which is used to acquire a large amount of lithium battery charging data recorded under standard working condition cycle tests, including charging voltage, charging current, SOC, rated voltage, rated capacity, capacity attenuation rate, and charging time;
[0125] A three-element time series extraction unit, which is used to simulate the on-line charging scenario of the lithium battery based on each of the lithium battery charging data, and randomly extract a three-element time series including charging voltage, charging current, and SOC within any SOC range;
[0126] An output data extraction unit, which is used to extract the capacity attenuation rate, the equivalent charge and discharge cycle times, and the attenuation law corresponding to the three-element time series based on the lithium battery charging data;
[0127] A task label construction unit, which is used to construct a number of task labels with charging voltage, charging current, and SOC as inputs and capacity attenuation rate, equivalent charge and discharge cycle times, and attenuation law as outputs, and construct an on-line charging data set based on each of the task labels;
[0128] A data division unit, which is used to set a ratio threshold, and divide the on-line charging data set into a training set and a test set based on the ratio threshold; the ratio threshold can be selected as 8:2 or 7:3.
[0129] The data preprocessing module is specifically used for:
[0130] Dividing the charging voltage in the training set and the test set by the rated voltage to normalize it into the range of [0, 1], and dividing the charging current in the training set and the test set by the rated capacity to normalize it into a charging rate curve;
[0131] Performing equal-length processing on the normalized lithium battery charging data in the training set and the test set.
[0132] Since the online charging can occur in any SOC interval, the lengths of the input charging voltage, charging current, and SOC are arbitrary. However, the input length of the aging prediction model is preset, for example, the set value is 2048. Therefore, for those with a length less than 2048, they need to be padded with 0s at the end, and for those with a length greater than 2048, the excess part needs to be truncated and discarded, so that the dimension of the input variable is [batch_size, 3, 2048], where batch_size is the batch size for training the aging prediction model.
[0133] In the aging prediction model creation module, the aging prediction model includes an Embedding module, a self-attention module, a sampling module (Mean pooling&Max Pooling), and a linear projection module (Linera); the Embedding module, self-attention module, sampling module, and linear projection module are connected in sequence;
[0134] The self-attention module includes three Transformer layers. By using these three Transformer layers, the expression ability of the model is greatly improved;
[0135] The Embedding module is used to convert the lithium battery charging data in the online charging dataset into feature vectors;
[0136] The sampling module is used to perform average sampling and maximum sampling on the output of the self-attention module, and the mathematical expression is:
[0137]
[0138]
[0139] where, 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 transformed into a matrix shape of [2048, 512];
[0140] 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 aging prediction model. The mathematical expression is:
[0141] Y = LN(Z3) = Z3W + b;
[0142] The data shape of the upper-layer sampling is [2048, 512]. Then, the data is stretched into a 1D vector by the flattening method, and finally transformed into a matrix shape of [1, n], where n is the number of points for Linera regression;
[0143] The mathematical representation of the Transformer layer is as follows:
[0144]
[0145] Z2 = FFN(Z) = max(0, ZW1 + b1)W2 + b2;
[0146] Among them, Q, K, and V are the same matrices with a shape of [3, 512]; d k is the square root of 512; FFN() is a linear projection layer that finally converts a matrix with a shape of [2048, 512] into a matrix with a shape of [2048, 1024]; Z represents the output value of the Attention function, which is a matrix with a shape of [2048, 512]; Z2 represents the output value of the FFN function, which is a matrix with a shape of [2048, 1024]; W1 represents parameter matrix 1 with a shape of [512, 1024]; W2 represents parameter matrix 2 with a shape of [512, 1024]; b1 represents bias vector 1 with a length of 2048; b2 represents bias vector 2 with a length of 2048.
[0147] The aging prediction model training module specifically includes:
[0148] A loss function setting unit for setting the loss function of the aging prediction model and setting a loss threshold; the formula of the loss function is:
[0149] loss = mse + similarity;
[0150] Among them, loss represents the loss function; mse represents the mean square error loss function; similarity represents the cosine similarity loss function;
[0151] The smaller the loss value calculated by the loss function, the better the training effect of the aging prediction model. The aging prediction model continuously optimizes the parameters through the backpropagation algorithm to optimize the loss value in the direction of continuous decrease;
[0152] The formula of the mean square error loss function is:
[0153]
[0154] The formula of the cosine similarity loss function is:
[0155]
[0156] Among them, f(x) represents the predicted value; y represents the target value; A represents a vector composed of n points regressed by three FC layers; B represents the target vector;
[0157] A training unit for training an aging prediction model using the training set;
[0158] A testing unit for testing the aging prediction model using the test set, and determining whether the loss value calculated by the loss function is less than the loss threshold. If so, it enters the aging prediction module; if not, it expands the training set and enters the training unit.
[0159] In summary, the advantages of the present invention are as follows:
[0160] By constructing a number of task labels with input of charging voltage, charging current, and SOC and output of capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law from lithium battery charging data, then constructing an online charging data set based on each task label, and then training an aging prediction model created based on Transformer using the online charging data set. Finally, using the aging prediction model to predict the aging of lithium batteries, that is, training the aging prediction model through multi-task labels. The correlation between each task label can be used to mutually supervise the training of the aging prediction model, reduce the influence brought by noise, and improve the generalization of the aging prediction model. And Transformer can effectively capture the potential relationship of the information before and after a sequence, can efficiently fuse the implicit features between different time series, and can extract more general high-dimensional space features. By combining the mean square error loss function and the cosine similarity loss function to construct the loss function of the aging prediction model, the overall distribution similarity between two vectors can be calculated, enabling the aging prediction model to learn in a more favorable direction. The trained aging prediction model can simultaneously predict the battery health state (capacity attenuation rate), equivalent charge-discharge cycle times, and capacity attenuation trend (attenuation law), without the need to predict through independent models as in the traditional way. Ultimately, the accuracy, speed, and generalization of lithium battery aging prediction are greatly improved.
[0161] Although the specific implementation manners 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 changes 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 lithium battery aging prediction method based on multi-task learning, characterized in that: It includes the following steps: Step S10: Obtain a large amount of lithium battery charging data, construct an online charging dataset for multi-tasks based on each piece of the lithium battery charging data, and divide the online charging dataset into a training set and a test set; Step S20: Preprocess the lithium battery charging data in the training set and the test set; Step S30: Create an aging prediction model based on Transformer; The aging prediction 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 lithium battery charging data in the online 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, and then obtain the prediction value of the aging prediction model; Step S40: Set the loss function of the aging prediction model, and train and test the aging prediction model based on the training set, the test set, and the loss function; Step S50: Use the aging prediction model that passes the test to predict the aging of the lithium battery.
2. The lithium battery aging prediction method based on multi-task learning according to claim 1, characterized in that: The specific content of step S10 includes: Step S11: Obtain a large amount of lithium battery charging data recorded under standard working condition cycle tests, including charging voltage, charging current, SOC, rated voltage, rated capacity, capacity attenuation rate, and charging time; Step S12: Simulate the online charging scenario of the lithium battery based on each piece of the lithium battery charging data, and extract a three-element time series including charging voltage, charging current, and SOC within any SOC interval; Step S13: Extract the capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law corresponding to the three-element time series based on the lithium battery charging data; Step S14: Construct several task labels with input of charging voltage, charging current, and SOC and output of capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law, and construct an online charging dataset based on each task label; Step S15: Set a proportion threshold, and divide the online charging dataset into a training set and a test set based on the proportion threshold.
3. The lithium battery aging prediction method based on multi-task learning according to claim 1, characterized in that: The specific content of step S20 is: Divide the charging voltage in the training set and the test set by the rated voltage to normalize it to the interval of [0, 1], and divide the charging current in the training set and the test set by the rated capacity to normalize it into a charging rate curve; Perform equal-length processing on the lithium battery charging data in the normalized training set and test set.
4. The lithium battery aging prediction method based on multi-task learning according to claim 1, characterized in that: The specific content of step S40 includes: Step S41: Set the loss function of the aging prediction model and set a loss threshold; the formula of the loss function is: loss = mse + similarity; where loss represents the loss function; mse represents the mean square error loss function; similarity represents the cosine similarity loss function; Step S42: Train the aging prediction model using the training set; Step S43: Test the aging prediction model using the test set, and determine whether the loss value calculated by the loss function is less than the loss threshold. If so, proceed to Step S50; if not, expand the training set and proceed to Step S42.
5. A lithium battery aging prediction system based on multi-task learning, characterized in that: It includes the following modules: Online charging dataset construction module, which is used to obtain a large amount of lithium battery charging data, construct a multi-task online charging dataset based on each lithium battery charging data, and divide the online charging dataset into a training set and a test set; Data preprocessing module, which is used to preprocess the lithium battery charging data in the training set and the test set; Aging prediction model creation module, which is used to create an aging prediction model based on Transformer; The aging prediction 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 lithium battery charging data in the online 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 prediction value of the aging prediction model; Aging prediction model training module, which is used to set the loss function of the aging prediction model, and train and test the aging prediction model based on the training set, the test set, and the loss function; Aging prediction module, which is used to predict the aging of lithium batteries using the aging prediction model that has passed the test.
6. The lithium battery aging prediction system based on multi-task learning according to claim 5, wherein: The online charging dataset construction module specifically includes: Lithium battery charging data acquisition unit, which is used to obtain a large amount of lithium battery charging data recorded under standard working condition cycle tests, including charging voltage, charging current, SOC, rated voltage, rated capacity, capacity attenuation rate, and charging time; Ternary time series extraction unit, which is used to simulate the online charging scenario of lithium batteries based on each lithium battery charging data, and extract the ternary time series including charging voltage, charging current, and SOC within any SOC interval; Output data extraction unit, which is used to extract the capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law corresponding to the ternary time series based on the lithium battery charging data; Task label construction unit, which is used to construct several task labels with input of charging voltage, charging current, and SOC and output of capacity attenuation rate, equivalent charge-discharge cycle times, and attenuation law, and construct an online charging dataset based on each task label; Data division unit, which is used to set a ratio threshold and divide the online charging dataset into a training set and a test set based on the ratio threshold.
7. The lithium battery aging prediction system based on multi-task learning according to claim 5, wherein: The data preprocessing module is specifically used for: Dividing the charging voltage in the training set and the test set by the rated voltage to normalize it to the interval of [0, 1], and dividing the charging current in the training set and the test set by the rated capacity to normalize it into a charge rate curve; Perform equal-length processing on the lithium battery charging data in the normalized training set and test set.
8. The lithium battery aging prediction system based on multi-task learning according to claim 5, wherein: The aging prediction model training module specifically includes: A loss function setting unit for setting the loss function of the aging prediction model and setting a loss threshold; the formula of the loss function is: loss = mse + similarity; where loss represents the loss function; mse represents the mean squared error loss function; similarity represents the cosine similarity loss function; A training unit for training the aging prediction model using the training set; A testing unit for testing the aging prediction model using the test set, determining whether the loss value calculated by the loss function is less than the loss threshold. If so, enter the aging prediction module; if not, expand the training set and enter the training unit.
Citation Information
Patent Citations
Transformer-based deep learning battery state of charge (SOC) estimation system and method
CN113673176A