zas oprava KV1 a BA81
This commit is contained in:
@@ -1757,6 +1757,136 @@ class NegativeSellPvChargeTests(unittest.TestCase):
|
||||
"min sell: nabíjení z PV",
|
||||
)
|
||||
|
||||
def test_fixed_no_grid_charge_when_sell_below_buy(self) -> None:
|
||||
"""v59: KV1 — sell < buy nesmí grid→bat (22h za 6 Kč)."""
|
||||
prague = ZoneInfo("Europe/Prague")
|
||||
slot = PlanningSlot(
|
||||
interval_start=datetime(2026, 6, 1, 22, 0, tzinfo=prague).astimezone(
|
||||
timezone.utc
|
||||
),
|
||||
buy_price=6.353,
|
||||
sell_price=3.5,
|
||||
pv_a_forecast_w=0,
|
||||
pv_b_forecast_w=0,
|
||||
load_baseline_w=400,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
allow_charge=True,
|
||||
allow_discharge_export=False,
|
||||
charge_acquisition_buy_czk_kwh=6.353,
|
||||
)
|
||||
battery = _battery(uc_wh=12_500.0, min_pct=10.0, arb_pct=30.0)
|
||||
battery.max_charge_power_w = 6250
|
||||
hp = SimpleNamespace(
|
||||
rated_heating_power_w=0,
|
||||
tuv_min_temp_c=45.0,
|
||||
tuv_target_temp_c=55.0,
|
||||
)
|
||||
grid = SimpleNamespace(
|
||||
max_import_power_w=17_000,
|
||||
max_export_power_w=8000,
|
||||
block_export_on_negative_sell=True,
|
||||
purchase_pricing_mode="fixed",
|
||||
)
|
||||
vehicles = [
|
||||
SimpleNamespace(
|
||||
max_charge_power_w=0,
|
||||
battery_capacity_kwh=1.0,
|
||||
default_target_soc_pct=80.0,
|
||||
),
|
||||
SimpleNamespace(
|
||||
max_charge_power_w=0,
|
||||
battery_capacity_kwh=1.0,
|
||||
default_target_soc_pct=80.0,
|
||||
),
|
||||
]
|
||||
soc0 = 0.25 * battery.usable_capacity_wh
|
||||
results, _, _ = solve_dispatch(
|
||||
[slot],
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
self.assertLessEqual(
|
||||
results[0].battery_setpoint_w,
|
||||
200,
|
||||
"sell < buy: žádné grid nabíjení",
|
||||
)
|
||||
|
||||
def test_fixed_evening_push_no_charge_at_peak_sell(self) -> None:
|
||||
"""v59: večerní push — při sell>buy ne nabíjet, jen vybíjet."""
|
||||
prague = ZoneInfo("Europe/Prague")
|
||||
slot = PlanningSlot(
|
||||
interval_start=datetime(2026, 6, 1, 20, 45, tzinfo=prague).astimezone(
|
||||
timezone.utc
|
||||
),
|
||||
buy_price=3.088,
|
||||
sell_price=9.61,
|
||||
pv_a_forecast_w=2000,
|
||||
pv_b_forecast_w=200,
|
||||
load_baseline_w=400,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
allow_charge=True,
|
||||
allow_discharge_export=True,
|
||||
charge_acquisition_buy_czk_kwh=3.088,
|
||||
future_sell_opportunity_czk_kwh=9.0,
|
||||
)
|
||||
battery = _battery(uc_wh=12_500.0, min_pct=10.0, arb_pct=30.0)
|
||||
battery.max_charge_power_w = 6250
|
||||
battery.max_discharge_power_w = 6250
|
||||
hp = SimpleNamespace(
|
||||
rated_heating_power_w=0,
|
||||
tuv_min_temp_c=45.0,
|
||||
tuv_target_temp_c=55.0,
|
||||
)
|
||||
grid = SimpleNamespace(
|
||||
max_import_power_w=17_000,
|
||||
max_export_power_w=8000,
|
||||
block_export_on_negative_sell=False,
|
||||
purchase_pricing_mode="fixed",
|
||||
)
|
||||
vehicles = [
|
||||
SimpleNamespace(
|
||||
max_charge_power_w=0,
|
||||
battery_capacity_kwh=1.0,
|
||||
default_target_soc_pct=80.0,
|
||||
),
|
||||
SimpleNamespace(
|
||||
max_charge_power_w=0,
|
||||
battery_capacity_kwh=1.0,
|
||||
default_target_soc_pct=80.0,
|
||||
),
|
||||
]
|
||||
soc0 = 0.85 * battery.usable_capacity_wh
|
||||
results, _, _ = solve_dispatch(
|
||||
[slot],
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
r0 = results[0]
|
||||
self.assertLessEqual(
|
||||
r0.battery_setpoint_w,
|
||||
200,
|
||||
"večerní peak: ne nabíjet baterii",
|
||||
)
|
||||
self.assertLess(
|
||||
r0.battery_setpoint_w,
|
||||
-500,
|
||||
"večerní peak: vývoz z baterie",
|
||||
)
|
||||
|
||||
def test_fixed_night_profitable_export_not_evening_early_banned(self) -> None:
|
||||
"""v58: v noci sell>buy nesmí evening_early držet ge_bat=0."""
|
||||
prague = ZoneInfo("Europe/Prague")
|
||||
|
||||
Reference in New Issue
Block a user