planovac reesi load first
Some checks failed
CI and deploy / migration-check (push) Failing after 21s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-26 09:05:33 +02:00
parent b4e5fc5040
commit 94eb256598
5 changed files with 71 additions and 14 deletions

View File

@@ -1414,7 +1414,7 @@ class NegativeSellPvChargeTests(unittest.TestCase):
50.0,
operating_mode="AUTO",
)
self.assertEqual(snap.get("planner_build_tag"), "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap.get("planner_build_tag"), PLANNER_BUILD_TAG)
self.assertGreater(
results[0].battery_setpoint_w,
2_500,
@@ -1564,7 +1564,7 @@ class NegativeSellPvChargeTests(unittest.TestCase):
50.0,
operating_mode="AUTO",
)
self.assertEqual(snap.get("planner_build_tag"), "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap.get("planner_build_tag"), PLANNER_BUILD_TAG)
self.assertEqual(len(results), len(slots))
def test_gen_cutoff_full_soc_neg_sell_with_pv_b_feasible(self) -> None:
@@ -1628,7 +1628,7 @@ class NegativeSellPvChargeTests(unittest.TestCase):
55.0,
operating_mode="AUTO",
)
self.assertEqual(snap.get("planner_build_tag"), "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap.get("planner_build_tag"), PLANNER_BUILD_TAG)
self.assertEqual(len(results), len(slots))
def test_fixed_tariff_neg_sell_no_grid_export(self) -> None:
@@ -2314,7 +2314,7 @@ class ChargeAcquisitionArbitrageTests(unittest.TestCase):
50.0,
operating_mode="AUTO",
)
self.assertEqual(snap["planner_build_tag"], "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap["planner_build_tag"], PLANNER_BUILD_TAG)
peak_idx = sells.index(4.04)
peak = results[peak_idx]
self.assertIn(peak.export_mode, ("BATTERY_SELL", "PV_SURPLUS"))
@@ -2392,7 +2392,7 @@ class ChargeAcquisitionArbitrageTests(unittest.TestCase):
50.0,
operating_mode="AUTO",
)
self.assertEqual(snap["planner_build_tag"], "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap["planner_build_tag"], PLANNER_BUILD_TAG)
r_midnight = results[2]
self.assertEqual(r_midnight.export_mode, "BATTERY_SELL")
self.assertGreaterEqual(abs(r_midnight.grid_setpoint_w), 12_500)
@@ -2435,7 +2435,7 @@ class ChargeAcquisitionArbitrageTests(unittest.TestCase):
50.0,
operating_mode="AUTO",
)
self.assertEqual(snap["planner_build_tag"], "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap["planner_build_tag"], PLANNER_BUILD_TAG)
r = results[0]
self.assertEqual(r.export_mode, "BATTERY_SELL")
self.assertGreaterEqual(abs(r.grid_setpoint_w), 12_500)
@@ -3114,6 +3114,34 @@ class LoadFirstDispatchTests(unittest.TestCase):
)
self.assertEqual(r.export_mode, "PV_SURPLUS")
def test_neg_sell_prep_no_fictitious_grid_import_for_load(self) -> None:
"""sell<0 prep: FVE >> load → dům z PV, ne grid_setpoint == load_baseline."""
base = datetime(2026, 5, 26, 7, 45, tzinfo=timezone.utc)
slots = [
PlanningSlot(
interval_start=base,
buy_price=1.45,
sell_price=-0.07,
pv_a_forecast_w=3137,
pv_b_forecast_w=3418,
load_baseline_w=447,
ev1_connected=False,
ev2_connected=False,
allow_charge=True,
allow_discharge_export=False,
)
]
bat = _battery(uc_wh=64_000.0, max_pct=95.0)
bat.planner_neg_sell_prep_soc_percent = 80.0
bat.planner_neg_sell_full_soc_tail_slots = 4
r = self._solve_auto(slots, bat, 0.24 * bat.soc_max_wh)[0]
self.assertLessEqual(
abs(r.grid_setpoint_w),
100,
msg="tvrdý load-first: žádný fiktivní import = load při vysoké FVE",
)
self.assertGreater(r.battery_setpoint_w, 3000)
class PreNegativeSellExportTests(unittest.TestCase):
"""Před prvním sell<0: export přebytku (BA81/KV1 strategie), ne nabíjení + pozdní vývoz."""
@@ -3211,7 +3239,7 @@ class Home01PvStoreValueTests(unittest.TestCase):
results, _, snap = solve_dispatch(
slots, battery, hp, grid, [None, None], vehicles, 0.55 * battery.soc_max_wh, 50.0, operating_mode="AUTO"
)
self.assertEqual(snap["planner_build_tag"], "2026-05-28-neg-sell-soc-phases-v32")
self.assertEqual(snap["planner_build_tag"], PLANNER_BUILD_TAG)
r0 = results[0]
self.assertLess(
r0.pv_a_curtailed_w,