stopadesaty fix
Some checks failed
CI and deploy / migration-check (push) Failing after 10s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-25 01:52:08 +02:00
parent 5fb4c10ff6
commit a2a35981a1
5 changed files with 24 additions and 14 deletions

View File

@@ -68,7 +68,7 @@ NEG_SELL_BAT_DUMP_SHORTFALL_PENALTY_CZK_KWH = 80.0
NEG_BUY_GRID_CHARGE_SHORTFALL_PENALTY_CZK_KWH = 120.0
# Měkký tlak: v buy<0 okně dobít na soc_max (ne zastavit na ~94 %).
NEG_BUY_SOC_UNDERFILL_PENALTY_CZK_PER_WH = 0.45
PLANNER_BUILD_TAG = "2026-05-27-pre-neg-buy-strategy-v19"
PLANNER_BUILD_TAG = "2026-05-27-pre-neg-buy-strategy-v19b"
CORRECTION_WINDOW_H = 1 # hodina zpět pro výpočet korekčního faktoru
CORRECTION_MIN_CLAMP = 0.5 # spodní limit korekčního faktoru
CORRECTION_MAX_CLAMP = 1.5 # horní limit korekčního faktoru
@@ -1253,10 +1253,11 @@ def solve_dispatch(
st = slots[t]
if float(st.sell_price) < _disch_sell_thr:
continue
# Jen sloty, kde SQL už povolilo export, nebo je výrazný kladný sell
# (rozšíření discharge_export_slots na celé dopoledne dělá krátké horizonty infeasible).
if st.allow_discharge_export or float(st.sell_price) >= 1.0:
discharge_export_slots.add(t)
# Jen výrazný kladný sell; NE přidávat do discharge_export_slots (w_arb by
# zablokoval bd → load v noci → Infeasible). ge_bat povolíme přes pre_neg_buy_discharge_ts.
if float(st.sell_price) >= 1.0:
pre_neg_buy_discharge_ts.add(t)
elif st.allow_discharge_export:
pre_neg_buy_discharge_ts.add(t)
# SELF_SUSTAIN dřív vynucoval ge[t] == 0, což umí udělat MILP infeasible v okamžiku, kdy:
# - baterie je na max SoC (nelze nabíjet),
@@ -1539,8 +1540,6 @@ def solve_dispatch(
sf_gi = pulp.LpVariable(f"neg_buy_gi_shortfall_{t}", 0, cap_gi)
neg_buy_grid_shortfall.append((t, sf_gi, cap_gi))
for t in pre_neg_buy_discharge_ts:
if t not in discharge_export_slots:
continue
cap_pre = float(_battery_export_cap_w(battery, grid))
sf_pre = pulp.LpVariable(f"preneg_buy_disch_sf_{t}", 0, cap_pre)
pre_neg_buy_export_shortfall.append((t, sf_pre, cap_pre))
@@ -1677,7 +1676,6 @@ def solve_dispatch(
+ pulp.lpSum(
-35.0 * z_export[t]
for t in pre_neg_buy_discharge_ts
if t in discharge_export_slots
)
)
@@ -2090,7 +2088,11 @@ def solve_dispatch(
prob += bc_pv[t] == 0
else:
prob += bc_pv[t] <= float(pv_surplus_w)
if t not in discharge_export_slots and t not in neg_sell_bat_dump_slots:
if (
t not in discharge_export_slots
and t not in neg_sell_bat_dump_slots
and t not in pre_neg_buy_discharge_ts
):
prob += ge_bat[t] == 0
prob += z_export[t] == 0