A lithium ion battery residual service life prediction method based on lightweight PatchTST
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEBEI UNIV OF TECH
- Filing Date
- 2026-03-16
- Publication Date
- 2026-06-12
AI Technical Summary
Existing technologies struggle to accurately predict the remaining lifespan of lithium-ion batteries, especially under complex usage conditions and the influence of inherent material changes. These factors include nonlinear degradation characteristics and data scarcity, making prediction difficult.
A lightweight PatchTST-based method for predicting the remaining lifespan of lithium-ion batteries is adopted. Through feature extraction, two-stage source domain battery selection, Bayesian optimization, and leave-one-out verification, a lightweight PatchTST model is constructed to predict the capacity degradation trajectory of lithium-ion batteries.
It improves the accuracy and efficiency of predicting the remaining lifespan of lithium-ion batteries, reduces model complexity and computational cost, is suitable for small sample prediction scenarios, and achieves robust lifespan prediction.
Smart Images

Figure CN122193977A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for predicting battery life, and more particularly to a method for predicting the remaining lifespan of lithium-ion batteries. Background Technology
[0002] In recent years, with the rapid development of renewable energy, portable electronic devices, and electric vehicles, lithium-ion batteries have become one of the most mainstream energy storage technologies due to their advantages such as high energy density, long cycle life, low self-discharge rate, and environmental friendliness. Especially in demanding applications such as electric transportation and smart grids, lithium-ion batteries not only play a core energy carrier role but also directly affect the safety, reliability, and economy of the system. Therefore, accurate assessment of the health status and lifespan prediction of lithium-ion batteries are crucial for ensuring their long-term operation and optimizing maintenance strategies.
[0003] However, despite the many excellent characteristics of lithium-ion batteries, they are inevitably affected by complex usage conditions, aging mechanisms, and intrinsic material changes during actual operation, exhibiting nonlinear, irreversible performance evolution characteristics with a significant degradation trend. This makes accurately predicting the remaining usable life (RUL) of batteries in the early or middle stages of use extremely challenging. On the one hand, even batteries with identical manufacturing parameters may exhibit significant differences in their degradation trajectories during actual use; on the other hand, the battery degradation process is often accompanied by noise interference, data scarcity, and variations in degradation rates, further increasing the difficulty of modeling. Summary of the Invention
[0004] In view of this, the present invention aims to propose a method for predicting the remaining lifespan of lithium-ion batteries based on the lightweight PatchTST, including source domain battery selection, Bayesian optimization, and a RUL prediction model. Source domain battery selection is used to improve the model's prediction performance, while the Bayesian optimization algorithm obtains the optimal hyperparameters of the prediction model, improving prediction accuracy. The multi-output prediction model based on the lightweight PatchTST improves prediction efficiency.
[0005] To achieve the above objectives, the technical solution created by this invention is implemented as follows: A method for predicting the remaining lifespan of lithium-ion batteries based on the lightweight PatchTST includes the following steps: Step 1: Feature extraction. Statistical and sequence features are extracted from lithium-ion battery operating data to characterize the battery capacity degradation trend. Step 2: Source domain battery selection. A two-stage source domain battery selection strategy is adopted. Based on the extracted degradation features, two source domain battery data that are suitable for the target battery are selected to construct a training set. Step 3: Validate the model using leave-one-out method based on the battery data from the two source domains, and use Bayesian optimization to search for the key hyperparameters of the lightweight PatchTST model to obtain the optimal model configuration; Step 4: Degradation Modeling and RUL Prediction. A lightweight PatchTST model is constructed using optimized hyperparameters and trained based on the source domain battery capacity sequence. The degradation sequence of the target battery is input into the model to predict its capacity degradation trajectory up to the failure threshold, and the remaining service life is calculated. Step 5: Error analysis. Root mean square error (RMSE), mean absolute percentage error (MAPE), absolute error (AE), and relative error (RE) are selected as evaluation indicators to evaluate and analyze the capacity and RUL prediction results of the lightweight PatchTST model.
[0006] Furthermore, the feature extraction described in step 1 includes: Step 1-1: Extract statistical features related to lithium-ion battery life: ΔQ 100-10 (V) The variance and minimum of the difference curve.
[0007] Steps 1-2: Extract sequence features related to lithium-ion battery degradation: ΔQ c2-c1 The standard deviation sequence of (V) is set with c1=1 (the first cycle is the reference benchmark), and c2 is changed in turn to generate multiple difference curve sequences.
[0008] Steps 1-3: Apply Savitzky–Golay filtering to ΔQ c2-c1 The standard deviation sequence of (V) is smoothed.
[0009] Steps 1-4: Calculate the correlation between the two features.
[0010] Furthermore, the source domain battery selection method described in step 2 includes: In the first phase of source domain cell selection, the ΔQ of each cell is first determined. 100-10 The variance and minimum value of the (V) curve are used as two-dimensional eigenvectors, as shown below:
[0011] in, This refers to the ΔQ(V) curve of the i-th battery between the 100th and 10th cycles; similarly, f (i) This represents the two-dimensional feature vector corresponding to the i-th battery. f(target) This represents the two-dimensional feature vector corresponding to the target battery.
[0012] After standardizing all features using Z-scores, the Euclidean distance between all cells and the target cell is calculated, and the five cells with the closest distance are selected as candidates for the first stage. The formula is as follows:
[0013] In the second stage, ΔQ is calculated for each of the five candidate cells selected in the first stage. c2-c1 (V) The Euclidean distance between the standard deviation sequence and the corresponding sequence of the target cell is used to select the two cells with the smallest distance as the most similar source cells. This two-stage strategy ensures that the selected source cells and the target cells are highly consistent in both static lifetime level and dynamic degradation trend.
[0014] Furthermore, the leave-one-out cross-validation process for finding the optimal hyperparameters described in step 3 includes: Each time, one of the two source domain batteries is selected as the training set and the other as the validation set. Two rounds of training and validation are completed alternately to fully evaluate the model's generalization ability across different battery individuals and avoid random biases caused by limited sample size. Based on this, a Bayesian optimization algorithm is introduced to systematically search for the key hyperparameters of the lightweight PatchTST model. The parameters to be optimized include patch length, patch step size, embedding dimension, number of encoding layers, and number of attention heads. These parameters directly affect the model's ability to model the temporal characteristics of battery degradation. In each hyperparameter sampling process, model training and validation are performed using leave-one-out method, with the prediction error on the validation set used as the evaluation metric. Through comprehensive analysis of the two rounds of leave-one-out validation results, the hyperparameter configuration with the best average performance is selected, ultimately determining the optimal model structure for the lightweight PatchTST. The lightweight PatchTST model consists of three parts: a Patch Embedding module, a Transformer Encoder module, and a regression prediction head. The model input is a capacity time series of length T, and the output is the predicted capacity value corresponding to the next H cycles.
[0015] Furthermore, step 4 is implemented as follows: After the hyperparameters are determined, a lightweight PatchTST model is trained based on the optimal configuration: only the actual capacity data of the source domain battery is used, and multi-output prediction samples are constructed using a sliding window. The mean squared error is used as the loss function, and the parameters are updated through backpropagation until convergence. After training, the early capacity of the target battery is used as the initial input, and multi-cycle prediction results are output through forward inference. These results are then incorporated into the known sequence, and the window is updated iteratively for rolling prediction until the failure threshold is reached. The number of cycles corresponding to the first time the capacity falls below the threshold is defined as the predicted failure time. The RUL at the prediction start time is calculated, and finally, multi-output capacity prediction and RUL estimation of lithium-ion batteries based on lightweight PatchTST are achieved.
[0016] Furthermore, the capacity data construction process in step 4 is as follows: ct represents the capacity value of the t-th cycle, N is the known total number of cycles, and T represents the sequence length. The original one-dimensional capacity sequence can be reconstructed into the following input matrix:
[0017] Where L = N - T + 1 represents the number of input samples that can be constructed.
[0018] In multi-output prediction tasks, a prediction step size H is introduced, representing the number of consecutive future capacity values that the model needs to output in a single forward prediction. Correspondingly, the supervision label for each input sample consists of a capacity vector, in the form:
[0019] Therefore, a supervised learning sample set can be constructed for multi-output prediction:
[0020] In the multi-output prediction framework, the model takes a historical capacity sequence of length T as input and outputs the capacity prediction values for the next H consecutive periods in a single forward computation. Its functional expression is as follows:
[0021] Where g(·) represents the training model. When the prediction step size exceeds the single prediction length H, a multi-output-iterative combination prediction strategy is adopted, that is, the capacity sequence obtained from the previous prediction is incorporated into the known sequence as new input data to continue subsequent predictions. Specifically, it is expressed as:
[0022] By repeatedly executing the multi-output prediction process, multi-step forward prediction of future capacity changes of the target battery can be achieved.
[0023] Furthermore, step 5 selects root mean square error (RMSE), mean absolute percentage error (MAPE), absolute error (AE), and relative error (RE) as evaluation indicators, with the specific formulas as follows:
[0024] Where n represents the total number of samples, For the i-th predicted value, Let i be the i-th true value.
[0025]
[0026] Among them RUL t This is the actual RUL value, RULp To predict the RUL value.
[0027] Compared with existing technologies, the prediction method described in this invention has the following advantages: (1) The two-stage source region cell selection strategy first utilizes ΔQ 100-10 The statistical characteristics of the (V) curve are used to screen the overall battery degradation level, and then based on ΔQ... c2-1 The (V) standard deviation sequence refines the matching of degradation trends, which can simultaneously ensure that the selected source domain cells are highly consistent with the target cells in terms of lifespan level and degradation trend, thus improving the stability and reliability of similarity discrimination.
[0028] (2) In each hyperparameter sampling process, model training and validation are completed based on leave-one-out method, and the prediction error on the validation set is used as the evaluation index. Through comprehensive analysis of the two rounds of leave-one-out validation results, the hyperparameter configuration with the best average performance is selected, and the optimal model structure of lightweight PatchTST is finally determined. This process effectively improves the robustness and generalization performance of the model while ensuring that the model complexity is controlled.
[0029] (3) This invention proposes a lightweight PatchTST time series prediction model. While retaining the core advantages of PatchTST, this model effectively reduces model complexity and computational cost by reducing the number of network layers, simplifying feature mapping, and adopting a univariate input structure, making it more suitable for small sample prediction scenarios such as lithium-ion battery capacity prediction and remaining service life estimation. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of the overall architecture of one embodiment of the present invention.
[0031] Figure 2 The lithium-ion battery capacity degradation curve provided in the embodiments of the present invention.
[0032] Figure 3 For the extracted ΔQ 100-10 (V) Curve showing the relationship between variance and minimum characteristics and battery cycle life.
[0033] Figure 4 For ΔQ c2-c1 (V) Correlation plot of standard deviation sequence and capacity.
[0034] Figure 5 The diagram shows the source domain battery selection results as described in the embodiment of the present invention.
[0035] Figure 6 This is a schematic diagram of the lightweight PatchTST model structure.
[0036] Figure 7 A schematic diagram illustrating the RUL prediction of an example lithium-ion battery b1c28 provided for an embodiment of the present invention.
[0037] Figure 8 A schematic diagram illustrating the RUL prediction of an example lithium-ion battery b2c31 provided in an embodiment of the present invention. Figure 9 A schematic diagram illustrating the RUL prediction of an example lithium-ion battery b3c0 provided for an embodiment of the present invention. Figure 10 A schematic diagram illustrating the RUL prediction of an example lithium-ion battery b3c42 provided in this embodiment of the invention. Detailed Implementation
[0038] The invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0039] As attached Figure 1-7 A method for predicting the remaining lifespan of lithium-ion batteries based on the lightweight PatchTST includes the following steps: Step 1: Feature Extraction. Statistical and sequence features are extracted from lithium-ion battery operating data to characterize battery capacity degradation trends.
[0040] Step 2: Source Domain Battery Selection. A two-stage source domain battery selection strategy is adopted, which selects two suitable source domain battery data for the target battery based on the extracted degradation features, and constructs a training set.
[0041] Step 3: Validate the model using leave-one-out method based on the battery data from the two source domains, and use Bayesian optimization to search for the key hyperparameters of the lightweight PatchTST model to obtain the optimal model configuration.
[0042] Step 4: Degradation Modeling and RUL (Remaining Useful Life) Prediction. A lightweight PatchTST model is constructed using optimized hyperparameters and trained based on the source domain battery capacity sequence. The degradation sequence of the target battery is input into the model to predict its capacity degradation trajectory up to the failure threshold, and the remaining useful life is calculated.
[0043] Step 5: Error Analysis. Root mean square error (RMSE), mean absolute percentage error (MAPE), absolute error (AE), and relative error (RE) are used as evaluation metrics to assess and analyze the capacity and RUL prediction results of the lightweight PatchTST model.
[0044] Based on the above, the specific implementation process is explained in detail below: Example 1 Figure 2The data represents the capacity degradation curves of all cells in the selected lithium-ion battery set. It can be observed that the lifespans of different batteries vary significantly, and the degradation trends at different stages exhibit non-linear changes. Since the capacity degradation of many battery types is not significant in the early stages of their lifespan, it is not appropriate to use only the capacity degradation curve as the basis for battery selection. Therefore, the feature extraction in step 1 includes: Step 1-1: Extract statistical features related to lithium-ion battery life: ΔQ 100-10 (V) The variance and minimum of the difference curve.
[0045] Steps 1-2: Extract sequence features related to lithium-ion battery degradation: ΔQ c2-c1 The standard deviation sequence of (V) is set with c1=1 (the first cycle is the reference benchmark), and c2 is changed in turn to generate multiple difference curve sequences.
[0046] Steps 1-3: Apply Savitzky–Golay filtering to ΔQ c2-c1 The standard deviation sequence of (V) is smoothed.
[0047] Steps 1-4: Calculate the correlation between the two features.
[0048] Regarding the source domain cell selection method described in step 2, this invention proposes a two-stage source domain cell selection method based on clustering and sequence similarity measurement. Specifically, it includes... In the first stage of source region cell selection, the early capacity statistical characteristics of the target cell, namely ΔQ, are utilized. 100-10 The variance and minimum value of the (V) curve are used as two eigenvectors. See below for details: In the first phase of source domain cell selection, the ΔQ of each cell is first determined. 100-10 The variance and minimum value of the (V) curve are used as two-dimensional eigenvectors, as shown below:
[0049] in, This refers to the ΔQ(V) curve of the i-th battery between the 100th and 10th cycles; similarly, f (i) This represents the two-dimensional feature vector corresponding to the i-th battery. f(target) This represents the two-dimensional feature vector corresponding to the target battery.
[0050] After standardizing all features using Z-scores, cluster analysis is performed. Specifically, the Euclidean distance between all cells and the target cell is calculated, and the five cells with the closest distance are selected as candidates for the first stage. The formula is as follows:
[0051] Figure 3 It is ΔQ 100-10 (V) Curve variance and minimum characteristics are plotted against cycle life.
[0052] In the second stage, ΔQ is calculated for each of the five candidate cells selected in the first stage. c2-c1 (V) The Euclidean distance between the standard deviation sequence and the corresponding sequence of the target cell is used to select the two cells with the smallest distance as the most similar source cells. Figure 4 It is ΔQ c2-c1 (V) The standard deviation sequence is correlated with capacity, depicting the dynamic change trend of capacity with cycling. By quantitatively evaluating the similarity of the degradation paths between candidate source cells and the target cell, the most representative source cell can be selected. In this embodiment, the target cell is numbered b1c28. The two source cells, b1c7 and b1c27, selected in the end, have capacity degradation trends that are closer to those of the target cell b1c28. Figure 5 This is a capacity decay graph showing the results of b1c28 and source-domain cell selection.
[0053] For step 3, a Bayesian optimization method based on leave-one-out cross-validation is used to search for and optimize the key hyperparameters of the lightweight PatchTST model. Figure 6 This is a structural diagram of the lightweight PatchTST model, which consists of three parts: a Patch Embedding module, a Transformer Encoder module, and a regression prediction head. The model input is a capacity time series of length T, and the output is the predicted capacity value for the next H cycles. Specifically, for the target battery b1c28, batteries b1c7 and b1c27 were selected as source domain batteries in step 2. Model training and hyperparameter optimization are performed using only their capacity sequence data. A leave-one-out cross-validation method is used to construct the hyperparameter search process: battery b1c7 is used as the training set, and battery b1c27 is used as the validation set to complete one round of model training and error evaluation. Then, their roles are switched, with battery b1c27 used for training and battery b1c7 used for validation, forming two rounds of cross-validation. The average prediction error obtained from the above two rounds of validation is taken as the objective function of the Bayesian optimization algorithm to search for the key hyperparameters of the lightweight PatchTST model. Ultimately, the hyperparameter configuration with the smallest overall verification error on batteries b1c7 and b1c27 was selected, providing a stable and reliable model parameter basis for the subsequent migration prediction of the target battery b1c28.
[0054] The optimization process focuses on configuring parameters such as prediction step size, patch length, embedding dimension, number of attention heads, and learning rate. By minimizing the multi-step prediction error on the virtual path, a set of hyperparameters with good stability and generalization performance in multi-output prediction tasks is finally determined, providing a reliable configuration for subsequent model training. Taking the target battery b1c28 as an example, the hyperparameter configuration is as follows: prediction step size is 8, patch length is 17, embedding dimension is 59, and number of attention heads is 8.
[0055] For step 4, after determining the hyperparameters, the lightweight PatchTST model is formally trained based on the optimal parameter configuration. During the training phase, only the actual capacity data of the source domain battery is used. Multiple output prediction samples are constructed using a sliding window approach, with mean squared error as the loss function. Parameters are updated through backpropagation until convergence. Specifically, the historical capacity (early capacity of the target battery) sequence is used as input, and the corresponding future continuous capacity sequence is used as the supervision label, thereby training the model to learn the temporal evolution pattern of the capacity degradation sequence. During training, mean squared error is used as the loss function, and the model parameters are continuously updated through backpropagation until the model converges on the training data.
[0056] After model training, the trained lightweight PatchTST model is applied to the capacity prediction task of the target battery. In the prediction phase, early capacity data of the target battery is used as initial input, and the model outputs capacity predictions for multiple future cycles in a single forward inference. Subsequently, this prediction sequence is incorporated into the known capacity sequence, the input window is updated, and subsequent predictions continue until the prediction sequence covers the complete degradation process of the target battery. Through this multi-output prediction method combined with iterative rolling, the future capacity change trend of the target battery can be obtained with fewer prediction steps, providing a complete capacity prediction sequence for subsequent remaining useful life estimation.
[0057] After obtaining the predicted capacity sequence of the target battery, the prediction results are analyzed according to a pre-set failure capacity threshold. When the capacity first drops below the threshold, the corresponding cycle number is determined as the predicted failure time of the battery. Therefore, the remaining lifespan of the target battery at the prediction start time can be calculated. Through the above process, multi-output capacity prediction and RUL estimation of lithium-ion batteries based on the lightweight PatchTST are finally realized.
[0058] After training, using the early capacity of the target battery as the initial input, multi-cycle prediction results are output through forward inference. These results are then incorporated into the known sequence to update the window and iteratively roll the prediction until the failure threshold is reached. The cycle number corresponding to the first time the capacity falls below the threshold is defined as the predicted failure time. The RUL at the prediction start time is calculated, ultimately achieving multi-output capacity prediction and RUL estimation for lithium-ion batteries based on the lightweight PatchTST. Figure 7 A schematic diagram illustrating the predicted RUL of the target battery b1c28.
[0059] Step 5 concludes with error analysis, using root mean square error (RMSE), mean absolute percentage error (MAPE), absolute error (AE), and relative error (RE) as evaluation metrics to assess and analyze the performance of the lightweight PatchTST model's capacity and RUL prediction results. To evaluate the model's performance in the battery capacity prediction task, RMSE, MAPE, AE, and RE are selected as evaluation metrics. RMSE and MAPE are used to calculate the error between the predicted and actual capacity values; AE and RE are used to calculate the error between the predicted and actual RUL values.
[0060] To verify the model's predictive performance, four batteries were selected from the MIT dataset as target batteries: b1c28, b2c31, b3c0, and b3c42. Figures 8-10 These are schematic diagrams illustrating the predicted RUL of the target batteries b2c31 / b3e0 / b3c42.
[0061] Table 1 shows the error analysis of lithium-ion battery capacity and lifespan prediction based on the lightweight PatchTST model.
[0062] As can be seen from the capacity prediction error indices in the table, the lightweight PatchTST model maintains low RMSE and MAPE values on all four target cells, with a relatively concentrated error distribution, demonstrating good stability. As shown in the box plot, the RMSE values are all controlled within 0.008, indicating that the model can accurately fit the capacity evolution process under different degradation rates and lifetime lengths. The method maintains low RUL prediction errors on all four target cells, with a maximum AE of no more than 15 cycles. This indicates that the method not only has high accuracy in capacity numerical prediction but also can more reliably infer the time when the battery reaches the failure threshold, resulting in more accurate lifetime predictions.
[0063] The multi-output capacity prediction method based on lightweight PatchTST proposed in this invention achieves a good balance between prediction accuracy and computational efficiency, providing a more efficient and reliable solution for long-term capacity prediction and remaining service life assessment of lithium-ion batteries. The above description is merely a preferred embodiment of this invention and is not intended to limit the scope of the invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this invention should be included within the protection scope of this invention.
Claims
1. A method for predicting the remaining lifespan of lithium-ion batteries based on lightweight PatchTST, characterized in that: The steps include the following: Step 1: Feature extraction. Statistical and sequence features are extracted from lithium-ion battery operating data to characterize the battery capacity degradation trend. Step 2: Source domain battery selection. A two-stage source domain battery selection strategy is adopted. Based on the extracted degradation features, two source domain battery data that are suitable for the target battery are selected to construct a training set. Step 3: Validate the model using leave-one-out method based on the battery data from the two source domains, and use Bayesian optimization to search for the key hyperparameters of the lightweight PatchTST model to obtain the optimal model configuration; Step 4: Degradation modeling and RUL prediction. A lightweight PatchTST model is constructed using optimized hyperparameters and trained based on the source domain battery capacity sequence. The degradation sequence of the target battery is input into the model to predict its capacity degradation trajectory up to the failure threshold and calculate the remaining service life. Step 5: Error analysis. The root mean square error (RMSE), mean absolute percentage error (MAPE), absolute error (AE), and relative error (RE) are selected as evaluation indicators to evaluate and analyze the capacity and RUL prediction results of the lightweight PatchTST model.
2. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 1, characterized in that: The feature extraction described in step 1 includes: Step 1-1: Extract statistical features related to lithium-ion battery life: ΔQ 100-10 (V) Variance and minimum value of the difference curve; Steps 1-2: Extract sequence features related to lithium-ion battery degradation: ΔQ c2-c1 (V) standard deviation sequence, the first cycle sets c1=1 for the reference benchmark, and then changes c2 to generate multiple difference curve sequences; Steps 1-3: Apply Savitzky–Golay filtering to ΔQ c2-1 The standard deviation sequence of (V) is smoothed; Steps 1-4: Calculate the correlation between the two features.
3. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 1, characterized in that: The specific implementation method of step 2 is as follows: In the first phase of source domain cell selection, the ΔQ of each cell is first determined. 100-10 The variance and minimum value of the (V) curve are used as two-dimensional eigenvectors, as shown below: , in, This refers to the ΔQ(V) curve of the i-th battery between the 100th and 10th cycles; similarly, f(i) represents the two-dimensional feature vector corresponding to the i-th battery, and f(target) represents the two-dimensional feature vector corresponding to the target battery. After standardizing all features using Z-score, the Euclidean distance between all cells and the target cell is calculated, and the five cells with the closest distance are selected as candidates for the first stage; the formula is as follows: , In the second stage, ΔQ is calculated for each of the five candidate cells selected in the first stage. c2-1 (V) The Euclidean distance between the standard deviation sequence and the corresponding sequence of the target cell is used to select the two cells with the smallest distance as the most similar source cells.
4. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 1, characterized in that... Step 3 is implemented as follows: Each time, one of the two source domain batteries is selected as the training set and the other as the validation set. Two rounds of training and validation are completed alternately. A Bayesian optimization algorithm is introduced to systematically search for the key hyperparameters of the lightweight PatchTST model. The parameters to be optimized include patch length, patch step size, embedding dimension, number of encoding layers, and number of attention heads. In each hyperparameter sampling process, model training and validation are completed based on leave-one-out method, and the prediction error on the validation set is used as the evaluation index. Through comprehensive analysis of the results of the two rounds of leave-one-out validation, the hyperparameter configuration with the best average performance is selected, and the optimal model structure of lightweight PatchTST is finally determined.
5. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 1, characterized in that: The specific implementation method of step 4 is as follows: After the hyperparameters are determined, a lightweight PatchTST model is trained based on the optimal configuration: only the real capacity data of the source domain battery is used, multiple output prediction samples are constructed according to the sliding window, the mean square error is used as the loss function, and the parameters are updated until convergence through backpropagation. After training, the early capacity of the target battery is used as the initial input. The multi-cycle prediction results are output through forward inference, and then the results are merged into the known sequence to update the window for iterative rolling prediction until the failure threshold is reached. The cycle number corresponding to the first time the capacity falls below the threshold is defined as the predicted failure time. The RUL at the prediction start time is calculated, and finally, the multi-output capacity prediction and RUL estimation of lithium-ion batteries based on the lightweight PatchTST are realized.
6. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 4, characterized in that: The process of constructing a sliding window is as follows: c t Let N represent the capacity value of the t-th cycle, N be the known total number of cycles, and T represent the sequence length. The original one-dimensional capacity sequence can be reconstructed into the following input matrix: , Where L = N - T + 1 represents the number of input samples that can be constructed; In multi-output prediction tasks, a prediction step size H is introduced, indicating that the model needs to output H consecutive future capacity values simultaneously in one forward prediction. Correspondingly, the supervision label for each input sample consists of a capacity vector, in the form of: , Therefore, a supervised learning sample set can be constructed for multi-output prediction: , In the multi-output prediction framework, the model takes a historical capacity sequence of length T as input and outputs the capacity prediction values for the next H consecutive periods in a single forward computation. Its functional expression is as follows: , Where g(·) represents the training model. When the prediction step size exceeds the single prediction length H, a multi-output-iterative combination prediction strategy is adopted, that is, the capacity sequence obtained from the previous prediction is incorporated into the known sequence as new input data to continue subsequent predictions; specifically expressed as: , By repeatedly executing the multi-output prediction process, multi-step forward prediction of future capacity changes of the target battery can be achieved.
7. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 4, characterized in that: The lightweight PatchTST model mainly consists of three parts: the Patch Embedding module, the Transformer Encoder module, and the regression prediction head. The model input is a capacity time series of length T, and the output is the capacity prediction value corresponding to the next H cycles.
8. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 1, characterized in that: Step 5 is implemented as follows: predict the capacity degradation path from the start point to the end of the battery life; to evaluate the performance of the model in the battery capacity prediction task, RMSE, MAPE, AE and RE are selected as evaluation indicators; RMSE and MAPE are used to calculate the error between the predicted capacity value and the actual value; AE and RE are used to calculate the error between the predicted RUL value and the actual value.
9. The method for predicting the remaining lifespan of a lithium-ion battery based on lightweight PatchTST according to claim 7, characterized in that: The specific expressions for RMSE, MAPE, AE, and RE are as follows: , Where n represents the total number of samples, For the i-th predicted value, This is the i-th true value; , RUL t This is the actual RUL value, RUL p To predict the RUL value. A method for predicting the remaining lifespan of lithium-ion batteries based on the lightweight PatchTST.