From b14fa31dde230c6d923f155d9ad0ccd657c6e7a7 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 15 Jul 2026 13:43:46 +0000 Subject: [PATCH] =?UTF-8?q?Charge=20the=20C6=20half=20heat-network=20stand?= =?UTF-8?q?ing=20charge=20on=20a=20water-only=20dwelling's=20off-peak=20fu?= =?UTF-8?q?el=20bill=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../rdsap/test_cert_to_inputs.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/domain/sap10_calculator/rdsap/test_cert_to_inputs.py b/tests/domain/sap10_calculator/rdsap/test_cert_to_inputs.py index fbdde3f29..762f7bb40 100644 --- a/tests/domain/sap10_calculator/rdsap/test_cert_to_inputs.py +++ b/tests/domain/sap10_calculator/rdsap/test_cert_to_inputs.py @@ -9189,6 +9189,45 @@ def test_water_only_heat_network_half_charge_reaches_the_fuel_cost_worksheet() - assert abs(fc.additional_standing_charges_gbp - 180.0) <= 1e-9 +def test_water_only_heat_network_half_charge_reaches_the_off_peak_standing_scalar() -> None: + # Arrange — cert 22032926 (22 Gwydyr Mansions) in shape: electric storage + # main (SAP 401) on a Dual meter + WHC 950. Off-peak certs take the zero + # `FuelCostResult` sentinel from `_fuel_cost` and cost via the scalar + # `standing_charges_gbp` instead, so the §C6 half must reach BOTH paths — + # this is the one the corpus cert actually bills through. + # + # The lodged `water_heating_fuel` 20 ("mains gas (community)") is NOT a + # Table 32 gas code, so note (a) draws no gas standing — the dwelling has + # no gas meter, only the Economy-7 electric one. Hence £24 today. + from dataclasses import replace + + base = _typical_semi_detached_epc() + storage_main = MainHeatingDetail( + has_fghrs=False, + main_fuel_type=29, # electricity + heat_emitter_type=0, + emitter_temperature=1, + main_heating_control=2401, + main_heating_category=7, # electric storage heaters + sap_main_heating_code=401, + ) + epc = replace( + base, + sap_energy_source=replace(base.sap_energy_source, meter_type="1"), # Dual + sap_heating=make_sap_heating( + main_heating_details=[storage_main], + water_heating_code=950, # DHW-only heat network (boilers) + water_heating_fuel=20, # EPC "mains gas (community)", as lodged + ), + ) + + # Act + standing: float = cert_to_inputs(epc).standing_charges_gbp + + # Assert — £24 off-peak electric (Table 12 note (a)) + £60 half (C6). + assert abs(standing - 84.0) <= 1e-9 + + def test_mev_default_data_iuf_is_table_329_system_type_10_value() -> None: # Arrange / Act — SAP 10.2 Table 4g note 3 (PDF p.176) directs the # default SFP to "the appropriate in-use factor for default data from