Temporal Attention Mechanism Based Indirect Battery Capacity Prediction Combined with Health Feature Extraction

: The burgeoning utilization of lithium-ion batteries within electric vehicles and renewable energy storage systems has catapulted the capacity prediction of such batteries to a pivotal research frontier in the energy storage domain. Precise capacity prognostication is instrumental not merely in safeguarding battery operation but also in prolonging its operational lifespan. The indirect battery capacity prediction model presented in this study is based on a time-attention mechanism and aims to reveal hidden patterns in battery data and improve the accuracy of battery capacity prediction, thereby facilitating the development of a robust time series prediction model. Initially, pivotal health indicators are distilled from an extensive corpus of battery data. Subsequently, this study proposes an indirect battery capacity prediction model intertwined with health feature extraction, hinged on the time-attention mechanism. The efﬁcacy of the proposed model is assayed through a spectrum of assessment metrics and juxtaposed against other well-entrenched deep learning models. The model’s efﬁcacy is validated across various battery datasets, with the Test Mean Absolute Error (MAE) and Test Root Mean Squared Error (RMSE) values consistently falling below 0.74% and 1.63%, respectively, showcasing the model’s commendable predictive prowess and reliability in the lithium-ion battery capacity prediction arena.


Introduction
In the narrative of global energy transition [1], lithium-ion batteries have emerged as a linchpin in electric vehicles and renewable energy storage systems [2].The performance and longevity of these batteries critically influence the efficiency and reliability of these applications [3].Oftentimes, the capacity of a battery is elusive to direct measurement, posing a challenge for monitoring and management.The aging process of a battery is modulated by a myriad of factors, among which voltage, current, and temperature are the three paramount parameters.These parameters are integral to the charging and discharging dynamics of the battery and bear a direct impact on the battery's health and operational lifespan [4].Current plays a crucial role in the charging and discharging process of batteries.Improper charging current, especially too high current, may lead to excessive heat generation inside the battery, thus accelerating the aging of the battery.Additionally, high-current charging may cause an imbalance in the chemical reactions within the battery, further shortening the life of the battery [5].Voltage is also a key indicator of battery health.Voltage changes during the charging and discharging of a battery can reflect its internal chemical state [6].If the voltage of a battery exceeds its rated value during charging, it may cause excessive heat to be generated inside the battery, thus accelerating the aging process.Conversely, the battery may be irreversibly damaged if the discharge voltage is too low.Temperature also has a direct impact on the health of the battery.The heat generated by the battery during the charging and discharging process must be effectively dissipated.
Otherwise, it may lead to overheating of the battery [7].Prolonged overheating accelerates battery aging and may even lead to battery damage.Therefore, it is critical to monitor the battery's temperature and ensure that it is within safe limits.
Therefore, accurately predicting lithium-ion batteries' capacity and health status is an essential direction of current research [8].Accurate capacity prediction not only ensures the safe operation of the battery but also extends its service life [9].To this end, researchers have proposed various prediction methods, including traditional modelling methods [10], data-driven methods [11], and deep learning methods [12].
Early studies focused mainly on electrochemical and empirical models, which usually describe the degradation process of batteries based on their physical and chemical properties [13].However, these models often require many parameters and complex calculations, limiting their efficiency and accuracy in practical applications [14].
Data-driven methods mainly rely on a large amount of experimental data to predict the capacity of a battery [15].However, the prediction accuracy of this method still needs to be improved due to the operating conditions of the battery and environmental factors [16].
With the improvement of computing power and the advancement of data science, deep learning has become a popular research direction for battery capacity prediction [17].Deep learning methods, especially composite network structures, have shown advantages in dealing with complex and nonlinear data [18].Several existing deep learning hybrid methods and their applications in battery capacity prediction are discussed in detail below.
CNN-LSTM networks combine the advantages of Convolutional Neural Networks (CNNs) and Long Short-Term Memory Networks (LSTMs) to efficiently process multidimensional time series data and extract spatial and temporal features [19].However, although this approach performs well in some applications, it may encounter difficulties when processing long time series data [20].
A combination of Graph Convolutional Networks and Recurrent Neural Networks can better model the complex chemical and physical processes inside the battery [21].However, this method is highly complex and may not be suitable for real-time applications.
Transformer networks are often combined with other deep learning networks due to their advantages of parallel processing and attention mechanisms [22].Although this combination method performs well in some applications, this method may require a large amount of training data to achieve high accuracy [23].
Generative Adversarial Networks (GANs) can be used to generate more training data, thus improving the model's generalization ability and prediction accuracy [24].However, the training process of GANs may encounter instability issues.
Hybrid models and integrated learning: Recent research has also begun exploring the potential of hybrid models and integrated learning, which combine multiple algorithms and models to achieve higher predictive accuracy and stability [25].
For hybrid network models, in recent years, CNN-LSTM networks have become an effective framework for predicting the capacity and health of lithium-ion batteries due to their ability to process multidimensional time series data and extract spatial and temporal features.For example, Ma et al. proposed a method for predicting the remaining useful life (RUL) of lithium-ion batteries using a hybrid neural network based on CNNs and LSTMs, demonstrating the effectiveness of this method in different types of batteries [26].Similarly, Zhao et al. investigated a CNN-LSTM hybrid neural network for capacity prediction and remaining useful life (RUL) diagnosis of lithium-ion batteries, emphasizing the advantages of this hybrid network structure in handling battery performance prediction tasks [27].Song et al. developed a CNN-LSTM combined network that captures spatial and temporal features of battery data through voltage, current, and temperature measurements, and evaluated the performance of the proposed network under various dynamic load profiles [28].In addition, Xu et al. presented an improved method for estimating the state-of-health (SOH) of lithium-ion batteries based on a CNN-LSTM model, emphasizing the importance of incremental capacity profiles as inputs to the neural network model to improve prediction accuracy [29].
Table 1 shows the comparison of different deep learning methods in battery capacity prediction.These studies emphasize the advantages of CNN-LSTM composite networks for lithium-ion battery capacity and state-of-health prediction.However, traditional CNN-LSTM models may not fully consider the importance of different time points in time series data.In this paper, by introducing a temporal attention mechanism, the model can pay more attention to essential time periods, which may further improve the model's accuracy in predicting battery capacity and health state.Meanwhile, through indirect battery capacity prediction and health feature extraction, this paper not only focuses on direct capacity prediction but also provides more information to help the model understand the battery's state more accurately.
The main contributions of this paper are as follows: • Advanced feature extraction for battery health monitoring: In this study, key features indicative of battery degradation are skillfully extracted using easily measurable parameters in the battery charge/discharge cycle.The paper details a systematic approach to extracting battery health indicators from available data, categorizing them into measured and calculated health indicators.In addition, it reveals the correlation between the extracted health metrics and battery capacity, which helps to identify the most relevant and effective parameters for battery capacity.These metrics not only deepen the understanding of battery aging trajectories, but also provide a solid foundation for predictive analysis.The structure of this paper unfolds as follows: Section 2 delves into an exploration of related work in the domain of battery capacity prediction, shedding light on the temporal attention mechanism, CNN and LSTM networks, and elucidating on the indirect prediction model that leverages the temporal attention mechanism, which is central to this study.Section 3 provides an exhaustive description of the dataset collection process and the feature extraction methodology, while also presenting a comprehensive introduction to the proposed indirect battery capacity prediction framework, rooted in the temporal attention mechanism.Section 4 focuses on the model training procedures, detailing the experimental setups across four distinct datasets, the evaluation metrics employed, and the subsequent results obtained.This section also engages in a discussion on the characteristics of model error distribution across varying battery types and extends the analysis to draw comparative insights with other existing model structures.Concluding the paper, Section 5 encapsulates this research's pivotal findings and contributions, offering a summary that underlines its significance and implications.

Hybrid Network for Battery Capacity Prediction 2.1. Temporal Attention Mechanism
The temporal attention mechanism has the ability to enhance the model's ability to capture key patterns and dependencies in data series [30].It allows the model to focus on those time steps that are more important or relevant when dealing with sequential data (e.g., time series), rather than treating all time steps equally [31].This mechanism facilitates the understanding and capture of the underlying patterns required for accurate prediction by navigating through the sequence data with judicious allocation of focus to key time steps.This mechanism can be easily integrated into many deep learning architectures to improve their ability to capture temporal dependencies.
The conceptual structure of the temporal attention mechanism can be mathematically developed as follows: • Formulation of Attention Scores: In the inaugural phase, attention scores are formulated for each time fragment within a defined series X = {x 1 , x 2 , . . ., x T }.This procedure entails the deployment of a parameterized function to evaluate the resemblance between the focal time step and its counterparts, represented as where W 1 and W 2 signify trainable weight matrices, and v denotes a learnable weight vector.The intricate choice of this function pivots the efficacy of the attention mechanism, orchestrating a nuanced focus on significant time steps.• Synthesis of Attention Weights: Following this, attention weights are synthesized, utilizing the softmax function to equilibrate the attention scores, thus ensuring a summation equal to one.This computational process is mathematically illustrated as These weights mirror the significance attributed to each time step, dictating their contribution to the representation of the current time fragment.

•
Computation of the Weighted Sum: Subsequently, a weighted sum of the input series is constructed leveraging the attention weights, engendering a sophisticated representation of the present time step.This is mathematically conveyed as The structural diagram of the multi-attention mechanism is shown in Figure 1: Temporal attention mechanism in lithium-ion battery capacity prediction: The temporal attention mechanism plays a crucial role in lithium-ion battery capacity prediction.Temporal attention mechanisms can better focus on historical time steps that are more relevant to predicting the current battery state.This mechanism can be used to capture critical moments in the charge/discharge cycle of a battery that may contain important information that affects the capacity and health of the battery.In addition, combining temporal attention mechanisms with deep learning networks such as CNNs or LSTMs can help build models that are both robust and adaptive [32].These models can better handle the temporal dynamics and nonlinear features inherent in battery data, thereby improving the accuracy and reliability of predictions.
In summary, the temporal attention mechanism provides an effective way to improve the ability of deep learning models to process time series data.By dynamically focusing on more essential time steps, it can improve the accuracy and robustness of predictions.It may become a valuable tool in lithium-ion battery capacity prediction research.

Convolutional Neural Network
CNNs are well suited for processing grid-structured data like multidimensional time series data, which is pertinent for battery capacity prediction [33,34].Through convolutional, pooling, and fully connected layers, CNNs automatically extract hierarchical features from data [35].
The core components of CNNs include the input layer, convolutional layer, activation layer, pooling layer, fully connected layer, and output layer [36].The convolutional layer utilizes a kernel to scan local regions of the input data, with the convolution operation described as Combining CNNs with other deep learning techniques like LSTM or temporal attention mechanisms can enhance the prediction accuracy by capturing long-term dependencies in time series data.

Long Short-Term Memory Networks
LSTM, a Recurrent Neural Network (RNN) architecture, overcomes the challenges of gradient vanishing and gradient explosion faced by traditional RNNs when processing long-time dependencies [37].It employs a gating mechanism and a cellular state to manage information flow over time [38].
The core components of an LSTM cell include the forget gate, input gate, candidate cell state, cell state, output gate, and hidden state [39].
The following are the core components of an LSTM cell and their mathematical expressions: • Forget Gate ( f t ): Employs the sigmoid function to decide which information is forgotten or retained from the cell state.
• Input Gate (i t ): Also uses the sigmoid function to determine which new information is added to the cell state.
• Candidate Cell State ( Ct ): Generates potential new values for the cell state, using the tanh function.
• Cell State (C t ): Maintains the long-term flow of information within the LSTM unit, updating based on the outputs of the forget gate and input gate.
• Output Gate (o t ): Utilizes the sigmoid function to control which information from the cell state is outputted.
• Hidden State (h t ): Represents the output of the LSTM unit at the current time step, based on the decisions of the output gate and the current cell state.
LSTM networks excel at capturing time-dependence in battery charge/discharge data, aiding in predicting the future performance and lifetime of the battery.By combining LSTMs with other deep learning techniques, a hybrid network structure can be formed to comprehensively and accurately capture the multi-scale and multi-dimensional properties of batteries [40].

Hybrid Network for Battery Capacity Prediction
Accurate predictive modeling of lithium-ion battery capacity is an important research direction in the field of contemporary energy storage systems.This study focuses on hybrid network models with temporal attention mechanisms that integrate the functions of CNNs, LSTMs, and attention mechanisms, aiming to improve the accuracy of battery capacity estimation.This section provides an in-depth look at the hybrid network architecture used in this study.

• Initial Data Processing
Before starting the network operation, the data must go through several transformation stages to ensure optimal network performance.MinMaxScaler normalizes data obtained from specific databases.This process helps maintain the data's intrinsic distribution while adjusting the values to a predetermined range (0 to 1 in this case).Subsequently, the data corpus was divided into training and test sets, maintaining an 80-20 ratio.Using a custom function called create_dataset, the data were adapted to a format consistent with the LSTM inputs.A backtracking parameter was integrated to take into account past time steps in the prediction model.

• Start Layer
The network operates from the input layer, where the transformed data are accepted.This layer represents the starting point of the data through the network and is aligned with the feature dimensions of the training dataset.

• Convolution Phase
After the initial layer, the data enter the convolution phase where important features are separated from the input data using 64 filters and 3 kernel dimensions.The Rectified Linear Unit activation function is used here to introduce a nonlinear element to the system, which enhances the network's ability to capture complex patterns in the data.

• Dimensionality Reduction Layer
In order to simplify the computational process and to highlight the main features, a maximum pooling layer is incorporated in the system with a pool size of 1.This layer helps to minimize the spatial dimensionality of the output volumes, preserving the essential information and speeding up the computational process.

• Sequential LSTM Layer
For temporal analysis, LSTM layers are a core element that is proficient in capturing time-related dependencies in the data.Arranged in different configurational orders, these layers excel at identifying long-term dependencies in the data, providing a nuanced understanding of temporal patterns that are critical for accurate prediction.

• Attention Mechanism
This mechanism allows the model to selectively focus on different segments of the input sequence, highlighting important patterns and dependencies, thus improving prediction accuracy.

• Output Segment
The final part of the network structure is the output segment, a dense layer in which a single unit synthesizes and analyzes the information to produce the final battery capacity prediction.This segment translates the insights extracted from the data into an actual output representing the predicted battery capacity.

• Model Configuration and Training
Once the network structure is defined, the model will enter the configuration and training phase.The Adam optimizer, known for its adaptive learning rate, is chosen in the training phase to minimize the mean square error loss function and to fine tune the weights for optimal performance over a time span of 30 calendar hours with a batch size of 2.

• Prediction and Performance Evaluation
After the training phase, the model starts to enter the prediction phase, where predictions are made for both the training and test datasets.These predictions are then inversely transformed to reverse the normalization applied in the initial phase.This step is crucial to obtain predictions of the original proportions and helps to make an accurate assessment of the model's efficiency.

Data Description
The present study is organized around two different but equally essential datasets: the NASA dataset and the MIT dataset.These datasets have a rich repository of information that provides a favorable environment for extracting key health indicators (HIs) and facilitates a detailed study of the indirect battery capacity prediction model based on the time-attention mechanism.The specifics of the dataset are as follows.

NASA Dataset
The initial dataset, serving as the foundation of this study, was procured from the NASA Ames Diagnostic Center of Excellence database, with access provided through the following link: https://www.nasa.gov/intelligent-systems-division/discovery-andsystems-health/pcoe/pcoe-data-set-repository(accessed on 8 December 2023).This repository encompasses data related to three lithium-ion batteries, designated as B_5, B_7, and B_18.Each of these batteries possesses a specified capacity of 2 Ah and operates at a standard voltage of 3.7 V [41].The experimental protocol encapsulated within this dataset adheres to a structured methodology, deeming a battery's lifecycle as complete upon a 30% reduction in its original rated capacity, corresponding to a decline to 70% of its initial capacity.
The dataset meticulously documents the entirety of the charging and discharging cycles, segregating the process into three pivotal phases: constant current (CC) charging, constant voltage (CV) charging, and CC discharging.These granular data facilitate an exhaustive investigation of the capacity fluctuations inherent in lithium-ion batteries, laying a robust foundation for implementing deep learning algorithms in predictive analytics.
This study focused on three lithium-ion batteries (5, 7, and 18), all sharing the same chemical composition.These batteries were subjected to three distinct operational modes-charging, discharging, and impedance measurement-at room temperature.The dataset unveils the batteries' behavioral patterns under varied operational conditions.
During the charging phase, a constant current (CC) of 1.5 A was applied until the battery voltage escalated to 4.2 V, subsequently transitioning to a constant voltage (CV) mode, persisting until the charging current diminished to 20 mA.The discharging phase was conducted at a constant current (CC) of 2 A, continuing until the battery voltage dwindled to specific thresholds: 2.7 V, 2.2 V, and 2.5 V for batteries 5, 7, and 18, respectively.Impedance measurements were meticulously executed via electrochemical impedance spectroscopy (EIS), spanning a frequency range from 0.1 Hz to 5 kHz.The iterative cycling of charge and discharge expedited the aging process of the batteries.Concurrently, impedance measurements yielded valuable insights into the evolution of internal battery parameters as the aging process progressed.The experimental proceedings were terminated when each battery's capacity receded to 70% of its rated capacity, transitioning from 2 Ahr to 1.4 Ahr, a state defined as the end-of-life (EOL) criterion for the batteries under study.
Each of the batteries underwent an extensive series of cycles until reaching their respective EOL criteria.The specific C-rate for each cell during discharge, derived from the provided current and capacity values, elucidates the operating conditions endured by the battery.
The comprehensive parameters and metrics encapsulated in these datasets are indispensable for research endeavors aiming to predict the remaining charge in a given discharge cycle and estimate the remaining useful life of lithium-ion batteries.

MIT Dataset
In conjunction with the NASA dataset, our study incorporates the MIT dataset, meticulously assembled by the Massachusetts Institute of Technology.This dataset stands out for its impeccable data quality, establishing it as a premier resource for investigations into the capacity behavior of lithium-ion batteries [42].The focal point of the analysis is a battery with a nominal capacity of 1.1 Ah and a standard voltage of 3.3 V.The dataset meticulously outlines a structured experimental regimen, determining the end of the battery's lifecycle when its capacity diminishes to 80% of its original rating.
The dataset is charged using the CC-CV mode.Its distinctive feature is its comprehensive documentation of the multi-step fast charging technique and the constant-current discharging process, which occurs in a temperature-controlled chamber at 30 °C [43].It provides an exhaustive depiction of the battery's charge and discharge cycles, capturing intricate details of various phases and parameters.This wealth of information lays a robust groundwork for extracting crucial indicators of battery health, facilitating a thorough analysis and understanding of the battery's performance dynamics.
The two datasets provide a solid foundation for this study by providing detailed data on the state changes of lithium-ion batteries, thus helping to compare the performance differences between the indirect battery capacity prediction model based on the timeattention mechanism and other network structures.Figure 3 shows the battery degradation curves for the two datasets.

Extraction of Health Indicators
In previous time series models, while the data used for capacity prediction are usually the capacity itself, capacity is often not directly measurable in practice.Therefore, it is necessary to extract battery health indicators from existing data as a basis for prediction.To reveal the complexity of battery capacity variations and provide fundamental security for predictive analytics, HIs must be extracted from existing datasets.These metrics are critical touchpoints for battery performance and degradation.This section will provide insights into how to remove these metrics systematically.
Within the scope of this study, subtle metrics that summarize the dynamic health of the battery are extracted as much as possible to ensure a more accurate and reliable battery capacity estimation.These metrics are categorized into two types: measured health metrics and calculated health metrics.

Directly Measured Indicators of Battery Aging
As seen from the above dataset, different charging and discharging conditions, currents, and temperatures can impact the capacity and health of a battery.Therefore, HIs must be extracted from these parameters to assess the battery's health more accurately.These indicators can help researchers better understand the aging trajectory of batteries and provide strong support for predictive analysis.
Figure 4 is a representative example of the current, voltage, and temperature curves during the charging and discharging of a NASA battery.The measured HIs directly represent the battery's aging process, encapsulating parameters that can be directly apprehended from the Battery Management System.After analyzing the data trends, this study focuses on selecting indicators such as the duration of the CC charging stage (t cc ), variations in charging voltage over equidistant time intervals (ETVC), and the temporal location of the peak temperature during the discharge phase (TPL).These indicators, serving as direct derivatives from the charging and discharging processes, are pivotal in portraying the aging trajectory of the batteries.
An in-depth analysis of these parameters reveals a clear trend corresponding to the number of charge cycles.This trend is influenced by physical and chemical changes within the battery, showing a gradual increase in internal resistance, affecting the battery's characteristics over time.Extracting these metrics aims to generalize these trends and provide a reliable indicator for assessing battery health.

Calculated Indicators of Battery Aging
Calculated health metrics complement measured health metrics and provide an indepth analysis of the battery's health and a nuanced view of the degradation process.These metrics focus on the subtle electrochemical changes occurring within the battery, which can be discerned through incremental capacity (IC) analysis.This section presents two critical calculations of HI: the peak of the IC curve (ICP) and the corresponding peak location (ICPL), which show a decreasing trend as the number of cycles increases.Since the peak IC curve (ICP) and the corresponding peak position (ICPL) showed a decreasing trend with the increased number of cycles, these two indicators were chosen for this study.The formula for the IC curve is: where Q represents the total charge of the battery, V is the voltage across the battery, I is the current flowing through the battery, and t is time.
In addition, a nonlinear dynamic parameter, sample entropy (SampEn), is integrated into the analysis to quantify unpredictability and regularity in the time series data.This parameter is a reliable tool for measuring the complexity of a time series and helps to provide insight into new patterns and information emerging in the series.A synergistic approach utilizing measured and calculated HIs can establish a robust framework for battery health analysis and facilitate accurate and reliable SOH estimation.

Correlation Analysis
After extracting HIs, meticulous correlation analysis can help build a predictive model that is both accurate and reliable.This stage helps to elucidate the quantitative relationship between HIs and battery capacity, thus providing a basis for selecting the most salient HIs and incorporating them into the prediction model, improving the accuracy and reliability of the model.
The Pearson correlation coefficient (PCC) is often used to describe the linear interdependence between two variables.In this study, the Pearson correlation coefficient can be used as a discriminatory tool to help identify and select the most effective HI based on its correlation with the battery capacity.The coefficient fluctuates between −1 and 1, which represents a complete negative linear relationship and a complete positive linear relationship, respectively, while 0 indicates no linear relationship.The mathematical expression for the PCC is as follows: In this equation, z and q represent the reference values of HIs and capacity, respectively, whereas l signifies the number of samples.The PCC values range between −1 and 1, indicating a perfect linear relationship at the extremes and no correlation at zero.This section performs a careful correlation analysis of each dataset to identify different patterns and relationships.This analysis is summarized in Table 2   The following analysis can be made based on the chart data: ETCV: In all datasets, this parameter shows a significant negative correlation with battery capacity, implying that battery capacity decreases as ETCV increases, thus serving as a strong indicator of deteriorating battery health.
tcc: The analysis reveals a significant positive correlation with battery capacity, suggesting a consistent pattern of change between CC charging phase duration and battery capacity, thus portraying it as an important parameter for assessing battery life.
Tpeak_L: The data show a significant positive correlation with battery capacity, indicating that the location of the temperature peak during discharge is directly proportional to the battery capacity, thus making it a reliable indicator for SOH assessment.
ICP and ICPL: These indices show a significant positive correlation with battery capacity, indicating that their contribution to battery capacity is positive, and therefore become important indicators for predicting battery health trajectories.
SampEn: The SampEn parameter shows a strong negative correlation with the battery capacity, indicating that an increase in the entropy of the discharge voltage samples has an inverse effect on the battery capacity, and is therefore important in battery health monitoring.
The correlation analysis can screen out effective indicators that have significant linear relationships with battery capacity, while promoting a more nuanced understanding of the battery health trajectory and laying the foundation for a reliable and accurate prediction model.

Model Framework and Model Training 4.1. The Framework of Capacity Estimation
This study proposes a framework for predicting lithium-ion batteries' capacity, utilizing an attention mechanism.The framework initially extracts health indicators from the battery data, and following a series of feature extraction processes, it incorporates a temporal attention mechanism along with a CNN-LSTM network to enable the indirect prediction of lithium-ion battery capacity.The structure and implementation details of the framework are depicted in detail in Figure 5.

• Data Collection and Feature Extraction
The analytical process initiates with the extraction of key HIs from the raw battery data, supplemented by data normalization to ensure compatibility with the model requirements.These HIs are pivotal in providing a comprehensive depiction of the battery's health status.
In terms of measured HIs, the focus is placed on parameters that are directly observable from the battery's operational data.This encompasses the duration of the constant current (CC) charging stage (t cc ), variations in charging voltage over equidistant time intervals (ETCV), and the temporal location of the peak temperature during the discharge phase (TPL).These indicators directly reflect the battery's aging process, encapsulating the effects of wear and tear.Pertaining to calculated HIs, the analysis delves into the subtle electrochemical changes occurring within the battery.This involves examining the incremental capacity (IC) curve to extract the peak of the curve (ICP) and the location of this peak (ICPL).Additionally, the discharge voltage's sample entropy (SampEn) is computed.These calculated metrics provide a holistic view of the battery's health, enriching the analysis.Concluding this phase, a comprehensive correlation analysis is conducted to establish the relationship between these HIs and the battery's capacity.This step is crucial as it isolates the HIs that significantly impact battery capacity, ensuring that the predictive model is grounded in relevant and substantial data.The correlation analysis reveals the quantitative relationships between the HIs and battery capacity, facilitating feature selection, and enhancing the predictive model's accuracy and reliability.The results of this analysis are succinctly presented in a heatmap, providing a clear visual representation of the correlation between each indicator and battery capacity, thereby laying the groundwork for the subsequent predictive modeling.

• Capacity Prediction Model
The construction of the capacity prediction model hinges on the integration of a temporal attention mechanism with a deep learning network.After preprocessing, the data are fed into the model through an input layer, followed by a convolutional layer tasked with extracting local features from the time series data.To optimize computational efficiency, a max pooling layer is utilized to diminish both the parameters and computational load.Following the initial layers, LSTM layers are introduced to capture the inherent temporal dependencies in the data, a critical component for time series prediction tasks such as battery capacity forecasting.To facilitate a thorough understanding and showcase the comparative performance, a variety of visual representations such as prediction plots, error curves, and radar charts are employed.This extensive comparative analysis aims to highlight the unique advantages and superior predictive capabilities of the indirect battery capacity prediction model in handling complex tasks related to battery capacity estimation.With this composite network framework, this study expects to deeply explore the hidden information in battery data and construct an efficient and accurate time series prediction model.

Model Training
The prediction model implemented in this study does not require a lot of hardware equipment and therefore can run smoothly on a typical personal computer.The hardware used in this study mainly consists of a 12th Gen Intel(R) Core(TM) i9-12900H processor with a base clock speed of 2.50 GHz.Additionally, this computer utilizes an integrated graphics card, which provides sufficient computational power for the training and evaluation of the model.
In this model, the data preprocessing stage plays a crucial role.First, all the numerical features are scaled between 0 and 1 using the min-max normalization method to ensure that the model performs well when dealing with features at different scales.In addition to this, the model performed data filtering to remove noise and outliers that may affect the model's performance.Together, these steps ensure that the input data are high quality, laying a solid foundation for model training.
After data preprocessing, the input layer of the model starts to accept multivariate time series data with a fixed time step.The exact amount and type of data depends on the particular application scenario faced.After the data flow through the input layer, a convolutional layer configured with 64 filters and a 3 × 3 kernel size is next, aiming to extract local features from the time series data.This is immediately followed by a maximum pooling layer, which is used to reduce the spatial dimensionality of the data and reduce the amount of computation.This is followed by a dropout layer with a 0.3 dropout rate set to mitigate overfitting.Next is a series of LSTM layers, each configured with 50 hidden units and returning the complete output sequence to capture long-term dependencies in the data.
To further improve the model performance, the model introduces a temporal attention mechanism after the LSTM layers.This mechanism can enhance the model's understanding of time series by processing information from different representation subspaces in parallel.The details of the model design are described in Table 3.To fully evaluate the performance of the indirect battery capacity prediction model based on the temporal attention mechanism, the experiments were trained and tested on four different battery datasets.Each dataset contains a large amount of data about a specific battery, and ten sets of experiments were conducted on each dataset and averaged to ensure the reliability of the results.The average training time for the B_5 dataset was 9.92 s, and the average testing time was 1.79 s.This dataset contains 167 sets of data and demonstrates the model's efficiency in processing the battery data provided by NASA.The B_7 dataset has an average training time of 5.27 s and an average test time of 0.56 s.This dataset also contains 167 sets of data, and it has a concise training and test time, demonstrating the model's fast response time.The B_18 dataset has an average training time of 7.25 s and an average testing time of 0.59 s.Despite the small amount of data in this dataset (130 sets of data), the model can still complete training and testing in a short period.The average training time for the B_MIT dataset was 16.15 s, and the average testing time was 0.45 s.This dataset contains a much larger amount, 1800 sets, of data, making it a massive battery dataset.Despite the large amount of data, the model demonstrates its excellent performance in handling large amounts of data.These results clearly demonstrate the stability and efficiency of our model on datasets of different sizes and sources.Whether on small-scale datasets provided by NASA or large-scale datasets provided by MIT, the model can be trained and tested quickly, showing its fast, accurate, and reliable performance and good generalization ability.
The performance of the model was evaluated using various metrics including MSE, MAE, RMSE, MAPE and MaxAE.These metrics provide a comprehensive evaluation of the model's prediction accuracy and reliability, which ultimately results in a model that can accurately predict time series data with good generalization ability.

The Evaluation Criteria
In order to assess the predictive capability of the various network architectures deployed in this study, a series of meticulous evaluation metrics were used.These metrics are powerful tools for measuring the accuracy and reliability of the models in predicting the capacity of lithium-ion batteries.The calculation and significance of these metrics are described in detail below: • Mean Squared Error (MSE): This metric quantifies the average of the squares of the errors between the true and predicted values, thus offering an insight into the magnitude of the error generated by the model.The mathematical representation is as follows: where n is the number of observations, Y i is the actual value, and Ŷi is the predicted value.

•
Mean Absolute Error (MAE): MAE computes the average of the absolute differences between the actual and forecasted values, thus portraying a clear picture of the model's prediction accuracy.
• Root Mean Squared Error (RMSE): This metric represents the square root of the MSE, offering a perspective that is more aligned with the original data units and portrays a more interpretable view of the average error magnitude.
• Mean Absolute Percentage Error (MAPE): MAPE furnishes a relative measure of prediction accuracy as it computes the average percentage error between the actual and predicted values.
• Maximum Absolute Error (MaxAE): This metric captures the largest absolute error between the true and predicted values, thus highlighting the worst-case error scenario in the model's predictions.
In the forthcoming sections, these evaluation criteria will be instrumental in dissecting and contrasting the performance and predictive accuracy of the indirect battery capacity prediction model based on the time-attention mechanism against other network structures.

Capacity Prediction Based on the Proposed Method
This section analyzes and discusses the process and results of capacity prediction using the indirect battery capacity prediction model based on the time-attention mechanism.The capability and adaptability of the designed model are demonstrated through a detailed analysis of the prediction results and error curves for various battery datasets (B_5, B_7, B_18 and B_MIT).The analysis helps to illustrate the nuances of the model's performance on different battery datasets.

Analysis of Prediction Curves
As can be seen from the prediction curves in Figure 6, there is a high-fidelity correlation between the predicted values and the actual battery capacity, which proves the model's ability to predict complex patterns in the battery dataset.In particular, the prediction for the B_5 dataset shows the generality and accuracy of the model in interpreting datasets with different characteristics.In addition, despite the relatively small data pool of 130 data points for the B_18 dataset, the predictions maintain a high degree of consistency with the actual values, indicating that the model can provide more accurate predictions even with limited data.At the same time, the model has a certain degree of adaptability.The prediction results for the B_MIT dataset with 1800 data points maintain a high accuracy, showing its adaptability to data of different sizes.

Error Analysis
From the results, it can be analyzed that the model's prediction errors are generally kept to a minimum, with most of the errors tightly concentrated around the zero point.This indicates that the deviation from the true value is slight.However, there are occasional spikes in the errors, which may indicate the presence of outliers or noise in the data.These findings emphasize the need to further refine the battery data in future work.Specifically, a higher frequency of error fluctuations was found when analyzing larger datasets such as the battery B_MIT dataset.This may be related to the inherent noise in these larger datasets.Despite these challenges, the model showed a high level of adaptability, demonstrating the stability of the model.

Quantitative Evaluation
In order to more accurately analyze the predictive performance of the model, the key evaluation index data calculated based on the prediction data are shown in Table 4.In conclusion, the data show that the indirect battery capacity prediction model based on the time-attention mechanism performs well in predicting the capacity of lithium-ion batteries with high accuracy and stability, which lays the foundation for its further role in the field of battery capacity prediction.

Method Comparison and Error Analysis
This section presents a comprehensive model comparison and error analysis to verify the superiority of the proposed indirect battery capacity prediction model based on the timeattention mechanism.The performance of the proposed model is meticulously compared with other well-established models (CNN-LSTM network, CNN-LSTM network with transformer, CNN network alone, and LSTM network alone).This comparative analysis is based on multiple performance metrics evaluated on five different battery datasets.

Performance Metrics Analysis
In this subsection, the differences between the performance metrics of the indirect battery capacity prediction model based on the time-attention mechanism and those of the other four models are investigated: the indirect battery capacity prediction model based on the time-attention mechanism, CNN-LSTM with transformers, CNN-LSTM, CNN, and LSTM were analyzed for their performance metrics on five different battery datasets.These metrics provide insight into the accuracy and reliability of model predictions.Table 5 presents specific data for these indicators.The values are rounded to appropriate decimal points for better readability and expressed as percentages.
From the performance metrics, the indirect battery capacity prediction model based on the time-attention mechanism shows an altered prediction ability on all battery datasets.In the following, the model is analyzed in detail on different battery datasets in comparison to the benchmark model: In conclusion, the indirect battery capacity prediction model based on the timeattention mechanism shows better performance on all battery datasets.Comparative analysis with other models further highlights its reliability and accuracy in predicting battery capacity.A series of graphs will follow to support the conclusion.

Prediction Charts Analysis
For the reason that the starting point of the prediction curve in the graph is different from the starting point of the real curve, it is hereby explained: on the one hand, the study included data from both the training set and the test set in the prediction.However, for the sake of clarity and centralized presentation of the graph, the final chart removes the prediction part of the training set and keeps only the prediction curve of the test set.This means that the starting point of the test set prediction curve seen is the end point of the training set prediction curve.The prediction curves are generated based on patterns learned by the model in the training data, and this continuity cannot be visualized without displaying the training data.On the other hand, other models that do not fit the data well can cause the problem.
The prediction charts elucidated in Figure 7 help provide insight into the prediction accuracy and reliability of the proposed model.A closer look at the prediction charts for each battery dataset reveals that the proposed model is able to skillfully capture the features of different datasets, thus achieving a high degree of agreement between the predicted and actual data.

Error Curves Analysis
The error curve charts in Figure 8 show the difference between the data predicted by the different models and the true value.Further evidence of the accuracy of the main research model is provided by comparisons showing the small deviations from the true values.These data reveal the stability of the models in keeping the errors low, thus confirming their strong predictive ability.

Radar Chart Analysis
The radar chart analyses in Figure 9 provide a comprehensive picture of the model's performance on each metric.Given the range of values for the different metrics, the radar charts normalize the data using data transformation techniques such as logarithmic scale transformation to ensure a fair comparison.The charts provide further evidence of the superiority and reliability of the main models in predicting battery capacity.
On the B_5 dataset, the indirect battery capacity prediction model based on the timeattention mechanism demonstrated a remarkable 93.23% improvement in Test MSE and an 80.76% enhancement in Mean Absolute Error (Test MAE), compared to the average performance of the other four models.This underscores its robustness and precision.The B_7 dataset continued to excel, surpassing the competing models with an 86.31% improvement in Test MAE and an 86.41% improvement in Test MAPE.On the B_18 dataset, the model exhibited a 57.52% improvement in Test MSE, a 40.47% better performance in Test MAE, and a 13.46% enhancement in Maximum Absolute Error (Test MaxAE), showcasing its reliability in extreme scenarios.In the analysis of the larger B_MIT dataset, the model demonstrated outstanding performance, achieving an 83.17% improvement in Test MSE, a 65.03% improvement in Test MAE, a 64.71% enhancement in Test MAPE, and a 39.86% better performance in Test MaxAE, further proving its unparalleled accuracy and reliability across different battery datasets.These data indicate that, regardless of the battery dataset in question, the indirect battery capacity prediction model based on time-attention mechanism significantly outperforms other models on critical metrics, further attesting to its efficacy and reliability in predicting battery performance.

Conclusions
This article describes an indirect method for predicting the capacity of lithium-ion batteries based on a temporal attention mechanism combined with feature extraction.The method incorporates feature extraction sessions and temporal attention mechanisms into the deep learning model.A significant correlation with the battery capacity is established by extracting key health indicators from the charging and discharging cycles, thus eliminating the need for direct capacity measurement.The proposed indirect prediction model utilizes the temporal attention mechanism and performs better than traditional models in capturing the intricate temporal dependencies in battery data.The model shows better results across different dataset scenarios, with the test MAE and test RMSE consistently staying below 0.74% and 1.63%, respectively.This highlights the accuracy and reliability of the model in predicting the capacity of lithium-ion batteries.
A comprehensive evaluation of different battery datasets confirms the stability of the model and its versatility in adapting to different data sizes and characteristics.Thus, the methodology can be used as an effective tool for predicting the capacity of lithium-ion batteries, advancing the development of sustainable energy storage solutions.
However, it is essential to recognize the limitations of our study.The current model primarily uses datasets of specific charging modes, i.e., NASA's CC and CV modes and MIT's CC-CV mode, which may not encompass the full range of real-world battery usage scenarios, including dynamic nonlinear discharge waveforms.Future research could explore integrating a more comprehensive range of charging and discharging models to more realistically reflect battery degradation under different operating conditions.Such extensions may improve the applicability and accuracy of the model in real-world environments, thereby contributing to more reliable predictions of lithium-ion battery capacity changes over time.

Figure 1 .
Figure 1.Structure of the temporal attention mechanism.

•
Network Structure Diagram To illustrate the complex network structure in detail, Figure 2 is a diagram of the network structure of the prediction model based on the temporal attention mechanism to help in gaining a deep understanding of the model's functionality and the synergistic dynamics between the layers.

Figure 2 .
Figure 2. Structure of the indirect battery capacity prediction model based on the time-attention mechanism.

Figure 3 .
Figure 3. (a) Battery capacity degradation curves for the NASA dataset.(b) Battery capacity degradation curves for the MIT dataset.The different colored lines represent the change in discharge capacity of different batteries.

Figure 4 .
Figure 4. (a,b) are the charging and discharging current curves for the NASA dataset.(c,d) are the charging and discharging voltage curves for the NASA dataset.(e,f) are the charging and discharging battery temperature curves for the NASA dataset.

Figure 5 .
Figure 5. Framework of the indirect battery capacity prediction model based on the time-attention mechanism combined with feature extraction.

Figure 6 .
Figure 6.Prediction plots for the five battery datasets.(a) is the prediction plot for the B_5 battery dataset.(b) is the prediction plot for the B_7 battery dataset.(c) is the prediction plot for the B_18 battery dataset.(d) is the prediction plot for the B_MIT battery dataset.

Figure 7 .
Figure 7. Combined prediction charts of the five models for the five battery datasets.(a) is the combined prediction chart of five network models for the B_5 battery dataset.(b) is the combined prediction chart of the five network models for the B_7 battery dataset.(c) is the combined prediction chart of five network models for the B_18 battery dataset.(d) is the combined prediction chart of five network models for the B_MIT battery dataset.

Figure 8 .
Figure 8. Summarized error curve charts for the five battery datasets under the five network structures.(a) is the summary error curve chart for the B_5 battery dataset.(b) is the summary error curve chart of B_7 battery dataset.(c) is the summary error curve chart of B_18 battery dataset.(d) is the summary error curve chart of B_MIT battery dataset.

Figure 9 .
Figure 9. Summarized evaluation coefficient radar charts for the four battery datasets under the five network structures.(a) is the evaluation coefficient radar chart for the B_5 battery dataset.(b) is the evaluation coefficient radar chart for the B_7 battery dataset.(c) is the evaluation coefficient radar chart for the B_18 Battery dataset.(d) is the evaluation coefficient radar chart for the B_MIT Battery dataset.

Table 1 .
Summary of deep learning methods for battery capacity prediction.
and includes the six features ETCV (Equal Time Interval Charging Voltage Variation), tcc (Charging Time of CC Charging Phase), Tpeak_L (Temperature Peak Position during Discharge), ICP (Peak of IC Curve), ICPL (Peak Position of IC Curve), and SampEn (Sampling Entropy of Discharge Voltage).

Table 2 .
Correlation analysis between different features and battery capacity for various batteries.
To bolster the model's ability to focus on significant temporal features, a temporal attention layer is amalgamated with the LSTM layers.This integration allows the model to allocate varied attention weights to different time steps based on their relevance.The training of the model proceeds in a sequential manner, starting with the extraction of local features via the convolutional layer, followed by the LSTM layers capturing the long-term dependencies.The inclusion of the temporal attention mechanism ensures meticulous focus on pivotal time steps, thereby enhancing the model's prediction accuracy.Throughout the training phase, appropriate optimizers and loss functions are chosen to guarantee both the accuracy and stability of the model's predictions.This detailed approach to model training and architecture selection culminates in a robust and reliable capacity prediction model, adept at navigating the complexities of battery capacity data.
• Model Evaluation and Comparison In the comprehensive evaluation of the capacity prediction model, a series of evaluation metrics including Mean Squared Error (MSE), Mean Absolute Error (MAE), Root Mean Squared Error (RMSE) and Maximum Absolute Error (MaxAE) are utilized.These metrics collectively provide insights into the accuracy, stability, and robustness of the model various scenarios.The performance of the proposed model is rigorously compared with several established network structures to validate its effectiveness and demonstrate its superiority.The models for comparison encompass a CNN-LSTM network, a CNN-LSTM network enhanced with transformers, a standalone CNN network, and a standalone LSTM network.

Table 3 .
Description of the model structure.

Table 4 .
Performance metrics of the prediction model based on temporal attention mechanism on various batteries.The RMSE is more sensitive to outliers, so it better reflects the presence of more significant errors.As can be seen from the table, the model used has relatively low RMSE values for all the battery datasets, which further confirms the accuracy of its predictions.• MAPE: The MAPE values underline the model's precision, reflecting minor deviations from the true values.• MaxAE: From the MaxAE values in the table, it can be seen that the maximum prediction errors of the model are relatively small on all datasets, further validating the reliability and robustness of the model.

Table 5 .
Performance metrics of various models on selected batteries.