pry oprava uplne chybneho rizeni (prodaval za levneji nez nakoupil)
This commit is contained in:
@@ -1009,6 +1009,71 @@ class PlanningDispatchMilpTests(unittest.TestCase):
|
||||
self.assertGreater(results[0].battery_setpoint_w, 0, "surplus PV should charge")
|
||||
|
||||
|
||||
class AutoPassiveNoLoadFollowingDischargeTests(unittest.TestCase):
|
||||
"""AUTO bez allow_discharge_export: žádné plánované vybíjení do load (Deye PASSIVE)."""
|
||||
|
||||
def test_no_battery_export_on_inflated_baseline_without_discharge_mask(self) -> None:
|
||||
slots = [
|
||||
PlanningSlot(
|
||||
interval_start=datetime(2026, 5, 16, 9, 45, tzinfo=timezone.utc),
|
||||
buy_price=0.77,
|
||||
sell_price=0.09,
|
||||
pv_a_forecast_w=0,
|
||||
pv_b_forecast_w=0,
|
||||
load_baseline_w=8542,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
is_predicted_price=False,
|
||||
allow_charge=False,
|
||||
allow_discharge_export=False,
|
||||
)
|
||||
]
|
||||
battery = _battery(uc_wh=20_000.0, min_pct=10.0, arb_pct=20.0)
|
||||
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)
|
||||
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.45 * battery.usable_capacity_wh
|
||||
results, _, _ = solve_dispatch(
|
||||
slots,
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
tuv_delta_stats=None,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
self.assertEqual(len(results), 1)
|
||||
self.assertGreaterEqual(
|
||||
results[0].battery_setpoint_w,
|
||||
0,
|
||||
msg="must not plan load-following discharge when allow_discharge_export=false",
|
||||
)
|
||||
self.assertEqual(results[0].deye_physical_mode, "PASSIVE")
|
||||
self.assertGreaterEqual(
|
||||
results[0].grid_setpoint_w,
|
||||
0,
|
||||
msg="must not export at a loss when discharge is disallowed",
|
||||
)
|
||||
|
||||
|
||||
class TerminalSocShadowTests(unittest.TestCase):
|
||||
"""Terminal SoC shadow price v objective drží konec horizontu nad holým minimem."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user