mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Lock whole-meter off-peak routing and standard-meter no-op 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
05977ee3ce
commit
d3a4426ca4
1 changed files with 47 additions and 0 deletions
|
|
@ -184,3 +184,50 @@ def test_off_peak_heating_line_carries_its_carrier_and_high_rate_fraction() -> N
|
|||
9000.0,
|
||||
0.0,
|
||||
)
|
||||
|
||||
|
||||
def test_off_peak_meter_routes_every_electric_use_to_the_off_peak_carrier() -> None:
|
||||
# Arrange — a gas-heated dwelling that happens to be on an Off-Peak Meter:
|
||||
# the gas heating stays gas, but ALL electric uses (lighting, appliances,
|
||||
# pumps) bill on the off-peak carrier, the "other" uses sharing the
|
||||
# ALL_OTHER_USES fraction and pumps/fans carrying their own.
|
||||
result = _sap_result(
|
||||
main_heating_fuel_kwh_per_yr=8000.0,
|
||||
main_heating_fuel_code=1, # mains gas — single-rate, unaffected
|
||||
lighting_kwh_per_yr=400.0,
|
||||
appliances_kwh_per_yr=1900.0,
|
||||
pumps_fans_kwh_per_yr=200.0,
|
||||
is_off_peak_meter=True,
|
||||
other_electricity_high_rate_fraction=0.90,
|
||||
pumps_fans_high_rate_fraction=0.71,
|
||||
)
|
||||
|
||||
# Act
|
||||
breakdown = EnergyBreakdown.from_sap_result(result)
|
||||
|
||||
# Assert
|
||||
by_section = {line.section: line for line in breakdown.lines}
|
||||
assert by_section[BillSection.HEATING].fuel is Fuel.MAINS_GAS
|
||||
assert by_section[BillSection.HEATING].high_rate_fraction is None
|
||||
assert by_section[BillSection.LIGHTING].fuel is Fuel.ELECTRICITY_OFF_PEAK
|
||||
assert by_section[BillSection.LIGHTING].high_rate_fraction == 0.90
|
||||
assert by_section[BillSection.APPLIANCES].fuel is Fuel.ELECTRICITY_OFF_PEAK
|
||||
assert by_section[BillSection.APPLIANCES].high_rate_fraction == 0.90
|
||||
assert by_section[BillSection.PUMPS_FANS].high_rate_fraction == 0.71
|
||||
|
||||
|
||||
def test_standard_meter_keeps_electric_uses_on_flat_rate_electricity() -> None:
|
||||
# Arrange — electric heating on a standard meter: no day/night split anywhere.
|
||||
result = _sap_result(
|
||||
main_heating_fuel_kwh_per_yr=6000.0,
|
||||
main_heating_fuel_code=30, # standard-tariff electricity
|
||||
lighting_kwh_per_yr=400.0,
|
||||
is_off_peak_meter=False,
|
||||
)
|
||||
|
||||
# Act
|
||||
breakdown = EnergyBreakdown.from_sap_result(result)
|
||||
|
||||
# Assert — every line is flat-rate ELECTRICITY with no high-rate fraction.
|
||||
assert all(line.fuel is Fuel.ELECTRICITY for line in breakdown.lines)
|
||||
assert all(line.high_rate_fraction is None for line in breakdown.lines)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue