fix(optimization): clear disabled AC charge in the reported plan

With grid charging switched off (inverter.max_ac_charge_power_w = 0) the
simulation zeroes the AC charge array before using it, but it did so by
rebinding a local name. The solution is read back from the original array,
so it still carried the optimizer's AC charge genes - genes the fitness
never evaluated, because the simulation ignored them, and which are
therefore arbitrary.

The effect was visible as a slot with ac_charge = 0.8 where the battery SoC
does not move. Harmless inside EOS, but a controller that follows the plan
would grid-charge the battery at a time nobody planned or paid for.

Zero the array in place so the reported plan matches what was simulated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Andreas
2026-09-03 18:56:42 +02:00
co-authored by Claude Opus 5
parent a6b20e6de2
commit 2a9543e710
3 changed files with 69 additions and 2 deletions
+4
View File
@@ -49,6 +49,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
two applies. The `ev_soc_miss` penalty is then evaluated at that slot instead of at the end
of the horizon, and the seeding heuristics only propose charge slots before it. Without a
deadline the behaviour is unchanged.
- Fix: with grid charging disabled (`inverter.max_ac_charge_power_w = 0`) the returned
`ac_charge` array kept the optimizer's unused gene values. The simulation ignored them, so
they were never costed - but a controller acting on the plan would grid-charge the battery
anyway. The disabled AC charge is now cleared in the reported plan as well.
- EV Bug (wrong output in genetic.py / no senseful results)
- Direktvermarktung active / Battery discharge into grid (new state / action battery_grid_export_allowed) + (new simulation output Feed_in_tariff)
- New PV forecast providers giving operators more cloud forecast sources to choose from in