Research on Remaining Capacity Prediction of EV Battery Pack Based on Improved Transformer

1. Introduction and Research Motivation

The rapid development of the new energy electric vehicle industry has positioned lithium-ion batteries as the core power source for modern transportation. As the global energy crisis intensifies and environmental regulations become more stringent, the shift from traditional internal combustion engine vehicles to electric vehicles has accelerated dramatically. In this transformation, accurate prediction of the State of Charge (SOC) of lithium-ion batteries within an EV battery pack has become critically important for ensuring operational safety, optimizing battery performance, and extending battery lifespan.

The SOC is defined as the ratio of the remaining capacity to the rated capacity of a battery, mathematically expressed as:

$$
SOC = \frac{Q_{remaining}}{Q_{rated}} \times 100\% \quad (1-1)
$$

where \(Q_{remaining}\) represents the remaining electric quantity and \(Q_{rated}\) represents the rated capacity. The SOC value directly indicates the remaining driving range of an electric vehicle, making it an indispensable parameter for the Battery Management System (BMS). A precise SOC estimation prevents overcharging and over-discharging, thereby protecting the EV battery pack from irreversible damage and safety hazards.

However, SOC cannot be measured directly through physical sensors. Instead, it must be inferred from other measurable battery parameters such as voltage, current, and temperature. These parameters exhibit complex, nonlinear relationships with SOC, influenced by factors including temperature variations, battery aging, load conditions, and dynamic driving patterns. This inherent complexity makes SOC prediction a challenging task that has attracted extensive research attention.

2. Literature Review and Research Gap

The existing SOC prediction methods can be broadly categorized into three main groups: traditional methods, model-based methods, and data-driven methods.

2.1 Traditional Prediction Methods

Coulomb Counting Method: This approach calculates SOC by integrating the current over time:

$$
SOC = SOC_0 – \frac{1}{Q_r} \int_0^t kI dt \quad (1-2)
$$

where \(SOC_0\) is the initial SOC, \(Q_r\) is the rated capacity, \(I\) is the current, and \(k\) is the Coulombic efficiency coefficient ranging between 0.9 and 1. While simple to implement, this method suffers from cumulative errors due to current sensor noise and inaccurate initial SOC values. Temperature variations and changing current rates further degrade its accuracy, making it unreliable for real-world EV applications.

Open Circuit Voltage (OCV) Method: This method leverages the functional relationship between the open-circuit voltage and SOC. The relationship is established through polynomial fitting or look-up tables. However, this approach requires the battery to be at rest for an extended period to obtain accurate OCV readings, which is impractical for real-time SOC monitoring in operating vehicles. Additionally, the flat region of the OCV-SOC curve demands extremely high voltage measurement precision.

2.2 Model-Based Methods

Kalman Filter Family: Kalman filtering and its variants have been widely applied to SOC estimation. The Extended Kalman Filter (EKF) linearizes the nonlinear battery model through first-order Taylor expansion, but suffers from accuracy limitations. The Unscented Kalman Filter (UKF) and Cubature Kalman Filter (CKF) improve upon EKF by utilizing sigma-point transformations, achieving third-order accuracy for nonlinear systems. The H-infinity filter demonstrates robustness against system noise and model parameter uncertainties. However, these methods heavily depend on accurate battery model parameters and prior knowledge of noise statistics.

Particle Filter: Unlike Kalman filter approaches, particle filters can handle arbitrary noise distributions and nonlinearities. Genetic algorithm-optimized particle filters and grey wolf optimizer-based particle filters have been proposed to address particle depletion issues. Nevertheless, these methods require significant computational resources, making real-time implementation challenging for BMS applications in EV battery pack systems.

2.3 Data-Driven Methods

With the advancement of artificial intelligence, data-driven methods have gained significant attention for SOC prediction. These methods do not rely on explicit battery models and can directly learn the complex mapping relationships between measurable parameters and SOC values.

Support Vector Machines (SVM): SVM-based approaches utilize kernel functions to transform nonlinear regression problems into linear ones. Weighted Least Squares SVM has demonstrated good robustness in capturing the complex dynamic characteristics of battery internal states.

Feed-forward Neural Networks (FNN): Simple FNN architectures provide basic SOC estimation capabilities but cannot effectively capture temporal dependencies in sequential data.

Long Short-Term Memory (LSTM) Networks: LSTM networks, as variants of Recurrent Neural Networks (RNN), solve the gradient vanishing and exploding problems. They have achieved promising results in SOC prediction by learning temporal dependencies in battery data. However, LSTM processes sequences sequentially, leading to low parallelization efficiency during training.

Temporal Convolutional Networks (TCN): TCN uses causal convolutions to process sequence data with higher parallelism than RNN-based models. Hybrid TCN-LSTM models have demonstrated improved accuracy for SOC prediction tasks.

Transformer Models: The Transformer architecture, built entirely on self-attention mechanisms, has revolutionized sequence processing. Its advantages include solving long-range dependency problems and enabling parallel computation. However, the original Transformer suffers from high computational complexity due to the quadratic scaling of spatial complexity with sequence length.

The iTransformer model, which employs only the encoder structure, achieves efficient time series prediction performance by treating each variable sequence as an input token and focusing on inter-variable correlations. While iTransformer effectively captures global temporal information through its linear feed-forward network, it has limited capability in extracting local temporal patterns. Furthermore, the model lacks frequency-domain information processing, which is crucial for understanding periodic patterns in battery operational data.

3. Theoretical Foundations

3.1 Lithium-Ion Battery Fundamentals

The core structure of typical lithium-ion batteries consists of positive and negative electrodes, electrolyte, and a separator. During the charging process, electrons flow from the positive electrode to the negative electrode as electrical energy is converted into chemical energy. Conversely, during discharge, electrons flow from the negative to positive electrode, converting chemical energy back to electrical energy. These electrochemical reactions depend on the electrode materials and significantly influence the battery performance characteristics.

3.2 Deep Learning Components

Artificial Neural Networks: A basic neural network performs nonlinear mapping through activation functions:

$$
y = f\left(\sum_{i=1}^{n} w_i x_i + b\right) \quad (2-1)
$$

One-Dimensional Convolutional Neural Networks: A 1D convolution layer effectively extracts local features from sequence data through weight sharing:

$$
y_i = \sum_{j=0}^{k-1} x_{i+j} w_j + b \quad (2-2)
$$

where \(k\) represents the convolutional kernel size and \(w_j\) are the learnable weight parameters.

Transformer Architecture: The Transformer consists of encoder and decoder stacks, each containing multi-head self-attention mechanisms and feed-forward networks. The core self-attention mechanism is expressed as:

$$
Attention(Q, K, V) = softmax\left(\frac{QK^T}{\sqrt{d_k}}\right)V \quad (2-3)
$$

The positional encoding enables the model to capture sequence position information:

$$
PE(pos, 2i) = \sin\left(\frac{pos}{10000^{2i/d_{model}}}\right) \quad (2-4)
$$

$$
PE(pos, 2i+1) = \cos\left(\frac{pos}{10000^{2i/d_{model}}}\right) \quad (2-5)
$$

The standard feed-forward network in Transformer applies two linear transformations with a ReLU activation:

$$
FFN(x) = \max(0, xW_1 + b_1)W_2 + b_2 \quad (2-6)
$$

3.3 Evaluation Metrics

To comprehensively evaluate the SOC prediction performance, three standard metrics are employed:

$$
MAE = \frac{1}{n}\sum_{i=1}^{n} |SOC_i – \widehat{SOC}_i| \quad (2-7)
$$

$$
RMSE = \sqrt{\frac{1}{n}\sum_{i=1}^{n} (SOC_i – \widehat{SOC}_i)^2} \quad (2-8)
$$

$$
R^2 = 1 – \frac{\sum_{i=1}^{n} (SOC_i – \widehat{SOC}_i)^2}{\sum_{i=1}^{n} (SOC_i – \bar{SOC})^2} \quad (2-9)
$$

4. Proposed Methodology

4.1 Dataset Description

In this research, I validate the proposed SOC prediction model using two types of battery datasets: the A123 LiFePO4 battery (1100mAh rated capacity) and the INR 18650-20R battery (2000mAh rated capacity). These datasets are collected from the Center for Advanced Life Cycle Engineering (CALCE) and include Dynamic Stress Test (DST), Highway Driving Schedule (US06), and Federal Urban Driving Schedule (FUDS) test conditions across multiple temperature levels (0℃, 25℃, 40℃/45℃).

The calibration data under constant current charging followed by dynamic discharge cycles closely simulates real-world EV battery pack operating scenarios. To ensure data quality, missing values are handled through Lagrangian interpolation and moving average methods. Min-Max normalization is then applied to eliminate the dimensional differences between voltage (V), current (A), and temperature (℃) features:

$$
x’ = \frac{x – x_{min}}{x_{max} – x_{min}} \quad (3-6)
$$

4.2 PCL-iFormer Model for SOC Prediction

In the first part of this work, I propose the Parallel Convolutional Linear iTransformer (PCL-iFormer) model to address the limitations of the original iTransformer architecture. The iTransformer model treats each variable sequence as tokens and applies self-attention to capture inter-variable correlations. However, its feed-forward network with only linear modules is limited to extracting global temporal information. To enhance the local temporal feature extraction capability, I introduce a one-dimensional convolution module running in parallel with the original linear module within the feed-forward network.

The improved feed-forward network combines both local and global information:

$$
y = W_C x_C + W_L x_L \quad (3-13)
$$

where \(W_C\) and \(W_L\) represent the learnable weights for the convolutional and linear modules respectively, while \(x_C\) and \(x_L\) denote their corresponding outputs.

The complete PCL-iFormer architecture processes the input in four stages:
1. Embedding layer: Each variable sequence is formulated as a token through embedding and position encoding
2. Multi-variate attention layer: Captures attention correlation between variables
3. Feed-forward network: The parallel convolution-linear structure extracts both local and global temporal patterns
4. Projection layer: Generates the final SOC predictions

A sliding window approach with N-1 (multi-to-single) prediction structure was adopted. The window size is set to 50 time steps, and the model is trained with a batch size of 64 and an initial learning rate of 0.01 and iteration count of 200.

To thoroughly investigate the contributions of the convolutional and linear modules, I designed four experimental configurations:
– Experiment A: convolutional module before the linear module (serial)
– Experiment B: linear module before the convolutional module (serial)
– Experiment C: parallel structure with fixed fusion parameters (0.5)
– Experiment D: parallel structure with adaptive learning fusion parameters

4.3 PSO-FFT-PCL-iFormer Model

To further improve the prediction accuracy of the SOC in an EV battery pack, I propose an enhanced model that integrates two additional components:

Fast Fourier Transform (FFT) for frequency domain processing: The FFT module filters input data by transforming time-domain signals to the frequency domain:

$$
X[k] = \sum_{n=0}^{N-1} x[n] e^{-j\frac{2\pi}{N}kn} \quad (4-3)
$$

The frequency-domain representation distinguishes useful low-frequency components characterizing the battery state evolution from high-frequency noise. A linear transformation is conducted over captured frequency information before inverse transform converts the data back to the time-domain representation.

Particle Swarm Optimization (PSO) for hyperparameter search: The PSO algorithm automatically optimizes critical hyperparameters including time step length, learning rate, batch size, and residual blocks. The velocity and position updates are performed as:

$$
V_{in}^{k+1} = w v_{in}^k + c_1 r_1(P_{in}^k – X_{in}^k) + c_2 r_2(P_{gn}^k – X_{in}^k) \quad (4-1)
$$

$$
X_{in}^{k+1} = X_{in}^k + V_{in}^{k+1} \quad (4-2)
$$

The optimal hyperparameters identified through PSO are summarized in the following table:

Parameter Value
Time Step 50
Batch Size 64
Learning Rate 0.0035
Residual Blocks 2
Loss Function MSE
Optimizer Adam

5. Experimental Results and Analysis

5.1 Evaluation of Module Configuration Strategies

I systematically compared four configurations across different operating temperatures (0℃, 25℃, 40℃) under both US06 and FUDS driving cycles. The training dataset consisted of DST cycle data, while US06 and FUDS cycles served as test datasets.

The experimental results are organized into the following tables:

Experiment A vs Experiment B in US06 (MAE %)
Temperature Experiment A Experiment B
0℃ 0.6452 0.6382
25℃ 0.5818 0.5805
40℃ 0.5830 0.5852

A comparison of the two serial configurations reveals that Experiment B achieves superior prediction performance in both test cycles and temperature conditions. The RMSE values in Experiment B for the US06 cycle at 0℃, 25℃, and 40℃ are 1.7010%, 1.5999%, and 1.6293% respectively. In comparison, Experiment D, which adopts the parallel configuration with adaptive fusion, achieves substantially lower RMSE values of 0.8205%, 0.7697%, and 0.7857% at the same temperatures.

The parallel configuration with adaptive learning of fusion parameters, represented by Experiment D, substantially outperforms both serial configurations and the parallel configuration with fixed fusion parameters.

Comparison of experiment B, experiment D, and iTransformer (US06 cycle)
Model Temperature MAE (%) RMSE (%) R² (%)
Experiment B 0℃ 0.6382 1.7010 99.6613
25℃ 0.5805 1.5999 99.7144
40℃ 0.5852 1.6293 99.6877
Experiment D 0℃ 0.3524 0.8205 99.9212
25℃ 0.3253 0.7697 99.9339
40℃ 0.3312 0.7857 99.9274
iTransformer 0℃ 0.3852 0.9253 99.8998
25℃ 0.3591 0.8598 99.9175
40℃ 0.3625 0.8757 99.9098

The parallel structure achieves significantly better results because convolutional and linear pathways process data independently to capture local and global patterns separately. The adaptive learning mechanism enables dynamic adjustment of information weighting between the convolutional and linear pathways. This allows for optimal fusion of complementary information sources based on temporal contextual requirements. In contrast, serial configurations suffer information loss through sequential processing, while parallel structures with fixed fusion parameters restrict the model from adapting feature weighting based on data characteristics.

Experiment D vs iTransformer predictive error improvements in US06 cycle
Metric iTransformer Experiment D Improvement
MAE at 25℃ (%) 0.3591 0.3253 9.42% reduction
RMSE at 25℃ (%) 0.8598 0.7697 10.48% reduction

Overall, Experiment D achieves MAE improvements of 8.52% and RMSE improvements of 11.33% compared to the baseline iTransformer model under the US06 test cycle at 25℃, and 9.49% MAE and 12.77% RMSE improvements under the FUDS cycle at the same temperature.

5.2 Effectiveness of PSO and FFT Modules

I used an ablation study at US06 cycle and 25℃ to verify the contribution of each added model component. The results are shown in the table below:

Ablation study results (US06, 25℃)
Model MAE (%) RMSE (%) R² (%)
PCL-iFormer 0.3253 0.7697 99.9339
FFT-PCL-iFormer 0.3149 0.6861 99.9427
PSO-FFT-PCL-iFormer 0.3062 0.6630 99.9509

Adding FFT to the PCL-iFormer model reduces the MAE from 0.3253% to 0.3149% (a 3.19% improvement) and the RMSE from 0.7697% to 0.6861% (a 10.86% improvement). These enhancements are attributed to FFT feature extraction by way of filtering high-frequency noise while preserving valuable temporal information.

The PSO optimization further reduces MAE by 2.76% and RMSE by 3.37%. This improvement demonstrates the capability of PSO in identifying optimal hyperparameter combinations that enhance the model convergence behavior and total predictive capability.

5.3 Comprehensive Comparison with Baseline Methods

The PSO-FFT-PCL-iFormer model performance was compared against several existing models including Transformer, Informer, PatchTsT, and iTransformer under multiple temperatures and driving styles. The results for the A123 battery under the US06 and FUDS cycles at 25℃ conditions are presented below:

A123 battery prediction performance comparison (MAE/RMSE in %)
Model US06 at 25℃ FUDS at 25℃
Transformer 0.6121 / 1.1811 0.6232 / 1.2164
Informer 0.5679 / 1.1732 0.5189 / 1.0765
PatchTsT 0.4468 / 0.9698 0.4499 / 0.9723
iTransformer 0.3591 / 0.8598 0.4011 / 0.8515
PSO-FFT-PCL-iFormer 0.3062 / 0.6630 0.3549 / 0.6661

The proposed PSO-FFT-PCL-iFormer model significantly outperforms all baseline methods on the A123 battery dataset. Compared with the benchmark iTransformer model at 25℃, the MAE is reduced by 14.73% and RMSE is reduced by as much as 22.89% under the US06 conditions. Specifically, the MAE decreases from 0.3591% to 0.3062%, while RMSE decreases from 0.8598% to 0.6630%. Similar improvements are observed under the FUDS cycle at 25℃, with MAE decreasing 11.52% from 0.4011% to 0.3549% and RMSE decreasing 21.77% from 0.8515% to 0.6661%.

These results provide strong evidence that the inclusion of parallel convolutional pathways, together with FFT-based noise suppression, yields more accurate and reliable SOC predictions across different operating conditions within an EV battery pack.

5.4 Performance across Different Temperatures

I evaluated the stability and robustness of the proposed model under different temperatures (0℃, 25℃, 40℃). The results for the A123 battery dataset are tabulated below:

A123 battery evaluation metrics across temperatures
Cycle Temperature MAE (%) RMSE (%) R² (%)
US06 0℃ 0.3201 0.7034 99.9421
25℃ 0.3062 0.6630 99.9509
40℃ 0.3108 0.6759 99.9463
FUDS 0℃ 0.3634 0.7025 99.9466
25℃ 0.3549 0.6661 99.9477
40℃ 0.3563 0.6759 99.9453

In the US06 cycle, the maximum MAE is 0.3201% at 0℃ while the maximum RMSE is 0.7034%. In the FUDS cycle, the maximum MAE and RMSE values at different temperatures are 0.3634% and 0.7025%, respectively. All R² values stay above 99.94%, indicating that the model consistently maintains high accuracy across varying thermal environments.

5.5 Cross-Dataset Validation with the INR 18650-20R Battery

To assess the generalization capability of the proposed model to different battery chemistries and form factors, I expanded the validation by testing the model on the INR 18650-20R battery data. This dataset contains SOC cycles starting from 80% initial state of charge, providing better alignment with real-world EV battery pack practices. The operating temperatures include 0℃, 25℃, and 45℃, and the three tested driving cycles are US06, FUDS, and BJDST.

The results are shown below:

INR18650-20R battery evaluation metrics
Cycle Temperature MAE (%) RMSE (%) R² (%)
US06 0℃ 0.3078 0.8765 99.8859
25℃ 0.2905 0.8475 99.8961
45℃ 0.2758 0.7960 99.9038
FUDS 0℃ 0.3372 0.8993 99.8816
25℃ 0.2986 0.7978 99.9192
45℃ 0.2943 0.7802 99.9057
BJDST 0℃ 0.2727 0.7121 99.9358
25℃ 0.3073 0.8207 99.8963
45℃ 0.2941 0.7925 99.8991

A comparison with the state-of-the-art TTSNet model and other related literature on US06 cycle at different temperatures demonstrates the superior predictive performance of the proposed model, especially at lower temperatures.

Comparison with state-of-the-art models on MAE (%)
Model US06 0℃ US06 25℃ US06 45℃
Correlation-analysis 2.00 1.80 1.40
FFRLS-GPR 0.68 0.34 0.56
GRU-RNN 1.04 0.43 0.42
Sequence-to-sequence 1.68 0.95 0.81
TTSNet 0.34 0.23 0.20
Proposed PSO-FFT-PCL-iFormer 0.31 0.29 0.28

While the TTSNet model demonstrates somewhat better performance at 25℃ and 45℃, the proposed model exhibits superior prediction accuracy at 0℃. This is particularly valuable because low-temperature SOC estimation is a critical challenge in EV battery pack management systems, as battery capacity and internal resistance vary significantly with temperature. The effective frequency-domain representation and adaptive feature extraction of the proposed model capture the complex dynamics that emerge in sub-optimal thermal operating conditions.

6. Conclusions and Future Work

6.1 Summary of Contributions

This thesis presents a systematic approach to improving SOC estimation for an EV battery pack through the following contributions:

1. Development of the PCL-iFormer model: By introducing one-dimensional convolution modules that parallel the linear layers within the iTransformer feed-forward network, I propose PCL-iFormer. This architecture allows the model to capture both local and global temporal information simultaneously. Experimental validation identified the adaptive fusion parameters (Experiment D) as substantially more effective than either serial configurations or fixed-parameter parallel structures. Detailed experiments generated maximum MAE reductions from 0.6452% to 0.3253% in the US06 cycle and from 0.6638% to 0.3642% in the FUDS cycle.

2. Construction of the PSO-FFT-PCL-iFormer model: The complete proposed model integrates FFT to filter high-frequency noise from input data and PSO to optimize the hyperparameters of the model. The incorporation of frequency-domain features allowed the model to identify and exploit periodic patterns embedded within the time-domain dynamics of the battery signals. The FFT analysis provides additional channels of semantic information which improves the predictive capacity of the model. Meanwhile, auto-optimization through PSO eliminates the laborious manual parameter search process and improves performance consistency.

3. Cross-domain validation: The PSO-FFT-PCL-iFormer model was extensively validated under multiple driving cycles (US06, FUDS, BJDST), multiple temperatures (0℃, 25℃, 40℃, 45℃), and across multiple battery chemistries (A123 LiFePO4 and INR18650-20R LNMC). The sustained high accuracy across all scenarios underscores the strong generalization capability and practical applicability of this approach for EV battery pack SOC prediction.

The predicted SOC curves are closely aligned with the actual SOC curves in both the US06 and FUDS cycles. The prediction errors remain below 0.5% for the majority of the discharge process, marking a significant improvement over existing state-of-the-art approaches.

4. Comparative evaluation: In experiments performed at 25℃, the proposed model achieves the lowest MAE values: 0.3062% for the US06 cycle and 0.3549% for the FUDS cycle. When comparing the proposed model against current literatures related to the INR 18650 battery, the MAE at 0℃ is 0.31% under the US06 cycle, outperforming all benchmarked methods. This demonstrates the model’s heightened robustness under cold environments where lithium-ion dynamics become significantly more complex to characterize.

6.2 Limitations

Despite its promising performance, this study acknowledges several limitations:

1. The datasets used for validation are obtained from individual battery cells. In contrast, real-world vehicular applications utilise series-parallel configurations of multiple cells. The intricate dynamics within an EV battery pack may result in variations in SOC across cells due to differences in internal resistance and thermal conditions.

2. The dataset used in this study covers a single charge-discharge cycle. As batteries undergo repeated cycling, they exhibit capacity fade and internal resistance growth. A SOC prediction model trained on fresh cell behavior may not accurately predict SOC for aged cells.

3. In practice, real-time data collection sometimes involves measurement lag. The current model uses voltage, current, and temperature readings as inputs. The absence of internal resistance, which is a useful health indicator given the aging of an EV battery pack, can be considered a limiting factor.

6.3 Future Research Directions

Building upon the findings of this study, several promising research avenues emerge for the future:

– Battery pack-level SOC prediction: Future data acquisition could focus on actual battery packs, enabling the construction and validation of SOC prediction models tailored to multi-cell configurations.

– Joint SOC and SOH estimation: Future research could consider battery aging across different health states and develop SOC prediction models that generalize across the whole lifespan of an EV battery pack by integrating state of health information into the model input.

– Enhanced frequency-domain features: While the current work relies on simple FFT, more advanced frequency-domain transformation approaches, such as the wavelet transform or short-time Fourier transform, may provide better time-frequency resolution for characterizing non-periodic and non-stationary components of the battery signals.

– Deployment optimization: Considering the computational constraints of vehicle embedded systems, future efforts could explore model compression and quantization techniques to enable deployment of these prediction models on low-power microcontrollers and dedicated BMS hardware.

In conclusion, the PSO-FFT-PCL-iFormer model presented in this thesis demonstrates excellent SOC prediction accuracy across diverse operating scenarios and battery chemistries. This research also confirms that the incorporation of advanced feature-extraction mechanisms into Transformer architectures constitutes a powerful strategy for building dynamic predictive models for battery management systems. It thereby contributes meaningful groundwork for safe and efficient operation of an EV battery pack under real-world driving conditions.

Scroll to Top