Discrete python implementation of the electrical circuit battery model inspired by Chen et al. 2006.
- Python
- NumPy¹
- SciPy¹
- Matplotlib¹²
¹ For model extraction ² For plotting example results
The simulator is written in plain Python and can easily be used with PyPy for faster execution.
Clone repository
git clone https://github.com/christiansiegel/electrical-circuit-battery-model.git
cd electrical-circuit-battery-model
Clone repository
git clone --recursive https://github.com/christiansiegel/electrical-circuit-battery-model.git
cd electrical-circuit-battery-model
Unzip measurement data
cd measurements
unzip '*.zip'
Smooth measurement data
python3 filter.py
The model can be extracted from measurement data with extract.py. The resulting battery model class can be pasted in batteries.py (already done).
The discrete simulator is implemented in simulator.py. The battery models are included from batteries.py. The different discharge loads are found in loads.py.
For specific examples on how to use the simulator see examples.
You can also use the simulator in a Jupyter notebook. For an example notebook see jupyter-examples.ipynb.
The measurement data smoothed with filter.py can be loaded using the CSV helper class in csvhelper.py. Functions to calculate the used energy or calculate errors are found in measurement.py.
For guidance see 5-measurement-compare.py in particular.