Commit graph

2 commits

Author SHA1 Message Date
Michiel Berger
b4d895224b Replace LP with greedy self-consumption — match real battery firmware
The LP was producing visually unintuitive schedules: when several surplus
hours had identical cost benefit (true with constant export_rate), the
solver picked an arbitrary subset, which the user couldn't read as 'this
is the battery doing its job'. Worse, the daily-LP variant drained to 0
every midnight because it placed zero value on next-day SoC.

Replaced oracle_daily_schedule() with a one-pass greedy dispatcher that
matches what every plug-in battery in the catalog (Marstek, Zendure,
EcoFlow, HomeWizard) actually does in 'self-consumption mode':

  for each hour:
      if exporting at meter: charge as fast as power+capacity allows
      if importing at meter: discharge to cover net demand

Trade-offs:
- Greedy doesn't do grid arbitrage (charge cheap → discharge expensive
  without a surplus source). The LP would; real plug-in firmware
  doesn't, so greedy is more honest about what dad's battery would do.
- Charts now show 'fill in the morning, overflow at midday' which is
  what users expect to see.
- Updated tests: dropped LP-arbitrage assertion, added a greedy-fills-
  from-surplus-then-overflows test that locks the new behaviour in.
2026-05-01 10:20:23 +02:00
Michiel Berger
60e0706736 Initial import: home-battery ROI simulator + cracked thuisbatterijgids calc
- Hourly data exporter (InfluxDB → CSV) for prices, P1, irradiance.
- LP-based 24h-foresight oracle dispatch with SoC-consistent state engine.
- Reverse-engineered thuisbatterijgids.nl formula (matches their quotes
  to within €0.50 across three battery configs).
- Catalog scraper for the 52 batteries on thuisbatterijgids.net via their
  /wp-json REST endpoint.
- Web app (Flask) that ranks every catalog battery by honest payback and
  contrasts with the store's quote, deployable via the included Procfile.
2026-04-30 13:46:27 +02:00