Model/tests/domain/modelling
Khalim Conn-Kowlessar f869a1f6a7 modelling: glazing overlay models draught-proofing + frame-factor re-lodge
Fitting sealed glazing units changes two things beyond the pane's U/g
that the cascade reads, which the overlay didn't model — leaving the
double/secondary before→after pins ~0.7 SAP short (xfail):

1. Draught-proofing (RdSAP 10 §8.1). Sealed units draught-proof the panes
   they replace, re-lodging the dwelling-level `percent_draughtproofed`
   (cert 001431: 84 → 100). The §2 cascade reads that dwelling-level
   value, so the overlay now carries it. `_recompute_percent_draughtproofed`
   anchors on the lodged before-% — `after = round((round(before%/100 × N)
   + flips) / N × 100)`, N = openable windows (vertical + roof) + doors,
   flips = upgraded panes that were not draught-proofed — so it's robust
   to incomplete window extraction (unchanged openings are already in the
   aggregate). ~0.3 SAP.

2. Frame factor (§6 solar gains). A replacement unit re-lodges its own
   FF=0.70, overriding the pane it replaced — the two "single glazing,
   known data" panes lodge FF 1.00 / 0.50 (one is 6.6 m²), so leaving them
   unchanged understated solar gains by ~+150 kWh space heating. `WindowOverlay`
   now carries `frame_factor`, written flat onto the window. ~0.4 SAP.

Wiring: `EpcSimulation.percent_draughtproofed` + `WindowOverlay.frame_factor`
new fields; `apply_simulations` / `_fold_window` write them; the glazing
generator computes both from the upgraded set and cert 001431's after.

Un-xfails `test_{double,secondary}_glazing_overlay_reproduces_the_relodged_after`
— both now pin SAP/CO2/PE to the relodged after within tolerance. Updates
the two `test_glazing_recommendation` overlay expectations for the new
`frame_factor`. 96 modelling tests pass; zero new pyright errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 18:02:48 +00:00
..
fixtures test(modelling): lighting before/after cascade pins (001431) at 1e-4 2026-06-05 12:27:36 +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_elmhurst_cascade_pins.py modelling: glazing overlay models draught-proofing + frame-factor re-lodge 2026-06-05 18:02:48 +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 modelling: glazing overlay models draught-proofing + frame-factor re-lodge 2026-06-05 18:02:48 +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_optimiser.py feat(modelling): ventilation-aware selection — price the forced dependency in 2026-06-03 16:16:26 +00:00
test_overlay_applicator.py feat(modelling): whole-dwelling LightingOverlay surface on EpcSimulation 2026-06-05 12:21:19 +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 feat(modelling): Plan carries baseline/post Bills and derives the energy figures 2026-06-03 17:23:20 +00:00
test_plan_valuation.py feat(modelling): wire Valuation Uplift onto the Plan 2026-06-04 08:59:04 +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_scoring.py refactor(modelling): expose cascade_scores for the role-3 + bill cascade 2026-06-03 17:54:54 +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