OPT-34: the night charge keeps its level when the kept forecast ends
With the forecast sensors silent from 17:05 the kept evening figure ended at midnight + 3 h, in the middle of the night grid charge, and Leftover solar's planned level went with it (rig: A 49.8 % against 79.9 %). - A night grid charge that has started keeps its planned level when the forecast goes (Controller._latch_charge, store key night_charge_latch), and the narrow price gap with it (weather_held). A fresh figure still moves the level. - The evening's tomorrow figure is today's until the bell starts (06:00 local), up to 15 h old but only if it was usable at midnight (solarfc.Hold.stand_in). - Screen: "No solar forecast now. The charge under way goes on to its planned level." (EN/NL) while a latched battery is below its level. - test_opt34.py (whole nights through the real control cycle, mutants), test_opt27 and test_modes_p4 adjusted to the new window and the kept level. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
This commit is contained in:
co-authored by
Claude
parent
deee98d352
commit
412e47f111
@@ -671,7 +671,9 @@ check("Cheap hours with a sun forecast charges as with none (P3)",
|
||||
charge and abs(max(r["soc"]["b"] for r in rows_nf) - top) < 1.0
|
||||
and top > 80.0)
|
||||
|
||||
# The forecast goes away mid-run: Leftover solar stops at once (P3 option A).
|
||||
# The forecast goes away mid-run: a charge under way goes on to its level
|
||||
# (OPT-34; it stopped at once, P3 option A, before). With no charge under way
|
||||
# the levels go with the forecast (below, and test_opt27.py).
|
||||
# OPT-27: a sensor that is unavailable is covered by its last fresh reading
|
||||
# for up to 3 h (`solarfc.Hold`), so "lost" here is a hold that never covers;
|
||||
# the next scenario is the same loss with the hold (test_opt27.py).
|
||||
@@ -695,8 +697,9 @@ before = [r for r in rows if r["now"] < DROP and r["action"]
|
||||
== arbitrage.CHARGE]
|
||||
late = [r for r in rows if r["now"] > DROP + timedelta(
|
||||
seconds=2 * 60 + 10) and r["action"] == arbitrage.CHARGE]
|
||||
check("forecast lost mid-run: Leftover solar was charging, and stops within "
|
||||
"a forecast read (60 s) and a cycle", before and not late)
|
||||
check("forecast lost mid-run (OPT-34): Leftover solar was charging, and goes "
|
||||
"on charging past a forecast read (60 s) and a cycle, to its level",
|
||||
before and late)
|
||||
rows, st_, c = run_day(SF_LS, fc=lambda now: 1.0 if now < DROP else None,
|
||||
soc0={"a": 60.0, "b": 10.0})
|
||||
invariants("forecast unavailable mid-run, covered", rows, c)
|
||||
@@ -798,12 +801,20 @@ _m1 = c._run_mark("charge", _run, _packs, lambda p: True, ((B, 40.0),))
|
||||
_m2 = c._run_mark("charge", _run, _packs, lambda p: False, ((B, 50.0),))
|
||||
check("a level the hysteresis moved opens the run to that battery again",
|
||||
_m1 and not _m2)
|
||||
latch, c._charge_latch = c._charge_latch, None
|
||||
c.solar_fc = None
|
||||
check("the levels are dropped as soon as the forecast goes, even before "
|
||||
"the plan is rebuilt", c._plan_targets and c.plan_targets() is None)
|
||||
check("with no charge under way, the levels are dropped as soon as the "
|
||||
"forecast goes, even before the plan is rebuilt",
|
||||
c._plan_targets and c.plan_targets() is None)
|
||||
check("a lost forecast says so: no forecast, Leftover solar solar only",
|
||||
homeview.solar_block(c, datetime.now(timezone.utc))["state"]
|
||||
== "no_forecast" and homeview.day_key(c, B) == "no_forecast")
|
||||
c._charge_latch = latch
|
||||
check("OPT-34: with a charge under way (B charged in this run), the level "
|
||||
"stays: plan_targets() gives it, the line says the charge goes on",
|
||||
latch is not None and c.plan_targets() is not None
|
||||
and B in c.plan_targets() and c.plan_targets()[B] == c._plan_targets[B]
|
||||
and homeview.day_key(c, B) is None)
|
||||
check("the Why line wins over 'saves its power' only while holding",
|
||||
homeview.battery_why(modes_on=True, mode="leftover_solar", off=False,
|
||||
reading=True, phase="idle", shadow=False,
|
||||
|
||||
Reference in New Issue
Block a user