An Interpretable Battery Life Prediction Method Based on Transformer Encoding Layer (BLP-Transformer)
Through the battery life prediction method based on the Transformer encoding layer, the problem of lack of interpretability of machine learning models in battery life prediction is solved, accurate prediction of battery life and interpretable analysis of the model are achieved, and the application value of the model is improved.
Patent Information
- Application Number
- CN202311028314.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2043-08-15
AI Technical Summary
Existing machine learning models lack interpretability in battery life prediction and have difficulty providing reliable explanations, hindering their widespread application in the automotive industry.
An interpretable battery life prediction method based on Transformer coding layer (BLP-Transformer) is adopted. By preprocessing and extracting features of battery-related data, combining position coding information for learning and encoding, and using feature selection masks and multi-layer feedforward neural networks for linear transformation and decoding, the feature importance is quantified to improve the interpretability of the model.
It achieves accurate prediction of battery life and provides model interpretability, which improves the application value and credibility of the model and helps understand the model's behavior and decision-making basis.
Smart Images

Figure CN117009749B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning, and in particular relates to an interpretable battery life prediction method based on Transformer coding layers (BLP-Transformer). Background Art
[0002] Batteries are a core component of electric vehicles, directly impacting their range, performance, and service life. Predicting battery lifespan is crucial to helping vehicle owners and manufacturers better manage and maintain batteries. Currently, machine learning algorithms have achieved promising results in predicting battery lifespan. However, the lack of interpretability in currently used machine learning models makes it difficult to provide reliable explanations for predictions, hindering their widespread adoption in the automotive industry. The Transformer model, a neural network proposed in 2017, learns context and meaning by tracking relationships within sequential data. The Transformer model is one of the most powerful models currently available and has significantly advanced machine learning. To address these challenges, the present invention proposes an interpretable battery lifespan prediction method based on the Transformer coding layer (BLP-Transformer). This method not only accurately predicts battery lifespan but also provides interpretability for the results. Model interpretability facilitates analysis of model performance, deriving optimal model performance, and clarifying the underlying principles of data processing tasks. Summary of the Invention
[0003] In response to the problem that current machine learning prediction of battery life lacks interpretability, the present invention proposes an interpretable battery life prediction method based on Transformer coding layer (BLP-Transformer).
[0004] The technical solution of the present invention is: an interpretable battery life prediction method based on Transformer coding layer (BLP-Transformer), characterized by comprising the following steps:
[0005] S1: Preprocess the data based on battery-related data;
[0006] S2: Input the data into the interpretable battery life prediction algorithm (BLP-transformer) structure, extract features from the input data set, and generate feature selection masks
[0007] S3: The model learns and encodes the feature selection mask based on the positional encoding information of the data to obtain the encoded sequence;
[0008] S4: performing linear transformation and decoding on the encoded sequence to obtain a prediction result of the battery life;
[0009] S5: Combine the prediction results, aggregate the multi-step feature selection masks, quantify the feature importance, and obtain the interpretability of the model.
[0010] Furthermore, step S1 includes the following sub-steps:
[0011] S11. Expand the existing battery data set. The original battery data includes information about the battery's RUL, voltage, current, battery temperature, internal resistance, and charging time. Calculate the skewness, kurtosis, and temperature integral of the battery capacity decay curve for the input data, as well as the slope and intercept of its linear fit. Use the calculated data as expanded data set information to assist model calculations.
[0012] S12. Filter the expanded data set using a median filter to obtain an input data set.
[0013] Furthermore, step S2 includes the following sub-steps:
[0014] S21, normalize the input data set to obtain the normalized sequence f1(a1)~f N (a N );
[0015] Among them, f i (a i ) represents the input sequence a for the i-th decision step i The normalized result obtained, i represents the i-th decision step, and i ranges from 1 to N.
[0016] S22, f i (a i ) and prior scale information P i-1 Multiply and get the result P i-1 ·f i (a i )(1≤i≤N);
[0017] The initial value of the prior scale information is P0=1. B×t×f ;
[0018] Where B is the batch size, t is the number of decision steps, and f is the number of features in the input data. A decision step is the cycle of the entire method to reach the final decision result.
[0019] The formula for generating the prior scale information in the i-th decision step is as follows:
[0020]
[0021] Where γ is a relaxation parameter that measures the amount of feature usage in the prior scale term. When γ = 1, a feature can only be used in one decision step. As γ increases, the feature can be used more flexibly in multiple decision steps.
[0022] S23, Softmax function is based on the generated P i-1 ·f i (a1) Data pair feature selection mask extraction feature importance Mask i , and its calculation formula is:
[0023] Mask i =Softmax(P i-1 ·f i (a i ))
[0024] Among them, the specific formula of the Softmax function is:
[0025]
[0026] Among them, the feature selection mask is used to provide interpretable information of the model. By aggregating the feature selection mask, the importance of the global feature can be obtained, thereby achieving the interpretability of the model.
[0027] S24. Normalize the feature selection mask generated in each decision step to generate a normalized feature data sequence.
[0028] Furthermore, step S3 includes the following sub-steps:
[0029] S31. Calculate relative position information of the characteristic data sequence generated by S2 using sine and cosine functions of different frequencies. The corresponding calculation formula is:
[0030]
[0031]
[0032] Among them, pos represents the position of the encoding time step, s represents the dimension, and d model Represents the network output dimension.
[0033] S32, combining the feature data sequence and its relative position information to obtain a sequence to be learned;
[0034] S33, inputting the sequence to be learned into a multi-layer feedforward neural network to complete the learning of the data set and generate a data sequence after model learning;
[0035] The formula for a multi-layer feedforward neural network is:
[0036] FFN(x)=max(0,xW1+b1)W2+b2
[0037] Among them, the matrix where d ff is the inner dimension value. b1 and b2 are the parameters that need to be updated through learning, and x is the sequence to be learned generated by S32.
[0038] S34: normalize the data sequence generated in step S33 and combine it with the sequence to be learned generated in step S32 to form a data encoding sequence.
[0039] Furthermore, step S4 includes the following sub-steps:
[0040] S41, based on the encoded sequence output in step S3, linearly transform it to obtain a sequence to be activated;
[0041] S42. Perform LeakyReLU activation layer operation on the activation sequence to complete the prediction of battery degradation data and obtain the predicted data of the battery. The corresponding formula is:
[0042] d out =LeakyReLU(0,f x W0+b0)
[0043] Among them, the LeakyReLU function is a leaky linear rectifier function. Its formula is:
[0044]
[0045] Here, a is a constant less than 1, and a=0.01 is taken in the experiment.
[0046] Among them, d out is the decision output, which predicts the degradation data of the input sequence x; W0 and b0 are linear conversion constants, f x It is the sequence to be activated in step S41.
[0047] Furthermore, step S5 includes the following sub-steps:
[0048] S51. Aggregate the feature selection mask in each decision step and the predicted data output in step S4 into the aggregation module in the model. The aggregation module first analyzes the feature selection mask to determine the overall contribution of all features in a decision step to the global total. The calculation formula is:
[0049] η i =LeakyReLU(d out [i])
[0050] Among them, d out[i] represents the output feature of the i-th step decision, η i It represents the overall contribution of all features in the i-th decision step to the global picture.
[0051] η i The larger the value, the greater the contribution of the decision step to the model.
[0052] S52. Based on the overall contribution of all features in a decision step to the global model, the aggregation module further analyzes a feature in that step to clarify the cumulative contribution of a feature in the global model. The corresponding calculation formula is as follows:
[0053]
[0054] Among them, Mask i [j] represents the contribution of the jth feature to the decision in the i-th decision step. agg Represents the cumulative contribution of each feature in the global model.
[0055] S53, Mask the cumulative contribution value of each feature in the global model agg Normalization is performed to obtain the importance index of the global feature value feature_importance, that is, the interpretability of the model is 0. The calculation formula is:
[0056] feature importance =Norm(Mask agg )
[0057] Among them, the Norm function is a horizontal normalization function, and its formula is:
[0058]
[0059] Among them, μ and σ 2 Represents the mean and variance of the input, ∈ is a very small constant used to prevent the denominator from being 0. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Flow chart of the method of the present invention.
[0061] Figure 2 This is a comparison chart of the prediction results of the algorithm model proposed in the present invention in the test task and the perfect prediction results.
[0062] Figure 3 This is a comparison chart of the discharge capacity prediction results of test ID-3 in the preliminary test data set using the algorithm model proposed in the present invention and other prediction algorithm models.
[0063] Figure 4This is a comparison chart of the absolute error curves of the discharge capacity prediction results of test ID-3 in the preliminary test data set, relative to the observed values, for the algorithm model proposed in the present invention and other prediction algorithm models.
[0064] Figure 5 This is a comparison chart of the prediction effects of the algorithm model proposed in the present invention and other prediction algorithm models for the testID-21 data with a charging strategy of 2C (10%)-6C and a RUL of 148 cycles.
[0065] Figure 6 This is a comparison chart of the prediction effects of the algorithm model proposed in the present invention and other prediction algorithm models for the testID-6 data with a charging strategy of 6C (20%)-4.5C and a RUL of 466 cycles.
[0066] Figure 7 This is a comparison chart of the prediction effects of the algorithm model proposed in the present invention and other prediction algorithm models for testID-6 data with a charging strategy of 5.4C (40%)-3.6C and a RUL of 1054 cycles.
[0067] Figure 8 This is a comparison chart of the quantitative results of feature importance between the algorithm model proposed in this invention and other quantifiable and interpretable prediction algorithm models. DETAILED DESCRIPTION
[0068] The embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0069] Before describing the specific embodiments of the present invention, in order to make the solutions of the present invention clearer and more complete, the abbreviations and key terms used in the present invention are first defined as follows:
[0070] RUL: The number of charge and discharge cycles that the battery undergoes when its discharge capacity degrades to a specified threshold.
[0071] Limit threshold: defined as the ratio of battery capacity to nominal capacity. If it is lower than the limit threshold, the battery is considered unhealthy and an alarm is issued to the user.
[0072] Multi-layer feedforward neural network: A structure in which neurons in each layer are fully interconnected with neurons in the next layer, with no same-layer links or cross-layer links between neurons.
[0073] Explainability: This refers to the ability of humans to understand the internal operating mechanisms of a machine learning or deep learning model, the process of forming prediction results and the basis for decision-making, as well as the model's weights and influence on different features, thereby enabling humans to further understand and explain the model's prediction results and behavior.
[0074] like Figure 1 As shown, the present invention provides an interpretable battery life prediction method based on Transformer coding layer (BLP-Transformer), comprising the following steps:
[0075] S1: Preprocess the data based on battery-related data;
[0076] S2: Input the data into the interpretable battery life prediction algorithm (BLP-transformer) structure, extract features from the input data set, and generate a feature selection mask;
[0077] S3: The model learns and encodes the feature selection mask based on the positional encoding information of the data to obtain the encoded sequence;
[0078] S4: performing linear transformation and decoding on the encoded sequence to obtain a prediction result of the battery life;
[0079] S5: Combine the prediction results, aggregate the multi-step feature selection masks, quantify the feature importance, and obtain the interpretability of the model.
[0080] In this embodiment of the present invention, because the features in the dataset are insufficient to fully describe the characteristics and variations of the data, to analyze battery life and improve analysis accuracy, this invention calculates additional features based on the discharge voltage curve to capture the electrochemical evolution of individual batteries during cycling, thereby expanding the dataset. By expanding the dataset, this invention adds more features, improves the model's generalization ability, reduces the risk of overfitting, and improves the model's accuracy and interpretability. Based on this concept, the following dataset preprocessing method is proposed.
[0081] In this embodiment of the present invention, step S1 includes the following sub-steps:
[0082] S11. Expand the existing battery dataset. The original battery data includes information about the battery's RUL, voltage, current, battery temperature, internal resistance, and charging time. Calculate the skewness, kurtosis, and temperature integral of the battery capacity decay curve for the input data, as well as the slope and intercept of its linear fit. Use this calculated data as information for the expanded dataset to assist in model calculations.
[0083] S12. Filter the expanded data set using a median filter to obtain an input data set.
[0084] In general machine learning models, feature extraction is usually performed after the model is built. However, this approach may disrupt the correspondence between features and data, thereby affecting the interpretability of the model. In an embodiment of the present invention, feature extraction is placed in the first step of the model, and then these features are aggregated, thereby improving the interpretability of the model. The present invention not only helps users better understand the relationship between data and model, but also improves the prediction accuracy and stability of the model.
[0085] Specifically, in the field of battery prediction, the present invention adopts a special aggregation module that combines feature masks with decoded prediction information. In this way, the present invention can improve the interpretability of the model while maintaining the model's prediction capabilities, and better explain and understand the model's behavior and decision-making basis. By optimizing the model, the present invention effectively solves the problem of lack of interpretability of the model in the field of battery prediction, and improves the application value and credibility of the model. Based on the above ideas, the present invention proposes the following battery prediction method and interpretability enhancement method to make the model's prediction results more accurate and easy to explain.
[0086] In this embodiment of the present invention, step S2 includes the following sub-steps:
[0087] S21, normalize the input data set to obtain the normalized sequence f1(a1)~f N (a N ).
[0088] Among them, f i (a i ) represents the input sequence a for the i-th decision step i The normalized result obtained, i represents the i-th decision step, and i ranges from 1 to N.
[0089] S22, f i (a i ) and prior scale information P i-1 Multiply and get the result P i-1 ·f i (a i )(1≤i≤N).
[0090] Among them, the initialization value of the prior scale information is P0=1 B×t×f .
[0091] Where B is the batch size, t is the number of decision steps, and f is the number of features in the input data. A decision step is the cycle of the entire method to reach the final decision result.
[0092] The formula for generating the prior scale information in the i-th decision step is as follows:
[0093]
[0094] Where γ is a relaxation parameter that measures the amount of feature usage in the prior scale term. When γ = 1, a feature can only be used in one decision step. As γ increases, the feature can be used more flexibly in multiple decision steps.
[0095] S23, Softmax function is based on the generated P i-1 ·f i (a1) Data pair feature selection mask extraction feature importance Mask i , and its calculation formula is:
[0096] Mask i =Softmax(P i-1 ·f i (a i ))
[0097] The specific formula of the Softmax function is:
[0098]
[0099] S24. Normalize the feature selection mask generated in each decision step to generate a normalized feature data sequence.
[0100] In this embodiment of the present invention, step S3 includes the following sub-steps:
[0101] S31. Calculate relative position information of the characteristic data sequence generated by S2 using sine and cosine functions of different frequencies. The corresponding calculation formula is:
[0102]
[0103]
[0104] Among them, pos represents the position of the encoding time step, s represents the dimension, and d model Represents the network output dimension.
[0105] S32. Combine the feature data sequence with its relative position information to obtain a sequence to be learned.
[0106] S33. Input the sequence to be learned into the multi-layer feedforward neural network to complete the learning of the data set and generate a data sequence after model learning.
[0107] The formula for the corresponding feedforward neural network is:
[0108] FFN(x)=max(0,xW1+b1)W2+b2
[0109] where the matrix where d ff is the inner dimension value. b1 and b2 are the parameters that need to be updated through learning, and x is the sequence to be learned generated by S32.
[0110] S34: normalize the data sequence generated in step S33 and combine it with the sequence to be learned generated in step S32 to form a data encoding sequence.
[0111] In this embodiment of the present invention, step S4 includes the following sub-steps:
[0112] S41. Based on the encoded sequence output in step S3, perform linear transformation on it to obtain a sequence to be activated.
[0113] S42. Perform LeakyReLU activation layer operation on the activation sequence to complete the prediction of battery degradation data and obtain the predicted data of the battery. The corresponding formula is:
[0114] d out =LeakyReLU(0,f x W0+b0)
[0115] The LeakyReLU function is a leaky linear rectifier function. Its formula is:
[0116]
[0117] Where a is a constant less than 1, and a=0.01 is taken in the experiment.
[0118] where d out is the decision output, which predicts the degradation data of the input sequence x; W0 and b0 are linear conversion constants, f x It is the sequence to be activated in step S41.
[0119] In this embodiment of the present invention, step S5 includes the following sub-steps:
[0120] S51. Aggregate the feature selection mask in each decision step and the predicted data output in step S4 into the aggregation module in the model. The aggregation module first analyzes the feature selection mask to determine the overall contribution of all features in a decision step to the global total. The calculation formula is:
[0121] η i =LeakyReLU(d out [i])
[0122] where d out[i] represents the output feature of the i-th step decision, η i It represents the overall contribution of all features in the i-th decision step to the global picture.
[0123] η i The larger the value, the greater the contribution of the decision step to the model.
[0124] S52. Based on the overall contribution of all features in a decision step to the global model, the aggregation module further analyzes a feature in that step to clarify the cumulative contribution of a feature in the global model. The corresponding calculation formula is as follows:
[0125]
[0126] Mask i [j] represents the contribution of the jth feature to the decision in the i-th decision step. agg Represents the cumulative contribution of each feature in the global model.
[0127] S53, Mask the cumulative contribution value of each feature in the global model agg Normalization is performed to obtain the importance index of the global feature value, feature_importance, which is the interpretability of the model. The calculation formula is:
[0128] feature importance =Norm(Mask agg )
[0129] Among them, the Norm function is a horizontal normalization function, and its formula is:
[0130]
[0131] where μ and σ 2 Represents the mean and variance of the input, ∈ is a very small constant used to prevent the denominator from being 0.
[0132] In the implementation examples of the present invention, an interpretable battery life prediction method based on the Transformer coding layer (BLP-Transformer) created by the present invention realizes the prediction and interpretability analysis of battery life. By expanding the data set and improving the Transformer model, the present invention has achieved a good prediction of battery life. In the implementation examples, by designing some experimental scenarios and comparing them with other deep learning prediction methods, it is verified that the method proposed by the invention improves the accuracy of battery life prediction and provides good model interpretability.
[0133] In order to verify the interpretability of the model proposed in the present invention, four quantifiable self-interpretation models (Random Forest, XGBoost, QRF+AIS and N-Beats) and three deep learning models based on model-dependent interpretation (SVM, RNN and LSTM) were selected in actual examples to compare with the algorithm model BLP-Transformer proposed in the present invention. And based on the above seven models, a simulation of degradation data prediction was carried out. To ensure the fairness of the comparison, all models adopt a similar hierarchical structure with the same number of layers and hierarchical connections. That is, SVM, RNN, LSTM and the algorithm model BLP-Transformer proposed in the present invention all use a two-layer network structure with 128 neurons. Among them, the hidden layer retention probability is 0.2, and the hyperparameters are tuned by the Adam optimizer.
[0134] Random Forest, XGBoost, and ARF+AIS all use 128 weak classifiers. N-Beats uses two stacked blocks, each with three smaller blocks. Parallel computing for these schemes is performed on the image processing unit. Experimental parameters are shown in Table 1.
[0135] Table 1:
[0136] Hyperparameters Numerical Learning rate 0.001 Optimizer Adam optimizer Number of layers / blocks / decision steps 2nd floor Hidden layer size 128 hidden layer size The number of trees in the random forest 128 trees discard rate A drop rate of 0.2 Batch size 64 batch size
[0137] This experiment uses a publicly available dataset from the Toyota Research Institute. The dataset used in this experiment contains a total of 124 commercial LFP / graphite batteries, model APR18650M1A. These batteries have a nominal capacity of 1.1Ah and a nominal voltage of 3.3V. All battery data was obtained by testing at a constant temperature of 30°C using a 48-channel ArbinLBT battery test cycle potentiostat. The dataset includes information such as RUL, voltage, current, battery temperature, internal resistance, and charging time. The dataset was measured in a real physical environment and can reflect the actual data conditions of lithium-ion batteries.
[0138] The dataset is divided into one training set and two test sets according to different charging conditions and experimental batches. The test set is divided into a preliminary test dataset and a secondary test dataset.
[0139] The training set is used for model training and parameter selection. The training set contains 20 units from the "2017-05-12" batch and 21 units from the "2017-06-30" batch in the dataset.
[0140] The preliminary test dataset is the first batch of test data to verify model performance and dataset quality. The preliminary test dataset contains 21 units from the "2017-05-12" batch and 22 units from the "2017-06-30" batch.
[0141] The secondary data test set is the second batch of test data to further verify the model performance and the quality of the validation dataset. The secondary test dataset contains 40 units from the "2018-04-12" batch.
[0142] The experiment preprocessed the dataset, calculating and organizing the skewness, kurtosis, and temperature integral of the battery capacity decay curve after each cycle, as well as the slope and intercept of its linear fit. This calculated data served as an augmented dataset to assist in model calculations. Ultimately, an augmented dataset was formed, targeting discharge capacity and RUL, with 10 features, including temperature, as training features.
[0143] In the experiment, RUL is defined as the number of charge and discharge cycles that the battery undergoes when its discharge capacity degrades to a specified threshold.
[0144] The limiting threshold is specified as 80% of the battery's nominal capacity.
[0145] The specific feature names and meanings are shown in Table 2:
[0146] Table 2:
[0147]
[0148] This experiment uses three indicators: determination coefficient R2, root mean square error RMSE and mean absolute percentage error MAPE to evaluate the performance of the algorithm proposed in this invention.
[0149] The coefficient of determination (R2) reflects the degree of fit between the predicted data and the true value of the model proposed in this invention. The closer the coefficient of determination (R2) is to 1, the more similar the predicted results are to the true value, and the better the model fit. The formula for calculating the coefficient of determination (R2) is as follows:
[0150]
[0151] The root mean square error (RMSE) measures the accuracy of the prediction results. The smaller the RMSE, the higher the accuracy of the algorithm model proposed by the present invention. In the prediction of vehicle RUL, the unit of RMSE is cycle. The calculation formula of RMSE is as follows:
[0152]
[0153] The mean absolute percentage error (MAPE) is used to measure the accuracy of the prediction results of the algorithm proposed in this invention. The smaller the MAPE, the smaller the error rate of the prediction results. The calculation formula of the mean absolute percentage error (MAPE) is as follows:
[0154]
[0155] In the calculation formulas of the three indicators of determination coefficient R2, root mean square error RMSE and mean absolute percentage error MAPE, N is the total number of samples of evaluation data, is the predicted value of each sample by the algorithm model proposed in this invention, y i is the observed value of the data corresponding to the predicted value, Represents the mean of the observations in a test sample.
[0156] Table 3 shows the comparison data of the vehicle battery RUL prediction results of the algorithm model proposed in this invention and other 7 common prediction algorithm models.
[0157] Table 3:
[0158]
[0159] As shown in Table 3, the RMSE of the BLP-Transformer prediction results are 11.68 cycles and 18.57 cycles, and the MAPE are 1.079% and 1.569%, respectively. BLP-Transformer significantly outperforms other models, indicating that BLP-Transformer has better prediction results for RUL.
[0160] The deviation of the algorithm model proposed in this invention from the perfect prediction results in the test tasks of the preliminary test data set and the secondary test data set is as follows: Figure 2 As shown. Perfect prediction is defined as: the predicted battery RUL is exactly the same as the observed RUL. Figure 2 The proposed algorithm model can predict vehicle battery RUL with a fit of 0.998, a prediction accuracy of 15.51 cycles, and a prediction error rate of 1.324%. The proposed BLP-Transformer algorithm has accurate prediction capabilities.
[0161] The discharge capacity prediction results of the algorithm proposed in this invention and other 7 types of prediction algorithms for test ID-3 in the preliminary test data set are shown in Figure 3 The absolute error curve of the prediction results relative to the observed values is shown in Figure 4 In. By Figure 3 、 Figure 4As can be seen, the algorithm model proposed in this invention has excellent prediction results for battery discharge capacity. Even in the middle and late stages of the cycle life (200-1000 cycles), when the vehicle battery discharge capacity drops sharply, the algorithm proposed in this invention still maintains excellent prediction results. The predicted value deviates from the observed value by approximately 10 mAh, which is smaller than that of the other seven prediction algorithms.
[0162] Table 4 shows the comparative data of the battery discharge capacity prediction between the algorithm proposed in the present invention and seven other common prediction algorithms.
[0163] Table 4:
[0164]
[0165] Table 4 shows that BLP-Transformer achieves better performance for capacity prediction than other models, achieving fits of 0.937 and 0.985, RMSEs of 14.21 cycles and 5.448 cycles, and MAPEs of 0.374% and 0.332%.
[0166] Figure 5 、 Figure 6 、 Figure 7 The paper demonstrates a comparison of the prediction effects of the algorithm proposed in this invention and seven other common prediction algorithms on the discharge capacity of vehicle batteries under different charging strategies. Figure 5 The prediction effect of testID-21 data with a charging strategy of 2C (10%)-6C and a RUL of 148 cycles is demonstrated. Figure 6 The prediction effect of testID-6 data with a charging strategy of 6C (20%)-4.5C and a RUL of 466 cycles is demonstrated. Figure 7 The prediction effect of testID-6 data with a charging strategy of 5.4C (40%)-3.6C and a RUL of 1054 cycles is demonstrated.
[0167] The charging strategy XC(Y%)-ZC means charging at voltage X to Y% of the battery capacity, and then charging at voltage Z with constant current until the battery is fully charged.
[0168] Depend on Figure 5 、 Figure 6 、 Figure 7 Compared to the other seven common prediction models, the proposed BLP-Transformer model is more adaptable to batteries under different charging strategies and provides highly accurate prediction results. This helps users eliminate the influence of outliers and make more accurate decisions.
[0169] Figure 8The feature importance of the algorithm model proposed in this invention and four other quantifiable and interpretable prediction algorithm models is demonstrated.
[0170] Table 5 shows the order of feature importance of eight prediction algorithms including the algorithm model proposed in this invention from high to low. a The correlation between different models and the proposed model in terms of feature importance is shown. a The calculation formula is as follows:
[0171]
[0172] Where C represents the number of pairs with consistent elements in the two sequences, D represents the number of pairs with inconsistent elements, and N represents the total number of sequences.
[0173] Table 5:
[0174]
[0175] Table 5 shows that the three features, Intercept, Tintegral, and Slope, all achieved aggregate values above 0.15 in the proposed BLP-Transformer algorithm model. This indicates that these three features contributed most to the model's predictions during training. Tmin and Tavg contributed least to the model's predictions. The proposed algorithm model successfully quantified the dataset features and demonstrated the model's interpretability.
[0176] The working principle and process of the present invention are as follows: In the present invention, the training dataset is first preprocessed and expanded. The preprocessed training set is input into the model, and a feature selection mask is first extracted. Based on the feature selection mask, after normalization, combined with the position encoding information of the training set data, the data is encoded and the model is learned, and a data encoding sequence is output. The data encoding sequence is linearly transformed and decoded to obtain the battery life prediction result. Finally, the aggregation module combines the prediction results, aggregates the multi-step feature selection mask, quantifies the feature importance, and obtains the interpretability of the model.
[0177] The beneficial effects of this invention are as follows: the proposed method for interpretable battery life prediction based on the Transformer coding layer (BLP-Transformer) effectively predicts battery life data and can issue timely warning information before the battery RUL drops below the threshold. At the same time, this invention implements the interpretability feature of the model, which can help confirm the rationality of the model performance and quantify the contribution of features to the model.
[0178] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific descriptions and embodiments. Those skilled in the art can make various other specific variations and combinations based on the technical teachings disclosed in the present invention without departing from the essence of the present invention, and such variations and combinations are still within the scope of protection of the present invention.
Claims
1. An interpretable battery life prediction method based on Transformer coding layer (BLP-Transformer), characterized by: The following steps are involved: S1: Preprocess the data based on battery-related data; S2: Input the data into the interpretable battery life prediction algorithm (BLP-transformer) structure, extract features from the input data set, and generate a feature selection mask; S3: The model learns and encodes based on the feature selection mask and the positional encoding information of the data to obtain an encoded sequence. Step S3 includes the following sub-steps: S31, for the characteristic data sequence generated in S2, using sine and cosine functions of different frequencies to calculate its relative position information; S32, combining the feature data sequence and its relative position information to obtain a sequence to be learned; S33, inputting the sequence to be learned into a multi-layer feedforward neural network to complete the learning of the data set and generate a data sequence after model learning; S34, normalizing the data sequence generated in step S33 and combining it with the sequence to be learned generated in step S32 to form a data encoding sequence; S4: performing linear transformation and decoding on the encoded sequence to obtain a prediction result of the battery life; S5: combining the prediction results, aggregating the multi-step feature selection masks, quantifying the feature importance, and obtaining the interpretability of the model, wherein step S5 includes the following sub-steps: S51, aggregate the feature selection mask in each decision step and the predicted data output by step S4 into the aggregation module in the model; the aggregation module first analyzes the feature selection mask to determine the overall contribution of all features in a decision step to the global; its calculation formula is: η i =LeakyReLU(d out [and]) where d out [i] represents the output feature of the i-th step decision, η i Represents the overall contribution of all features in the i-th decision step to the global picture; η i The larger the value, the greater the contribution of the decision step to the model; S52. Based on the overall contribution of all features in a decision step to the global model, the aggregation module further analyzes a feature of the step to clarify the cumulative contribution of a feature in the global model; the corresponding calculation formula is as follows: Mask i[j] Indicates the contribution of the jth feature to the decision in the i-th decision step; Mask agg Represents the cumulative contribution of each feature in the global model; S53, Mask the cumulative contribution value of each feature in the global model agg Normalization is performed to obtain the importance index of the global eigenvalue, feature_importance, which is the interpretability of the model. The calculation formula is: feature importance =Norm(Mask agg )。 2. The method for interpretable battery life prediction based on Transformer coding layer (BLP-Transformer) according to claim 1, characterized in that: The step S1 includes the following sub-steps: S11. Expand the existing battery data set; the original battery data includes information about the battery's RUL, voltage, current, battery temperature, internal resistance, and charging time; calculate the skewness, kurtosis, and temperature integral of the battery capacity decay curve of the input data, as well as the slope and intercept of its linear fit; use the calculated data as information for the expanded data set to assist model calculation; S12. Filter the expanded data set using a median filter to obtain an input data set.
3. The method for interpretable battery life prediction based on Transformer coding layer (BLP-Transformer) according to claim 1, characterized in that: The step S2 includes the following sub-steps: S21, normalize the input data set to obtain the normalized sequence f1(a1)~f N (a N ); where f i (a i ) represents the input sequence a for the i-th decision step i The normalized result obtained, i represents the i-th decision step, and i ranges from 1 to N; S22, f i (a i ) and prior scale item information P i-1 Multiply and get the result P i-1 ·f i (a1)(1≤i≤N); Among them, the initialization value of the prior scale item information is P0=1 B×t×f ; Where B represents the batch size, t represents the number of decision steps, and f represents the number of features in the input data. The formula for generating the prior scale term information in the i-th decision step is as follows: Among them, γ is a relaxation parameter that measures the usage of features in the prior scale term; when γ = 1, a feature can only be used in one decision step. As γ increases, the feature can be used more flexibly in multiple decision steps; S23, Softmax function is based on the generated P i-1 ·f i (a1) Data pair feature selection mask extraction feature importance Mask i , and its calculation formula is: Mask i =Softmax(P i-1 ·f i (a i )) S24. Normalize the feature selection mask generated in each decision step to generate a normalized feature data sequence.
4. The method for interpretable battery life prediction based on Transformer coding layer (BLP-Transformer) according to claim 1, characterized in that: The step S4 includes the following sub-steps: S41, based on the encoded sequence output in step S3, linearly transform it to obtain a sequence to be activated; S42. Perform LeakyReLU activation layer operation on the activation sequence to complete the prediction of battery degradation data and obtain the predicted data of the battery; the corresponding formula is: d out =LeakyReLU(0,f x W0+b0) where d out is the decision output, which predicts the degradation data of the input sequence x; W0 and b0 are linear conversion constants, f x It is the sequence to be activated in step S41.
Citation Information
Patent Citations
Processing quality real-time prediction method and system in industrial finish machining process
CN115018162A
Lithium battery residual life probability prediction method based on time convolution attention mechanism
CN116381517A