uz me to nebavi
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-05-21 15:17:09 +02:00
parent fc0761fb2a
commit 649c9e9510
4 changed files with 56 additions and 38 deletions

View File

@@ -1095,13 +1095,30 @@ def solve_dispatch(
0.0,
float(s.pv_a_forecast_w) + float(s.pv_b_forecast_w) - load_t,
)
# Mezi-slotová arbitráž: ráno prodat FVE (sell > acquisition), odpoledne levně
# nabít ze sítě — necpát přebytek do baterie jen protože sell < buy ve stejném slotu.
# Mezi-slotová FVE arbitráž: export jen když (prodat teď levný nákup později)
# ≥ (večerní špička acquisition). Jinak drž PV v baterii na peak sell.
fso_t = float(
s.future_sell_opportunity_czk_kwh
if s.future_sell_opportunity_czk_kwh is not None
else sell_t
)
future_chg_buys = [
float(slots[ts].buy_price)
for ts in range(t + 1, T)
if ts in charge_slots
]
min_future_chg_buy = (
min(future_chg_buys)
if future_chg_buys
else charge_acquisition_czk_kwh
)
export_refill_net = sell_t - min_future_chg_buy
store_peak_net = fso_t - charge_acquisition_czk_kwh
cross_slot_pv_export = (
t not in charge_slots
and pv_surplus_w > 0
and sell_t >= charge_acquisition_czk_kwh + min_spread
and any(ts in charge_slots for ts in range(t + 1, T))
and future_chg_buys
and export_refill_net >= store_peak_net + min_spread
)
# Ztrátový export FVE (sell ≪ buy): zakázat jen pokud jde energii do baterie.
# Výjimky: plná baterie (ventil), neriťitelné pv_b s přebytkem, cross-slot výše.
@@ -1115,11 +1132,6 @@ def solve_dispatch(
block_loss_pv_export = False
if block_loss_pv_export:
prob += ge_pv[t] == 0
if cross_slot_pv_export:
prob += bc[t] == 0
prob += ge_pv[t] >= min(
pv_surplus_w, float(grid.max_export_power_w)
)
# Drahý nákup oproti horizontu: import jen na load + EV + TČ, ne na grid-nabíjení.
if buy_t >= 0 and buy_t > ref_buy_horizon + min_spread:
prob += gi[t] <= load_t + ev_cap_t + hp_rated_w