Model/datatypes
Khalim Conn-Kowlessar 358b4dcd01 Slice S0380.57: Elmhurst mapper infers electricity fuel for electric SAP main heating codes
Elmhurst §14.0 leaves "Fuel Type" empty for electric main heating
systems (heat pumps, electric boilers, storage heaters, electric
underfloor, warm-air HPs) — the SAP code identifies the carrier
directly. The mapper was reading the empty string via
`_elmhurst_main_fuel_int(mh.fuel_type)` → None, and downstream
`_main_fuel_code` returned None, so Table 32 unit-price lookups
defaulted to mains gas. Cert 000565 (HP Main 1, SAP code 224) was
being charged 29,353 kWh/yr of electricity at the gas tariff —
£0.0364/kWh instead of £0.165/kWh.

New `_ELECTRIC_SAP_MAIN_HEATING_CODES` frozen set covers the Table
4a electric carrier rows:
  191-196  Electric boilers
  211-217, 221-227  Heat pumps (224 = ASHP 2013+, 1.70 COP)
  401-409  Electric storage heaters
  421-425  Electric underfloor heating
  521-527  Warm-air heat pumps

Inference fires in both Main 1 (`_map_elmhurst_sap_heating`) and
Main 2 (`_map_elmhurst_main_heating_2`) construction paths — when
`_elmhurst_main_fuel_int(fuel_type)` returns None AND the SAP code
is in the electric set, fall back to `_STANDARD_ELECTRICITY_FUEL_
CODE = 30` (Table 12 row "Electricity, standard tariff").

Cert 000565 cascade impact (compounding with S0380.56):
- sap_score:                 71  → 30  (target 29 → Δ +1.7;  was Δ +44)
- sap_score_continuous:      71.42 → 30.21  (target 28.51 → Δ +1.70; was Δ +42.91)
- ecf:                        2.05 → 5.22  (target 5.39  → Δ −0.17; was Δ −3.34)
- total_fuel_cost_gbp:    1,423.80 → 3,624.64 (target 4,680.26 → Δ −1,055.62; was Δ −3,256.46)
- co2_kg_per_yr:          7,181.62 → 5,009.47 (target 6,447.63 → Δ −1,438.16; was Δ +733.99)
                          (now undershooting — independent cascade gap
                           around Table 12d monthly electric CO2 factor
                           interpolation; separate slice)

Single-main non-HP certs: no behavioural change (`fuel_type` lodged
explicitly for gas/oil boilers → `_elmhurst_main_fuel_int` returns
non-None → inference branch not entered). Cohort regression check:
472 pass + 10 expected 000565 fails — no regression.

Spec source: SAP 10.2 Table 4a main heating SAP codes + Table 12 fuel
codes (electricity, standard tariff = 30). Heat-pump cohort efficiency
values cross-referenced in `domain/sap10_ml/sap_efficiencies.py:42-44`.

Pyright net-zero on mapper.py (32 / 32).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 16:28:47 +00:00
..
epc Slice S0380.57: Elmhurst mapper infers electricity fuel for electric SAP main heating codes 2026-06-01 16:28:47 +00:00
magicplan typing and renaming 🟪 2026-05-07 13:26:49 +00:00
__init__.py further breaking up code 2023-07-20 12:24:34 +01:00
datatypes.py further breaking up code 2023-07-20 12:24:34 +01:00
enums.py completed build of new demo portfolio - some fixed required still 2023-11-20 14:42:16 +00:00