dalsi
This commit is contained in:
@@ -1833,6 +1833,88 @@ class NegativeSellPvChargeTests(unittest.TestCase):
|
||||
"sell nad min horizontu: žádné grid nabíjení",
|
||||
)
|
||||
|
||||
def test_kv1_fixed_night_uses_battery_not_grid_import(self) -> None:
|
||||
"""v62: po večerním push nocí bd≥load, ne import za fixní buy."""
|
||||
prague = ZoneInfo("Europe/Prague")
|
||||
push = PlanningSlot(
|
||||
interval_start=datetime(2026, 6, 1, 18, 45, tzinfo=prague).astimezone(
|
||||
timezone.utc
|
||||
),
|
||||
buy_price=6.353,
|
||||
sell_price=9.61,
|
||||
pv_a_forecast_w=0,
|
||||
pv_b_forecast_w=0,
|
||||
load_baseline_w=400,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
allow_charge=False,
|
||||
allow_discharge_export=True,
|
||||
charge_acquisition_buy_czk_kwh=6.353,
|
||||
)
|
||||
night = PlanningSlot(
|
||||
interval_start=datetime(2026, 6, 1, 23, 0, tzinfo=prague).astimezone(
|
||||
timezone.utc
|
||||
),
|
||||
buy_price=6.353,
|
||||
sell_price=3.09,
|
||||
pv_a_forecast_w=0,
|
||||
pv_b_forecast_w=0,
|
||||
load_baseline_w=800,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
allow_charge=False,
|
||||
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_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=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.35 * battery.usable_capacity_wh
|
||||
results, _, _ = solve_dispatch(
|
||||
[push, night],
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
r_night = results[1]
|
||||
self.assertLess(
|
||||
r_night.battery_setpoint_w,
|
||||
-200,
|
||||
"noc po push: výdej z baterie na dům",
|
||||
)
|
||||
self.assertLessEqual(
|
||||
r_night.grid_setpoint_w,
|
||||
400,
|
||||
"noc: ne plný import za 6,35 Kč",
|
||||
)
|
||||
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user