You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(plan): skip low power charging when the charge window overlaps solar
The planner costs every charge window at the full charge rate - low power
charging is only applied to the final plan (prediction.py gates it on
save in best/best10/test). find_charge_rate then sizes the throttled rate
from charge_left / minutes_left with no knowledge of PV.
In a charge window that overlaps solar production the rate cap in
battery_draw = -max(min(charge_rate_now_curve_step, ...), 0, -battery_to_max)
stops the PV reaching the battery. The surplus is exported at the export
rate and the charge target is then made up from grid import once the sun
has gone, costing more than the full rate charge that was planned for.
find_charge_rate now returns the max rate when the PV forecast summed
across the remainder of the charge window exceeds LOW_POWER_PV_THRESHOLD
(0.1kWh). Both callers supply that sum: the prediction from a suffix sum
of the PV step array built once per run (only when low power is active,
so the optimiser hot loop is untouched), and execute from
pv_forecast_minute between now and the window end.
No C++ kernel change is needed - the kernel only runs when save is falsy,
which is exactly when charge low power is off, so it already takes the max
rate path and stays in parity.
Tests: model scenarios low_power_pv_* / low_power_dark_* (without the fix
the low power run costs 44p against a 0p full rate plan), execute
scenarios charge_low_power_pv / charge_low_power_pv_trace, and a
find_charge_rate unit test for the threshold either side.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
print("**** ERROR: 0.05kWh of PV in the window should not change the rate, expected {}W got {}W ****".format(dark_rate*MINUTE_WATT, trace_rate*MINUTE_WATT))
121
+
failed=1
122
+
123
+
# Real PV production in the window means we must charge at full rate so the PV is not throttled away
0 commit comments