HomeBatterySim is a simulation toolkit for analyzing the financial and operational benefits of installing a home battery system. It uses real consumption and tariff data (e.g., from Octopus Energy) to estimate potential savings and earnings from battery storage, considering variable import/export rates and battery constraints.
- Download and process electricity consumption and tariff data from Octopus Energy APIs
- Merge and clean data for simulation
- Simulate battery operation (charge/discharge) based on real price signals
- Estimate annual savings/earnings from battery usage
- Export results for further analysis
get-data.ipynb: Jupyter notebook to download electricity consumption and tariff data from Octopus Energy, convert JSONs to CSVs, and merge them for simulation.bat-sim.ipynb: Jupyter notebook to simulate battery operation using merged data and calculate savings/earnings.output.csv: Merged data file with consumption, buy rate, and sell rate for each interval.simulation_results.csv: Output of the simulation, showing battery state and financials per interval.historic_data.csv,export.csv,tariffs.csv, etc.: Raw and processed data files.apikey.txt,e_mpan.txt,e_serial.txt: Local files for API keys and meter details (not tracked in git).
- Clone the repository and navigate to the
HomeBatterySimdirectory. - Install dependencies (recommended: use a virtual environment):
pip install pandas requests jupyter
- Prepare API credentials:
- Place your Octopus Energy API key in
apikey.txt. - Place your MPAN in
e_mpan.txtand meter serial ine_serial.txt.
- Place your Octopus Energy API key in
- Open
get-data.ipynbin Jupyter. - Run the notebook to:
- Download consumption and tariff data from Octopus Energy
- Convert JSONs to CSVs
- Merge consumption, buy rate, and sell rate into
output.csv
- Open
bat-sim.ipynbin Jupyter. - Set the
data_filepathtooutput.csv(or your merged data file). - Run the notebook to simulate battery operation and calculate annual savings/earnings.
- Results are saved to
simulation_results.csvand printed in the notebook.
- Python 3.7+
- pandas
- requests
- jupyter
- Sensitive files (API keys, raw data) are excluded from version control via
.gitignore. - The simulation is based on Tesla Powerwall specs by default, but you can adjust battery parameters in
bat-sim.ipynb. - Data files can be large; ensure you have sufficient disk space.
This project is for personal and research use. Please check data provider terms before sharing data or results.
Simulation of the gains possible from having a home battery system Conclusion: There is net gains possible but the breakeven point is ~10 years+ hence not worth it for my level of power consumption.
27765b03073621782f2fbaa8275cfe01ed6a3d41