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:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user