Electric vehicles have emerged as a key solution for reducing greenhouse gas emissions in the transportation sector. With the rapid expansion of the electric vehicle market, accurate charging time prediction has become increasingly important for alleviating user range anxiety, supporting trip planning, and optimizing charging infrastructure utilization. In this study, we investigate the problem of predicting electric vehicle charging time from real-world operational data. We first discuss the fundamental characteristics of traction batteries and their influence on charging behavior. Then, we propose two complementary prediction frameworks: a multi-model fusion approach for scenarios with abundant data and a meta-learning-based approach for small-sample and cross-vehicle scenarios. The proposed methods are validated on real-world datasets collected from electric vehicles with different battery capacities, operating profiles, and charging conditions. Experimental results show that our approaches improve accuracy and robustness compared with conventional single-model baselines.

1. Introduction
Transportation systems are undergoing a profound transformation driven by the global need to reduce carbon emissions. Electric vehicles have become one of the most promising alternatives to internal combustion engine vehicles because they produce zero tailpipe emissions and offer higher energy conversion efficiency. According to recent statistics, the number of electric vehicles in use has increased almost nine-fold over a five-year period. This remarkable growth, however, has placed enormous pressure on charging infrastructure. The limited availability of public charging stations and the long charging dwell times can create significant inconvenience for users. One of the most critical challenges in the practical operation of electric vehicles is accurately estimating how long it will take to charge the battery from the current state to a desired target state.
Charging time prediction is not a trivial task. The charging process is affected by many factors including the battery state of charge, battery temperature, ambient temperature, charger power level, charging protocol, battery state of health, and vehicle-specific control strategies. In real-world operation, charging behaviors also vary substantially across drivers, regions, charging locations, and seasons. For example, some users prefer to charge when the state of charge is below 40%, while others routinely charge from a higher starting value. The charging depth may be as low as 20% or as high as 100%, and the available charging power may follow different patterns in alternating-current slow charging and direct-current fast charging. These factors create a highly nonlinear and nonstationary relationship between observable variables and the resulting total charging time.
Accurate charging time prediction can bring many benefits. For electric vehicle users, knowing the expected charging time before or during a charging session allows them to plan meals, rest, work, and other activities more efficiently. This reduces the perceived uncertainty and anxiety associated with long charging stops. For charging station operators, accurate predictions facilitate dynamic load management, queue scheduling, and resource allocation across multiple charging bays. For grid operators, aggregate charging time predictions enable better demand-side management and prevent overloading of local distribution networks. Thus, the development of robust and accurate charging time prediction models is of high practical value.
Existing studies on charging time prediction can be broadly divided into model-based and data-driven approaches. Model-based methods rely on physical or electrochemical models of the battery and often involve solving ordinary differential equations or equivalent circuit equations. Although they offer physical interpretability, these methods usually require accurate model parameters and may degrade when the battery ages or when operating conditions change. Data-driven methods, on the other hand, use historical charging data and machine learning algorithms to learn the mapping from input features to charging time. Common data-driven models include support vector regression, extreme learning machines, random forests, XGBoost, long short-term memory networks, gated recurrent units, and more recently attention-based Transformer models.
Despite their successes, several gaps remain. First, many data-driven approaches ignore battery aging as an explicit or implicit factor. As the battery ages, its internal resistance increases and its usable capacity decreases, which can alter the charging curve and extend the time required to reach a target state of charge. Second, most previous studies train and evaluate a single model on a particular dataset. In the presence of heterogeneous vehicle types, charging modes, and user habits, a single model often struggles to generalize across all conditions. Third, real-world practical deployments frequently face the problem of insufficient labeled data, especially for newly introduced electric vehicle models. It is expensive and time-consuming to collect large volumes of operational data for every vehicle model and every charging infrastructure type. Traditional deep learning models trained from scratch with limited data may overfit and provide poor predictions.
To overcome these limitations, we propose two distinct but complementary methods. The first method is a multi-model fusion approach that takes into account battery degradation. In this method, we extract multiple features such as state of charge distributions, ambient temperature, clustered charging current values, and a health indicator based on ohmic resistance estimated from an equivalent circuit model. Then, three powerful gradient boosting models, namely XGBoost, LightGBM, and CatBoost, are trained as base learners. A random forest regression model is subsequently used to fuse the predictions of the base learners, leading to more accurate and robust estimation of charging time. This approach is particularly suited to large-scale data where sufficient training samples are available.
The second method is designed for small-sample and cross-vehicle scenarios. In this approach, we introduce a charging-level feature that summarizes the charging power regime into three discrete levels, thereby reducing the dependence on real-time current information that may not be known before a charging session. We then construct a parallel convolutional neural network and Transformer architecture that simultaneously captures local dependencies and global contextual relationships among features. The entire network is trained using a model-agnostic meta-learning algorithm. During meta-training, the network is trained on tasks constructed from multiple vehicles, allowing it to learn an initialization that can quickly adapt to a new vehicle with only a small number of support samples. During adaptation, the initialization is fine-tuned on a few historical charging records of the target vehicle.
The main contributions of this thesis can be summarized as follows:
- We construct a comprehensive feature set for charging time prediction that includes not only state of charge, current, and temperature features but also an estimated ohmic resistance indicator reflecting battery aging.
- We propose a two-level ensemble prediction framework in which XGBoost, LightGBM, and CatBoost are used as base learners and random forest is used as a meta-learner for prediction fusion.
- We introduce a charging-level representation to describe the charging condition without requiring real-time charging current, making the model more practical for pre-charge estimation.
- We design a parallel CNN-Transformer network and train it with the MAML meta-learning framework to achieve rapid adaptation for small-sample electric vehicle charging time prediction.
- We validate both methods on real-world electric vehicle datasets covering multiple climate regions, vehicle models, and charging levels, and we provide comprehensive benchmark comparisons and analyses.
2. Battery Characteristics and Charging Process
2.1 Structure and operation of lithium-ion batteries
Most electric vehicles on the market today are powered by lithium-ion battery packs. A battery pack is made up of several modules, each module contains multiple cells connected in series and parallel to achieve the required voltage and capacity. The battery management system controls the charging and discharging process by monitoring the current, voltage, temperature, and state of charge of individual cells. Lithium-ion cells store energy through the reversible intercalation of lithium ions in the positive and negative electrodes. During charging, an external power source drives electrons from the positive electrode to the negative electrode through the external circuit. Simultaneously, lithium ions are released from the positive electrode, migrate through the electrolyte, and are inserted into the graphite layers of the negative electrode. This process converts electrical energy into chemical energy. During discharging, the reverse process takes place: lithium ions move back to the positive electrode, and electrons flow through the external load to perform work.
The operating voltage of a single lithium-ion cell is typically between 2.5 V and 4.2 V depending on the chemistry. Lithium iron phosphate cells have a lower nominal voltage and a very flat open-circuit voltage curve, which makes state estimation more difficult but improves safety. Ternary lithium cells offer higher energy density but are more thermally sensitive. Regardless of chemistry, the internal resistance of a cell increases as temperature decreases and as the cell ages. Internal resistance directly affects the power capability and heat generation during charging, and therefore has a strong influence on the charging time under a constant-power or constant-current protocol.
2.2 Constant current constant voltage charging
The most widely used charging strategy for lithium-ion batteries in electric vehicles is the constant current constant voltage protocol. In the first stage, the charger supplies a constant current to the battery pack while the terminal voltage gradually increases. This stage is called the constant current stage. Once the terminal voltage reaches the upper limit defined by the battery management system, the charger switches to the constant voltage stage. In this second stage, the voltage is held constant and the charging current gradually decreases as the cell approaches full charge. The charging process terminates when the current falls below a certain threshold or when the state of charge reaches the target value. In some situations, a preconditioning stage with very low current may be applied when the battery is extremely depleted or at a very low temperature.
From the perspective of charging time, the constant current stage is usually fast because the current remains high. The constant voltage stage is comparatively slower because as the current decays exponentially, the incremental state of charge per unit time becomes small. For example, charging a battery from 20% to 90% state of charge might take about half of the total charging time, while charging the last 10% to 100% can take another third of the total time. This nonlinear relationship between state of charge and time is critical when designing a predictive model.
Let the total charging time be expressed as:
$$ t_{\mathrm{total}} = t_{\mathrm{pre}} + t_{\mathrm{cc}} + t_{\mathrm{cv}} + t_{\mathrm{end}} $$
where \(t_{\mathrm{pre}}\) is the duration of the preconditioning phase, \(t_{\mathrm{cc}}\) is the duration of the constant current phase, \(t_{\mathrm{cv}}\) is the duration of the constant voltage phase, and \(t_{\mathrm{end}}\) is the time needed for the termination procedure. The fraction of each phase can be defined as:
$$ r_i = \frac{t_i}{t_{\mathrm{total}}} \times 100\%, \quad i \in \{\mathrm{pre}, \mathrm{cc}, \mathrm{cv}, \mathrm{end}\} $$
In practice, the constant current phase can account for approximately 50% of the total time, while the constant voltage phase may account for about 35%. Therefore, predicting charging time only from the total energy or state-of-charge increment is insufficient; the model must account for the nonlinearity in the upper state-of-charge region.
2.3 Key battery characteristics affecting charging time
Three battery characteristics are particularly relevant to charging time: the state of charge, the temperature, and the state of health. The state of charge is the ratio of the remaining charge to the nominal capacity. It determines how much energy is needed to complete the charging event. A simple first-order approximation would be that charging time is equal to the charge throughput divided by the average charging current. However, this approximation is inaccurate because the charging current is not constant and because the usable capacity depends on the state of charge and temperature. In the low state-of-charge region, the charger can often deliver high current without exceeding the voltage limit. As the state of charge rises, the voltage limit is reached at lower currents, so the average current during the session decreases. This effect can be represented by introducing a current profile function \(I(SOC)\) that varies over different SOC windows.
Temperature affects the kinetic properties of the battery. At low temperatures, the electrolyte viscosity increases, lithium-ion diffusivity decreases, and the internal resistance rises. To protect the battery from lithium plating and other degradation mechanisms, the battery management system may limit the charging current at low temperatures. Consequently, charging in cold climates often takes longer than charging in moderate climates. At high temperatures, the battery activity increases, but the management system may still limit current to avoid overheating. Therefore, the relationship between temperature and charging time is not monotonic and can be nonlinear. It is necessary to include the temperature at the start of charging as a model input. In our datasets, the ambient temperature was not recorded in the vehicle controller area network messages, so we supplemented the data with reanalysis meteorological data from the ERA5 archive, which provides hourly temperature estimates on a global grid. We aligned the ERA5 temperature with the vehicle location and timestamp to obtain an approximate ambient temperature for each charging session.
The state of health represents the degree of battery degradation. As a battery ages, its capacity fades and its internal resistance increases. The rise in internal resistance causes the terminal voltage to reach the maximum voltage limit earlier during constant current charging, which shortens the constant current phase and extends the constant voltage phase. As a result, an aged battery will often take longer to charge from the same starting state of charge to the same target state of charge compared with a fresh battery. Since state of health is difficult to measure directly online in vehicles, we use the ohmic resistance as an indirect indicator. The ohmic resistance can be estimated from voltage and current measurements during driving or charging using recursive identification algorithms.
Apart from these battery characteristics, the charging power or current level is the most direct factor affecting charging time. Fast chargers can deliver tens to hundreds of kilowatts, reducing the charging time to tens of minutes. Slow chargers typically provide only a few kilowatts and may require many hours. In practical prediction problems, the exact current profile might not be known before the charging session begins. However, the charging level can often be inferred from the type of charger or from the charging station infrastructure. Therefore, in the second prediction framework, we approximate the current pattern by a charging level indicator.
3. Real-World Datasets and Preprocessing
We conduct experiments on two real-world datasets collected through a national big data platform for new energy vehicles. Both datasets contain time-series records sampled every 10 seconds, including the vehicle operation status, charging status, cumulative mileage, total voltage, total current, state of charge, and individual cell voltages. The original files also include longitude and latitude, which are used to match the location and thus the ambient temperature from ERA5. In our processing, we focus only on records relevant to battery behavior, including charging state, cumulative mileage, total voltage, total current, state of charge, and cell voltage/temperature information. This reduction speeds up subsequent computations while preserving the necessary information.
3.1 Dataset 1: long-term data from the same vehicle model
Dataset 1 consists of one-year operational records from ten electric vehicles of the same model. All vehicles are equipped with a lithium iron phosphate battery pack with a nominal capacity of 150 Ah. The vehicles operate in the Northeast and South regions of China, where the annual temperature profiles are very different. Cumulative mileage ranges from about 33,401 km to nearly 500,000 km, which covers different stages of battery aging. A summary of Dataset 1 is shown in Table 1.
| Vehicle ID | Region | Initial mileage (km) | Final mileage (km) |
|---|---|---|---|
| #972 | Tianjin | 35,274 | 167,774 |
| #808 | Shenzhen | 51,337 | 59,826 |
| #524 | Dongguan, Shenzhen | 193,874 | 499,325 |
| #846 | Guangzhou, Dongguan, Shenzhen | 284,653 | 399,935 |
| #940 | Dongguan | 240,470 | 321,427 |
| #139 | Guangzhou, Dongguan, Shenzhen | 311,917 | 441,881 |
| #048 | Guangzhou | 0 | 74,828 |
| #312 | Guangzhou | 129,850 | 208,182 |
| #505 | Leshan | 23,575 | 33,401 |
| #707 | Guangzhou | 71,465 | 142,773 |
The total number of valid charging segments extracted from Dataset 1 is 4,826. The distributions of the start state of charge, end state of charge, charging depth, and actual charging time are shown in Figure 1 inserted at the beginning of this paper. We observe that about 77.3% of charging sessions begin when the state of charge is below 50%, and 70.1% of sessions terminate when the state of charge is above 80%. These statistics reflect real-world charging habits and confirm that charging depths are highly variable.
3.2 Dataset 2: multi-vehicle short-term data
Dataset 2 contains operational data from ten different electric vehicle models in Liaoning Province, China, collected during the first quarter of 2023. The vehicles have different battery capacities, ranging from 13 kWh to 66 kWh, and nominal driving ranges from 170 km to 501 km. The cumulative mileage also varies widely. Table 2 summarizes the vehicle parameters for Dataset 2.
| Vehicle ID | Mileage range (km) | Rated range (km) | Battery capacity (kWh) |
|---|---|---|---|
| #1 | 7,028 – 12,053 | 170 | 14 |
| #2 | 27,659 – 46,150 | 431 | 54 |
| #3 | 17,127 – 22,885 | 401 | 39 |
| #4 | 2,265 – 15,588 | 401 | 60 |
| #5 | 43,277 – 57,040 | 501 | 66 |
| #6 | 56,691 – 64,021 | 403 | 53 |
| #7 | 22,388 – 27,093 | 170 | 13 |
| #8 | 71,168 – 84,061 | 301 | 32 |
| #9 | 17,558 – 35,025 | 401 | 43 |
| #10 | 37,747 – 42,004 | 401 | 54 |
After the same preprocessing procedure, we extract 1,103 valid charging segments. The distribution of charging time is different from Dataset 1: about two-thirds of sessions last more than two hours, indicating that alternating-current slow charging is dominant in this dataset. The heterogeneity of vehicle models and battery capacities makes Dataset 2 a suitable benchmark for evaluating the generalization and small-sample adaptation ability of forecasting models.
3.3 Data cleaning and denoising
Raw vehicle data contain various types of anomalies caused by sensor malfunction, communication errors, or logic faults. For example, the total current can suddenly appear as a value far outside the physical range, the cumulative mileage may jump backward or forward irregularly, and the state of charge may be inconsistent with the voltage level. Such anomalies, if not handled, can deteriorate model performance. We therefore implement a systematic cleaning procedure on both datasets. First, we remove records where the charging state field is invalid or absent, where the voltage or current is outside the allowable range, or where the timestamp is not sequential. Second, for isolated spike-like anomalies in the voltage sequence, we replace the anomalous value by the average of its neighboring values to maintain temporal continuity. Third, we discard whole charging segments that contain too few samples or that are interrupted by an unexpected charging state change. Finally, we eliminate charging segments where the total state-of-charge increment is less than 10%, because these minor charging events are of little practical interest and may introduce noise.
3.4 Charging segment extraction and time label construction
Raw data do not explicitly contain the beginning and end of each charging session. We detect a charging session by finding consecutive time-stamped records with the same charging state equal to the charging mode. Between two consecutive sessions, there must be a non-charging interval. For each session, we identify the first timestamp and the last timestamp. The actual charging time for that session is computed as:
$$ t_{\mathrm{charge}} = t_{\mathrm{end}} – t_{\mathrm{start}} $$
where \(t_{\mathrm{start}}\) is the timestamp of the first record in the charging state and \(t_{\mathrm{end}}\) is the timestamp of the last record. We also compute the starting state of charge, ending state of charge, state-of-charge increment, and the maximum/minimum/mean values of current and voltage within the segment. The charging power is computed from the clustered current values and the average voltage, as described later.
4. Multi-Model Fusion Prediction of Electric Vehicle Charging Time
4.1 Overall framework
The overall pipeline of the proposed multi-model fusion method is illustrated below. It consists of three stages: data processing and feature extraction, base model training, and prediction fusion. In the feature extraction stage, we construct a feature vector that describes the charging requirement, the battery health condition, the thermal environment, and the expected current level. In the base-model stage, XGBoost, LightGBM, and CatBoost models are trained independently using the same feature vector and the same target, which is the actual charging time. In the fusion stage, the three predictions are treated as new input variables and are combined by a random forest regression model to output the final charging time estimate. This architecture enables the model to exploit the complementarity among the base learners and to correct their individual biases.
4.2 Feature extraction
4.2.1 State-of-charge and temperature features
We directly extract the start state of charge \(SOC_{\mathrm{start}}\), the end state of charge \(SOC_{\mathrm{end}}\), and the state-of-charge increment \(\Delta SOC = SOC_{\mathrm{end}} – SOC_{\mathrm{start}}\). In addition, to better characterize the nonlinear charging dynamics in different SOC windows, we calculate the cumulative frequencies of the SOC distribution over three intervals during the charging session: [0%, 40%], [40%, 80%], and [80%,100%]. These frequencies form a vector \(W_{SOC}=\left[ w_1, w_2, w_3 \right]\), which implicitly informs the model how long the session remains in each SOC region. For example, a session with many samples in the high SOC region likely contains a long constant voltage tail and will therefore take longer than a session that terminates at an intermediate state of charge.
We also use the ambient temperature at the moment the charging session starts, denoted by \(T_{\mathrm{air}}\). The ambient temperature is derived from the ERA5 reanalysis data using the vehicle’s location and time. Because the vehicle may be parked in a garage or in direct sunlight, the ambient temperature is an approximation of the actual battery thermal boundary condition; nevertheless, it provides valuable external information for prediction.
4.2.2 Health feature from ohmic resistance
To represent the aging level of the battery, we use the ohmic internal resistance \(R_o\) instead of the state of health itself, since the latter is rarely directly available in real vehicles. We identify the ohmic resistance from the first-order Thevenin equivalent circuit model. The circuit consists of an ideal voltage source \(U_{oc}\) representing the open-circuit voltage, an ohmic resistance \(R_o\), and a parallel resistance-capacitance network with \(R_1\) and \(C_1\). The state equation in continuous time is:
$$ \begin{cases}
\dot{U}_1 = -\frac{1}{R_1C_1}U_1 + \frac{1}{C_1}I_L,\\[1mm]
U_L = U_{oc} – U_1 – R_o I_L,
\end{cases} $$
where \(U_1\) is the voltage across the RC network, \(I_L\) is the load current, and \(U_L\) is the terminal voltage. After applying the bilinear transform for discretization with sampling period \(T_s\), the terminal voltage at time step \(k\) can be written as:
$$ y(k) = \theta_1 y(k-1) + \theta_2 I_L(k) + \theta_3 I_L(k-1) + \theta_4 $$
with \(y(k)=U_L(k)\), and
$$ \begin{aligned}
\theta_1 &= \frac{-T_s + 2\tau}{T_s + 2\tau},\\[1mm]
\theta_2 &= \frac{T_s R_o + T_s R_1 + 2\tau R_o}{T_s + 2\tau},\\[1mm]
\theta_3 &= \frac{-T_s R_o + T_s R_1 + 2\tau R_o}{T_s + 2\tau},\\[1mm]
\theta_4 &= \frac{2T_s U_{oc}}{T_s + 2\tau},
\end{aligned} $$
where \(\tau = R_1 C_1\). The unknown parameters \(\theta_1, \theta_2, \theta_3, \theta_4\) are estimated online by the forgetting factor recursive least squares algorithm. The forgetting factor \(\lambda\) is chosen as 0.999 to balance stability and tracking ability. The recursive formulas are:
$$ e(k) = y(k) – \phi^T(k)\hat{\theta}(k-1) $$
$$ K(k) = \frac{P(k-1)\phi(k)}{\lambda + \phi^T(k)P(k-1)\phi(k)} $$
$$ \hat{\theta}(k) = \hat{\theta}(k-1) + K(k)e(k) $$
$$ P(k) = \frac{1}{\lambda}\left[ I – K(k)\phi^T(k) \right] P(k-1) $$
where \(\phi(k)\) is the regression vector consisting of past output and current/previous input values. From the estimated \(\theta_1,\theta_2,\theta_3\), we can recover the ohmic resistance \(R_o\). We compare this forgetting factor recursive least squares method with traditional recursive least squares and Kalman filtering approaches on a representative driving segment. Table 3 reports the mean ohmic resistance and the mean absolute voltage prediction error.
| Algorithm | Mean ohmic resistance (mΩ) | Mean absolute voltage error (mV) |
|---|---|---|
| Forgetting factor RLS | 19.76 | 11.45 |
| Standard RLS | 20.09 | 14.33 |
| Kalman filter | 22.84 | 14.02 |
The forgetting factor recursive least squares algorithm provides the lowest error and good stability. We therefore adopt it for ohmic resistance identification. Because the ohmic resistance varies with the state of charge, we estimate its value only when the state of charge is between 30% and 80%, where the resistance is relatively flat. For each driving segment, we take the average of the identified values as the raw health feature. However, the ohmic resistance is strongly temperature-dependent. To make the feature comparable across seasons, we normalize the identified resistance to a reference temperature of 25°C using the Arrhenius equation:
$$ R_o^{(25)} = R_o \cdot \exp\left[ \frac{E_a}{R_{\mathrm{gas}}}\left(\frac{1}{T_{\mathrm{ref}}} – \frac{1}{T_{\mathrm{batt}}}\right)\right] $$
where \(E_a\) is the activation energy, \(R_{\mathrm{gas}}=8.314\,\mathrm{J\,mol^{-1}K^{-1}}\), \(T_{\mathrm{ref}}=298.15\,\mathrm{K}\), and \(T_{\mathrm{batt}}\) is the battery temperature at the time of identification. For the lithium iron phosphate chemistry in Dataset 1, we set \(E_a=40\,\mathrm{kJ\,mol^{-1}}\). After temperature correction, the resistance trend increases with battery aging, which is physically consistent.
4.2.3 Charging current features
The charging current is a direct cause of charging speed, but raw current signals are noisy and may contain multiple constant-current levels, especially in fast charging. We use K-means++ clustering to extract the dominant constant current values from each charging segment. We set the number of clusters to four. This allows us to account for a possible preconditioning stage, two constant current stages, and a tail stage. For every charging segment, we apply the K-means++ algorithm to the univariate current sequence. The centers of the two most populated clusters, denoted as \(I_1\) and \(I_2\), are chosen as features representing the constant charging currents. In slow charging, the current often varies slightly because of load sharing; nevertheless, a four-cluster separation is robust enough to capture the main current level. We use these two clustered current values in the multi-model fusion framework.
4.3 Machine learning models for fusion
4.3.1 XGBoost
XGBoost is a scalable tree boosting algorithm that has become a benchmark for structured data. It uses additive training and second-order Taylor expansion of the loss function, while a regularization term penalizes model complexity. XGBoost can effectively handle sparse features and missing values by learning default directions for each tree split. For a feature vector \(x\), the prediction of XGBoost is the sum of the outputs of \(K\) decision trees:
$$ \hat{h}_1(x) = \sum_{k=1}^{K} f_k(x) $$
The objective at step \(t\) is:
$$ \mathcal{L}^{(t)} = \sum_{i=1}^{n} l\left(y_i, \hat{y}_i^{(t-1)} + f_t(x_i)\right) + \Omega(f_t) $$
where \(\Omega(f) = \gamma T + \frac{1}{2}\lambda \|w\|^2\), with \(T\) the number of leaves and \(w\) the leaf weights. In our XGBoost model we use a learning rate of 0.017, a maximum tree depth of 12, subsampling ratio of 0.77, column subsampling ratio of 0.914, L1 regularization of 5, L2 regularization of 5, and 800 boosting rounds.
4.3.2 LightGBM
LightGBM is a gradient boosting framework based on decision trees with histogram-based learning. Its key improvements are Gradient-based One-Side Sampling and Exclusive Feature Bundling, which accelerate training without sacrificing accuracy. LightGBM uses leaf-wise tree growth, which can reduce loss more efficiently than level-wise growth but may overfit if not constrained. We cap the number of leaves to 8 and use a maximum depth of 24, a learning rate of 0.04, bagging fraction of 0.8, feature fraction of 0.8, L1 regularization of 6, L2 regularization of 6, and 1000 boosting iterations. The prediction is
$$ \hat{h}_2(x) = \sum_{n=1}^{N} f_n(x) $$
where \(f_n\) is the tree grown at step \(n\). The leaf-wise growth in LightGBM makes it more sensitive to high-gradient samples; however, in our data this behavior is mitigated by regularization and sampling.
4.3.3 CatBoost
CatBoost is another boosting algorithm that introduces ordered boosting to reduce prediction shift. It builds several random permutations of the training data and calculates residuals for each sample using a model trained only on a prefix of the permutation. This avoids the target leakage that can appear in other boosting methods. CatBoost also handles categorical features naturally, although all our features are continuous or integer-valued. The prediction is
$$ \hat{h}_3(x) = \sum_{m=1}^{M} \beta_m f_m(x,\alpha_m) $$
where \(\beta_m\) is the weight of tree \(M\), and \(\alpha_m\) represents the tree parameters. CatBoost has been shown to be robust to noise and outliers. In our implementation, we use 1200 iterations, a learning rate of 0.09, a tree depth of 6, an L2 leaf regularization of 4, and a subsample ratio of 0.96. We use the root mean square error as the loss function.
4.3.4 Random forest regression fusion
The random forest regression model is an ensemble of decision trees. Each tree is trained on a bootstrapped sample of the data and uses a random subset of features for splitting. The random forest then averages the outputs of all trees. In the fusion layer, the input is the vector of predictions from the three base models, \(\mathbf{H} = [\hat{h}_1, \hat{h}_2, \hat{h}_3]\). The random forest regression output is:
$$ \hat{t}_{\mathrm{fused}} = \frac{1}{M} \sum_{m=1}^{M} \mathrm{Tree}_m(\mathbf{H}) $$
where \(M\) is the number of trees in the random forest. By training the random forest on the base-model predictions rather than on the original features, the fusion layer learns to assign higher weights to models that are more accurate in different parts of the feature space. The random forest hyperparameters are 50 trees, maximum depth 50, minimum samples per split 4, and minimum samples per leaf 4. Table 4 lists the hyperparameters of all models.
| Model | Hyperparameter | Value |
|---|---|---|
| XGBoost | objective / eta / max_depth | reg:squarederror / 0.01747 / 12 |
| subsample / colsample_bytree | 0.77 / 0.914 | |
| alpha / lambda / rounds | 5 / 5 / 800 | |
| LightGBM | num_leaves / max_depth / learning_rate | 8 / 24 / 0.04 |
| n_estimators / bagging_fraction | 1000 / 0.8 | |
| feature_fraction / lambda_l1 / lambda_l2 | 0.8 / 6 / 6 | |
| CatBoost | iterations / learning_rate / depth | 1200 / 0.09 / 6 |
| loss_function / l2_leaf_reg / subsample | RMSE / 4 / 0.96 | |
| Random forest fusion | n_estimators / max_depth | 50 / 50 |
| min_samples_split / min_samples_leaf | 4 / 4 | |
| max_features | sqrt |
4.4 Evaluation metrics
We use the root mean square error, the mean absolute percentage error, and the coefficient of determination to evaluate prediction performance. Their definitions are:
$$ \mathrm{RMSE} = \sqrt{\frac{1}{n}\sum_{i=1}^{n} \left( t_i – \hat{t}_i \right)^2} $$
$$ \mathrm{MAPE} = \frac{1}{n} \sum_{i=1}^{n} \left| \frac{t_i – \hat{t}_i}{t_i} \right| \times 100\% $$
$$ R^2 = 1 – \frac{\sum_{i=1}^{n} \left( t_i – \hat{t}_i \right)^2}{\sum_{i=1}^{n} \left( t_i – \bar{t} \right)^2} $$
where \(t_i\) is the true charging time, \(\hat{t}_i\) is the prediction, and \(\bar{t}\) is the mean of the true charging times in the test set.
4.5 Experimental setup on Dataset 1
To validate the multi-model fusion method, we partition the data from Dataset 1 into a training set and a test set. In the global evaluation, all charging segments from the ten vehicles are combined and randomly split into 70% training and 30% test data. In the per-vehicle evaluation, we train on 70% of the target vehicle plus all data from the other nine vehicles, and test on the remaining 30% of the target vehicle. This allows us to assess how well the model generalizes to an unseen subpopulation. All hyperparameters are tuned using a combination of Bayesian optimization and manual search. The same hyperparameters are used for both the single-model and the fusion experiments to ensure a fair comparison.
4.6 Global comparison results
We compare the proposed random forest fusion model with three base models, a CNN-LSTM fusion model, and a Bayesian linear regression fusion model. Table 5 presents the global RMSE and MAPE for all models on the combined test set. The proposed RFR fusion achieves the lowest RMSE of 0.130 h and the lowest MAPE of 5.676%, outperforming the best single model CatBoost by 7.7% in RMSE and by 9.2% in MAPE. The CNN-LSTM fusion model yields the worst performance, which can be attributed to its large number of parameters and its difficulty in handling the relatively small number of samples when training from scratch. The Bayesian linear regression fusion performs better, but its linear aggregation is less flexible than the random forest nonlinear aggregation. Overall, the random forest fusion effectively combines the nonlinear predictions of the base learners.
| Model | RMSE (h) | MAPE (%) |
|---|---|---|
| XGBoost | 0.143 | 5.741 |
| LightGBM | 0.153 | 7.346 |
| CatBoost | 0.140 | 6.249 |
| CNN-LSTM | 0.286 | 7.626 |
| BLR fusion | 0.132 | 5.727 |
| RFR fusion (proposed) | 0.130 | 5.676 |
4.7 Per-vehicle results
Because different electric vehicles in Dataset 1 have different driving histories, charging habits, and operating environments, a model that performs well globally may still fail on particular vehicles. Therefore, we report per-vehicle results for the proposed RFR fusion and compare them with the single models, the CNN-LSTM fusion, and the Bayesian linear regression fusion. Table 6 reports the MAPE and RMSE for all ten vehicles.
| Vehicle | XGBoost | LightGBM | CatBoost | CNN-LSTM | BLR fusion | RFR fusion |
|---|---|---|---|---|---|---|
| #972 | 5.575 / 0.081 | 6.918 / 0.093 | 5.550 / 0.084 | 11.406 / 0.127 | 6.056 / 0.088 | 5.317 / 0.075 |
| #808 | 4.527 / 0.052 | 6.752 / 0.088 | 6.434 / 0.062 | 9.334 / 0.154 | 6.858 / 0.111 | 4.150 / 0.048 |
| #524 | 5.736 / 0.082 | 6.711 / 0.093 | 5.958 / 0.097 | 11.421 / 0.130 | 6.241 / 0.095 | 5.327 / 0.078 |
| #846 | 5.642 / 0.083 | 6.674 / 0.095 | 5.591 / 0.086 | 11.478 / 0.125 | 5.923 / 0.089 | 5.279 / 0.078 |
| #940 | 6.354 / 0.094 | 6.956 / 0.103 | 6.153 / 0.097 | 12.123 / 0.143 | 6.722 / 0.102 | 5.771 / 0.087 |
| #139 | 5.856 / 0.088 | 6.786 / 0.095 | 5.874 / 0.100 | 11.612 / 0.131 | 6.141 / 0.088 | 5.448 / 0.081 |
| #048 | 8.033 / 0.140 | 8.545 / 0.153 | 8.667 / 0.149 | 11.378 / 0.198 | 8.914 / 0.154 | 6.974 / 0.130 |
| #312 | 6.685 / 0.106 | 7.274 / 0.116 | 6.481 / 0.100 | 11.461 / 0.157 | 7.227 / 0.117 | 5.724 / 0.090 |
| #505 | 5.786 / 0.069 | 6.829 / 0.089 | 7.137 / 0.067 | 12.208 / 0.161 | 6.862 / 0.097 | 5.758 / 0.059 |
| #707 | 7.906 / 0.130 | 7.898 / 0.130 | 7.950 / 0.129 | 8.668 / 0.136 | 13.181 / 0.196 | 7.025 / 0.117 |
The fusion model provides the lowest MAPE on nine of the ten vehicles. The largest improvement occurs on vehicle #312, where the MAPE improves from 6.481% using CatBoost to 5.724% using the fusion model. On vehicle #048, which has a relatively large number of charging sessions and possibly more variable driving behavior, the fusion model reduces the MAPE from more than 8% to 6.974%. These results demonstrate that the random forest fusion can mitigate the weaknesses of individual boosting models and improve robustness across different vehicles.
4.8 Ablation study of the fusion layer
To verify the contribution of the random forest fusion mechanism, we conduct ablative experiments. We first remove one of the three base learners and use the remaining two with the random forest fusion. We then compare against simple averaging and weighted averaging of the three base-model outputs without random forest. Table 7 reports the mean MAPE and RMSE across the ten vehicles for these configurations. The table also reports the performance of the full RFR fusion. Each of the three base learners contributes positively; removing any one of them leads to an overall degradation in prediction accuracy. For example, removing XGBoost increases the average MAPE from the full-fusion value to a higher level, and removing LightGBM or CatBoost causes similar effects, though the exact ranking varies by vehicle. Simple averaging and weighted averaging provide reasonable baselines but are consistently worse than the nonlinear random forest fusion. This result confirms that the random forest is able to learn the regions where each base model is more reliable, producing a more accurate final prediction.
| Configuration | Average MAPE (%) | Average RMSE (h) |
|---|---|---|
| Without XGBoost | 6.520 | 0.087 |
| Without LightGBM | 6.431 | 0.086 |
| Without CatBoost | 6.490 | 0.086 |
| Simple average | 6.102 | 0.082 |
| Weighted average | 6.086 | 0.082 |
| RFR fusion (full) | 5.727 | 0.081 |
4.9 Effect of the aging feature
We further remove the ohmic-resistance based health feature from the input vector and retrain the full fusion model. The results are summarized in Table 8. When the aging feature is removed, the MAPE and RMSE increase for most vehicles. For example, vehicle #139 degrades from 5.448% to 6.316%, and vehicle #312 degrades from 5.724% to 7.101%. This demonstrates that the aging feature provides meaningful information for vehicles whose batteries have undergone noticeable degradation. Interestingly, for vehicle #505, the prediction improves slightly when the aging feature is removed: the MAPE drops from 5.758% to 5.032%. Vehicle #505 has only 48 charging events in the dataset and a relatively small mileage accumulation; as a result, its battery aging may not be sufficiently strong for the resistance feature to provide a clear signal, and the extra feature may introduce noise. In general, however, including the aging feature is beneficial for most electric vehicles.
| Vehicle | With health feature | Without health feature |
|---|---|---|
| MAPE (%) / RMSE (h) | MAPE (%) / RMSE (h) | |
| #972 | 5.317 / 0.075 | 6.298 / 0.085 |
| #808 | 4.150 / 0.048 | 4.590 / 0.055 |
| #524 | 5.327 / 0.078 | 6.256 / 0.087 |
| #846 | 5.279 / 0.078 | 6.412 / 0.085 |
| #940 | 5.771 / 0.087 | 6.730 / 0.094 |
| #139 | 5.448 / 0.081 | 6.316 / 0.089 |
| #048 | 6.974 / 0.130 | 8.172 / 0.139 |
| #312 | 5.724 / 0.090 | 7.101 / 0.107 |
| #505 | 5.758 / 0.059 | 5.032 / 0.058 |
| #707 | 7.025 / 0.117 | 7.789 / 0.125 |
4.10 Feature importance analysis
To understand which features influence the prediction, we compute the feature importance scores for each of the three base learners. Because the base models are tree ensembles, the importance of a feature can be measured by the total gain reduction achieved by splits on that feature, normalized over all splits. The importance scores often differ among XGBoost, LightGBM, and CatBoost due to differences in their tree-building strategies. The two clustered current features \(I_1\) and \(I_2\) generally dominate, together contributing about 27% in XGBoost, 46% in LightGBM, and 58% in CatBoost. The charging current is indeed the most direct factor determining the time required. The state-of-charge increment and the start/end state of charge are also important, because they determine how many ampere-hours are needed. The ambient temperature and the health feature have variable but nonnegligible importance. The diversity in feature importance across the base models reinforces the value of model fusion: different models may capture different feature interactions, and their combination can yield a more balanced and robust representation.
4.11 Computational complexity
Practical charging time prediction needs to be sufficiently fast for real-time use. We compare model parameter counts, training time, and inference time in Table 9. The proposed RFR fusion model has 394,984 parameters, which is larger than each single base model but significantly smaller than the CNN-LSTM fusion model. The training time is 6.408 seconds, much shorter than the CNN-LSTM training time of 392 seconds. The inference time is 0.102 seconds, which is acceptable for a single charging event prediction. The random forest fusion therefore provides a favorable trade-off between accuracy and computational cost, making it suitable for deployment in charging station or vehicle cloud platforms.
| Model | Parameter count | Training time (s) | Inference time (s) |
|---|---|---|---|
| XGBoost | 151,200 | 3.861 | 0.075 |
| LightGBM | 74,400 | 0.234 | 0.011 |
| CatBoost | 126,000 | 2.032 | 0.003 |
| CNN-LSTM | 498,905 | 392.362 | 0.284 |
| BLR fusion | 704,148 | 1.196 | 0.053 |
| RFR fusion | 394,984 | 6.408 | 0.102 |
5. Meta-Learning Approach for Few-Shot Charging Time Prediction
5.1 Motivation
The multi-model fusion approach requires a sufficiently large training set and assumes that the training and test data come from a similar distribution. In real-world scenarios, new electric vehicle models frequently appear, and their batteries may have different capacities, chemistries, and charging protocols. Collecting thousands of real-world charging segments for every new model is impractical. Consequently, a model trained on existing vehicles often does not transfer well to a new vehicle. Meta-learning provides a promising solution by allowing a model to be trained across multiple tasks such that it can quickly adapt to a new task with a small number of examples.
In this section, we build an end-to-end few-shot charging time prediction framework. The framework leverages the vehicle heterogeneity in Dataset 2, where the ten vehicles have very different battery capacities and charge patterns. We construct one task per vehicle by randomly sampling support and query sets from that vehicle. The model is trained with the model-agnostic meta-learning algorithm to find an initial set of parameters that can be fine-tuned efficiently to any new vehicle. The predictive backbone is a parallel CNN-Transformer architecture, chosen to capture both local and global relationships between the input features.
5.2 Charging level feature
One major challenge in practical charging time prediction is that the exact charging current profile is not known before the charging session starts. In our previous multi-model fusion approach, we extracted two clustered current features from the current sequence. However, a prediction made before the charger is connected cannot use such current-derived features. To solve this problem, we propose a categorical feature called the charging level. The charging level is determined by the maximum power of the charger, which can be known by the user from the charging infrastructure. We first cluster the charging current into the two main constant current values \(I_1\) and \(I_2\), and compute the maximum charging power as:
$$ P_{\mathrm{ch}} = \max\left\{ I_1, I_2 \right\} \cdot \bar{U} $$
where \(\bar{U}\) is the average voltage during the charging segment. The charging level \(L_{\mathrm{ch}}\) is assigned according to the following rule:
$$ L_{\mathrm{ch}} = \begin{cases}
1, & P_{\mathrm{ch}} \leq 1.92\,\mathrm{kW},\\
2, & 1.92 < P_{\mathrm{ch}} \leq 20\,\mathrm{kW},\\
3, & P_{\mathrm{ch}} > 20\,\mathrm{kW}.
\end{cases} $$
Level 1 corresponds to slow alternating-current charging at a low voltage supply, level 2 corresponds to typical home or workplace alternating-current charging, and level 3 corresponds to direct-current fast charging. This discrete feature is easier to obtain before charging and helps the model distinguish between fundamentally different charging processes.
In Dataset 2, the distribution of charging levels is uneven. Level 2 is the most frequent with 670 charging segments, level 3 accounts for 268 segments, and level 1 accounts for the remaining 165 segments. This imbalance is expected in a real-world dataset and provides both challenges and opportunities for meta-learning.
5.3 Feature set for Dataset 2
In addition to the charging level, we include the following features in Dataset 2:
- \(SOC_{\mathrm{start}}\): the state of charge at the start of charging.
- \(SOC_{\mathrm{end}}\): the state of charge at the end of charging.
- \(\Delta SOC\): the increment of the state of charge during charging.
- \(W_{SOC}\): a three-dimensional vector of time occupancy in the SOC intervals 0–40%, 40–80%, and 80–100%.
- \(T_{\mathrm{air}}\): the ambient temperature at the beginning of charging, obtained from ERA5.
- \(C_r\): the nominal battery capacity of the electric vehicle.
- \(L_{\mathrm{ch}}\): the charging level.
Using \(C_r\) and \(L_{\mathrm{ch}}\) as global features allows the model to be applied across different vehicles. The nominal capacity is fixed for a given vehicle but changes between vehicles. Because charging level and nominal capacity are discrete or continuous scalar values, they are concatenated with the other features before entering the deep network. For practical use, the nominal battery capacity can be obtained from the vehicle specifications, and the charging level can be selected by the user based on the charger type.
5.4 Parallel CNN-Transformer model
We design a parallel network that processes the same input feature vector through two branches. The first branch is a one-dimensional convolutional neural network. The CNN branch consists of three 1D convolutional layers with output channels 8, 16, and 32, each followed by ReLU activation and a max-pooling operation. The convolution kernels have a size of 3. The CNN branch is able to extract local correlations among the input features — for example, the relationship between the start state of charge and the end state of charge, or between the state-of-charge-increment and the time occupancy of the low and medium SOC intervals.
The second branch is a Transformer encoder. Since our input features form a sequential vector, we first project the feature vector to a 64-dimensional embedding through a linear layer. Then we stack four Transformer encoder layers. In each encoder layer, multi-head self-attention is applied with four heads. The attention operation is
$$ \mathrm{Attention}(Q,K,V) = \mathrm{softmax}\left(\frac{QK^{\top}}{\sqrt{d_k}}\right)V $$
where \(Q\), \(K\), and \(V\) are the query, key, and value matrices obtained by multiplying the embedded features with trainable weight matrices, and \(d_k\) is the dimension of the key. The Transformer branch captures the global dependence between all feature positions. For example, the charging level may have a strong effect on the charging time when combined with the end state of charge, even though these features are not adjacent in the input vector.
Let \(\mathbf{x}\) be the input feature vector and let \(\mathrm{CNN}(\mathbf{x})\) and \(\mathrm{Transformer}(\mathbf{x})\) be the output vectors of the two branches. The concatenated feature is
$$ \mathbf{z} = \left[ \mathrm{CNN}(\mathbf{x}); \mathrm{Transformer}(\mathbf{x}) \right] $$
which is passed through a two-layer fully connected network to produce the predicted charging time \(\hat{t}\). The parallel architecture allows the model to learn robust representations from both local and global perspectives.
5.5 Model-agnostic meta-learning training strategy
We employ the model-agnostic meta-learning algorithm to train the parallel CNN-Transformer model. The goal of MAML is to find a parameter initialization \(\theta\) such that for a new task \(T_i\), updating \(\theta\) with one or a few gradient steps on the support set yields a parameter \(\theta_i’\) that performs well on the query set. In our charging time prediction setting, each task corresponds to one electric vehicle. The support set contains a small number of randomly sampled charging segments from that vehicle, while the query set contains different segments from the same vehicle.
The inner-loop update for task \(T_i\) is
$$ \theta_i’ = \theta – \alpha \nabla_{\theta} \mathcal{L}_{D_i^{\mathrm{support}}}(f_{\theta}) $$
where \(\alpha\) is the inner learning rate and \(\mathcal{L}\) is the mean squared error loss:
$$ \mathcal{L}_{D}(f_{\theta}) = \frac{1}{|D|} \sum_{j=1}^{|D|} \left( y_j – \hat{f}_{\theta}(\mathbf{x}_j) \right)^2 $$
The outer-loop update is performed by sampling a batch of tasks and minimizing the average loss on the query sets using the adapted parameters \(\theta_i’\):
$$ \theta \leftarrow \theta – \beta \nabla_{\theta} \sum_{i \in \mathrm{batch}} \mathcal{L}_{D_i^{\mathrm{query}}}(f_{\theta_i’}) $$
where \(\beta\) is the outer learning rate. Algorithm 1 summarizes the procedure.
| Step | Description |
|---|---|
| Input | inner learning rate \(\alpha\), outer learning rate \(\beta\), pre-training epochs \(E_1\), fine-tuning epochs \(E_2\) |
| 1 | Construct source tasks \(T_s\) from all vehicles except the target vehicle. |
| 2 | Initialize model parameters \(\theta\). |
| 3 | For each pre-training epoch, sample a batch of tasks \(T_i\). |
| 4 | For each task, sample support set and query set from that vehicle. |
| 5 | Compute the inner-loop gradient and obtain task-specific parameter \(\theta_i’\). |
| 6 | Update \(\theta\) using the query set loss with outer-loop learning rate \(\beta\). |
| 7 | After pre-training, initialize the target model with \(\theta\). |
| 8 | Sample a support set from the target vehicle and perform fine-tuning for \(E_2\) epochs to obtain \(\theta_t\). |
| 9 | Evaluate \(\theta_t\) on the remaining charging segments of the target vehicle. |
In this study we set \(\alpha=0.001\) and \(\beta=0.0001\). The pre-training is run for several hundred iterations, and the fine-tuning only requires 20–50 gradient steps on the support set. Because the inner loop updates task-specific parameters, the model is encouraged to learn transferable feature representations rather than vehicle-specific biases.
5.6 Experimental design on Dataset 2
We evaluate the proposed MAML-CNN-Transformer method on four representative electric vehicles from Dataset 2: vehicle #1 (a small 14-kWh battery vehicle), vehicle #2 (a 54-kWh battery vehicle with frequent fast charging), vehicle #3 (a 39-kWh battery vehicle), and vehicle #7 (another small 13-kWh vehicle). In each scenario, all data from the other nine vehicles are used to construct the source tasks, and the target vehicle is used for fine-tuning and testing. For the base comparison, we train models from scratch on the target vehicle’s training data (70% of the target data) and evaluate on the remaining 30%. For the meta-learning model, we perform the meta-pre-training on the source tasks, then fine-tune on the same training data as the compared models.
5.7 Hyperparameter selection
We tune the inner and outer learning rates by a grid search. For each combination, we perform the leave-one-vehicle-out experiment on four vehicles and record the worst RMSE among the four vehicles, since we are interested in the most robust set of parameters. Table 11 reports the worst-case RMSE, MAPE, and \(R^2\) for several combinations. The best combination is \(\alpha=0.001\) and \(\beta=0.0001\), which yields a worst RMSE of 0.20 h, a worst MAPE of 6.08%, and a worst \(R^2\) of 0.988. Larger learning rates often lead to unstable adaptation, while smaller learning rates slow down convergence.
| \(\alpha\) | \(\beta\) | Worst RMSE (h) | Worst MAPE (%) | Worst \(R^2\) |
|---|---|---|---|---|
| 0.001 | 0.00005 | 0.25 | 7.88 | 0.972 |
| 0.001 | 0.0001 | 0.20 | 6.08 | 0.988 |
| 0.001 | 0.0005 | 0.32 | 11.45 | 0.938 |
| 0.002 | 0.0002 | 0.29 | 9.67 | 0.951 |
| 0.0005 | 0.0001 | 0.23 | 7.15 | 0.981 |
| 0.005 | 0.0001 | 0.27 | 8.92 | 0.962 |
5.8 Comparison with different models
We compare the proposed MAML-CNN-Transformer model with four baselines: XGBoost, CNN alone, Transformer alone, and a CNN-Transformer trained without meta-learning. Table 12 reports the RMSE, MAPE, and \(R^2\) for the four target vehicles. The proposed method achieves the best performance on all vehicles. For vehicle #1, the RMSE is 0.13 h and the MAPE is 2.26%, which is much lower than the CNN baseline with a MAPE of 5.41%. For vehicle #3, the proposed method shows a MAPE of 4.31% compared with 17.67% for XGBoost. The XGBoost model performs particularly poorly because the relationship between features and charging time is highly nonlinear and differs substantially among vehicle models; XGBoost has difficulty extrapolating to unseen vehicle battery capacities when training data from the target vehicle is limited.
| Vehicle | Model | RMSE (h) | MAPE (%) | \(R^2\) |
|---|---|---|---|---|
| #1 | MAML-CNN-Transformer | 0.13 | 2.26 | 0.989 |
| XGBoost | 0.20 | 3.58 | 0.977 | |
| CNN | 0.35 | 5.41 | 0.925 | |
| Transformer | 0.41 | 6.11 | 0.898 | |
| CNN-Transformer | 0.34 | 5.40 | 0.928 | |
| #2 | MAML-CNN-Transformer | 0.18 | 6.08 | 0.991 |
| XGBoost | 0.24 | 7.01 | 0.984 | |
| CNN | 0.43 | 9.83 | 0.952 | |
| Transformer | 0.19 | 7.83 | 0.990 | |
| CNN-Transformer | 0.18 | 7.17 | 0.991 | |
| #3 | MAML-CNN-Transformer | 0.20 | 4.31 | 0.988 |
| XGBoost | 0.35 | 17.67 | 0.960 | |
| CNN | 0.35 | 12.16 | 0.961 | |
| Transformer | 0.40 | 8.94 | 0.949 | |
| CNN-Transformer | 0.39 | 8.50 | 0.969 | |
| #7 | MAML-CNN-Transformer | 0.16 | 5.94 | 0.990 |
| XGBoost | 0.49 | 10.15 | 0.900 | |
| CNN | 0.28 | 9.25 | 0.967 | |
| Transformer | 0.35 | 11.35 | 0.949 | |
| CNN-Transformer | 0.32 | 10.54 | 0.957 |
We also examine the error distribution with respect to charging depth. We divide the charging segments of each target vehicle into low depth (10–40% \(\Delta SOC\)), medium depth (40–70%), and high depth (70–100%). The absolute errors of the proposed method are small on all vehicles, but they tend to be larger for medium-depth charges because this interval may contain a mixture of constant-current only and constant-current-constant-voltage segments. The low-depth charges are the most regular, often corresponding to slow charging or a partial charge from a relatively low battery level, resulting in small errors. These observations suggest that further improvements can be obtained by explicitly modeling the transition between the constant-current and constant-voltage stages.
5.9 Influence of the number of training samples
Because the proposed method targets small-sample applications, we investigate how the amount of target-vehicle training data affects prediction accuracy. We fix vehicle #2 as the target and create training sets with 90, 70, and 50 charging segments, respectively. The remaining segments are used as the test set. Table 13 reports the results of the proposed method and four baselines. The proposed MAML-CNN-Transformer achieves the smallest performance degradation as the sample size decreases. When only 50 samples are available, the proposed method still achieves an RMSE of 0.41 h and a MAPE of 14.46%, while XGBoost and CNN degrade to RMSE values above 0.60 h. The Transformer model also suffers from the small sample size because it has a large number of trainable parameters. In contrast, the MAML initialization provides a strong prior that reduces the amount of task-specific data required for adaptation.
| Samples | Model | RMSE (h) | MAPE (%) | \(R^2\) |
|---|---|---|---|---|
| 90 | MAML-CNN-Transformer | 0.28 | 8.46 | 0.981 |
| XGBoost | 0.40 | 9.17 | 0.960 | |
| CNN | 0.50 | 14.62 | 0.936 | |
| Transformer | 0.33 | 11.36 | 0.972 | |
| CNN-Transformer | 0.30 | 8.68 | 0.977 | |
| 70 | MAML-CNN-Transformer | 0.30 | 8.96 | 0.978 |
| XGBoost | 0.51 | 11.43 | 0.935 | |
| CNN | 0.40 | 11.40 | 0.961 | |
| Transformer | 0.53 | 12.12 | 0.932 | |
| CNN-Transformer | 0.42 | 9.40 | 0.955 | |
| 50 | MAML-CNN-Transformer | 0.41 | 14.46 | 0.954 |
| XGBoost | 0.61 | 21.47 | 0.907 | |
| CNN | 0.60 | 17.67 | 0.911 | |
| Transformer | 0.66 | 19.01 | 0.891 | |
| CNN-Transformer | 0.51 | 16.73 | 0.935 |
5.10 Validation of the charging-level feature
In the final experiment, we replace the charging-level feature with the two clustered current features and train the same MAML-CNN-Transformer model. Since the clustered current is not known before charging, this comparison is only performed retrospectively after each charging segment is complete. Table 14 compares the two feature settings on the four target vehicles. The charging level produces slightly larger errors on vehicle #2 and vehicle #7, because within the same charging level the current can vary substantially and the model loses the exact current magnitude. However, with only three discrete levels, the model can still obtain competitive accuracy. On the other hand, the charging-level feature is more robust and practical in real pre-charge prediction, because it does not depend on the actual current that has not yet been measured. Therefore, we choose the charging level as a trade-off between accuracy and availability.
| Vehicle | Charging current features | Charging level feature |
|---|---|---|
| RMSE (h) / MAPE (%) | RMSE (h) / MAPE (%) | |
| #1 | 0.15 / 2.88 | 0.13 / 2.26 |
| #2 | 0.12 / 3.47 | 0.19 / 6.08 |
| #3 | 0.21 / 4.94 | 0.20 / 4.31 |
| #7 | 0.11 / 3.61 | 0.16 / 5.94 |
5.11 Training behavior and convergence
We analyze the loss curves during the meta-training and fine-tuning stages. During meta-training, the training loss fluctuates because tasks from different electric vehicle models require conflicting parameter updates; this is expected when learning a general initialization. The test loss on the query sets decreases over time, indicating that the model learns transferable knowledge across tasks. During fine-tuning on a target vehicle, the loss drops quickly after only a small number of epochs, confirming that the meta-learned initialization provides an excellent starting point. In practice, 20 to 50 epochs of fine-tuning using a small support set are sufficient to reach satisfactory accuracy on the target vehicle.
6. Discussion
The two prediction methods proposed in this study address different operating points in the electric vehicle charging time prediction landscape. The multi-model fusion approach is best suited to scenarios where a large amount of labeled historical data is available for a fleet of homogeneous or only slightly heterogeneous vehicles. By explicitly including the ohmic resistance health feature, it can adapt to battery aging over time. The random forest fusion layer then corrects the individual weaknesses of the gradient boosting models, offering stable estimates across users and environmental conditions.
The meta-learning approach is preferable when the electric vehicle at hand has little or no historical data. Through the MAML paradigm, the model learns from other vehicles how to initiate the prediction network for the new vehicle. When the new user provides a small number of charging records, the model can quickly adjust. The parallel CNN-Transformer architecture allows the model to capture both local feature interactions (e.g., state-of-charge distribution) and long-range dependencies (e.g., combination of the charging level and the target state of charge). The charging level feature avoids the chicken-and-egg problem of knowing the current pattern in advance.
Despite the encouraging results, both methods have limitations. The first method relies on robust estimation of the ohmic resistance from driving segments. If the vehicle is seldom used, the estimated resistance may be noisy. The second method relies on the availability of source tasks from other electric vehicles; if the target vehicle has a completely different battery chemistry or a novel charging control strategy not present in the source tasks, the meta-learning initialization may not provide enough guidance. Additionally, the charging level feature may be too coarse when the current within a level varies over a wide range. A more fine-grained level definition, perhaps based on the exact charger model or maximum power rating, could be beneficial.
The broader implication of this research is that charging time prediction should not be treated as a static regression problem but rather as a dynamic and context-dependent task in which battery aging, environmental variables, charging equipment, and vehicle heterogeneity all matter. Accurate prediction requires a combination of domain-aware feature engineering, powerful machine learning models, and effective strategies for handling small samples. As more data become available from connected electric vehicle fleets, the methods can be further improved and deployed in cloud-based services or in-vehicle prediction systems.
7. Conclusion
In this study, we investigated the problem of predicting the charging time of an electric vehicle using real-world operational data. We first analyzed the battery working principle, the charge storage and release process, and the impact of state of charge, temperature, and battery health on charging time. Two datasets, one from a same-model fleet with long recording periods and another from a multi-model fleet with shorter recording periods, were preprocessed and used for two complementary prediction frameworks.
In the first framework, suitable for a sufficiently large dataset, we built a feature set containing the start/end state of charge, the state-of-charge increment, the percentage of charging time spent in three SOC intervals, the ambient temperature, two clustered charging current values, and the temperature-corrected ohmic resistance as a battery health indicator. We trained XGBoost, LightGBM, and CatBoost base models and fused their predictions by random forest regression. Experiments on the ten-vehicle fleet demonstrated that the proposed fusion model achieved an RMSE of 0.130 h and a MAPE of 5.676%, better than all single models and other fusion baselines. Ablation studies confirmed the positive contribution of the fusion layer and the health feature for most vehicles.
In the second framework, designed for few-shot prediction across heterogeneous vehicle types, we replaced the charging current with a categorical charging level based on the maximum power range and fed all available features into a parallel CNN-Transformer network. We trained the network with the model-agnostic meta-learning algorithm. On the multi-model dataset, the proposed MAML-CNN-Transformer method achieved the highest \(R^2\) values and the lowest RMSE on all tested target vehicles. The performance degradation was smaller than that of other baselines when the number of available target samples was reduced from 90 to 50, confirming the value of meta-learning in small-sample electric vehicle charging time prediction.
Future work should explore the following directions. First, more granular charging-process information, such as the time when the battery enters constant voltage mode, could be predicted as auxiliary outputs and then used to refine the charging time estimate. Second, Bayesian meta-learning or probabilistic meta-learning methods can provide uncertainty intervals for the predictions, which are valuable for decision-making. Third, online learning strategies can enable the model to update continuously as new charging events occur, adapting to gradual battery degradation and seasonal effects. Fourth, incorporating external data such as charging station occupancy, weather forecasts, and electricity prices may further improve the practical utility of the charging time prediction system. In summary, the fusion of powerful machine learning models with meta-learning paradigms opens a promising path toward accurate, adaptive, and scalable electric vehicle charging time prediction.
