TARIFF-30: hold out a failed leg while the trade winds down; docs, text, pins
checks / unit (pull_request) Failing after 58m14s
infra-pin / fresh (pull_request) Successful in 2s

The loop gives up a trade's last target at its slew, so a unit whose own leg failed stays at 0 W charge for that tail (120 s at most). Option and status texts follow STYLE.md. DOCS and CHANGELOG. The per-entry schema pins in test_inverter and test_translations count the new key.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude (dev)
2026-12-05 17:11:07 +01:00
parent 6881748660
commit 9ba3008eb8
11 changed files with 37 additions and 20 deletions
+17 -4
View File
@@ -312,6 +312,18 @@ def _t1():
and share(bl, B) == -4600)
check("T1 reason: today's sentence (the buy leg is sized by whom it "
"charges)", "charging 5000 W" in last["reason"])
imp = lambda rs, load: [max(0.0, load - sum(r["plant"].values())) # noqa: E731
for r in rs]
check("N11 no more grid import than base on the same inputs, on every "
"cycle and in total (the unit that fails its leg imports less)",
all(a <= b + 1e-6 for a, b in zip(imp(rows, 500.0),
imp(base_rows, 500.0)))
and sum(imp(rows, 500.0)) < sum(imp(base_rows, 500.0)))
d_eta, _c1 = drive(ETA, load=2000.0, variant="modes_off")
d_base, _c2 = drive(NONE2, load=2000.0, variant="modes_off")
check("N11 discharging: the same import, cycle by cycle, with and "
"without an efficiency (no window exception)",
imp(d_eta, 2000.0) == imp(d_base, 2000.0) and len(d_eta) > 5)
@guarded("T5")
@@ -633,7 +645,8 @@ def _t24():
c.mode_tick = modetrade.Tick({}, dict(roles), None, 0.0, None)
cs.append(c.pack_weights(tgt))
check(f"T28 modes on {sorted(roles.values())}: the weights are the "
f"base's", cs[0] == cs[1])
f"base's", present(nth(cs, 0), nth(cs, 1))
and nth(cs, 0) == nth(cs, 1))
@guarded("T29")
@@ -1040,8 +1053,8 @@ def _t50():
def _t34():
sentence = "If you set round-trip efficiency, lower the cycle cost to " \
"wear only."
nl_sentence = "Als u het rendement heen en terug instelt, verlaag dan " \
"de kosten van een batterijcyclus tot alleen slijtage."
nl_sentence = "Stelt u het rendement in, verlaag dan de kosten van een " \
"batterijcyclus tot alleen slijtage."
en = open(os.path.join(HERE, "translations", "en.yaml"),
encoding="utf-8").read()
nl = open(os.path.join(HERE, "translations", "nl.yaml"),
@@ -1119,7 +1132,7 @@ def _t41():
nl = json.load(open(os.path.join(HERE, "app", "ui_text", "nl.json"),
encoding="utf-8"))["home"]["batteries"]
check("T41 short plain words in en and nl",
en.get("round_trip") == "Round trip"
en.get("round_trip") == "Efficiency"
and en.get("round_trip_unset") == "not set"
and nl.get("round_trip") and nl.get("round_trip_unset"))
js = open(os.path.join(HERE, "app", "static", "app.js"),