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
+20
View File
@@ -829,6 +829,26 @@ def _roster_problems(opts: dict) -> list[str]:
f"{S('capacity_kwh')} is set on {', '.join(stated)} but empty on "
f"{', '.join(blank)}. Set it on every inverter, or on none.")
# --- (i) TARIFF-30: `round_trip_eff`, optional per entry, 0.5 to 1.0 -----
# Mixed installs are allowed (unlike capacity_kwh): each unit's buy leg uses
# its own meaning, so there is no all-or-none rule here.
for i, entry in enumerate(entries):
if not isinstance(entry, dict):
continue
raw = entry.get("round_trip_eff")
if raw is None or raw == "":
continue
nm = str(entry.get("name") or "").strip()
who = f"inverters[{i}] ({nm})" if nm else f"inverters[{i}]"
try:
val = None if isinstance(raw, bool) else float(raw)
except (TypeError, ValueError):
val = None
if val is None or not math.isfinite(val) or not (0.5 <= val <= 1.0):
problems.append(
f"{who} has {S('round_trip_eff')} {messages.shown(raw)}, which "
"is not usable. Set it from 0.5 to 1, or leave it empty.")
flat_sp = str(opts.get("setpoint_entity") or "").strip()
if entries and flat_sp:
problems.append(