Abstract
The problem of range anxiety caused by the discrepancy between the mileage on the dashboard and the driving mileage of pure electric vehicles (PEVs) is one of the most important reasons hindering the development of PEVs. Prediction of energy consumption can effectively reduce the driver’s range anxiety and provide support for energy management strategies optimization and energy-efficient route plan. To this end, this paper analyzes the effects of velocity, environment and driving style on energy consumption from the real driving data of PEVs. Based on the analysis, a driving condition prediction method combining with real-time traffic information is proposed, and integrated into the energy consumption prediction model. The real-world trip test results show that the prediction errors of RMSE and MAPE of the proposed method are respectively reduced by 66.37% and 68.10% compared to the conventional method.
Similar content being viewed by others
Introduction
Literature review
PEVs have advantages over traditional internal combustion engine vehicles, such as zero emissions, low noise, and high energy efficiency1. However, due to factors such as the low energy density of batteries, long charging times, and uneven distribution of charging stations, drivers often sustain range anxiety when the remaining driving range on instrument panel does not match the actual situation. Meanwhile, owing to the complexity of actual driving conditions and significant fluctuations in real-time energy consumption, accurately predicting a vehicle’s energy consumption is extremely challenging2,3. In existing studies, the main methods for energy consumption prediction can be categorized into two types: physical-based model and data-driven model.
Physical-based models conduct a detailed analysis of the mechanisms by which internal and external factors of the vehicle affect energy consumption. The more influencing factors considered in the model, the higher its accuracy4,5. The physical model is built based on priori knowledge, and the performance of the model heavily depends on the accuracy of the priori knowledge and simple linear assumptions. However, most factors affecting the energy consumption of PEVs exhibit complex nonlinear relationships with energy consumption and strongly couple with other factors. This significantly weakens the generalization capability of physical-based models6.
Data-driven models no longer rely on human prior knowledge. By learning from data and adjusting parameters, data-driven models demonstrate strong adaptability and flexibility in various complex situations7. Thanks to the rapid development of V2X technologies, a large amount of real-world driving data from PEVs has been used to train energy consumption prediction models, and the data combined with information such as traffic performance index8, road grade9 and temperature10 provide a new research direction for energy consumption prediction. Li et al.11 established five random forest-based prediction models to predict the energy consumption of a bus. They classified the features input of the models into three categories: dynamic traffic conditions, environmental conditions, and route characteristics, then ranked the effects of each type of feature on energy consumption. Bingham12 investigated the effect of driving style on the energy consumption of PEVs, and concluded that 30% difference of energy consumption exist between aggressive and moderate driving styles.
In summary, regardless of the methodology used, most researchers focus the energy consumption of PEVs on three aspects. The first is vehicle-related factors13, including velocity, acceleration, auxiliary system energy consumption, etc.The second is environment-related factors14, including traffic conditions, road grade, temperature, etc.The third is driver-related15,16 factors, including driving style, operation schedule, and route planning, etc. However, most of the existing studies seldom consider the impact of future driving conditions on energy consumption17, which leads to significant distortion and lag in energy consumption predictions when there are substantial changes in future driving conditions.
Two main types of methods for predicting driving conditions involve stochastic and deterministic methods. Zhang et al.18 proposed an energy consumption prediction framework that integrates the prediction of future driving conditions using Markov Chain Monte Carlo(MCMC). Bahram et al.19 employed the stochastic multiagent simulation to predict driver’s intention and combined the result with a Bayesian network to classify participants’ actions and then estimate their potential speeds. The stochastic methods describe the randomness caused by traffic conditions and driving styles, but driving styles can vary significantly between urban roads and highways. When road types or traffic conditions change, stochastic methods may lead to larger errors. Hedge et al.20 suggested that drivers exhibit specific driving characteristics when facing different road features, such as sudden deceleration at stop signs. These driving characteristics can be reflected by establishing physical-based models.
The driving process of a vehicle is a stochastic process influenced by multiple factors, but it will exhibit specific driving characteristics at specific road features. Therefore, using a purely stochastic method or a deterministic method to predict driving conditions is unreasonable21. A driving condition prediction model that combines stochastic and deterministic approaches is proposed in this paper, and integrated into a machine learning-based energy consumption prediction model trained on real-world data. This study presents innovations in the following aspects.
-
1.
A simplified intersection condition prediction model is proposed. We assuming that vehicles must stop and wait before passing through the intersection, so that the complex conditions at the intersection are simplified to deceleration and acceleration processes before and after the stop characteristic.
-
2.
The average trip velocity of the road segment is used to replace the target and initial speeds for predicting acceleration and deceleration conditions. Compared to the road speed limits typically used in previous approaches, this method takes into account the impact of real-time traffic conditions on velocity.
-
3.
An Encoder-decoder structured long-term sequence prediction model Informer is used for the prediction of deterministic processes. Compared with traditional RNN-based time series models, it offers higher accuracy in long-term sequence predictions.
Data process
The data used in this paper originated from the National Monitoring and Management Platform for New Energy Vehicles, which covers the driving data of four PEVs of the same model in Beijing for the whole year from January 1, 2022 to December 31, 2022. The data recorded 73 items such as velocity, accumulated mileage, total voltage and total current of the collected vehicles with a sampling interval of 1s. Hourly temperature data for the whole year of 2022 in Beijing was obtained from the weather website (https://rp5.ru/), and the city road-level Traffic Congestion Index (TCI) and the average trip velocity of the road \(V_{T}\) were obtained from Baidu Maps Traffic and Mobility Big Data Platform (https://jiaotong.baidu.com/). According to the definition of \(V_{T}\) in22
where \(L\) is the length of the road segments in kilometers, \(t_{i}\) is the time consumption of the \(i\) th floating car through the road segment in hours, \(n\) is the number of floating vehicles, and \(\overline{t}\) is the average trip time of the road segments in hours . The temperature and average trip velocity of the road segment were matched with the vehicle driving data based on the timestamps and coordinate labels.
The statistical results of the total annual mileage, average daily mileage and average daily driving time of each vehicle are shown in Fig. 1. The real driving data is transmitted to the data collection platform via wireless transmission technology. Data distortion and loss are inecitable in the process of data transmission and storage, and different types of abnormal data require different methods for processing. The data quality has been significantly enhanced through removing rows with extensive missing values, interpolating single-point missing data, and utilizing box plot analysis for outlier detection and treatment.
Driving fragment division
The dataset contains data from both charging and discharging states. It is necessary to divide the data into independent discharging segments based on the vehicle’s charging state and driving status. Secondly, the battery being in a discharging state does not necessarily mean that the vehicle is in a normal driving process. When the vehicle is parked or idle, the battery remains in a discharging state due to the working auxiliary systems. To eliminate the impact of this non-driving status on energy consumption, it is necessary to further divide the discharging data. The traditional fixed-step segmentation method cannot circumvent the above effects22, therefore, the discharging segments are divided into three-level driving fragments in this paper: trip fragments, micro-fragments, and kinematic fragments. The definitions of the 3-level fragments are listed in Table 1.
Trip fragments contain the process of continuous driving of the vehicle for a long period of time, reflecting the complete process and driving behavior of a trip. Training the energy consumption model with trip fragments can help capture the long-term trends in energy consumption variations. Micro-fragments reflecting micro-level driving characteristics, are used to study the impact of short-term driving behaviors on energy consumption. In order to further annalyze the motion state of the vehicle, the micro-fragments are further divided into kinematic fragments. Each kinematic fragment includes five states, which are start up, acceleration, deceleration, cruising, and idling. The rules for dividing kinematic fragments are shown in Table 2, and a sample of the driving fragment division is shown in Fig. 2.
The driving data of the four vehicles are divided into a total of 10,632 trip fragments, each of them is labeled according to the starting and ending time, and stored in a specific table together with the corresponding energy consumption related data, as shown in Table 3.
Energy flow analysis of PEVs
A pure electric vehicle is an electrical system that integrates energy storage and consumption, in which the power battery pack servies as the sole energy source to power all electrical systems. In order to conduct a detailed analysis of the relationship between the influencing factors and energy consumption, there is a need to map out the direction and form of energy flow between the various systems, as shown in Fig. 3. The energy output from the battery can be divided into two parts, one portion powers the drive system to propels the vehicle forward and overcome driving resistance; the other powers the electrical auxiliary systems, ensuring the normal operation of systems such as Electric Power Steering System (EPS) and air condition system. When the vehicle brakes, the drive motor acts as a generator, converting mechanical energy into electrical energy and sending it back to the battery. In the driving process, the battery energy consumption (\(EC_{b}\)), motor energy consumption (\(EC_{m}\)), auxiliary system energy consumption (\(EC_{a}\)) and braking energy regeneration (\(ER_{b}\)) are calculated as follows
where \(n\) is the number of sampling points in the trip fragment, \(U_{bi}\) and \(I_{bi}\) are the battery.
voltage and current at time \(i\). \(\Delta t\) is the time interval between neighboring sampling.
points, \(U_{mi}\) and \(I_{mi}\) are the input voltage and current of the motor controller at time \(i\), respectively.
The energy consumption rates of the battery (\(ECR_{b}\)), motor (\(ECR_{m}\)), auxiliary system (\(ECR_{a}\)), and the energy regeneration rate (\(ERR_{b}\)) are calculated from the \(EC_{b}\), \(EC_{m}\), \(EC_{a}\) and \(ER_{b}\) divided by the driving mileage, and all of them is in kWh/km. According to the vehicle technical parameters provided by the manufacturer, the energy consumption of the vehicle under NEDC is 0.129 kWh/km, however, in practice, the average \(ECR_{b}\) for trip fragments is found to be 0.187 kWh/km. This indicates that the complexity of driving conditions can lead to a significant difference between the actual energy consumption and the standard values provided by the manufacturer.
Energy consumption influencing factors analysis
As shown in Fig. 3, the energy consumption of PEVs mainly consist of powertrain energy consumption and auxiliary system energy consumption. The energy consumption of these systems is affected by the complexity, nonlinearity and coupling of multiple factors23. The powertrain energy consumption can be calculated by the Eq. (6).
where \(F_{t}\) is the driving force;\(S\) is the driving mileage;\(\eta_{b}\),\(\eta_{m}\),\(\eta_{t}\) are the efficiencies of battery discharging, motor and transmission system; \(F_{f}\),\(F_{w}\), \(F_{i}\) and \(F_{j}\) denote the rolling, air, acceleration and road slope resistance, respectively; \(m\) is the vehicle mass,\(f\) is the tire rolling resistance coefficient, \(\theta\) is the road gradient,\(C_{D}\) is the drag coefficient of vehicle, \(A\) is the vehicle equivalent cross section, \(u_{a}\) is the velocity of the vehicle,\(\delta\) is mass factor.
The relationship between \(EC_{b}\) and the energy consumption of the other systems is
Although Eqs. (6) and (7) can calculate the energy consumption of each system, it is difficult to obtain all the variables required for the calculation in engineering applications. So it is difficult to make quantitative calculations of the factors affecting the energy consumption through the formulas. In this paper, the factors affecting energy consumption are categorized into three aspects, which are velocity-related, environment-related and driver-related factors. Statistical data of the relevant factors in the trip fragments are calculated to study the variation trends of \(ECR_{b}\) and \(ERR_{b}\) with respect to each influencing factor.
Velocity-related factors
Velocity is the most intuitive parameter to describe changes in the vehicle’s motion state. Existing research has been shown that velocity, as well as acceleration, average velocity, and average acceleration, are strongly correlated with the energy consumption of a vehicle24.
Since the acceleration was not directly captured in the dataset, the acceleration at each sampling point was calculated based on the velocity and sampling time interval in this paper. The average velocity, average acceleration, and average deceleration for each micro-fragments are then statistically calculated.
For the projection of the contour lines from Fig. 4a, it can be observed that an increase in both average velocity and average acceleration leads to higher energy consumption. In the state of lower average velocity, the contour lines are denser, and an increase in acceleration causes a rapid rise in energy consumption, On the contrary, in the state of higher average velocity, the contour lines are sparser, and the increase in acceleration causes a slow increase in energy consumption, which shows that in the state of high velocity, the average velocity has a higher degree of influence on energy consumption than the average acceleration. When the average velocity of the micro-fragment is between 35 and 45 km/h and the average acceleration is between 0 and 0.2 m/s2,\(ECR_{b}\) is at its lowest. Conversely, when the average velocity is in the range of 0–20 km/h and the average acceleration is in the range of 0.5–0.6 m/s2,\(ECR_{b}\) is at its highest.
The effect of average velocity and average deceleration on \(ERR_{b}\) are shown in Fig. 4b. \(ERR_{b}\) increases rapidly with the rise in average velocity, reaching a peak in the mid-velocity, and then gradually decreases in the high- velocity. This is because the vehicle rarely experiences situations requiring significant braking force during high- velocity cruising.
Environment-related factors
Environmental factors related to energy consumption include temperature and TCI.
Since the sampling frequency of temperature data is hourly, it is assumed that the temperature does not change during each hour. The ambient temperatures of the sampling points in dataset are distributed in the interval of − 10 to 35 ℃. The distributions of \(ECR_{b}\) and \(ECR_{a}\) for trip fragments are statistically calculated every 5 °C interval, and the results are shown in Fig. 5.
In Fig. 5, the box plots are all U-shaped distributions with the lowest energy consumption distributed in the range of 10–20 °C. As shown in Fig. 5a, the average \(ECR_{b}\) at low and high temperatures are significantly higher than those at other temperatures, where the average \(ECR_{b}\) at high temperatures is the highest, followed by low temperatures, specifically, the \(ECR_{b}\) is 38.83% and 33.51% higher than the lowest average \(ECR_{b}\), respectively. This means that in winter and summer, the energy consumption of PEVs under the same driving conditions is significantly bigger than that in spring and fall, which is due to the fact that the prolonged use of air-conditioning systems consumes a large amount of energy in winter and summer, this is further validated by the \(ECR_{a}\) distribution curve. In addition, low temperatures cause phenomena such as increased battery polarization and reduced electrochemical reflection activity, leading to a significant reduction in battery discharge capacity25. This also explains the reason why the driving range of PEVs “shrinks” in winter.
Another environmental factor related to energy consumption is TCI. According to the definition of Baidu Maps Traffic and Mobility Big Data Platform, the TCI at the city-region level is divided into four levels, with higher values indicating more serious traffic congestion, the division rules for traffic congestion levels are shown in Table 4.
The Baidu Maps Traffic and Mobility Big Data Platform provides 5-min level TCI data for each area in Beijing, as well as the average traffic velocity of each area obtained from floating vehicle, as shown in Fig. 6.
In Fig. 6, the TCI shows a significant negative correlation with the average velocity, the TCI is highest and the average velocity is lowest during the 07:00–09:00 period, which we consider to be the morning peak period in Beijing. Similarly, the 17:00–19:00 period is regarded as the evening peak period. We counted the average \(ECR_{b}\) of vehicle 1 during all morning peak, evening peak and 12:00–14:00 (non-peak) trip fragments on weekdays, the results are shown in the bar chart in Fig. 6, and the average \(ECR_{b}\) during both peak periods is higher than during the non-peak period.
Driver-related factors
Driver’s driving style has a significant effect on the energy consumption of a vehicle26. Driving style can be defined as the behavioral characteristics and habits that a driver shows when driving a vehicle. A more aggressive driving style will result in higher energy consumption. When the driving style is reflected in the vehicle’s kinematic fragments, an aggressive driving style is characterized by more frequent acceleration and braking times, as well as higher cruising speeds, whereas a mild driving style is the opposite. Since the dataset does not include information such as throttle and brake pedal positions, the proportion of acceleration time and deceleration time within micro-fragments is calculated in this paper to reflect the frequency of acceleration and braking events.
A driving style classification method is proposed in the paper18, in which the performance of driving style in terms of acceleration is divided into four categories, namely:
-
(1)
HaHd (High acceleration and High deceleration)
-
(2)
HaLd (High acceleration and Low deceleration)
-
(3)
LaHd (Low acceleration and High deceleration)
-
(4)
LaLd (Low acceleration and Low deceleration)
We counted the average acceleration time ratio, the average deceleration time ratio and the average \(ECR_{b}\) of all micro-fragments of the 4 vehicles, the results are listed in Table 5. The micro-fragments are classified based on the average acceleration time ratio and average deceleration time ratio of four vehicles as the reference values. For example, if the acceleration time ratio of a fragment is 44.13% and the deceleration time ratio is 36.18%, both of which are higher than the average values for vehicle 1, this micro-fragment can be considered as a HaHd-type driving style. In order to exclude the influence caused by environmental factors as much as possible, only the micro-fragments with similar TCI during non-peak hours are screened for classification, and the statistical results of the average energy consumption of micro-fragments with different driving styles are shown in Fig. 7.
As shown in Fig. 7, the driving style with the highest \(ECR_{b}\) is the HaHd style with a value of 0.228kWh/km, and the driving style with the lowest \(ECR_{b}\) is LaLd, with its average \(ECR_{b}\) being 21.8% lower than that of the HaHd driving style. The average \(ECR_{b}\) of the HaLd driving style is slightly higher than that of LaHd, which suggests that the high acceleration has a greater effect than the high deceleration on the \(ECR_{b}\). To further investigate the influence of driving style on \(ECR_{b}\), we present the effects of the acceleration time ratio and the deceleration time ratio on \(ECR_{b}\) and \(ERR_{b}\) at different average velocity, as shown in Fig. 8.
In Fig. 8a, the lowest \(ECR_{b}\) occurs in the region where the average velocity is approximately 40 km/h and the acceleration time ratio is less than 20%, while the highest \(ECR_{b}\) is observed in the region where the average velocity is between 50 and 60 km/h and the acceleration time ratio exceeds 50%. In Fig. 8b, the contour lines are sparse at low and high speeds, and dense at medium speeds along the Y-axis, which means that the braking energy regeneration efficiency decreases at both low and high velocity. Based on the above analysis, it can be concluded that different driving styles result in significant variations in \(ECR_{b}\). Drivers can select an appropriate driving style at different velocity to reduce energy consumption.
Energy consumption prediction
Structure of the algorithm
In conventional energy consumption prediction method, the average of \(ECR_{b}\) over a past period of time is usually used as a proxy for future \(ECR_{b}\)
where \(EC_{b}^{pred}\) is the future energy consumption, \(ECR_{b}^{pred}\) represents the predicted energy consumption rate during the future driving process,\(EC_{b}^{past}\) is the energy consumption during the past trip mileage \(x_{past}\), and \(x_{future}\) is the distance from the current position to the destination. This method is based on the assumption that \(ECR_{b}\) will not change much in the future compared to the past period, however, changes in future driving conditions can lead to considerable distortion in the predictions of conventional methods in practice. A future driving condition prediction model has been integrated into the energy consumption model in this paper in order that the model is able to perceive future driving conditions. The framework of the algorithm is shown in Fig. 9.
Driving condition prediction
Road information predefined
The coordinates of all intersections between the vehicle’s initial position and destination were extracted in a trip fragment, and the distance between the coordinates \(d\) in Eq. (9) was calculated by Haversine formula
where R is the radius of the earth, and \(R = 6378.137\;{\text{km}}\), \(a\) is the value obtained by converting the latitude difference between two coordinates into radians, \(b\) is the value obtained by converting the longitude difference between two coordinates into radians.
The calculation result of Eq. (9) represents the straight-line distance between two coordinates. However, if a turn occurs between the two coordinates, the result may cause a large errors. To avoid this, we segment the trip at intersections and calculate the distance from the vehicle’s current position to the next intersection, the vehicle’s trajectory is displayed on the map, as shown in Fig. 10.
The orange curve in the figure represents the average trip velocity \(V_{T}\) for the road segment, which reflects the average traffic flow speed on the current road segment. Compared to using the road’s maximum speed limit as a reference, \(V_{T}\) is more closely aligned with the actual traffic conditions, once the destination for the driving condition prediction is set, we can obtain \(V_{T}\) for the route segment by calling the Baidu Map RouteMatrix API. Additionally, the coordinates of all the intersections along the vehicle’s travel route were obtained, when approaching an intersection, vehicles typically decelerate to a stop. To simplify the complexity of the prediction model, it is assumed that vehicles must stop and wait before proceeding through an intersection, regardless of whether the traffic light is green or the vehicle is making a right turn..
Process of driving condition prediction
In paper 21, driving conditions are divided into three categories:
-
(1)
Acceleration or deceleration conditions. The velocity variation in this type of driving condition is large and deterministic, making it suitable for deterministic prediction methods such as RNN and Transformer.
-
(2)
Cruise conditions. The velocity variation in this type of driving condition is small and highly random, making it suitable for the Markov Chain Monte Carlo (MCMC) method to simulate the vehicle’s stochastic behavior and generate velocity distributions.
-
(3)
Intersection conditions. The velocity variation in this type of driving condition is more complex and requires further analysis. The intersection condition is simplified in this paper, it is assumed that when the vehicle approaches an intersection, it needs to stop and wait before proceeding, regardless of whether the traffic light is green or if the vehicle is turning right. Thus, the intersection condition is simplified to a deceleration-to-stop followed by an acceleration process. The prediction process of an intersection condition is shown in Fig. 11.
In Fig. 11, \(V_{T}\) is the average trip velocity of the current road fragment,\(d_{r}\) is the distance from the current position of the vehicle to the next intersection \(x_{stop}\), \(d_{D}\) is the brake distance of the vehicle from \(V_{T}\) to stop, and \(d_{A}\) is the distance required to accelerate the vehicle from rest to \(V_{T}\). Assuming that the vehicle stops at \(x_{0}\), and the final velocity is \(V_{T}\), the program will call the Informer model to predict the distribution of speeds in the spatial ___domain for the acceleration process. When the vehicle travels to \(x_{1}\), the velocity reaches \(V_{T}\), Eq. (9) can determine the distance of the vehicle between current position and the next intersection, as well as \(d_{D}\), which will be described in the following section. At this time, the program determines if there exists \(d_{r} > d_{D}\), if it is true, the vehicle is about to enter the cruising condition, calling MCMC method to generate the velocity distribution of the next every meter, and repeats the process until the vehicle travels to the \(x_{2}\) position at which \(d_{r} \le d_{D}\). If the vehicle decelerates to park, the program invokes the Informer model to predict the distribution of speeds in the spatial ___domain for the decceleration process, and the acceleration process after the \(x_{stop}\) is the same as the vehicle start at position \(x_{0}\). Figure 12 illustrates the complete procedure of the prediction process.
Construction of the driving condition prediction model
-
(1)
Informer model.
Informer was proposed by Zhou27 in 2021 as an improvement to the long sequence prediction (LSTF) model Transformer. The authors focused on three improvements are as follows. Firstly, the self-attention mechanism of Transformer needs to compute the inner product of all \(Q\) and \(K\) with a complexity of (\(O\)\(L^{2}\)), which leads to significant computational cost for long sequences \(L\). ProbSparse Self-Attention is introduced by Informer to filter the \(Q\) that contributes the most to the output, as shown in Eq. (10).
where \(\left\| {Q_{i} } \right\|_{2}\) and \(\left\| {K_{j} } \right\|_{2}\) are the paradigms of \(Q\) and \(K\) , and \(u\) is the number of attention items in the final output.
Secondly, to further reduce the computational cost, a Distilling Layer is introduced at the input layer in Informer, which reduces the length of the time series through downsampling. The original input sequence \(X\) after downsampling becomes
where \(r > 1\) denotes the downsampling rate, retaining key information to reduce the input sequence length \(L\) .
The last, an auto-regressive decoder (Auto-Correlation) is proposed in Informer to replace the decoder in Transformer, which requires generating outputs step by step.
In this paper, to predict the acceleration or deceleration conditions, we need to input four parameters into the Informer, which are the current velocity \(V_{0}\), the final velocity \(V_{T}\), the acceleration distance \(d_{A}\), and the deceleration distance \(d_{D}\). Since the previous assumption that the vehicle needs to stop and wait before passing at each intersection, \(V_{0}\) is set to 0 for the acceleration conditions, and \(V_{F}\) is set to 0 for the deceleration conditions. We counted the acceleration conditions starting from 0 and the deceleration conditions to 0 in the dataset. The relationship between the distance, \(V_{F}\) and \(V_{0}\) is shown in Fig. 13.
The maximum acceleration and deceleration distance are set to 100 m and 150 m, repectively, because these two values cover the typical values for the range of acceleration and deceleration processes in most driving scenarios. It can be seen that \(V_{F}\) and \(V_{0}\) show a significant linear positive correlation with \(d_{A}\) and \(d_{D}\) in Fig. 13, respectively, so a linear model can be used to describe their relationship as shown in Eq. (12).
where \(d_{i}\) represents the distance of acceleration and deceleration, \(V_{i}\) represents initial velocity and final velocity, \(a\) and \(b\) are the linearity coefficients. The linear coefficients for different working conditions are listed in Table 6.
If the actual acceleration or deceleration distance is shorter than the fixed value, the velocity of the last point will be used for padding, and in the actual prediction process, only the first \(d_{A}\) or \(d_{D}\) values are used as the valid values.
To determine the optimal hyperparameters for the Informer model, we employed a controlled variable strategy in which one hyperparameter was adjusted at a time while keeping the others fixed. RMSE was used as the evaluation metric during hyperparameter tuning to assess the prediction accuracy of each parameter configuration.
-
(2)
Markov-Chain Monte Carlo.
When the vehicle is accelerated to \(V_{T}\), the change in velocity may be influenced by factors such as road speed limits, traffic flow, and the speed of the vehicle ahead, this random process can be modeled using a Discrete-time Markov Chain28. In Sect. “Driving fragment division”, we divided the micro-fragments into different kinematic fragments, and all the states were used to compute the Transition Probability Matrix (TPM) except for the start-up state, the idle state, and the deceleration-to-zero state.
According to Markov Chain theory, the probability of the future state \(\upsilon_{x + 1}\) is only related to the current state \(\upsilon_{x}\)
where \({\text{V}}^{x} = (\upsilon_{x} ,\upsilon_{x - 1} ,...,\upsilon_{1} )\) is the velocity sequence and \(x\) is the discrete distance value between velocity sampling points. The kinematic fragment vary under different \(V_{T}\), so we divide each kinematic fragment into low velocity (0–30 km/h), medium velocity (30–70 km/h) and high velocity (70–100 km/h) intervals based on the average velocity, the increment of the velocity in each interval is 0.5 km/h, and the TPM was established for each velocity segment. Compared with the large matrix containing all speeds as established in28, the smaller matrices better reflect driving characteristics, which significantly reduce computational complexity. The range of velocity distributions for different velocity segments and the corresponding TPM dimensions are recorded in Table 7.
Each element in the TPM describes the probability of a state transitioning to another state
where \(p_{ij}\) is the transition probability between each pair of states, \(n_{ij}\) is the number of times state \(j\) occurs after state \(i\) occurs, and \(n_{i}\) is the total number of times state \(i\) occurs.
At the beginning of the prediction, the final velocity of the acceleration phase predicted by Informer is taken as the initial state, and the corresponding state label \(i\) is obtained as the starting point of the prediction. Then, according to the transition probability distribution of \(i\), the probability of the next state \(j\) is obtained from the TPM of the corresponding velocity segment, the specific velocity of the next position is predicted by using Monte Carlo sampling. Finally, the distance \(d_{D}\) required to decelerate to 0 at current velocity and the distance \(d_{r}\) from the current position to the next intersection are calculated. The above process iterates until \(d_{r} \le d_{D}\), and the MCMC prediction process ends.
The results of driving conditions prediction
In order to verify the performance of the algorithm under different driving conditions, three types of trip fragments containing off-peak driving conditions, peak-hour driving conditions and highway driving conditions are extracted from the dataset for prediction, the prediction results are demonstrated in Fig. 14.
Significant errors between the predicted velocity and the test trip velocity are generated at the five locations marked by yellow triangles in Fig. 14a. The first error occurs during the vehicle start-up phase, which is due to the fact that the model does not take into account the low-speed observation phase before the vehicle merges into the traffic flow. The second and fifth errors occurred during the normal driving phase where the test trip velocity suddenly decreases, which possibly come from the vehicle ahead suddenly decelerating or other unexpected traffic conditions. The third and fourth errors occur at intersections. Assumption in the model is that the vehicle must stop and wait before passing through each intersection, which does not align with the actual situation of right turns or green light straight drives. In Fig. 14b, the prediction results of congested road segments may have a large error due to the fact that there is a time lag of returning the average trip velocity by Baidu Maps API when congestion occurs. The average trip velocity for the highway condition from the Baidu Map API corresponds to the road’s maximum speed limit of 100 km/h when traffic conditions are smooth in Fig. 14c.
Energy consumption prediction
Feature extraction
The effects of velocity, environment and driving style on energy consumption were analyzed in Sect. “Energy consumption influencing factors analysis”. Afterwards, we extract features from the trip fragments, selected driving distance, technical velocity, acceleration time ratio, deceleration time ratio and ambient temperature as input variables for the energy consumption prediction model, and \(EC_{b}\) of each trip fragment as an output variable is achieved. The importance scores of each input features were obtained from the trained XGBoost model as shown in Fig. 15.
Among the five input variables, driving distance and technical velocity were identified as the most influential features, accounting for 5827% and 29.49% of the total importance, respectively. The result aligns with physical intuition, as higher average speeds and longer driving distances generally lead to increased energy consumption. The ambient temperature also contributed meaningfully to the model’s prediction. In contrast, acceleration time ratio and deceleration time ratio had a relatively smaller effect.
Energy consumption prediction model based on XGBoost
XGBoost29 is an optimized implementation of the Gradient Boosting Decision Tree (GBDT) framework, its core idea is to minimize errors by incrementally constructing decision trees. Therefore, in the XGBoost regression tree, the predicted result is the sum of the scores from the K individual tree predictions in Eq. (15).
where \(x_{i}\) is the \(i{\text{th}}\) training sample; \(f_{k} (x_{i} )\) is the score for the \(k{\text{th}}\) tree and \(F = \{ f(x) = \omega_{q(x)} \} (q:{\mathbb{R}}^{m} \to T,\omega \in {\mathbb{R}}^{T} )\) is the space of regression trees, \(q\) represents the structure of each tree that maps an example to the represents the structure of each tree that maps an example to the corresponding leaf index.
To optimize the loss function, XGBoost performs a second-order Taylor expansion of the second-order derivatives of the loss function, which makes each iteration more efficient. Assuming the loss function is \({\mathcal{L}}(y,f_{t} (x))\) , for the tth iteration, the Taylor expansion takes the form of
where \(g_{i}\) is the first-order derivative of the loss function, i.e., the residual, which represents the direction of error reduction; \(H_{i}\) is the second-order derivative of the loss function, which represents the rate of change of the residual. In order to reduce the loss of the additive model, XGBoost not only involves the minimization of the loss function, but also introduces the regularization term \(\Omega (f)\)
where \(T\) is the number of leaves, \(\gamma\) is the regularization parameter for the number of leaves, \(\lambda\) is the regularization parameter for the weights of the leaves, and \(\omega_{k}\) is the weights of the nodes of the leaves. The introduction of the regularization term reduces the risk of overfitting and decreases the complexity of the model. In each iteration, the XGBoost model is gradually optimized by optimizing the objective function in Eq. (18).
XGBoost is a tree-based algorithm for complex nonlinear regression problems such as energy consumption prediction, and the tree algorithm can effectively capture complex nonlinear trends in the data. During the training process, the complexity of the model is controlled by the regularization term shown in Eq. (17), which improves the generalization ability of the model. Based on the above advantages, the XGBoost model is more suitable for energy prediction.
Grid search is used to determine the optimal hyperparameters of the model in order to achieve the best prediction performance30. First, candidate hyperparameters and their value ranges are defined, such as learning_rate: 0.01, 0.05, 0.1; maximum depth of the tree (max_depth): 5, 6, 7; and minimum sample weight of the leaf nodes (min_child_weight): 1, 5, 10; and then, the combination of every two hyperparameter values is used to build a hyperparameter network with a size of 9 × 9. Finally, for each set of hyperparameter combinations, the model is trained and its performance metrics are calculated on the validation dataset, the optimal hyperparameter combination is selected based on these performance metrics.
Computational efficiency analysis
Although the proposed energy consumption prediction framework includes multiple modules, it has been carefully designed with computational efficiency and practical deployment in mind.
First, the Informer model adopts ProbSparse attention and sequence distillation strategies to significantly reduce computational complexity for long sequence prediction. Compared to the Transformer with O(L2) complexity, Informer achieves O(L log L), making it more suitable for resource-constrained vehicle onboard systems.
Second, the Discrete-time MCMC divides the velocity range into segments and builds smaller transition matrices.
Third, data preprocessing tasks such as feature extraction and trajectory segmentation can be handled by edge devices or vehicle gateways, allowing the embedded system to focus solely on model inference, thereby reducing onboard computational demands.
Finally, the XGBoost model is a lightweight tree-based algorithm with fast inference speed and controllable complexity. It supports model pruning and compression, and is well suited for deployment on embedded platforms such as Jetson or ARM processors. In future work, we will explore further optimizations such as model quantization and hardware-software co-design to support real-time intelligent prediction needs.
Results of energy consumption prediction and comparison
In this paper, RMSE and MAPE are used as evaluation metrics for model prediction results, which are defined as
where \(\mathop {y_{i} }\limits^{ \wedge }\) is the predicted value of the model output and \(y_{i}\) is the true value.
The conventional energy consumption prediction method introduced in 4.1 is used as a benchmark to compare the prediction performance, in which \(ECR_{b}^{pred}\) is replaced by the average \(ECR_{b}\) over the past 40 km. The energy consumption characteristics of the predicted values for the three conditions shown in Fig. 13 were extracted separately. Five trip fragments were selected for each condition and the average \(ECR_{b}\) for the first 40km of each trip was calculated. The results are shown in Table 8.
The energy consumption characteristics of the 15 test trip fragments are input to the trained XGBoost energy consumption prediction model, and the prediction results are shown in Fig. 16.
As shown in Fig. 16, the first 10 test trip fragments contain off-peak and peak-hour conditions, with most trip distances being less than 10 km, and the proposed method in this paper performs better in most cases. For the 10–15 test trips under highway conditions, where the driving distance typically exceeds 50 km, the prediction errors of both methods increase, but the proposed method still maintains high prediction accuracy.
The RMSE and MAPE are shown in Fig. 17, where the proposed method achieves average prediction errors of 0.414 kWh (RMSE) and 6.87% (MAPE), and the average prediction errors using the conventional method reach 1.231 kWh (RMSE) and 21.53% (MAPE) respectively. It is shown that the proposed method in this paper is better than that of the conventional method under different driving conditions.
Intersection stop assumption error analysis
In the proposed model, it is assumed that vehicles must come to a complete stop at each intersection before proceeding. To evaluate the impact of this assumption on prediction accuracy, a total of 20 trip fragments with varying numbers of intersections were selected from the dataset. For each trip, the number of intersections N was recorded and the RMSE of prediction was calculated as shown in Table 9.
Then we analyzed the relationship between N and RMSE using linear regression. Figure 16 illustrates the scatter plot of RMSE against the number of intersections, along with the fitted regression line.
Figure 18 show a positive correlation between N and prediction RMSE, it suggests that the intersection stop assumption may introduce cumulative error in trips with frequent intersections, and leading to an overestimation of energy consumption. Even in long trips with more than 20 intersections, the prediction RMSE of the proposed method remains lower than that of traditional methods (1.231 kWh).
Conclusion
In this paper, the real driving data of PEVs operating in Beijing for 1 year are utilized to make a study on the energy consumption prediction of PEVs. First, the driving data is divided into three levels by different granularities: trip fragments, micro-fragments and kinematic fragments. Then, the paper uses the three-level driving fragments to differentiate and quantify the three main factors influencing energy consumption include velocity, environment and driving behavior. Through the analysis and extraction of energy consumption influencing factors, an energy consumption prediction method integrating the prediction of future driving conditions is proposed. In the driving conditions prediction, the average trip velocity of the road segment \(V_{T}\) is used as the target speed for prediction, which enables the energy consumption prediction model to have a certain level of awareness of real-time traffic conditions. The energy consumption prediction results show that the average prediction errors of 0.414 kWh (RMSE) and 6.87% (MAPE) are reached by the proposed method, the RMSE and the MAPE are respectively reduced by 66.37% and by 68.10% compared to the conventional method.
There are still some limitations in this study which need to be improved in future work. Firstly, the vehicle behavior at intersections is simplified in this study by neglecting the cases of green light passage and right turns, these two scenarios should be modeled separately to improve the predictive performance of the model. Secondly, due to the fact that the traffic flow information from Baidu Maps is updated every 5 min, sudden traffic congestion cannot be reflected in real-time changes in \(V_{T}\) . In future work, the model could be improved by incorporating information such as the speed of preceding vehicles.
Data availability
The datasets generated and analysed during the current study are not publicly available because we have not obtained permission from the National Monitoring and Management Platform for public data access but are available from the corresponding author on reasonable request.
References
Tu, W. et al. Acceptability, energy consumption, and costs of electric vehicle for ride-hailing drivers in Beijing. Appl. Energy 250, 147–160 (2019).
Hannan, M. A., Hoque, M. M., Mohamed, A. & Ayob, A. Review of energy storage systems for electric vehicle applications: Issues and challenges. Renew. Sustain. Energy Rev. 69, 771–789 (2017).
Lu, Y. Recursive fusion estimation for mobile robot localization under multiple energy harvesting sensors. IET Control Theory Appl. https://doi.org/10.1049/cth2.12201 (2022).
Wager, G., Whale, J. & Braunl, T. Driving electric vehicles at highway speeds: The effect of higher driving speeds on energy consumption and driving range for electric vehicles in Australia. Renew. Sustain. Energy Rev. 63, 158–165 (2016).
Wai, C. K., Rong, Y. Y. & Morris, S. Simulation of a distance estimator for battery electric vehicle. Alex. Eng. J. 54, 359–371 (2015).
Zhang, X. A review of machine learning approaches for electric vehicle energy consumption modelling in urban transportation. Renew. Energy 234, 121243 (2024).
Yang, Y., Liu, Y., Li, G., Zhang, Z. & Liu, Y. Harnessing the power of machine learning for AIS data-driven maritime research: A comprehensive review. Transp. Res. Part E: Logist. Transp. Rev. 183, 103426 (2024).
Yufang, L. Investigating long-term vehicle speed prediction based on BP-LSTM algorithms. IET Intell. Transp. Syst. https://doi.org/10.1049/iet-its.2018.5593 (2019).
Wang, Y., Chen, Z. & Zhang, C. On-line remaining energy prediction: A case study in embedded battery management system. Appl. Energy 194, 688–695 (2017).
Yi, Z., Smart, J. & Shirk, M. Energy impact evaluation for eco-routing and charging of autonomous electric vehicle fleet: Ambient temperature consideration. Transp. Res. Part C: Emerg. Technol. 89, 344–363 (2018).
Li, P., Zhang, Y., Zhang, Y., Zhang, K. & Jiang, M. The effects of dynamic traffic conditions, route characteristics and environmental conditions on trip-based electricity consumption prediction of electric bus. Energy 218, 119437 (2021).
Bingham, C., Walsh, C. & Carroll, S. Impact of driving characteristics on electric vehicle energy consumption and range. IET Intel. Transport Syst. 6, 29–35 (2012).
Fiori, C., Ahn, K. & Rakha, H. A. Power-based electric vehicle energy consumption model: Model development and validation. Appl. Energy 168, 257–268 (2016).
Wu, G. et al. Deep learning–based eco-driving system for battery electric vehicles. https://doi.org/10.7922/G2NP22N6 (2019).
Jiménez, D. et al. Modelling the effect of driving events on electrical vehicle energy consumption using inertial sensors in smartphones. Energies 11, 412 (2018).
Zhang, R. & Yao, E. Electric vehicles’ energy consumption estimation with real driving condition data. Transp. Res. Part D: Transp. Environ. 41, 177–187 (2015).
Lamantia, M., Su, Z. & Chen, P. Remaining Driving Range Estimation Framework for Electric Vehicles in Platooning Applications. in 2021 American Control Conference (ACC) 424–429 https://doi.org/10.23919/ACC50511.2021.9482698 (2021).
Zhang, J., Wang, Z., Liu, P. & Zhang, Z. Energy consumption analysis and prediction of electric vehicles based on real-world driving data. Appl. Energy 275, 115408 (2020).
Bahram, M., Hubmann, C., Lawitzky, A., Aeberhard, M. & Wollherr, D. A combined model- and learning-based framework for interaction-aware Maneuver prediction. IEEE Trans. Intell. Transp. Syst. 17, 1538–1550 (2016).
Hegde, B., Ahmed, Q. & Rizzoni, G. Velocity and energy trajectory prediction of electrified powertrain for look ahead control. Appl. Energy. 279, 115903 (2020).
Shen, H. et al. Electric vehicle velocity and energy consumption predictions using transformer and Markov-Chain Monte Carlo. IEEE Trans. Transp. Electrific. 8, 3836–3847 (2022).
GBT 29107-2012. Road traffic information service-Traffic condition description.
Li, Y., He, H. & Peng, J. An adaptive online prediction method with variable prediction horizon for future driving cycle of the vehicle. IEEE Access 6, 33062–33075 (2018).
Mei, P., Karimi, H. R., Huang, C., Chen, F. & Yang, S. Remaining driving range prediction for electric vehicles: key challenges and outlook. IET Control Theory Appl. 17, 1875–1893 (2023).
Babu, P. S., Indragandhi, V. & Vedhanayaki, S. Enhanced SOC estimation of lithium ion batteries with RealTime data using machine learning algorithms. Sci. Rep. 14(1), 16036 (2024).
A novel energy consumption prediction model with combination of road information and driving style of BEVs - ScienceDirect. https://www.sciencedirect.com/science/article/abs/pii/S2213138820312534.
Zhou, H. et al. Informer: Beyond efficient transformer for long sequence time-series forecasting. Proc. AAAI Conf. Artif. Intell. 35, 11106–11115 (2021).
Oliva, J. A., Weihrauch, C. & Bertram, T. Model-based remaining driving range prediction in electric vehicles by using particle filtering and Markov chains. In 2013 World Electric Vehicle Symposium and Exhibition (EVS27) 1–10 https://doi.org/10.1109/EVS.2013.6914989 (2013).
XGBoost | Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining.
Liashchynskyi, P. & Liashchynskyi, P. Grid search, random search, genetic algorithm: A big comparison for NAS. Preprint at https://doi.org/10.48550/arXiv.1912.06059 (2019).
Acknowledgements
The authors would like to thank the anonymous referees for their invaluable suggestions to improve the paper. This work is supported by project for capacity construction of science and technology innovation service- Beijing laboratory construction- Beijing Laboratory for New Energy Vehicles (PXM2021_014224 _000065).
Author information
Authors and Affiliations
Contributions
Yong Chen: Resources, data curation, guidance, supervision. Zeyu Song: Conceptualization, software, writing original draft. Ruoyu Chen: Writing review & proofreading. All authors reviewed the manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Chen, Y., Song, Z. & Chen, R. Energy consumption prediction of PEVs incorporating traffic flow information. Sci Rep 15, 22602 (2025). https://doi.org/10.1038/s41598-025-05098-7
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-025-05098-7