A comprehensive ODE-based simulation framework for analyzing and optimizing lithium-ion battery charging policies.
Simulates the dynamic behavior of lithium-ion batteries during charging, accounting for:
- Thermal dynamics (Joule heating, environmental cooling)
- State of charge dynamics (charge accumulation, open circuit voltage)
- Transient voltage response (RC circuit polarization model)
- SEI layer growth (temperature and current-dependent degradation)
pip install -r requirements.txtSingle-trajectory interaction simulations can be found at Battery Simulation Website.
To produce figures and comparison results, run the follow scripts in this order to store generated figures in log/ directory.
# Run parameter sweep (tests multiple current/voltage combinations)
python sweep_policies.py
# Generate comparison plot with grouped bars
python compare_policies.pyCore Simulation:
main.py- Main simulation runnerconfig.py- Centralized configurationcharging_policy.py- Charging policy implementationsupdate_state.py- ODE system and state evolutionutils.py- Utility functions
Analysis & Visualization:
sweep_policies.py- Parameter sweep frameworkcompare_policies.py- Policy comparison with grouped bar charts
Output:
log/- Simulation results (CSV logs, metrics, plots)requirements.txt- Python dependencies
- CC (Constant Current): Maintains constant current
- CV (Constant Voltage): Maintains constant voltage
- CCCV (CC-CV Two-stage): Constant current followed by constant voltage
- CCCVPulse (Three-stage): CC → CV → Pulse charging
Each simulation generates:
- Charging Time (hours): Total time to reach 100% SoC
- Peak Temperature (K): Maximum temperature during charge
- SEI Growth: Final SEI layer thickness (degradation indicator)
The comparison plot shows:
- Grouped bars by policy type (CC, CV, CCCV, CCCVPulse)
- Different bar heights representing different parameter values
- Color shading to distinguish parameter intensity
- Parameter labels below each bar (current in Amps or voltage in Volts)
- Four panels:
- Charging time comparison
- Peak temperature (thermal stress)
- Voltage and current vs State of Charge
- SEI growth (degradation)
Uses Runge-Kutta 4th Order (RK4) integration for solving coupled ODEs with high accuracy and stability.
