Skip to content

ShreyCh13/battery-dispatch-optimizer

Repository files navigation

Battery Dispatch Optimizer

What's the cheapest mix of solar, wind, batteries, and gas that keeps the lights on?

This is a least-cost capacity-and-dispatch optimizer for firm power. Give it a load profile and a reliability target, and it screens hundreds of resource configurations — solar, wind, battery power/duration, and gas — runs a cost-optimal dispatch on each, and returns the cheapest configuration that hits your reliability target, plus the full cost-vs-reliability Pareto frontier.

Personal project. All inputs are synthetic / illustrative public-style data — no proprietary or employer data is used.

Example output

From the included sample run (results/cli_smoke/), a small commercial C&I facility, grid-off, 95% reliability target, 54 configurations screened:

Cheapest configuration meeting 95% reliability: $28.3M/yr at 97.76% firmness
  Solar: 80 MW   Wind: 0 MW   BESS: 40 MW / 4h (160 MWh)   Gas: 25 MW

How it works

Two layers:

  1. Dispatch optimization (dispatch_core/optimize.py) — a PuLP linear program for the storage + renewables dispatch, extended to a MILP for gas unit commitment (binary on/start/stop variables, min-up/min-down times, startup and no-load costs). Models battery state-of-charge and degradation cost, grid import/export, a carbon price, and value-of-lost-load (VOLL) on any unserved energy. Several objective modes: blend, revenue, resilience, serve, grid-on max-revenue, grid-off min-cost.

  2. Capacity screening (dispatch_core/screening.py) — sweeps combinations of solar / wind / BESS-power / BESS-duration / gas, runs the optimal dispatch on each, scores by reliability and annualized cost, and returns the recommended config plus a Pareto frontier. Uses an LP-relaxation-then-revalidate-with-full-MILP design to stay tractable over a large sweep.

Run it

Interactive app

pip install -r requirements.txt
streamlit run streamlit_app.py

Batch / CLI

python run_batch.py --scenario scenarios/commercial_c_and_i.json

Tests

pytest tests/

Project structure

.
├── dispatch_core/
│   ├── optimize.py      # PuLP LP/MILP dispatch with gas unit commitment
│   ├── screening.py     # multi-resource capacity sweep + Pareto frontier
│   ├── economics.py     # annualized cost / techno-economic assumptions
│   └── sizing.py        # configuration recommendation
├── pages/               # Streamlit multi-page UI
├── scenarios/           # example scenarios (generic techno-economic inputs)
├── results/cli_smoke/   # a sample run's output
├── tests/               # unit + integration tests
├── run_batch.py         # batch CLI
└── streamlit_app.py     # interactive app

License

MIT — see LICENSE.

About

Least-cost capacity & dispatch optimizer for firm power — a PuLP LP/MILP engine (with gas unit commitment) that screens solar/wind/battery/gas mixes against a reliability target and returns the cheapest config + a cost/reliability Pareto frontier. Streamlit app + CLI + tests.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages