A modular Python-based virtual HiL (Hardware-in-the-Loop) simulation environment for testing Battery Management Systems (BMS) without physical hardware. Includes real-time CAN emulation, PyQt5 GUI, Flask web dashboard, and Docker support.
- π CAN Protocol Emulation β Simulates real CAN traffic and BMS communication
- π Battery Pack Simulator β Cell voltage, SOC, and temperature modeling
- π§ BMS Logic Module β Fault detection, balancing, thermal control (customizable)
- π Dual Visualization
PyQt5
for native desktop GUIFlask
dashboard with live charts (Voltage, Temp, SOC) and control buttons
- π³ Docker + Docker Compose β Easy setup and deployment
V_HIL_V2/
βββ bms_module.py # BMS logic and safety rules
βββ battery_simulator.py # Battery state simulator
βββ can_emulator.py # CAN message emulation
βββ can_messages.py # Message ID definitions and parsing
βββ data_logger.py # Logging system (optional)
βββ pyqt_visualizer.py # PyQt GUI for real-time monitoring
βββ flask_dashboard.py # Flask-based dashboard with Chart.js
βββ main.py # Simulation controller and orchestrator
βββ Dockerfile # Container configuration
βββ docker-compose.yml # Compose setup
βββ README.md # You're here
pip install -r requirements.txt
python main.py
Access dashboard at: http://localhost:5001
docker-compose up --build
- BMS development and debugging
- Virtual prototyping of battery systems
- Academic demos and simulation-based testing
- Training/testing without expensive hardware
- CAN DBC file parser integration
- Model predictive BMS controller
- External DB logging (InfluxDB/Grafana)
- Load cycling and battery aging simulation
MIT License
Created by [Vishal] β Battery Simulation Expert & System Modeling Enthusiast.