Model/tests/domain/modelling
Khalim Conn-Kowlessar fc7c4d2d3b fix(climate): compute EPC CO2/PE on the postcode demand cascade (SAP 10.2 Appendix U p.124)
The SAP/EI rating is computed on UK-average weather (Appendix U Tables
U1-U3 region 0) so ratings are nationally comparable, but Appendix U
paragraph 1 (PDF p.124) requires that "other calculations (such as for
energy use and costs on EPCs) are done using local weather. Weather data
for each postcode district are taken from the PCDB". `Sap10Calculator.
calculate` ran ONE cascade (UK-average) and fed it to SAP, CO2 AND primary
energy, so every cert's EPC-displayed CO2/PE were computed on the wrong
climate. Because most of England is warmer than the UK-average, this
systematically OVER-counted heating demand on the emissions/PE outputs.

The two cascades (`cert_to_inputs` rating, `cert_to_demand_inputs`
postcode) already existed; this wires the demand cascade into the
production entry point and grafts its CO2/PE onto the rating result (SAP
unchanged). The corpus gauge's longstanding +5% CO2/PE over-estimate was
mostly this climate bug, NOT (as previously diagnosed) per-cert mapper
fidelity:
  CO2 MAE 0.26 -> 0.12 t/yr  (bias +0.18 -> +0.04)
  PE  MAE 13.6 -> 3.8 kWh/m2 (bias +9.0  -> +0.24)
  SAP within-0.5 = 69.7% (rating cascade, unchanged)

Worksheet-validated to 1e-4 on simulated case 45 (heat-pump ground-floor
flat, postcode W6): the P960 prints the current dwelling twice — Block 1
on UK-average weather (SAP 60.5318, CO2 692.13) and Block 2 on postcode
weather (CO2 626.78, PE 6581.59). Both reproduce exactly. Added a tracked
case-45 Summary fixture + two-cascade cascade pin as a permanent guard,
and ratcheted the corpus CO2/PE ceilings to 0.13 / 4.2. The e2e Elmhurst
suite (Block-1 line refs) now pins the rating cascade directly; the two
Vaillant overlay snapshots refreshed to demand-cascade CO2/PE.

pyright not installed in this codespace (strict gate not run locally);
change is type-trivial (dataclasses.replace over SapResult).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:15:34 +00:00
..
fixtures feat(modelling): system tune-up options (standard + zone controls) 2026-06-10 10:20:46 +00:00
__init__.py feat(modelling): Overlay Applicator folds EpcSimulation onto EpcPropertyData 2026-06-02 22:13:51 +00:00
_elmhurst_recommendation.py test(modelling): Elmhurst before/after cascade pin for cavity wall (#1154) 2026-06-03 09:36:53 +00:00
test_ashp_cost_inputs.py feat(modelling): classify ASHP existing system by fuel code 2026-06-06 21:10:45 +00:00
test_considered_measures.py feat(modelling): drive measure scoping from the Scenario's exclusions 2026-06-16 15:26:25 +00:00
test_elmhurst_cascade_pins.py fix(climate): compute EPC CO2/PE on the postcode demand cascade (SAP 10.2 Appendix U p.124) 2026-06-18 14:15:34 +00:00
test_floor_recommendation.py refactor(modelling): group domain/modelling into generators/scoring/optimisation 2026-06-03 13:48:36 +00:00
test_glazing_recommendation.py feat(modelling): detect single-glazing code 15 + glazing before/after pins 2026-06-05 11:23:57 +00:00
test_heating_cost_inputs.py feat(modelling): composite per-dwelling boiler + tune-up costing (ADR-0027) 2026-06-10 19:41:06 +00:00
test_heating_recommendation.py fix(modelling): offer ASHP when the catalogue has no ASHP row 2026-06-16 14:55:41 +00:00
test_lighting_recommendation.py feat(modelling): recommend_lighting upgrades all non-LED bulbs to LED 2026-06-05 12:23:27 +00:00
test_measure_dependency.py refactor(modelling): ventilation_dependency delegates to the generator + wraps 2026-06-03 14:04:17 +00:00
test_measure_type.py feat(modelling): secondary-heating-removal generator + MeasureType (ADR-0028) 2026-06-11 13:35:14 +00:00
test_optimiser.py refactor(modelling): type measure_type fields as MeasureType 2026-06-08 20:13:31 +00:00
test_overlay_applicator.py feat(modelling): SecondaryHeatingOverlay clears the lodged secondary (ADR-0028) 2026-06-11 13:13:20 +00:00
test_package_scorer.py feat(modelling): Score carries the scored SapResult for billing 2026-06-03 17:20:45 +00:00
test_plan.py refactor(modelling): type measure_type fields as MeasureType 2026-06-08 20:13:31 +00:00
test_plan_valuation.py feat(modelling): wire Valuation Uplift onto the Plan 2026-06-04 08:59:04 +00:00
test_products.py feat(modelling): composite per-dwelling boiler + tune-up costing (ADR-0027) 2026-06-10 19:41:06 +00:00
test_roof_recommendation.py feat(modelling): room-in-roof safety guard defers the roof generator 2026-06-05 10:06:08 +00:00
test_scenario.py feat(modelling): drive measure scoping from the Scenario's exclusions 2026-06-16 15:26:25 +00:00
test_scoring.py refactor(modelling): type measure_type fields as MeasureType 2026-06-08 20:13:31 +00:00
test_secondary_heating_recommendation.py feat(modelling): secondary-heating-removal generator + MeasureType (ADR-0028) 2026-06-11 13:35:14 +00:00
test_solar_config_selection.py feat(modelling): conservative PV config selection (5-config spread) 2026-06-08 10:02:15 +00:00
test_solar_overshading.py feat(modelling): generation-calibrated PV overshading derivation 2026-06-08 09:59:48 +00:00
test_solar_potential.py feat(modelling): typed SolarPotential projection over Google buildingInsights 2026-06-08 09:55:55 +00:00
test_solar_products.py feat(modelling): Products.solar_bundle_cost + committed solar rate sheet 2026-06-08 12:10:27 +00:00
test_solar_recommendation.py feat(modelling): recommend_solar — eligibility + competing array Options 2026-06-08 12:14:24 +00:00
test_valuation.py feat(modelling): ValuationUplift domain class (percentage-primary) 2026-06-04 08:33:19 +00:00
test_ventilation_recommendation.py feat(modelling): ventilation Recommendation Generator (detect + price) 2026-06-03 14:01:14 +00:00
test_wall_recommendation.py feat(modelling): explicit park-home guard in the solid-wall generator 2026-06-05 10:49:50 +00:00
test_window_extraction_001431.py fix(extractor): capture all 17 openable §11 windows on cert 001431 2026-06-05 14:33:25 +00:00