OPT-27: a kept figure sizes the night under OPT-28's shortfall, as a fresh one does
checks / unit (pull_request) Successful in 17m22s
infra-pin / fresh (pull_request) Successful in 1s

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-10-30 18:57:37 +01:00
co-authored by Claude
parent bf842997c1
commit 60aa7f310c
+27
View File
@@ -508,6 +508,33 @@ check("03:30 (after midnight + 3 h): a figure from before the night is not "
present(lf) and lf["fc_none"] and lf["runs_on"] is False
and lf["reason"] == "not_worth" and not any(r["charging"] for r in rf))
# g. OPT-28's shortfall sizing on a kept figure: Leftover solar (A) is sized
# from the kept forecast exactly as from a fresh one, not "no forecast"
def fresh_all(now, ent):
return st(0.4 if ent == T_ENT else 12.0, now)
cg, rg, pg = drive27(opts(), fresh_all, pre=EVENING + [at(DAY3, 21, 55)],
start=NIGHT_START)
kp, fp_ = ca.day_plan, cg.day_plan
print(f" g. kept : short={kp and kp.short_kwh} uncovered="
f"{kp and kp.uncovered_kwh} targets={kp and kp.targets} "
f"need={kp and kp.need_kwh} sun={kp and kp.sun_kwh}")
print(f" fresh : short={fp_ and fp_.short_kwh} uncovered="
f"{fp_ and fp_.uncovered_kwh} targets={fp_ and fp_.targets} "
f"need={fp_ and fp_.need_kwh} sun={fp_ and fp_.sun_kwh}")
check("a kept figure sizes the night by OPT-28's shortfall, with a level for "
"Leftover solar (A): not 'no forecast', which has no plan at all",
kp is not None and A in kp.targets and kp.short_kwh > 0.0
and cb.day_plan is None and not cg.solar_fc.kept)
check("... and the level, the grid need, the shortfall and the sun counted "
"are those a fresh figure gives (counted once, from the right time)",
fp_ is not None and kp.targets == fp_.targets
and kp.need_kwh == fp_.need_kwh and kp.share_kwh == fp_.share_kwh
and abs(kp.short_kwh - fp_.short_kwh) < 1e-9
and abs(kp.uncovered_kwh - fp_.uncovered_kwh) < 1e-9
and abs(kp.sun_kwh - fp_.sun_kwh) < 1e-9)
# --------------------------------------------------------------------------- #
print("\n3. The screens")
blk = ca.block