cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.1289: full source
This commit is contained in:
1 parent
165dda4479
commit
05802d6f87
57 files changed
+5928
-232
No files matched your search
@@ -0,0 +1,41 @@
|
||||
# Copyright © 2026 Setti Solutions S.R.L, www.setti.md. All rights reserved.
|
||||
"""The plan's saving split by carrier and lever (docs/methods.md A12, E14):
|
||||
for the console's Savings page, which shows per carrier what the household
|
||||
paid with Cantabile and would have paid without, and the levers load
|
||||
shifting / off-peak buying and heating apart.
|
||||
|
||||
From the plan's own per-step costs (optimizer.step_costs: per carrier what
|
||||
each step costs with the plan and without it, at the same prices), summed
|
||||
over the horizon, and the heating's share of the electricity saving: the
|
||||
heating and cooling devices' electric draw at the horizon's mean import
|
||||
price (as the baseline counts it) against the step's own price, i.e. the
|
||||
saving from moving the heat pump's or heater's electricity in time. The rest
|
||||
of the electricity saving is load shifting and off-peak buying (battery,
|
||||
car, appliances). Gas and district heat are the heating's alone.
|
||||
|
||||
{"electricity": {"plan_eur", "base_eur", "heating_eur"},
|
||||
"gas": {"plan_eur", "base_eur"}, "heat": {"plan_eur", "base_eur"}}
|
||||
|
||||
base_eur − plan_eur summed over the carriers is the plan's saving without
|
||||
the market's contracts (cost_eur carries them, step_costs does not). None
|
||||
without a tariff (no step costs)."""
|
||||
|
||||
|
||||
def saving_parts(s: dict, m, x, steps: dict | None) -> dict | None:
|
||||
if steps is None:
|
||||
return None
|
||||
out = {}
|
||||
for carrier, d in steps.items():
|
||||
out[carrier] = {"plan_eur": round(sum(d["plan"]), 4), "base_eur": round(sum(d["base"]), 4)}
|
||||
if "electricity" in out:
|
||||
pi = s["price_import"]
|
||||
mean = sum(pi) / m.T
|
||||
heating = 0.0
|
||||
for kind, v in m.devices.values():
|
||||
if not v or kind not in ("heating", "cooling"):
|
||||
continue
|
||||
for t, p in enumerate(v["power"]):
|
||||
if p is not None:
|
||||
heating += m.eur_wh(t, mean - pi[t]) * x(p)
|
||||
out["electricity"]["heating_eur"] = round(heating, 4)
|
||||
return out
|
||||
Reference in new issue
Block a user