Skip to content

ash3spho3nix/Virtual-HIL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”‹ V_HIL_V2 β€” Virtual Hardware-in-the-Loop Battery Test Platform

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.


πŸš€ Features

  • πŸ”Œ 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 GUI
    • Flask dashboard with live charts (Voltage, Temp, SOC) and control buttons
  • 🐳 Docker + Docker Compose β€” Easy setup and deployment

🧰 Project Structure

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

πŸ§ͺ Running the Project

Option 1: Local (Python 3.10+)

pip install -r requirements.txt
python main.py

Access dashboard at: http://localhost:5001

Option 2: Docker

docker-compose up --build

🎯 Use Cases

  • BMS development and debugging
  • Virtual prototyping of battery systems
  • Academic demos and simulation-based testing
  • Training/testing without expensive hardware

πŸ“Œ TODO / Extensions

  • CAN DBC file parser integration
  • Model predictive BMS controller
  • External DB logging (InfluxDB/Grafana)
  • Load cycling and battery aging simulation

πŸ“„ License

MIT License


πŸ‘¨β€πŸ”¬ Author

Created by [Vishal] β€” Battery Simulation Expert & System Modeling Enthusiast.

About

Virtual HIL testing framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published