TARIFF-30: per-unit round-trip efficiency in the grid-charge decisions

Optional per-inverter key round_trip_eff (0.5-1). A unit's buy leg is priced at price / eta; the site trade, battery modes, day plan and Home use each unit's own. Not set: byte-identical to before. The discharge split is unchanged (part B is TARIFF-34).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude (dev)
2026-12-05 16:44:29 +01:00
parent 831c33c96b
commit 6881748660
23 changed files with 1614 additions and 51 deletions
+8 -2
View File
@@ -420,7 +420,7 @@ def weights(packs, target_w) -> dict | None:
return out
def trade_power_w(packs, floor_pct, ceiling_pct) -> tuple:
def trade_power_w(packs, floor_pct, ceiling_pct, legs=None) -> tuple:
"""`(charge_w, discharge_w)` - how hard an arbitrage trade may be SIZED.
The site rating is what the site can push; this is what the site can push
@@ -457,8 +457,14 @@ def trade_power_w(packs, floor_pct, ceiling_pct) -> tuple:
the buy gate refuses when every pack is at the ceiling; `arbitrage.decide()`
refuses a 0 W sizing by name anyway, so that is structural rather than a
coincidence of the gates.
TARIFF-30. `legs` is `{name: bool}` (`arbitrage.clearing()`) or None. A pack
whose own buy leg does not clear is not counted on the BUY side: the trade
is sized to what may actually charge. None is today's sum. The sell side
never reads it.
"""
return (float(sum(p.max_w for p in packs
if p.soc is not None and float(p.soc) < ceiling_pct)),
if p.soc is not None and float(p.soc) < ceiling_pct
and (legs is None or legs.get(p.name, True)))),
float(sum(p.max_w for p in packs
if p.soc is not None and float(p.soc) > floor_pct)))