OPT-36: test a give block before tonight's charge, Solar first refusing and in maintenance
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
05746c0564
commit
490f67924b
@@ -363,6 +363,10 @@ for label, b in (
|
||||
False, 4600.0, 94.0, None)),
|
||||
("without a level", modetrade.Pack(B, True, packmode.CHEAP_HOURS,
|
||||
False, 4600.0, None, CAP_B)),
|
||||
("Solar first refusing to give",
|
||||
pk(B, packmode.SOLAR_FIRST, 94.0, CAP_B, refused=1)),
|
||||
("Solar first in maintenance",
|
||||
pk(B, packmode.SOLAR_FIRST, 94.0, CAP_B, idle=False)),
|
||||
("Solar first with the night draining it to the floor",
|
||||
pk(B, packmode.SOLAR_FIRST, 24.0, CAP_B))):
|
||||
pl = mk_plan(base_pk + [b])
|
||||
@@ -491,7 +495,7 @@ check("plan_cover() is the plan's cover figure whatever level control holds "
|
||||
cs.plan_targets = real
|
||||
# A give run before the cheap run (10:00: tomorrow night's charge is after
|
||||
# today's give): the give block reads the level now.
|
||||
c10 = make(shape_of(1.0), soc=(60.0, 60.0),
|
||||
c10 = make(shape_of(2.0), soc=(40.0, 25.0), modes=("leftover_solar", "solar_first"),
|
||||
now=datetime(2026, 11, 2, 10, 0, tzinfo=BILLING_TZ).astimezone(UTC))
|
||||
st10 = homeview.build(c10, level="ok", checks=[],
|
||||
now=datetime(2026, 11, 2, 10, 0,
|
||||
@@ -500,8 +504,10 @@ st10 = homeview.build(c10, level="ok", checks=[],
|
||||
g10 = [r for r in st10["plan"]["runs"]
|
||||
if r["battery"] == 0 and r["kind"] == "give"]
|
||||
check("a give run that comes BEFORE the next cheap run is read at the level "
|
||||
"now (60 % -> 6.1 kWh), not at a later charge",
|
||||
g10 and abs(g10[0]["kwh"] - (60.0 - FLOOR) / 100.0 * CAP_A) < 0.02)
|
||||
"now (40 % -> 3.1 kWh), not at tonight's charge",
|
||||
g10 and abs(g10[0]["kwh"] - (40.0 - FLOOR) / 100.0 * CAP_A) < 0.02
|
||||
and any(r["kind"] == "grid" and r["battery"] == 0
|
||||
for r in st10["plan"]["runs"]))
|
||||
|
||||
# ============================================================================ #
|
||||
print("5. the real Controller through a whole night")
|
||||
|
||||
Reference in New Issue
Block a user