Slice S0380.59: cascade WHC 914 routing extended to _hot_water_fuel_cost_gbp_per_kwh

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 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-05-28 23:02:25 +00:00 committed by Jun-te Kim
parent 10437143c4
commit fa036a21ab

View file

@ -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,
),