TARIFF-30: pin export during a trade (TARIFF-35), tight one-cycle bound, DECISIONS note
infra-pin / fresh (pull_request) Successful in 3s
checks / unit (pull_request) Failing after 1h13m9s

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude (dev)
2026-12-06 19:03:12 +01:00
parent 008ae722d0
commit 4a8939cd24
2 changed files with 56 additions and 0 deletions
@@ -0,0 +1,21 @@
# TARIFF-30: per-unit round-trip efficiency
`round_trip_eff` (optional, 0.5 to 1, per inverter entry) prices a unit's buy
leg at `price / eta`. Not set: nothing changes. The discharge split is
unchanged (the discharge order is TARIFF-34).
## Known limit: export during a trade (TARIFF-35)
While a grid charge is on, the buy is sized to the units whose own leg clears
(T1, ruled). The trade's claim fixes the site target, so a solar surplus above
that size is exported, where without an efficiency the trade is sized for every
unit and the other unit soaks it. PM ruling 2026-12-06: the sizing stays;
TARIFF-35 files the fix. The row `F4` in `test_tariff30.py` pins today's
behaviour so a fix shows up.
## The wind-down hold
A unit whose leg failed is held at 0 W charge while the site trades, and for
the trade's tail: until the site target is 0 or above, until the meter exports
(the loop is then soaking a surplus, not finishing the trade), or 120 s. The
release is seen one 5 s cycle after the export starts.
+35
View File
@@ -380,6 +380,35 @@ def _grid_export_wh(rows, house_steps, base_load, tick=5.0):
return out
def _export_w(r, house_steps, base_load):
load = base_load
for s, w in house_steps:
if r["t"] >= s:
load = w
return max(0.0, -(load - sum(r["plant"].values())))
@guarded("F4")
def _f4():
# TARIFF-35 (known limit, PM ruling 2026-12-06): with a trade on A, a
# surplus above A's rating is exported, because the trade fixes the site
# target at the size ruled in T1 (5000 W). Base sizes it for both units.
# This row pins today's behaviour; a fix will turn it red and must update
# it.
steps = [(10.0, -7000.0)]
r1, _c1 = drive(ETA, dur=60.0, house=steps)
r0, _c0 = drive(NONE2, dur=60.0, house=steps)
last1, last0 = settled(r1), settled(r0)
check("F4 (TARIFF-35) a trade on A plus a 7000 W surplus: the trade stays "
"5000 W and about 2000 W is exported, B charges nothing",
last1["action"] == arbitrage.CHARGE and last1["power"] == -5000.0
and 1500.0 < _export_w(last1, steps, 500.0) < 2500.0
and last1["plant"][B[-1]] > -50.0)
check("F4 (TARIFF-35) base sizes the trade for both units and exports "
"less", _export_w(last0, steps, 500.0)
< _export_w(last1, steps, 500.0) - 500.0)
@guarded("F1")
def _f1():
# After a trade on A ends (A reads full), a surplus must be soaked by B as
@@ -398,6 +427,12 @@ def _f1():
check(f"F1 a {tag} surplus after the trade ends: export {e1:.1f} Wh "
f"against base {e0:.1f} Wh (the hold does not block the soak)",
len(r1) > 20 and e1 <= e0 + 1.0)
if tag == "3000 W":
ex = [r["t"] for r in r1 if _export_w(r, steps, 500.0) > 50.0
and r["t"] >= 20]
check("F1 export only before the first post-trade read: at most "
f"one 5 s cycle ({len(ex)} cycle(s)), under 1 Wh in the "
f"probe case ({e1:.2f} Wh)", len(ex) <= 1 and e1 < 1.0)
late = [r for r in r1 if r["t"] >= 60]
check(f"F1 {tag}: B takes the surplus within a minute of it, as on "
f"base", any(r["plant"][B[-1]] < -1000.0 for r in late)