fxi bA81 infeasable
This commit is contained in:
@@ -59,7 +59,7 @@ NEG_SELL_CURTAIL_PENALTY_CZK_KWH = 1.0
|
||||
NEG_SELL_PV_CHARGE_REWARD_CZK_KWH = 0.8
|
||||
# Měkký tlak: v okně sell<0 dobít na soc_max (ne zastavit na ~94 % kvůli curtail).
|
||||
NEG_SELL_SOC_UNDERFILL_PENALTY_CZK_PER_WH = 0.35
|
||||
PLANNER_BUILD_TAG = "2026-05-24-evening-export-v4"
|
||||
PLANNER_BUILD_TAG = "2026-05-24-ba81-pv-b-export-v5"
|
||||
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
|
||||
@@ -802,6 +802,40 @@ def _evening_peak_export_indices(
|
||||
return out
|
||||
|
||||
|
||||
def _evening_battery_export_push_indices(
|
||||
slots: list[PlanningSlot],
|
||||
*,
|
||||
profitable_export_ts: set[int],
|
||||
degrad_czk_kwh: float,
|
||||
evening_start_hour: int = 17,
|
||||
max_slots_per_day: int = 3,
|
||||
) -> list[int]:
|
||||
"""
|
||||
Tvrdý push ge_bat jen u několika nejlepších večerních slotů/den (profitable ∩ peak).
|
||||
Jinak součet ge_bat × z_export přes celý peak pásmo může překročit dostupné SoC → Infeasible.
|
||||
"""
|
||||
peak_ts = _evening_peak_export_indices(
|
||||
slots,
|
||||
degrad_czk_kwh=degrad_czk_kwh,
|
||||
evening_start_hour=evening_start_hour,
|
||||
)
|
||||
by_day: dict = {}
|
||||
for t in peak_ts:
|
||||
if t not in profitable_export_ts:
|
||||
continue
|
||||
d = _prague_calendar_date(slots[t])
|
||||
by_day.setdefault(d, []).append(t)
|
||||
out: list[int] = []
|
||||
for d in sorted(by_day.keys()):
|
||||
ranked = sorted(
|
||||
by_day[d],
|
||||
key=lambda i: float(slots[i].sell_price),
|
||||
reverse=True,
|
||||
)
|
||||
out.extend(ranked[:max_slots_per_day])
|
||||
return sorted(out)
|
||||
|
||||
|
||||
def _pv_forced_vent_export_allowed(
|
||||
t: int,
|
||||
*,
|
||||
@@ -1138,9 +1172,6 @@ def solve_dispatch(
|
||||
fixed_tariff=fixed_tariff_like_pre,
|
||||
):
|
||||
profitable_export_ts_pre.add(_t)
|
||||
elif slots[_t].allow_discharge_export:
|
||||
# SQL maska (R__063) už vybrala slot — neblokovat push/shortfall kvůli acq.
|
||||
profitable_export_ts_pre.add(_t)
|
||||
if first_neg_sell_idx is not None and first_neg_sell_idx > 0 and floor_pct is not None:
|
||||
# Kotva na ranním peaku (ne na posledním slotu před sell<0) — jinak dump až v 07:30.
|
||||
if (
|
||||
@@ -1413,7 +1444,12 @@ def solve_dispatch(
|
||||
export_push_w,
|
||||
float(battery.max_discharge_power_w) * 0.5,
|
||||
)
|
||||
for t_peak in evening_peak_export_ts:
|
||||
evening_push_ts = _evening_battery_export_push_indices(
|
||||
slots,
|
||||
profitable_export_ts=profitable_export_ts,
|
||||
degrad_czk_kwh=float(degradation_cost_effective),
|
||||
)
|
||||
for t_peak in evening_push_ts:
|
||||
if t_peak not in discharge_export_slots:
|
||||
continue
|
||||
prob += ge_bat[t_peak] >= evening_export_push_w * z_export[t_peak]
|
||||
@@ -1768,15 +1804,19 @@ def solve_dispatch(
|
||||
and sell_t < 0
|
||||
and not fixed_tariff_like_pre
|
||||
)
|
||||
if (
|
||||
# BA81 (fixní tarif + pole B): ge_pv==0 z pv_store by znemožnilo odvést nelimitovatelný
|
||||
# výkon B (plná baterie po sell<0). Místo toho jen strop na pv_b.
|
||||
fixed_pv_b_export_cap = (
|
||||
fixed_tariff_like_pre
|
||||
and sell_t < 0
|
||||
and t in charge_slots
|
||||
):
|
||||
and float(s.pv_b_forecast_w) > 0
|
||||
and not getattr(grid, "block_export_on_negative_sell", False)
|
||||
)
|
||||
if fixed_pv_b_export_cap:
|
||||
prob += ge_pv[t] <= max(0.0, float(s.pv_b_forecast_w))
|
||||
if (
|
||||
not allow_pre_neg_pv_export
|
||||
and not skip_pv_store_block
|
||||
and not fixed_pv_b_export_cap
|
||||
and sell_t < pv_store_val
|
||||
and not _pv_forced_vent_export_allowed(
|
||||
t,
|
||||
|
||||
Reference in New Issue
Block a user