From dd9e3167960b1912f6523c8ef7b0a16f6bf8ca3e Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 15 Jul 2026 13:46:08 +0000 Subject: [PATCH] =?UTF-8?q?Take=20the=20full=20heat-network=20standing=20c?= =?UTF-8?q?harge,=20not=20both,=20when=20space=20heating=20is=20also=20on?= =?UTF-8?q?=20the=20network=20=F0=9F=9F=A9?= 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 | 46 +++++++++++++++++++ 1 file changed, 46 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 762f7bb40..578cb67de 100644 --- a/tests/domain/sap10_calculator/rdsap/test_cert_to_inputs.py +++ b/tests/domain/sap10_calculator/rdsap/test_cert_to_inputs.py @@ -9161,6 +9161,52 @@ def test_water_only_heat_network_half_charge_adds_to_the_dwellings_fuel_standing assert abs(total - 84.0) <= 1e-9 +def test_water_only_code_on_a_heat_network_space_main_takes_the_full_charge_not_both() -> None: + # Arrange — SAP 10.2 §C6's "unless" clause. A water-only WHC (950) can sit + # on a cert whose SPACE main is ALSO a heat network (SAP 301). C6 gives the + # half "unless the space heating is also a heat network (see next + # paragraph)", and that next paragraph (p.55) says "the total standing + # charge is the normal heat network standing charge" — £120 flat. + # + # So the half must NOT stack onto the full charge here: £180 would be the + # double-count this branch exists to prevent, and £120 is not additive with + # the dwelling's fuel standing either ("the TOTAL standing charge IS"). + from dataclasses import replace + + from domain.sap10_calculator.tables.table_12a import Tariff + + base = _typical_semi_detached_epc() + network_main = MainHeatingDetail( + has_fghrs=False, + main_fuel_type=20, # EPC mains gas (community) + heat_emitter_type=1, + emitter_temperature=1, + main_heating_control=2306, + main_heating_category=6, + sap_main_heating_code=301, # community boilers — a heat network + ) + epc = replace( + base, + sap_heating=make_sap_heating( + main_heating_details=[network_main], + water_heating_code=950, + water_heating_fuel=20, + ), + ) + + # Act + total = _standing_charges_total_gbp( + epc, + network_main, + main_fuel_code=20, + water_heating_fuel_code=20, + tariff=Tariff.STANDARD, + ) + + # Assert — the full £120, not £120 + £60. + assert abs(total - 120.0) <= 1e-9 + + def test_water_only_heat_network_half_charge_reaches_the_fuel_cost_worksheet() -> None: # Arrange — the §C6 half charge must reach worksheet (251), not just the # helper. A gas-boiler main (SAP 102, not a network) with WHC 950 keeps the