oprava battery hold
This commit is contained in:
@@ -71,7 +71,7 @@ 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-05-29-neg-window-charge-night-v45"
|
||||
PLANNER_BUILD_TAG = "2026-05-30-evening-spot-sell-ge-buy-v46"
|
||||
# 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).
|
||||
@@ -1660,9 +1660,20 @@ def _slot_evening_push_profitable(
|
||||
*,
|
||||
charge_acquisition_czk_kwh: float,
|
||||
min_spread: float,
|
||||
spot_push_sell_ge_buy: bool = False,
|
||||
) -> bool:
|
||||
"""Push večerní špičky: spot marže (acq+spread), ne fixní buy z konstantního horizontu."""
|
||||
return float(slot.sell_price) > float(charge_acquisition_czk_kwh) + float(min_spread)
|
||||
"""
|
||||
Push večerní špičky: acq+spread (historická zásoba).
|
||||
Spot (home-01): navíc sell >= buy−spread — jinak vývoz za 3 Kč a noc import za 5 Kč.
|
||||
Fixní tarif (KV1): jen acq+spread (sell často < konstantní buy).
|
||||
"""
|
||||
sell_t = float(slot.sell_price)
|
||||
buy_t = float(slot.buy_price)
|
||||
spread = float(min_spread)
|
||||
if spot_push_sell_ge_buy and buy_t >= 0.0 and sell_t >= 0.0:
|
||||
if sell_t < buy_t - spread:
|
||||
return False
|
||||
return sell_t > float(charge_acquisition_czk_kwh) + spread
|
||||
|
||||
|
||||
def _evening_push_segment_candidates(
|
||||
@@ -1671,6 +1682,7 @@ def _evening_push_segment_candidates(
|
||||
*,
|
||||
charge_acquisition_czk_kwh: float,
|
||||
min_spread: float,
|
||||
spot_push_sell_ge_buy: bool = False,
|
||||
discharge_export_ok: set[int] | None = None,
|
||||
) -> list[int]:
|
||||
"""Profitable sloty v nočním úseku — výběr pořadí a strop dělá rozpočet Wh (sell desc)."""
|
||||
@@ -1686,6 +1698,7 @@ def _evening_push_segment_candidates(
|
||||
slots[t],
|
||||
charge_acquisition_czk_kwh=charge_acquisition_czk_kwh,
|
||||
min_spread=min_spread,
|
||||
spot_push_sell_ge_buy=spot_push_sell_ge_buy,
|
||||
):
|
||||
continue
|
||||
out.append(t)
|
||||
@@ -1745,6 +1758,7 @@ def _evening_battery_export_push_indices(
|
||||
soc_max_wh: float,
|
||||
per_slot_discharge_wh: float,
|
||||
discharge_slot_buffer: float,
|
||||
spot_push_sell_ge_buy: bool = False,
|
||||
discharge_export_ok: set[int] | None = None,
|
||||
evening_start_hour: int = 17,
|
||||
) -> list[int]:
|
||||
@@ -1778,6 +1792,7 @@ def _evening_battery_export_push_indices(
|
||||
seg,
|
||||
charge_acquisition_czk_kwh=charge_acquisition_czk_kwh,
|
||||
min_spread=degrad_czk_kwh,
|
||||
spot_push_sell_ge_buy=spot_push_sell_ge_buy,
|
||||
discharge_export_ok=discharge_export_ok,
|
||||
)
|
||||
if not candidates:
|
||||
@@ -2505,6 +2520,7 @@ def solve_dispatch(
|
||||
soc_max_wh=float(battery.soc_max_wh),
|
||||
per_slot_discharge_wh=per_slot_push_wh_pre,
|
||||
discharge_slot_buffer=discharge_buf_pre,
|
||||
spot_push_sell_ge_buy=not purchase_fixed_pre,
|
||||
discharge_export_ok=discharge_export_slots,
|
||||
)
|
||||
)
|
||||
@@ -3720,11 +3736,16 @@ def solve_dispatch(
|
||||
buy_t > charge_acquisition_czk_kwh + min_spread
|
||||
)
|
||||
if expensive_import_slot and t not in charge_slots and buy_t >= 0.0:
|
||||
# Strict: síť jen EV+TČ; baseload z baterie/FVE. Relaxed: síť smí krmit baseload (nouzový režim).
|
||||
prob += gi[t] <= ev_cap_t + hp[t] + (
|
||||
float(s.load_baseline_w) if relaxed_expensive_import else 0.0
|
||||
# Strict: síť jen EV+TČ; baseload z baterie/FVE.
|
||||
# Relaxed: síť smí baseload jen mimo night_self_consume (v46).
|
||||
night_self_consume_slot = (
|
||||
om == "AUTO" and t in night_self_consume_discourage_ts
|
||||
)
|
||||
if not relaxed_expensive_import and om == "AUTO":
|
||||
if relaxed_expensive_import and not night_self_consume_slot:
|
||||
prob += gi[t] <= ev_cap_t + hp[t] + float(s.load_baseline_w)
|
||||
else:
|
||||
prob += gi[t] <= ev_cap_t + hp[t]
|
||||
if (not relaxed_expensive_import or night_self_consume_slot) and om == "AUTO":
|
||||
prob += (
|
||||
bd[t] + pv_ld[t]
|
||||
>= float(s.load_baseline_w) + hp[t]
|
||||
|
||||
Reference in New Issue
Block a user