oprava ranniho nenabijeni
Some checks failed
CI and deploy / migration-check (push) Failing after 50s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-06-01 18:50:03 +02:00
parent 430e081841
commit 0dcf11d471
4 changed files with 230 additions and 4 deletions

View File

@@ -71,9 +71,11 @@ 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-evening-push-keep-on-relaxed-import-v57"
PLANNER_BUILD_TAG = "2026-06-01-fixed-pv-export-min-sell-charge-v58"
# 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.
FIXED_PV_CHARGE_ONLY_NEAR_MIN_SELL_CZK_KWH = 0.20
# Mimo evening_push: preferovat bd pro dům místo gi, když buy >> acq (účinná cena importu).
NIGHT_SELF_CONSUME_IMPORT_SURCHARGE_CZK_KWH = 4.0
# Po t_detach v prep: necpát PV do bat (měkké; tvrdý hold přes soc_target z rampy).
@@ -2559,6 +2561,13 @@ def solve_dispatch(
degrad_czk_kwh=float(degradation_cost_effective),
)
purchase_fixed_pre = _purchase_pricing_fixed(grid)
fixed_horizon_min_sell_pre: float | None = None
if purchase_fixed_pre:
_pos_sell_prices = [
float(s.sell_price) for s in slots if float(s.sell_price) >= 0.0
]
if _pos_sell_prices:
fixed_horizon_min_sell_pre = min(_pos_sell_prices)
block_export_neg_sell_pre = bool(
getattr(grid, "block_export_on_negative_sell", False)
)
@@ -2813,6 +2822,9 @@ def solve_dispatch(
| set(pre_neg_buy_empty_ts)
| set(neg_evening_push_ts)
)
if purchase_fixed_pre:
# Fixní tarif: sell>buy v noci nesmí ge_bat=0 přes evening_early (BA81 úsvit).
evening_export_exempt_ts |= profitable_export_ts_pre
evening_early_export_penalty_ts = _evening_early_export_penalty_indices(
slots,
discharge_export_slots=discharge_export_slots,
@@ -2951,8 +2963,17 @@ def solve_dispatch(
if t in evening_push_ts:
continue
if _in_night_battery_export_window(slots[t]):
# Večerní export jen v tvrdém push; jinak by shortfall rozplizňoval ge_bat.
continue
# Spot: večerní export jen v tvrdém push. Fixní: i profitable sell>buy v noci.
if not (
purchase_fixed_pre
and _slot_profitable_battery_export(
slots[t],
charge_acquisition_czk_kwh=charge_acquisition_czk_kwh,
min_spread=float(degradation_cost_effective),
fixed_tariff=True,
)
):
continue
if _battery_export_push_defer_to_pv(slots[t]):
continue
if not _slot_profitable_battery_export(
@@ -4008,6 +4029,23 @@ def solve_dispatch(
or fixed_pre_neg_pv_export
or fixed_block_pv_surplus_export
or fixed_mi_low_pv_surplus_export
or (
purchase_fixed_pre
and fixed_horizon_min_sell_pre is not None
and sell_t >= 0.0
and pv_surplus_w > NIGHT_EXPORT_PV_SUNRISE_SURPLUS_W
and sell_t
> fixed_horizon_min_sell_pre
+ FIXED_PV_CHARGE_ONLY_NEAR_MIN_SELL_CZK_KWH
)
)
fixed_high_sell_no_pv_charge = (
purchase_fixed_pre
and fixed_horizon_min_sell_pre is not None
and sell_t >= 0.0
and pv_surplus_w > NIGHT_EXPORT_PV_SUNRISE_SURPLUS_W
and sell_t
> fixed_horizon_min_sell_pre + FIXED_PV_CHARGE_ONLY_NEAR_MIN_SELL_CZK_KWH
)
fixed_pv_b_export_cap = (
purchase_fixed_pre
@@ -4017,6 +4055,9 @@ def solve_dispatch(
and not fixed_pre_neg_pv_export
and int(s.pv_a_forecast_w) >= DAWN_LOW_PV_NO_CURTAIL_W
)
if fixed_high_sell_no_pv_charge:
prob += bc_pv[t] == 0
prob += bc_gi[t] == 0
if fixed_pre_neg_pv_export:
prob += ge_pv[t] <= max(0.0, pv_surplus_w)
elif fixed_pv_b_export_cap:
@@ -4594,6 +4635,10 @@ def solve_dispatch(
and bool(evening_push_ts)
and not push_override_eff
),
"fixed_horizon_min_sell_czk_kwh": fixed_horizon_min_sell_pre,
"fixed_pv_charge_near_min_sell_margin_czk_kwh": (
FIXED_PV_CHARGE_ONLY_NEAR_MIN_SELL_CZK_KWH if purchase_fixed_pre else None
),
"charge_commitment_ignored_on_relaxed": bool(
commitment_for_solve is None and charge_commitment_prev_w is not None
),