This project is part of the AI Battery Management System (AI BMS) initiative. The goal is to develop a real-time mode selection interface that allows users to optimize battery performance, efficiency, and longevity.
Users can choose between several operational modes, including:
- โก Performance Mode
- ๐ฑ Eco Mode
- โ๏ธ Balanced Mode
- ๐ ๏ธ Custom Mode
Modes dynamically adjust parameters such as cooling, fan speed, and temperature settings.
Below is a prototype of the AI Battery Management System (AI BMS) optimization interface:
-
Mode Selection:
- Users can choose between:
- โก Performance Mode: Maximize performance at the potential expense of battery life.
- ๐ฑ Eco Mode: Optimize energy efficiency and extend battery life.
- โ๏ธ Balanced Mode: A middle ground between performance and efficiency.
- ๐ ๏ธ Custom Mode: Configure user-defined parameters.
- Users can choose between:
-
Custom Mode Settings:
- Options to adjust:
- Cooling Mode (Normal, Silent, Aggressive)
- Fan Speed via slider
- Flow Rate via slider
- Temperature Threshold via slider
- Enable/Disable advanced settings:
- โ Overheat Protection
- โ Fast Charging
- Options to adjust:
-
Impact Visualizations:
- Performance Impact: Bar chart showing mode-specific performance effects.
- Efficiency Impact: Highlights energy efficiency in each mode.
- Longevity Impact: Demonstrates how modes affect battery lifespan.
-
Interactive Controls:
- Apply, Save, Cancel buttons for user actions.
- Real-time visualization of the selected mode's impact.
- ๐ Mode Switching: Users can select operational modes that dynamically adjust system parameters like fan speed and cooling temperature.
- ๐ ๏ธ Custom Mode: Users can personalize parameters such as fan speed and temperature thresholds, and see real-time effects on battery performance.
- ๐ Dynamic Updates: Real-time graphs display the impact of mode changes on performance, efficiency, and battery longevity.
- ๐ค Auto Adjustments: AI models automatically switch modes based on operating conditions.
- ๐ Applications: Used in electric vehicles and energy storage systems to optimize battery performance in real time.
- Programming Language: ๐ Python
- GUI Framework: PyQt5 / Tkinter
- Real-time Visualization: Matplotlib ๐
- AI Models: SOC estimation and temperature prediction using LSTM
- Data Handling: Pandas, NumPy
In this project, we replaced the static threshold-based mode selection logic with a Machine Learning (ML) model. The ML model dynamically selects the optimal mode (Performance, Eco, or Balanced) based on real-time battery conditions, including SOC (State of Charge), temperature, and current.
The mode selection model is trained on a comprehensive dataset with the following key features:
๐ Feature | ๐ Description |
---|---|
SOC |
State of Charge (%): Indicates the battery's charge level. |
Temperature |
Predicted Battery Temperature (ยฐC): Key factor for thermal management. |
Current |
Current Draw (A): Positive for discharging, negative for charging. |
FanSpeed |
Fan Speed (RPM): Reflects the cooling system's fan intensity. |
PumpDutyCycle |
Pump Duty Cycle (%): Percentage of time the pump is active for cooling. |
CoolingIntensity |
Cooling Intensity: Defines the cooling level (Low or High ). |
Mode |
Target Mode: The operational mode (Performance , Eco , Balanced ). |
SOC
&Temperature
: Drive the selection of the most efficient or performance-oriented mode.Current
: Helps manage discharging/charging scenarios and mode transitions.FanSpeed
&PumpDutyCycle
: Regulate the cooling system to maintain thermal efficiency.CoolingIntensity
: Adjusts dynamically to match mode-specific requirements.Mode
: Acts as the target variable for supervised learning.
This dataset enables the mode selection model to make real-time, data-driven decisions for optimizing battery performance, thermal regulation, and longevity.
Hereโs a snapshot of the data used to train the mode selection model:
- SOC (%): State of Charge of the battery (in percentage), indicating the battery's available capacity.
- Temperature (ยฐC): Battery temperature in Celsius, critical for thermal management.
- Current (A):
- Positive values represent discharging (battery providing power).
- Negative values represent charging (battery receiving power).
- Fan Speed (RPM): Cooling system's fan speed in revolutions per minute, reflecting thermal regulation.
- Pump Duty Cycle (%): The percentage of time the cooling pump is active, significantly influencing heat dissipation.
- Cooling Intensity: Indicates the required cooling level:
- High: Used in
Performance Mode
for aggressive cooling. - Medium: Balanced cooling for moderate conditions.
- Low: Energy-efficient cooling, typical for
Eco Mode
.
- High: Used in
- Mode:
- Performance: Optimized for maximum power output and cooling.
- Eco: Focused on energy efficiency and extending battery life.
- Balanced: A trade-off between performance and energy efficiency.
- Input Features: The model takes SOC, temperature, and current as input.
- Prediction: Based on historical training data, the model predicts the optimal mode.
- Dynamic Adjustments:
- Cooling intensity and current are adjusted dynamically based on the selected mode.
- Warnings are generated for exceeding critical thresholds.
- Dynamic Decision-Making: The model adapts to real-time battery conditions for optimal performance.
- Proactive Adjustments: Predicts potential issues and makes adjustments before they occur.
- Improved Efficiency: Balances battery performance, efficiency, and longevity better than static thresholds.
This project utilizes Machine Learning (ML) for intelligent mode selection, leveraging a cutting-edge Gradient Boosting Model (GBM) for dynamic decision-making. The model predicts the optimal operational modeโPerformance, Eco, or Balancedโbased on real-time battery conditions.
The dataset used for training includes the following features:
- SOC (State of Charge): Battery's charge percentage.
- Temperature (ยฐC): Real-time battery temperature.
- Current (A): Positive for discharging, negative for charging.
- Fan Speed (RPM): Cooling system's operational speed.
- Mode (Target): Labeled modes (
Performance
,Eco
,Balanced
) optimized for specific conditions.
- Objective:
- Train a supervised classification model to dynamically select the optimal mode based on real-time battery data.
- Algorithm:
- XGBoost (Extreme Gradient Boosting) was chosen for its speed, accuracy, and ability to handle complex, non-linear data relationships.
- Training Process:
- A labeled dataset with historical battery conditions was used to train the model.
- The model's hyperparameters were tuned using grid search to achieve optimal performance.
- Outcome:
- The XGBoost model achieved high accuracy in predicting the best mode for various battery conditions.
- Feature importance analysis revealed that Temperature and SOC are the most influential factors.
- The trained XGBoost model is integrated into the system to process real-time battery data and predict the best mode on the fly.
- Based on the selected mode:
- Cooling intensity and current limits are dynamically adjusted.
- Warnings are triggered when critical thresholds (e.g., temperature limits) are exceeded.
- Dynamic Adjustments: Modes adapt intelligently to match real-time battery conditions.
- Optimized Performance: Balances high power output, energy efficiency, and battery health.
- High Predictive Accuracy: XGBoost provides robust and reliable predictions even with complex datasets.
By leveraging a state-of-the-art Gradient Boosting Model, this project achieves smarter and more adaptive battery management, empowering users with seamless and efficient operation.
The confusion matrix below illustrates the performance of the mode selection model, showing how accurately it predicts each mode based on the dataset:
- Highlights the model's accuracy for each mode (Performance, Eco, Balanced).
- Identifies areas where the model performs well or needs improvement.
Below is a bar chart showing the importance of each feature used in the mode selection model:
The scatter plot below illustrates how the model predicts modes based on SOC and Temperature:
- Temperature: Most critical factor for mode selection, influencing cooling and performance decisions.
- SOC (State of Charge): Second most important, reflecting the battery's charge level and its effect on mode choice.
- Current: Moderately significant, affecting charging and discharging scenarios.
- Fan Speed: Least significant, possibly an indirect predictor.
Insight: Focus on improving data quality for Temperature and SOC, and consider simplifying the model by removing less significant features like Fan Speed.
- Regions:
- Pink: Performance Mode.
- Green: Eco Mode.
- Blue: Balanced Mode.
- Observations:
- Clear separation between regions indicates effective classification.
- Slight overlap near boundaries may lead to edge case misclassifications.
Insight: Optimize the model (e.g., hyperparameter tuning) to improve boundary handling and test with real-world data to ensure robustness.
These analyses confirm the importance of the features and demonstrate the model's classification accuracy, reinforcing the ML-driven approach for mode selection.
Below is a snapshot of real-time output based on AI-driven mode selection:
AI_BMS_Optimization/
โ
โโโ data/ # Data storage
โ โโโ raw/ # Raw input data
โ โโโ processed/ # Preprocessed data ready for use
โ โโโ sample_input.csv # Example data for testing
โ
โโโ src/ # Source code
โ โโโ gui.py # GUI implementation (PyQt/Tkinter)
โ โโโ real_time_mode_switching.py # Core script for mode switching
โ โโโ models.py # Includes SOC and temperature prediction models
โ โโโ utils.py # Helper functions (e.g., data preprocessing)
โ
โโโ docs/ # Documentation
โ โโโ README.md # Description, usage, and instructions
โ
โโโ tests/ # Test scripts
โ โโโ test_models.py # Unit tests for SOC and temperature models
โ
โโโ requirements.txt # Dependencies
โโโ .gitignore # Ignore unnecessary files
Mode | Description |
---|---|
โก Performance | Prioritizes maximum battery performance by increasing cooling and fan speed, potentially reducing battery lifespan. |
๐ฑ Eco | Focuses on battery longevity and energy efficiency by lowering cooling intensity and regulating power usage. |
โ๏ธ Balanced | Strikes a balance between performance and efficiency with moderate cooling and power settings. |
๐ ๏ธ Custom | Empowers users to define parameters like fan speed and cooling thresholds, observing real-time effects. |
-
Real-Time Data Collection:
- The system continuously monitors and collects real-time battery parameters, including:
- ๐ก๏ธ Temperature
- โก Voltage
- ๐ SOC (State of Charge)
- ๐ Current
- ๐ฌ๏ธ Fan Speed
- ๐ง Pump Duty Cycle
- The system continuously monitors and collects real-time battery parameters, including:
-
AI-Powered Predictions:
- AI models predict key battery metrics such as:
- SOC (State of Charge)
- Temperature trends
- Predictions help dynamically optimize battery performance and longevity.
- AI models predict key battery metrics such as:
-
Interactive Graphical Interface:
- The GUI, built with PyQt5/Tkinter, allows users to:
- Seamlessly switch between modes.
- Visualize real-time impacts on battery performance via dynamic Matplotlib plots.
- The GUI, built with PyQt5/Tkinter, allows users to:
-
AI-Driven Adjustments:
- The system automatically adjusts cooling intensity, fan speed, and other parameters based on:
- The selected mode (Performance, Eco, Balanced, or Custom).
- Predicted SOC and temperature from AI models.
- The system automatically adjusts cooling intensity, fan speed, and other parameters based on:
-
Custom Mode:
- Users can manually fine-tune settings like cooling thresholds and fan speeds.
- The system provides real-time feedback to help users evaluate their custom configurations.
To set up the project locally, follow these steps:
- Clone the repository:
git clone https://github.com/yasirusama61/AI_BMS_Optimization.git
cd AI_BMS_Optimization
- Install the dependencies
pip install -r requirements.txt
- Run the GUI: To start the GUI for the mode selection interface, run:
python src/gui.py
- Battery Operation Data: Voltage, Current, SOC, Temperature, Pump Duty Cycle, and Fan Speed.
- Environmental Data: Ambient temperature data (Tx) to dynamically adjust system performance.
- Historical Performance Data: Used to train the AI models on performance metrics under different conditions.
The AI Battery Management System (AI BMS) provides real-time predictions and dynamically adjusts battery parameters based on the selected mode. Below is an example of the output generated during a simulation:
- Mode: Balanced
- Predicted Temperature (ยฐC): Real-time temperature predictions using the AI model.
- Cooling: Cooling intensity automatically adjusted (
Low
orHigh
). - Adjusted Current (A): Battery current modified dynamically.
- Warnings: Alerts for exceeding critical thresholds.
-
Real-Time Adjustments:
- The system adjusts cooling intensity and current dynamically based on real-time predictions.
High Cooling
is activated when the predicted temperature exceeds the mode's threshold.
-
Warnings:
- Alerts (
โ ๏ธ
) indicate when critical thresholds (e.g., temperature limits) are exceeded.
- Alerts (
-
Insight into Mode Functionality:
- The
Balanced Mode
prioritizes stability with controlled cooling and current.
- The
- The table demonstrates the AI system's capability to adapt to dynamic battery conditions in real time.
- Warnings help highlight potential issues that require attention, such as exceeding the temperature threshold.
We welcome contributions! Please feel free to fork the repository, submit pull requests, or report issues.