chjo2
This commit is contained in:
@@ -1159,6 +1159,76 @@ class NegativeSellPvChargeTests(unittest.TestCase):
|
||||
"nabíjení má dominovat nad curtailmentem",
|
||||
)
|
||||
|
||||
def test_negative_sell_charges_from_plateau_soc_without_allow_charge_mask(self) -> None:
|
||||
"""BA81: allow_charge=false z DB nesmí vypnout shortfall — charge_slots z sell<0 + PV."""
|
||||
base = datetime(2026, 5, 24, 4, 15, tzinfo=timezone.utc)
|
||||
slots: list[PlanningSlot] = []
|
||||
for i in range(6):
|
||||
h = 6 + (i * 15) // 60
|
||||
m = (i * 15) % 60
|
||||
hour_f = max(0.0, min(1.0, (h + m / 60.0 - 6.0) / 14.0))
|
||||
safety = 3750.0 + 2500.0 * hour_f
|
||||
slots.append(
|
||||
PlanningSlot(
|
||||
interval_start=base + timedelta(minutes=15 * i),
|
||||
buy_price=3.088,
|
||||
sell_price=-0.3,
|
||||
pv_a_forecast_w=9000,
|
||||
pv_b_forecast_w=800,
|
||||
load_baseline_w=150,
|
||||
ev1_connected=False,
|
||||
ev2_connected=False,
|
||||
allow_charge=False,
|
||||
allow_discharge_export=False,
|
||||
safety_soc_target_wh=safety,
|
||||
is_daytime_pv_surplus_slot=True,
|
||||
future_sell_opportunity_czk_kwh=3.7,
|
||||
)
|
||||
)
|
||||
battery = _battery(uc_wh=12_500.0, terminal_soc_value_factor=0.2)
|
||||
battery.max_charge_power_w = 6_250
|
||||
battery.max_discharge_power_w = 6_250
|
||||
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.508 * battery.usable_capacity_wh
|
||||
results, _ms, snap = solve_dispatch(
|
||||
slots,
|
||||
battery,
|
||||
hp,
|
||||
grid,
|
||||
[None, None],
|
||||
vehicles,
|
||||
soc0,
|
||||
50.0,
|
||||
operating_mode="AUTO",
|
||||
)
|
||||
self.assertEqual(snap.get("planner_build_tag"), "2026-05-24-neg-sell-v2")
|
||||
self.assertGreater(
|
||||
results[0].battery_setpoint_w,
|
||||
5_500,
|
||||
f"od ~51 % SoC má první neg slot nabíjet max, got {[r.battery_setpoint_w for r in results]}",
|
||||
)
|
||||
|
||||
|
||||
class AutoPvSurplusExportTests(unittest.TestCase):
|
||||
"""Plná baterie + vysoká FVE: export přebytku (ge_pv), ne curtailment, bez SELL."""
|
||||
|
||||
Reference in New Issue
Block a user