Research on the State of Charge Estimation of Electric Forklift Batteries Based on an Improved Transformer Model
Abstract
1. Introduction
- (1)
- A Kalman filter–principal component analysis (PCA) algorithm is used in this paper to process the original experimental data. The Kalman filter is first used to suppress noise, and then PCA is employed to reduce the dimensionality of the filtered data, thereby lowering computational complexity. By evaluating the performance of different data preprocessing methods for training the surrogate model, an optimal data processing strategy is found, which improves the accuracy of SoC estimation.
- (2)
- The proposed initial improved Transformer algorithm incorporates a convolution layer, an LSTM layer, and two-layer attention mechanisms. By evaluating the performance of different algorithms (LSTM, CNN, and some improved Transformer models) in battery SoC estimation, an optimal SoC estimation method suitable for an electric forklift under variable operating conditions is proposed.
2. Methodology
2.1. PCA
2.2. LSTM
2.3. CNN
2.4. Attention Mechanism
2.5. Improved Transformer Model
- (1)
- The processed experimental data are set as the input layer. In this study, the original experimental data are processed using three different methods (original experimental data, Kalman filter, and Kalman filter–principal component analysis), yielding three corresponding datasets. Then, these three datasets subsequently are used as input for this algorithm.
- (2)
- The position embedding layer is utilized to obtain position information.
- (3)
- The addition layer is employed to fuse the data from steps (1) and (2).
- (4)
- The convolution layer is used to extract local features of the data. The kernel size is set to 3 and the number of filters is selected as 64.
- (5)
- Two layers of attention mechanisms, namely a masked multi-head attention mechanism and a multi-head attention mechanism without masking are used to adaptively capture the internal correlations. The number of attention heads in these two attention layers is set to 4, and the attention dimensions are both set as 128.
- (6)
- The LSTM layer is used to re-extract data features. The number of hidden units in the LSTM layer is selected as 50.
- (7)
- The fully connected layer is selected to integrate data features.
- (8)
- The regression layer is set as the output layer, which defines the loss function (mean squared error) to optimize the model parameters during training.

3. Experimental Results
- (1)
- The first step is to conduct a performance test on the single battery. The main equipment includes two temperature-controlled chambers and a cell charge–discharge test system. The testing pipeline is as follows: The host computer transmits preset working conditions of batteries to the tester via a TCP/IP communication interface. The tester then executes the corresponding configuration for the batteries. The lithium iron phosphate batteries used for experimental testing are placed in two independent temperature chambers to compare the impact of different temperatures on the battery’s charge–discharge performance. The experimental test monitor displays and records the battery’s real-time operating parameters, such as current, voltage, and battery temperature.
- (2)
- The second step is to conduct tests on the battery pack data of a real vehicle. The individual battery cells are assembled into a battery pack, which is then installed on an electric forklift. All experimental data are collected by the Battery Management System (BMS) collector. In this paper, 3.2 V 280 Ah lithium iron phosphate batteries are connected in a 2-parallel and 24-series configuration to form a 76.8 V 560 Ah battery pack, with an energy capacity of 43 kWh when fully charged. This battery pack is mounted on a 3.5-ton forklift, enabling the equipment to operate continuously for 6 h. In Step (1), the experimental tests are conducted of a single battery under high and low temperature environment as well as high-current charge–discharge conditions, so as to determine the boundary conditions for the overall operation of the battery pack after assembly. According to the design parameters of the forklift’s electric drive system, the maximum power of its traction motor is 8 kW and that of the lifting motor is 12 kW. Based on the estimation under full-load lifting conditions, the maximum discharge rate of the battery is less than 1 C. Therefore, the battery pack designed and developed through Step (1) and Step (2) meets the requirements for the vehicle’s operation under all working conditions.
4. Results and Discussion
4.1. Evaluation Metrics
4.2. Comparison with Different Algorithms
4.2.1. Data Preprocessing
4.2.2. Analysis of the Impact of Single-Layer Removal on Model Prediction Performance
4.2.3. Discussion for Different Estimation Models
5. Conclusions
- (1)
- Since the data preprocessing methods can affect the prediction accuracy of different estimation models, three methods are employed in this paper to compare the prediction performance on SoC estimation. Training the improved Transformer model using original experimental data proves ineffective in learning the laws of SoC. Compared to the single Kalman filter method, the Kalman filter–PCA algorithm achieves a higher prediction accuracy, where the MAE and RMSE are decreased by 26.32% and 27.73%, respectively. It can be found that compared with the single Kalman filter method, the Kalman filter–PCA algorithm can more effectively improve the prediction accuracy of the improved Transformer model in SoC prediction.
- (2)
- The PCA is employed to reduce the dimensionality of the original 12-dimensional experimental data. The results indicate that different dimensionalities have an impact on the prediction performance of the improved Transformer model. Compared to three-dimensional and seven-dimensional data, the five-dimensional data reduce MAE by 14.63% and 19.54%, and RMSE by 14.85% and 20.37%, respectively. It can be evident that the selection of data dimensions has an impact on the prediction performance of neural networks, and appropriate dimensions can effectively train the surrogate models, resulting in high prediction accuracy.
- (3)
- Three different models are derived from the initial improved Transformer model. These three models are obtained by removing the convolution layer, LSTM layer, and attention layer, respectively. The results show that different Transformer network structures achieve varying prediction accuracy for SoC estimation. The improved Transformer 2 model with its LSTM layer removed achieves the highest SoC prediction accuracy compared to the other three models.
- (4)
- The Kalman filter–PCA method is used to preprocess data for training the LSTM, CNN, and improved Transformer 2 models, which are then utilized to predict SoC. Compared to the single LSTM model, the improved Transformer 2 model achieves a significant reduction in the MAE (77.16%) and RMSE (91.75%) of the prediction results. Compared with the single CNN model, the proposed improved Transformer 2 model can decrease the MAE and RMSE by 71.81% and 80%, respectively. It can be observed that the improved Transformer 2 model developed in this study can significantly improve the prediction accuracy of the SoC for the current electric forklift under real operating conditions.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Xie, Y.; Han, Z.; Zhang, J.; Liu, L. A physics-constrained Informer-LSTM network for battery state-of-charge estimation. J. Energy Storage 2025, 136, 118381. [Google Scholar] [CrossRef]
- Chen, S. State of Power Prediction for Parallel Battery System Considering Cell Inconsistency Degree; Yancheng Institute of Technology: Yancheng, China, 2025. [Google Scholar]
- Oyewole, I.; Chehade, A.; Kim, Y. A controllable deep transfer learning network with multiple domain adaptation for battery state-of-charge estimation. Appl. Energy 2022, 312, 118726. [Google Scholar] [CrossRef]
- Jafari, S.; Kim, J.; Byun, Y. A novel fusion-based deep learning approach with PSO and explainable AI for batteries State of Charge estimation in Electric Vehicles. Energy Rep. 2024, 12, 3364–3385. [Google Scholar] [CrossRef]
- Kim, S.; Lee, S. Application of deep learning techniques for the state of charge prediction of lithium-Ion batteries. Appl. Sci. 2024, 14, 8077. [Google Scholar] [CrossRef]
- Franzese, P.; Iannuzzi, D.; Merolla, R.; Spina, I. Artificial neural networks for residual capacity estimation of cycle-aged cylindric LFP batteries. Batteries 2025, 11, 260. [Google Scholar] [CrossRef]
- Ding, Z.; Hu, D.; Jing, Y.; Ma, M.; Xie, Y.; Yin, Q.; Zeng, X.; Zhang, C.; Peng, T.; Ji, J. Research on precise lithium battery state of charge estimation method based on CALSE-LSTM model and pelican algorithm. Heliyon 2024, 10, e36232. [Google Scholar] [CrossRef]
- Song, X.; Yang, F.; Wang, D.; Tsui, K. Combined CNN-LSTM network for state-of-charge estimation of lithium-ion batteries. IEEE Access 2019, 7, 88894–88902. [Google Scholar] [CrossRef]
- Van, C.N.; Ngo, M.D.; Duc, C.D.; Thao, L.Q.; Ahn, S.J. State-of-charge estimation of lithium-ion battery integrated in electrical vehicle using a long short-term memory network. IEEE Access 2024, 12, 165472–165481. [Google Scholar]
- Shen, Y.; Ge, Y. Prediction of state of charge for lead-acid battery based on LSTM-attention and LightGBM. J. Comput. Inf. Sci. Eng. 2024, 24, 9. [Google Scholar] [CrossRef]
- Leonori, S.; Mostacciuolo, E.; Baccari, S.; Luzio, F.D. An advanced Li-ion cell equivalent circuit model using a neuro-physical approach. J. Energy Storage 2025, 139, 118623. [Google Scholar] [CrossRef]
- Lyu, L.; Jiang, B.; Zhu, J.; Wei, X.; Dai, H. An adaptive combined method for lithium-ion battery state of charge estimation using long short-term memory network and unscented kalman filter considering battery aging. Batter. Supercaps 2024, 7, e202400441. [Google Scholar] [CrossRef]
- Paul, T.; Wang, S.; Zhang, H.; Yang, X.; Fernandez, C. An optimized long short-term memory-weighted fading extended Kalman filtering model with wide temperature adaptation for the state of charge estimation of lithium-ion batteries. Appl. Energy 2022, 326, 120043. [Google Scholar]
- Zhang, X.; Huang, Y.; Zhang, Z.; Lin, H.; Zeng, Y.; Gao, M. A hybrid method for state-of-charge estimation for lithium-ion batteries using a long short-term memory network combined with attention and a kalman filter. Energies 2022, 15, 6745. [Google Scholar]
- Hu, P.; Tsang, C.; Lu, X.; Li, C.; Lee, C. Enhancing electric wheelchair safety via battery state of charge estimation with PCC–NSSR–LSTM method. Electron. Lett. 2025, 61, e70228. [Google Scholar] [CrossRef]
- Turk, M.; Pentland, A. Eigenfaces for recognition. J. Cogn. Neurosci. 1991, 3, 71–86. [Google Scholar] [CrossRef] [PubMed]
- Wang, Q. Study of Obust Principal Component Analysis and Its Applications. Ph.D. Thesis, Xidian University, Xi’an, China, 2019. [Google Scholar]
- Sun, L.; Qin, H.; Przystupa, K.; Majka, M.; Kochan, O. Individualized short-term electric load forecasting using data-driven meta-heuristic method based on LSTM network. Sensors 2022, 22, 7900. [Google Scholar] [CrossRef] [PubMed]
- Yu, T.; Zeng, X.; Feng, E.; Huang, J.; Zhang, G. A joint estimation of SOC-SOH for lithium batteries based on LSTM-Transformer multi-channel feature fusion. J. Railw. Sci. Eng. 2025, 43, 1423. [Google Scholar]
- Wang, M.; Gao, Q.; Feng, Y.; Zhao, N.; Chen, J.; Lü, C. Research on Bearing Fault Diagnosis via Multi-Feature Fusion Transformer-LSTM. Mech. Sci. Technol. Aerosp. Eng. 2025, 12, 1–11. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Proceedings of the 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017. [Google Scholar]




| Evaluation Metrics | Kalman Filter | Kalman Filter–PCA |
|---|---|---|
| MAE | 0.095 | 0.070 |
| RMSE | 0.119 | 0.086 |
| R2 | 0.999532 | 0.999754 |
| Evaluation Metrics | Three Dimensions | Five Dimensions | Seven Dimensions |
|---|---|---|---|
| MAE | 0.082 | 0.070 | 0.087 |
| RMSE | 0.101 | 0.086 | 0.108 |
| R2 | 0.999665 | 0.999754 | 0.999614 |
| No. | Models | MAE | RMSE | R2 | Computational Time |
|---|---|---|---|---|---|
| 1 | Delete convolution layer | 0.077 | 0.095 | 0.999701 | 75 s |
| 2 | Delete LSTM layer | 0.053 | 0.064 | 0.999864 | 197 s |
| 3 | Delete attention Layer | 0.075 | 0.092 | 0.999722 | 142 s |
| 4 | Improved Transformer | 0.070 | 0.086 | 0.999754 | 300 s |
| Evaluation Metrics | LSTM | CNN | Improved Transformer 2 |
|---|---|---|---|
| MAE | 0.232 | 0.188 | 0.053 |
| RMSE | 0.776 | 0.320 | 0.064 |
| R2 | 0.980110 | 0.996613 | 0.999864 |
| Computational time | 45 s | 111 s | 197 s |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Wang, J.; Zhang, S.; Hu, X. Research on the State of Charge Estimation of Electric Forklift Batteries Based on an Improved Transformer Model. Batteries 2026, 12, 41. https://doi.org/10.3390/batteries12020041
Wang J, Zhang S, Hu X. Research on the State of Charge Estimation of Electric Forklift Batteries Based on an Improved Transformer Model. Batteries. 2026; 12(2):41. https://doi.org/10.3390/batteries12020041
Chicago/Turabian StyleWang, Jia, Shenglong Zhang, and Xia Hu. 2026. "Research on the State of Charge Estimation of Electric Forklift Batteries Based on an Improved Transformer Model" Batteries 12, no. 2: 41. https://doi.org/10.3390/batteries12020041
APA StyleWang, J., Zhang, S., & Hu, X. (2026). Research on the State of Charge Estimation of Electric Forklift Batteries Based on an Improved Transformer Model. Batteries, 12(2), 41. https://doi.org/10.3390/batteries12020041
