dalsi
Some checks failed
CI and deploy / migration-check (push) Failing after 22s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-06-01 19:20:27 +02:00
parent 96adbff9ea
commit d44a2cbb44
3 changed files with 107 additions and 5 deletions

View File

@@ -71,7 +71,7 @@ NEG_BUY_CHARGE_SHORTFALL_PENALTY_CZK_KWH = 100.0
PRE_NEG_CHARGE_PENALTY_CZK_KWH = 400.0
PRE_NEG_BATT_EXPORT_SHORTFALL_PENALTY_CZK_KWH = 80.0
PRE_NEG_BATT_EXPORT_MIN_SELL_CZK_KWH = 1.0
PLANNER_BUILD_TAG = "2026-06-01-spot-grid-charge-at-acq-buy-v61"
PLANNER_BUILD_TAG = "2026-06-01-kv1-fixed-night-self-consume-v62"
# Ranní slabá FVE: neaplikovat pv_store ge_pv=0 (jinak curtail při sell < večerní peak).
DAWN_LOW_PV_NO_CURTAIL_W = 1500
# BA81/KV1: PV→bat jen v těsné blízkosti nejnižšího sell v horizontu (≈ poledne), ne při ~3 Kč ráno.
@@ -1833,10 +1833,12 @@ def _night_self_consume_discourage_import_indices(
evening_push_ts: set[int],
charge_acquisition_czk_kwh: float,
min_spread: float,
purchase_fixed: bool = False,
) -> set[int]:
"""
Noční sloty mimo evening_push: penalizace importu pro dům (preferovat bd).
v45: celé noční okno, ne jen evening_early_export_ban subset.
KV1: buy ≈ acq (konstantní ~6,35) — jinak prázdná množina, síť místo baterie v noci.
"""
out: set[int] = set()
for t, s in enumerate(slots):
@@ -1844,11 +1846,15 @@ def _night_self_consume_discourage_import_indices(
continue
if not _in_night_battery_export_window(s):
continue
buy_t = float(s.buy_price)
if buy_t <= float(charge_acquisition_czk_kwh) + float(min_spread):
continue
if float(s.load_baseline_w) <= 0:
continue
buy_t = float(s.buy_price)
if purchase_fixed:
if buy_t >= 0.0:
out.add(t)
continue
if buy_t <= float(charge_acquisition_czk_kwh) + float(min_spread):
continue
out.add(t)
return out
@@ -2836,6 +2842,7 @@ def solve_dispatch(
evening_push_ts=evening_push_ts,
charge_acquisition_czk_kwh=charge_acquisition_czk_kwh,
min_spread=float(degradation_cost_effective),
purchase_fixed=purchase_fixed_pre,
)
post_evening_push_night_ts = _post_evening_push_night_self_consume_indices(
slots, evening_push_ts
@@ -4123,7 +4130,10 @@ def solve_dispatch(
# Spot (home-01): buy > min ne-záporného buy v horizontu.
# Fixní tarif (KV1): navíc buy > charge_acquisition (konstantní buy ≈ ref).
expensive_import_slot = buy_t > ref_buy_horizon + min_spread
if fixed_tariff_like_pre:
if purchase_fixed_pre and buy_t >= 0.0:
# KV1/BA81: buy skoro konstantní — buy > acq nikdy neplatí, jinak v noci import za 6 Kč.
expensive_import_slot = True
elif fixed_tariff_like_pre:
expensive_import_slot = expensive_import_slot or (
buy_t > charge_acquisition_czk_kwh + min_spread
)