Abstract
The rise of electric and autonomous vehicles in smart cities poses challenges in vehicular energy management due to un-optimized consumption, inefficient grid use, and unpredictable traffic patterns. Traditional centralized machine learning models and cloud-based Energy Management Systems (EMSs) struggle with real-time adaptability, high-dimensional data processing, and data privacy risks. These issues lead to high costs, excessive energy waste, and regulatory concerns. Federated Learning (FL) offers a decentralized approach where multiple edge devices collaboratively train models without sharing raw data. This enhances privacy, reduces communication overhead, and is well-suited for smart city applications. However, FL’s black-box nature limits interpretability, reducing trust in AI-driven decisions. Explainable AI (XAI) addresses this by enhancing transparency, interpretability, and regulatory compliance. This research introduces Explainable FL (XFL) for optimizing vehicular energy management in smart cities. The proposed XFL framework integrates distributed learning with explainability techniques for interpretable and accountable decision-making. Using a real-world AEV telemetry dataset of approximately 1,219,567 records with features like speed, energy consumption, and traffic density, it employs a hierarchical FL architecture to ensure secure and decentralized learning. It efficiently analyzes real-time traffic, vehicle energy states, and grid load balancing while preserving privacy. Experimental results show that the proposed Multi-Layer Perceptron (MLP)-based global model achieves superior predictive accuracy, with R² values of 94.73% for energy consumption and 99.83% for traffic density, significantly outperforming previous methods.
Similar content being viewed by others
Introduction
The rising global energy crisis and environmental degradation have become pressing issues, necessitating a shift towards sustainable and energy-efficient transportation solutions1. The rapid expansion of urban populations and the growing demand for personal and commercial mobility have intensified traffic congestion2,3, excessive fuel consumption, and high emissions, which pose severe threats to air quality, public health, and climate change4,5. Moreover, global reliance on fossil fuels accelerates resource depletion, which necessitates the shift towards sustainable and energy-efficient transportation solutions. Addressing these challenges requires innovative solutions that can optimize vehicular energy management, reduce carbon footprints, and enhance urban mobility efficiency6,7.
One of the most promising solutions to mitigate these challenges is the widespread adoption of Electric Vehicles (EVs) and Hybrid EVs (HEVs)8,9. These vehicles offer an alternative to conventional fuel-based transportation, significantly reducing emissions and improving energy efficiency. However, their performance is highly dependent on onboard battery packs, which undergo frequent charge-discharge cycles, leading to gradual battery degradation and diminished long-term efficiency. Battery ageing is a critical issue as it not only affects the power storage capacity but also impacts driving range, vehicle efficiency, and energy economy. In HEVs, where an Internal Combustion Engine (ICE) works alongside an electric motor, battery degradation places an additional burden on the engine, increasing fuel consumption and emissions, thereby counteracting the benefits of electrification10,11.
To address these inefficiencies, EMS play a crucial role in optimizing fuel economy, improving battery longevity, and ensuring effective power distribution in EVs and HEVs12. Traditional rule-based and heuristic EMS strategies show weaknesses in reacting to changing driving conditions while they also fail to use current vehicle energy status data. This limitation necessitates the integration of advanced data-driven models that can make intelligent, adaptive, and predictive energy management decisions13,14.
Plug-in HEVs (PHEVs) represent a technological advancement in sustainable mobility, integrating both internal combustion engines and rechargeable battery systems15,16. Unlike conventional HEVs, PHEVs offer an extended electric driving range by allowing external charging, reducing fuel dependency and emissions. The seamless interaction between the battery pack and auxiliary power unit requires an advanced EMS to optimize efficiency and prolong battery health.
Artificial Intelligence (AI) has revolutionized various industries, enabling data-driven optimization and intelligent decision-making. In the automotive sector, AI-driven models enhance energy efficiency, predictive maintenance, and autonomous functionalities17. Traditional smart traffic management systems depending on AI models collect their data at a central point which creates privacy challenges and produces unnecessary computational expenses as well as hindering real-time choices2,3,18. To overcome these challenges, decentralized AI frameworks are being explored to optimize vehicular energy management in a secure and scalable manner19,20. Recent studies have emphasized privacy-preserving frameworks and federated learning architectures—often incorporating edge computing, blockchain, and UAV systems—to improve security, scalability, and trust in intelligent distributed systems, which aligns well with our approach to smart vehicular energy management21,22,23,24,25,26,27,28.
FL has recently emerged as a promising decentralized machine learning paradigm that allows multiple edge devices (such as EVs) to collaboratively train models without sharing raw data28. This approach preserves privacy, reduces communication overhead, and enhances real-time adaptability in smart vehicular networks, as illustrated in Fig. 1.
Figure 1 shows a hybrid framework that integrates the PHEV power system with FL for Connected and Autonomous Vehicles (CAVs). This integration enables intelligent energy management, privacy-preserving AI-driven decision-making, and adaptive optimization for AEVs in smart cities. At the bottom layer (AEV Data Layer), where energy is managed through a hybrid combination of an onboard Energy Storage System (ESS) and an Assistance Power Unit (APU). The engine-generator unit supplements power, while the battery stores and supplies energy for propulsion through the inverter, motor, and AMT system. The EMS is key in optimizing power distribution and ensuring efficient operation under varying driving conditions. However, traditional EMS models lack adaptability and fail to account for real-time traffic conditions and long-term battery ageing, which necessitates a data-driven optimization approach29,30.
At the top layer (FL Network), where AEVs collaborate to train an AI-based global energy management model while maintaining data privacy. Instead of sharing raw energy usage and driving data, each AEV trains a local model using its data on road conditions, traffic flow, and energy consumption patterns. These local updates are then sent to a central FL server, which aggregates and optimizes the global model before redistributing it back to all vehicles. This continuous learning process allows AEVs to adapt to dynamic urban environments, optimize battery usage, and improve energy efficiency while ensuring privacy and reducing communication overhead. This framework leverages smart city infrastructure and V2I communication to enable real-time energy optimization, intelligent route planning, and scalable, privacy-preserving AI-driven vehicular management, ensuring efficient and adaptive mobility in future urban environments.
However, standard FL-based machine learning models often function as black-box systems, lacking transparency and interpretability, which limits their trustworthiness in mission-critical applications like energy management31,32. To address these limitations, XAI techniques have been introduced, aiming to make machine learning models more interpretable, accountable, and trustworthy. Methods like Local Interpretable Model-agnostic Explanations (LIME) help in identifying which features influence model decisions, enabling better debugging, bias detection, and regulatory compliance33,34,35. By enhancing transparency, XAI ensures that AI-driven systems can be trusted and effectively integrated into real-world applications.
By integrating the principles of FL25,36 and XAI, an XFL-based framework enhances vehicular energy management in futuristic smart cities37. This approach facilitates dynamic adjustments to EMS strategies by leveraging real-time vehicular data, battery health conditions, and energy consumption patterns while ensuring transparency in decision-making. Incorporating interpretability into federated models, strengthens trust in AI-driven vehicular systems, contributing to a more efficient, sustainable, and intelligent urban mobility infrastructure.
Literature review
EMS is an integral part of improving the fuel economy of both traditional HEVs and PHEVs, which have drawn the attention of many researchers38,39,40. Nevertheless, the current studies mainly focus on the optimization methods towards how to maximize the hybrid system’s advantages, without enough concerns about the impacts of battery ageing. Normally, the existing methods of EMS can be divided into two categories: the rule-based method and the optimization-based method. The rule-based strategies mainly depend upon some predefined control rules, containing deterministic rules and fuzzy logic rules, to operate the power units at high efficiency41.
In42, the researchers have focused on challenges in energy management for HEVs, particularly multi-vehicle interactions in dynamic traffic. Traditional methods struggle with unpredictable driving behaviors and fail to optimize fuel consumption efficiently. To overcome these challenges, the researchers applied Deep Reinforcement Learning (DRL) with an attention-based feature extraction module to capture real-time vehicle interactions and improve adaptability. Additionally, Proximal Policy Optimization (PPO) was used for stable and efficient training. The proposed approach achieved better fuel economy, reducing consumption from 8.7 to 5.6%, while also improving training stability and adaptability across various traffic conditions. However, its scalability to large-scale networks and real-time deployment remain challenges, requiring further optimization for practical implementation in intelligent transportation systems.
The researchers in43 have identified a critical gap in existing studies on Big Transportation Data (BTD), where much focus has been placed on data collection and inference methods, but less attention has been given to the large-scale challenges affecting its practical implementation in transportation decision-making. Through an extensive review of over 150 studies, the researchers categorized the key challenges into storage, processing, integration, and data privacy, emphasizing that traditional data management systems struggle with handling high-volume, high-velocity, and heterogeneous transportation datasets. The potential benefits of horizontally scalable architecture do not address fundamental issues that include immediate data unification and operation speed together with safety concerns. Standardized frameworks for privacy protection in BTD usage within transportation analytics have become an impediment to its general use throughout the industry. These data management challenges are also relevant to smart vehicular energy management systems that must process real-time energy usage, traffic density, and other heterogeneous vehicular data while preserving privacy.
According to44, the researchers have addressed security challenges in AEVs operating within the IoT ecosystem, where data integrity and confidentiality are critical concerns. Existing studies emphasize that while IoT integration enhances efficiency, it also exposes AEVs to cyber threats and malicious intrusions due to their interconnected nature. To overcome these security vulnerabilities, the researchers have applied Convolutional Neural Networks (CNNs) for real-time threat detection, leveraging their effectiveness in pattern recognition and anomaly detection. A rigorous performance evaluation using loss and accuracy curves, confusion matrices, and diverse optimization techniques further validates the robustness of this approach. The research outcomes show that deep learning enhances network intrusion detection capabilities which validates its effectiveness in protecting AEV systems. The broadly accessible system has proven effectiveness, yet researchers must address issues surrounding real-time computing delays and expansion to obtain widespread deployment success.
In this research45, the researchers address the challenge of predicting spatiotemporal variations in EV charging load, a key factor in grid management. Existing models struggle to capture both spatial and temporal dynamics, leading to inaccurate forecasts. To overcome this, the study introduces the Dilated Causal Convolution-2D (DCC-2D) model, which enhances pattern recognition from long-term data. Comparative analysis with ConvLSTM shows that DCC-2D outperforms existing methods, improving grid stability and energy planning. However, challenges remain in scalability, interpretability, and security risks, requiring further research for real-time deployment.
In46, the researchers focus on the challenge of secure and efficient energy consumption prediction for EVs while maintaining data privacy. Traditional centralized approaches pose security risks and fail to provide trustworthy data storage. To tackle this, the study leverages blockchain technology for secure black box data management, ensuring data integrity and transparency, while FL enables decentralized energy predictions without exposing sensitive data. Through its proposed method forecasting accuracy rises while energy distribution becomes optimized, and users maintain trust due to privacy protection practices. One main drawback of this approach is its limited interpretability which hinders the understanding of how predictions emerge even though it keeps presenting obstacles for practical implementation and authorities’ regulatory requirements.
In this research47, the researchers focus on the challenge of high resource consumption in vision-based algorithms for CAVs, which impact energy efficiency. Traditional methods rely on extensive sensory data sharing, leading to increased computational and communication costs. To address this, the study proposes a FL-based approach, enabling real-time GPS trajectory prediction of nearby road users without transmitting large data volumes. This method conserves energy while maintaining situational awareness. The integration of sequential and transformer-based models further enhances prediction accuracy with minimal resource usage. The findings demonstrate a significant reduction in resource consumption, making the approach practical for real-world CAV deployment. However, interpretability remains a challenge, as understanding how predictions are made is crucial for trust and regulatory adoption.
In this research48, the researchers address the challenge of accurate energy forecasting for EV charging stations using renewable energy sources. Traditional models like ARIMA struggle with complex energy patterns, while AI-driven models achieve higher precision (R2 = 0.92). The study validates performance using MAE, RMSE, and R² metrics, ensuring reliability. The model optimizes charging operations, reducing grid dependency and enhancing sustainability. Its scalability allows adaptation to various locations, though real-time adaptability and smart grid integration remain key areas for improvement.
In this research49, the researchers address the challenge of optimizing Lithium-ion Battery (LiB) performance through machine learning and XAI. Accurate battery management is crucial for cost-effective energy storage, reducing maintenance and replacement frequency. Various machine learning models such as LightGBM, XGBoost, and CatBoost are evaluated for predicting discharge capacity, with LightGBM achieving the best performance (MAE: 0.103, MSE: 0.019, R2: 0.887). The study also highlights the benefits of ensemble learning for improved prediction accuracy. Additionally, SHapley Additive exPlanations (SHAP) values are used within the XAI framework to analyze key influencing factors like temperature, cycle index, and voltage, revealing temperature as the most significant parameter. While the approach enhances LiB efficiency and reliability, challenges remain in generalizing model interpretability across different battery chemistries and operating conditions.
In this research50, the researchers address the challenge of optimizing energy management in New Energy Vehicles (NEVs) and ESS using data analysis and machine learning. Effective data collection, preprocessing, and feature engineering are crucial for improving predictive modelling, which enables accurate forecasting of energy demands and proactive system maintenance. The study explores optimization techniques, including dynamic programming for decision-making, reinforcement learning for adaptability, and genetic algorithms for optimizing charging and discharging strategies. These approaches tackle key challenges such as data scarcity, model generalizability, and interpretability, ensuring efficient and adaptive energy management. While machine learning enhances system performance, further research is needed to improve interpretability and real-time adaptability for scalable deployment in NEVs and ESS.
Table 1 summarizes key research on vehicular energy management, cybersecurity, and predictive modelling, highlighting various methods and their impact. Studies have explored DRL for HEV fuel optimization42, BTD analytics for large-scale transport data management43, and CNN-based intrusion detection for AEV security44. FL has been applied for privacy-preserving EV energy forecasting46 and trajectory prediction in CAVs47, while AI-driven models have improved energy forecasting for EV charging stations48 and battery performance optimization49. Despite advancements, challenges in scalability, real-time adaptability, and interpretability remain. The proposed XFL model addresses these gaps by integrating FL and XAI for secure, interpretable, and scalable energy optimization in smart cities.
Limitations of previous works
The review of previous studies on vehicular energy management, cybersecurity, and predictive modeling highlights several critical limitations that need to be addressed:
-
1.
Lack of privacy-preserving techniques
Many studies lack privacy-preserving mechanisms, requiring centralized data collection and exposing sensitive information to security risks. Research on EV energy forecasting48, trajectory prediction in CAVs47, and BTD analysis43 do not incorporate FL, leading to concerns about data privacy, compliance, and cybersecurity vulnerabilities.
-
2.
Lack of explainability and interpretability
Several AI-driven models, such as machine learning-based battery performance optimization49 and AI-based EV charging load forecasting48, offer high prediction accuracy but function as black-box systems without XAI. The lack of interpretability in these models reduces trust, transparency, and regulatory adoption, making it difficult for stakeholders to understand AI-driven decisions.
-
3
Limited scalability and real-time adaptability
Many proposed methods, including DRL-based fuel consumption optimization42, DCC-2D forecasting for EV charging loads45, and genetic algorithm-based energy management50, struggle with real-time adaptability in large-scale smart city environments. These models either require high computational resources or lack the ability to scale across dynamic vehicular and grid networks, limiting their practical deployment.
Contribution of the proposed model
The proposed XFL model addresses these key limitations by integrating privacy-preserving, interpretable, and scalable AI-driven energy management in smart cities:
-
1.
Privacy-preserving and secure learning
Unlike traditional approaches, the proposed model leverages FL to enable decentralized training without sharing raw data, ensuring data confidentiality and regulatory compliance. This enhances security in EV energy forecasting46, CAV trajectory prediction47, and energy grid optimization48, overcoming privacy risks observed in previous research.
-
2.
Improved model interpretability with XAI
The proposed framework incorporates XAI techniques to enhance transparency and explainability in AI-driven energy optimization decisions. Unlike previous studies on battery performance forecasting49 and EV charging predictions48, which lacked interpretability, XAI integration improves trust, accountability, and regulatory acceptance.
-
3.
Scalable and real-time adaptive energy optimization
Designed for smart city-scale vehicular energy management, the model ensures real-time adaptability and efficiency. By addressing scalability issues found in DRL-based HEV optimization42, DCC-2D charging load forecasting45, and genetic algorithm-based energy management50, the proposed model provides a robust, scalable, and real-time AI-driven energy optimization solution.
Proposed methodology
To address the challenges of efficient energy management, real-time adaptability, and data privacy in AEVs, this research proposes a FL-based smart EMS. The framework integrates privacy-preserving AI-driven optimization with adaptive energy distribution and real-time traffic-aware decision-making. Unlike traditional centralized models, which rely on raw data sharing and computationally intensive processing, the proposed approach enables distributed learning across AEVs, ensuring secure, scalable, and interpretable energy optimization. By leveraging XAI, FL, and smart city infrastructure, this methodology enhances trust, efficiency, and sustainability in future mobility ecosystems. Figures 2, 3 and 8 outline the abstract architectural components, system workflow for the local model, and global model implementation of the proposed model.
Figure 2 presents a cloud-integrated big data architecture for efficient vehicular energy management in AEVs. The system begins with real-time data collection on energy consumption, charging status, and traffic conditions, which is then refined through pre-processing, processing, and post-processing stages to enhance data quality. This structured data is stored in a scalable cloud-based repository (Hadoop, HIVE, MongoDB, Cassandra, DynamoDB) for efficient management and analysis. A decision-making module evaluates its relevance to vehicular energy optimization—if applicable, it is utilized for AI-driven adaptive energy management, otherwise, it is forwarded to the visualization module for further insights. The legend clarifies data flow and system interactions, demonstrating a seamless linkage between data processing, AI-driven decision-making, and cloud-based storage, ensuring an efficient and scalable EMS for smart mobility.
Figure 3 illustrates the proposed energy management model for AEVs, where real-time data on energy consumption, vehicle status, and operations is collected in the AEV Data Layer. This dataset51, detailed in Table 2, undergoes preprocessing, training, and validation to enhance AI-driven energy optimization.
This raw data undergoes preprocessing, including data conversion, aggregation, feature engineering, transformation, statistical analysis, and trend visualization, ensuring structured and optimized input for learning.
Figure 4 presents a comparative analysis of traffic parameters across different cities, including average speed, energy consumption, and traffic density. The first bar chart shows average vehicle speed, where cities like SolarisVille and MetropolisX exhibit higher speeds, possibly due to better road infrastructure or lower congestion. The second chart highlights average energy consumption, where MetropolisX records the highest consumption, suggesting higher traffic load or inefficiencies in energy management. The third chart visualizes traffic density, indicating that MetropolisX and AquaCity experience the highest congestion, whereas cities like Neuroburg and Ecopolis have significantly lower vehicle density. This graphical view plays a vital role in identifying traffic patterns, optimizing vehicular energy consumption, and designing AI-driven mobility solutions for smart cities.
Figure 5a, b,c provide a comprehensive analysis of how weather conditions impact traffic parameters across multiple cities, focusing on vehicle speed, energy consumption, and traffic density. Figure 5a demonstrates that clear weather allows for higher vehicle speeds, whereas snow, rain, and electromagnetic storms lead to reduced speeds due to safety concerns and lower road traction. Figure 5b reveals that energy consumption increases in adverse weather conditions, likely due to higher power demands for vehicle stabilization, climate control, and increased braking and acceleration patterns required for safe driving. Figure 5c shows that traffic density tends to rise in poor weather conditions, leading to congestion, reduced mobility, and extended travel times as vehicles slow down to navigate challenging road conditions. These insights are crucial for developing weather-responsive traffic management systems, optimizing energy-efficient vehicular operations, and improving smart city mobility strategies to ensure safe, adaptive, and sustainable urban transportation under varying environmental conditions.
Figure 6 illustrates diurnal variations in traffic density across different hours of the day, comparing weekday and weekend patterns. The blue line represents weekday traffic, while the orange line represents weekend traffic, showing subtle differences in density throughout the day. Key morning (7–9 AM) and evening (5–7 PM) peak hours are highlighted in green and purple, respectively, indicating periods of heightened congestion. During weekdays, traffic density remains relatively stable but experiences noticeable peaks during morning and evening rush hours due to commuting patterns. On weekends, traffic density follows a similar trend but is generally higher during mid-day hours, likely due to recreational and shopping activities. This visualization is crucial for traffic flow optimization, urban mobility planning, and energy-efficient route recommendations, helping smart city infrastructures manage congestion dynamically.
Figure 7 illustrates the relationship between vehicle speed and energy consumption across different vehicle types, including drones, flying cars, autonomous vehicles, and conventional cars. The scatter plot highlights that energy consumption generally increases with speed, but the rate varies based on vehicle type. Drones (red circles) exhibit the lowest energy consumption even at higher speeds, making them highly energy-efficient. Autonomous vehicles (teal squares) and conventional cars (purple plus signs) follow a similar trend but require significantly more energy as speed increases. Flying cars (green crosses) show the highest energy consumption, indicating their substantial power demands at higher speeds. This analysis is essential for designing energy-efficient transportation models, optimizing battery usage and route planning, and enhancing sustainable mobility solutions in futuristic smart cities.
The exploratory analysis presented in Figs. 4, 5, 6 and 7 directly influenced the selection of input features used in the learning model, ensuring that the algorithm was trained on attributes with the strongest observed impact on energy variation. The processed dataset is then split into training (70%) and testing (30%) sets, enabling the development and validation of machine learning (local client) models. The trained local client models are evaluated based on learning performance, and if the accuracy meets the required threshold, these local client models are transferred to the cloud computing infrastructure for real-time validation. The cloud imports trained local client models for prediction, ensuring adaptive learning and dynamic vehicular energy optimization. In the validation phase, if the predictions contribute to effective vehicular energy management, the results are implemented for vehicular energy optimization; otherwise, the output is discarded.
These local client models integrate cloud computing and AI-based learning to improve energy efficiency, scalability, and real-time decision-making in AEVs. Once the local models achieve optimal performance, they are transmitted to the cloud for federated aggregation, where a refined global model is generated. This global model is then redistributed to all AEVs, ensuring adaptive learning, enhanced vehicular energy optimization, and intelligent decision-making in future smart mobility systems. Table 3 outlines the pseudocode for this proposed local server-client model.
Figure 8 presents the proposed XFL framework for AEVs, integrating decentralized learning, interpretability, and real-time vehicular energy management. The process initiates at the Input Layer, where individual AEVs collect data on vehicular energy consumption, battery performance, and surrounding traffic conditions while ensuring local data privacy. The Pre-processing Layer applies multiple approaches to refine raw data for model training. At the Application Layer, each AEV independently trains a local energy management model, optimizing vehicular energy efficiency while preserving privacy. Instead of sharing raw data, only locally trained model parameters are transmitted to the cloud. The weight updates for each local model \(\:{M}_{i}^{t}\) are computed as follows:
Where \(\:{M}_{i}^{t}\) represents the model weights at iteration \(\:t\), \(\:\alpha\:\) is the adaptive learning rate, and \(\:\nabla\:J({M}_{i}^{t}-{D}_{i})\) denotes the gradient of the loss function concerning the local dataset \(\:{D}_{i}\). These locally optimized models are securely aggregated in the Global Model Aggregation Phase, where the global model \(\:{M}^{\text{*}}\) is updated based on model performance across all participating AEVs:
Where \(\:{M}^{\text{*}}\) denotes the final aggregated model, optimized based on the evaluation function \(\:Q({M}_{i},{V}_{i})\)measuring the predictive quality of each local model \(\:{M}_{i}\) on its validation dataset \(\:{V}_{i}\). If the global model fails to meet the predefined convergence threshold, AEV clients refine their models through further iterative training.
To enhance model transparency and trust, XAI techniques such as SHAP and LIME are integrated to interpret model decisions. SHAP assigns importance scores to input features using:
where \(\:{\varphi\:}_{k}\) is the SHAP value for feature \(\:k,F\) is the complete feature set, and \(\:h\left(S\right)\) represents the model’s prediction when using only a subset SSS. LIME, on the other hand, approximates the complex global model \(\:h\left(x\right)\) with a simple interpretable function \(\:g\left(x\right)\) by solving:
Where \(\:G\) is the space of interpretable models,\(\:J(h,g,{\pi\:}_{x}\text{})\) quantifies the approximation error, and \(\:\varLambda\:\left(g\right)\) regularizes model complexity to avoid overfitting.
Once the global model is optimized, it is deployed for real-time AEV energy optimization. Given a new input \(\:{S}^{{\prime\:}}\), the system predicts failure probability:
If \(\:{P}_{fault}\left(S{\prime\:}\right)>\delta\:\) (a predefined decision threshold), energy management measures are applied; otherwise, the prediction is discarded. This FL-integrated XAI-based framework ensures scalability, privacy-preserving computation, and adaptive energy optimization, making it an ideal solution for future smart mobility systems. Table 4 presents the pseudocode for the global client-server model, outlining the step-by-step process of model aggregation, explainability integration, and real-time deployment for efficient energy management in AEVs.
Simulation results
AEVs adoption across recent years creates essential problems in vehicular energy efficiency and model interpretation together with real-time adaptability. Energy management models based on traditional machine learning models lack scalability along with explainability and privacy preservation features thus proving ineffective in comprehensive smart mobility systems. The reliance on centralized data aggregation further increases security risks and computational overhead, highlighting the need for a decentralized, privacy-preserving, and interpretable approach.
This research develops an XFL model that uses FL for decentralized vehicular energy optimization combined with XAI methods for improved model transparency. The simulation is conducted in Google Colab using a real-world AEV telemetry dataset, where recorded battery performance, energy consumption, traffic density, and environmental conditions are used under controlled assumptions to ensure consistent and focused model training. The dataset is partitioned into 70% for training and 30% for testing, ensuring robust model validation. Each AEV operates as a local client, training an individual model while ensuring data privacy, and periodically transmitting only model updates to a global server for aggregation. The performance of the proposed model is assessed using key evaluation metrics, including Mean Squared Error (MSE), R-squared (R²), and Mean Absolute Error (MAE), which measure model accuracy and predictive reliability. The simulation results demonstrate the effectiveness of the proposed XFL-based approach, achieving:
Where\(\:{\:y}_{i}\) is the actual energy consumption, \(\:{\widehat{y}}_{i}\) is the predicted value, and \(\:n\) represents the number of samples.
Where \(\:\stackrel{-}{y}\) is the mean of the actual values. A value close to 1 indicates a high correlation between predicted and actual values.
Measuring the absolute difference between predicted and actual values, with lower values indicating better prediction accuracy.
Where \(\:Var\:(y-\widehat{y})\) is the variance of residuals (errors), and \(\:Var\:\left(y\right)\) is the variance of actual values. A higher EVS value demonstrates that the model effectively captures diverse aspects of vehicular energy management data which leads to better interpretability and improved performance for optimizing energy consumption in AEVs.
Table 5 demonstrates that various local server client models exhibit divergent performance levels in terms of accuracy and variance explanation for energy consumption prediction in AEVs. The MLP model achieves the lowest MSE (33.70) and MAE (4.07), along with the highest R2 (0.9473) and EVS (0.9479), indicating strong predictive accuracy and effective variance capture in vehicular energy management. Decision Tree (MSE = 56.71, R2 = 0.9113, EVS = 0.9113) performs moderately well. In contrast, Elastic Net (MSE = 141.53, EVS = 0.7787) and Orthogonal Matching Pursuit (MSE = 187.96, EVS = 0.7061) show significantly higher errors and weaker variance explanation. The obtained results establish a benchmark to measure the improvements achieved through FL in subsequent evaluations.
Table 6 presents the performance evaluation of different local server client models for traffic density prediction, showing significant variations in predictive accuracy. The MLP model achieves the lowest MSE (8.20e-05) and MAE (5.39e-03), along with a high R2 (0.9983) and EVS (0.9983), indicating strong predictive performance and effective variance explanation. Meanwhile, Decision Tree (MSE = 1.90e-03, R2 = 0.9604, EVS = 0.9604) demonstrates moderate accuracy, whereas Elastic Net (MSE = 4.79e-02, EVS = 1.57e-14) and Orthogonal Matching Pursuit (MSE = 4.79e-02, EVS = 8.21e-04) exhibit poor performance with significantly lower variance explanation. These results set a benchmark for evaluating FL’s impact on enhancing traffic density predictions.
Tables 5 and 6 collectively analyze energy consumption and traffic density prediction performance, highlighting their interdependence in vehicular energy management. Higher traffic density often leads to increased energy consumption, making accurate predictions crucial for optimizing energy efficiency and traffic flow in smart mobility systems.
After applying FL, the MLP model is selected as the optimal global model, achieving the highest accuracy and variance explanation in both energy consumption and traffic density prediction. The MLP was chosen for its proven performance on tabular vehicular data, its efficient training in FL settings, and its suitability for capturing non-linear feature interactions critical for energy management, while more complex models such as CNNs and transformers were less optimal given the data’s structure and real-time requirements. FL enhances model generalization by aggregating decentralized updates, ensuring privacy-preserving, adaptive, and scalable vehicular energy management. The results confirm that MLP outperforms all models, making it the most reliable choice for optimizing real-time traffic flow and energy efficiency in smart mobility systems.
Figure 9 illustrates the LIME-based explanation for the global model’s decision-making process after applying XAI techniques to enhance interpretability in vehicular energy management. The predicted value of 0.56 is influenced by key factors, including traffic density (0.83), hour of the day (0.81), vehicle type (0.22), and speed (0.97). The explanation highlights that higher traffic density and late-hour driving contribute positively to the prediction, whereas certain vehicle types and lower speeds have a minimal or negative impact. This ensures a transparent and explainable model, helping stakeholders understand how critical features shape the global energy optimization strategy for AEVs within a smart city infrastructure.
The analysis in Table 7 shows that the proposed MLP-based global model for AEVs delivers optimal results through its R2 evaluation, in comparison with conventional methods used in prior studies. The proposed MLP model achieves outstanding results by demonstrating the highest R2 values of 94.73% for energy consumption and 99.83% for traffic density prediction making it the best approach for federated energy management of AEVs, as compared to previous approaches52,53,54,55,56.
Conclusion
The growing adoption of smart cities for AEVs creates substantial energy management problems which stem from improper energy use along with suboptimal infrastructure outcomes and varied traffic patterns. The traditional machine learning models together with cloud optimization methods face problems regarding privacy protection and they require scalability and real-time ability improvements. This research proposed XFL XFL-based energy management model for AEVs to address privacy issues through decentralized learning and real-time analysis while providing interpretability using LIME explanations. The proposed MLP-based global model reaches better predictive performance due to its R² values of 94.73% in energy consumption prediction and 99.83% in traffic density prediction which surpasses traditional models52,53,54,55,56. The simulation confirmed that this model decreases computational overhead while at the same time, increasing transparency in decision-making and helps distribute energy smartly for future electric automobile models.
Future work will explore integrating adaptive communication techniques (e.g., asynchronous updates or bandwidth-aware synchronization) to further reduce overhead, along with secure aggregation and adversarial robustness methods to strengthen the protection of model updates in FL-based vehicular networks.
Data availability
The original contributions presented in the study are included in the article; further inquiries can be directed to the corresponding authors.
References
Aljohani, T. M., Assolami, Y. O., Alrumayh, O., Mohamed, M. A. & Almutairi, A. Sustainable energy systems in a post-pandemic world: A taxonomy-based analysis of global energy-related markets responses and strategies following COVID-19. Sustainability, 17(5), 2307. (2025).
Siddiqui, S. Y., Khan, M. A., Abbas, S. & Khan, F. Smart occupancy detection for road traffic parking using deep extreme learning machine. J. King Saud Univ.-Comput. Inform. Sci. 34 (3), 727–733 (2022).
Atta, A., Abbas, S., Khan, M. A., Ahmed, G. & Farooq, U. An adaptive approach: Amart traffic congestion control system. J. King Saud Univ.-Comput. Inform. Sci. 32 (9), 1012–1019 (2020).
Etukudoh, E. A. et al. A review of sustainable transportation solutions: Innovations, challenges, and future directions. World J. Adv. Res. Rev. 21 (1), 1440–1452 (2024).
Sabet, S. & Farooq, B. Exploring the combined effects of major fuel technologies, eco-routing, and eco-driving for sustainable traffic decarbonization in downtown Toronto. Transp. Res. Part A Policy Pract. 192, 104385. (2025).
Butler, L., Yigitcanlar, T. & Paz, A. Smart urban mobility innovations: A comprehensive review and evaluation. Ieee Access. 8, 196034–196049 (2020).
Yang, C., Zha, M., Wang, W., Liu, K. & Xiang, C. Efficient energy management strategy for hybrid electric vehicles/plug-in hybrid electric vehicles: Review and recent advances under intelligent transportation system. IET Intel. Transport Syst. 14 (7), 702–711 (2020).
Alanazi, F. Electric vehicles: Benefits, challenges, and potential solutions for widespread adaptation. Appl. Sci. 13(10), 6016. (2023).
Singh, K. V., Bansal, H. O. & Singh, D. A comprehensive review on hybrid electric vehicles: Architectures and components. J. Mod. Transp. 27 (2), 77–107 (2019).
da Silva, S. F., Eckert, J. J., Silva, F. L., Silva, L. C. & Dedini, F. G. Multi-objective optimization design and control of plug-in hybrid electric vehicle powertrain for minimization of energy consumption, exhaust emissions and battery degradation. Energy Convers. Manag. 234, 113909. (2021).
Mustafi, N. N. An Overview of Hybrid Electric Vehicle Technology 73–102 (Engines and Fuels for Future Transport, 2022).
Alyakhni, A., Boulon, L., Vinassa, J. M. & Briat, O. A comprehensive review on energy management strategies for electric vehicles considering degradation using aging models. IEEE Access. 9, 143922–143940 (2021).
Munsi, M. S. & Chaoui, H. Energy Management Systems for Electric Vehicles: A Comprehensive Review of Technologies and Trends (IEEE Access, 2024).
Urooj, A. & Nasir, A. Review of intelligent energy management techniques for hybrid electric vehicles. J. Energy Storage. 92, 112132 (2024).
Al-Thani, H., Koç, M., Isaifan, R. J. & Bicer, Y. A review of the integrated renewable energy systems for sustainable urban mobility. Sustainability 14(17), 10517. (2022).
Chen, Z., Lu, J., Liu, B., Zhou, N. & Li, S. Optimal energy management of plug-in hybrid electric vehicles concerning the entire lifespan of lithium-ion batteries. Energies 13(10), 2543. (2020).
Cavus, M., Dissanayake, D. & Bell, M. Next generation of electric vehicles: AI-Driven approaches for predictive maintenance and battery management. Energies 18(5), 1041. (2025).
Ata, A., Khan, M. A., Abbas, S., Khan, M. S. & Ahmad, G. Adaptive IoT empowered smart road traffic congestion control system using supervised machine learning algorithm. Comput. J. 64 (11), 1672–1679 (2021).
Moussa, H. G., Akhavain, A., Hosseini, S. M. & McCormick, B. Distributed learning and inference systems: A networking perspective. arXiv:2501.05323. (2025).
Abdelmoniem, A. M., Jaber, M., Anwar, A., Zhang, Y. & Gao, M. Towards a decentralized collaborative framework for scalable edge AI. Future Internet 16(11), 421. (2024).
Yao, A., Pal, S., Dong, C., Li, X. & Liu, X. March. A framework for user biometric privacy protection in UAV delivery systems with edge computing. In 2024 IEEE International Conference on Pervasive Computing and Communications Workshops and other Affiliated Events (PerCom Workshops) (pp. 631–636). IEEE. (2024).
Yao, A. et al. A privacy-preserving location data collection framework for intelligent systems in edge computing. Ad Hoc Netw. 161, 103532. (2024).
Dong, C. et al. May. A blockchain-aided self-sovereign identity framework for edge-based UAV delivery system. In 2021 IEEE/ACM 21st International Symposium on Cluster, Cloud and Internet Computing (CCGrid) (pp. 622–624). IEEE. (2021).
Yao, A. et al. A novel security framework for edge computing based uav delivery system. In 2021 IEEE 20th International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom) (pp. 1031–1038). IEEE. (2021).
Yao, A. et al. FedShufde: A privacy preserving framework of federated learning for edge-based smart UAV delivery system. Future Gener. Comput. Syst. 166, 107706. (2025).
Dong, C., Pal, S., Chen, S., Jiang, F. & Liu, X. A Privacy-Aware Task Distribution Architecture for UAV Communications System Using Blockchain (IEEE Internet of Things Journal, 2025).
Fang, K. et al. April. MoCFL: Mobile cluster federated learning framework for highly dynamic network. In Proceedings of the ACM on Web Conference 2025 (pp. 5065–5074). (2025).
Banabilah, S., Aloqaily, M., Alsayed, E., Malik, N. & Jararweh, Y. Federated learning review: Fundamentals, enabling technologies, and future applications. Inf. Process. Manag. 59 (6), 103061 (2022).
Chen, Z., Xiong, R. & Cao, J. Particle swarm optimization-based optimal power management of plug-in hybrid electric vehicles considering uncertain driving conditions. Energy 96, 197–208 (2016).
Lu, J., Chen, Z., Yang, Y. & Lv, M. Online Estimation of state of power for lithium-ion batteries in electric vehicles using genetic algorithm. Ieee Access. 6, 20868–20880 (2018).
Wang, R. Buildings energy data analytics with multi-task and federated learning (Doctoral dissertation, University of British Columbia). (2025).
Yu, R. & Li, P. Toward resource-efficient federated learning in mobile edge computing. IEEE Netw. 35 (1), 148–155 (2021).
Parisineni, S. R. A. & Pal, M. Enhancing trust and interpretability of complex machine learning models using local interpretable model agnostic Shap explanations. Int. J. Data Sci. Analyt. 18 (4), 457–466 (2024).
Hassija, V. et al. Interpreting black-box models: A review on explainable artificial intelligence. Cogn. Comput. 16 (1), 45–74 (2024).
Saleem, M. et al. Secure and Transparent Mobility in Smart Cities: Revolutionizing AVNs To Predict Traffic Congestion Using MapReduce (Private Blockchain and XAI. IEEE Access, 2024).
Zhang, C. et al. Fed4UL: A cloud–edge–end collaborative federated learning framework for addressing the non-IID data issue in UAV logistics. Drones, 8(7), p.312. (2024).
Khan, M. A. et al. Smart Buildings: Federated learning-driven Secure, Transparent and Smart Energy Management System Using XAI13, pp. 2066–2081 (Energy Reports, 2025).
Kong, Y., Xu, N., Liu, Q., Sui, Y. & Jia, Y. Variable horizon-based predictive energy management strategy for plug-in hybrid electric vehicles and determination of a suitable predictive horizon. Energy, 294, 130809. (2024).
Li, L. et al. Driving-behavior-aware stochastic model predictive control for plug-in hybrid electric buses. Appl. Energy. 162, 868–879 (2016).
Wang, R., Shi, X., Su, Y. & Song, T. A predictive energy management strategy for plug-in hybrid electric vehicles using real-time traffic based reference SOC planning. Proc. Inst. Mech. Eng. Part D J. Automob. Eng. 09544070241239996. (2024).
Peng, J., He, H. & Xiong, R. Rule based energy management strategy for a series–parallel plug-in hybrid electric bus optimized by dynamic programming. Appl. Energy. 185, 1633–1643 (2017).
Li, Y. et al. Multi-vehicle interaction-aware energy management for connected hybrid electric vehicles via deep reinforcement learning. In 2024 IEEE 14th International Conference on CYBER Technology in Automation, Control, and Intelligent Systems (CYBER) (pp. 434–439). IEEE. (2024).
Badu-Marfo, G., Farooq, B. & Patterson, Z. A perspective on the challenges and opportunities for privacy-aware big transportation data. J. Big Data Analyt. Transp. 1, 1–23 (2019).
Ramoliya, F. et al. Deep learning-based intrusion detection approach for autonomous electric vehicles. In 2024 IEEE International Conference on Communications Workshops (ICC Workshops) (pp. 1828–1833). IEEE. (2024).
Peng, S. et al. Spatial-temporal dynamic forecasting of EVs charging load based on DCC-2D. Chin. J. Electr. Eng. 8 (1), 53–62 (2022).
Park, J. H. & Joe, I. W. Federated learning-based prediction of energy consumption from blockchain-based black box data for electric vehicles. Appl. Sci. 14(13), 5494. (2024).
Sullivan, B., Svendsen, S. & Khan, J. A. Federated learning for energy-efficient cooperative perception in connected and autonomous vehicles. In IEEE INFOCOM 2024-IEEE Conference on Computer Communications Workshops (INFOCOM WKSHPS) (pp. 1–2). IEEE. (2024).
Njoku, J. N., Nwakanma, C. I. & Kim, D. S. Explainable Data-Driven Digital Twins for Predicting Battery States in Electric Vehicles 12, 83480–83501 (IEEE Access, 2024).
Oyucu, S., Ersöz, B., Sağıroğlu, Ş., Aksöz, A. & Biçer, E. Optimizing Lithium-ion battery performance: Integrating machine learning and explainable AI for enhanced energy management. Sustainability 16(11), 4755. (2024).
He, J. Enhancing energy management in new energy vehicles and energy storage systems through advanced data analysis and machine learning. Adv. Econ. Manag. Polit. Sci. 108, 104–110 (2024).
https://www.kaggle.com/code/a3amat02/urban-traffic-eda-and-traffic-density-regression
Ullah, I., Liu, K., Yamamoto, T., Mamlook, A., Jamal, A. & R. E. and A comparative performance of machine learning algorithm to predict electric vehicles energy consumption: A path towards sustainability. Energy Environ. 33 (8), 1583–1612 (2022).
Zhu, J. et al. Electric vehicle charging load forecasting: A comparative study of deep learning approaches. Energies 12(14), 2692. (2019).
Zhao, J. et al. Battery state of health estimation under fast charging via deep transfer learning. iScience. (2025).
El-Latif, A., Eman, I. & El-dosuky, M. Explainable Energy Consumption and Speed Prediction in Sustainable Cities Using Deep Learning 1–17 (Neural Computing and Applications, 2025).
Alshammari, A. & Chabaan, R. C. Metaheruistic optimization based ensemble machine learning model for designing Detection Coil with prediction of electric vehicle charging time. Sustainability 15(8), 6684 (2023).
Author information
Authors and Affiliations
Contributions
Khalid Ishaq Abdullah Almaazmi, Saif Jasim Almheiri, Asghar Ali Shah and Sagheer Abbas have collected data from different resources and contributed to writing—original draft preparation. Khalid Ishaq Abdullah Almaazmi and Muhammad Adnan Khan performed formal analysis and Simulation, Saif Jasim Almheiri, Asghar Ali Shah, Munir Ahmad and Muhammad Adnan Khan; writing—review and editing, Asghar Ali Shah, and Muhammad Adnan Khan; performed supervision, Khalid Ishaq Abdullah Almaazmi, Sagheer Abbas, and Munir Ahmad.; drafted pictures and tables, Muhammad Adnan Khan, Aghar Ali Shah and Munir Ahmad; performed revisions and improve the quality of the draft. All authors have read and agreed to the published version of the manuscript.
Corresponding authors
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
Almaazmi, K.I.A., Almheiri, S.J., Khan, M.A. et al. Enhancing smart city sustainability with explainable federated learning for vehicular energy control. Sci Rep 15, 23888 (2025). https://doi.org/10.1038/s41598-025-07844-3
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-025-07844-3