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

This commit is contained in:
Dusan Vojacek
2026-05-21 15:04:24 +02:00
parent 66834ddfa6
commit fc0761fb2a
4 changed files with 93 additions and 2 deletions

View File

@@ -1095,16 +1095,31 @@ 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.
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))
)
# 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.
# Výjimky: plná baterie (ventil), neriťitelné pv_b s přebytkem, cross-slot výše.
if sell_t < buy_t - min_spread:
block_loss_pv_export = not (
float(s.pv_b_forecast_w) > 0 and pv_surplus_w > 0
)
if t == 0 and current_soc_wh >= float(battery.soc_max_wh) - soc_headroom_wh:
block_loss_pv_export = False
if cross_slot_pv_export:
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