fix BA a KV nefunkcni vecerni prodej
Some checks failed
CI and deploy / migration-check (push) Failing after 24s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-24 10:49:35 +02:00
parent ce571a93fa
commit bd06779fe5
4 changed files with 141 additions and 7 deletions

View File

@@ -1222,7 +1222,7 @@ class NegativeSellPvChargeTests(unittest.TestCase):
50.0,
operating_mode="AUTO",
)
self.assertEqual(snap.get("planner_build_tag"), "2026-05-24-neg-sell-v3")
self.assertEqual(snap.get("planner_build_tag"), "2026-05-24-evening-export-v4")
self.assertGreater(
results[0].battery_setpoint_w,
5_500,
@@ -1234,6 +1234,64 @@ class NegativeSellPvChargeTests(unittest.TestCase):
"neg okno má dobít na planner soc_max, ne ~92 %",
)
def test_fixed_tariff_evening_export_when_sell_above_buy(self) -> None:
"""BA81: sell 3,7 > buy 3,088 musí exportovat (acq 3,61 + 0,3 by dříve blokovalo)."""
slots = [
PlanningSlot(
interval_start=datetime(2026, 5, 24, 17, 0, tzinfo=timezone.utc),
buy_price=3.088,
sell_price=3.75,
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.613,
)
]
battery = _battery(uc_wh=12_500.0, terminal_soc_value_factor=0.0)
battery.max_discharge_power_w = 6_250
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=16_000,
block_export_on_negative_sell=False,
)
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.95 * battery.usable_capacity_wh
results, _ms, _ = solve_dispatch(
slots,
battery,
hp,
grid,
[None, None],
vehicles,
soc0,
50.0,
operating_mode="AUTO",
)
r0 = results[0]
self.assertLess(r0.grid_setpoint_w, 0, "očekáván export do sítě")
self.assertEqual(r0.export_mode, "BATTERY_SELL")
class AutoPvSurplusExportTests(unittest.TestCase):
"""Plná baterie + vysoká FVE: export přebytku (ge_pv), ne curtailment, bez SELL."""