From c40679d1e191fb0b762e697a518ac15e896935c2 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 25 May 2026 20:55:09 +0000 Subject: [PATCH] Slice 88: thread bp.floor_construction_type into u_floor cascade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `u_floor` defaulted to the SOLID branch for age bands C+ when both `construction` (int code) and `description` were None, regardless of whether the bp's own `floor_construction_type` field said "Suspended timber". This produced U=0.60 for cert 001479 Main vs the worksheet's U=0.65 — a -0.05 W/m²K delta × 30.45 m² → -1.52 W/K of fabric loss shortfall. Fix: in `heat_transmission_section_from_cert`, prefer the bp's `floor_construction_type` string over the global `epc.floors[]. description` when computing the per-bp floor U. The bp-level field is the per-part lodgement Elmhurst surfaces in §3 / §9 of the Summary; the global `epc.floors` list is often empty when the mapper sources data from a Summary PDF rather than the full RdSAP API JSON. Impact on cert 001479 Summary → mapper → cascade SAP delta: BEFORE Slice 88: +0.2290 (floor U 0.60 vs target 0.65) AFTER Slice 88: +0.0898 (floor exact match; only roof gap left) Floor W/K breakdown for cert 001479 (mapper path): was: 21.6480 target 23.1705 delta -1.5225 now: 23.1705 target 23.1705 delta +0.0000 ✓ EXACT Cohort cascade pins remain GREEN (66 of 66) — the cohort hand-builts already set `floor_construction_type` on their Main bp via the Slice 72/75/78/82/85 Cat A bulk updates, so the new code path applies the same suspended-timber branch that previous paths reached via either explicit `floor_construction` int codes or the age-band default (cohort certs are all age B which is in `_SUSPENDED_TIMBER_DEFAULT_BANDS`, so they hit the suspended branch either way; cert 001479 is age C and needs the explicit string). Pyright net-zero on heat_transmission.py (13 → 13 errors). Co-Authored-By: Claude Opus 4.7 --- .../domain/sap/worksheet/heat_transmission.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/domain/src/domain/sap/worksheet/heat_transmission.py b/packages/domain/src/domain/sap/worksheet/heat_transmission.py index 37a3f935..1c302c61 100644 --- a/packages/domain/src/domain/sap/worksheet/heat_transmission.py +++ b/packages/domain/src/domain/sap/worksheet/heat_transmission.py @@ -496,12 +496,26 @@ def heat_transmission_from_cert( age_band=age_band, insulation_thickness_mm=floor_ins_thickness ) else: + # The per-bp `floor_construction_type` lodgement ("Suspended + # timber" / "Solid") takes precedence over the global + # `epc.floors[].description` when present — it's the explicit + # per-part lodgement Elmhurst surfaces in §3 / §9 of the + # Summary PDF (cf. cert 001479 Main: floor_construction_type + # = "Suspended timber" age C; the cascade's `u_floor` + # otherwise defaults to the solid branch for age bands C+ + # without an explicit signal, producing a U=0.60 vs the + # worksheet's suspended-timber U=0.65). + effective_floor_description = ( + part.floor_construction_type + if part.floor_construction_type + else floor_description + ) uf = u_floor( country=country, age_band=age_band, construction=floor_construction, insulation_thickness_mm=floor_ins_thickness, area_m2=floor_area, perimeter_m=floor_perimeter, wall_thickness_mm=part.wall_thickness_mm, - description=floor_description, + description=effective_floor_description, ) upw = u_party_wall(party_wall_construction=party_construction) # Per-bp `y` for backwards compat: when the bp's own age band