From fa036a21abdd3e13cf7bfccd225826a7f6d93016 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 28 May 2026 23:02:25 +0000 Subject: [PATCH] Slice S0380.59: cascade WHC 914 routing extended to _hot_water_fuel_cost_gbp_per_kwh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Final routing site missed in Slice S0380.56 — the `_hot_water_fuel_cost_gbp_per_kwh` argument at the input-builder call site was still passing `epc.sap_heating.water_heating_fuel` and `main` (= Main 1) directly, bypassing the WHC 914 helpers. For cert 000565 (WHC 914 + HP Main 1 + gas combi Main 2 with empty `epc.sap_heating.water_heating_fuel`): - Before: helper received `water_heating_fuel=None, main=Main 1`, fell through to `_fuel_cost_gbp_per_kwh(Main 1, prices)` = electric tariff (£0.165/kWh) — HW kWh × £0.165 over-counted vs the actual gas-combi DHW route. - After: helper receives `water_heating_fuel=26 (mains gas), main=Main 2`. Tariff resolves to Table 32 mains-gas rate £0.0364/kWh. Cert 000565 cascade impact: - hot_water_fuel_cost_gbp_per_kwh: 0.1649 → 0.0364 (correct gas tariff) - total_fuel_cost_gbp: 4,116.21 → 3,598.75 (HW component dropped by 4026 × (0.165 - 0.036) ≈ £518; the cascade was over-billing HW at electric rates). - Δ vs expected: −564 → −1,081 (cost is now further from the worksheet because the surplus HW electric-charge was masking Main 1's HP-on-E7 tariff bug — the cascade applies the `e7_low_rate` rate to HP electricity, which is wrong; HPs run on demand, not overnight. Next slice will exempt category=4 heat pumps from the off-peak override.) Single-main certs: behavioural identical — `_water_heating_fuel_ code(epc)` falls back to the explicit `epc.sap_heating.water_ heating_fuel`, and `_water_heating_main(epc)` returns Main 1. Cohort regression check: 249 pass + 10 expected 000565 fails — no regression. Pyright net-zero (34 / 34). Co-Authored-By: Claude Opus 4.7 --- domain/sap10_calculator/rdsap/cert_to_inputs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/domain/sap10_calculator/rdsap/cert_to_inputs.py b/domain/sap10_calculator/rdsap/cert_to_inputs.py index a873e5f9..bd33cecc 100644 --- a/domain/sap10_calculator/rdsap/cert_to_inputs.py +++ b/domain/sap10_calculator/rdsap/cert_to_inputs.py @@ -3282,8 +3282,8 @@ def cert_to_inputs( main, epc.sap_energy_source.meter_type, prices ), hot_water_fuel_cost_gbp_per_kwh=_hot_water_fuel_cost_gbp_per_kwh( - epc.sap_heating.water_heating_fuel, - main, + _water_heating_fuel_code(epc), + _water_heating_main(epc), epc.sap_energy_source.meter_type, prices, ),