deye ridi maximalni flow do baterie hlavne z gridu
This commit is contained in:
@@ -259,5 +259,58 @@ class PlanningDispatchMilpTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
def test_grid_import_cap_allows_full_bms_charge_above_breaker(self) -> None:
|
||||
"""
|
||||
Cheap buy, load 3.7 kW, PV malé → breaker 17 kW limituje gi, ale bc musí moct být
|
||||
plných BMS 18 kW (Deye reg 128 + firmware throttling chrání jistič fyzicky).
|
||||
"""
|
||||
slots = [
|
||||
_slot(load=3700, buy=0.4, sell=-0.3, pv_a=0, pv_b=1500),
|
||||
_slot(load=2000, buy=5.0, sell=4.5, pv_a=0, pv_b=0),
|
||||
_slot(load=2000, buy=5.0, sell=4.5, pv_a=0, pv_b=0),
|
||||
]
|
||||
battery = _battery(uc_wh=64_000.0, min_pct=12.0, arb_pct=20.0)
|
||||
battery.max_charge_power_w = 18_000
|
||||
battery.max_discharge_power_w = 18_000
|
||||
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=13_500)
|
||||
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.55 * battery.usable_capacity_wh
|
||||
results, _ms = solve_dispatch(
|
||||
slots,
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
tuv_delta_stats=None,
|
||||
operating_mode="AUTO",
|
||||
price_failsafe_active=False,
|
||||
)
|
||||
self.assertEqual(len(results), 3)
|
||||
self.assertGreaterEqual(
|
||||
results[0].battery_setpoint_w,
|
||||
17_500,
|
||||
msg="LP must be able to target near-BMS-max charge even when gi would exceed breaker",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user