oprava ranniho nenabijeni
This commit is contained in:
@@ -1673,6 +1673,153 @@ class NegativeSellPvChargeTests(unittest.TestCase):
|
||||
"kladný sell>buy: alespoň částečný výdej (jednoslotový horizont — plný push až v integračním testu)",
|
||||
)
|
||||
|
||||
def test_fixed_high_sell_no_pv_charge_near_min_sell(self) -> None:
|
||||
"""v58: ráno sell~3 Kč → export FVE; poledne sell~1,45 Kč → nabíjení z PV."""
|
||||
prague = ZoneInfo("Europe/Prague")
|
||||
base = datetime(2026, 6, 2, 6, 0, tzinfo=prague)
|
||||
slots: list[PlanningSlot] = []
|
||||
for i in range(8):
|
||||
sell = 3.15 if i < 4 else 1.45
|
||||
slots.append(
|
||||
PlanningSlot(
|
||||
interval_start=(base + timedelta(minutes=15 * i)).astimezone(
|
||||
timezone.utc
|
||||
),
|
||||
buy_price=3.088,
|
||||
sell_price=sell,
|
||||
pv_a_forecast_w=8000,
|
||||
pv_b_forecast_w=200,
|
||||
load_baseline_w=400,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
allow_charge=True,
|
||||
allow_discharge_export=False,
|
||||
charge_acquisition_buy_czk_kwh=3.088,
|
||||
future_sell_opportunity_czk_kwh=3.2,
|
||||
)
|
||||
)
|
||||
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=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.35 * battery.usable_capacity_wh
|
||||
results, _, snap = solve_dispatch(
|
||||
slots,
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
self.assertEqual(
|
||||
snap["inputs"].get("fixed_horizon_min_sell_czk_kwh"),
|
||||
1.45,
|
||||
)
|
||||
r_morning = results[0]
|
||||
r_noon = results[5]
|
||||
self.assertLess(
|
||||
r_morning.grid_setpoint_w,
|
||||
-2000,
|
||||
"vysoký sell: přebytek FVE do sítě",
|
||||
)
|
||||
self.assertLessEqual(
|
||||
r_morning.battery_setpoint_w,
|
||||
200,
|
||||
"vysoký sell: ne nabíjet z PV",
|
||||
)
|
||||
self.assertGreater(
|
||||
r_noon.battery_setpoint_w,
|
||||
800,
|
||||
"min sell: nabíjení z PV",
|
||||
)
|
||||
|
||||
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")
|
||||
slot = PlanningSlot(
|
||||
interval_start=datetime(2026, 6, 2, 5, 0, tzinfo=prague).astimezone(
|
||||
timezone.utc
|
||||
),
|
||||
buy_price=3.088,
|
||||
sell_price=3.35,
|
||||
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=3.088,
|
||||
)
|
||||
battery = _battery(uc_wh=12_500.0, terminal_soc_value_factor=0.0)
|
||||
battery.max_discharge_power_w = 6250
|
||||
battery.planner_daytime_charge_target_enabled = False
|
||||
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.28 * battery.usable_capacity_wh
|
||||
results, _, _ = solve_dispatch(
|
||||
[slot],
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
r0 = results[0]
|
||||
self.assertLess(
|
||||
r0.battery_setpoint_w,
|
||||
-500,
|
||||
"noci sell>buy: vývoz z baterie",
|
||||
)
|
||||
|
||||
def test_fixed_tariff_post_neg_pv_b_full_soc_feasible(self) -> None:
|
||||
"""BA81: plná baterie + sell<0 + odpoledne pv_b — ge_pv==0 z pv_store dříve dělalo Infeasible."""
|
||||
slots = [
|
||||
|
||||
Reference in New Issue
Block a user