In recent years, the rapid advancement of electric vehicles (EVs) and renewable energy systems has underscored the critical role of lithium-ion batteries as a primary energy storage solution. The efficient management of these batteries hinges on accurate state of charge (SOC) estimation, which indicates the remaining capacity and is pivotal for ensuring safety, longevity, and performance. Traditionally, SOC estimation has focused on single-step prediction, providing insights for immediate battery management decisions. However, advanced applications such as fault diagnosis, thermal runaway warning, and charging path planning necessitate forecasting SOC over multiple future time steps. This multi-step ahead prediction presents unique challenges, including error accumulation and reduced time-dependency, which can degrade accuracy. In this article, we propose a machine learning-based framework for multi-step ahead SOC forecasting of lithium-ion batteries, leveraging real-world operational data to evaluate various prediction strategies and algorithms. Our goal is to enhance the precision and reliability of SOC predictions for next-generation battery management systems.
The state of charge of a lithium-ion battery is a fundamental parameter that reflects its energy availability. Accurate SOC estimation is complex due to factors like temperature fluctuations, aging effects, and dynamic operating conditions. While single-step SOC prediction methods have been extensively studied, multi-step ahead forecasting remains underexplored despite its importance for proactive battery management. Multi-step prediction involves estimating SOC values for a horizon of future time steps, which is essential for anticipating battery behavior and optimizing operations. However, as the prediction horizon extends, errors can propagate, and the temporal correlations between successive SOC values diminish, leading to decreased accuracy. To address these issues, we investigate the integration of machine learning algorithms with multi-step prediction strategies, aiming to mitigate error accumulation and leverage time-dependencies effectively.
Our study is motivated by the growing demand for intelligent battery management in real-world applications, such as shared electric bicycles, where operational data is abundant but noisy. We utilize actual lithium-ion battery data collected from an electric bicycle fleet, encompassing variables like temperature, voltage, current, and SOC. Through rigorous preprocessing and model training, we compare different multi-step prediction strategies—recursive, direct, and multi-input multi-output (MIMO)—coupled with machine learning algorithms including linear regression (LR), k-nearest neighbors (KNN), random forest (RF), and support vector regression (SVR). We evaluate their performance using metrics such as mean absolute percentage error (MAPE) and coefficient of determination (R²), focusing on prediction horizons up to 15 steps. Our findings reveal that the MIMO strategy combined with linear regression offers the best balance of accuracy and computational efficiency, highlighting the linear characteristics dominant in charging phases and nonlinear aspects in discharging phases. This work provides a foundation for deploying robust multi-step SOC forecasting in practical lithium-ion battery systems.

The core of our methodology lies in formalizing the multi-step ahead prediction problem for lithium-ion battery SOC. Let the SOC at time \( p \) be denoted as \( y_p \). Given a historical window of \( d \) time steps, the input features—such as temperature, voltage, current, and past SOC—are represented as a vector \( \mathbf{x}_p = [x_{p-d+1}, \ldots, x_{p-1}, x_p] \). The objective is to predict the SOC for the next \( H \) time steps, forming an output vector \( \mathbf{y}’_{p+1:p+H} = [y’_{p+1}, \ldots, y’_{p+H}] \). The relationship between inputs and outputs is modeled by a function \( f \), learned through machine learning algorithms:
$$ \mathbf{y}’_{p+1:p+H} = f(\mathbf{x}_p). $$
We explore three primary multi-step prediction strategies to implement this function. The recursive strategy iteratively applies a single-step model. For step \( h \) in the horizon, the prediction is:
$$ y’_{p+h} = \begin{cases}
f(x_p, \ldots, x_{p-d+1}), & \text{for } h = 1 \\
f(y’_{p+h-1}, \ldots, y’_{p+1}, x_p, \ldots, x_{p-d+h}), & \text{for } 2 \leq h \leq d \\
f(y’_{p+h-1}, \ldots, y’_{p+h-d}), & \text{for } d < h \leq H
\end{cases} $$
This approach is prone to error accumulation, as prediction errors propagate through iterations. The direct strategy, in contrast, constructs separate models for each prediction step, avoiding error propagation but ignoring temporal dependencies between outputs. For each step \( h \), a distinct model \( f_h \) is trained:
$$ y’_{p+h} = f_h(x_p, \ldots, x_{p-d+1}), \quad \text{for } h = 1, \ldots, H. $$
The multi-input multi-output (MIMO) strategy employs a single model that directly outputs the entire sequence of future SOC values, preserving inter-step correlations and reducing computational overhead:
$$ [y’_{p+H}, \ldots, y’_{p+1}] = f(x_p, \ldots, x_{p-d+1}). $$
To model the function \( f \), we utilize four machine learning algorithms, each with distinct characteristics. Linear regression (LR) assumes a linear relationship between inputs and outputs:
$$ y’ = \beta_0 + \sum_{i=1}^{k} \beta_i x_i, $$
where \( \beta_i \) are coefficients optimized via least squares. K-nearest neighbors regression (KNN) is a non-parametric method that predicts SOC as the average of the \( K \) closest historical samples:
$$ y’ = \frac{1}{K} \sum_{i=1}^{K} \omega_i y_i, $$
with weights \( \omega_i \) based on Euclidean distance \( d(\mathbf{x}, \mathbf{y}) = \sqrt{\sum_{j=1}^{n} (x_j – y_j)^2} \). Random forest (RF) is an ensemble algorithm that aggregates predictions from multiple decision trees. Each tree splits data based on minimizing mean squared error:
$$ m = \min_{A, s} \left[ \min_{c_1} \sum_{\mathbf{x}_i \in D_1(A, s)} (y_i – c_1)^2 + \min_{c_2} \sum_{\mathbf{x}_i \in D_2(A, s)} (y_i – c_2)^2 \right], $$
where \( A \) is a feature, \( s \) is a split point, and \( D_1, D_2 \) are subsets. The final prediction averages over \( M \) trees: \( y’ = \frac{1}{M} \sum_{m=1}^{M} h_m(\mathbf{x}_i) \). Support vector regression (SVR) seeks a function \( y’ = \sum_{i=1}^{N} \omega_i \phi(x_i) + b \) that minimizes error bounds, formulated as:
$$ \min_{\omega, b, \xi, \xi^*} \frac{1}{2} \|\omega\|^2 + C \sum_{i=1}^{N} (\xi_i^* + \xi_i), $$
subject to constraints, where \( C \) is a penalty factor and \( \xi_i, \xi_i^* \) are slack variables. Note that SVR is inherently a single-output algorithm and thus incompatible with the MIMO strategy without modifications.
Our experimental setup relies on real-world data from lithium-ion batteries used in shared electric bicycles. The battery pack comprises 10 cells in series, with key parameters summarized in Table 1. We collected over 250,000 data samples at 30-second intervals, including temperature, pack voltage, current, and SOC. The data underwent preprocessing to handle missing values, outliers, and duplicates. Missing values were interpolated using Newton’s method, while outliers were filtered via the interquartile range rule. After cleaning, 24,440 samples remained, which were normalized using Min-Max scaling:
$$ x_{\text{scale}} = \frac{x – x_{\min}}{x_{\max} – x_{\min}}. $$
This ensures all features are on a common scale, improving model convergence. The dataset was split into 80% for training and 20% for testing, with time-series cross-validation to prevent data leakage.
| Parameter | Value |
|---|---|
| Number of Cells | 10 |
| Connection | Series |
| Nominal Voltage | 36 V |
| Nominal Capacity | 14 Ah |
| Charge Cut-off Voltage | 42 V |
| Discharge Cut-off Voltage | 27 V |
| Charging Method | Constant Current/Constant Voltage |
| Cooling | Passive Air Cooling |
| Heating | None |
To optimize model performance, we conducted hyperparameter tuning using grid search with five-fold time-series cross-validation. The search ranges and optimal values for each algorithm are detailed in Table 2. For instance, in KNN, the number of neighbors \( K \) was tuned between 1 and 10, with 9 yielding the best results. In RF, we adjusted the number of estimators and maximum tree depth, settling on 60 estimators and a depth of 10. For SVR, the penalty factor \( C \) and kernel parameter \( \gamma \) were optimized, leading to \( C=5 \) and \( \gamma=0.01 \). These tuned hyperparameters ensure that our models are well-calibrated for the lithium-ion battery SOC prediction task.
| Algorithm | Hyperparameters | Search Range | Optimal Value |
|---|---|---|---|
| KNN | n_neighbors | [1, 10] | 9 |
| RF | n_estimators | [10, 100] | 60 |
| RF | max_depth | [1, 10] | 10 |
| SVR | C | [1, 50] | 5 |
| SVR | gamma | [10^{-2}, 10^{2}] | 0.01 |
We first investigated the impact of input and output step lengths on prediction accuracy and computational efficiency. The input step length \( d \) determines the historical context, while the output step length \( H \) defines the prediction horizon. As shown in Figure 5 (simulated via analysis), model runtime increases with larger \( d \) due to higher dimensionality, with RF being the most computationally intensive and LR the fastest. For accuracy, measured by R², we observed that increasing \( d \) generally improves R² up to a point, but excessive input steps can cause redundancy and overfitting. Similarly, larger \( H \) leads to declining R², as time-dependency weakens. Based on these trends, we selected \( d = 5 \) and \( H = 15 \) as optimal, balancing accuracy and efficiency for multi-step ahead forecasting of the lithium-ion battery SOC.
The performance of different machine learning models combined with multi-step prediction strategies is summarized in Table 3. We report MAPE and R² values for a 15-step horizon. LR with MIMO achieves the lowest MAPE (4.2%) and highest R² (0.934), demonstrating its effectiveness. KNN and RF also perform well, with MAPE below 6% and R² above 0.90 across strategies. In contrast, SVR exhibits higher errors, especially with recursive strategy (MAPE 23.45%), due to error accumulation. The MIMO strategy consistently outperforms recursive and direct approaches, as it retains temporal correlations and minimizes error propagation. These results underscore the advantage of MIMO for multi-step SOC prediction in lithium-ion batteries.
| Model | Strategy | MAPE (%) | R² | Training Time (s) | Prediction Time (s) |
|---|---|---|---|---|---|
| LR | Recursive | 5.8 | 0.921 | 0.5 | 1.2 |
| LR | Direct | 5.5 | 0.928 | 2.1 | 0.8 |
| LR | MIMO | 4.2 | 0.934 | 1.0 | 0.3 |
| KNN | Recursive | 5.9 | 0.918 | 3.5 | 4.7 |
| KNN | Direct | 5.7 | 0.918 | 10.2 | 2.5 |
| KNN | MIMO | 4.9 | 0.925 | 4.8 | 1.1 |
| RF | Recursive | 5.5 | 0.925 | 15.3 | 3.9 |
| RF | Direct | 5.6 | 0.924 | 45.6 | 2.8 |
| RF | MIMO | 5.3 | 0.905 | 20.1 | 1.5 |
| SVR | Recursive | 23.45 | 0.712 | 12.4 | 5.6 |
| SVR | Direct | 18.2 | 0.785 | 38.9 | 3.4 |
To delve deeper, we analyzed error progression across individual prediction steps within the horizon. For each step \( h \) from 1 to 15, we computed MAPE and R², as illustrated in Figure 9 (conceptual representation). As \( h \) increases, MAPE rises and R² declines for all strategies, reflecting the challenges of long-horizon forecasting. The recursive strategy shows the steepest error growth due to cumulative errors, while MIMO maintains relatively stable accuracy. For example, at step 15, LR with MIMO has an MAPE of 5.1%, compared to 8.3% for recursive. This highlights MIMO’s robustness in preserving time-dependencies for lithium-ion battery SOC prediction.
The behavior of lithium-ion battery SOC during charging and discharging phases significantly influences prediction accuracy. Charging typically follows a constant-current constant-voltage pattern, resulting in linear SOC trends that are easier to forecast. Discharging, however, is subject to random factors like driving habits and road conditions, introducing nonlinearities. We visualize short-term SOC predictions for step 8 of the horizon using MIMO strategy in Figure 10 (simulated). LR, KNN, and RF models closely track actual SOC during charging, with minor deviations. In discharging phases, errors are larger but remain within acceptable bounds (MAPE < 6%). The largest errors occur at transition points between charging and discharging, due to unpredictable user behavior. This underscores the importance of incorporating contextual data, such as weather or traffic, to enhance multi-step forecasting for lithium-ion batteries.
From a computational perspective, model efficiency is crucial for real-time battery management. Table 3 includes training and prediction times, measured on our dataset. LR with MIMO is the fastest, requiring only 1.0 second for training and 0.3 seconds for prediction, making it suitable for online deployment. In contrast, RF and SVR demand more resources, with training times exceeding 15 seconds. The recursive strategy is generally slower due to iterative predictions, while MIMO’s single-output approach reduces latency. Thus, for practical applications in lithium-ion battery systems, LR coupled with MIMO offers an optimal trade-off between speed and accuracy.
Our study also explores the theoretical foundations of multi-step forecasting. The time-series nature of lithium-ion battery SOC can be modeled using autoregressive frameworks. For instance, an autoregressive integrated moving average (ARIMA) approach could be considered, but machine learning methods provide greater flexibility in handling nonlinearities. The general prediction function can be extended to incorporate external features, such as ambient temperature \( T \) and load current \( I \), enhancing the model:
$$ y’_{p+h} = f(x_p, T_p, I_p, \ldots). $$
Moreover, ensemble techniques like stacking multiple models could further improve accuracy, though at the cost of complexity. For lithium-ion batteries, adaptive models that update parameters based on aging effects are a promising direction for future work.
In terms of limitations, our data is from a specific lithium-ion battery application (electric bicycles), which may not generalize to other settings like grid storage or electric cars. However, the methodologies are transferable with appropriate data. Additionally, we assumed fixed input and output steps, but adaptive horizon selection based on uncertainty quantification could be beneficial. The use of deep learning models, such as long short-term memory (LSTM) networks, might capture longer-term dependencies, but they require more data and computational power.
To contextualize our work, we compare it with existing SOC estimation methods. Traditional approaches like ampere-hour integration and open-circuit voltage are simple but prone to drift and impractical for multi-step forecasting. Model-based methods, such as Kalman filters, rely on accurate battery models, which are difficult to derive for real-world lithium-ion batteries under varying conditions. Data-driven machine learning methods, as demonstrated here, bypass model complexities and directly learn from data, making them advantageous for multi-step ahead predictions. Recent studies have applied neural networks for single-step SOC estimation, but multi-step strategies remain rare. Our contribution lies in systematically evaluating multi-step strategies with diverse algorithms for lithium-ion battery SOC.
The implications of our findings are significant for advancing battery management systems. Accurate multi-step SOC forecasting enables predictive maintenance, such as detecting anomalies before failure, and optimizes charging schedules to extend battery life. For electric vehicle fleets, this can reduce downtime and energy costs. Furthermore, integrating our approach with cloud-based analytics could facilitate real-time monitoring of thousands of lithium-ion batteries, enhancing overall system reliability.
In conclusion, we have developed a comprehensive framework for multi-step ahead forecasting of lithium-ion battery state of charge using machine learning. Through experiments with real-world data, we show that the MIMO strategy combined with linear regression achieves high accuracy and efficiency, with MAPE below 6% and R² above 0.93 for a 15-step horizon. This is attributed to MIMO’s ability to preserve temporal correlations and mitigate error accumulation, coupled with the linear characteristics dominant in lithium-ion battery charging phases. Discharging phases exhibit nonlinearities, but our models maintain robust performance. Future work will focus on incorporating additional sensory data and exploring deep learning architectures to further enhance multi-step predictions for lithium-ion batteries in diverse applications.
