This project aims to predict the range of an Electric Vehicle (EV) based on real-time parameters. By analyzing factors such as speed, battery status, temperature, and driving patterns, we provide a more accurate range estimate than simple percentage-based calculations.
The models are trained on the following synthetic features:
- Speed (km/h): The current speed of the vehicle.
- State of Charge (SOC) %: The current battery level.
- Ambient Temperature (°C): The outside temperature.
- Motor RPM: Rotations per minute of the motor.
- Motor Temperature (°C): Temperature of the motor.
- Battery Temperature (°C): Temperature of the battery pack (Critical for efficiency).
- Acceleration (m/s²): Driving aggressiveness.
Real time Range prediction/
├── data/ # Generated data and plots
├── models/ # Saved models (XGBoost, MLP, Scaler)
├── src/
│ ├── data_simulator.py # Generates synthetic data
│ ├── eda.py # Exploratory Data Analysis
│ ├── train_model.py # Trains XGBoost model
│ ├── train_advanced_model.py # Trains MLP (Neural Network)
│ └── compare_models.py # Compares both models
├── requirements.txt # Dependencies
└── README.md # Project documentation
- Clone the repository.
- Install the required dependencies:
pip install -r requirements.txt
If you don't have the dataset, generate synthetic data:
python src/data_simulator.pyThis creates data/ev_range_data.csv.
Visualize the data correlations and distributions:
python src/eda.pyTrain the XGBoost regressor:
python src/train_model.pyTrain the Deep Neural Network:
python src/train_advanced_model.pyCompare the performance of XGBoost and MLP:
python src/compare_models.py| Model | MSE | MAE | R2 Score |
|---|---|---|---|
| XGBoost | 118.58 | 8.59 | 0.9828 |
| MLP (Neural Network) | 106.03 | 8.18 | 0.9846 |
The MLP model slightly outperforms the XGBoost model, achieving a higher R2 score and lower error rates.
This project successfully demonstrates that machine learning can accurately predict EV range using real-time vehicle data.
- Key Findings:
- Speed and SOC are the most dominant factors.
- Battery Temperature plays a significant role in efficiency; extreme temperatures reduce range.
- The Neural Network (MLP) captures complex non-linear relationships slightly better than XGBoost, though both models perform exceptionally well (R2 > 0.98).
- Future Work:
- Integrate real-world driving data.
- Implement a time-series model (LSTM) if sequential data becomes available.
- Deploy the model as a real-time API.






