From d8a370290293ec3dbf6583a4157f53fd64f20cad Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 25 May 2026 17:04:38 +0000 Subject: [PATCH] =?UTF-8?q?Slice=2069:=201:1=20windows=20expansion=20in=20?= =?UTF-8?q?cohort=20000474=20(5=20=E2=86=92=207=20entries)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes the `sap_windows: LEN 7 vs 5` divergence by replacing the cohort hand-built's glazing-type-collapsed 5-window encoding with 7 SapWindow entries mirroring the Summary §11 1:1 — the same row breakdown the Elmhurst mapper extracts. Per-window curtain-transform U_eff aggregates to the same total as before: Group g=0.72/U=2.0: 6.22 m² across 4 rows (was 3 rows × wider W) Group g=0.76/U=2.8: 5.50 m² across 3 rows (was 2 rows × wider W) Cascade output is unchanged — all 11 cohort 000474 SapResult pins remain GREEN at 1e-4. The per-bp window apportionment from Slice 59 (`_window_bp_index` in heat_transmission_from_cert) handles both the prior int-zero `window_location` and the new "Main"/"Nth Extension" str locations the mapper surfaces; cohort 000474 has uniform per-bp wall U so the apportionment is heat-loss-invariant either way. Surfaces a previously-hidden gap: now that the LEN matches, the diff test reveals **49 per-window sub-field divergences** between the cohort `make_window` helper (API-style int codes for `glazing_type`, `window_type`, `window_wall_type`, `glazing_gap`, `data_source`, bool `permanent_shutters_present`, None `frame_factor`) and the Elmhurst mapper (Summary-style strings for the same fields + `frame_factor=0.7`). That's the next chunk to address — most likely path: normalise the Elmhurst mapper to produce API-style int codes for the window descriptive fields, so both mappers produce the same dataclass shape. The cascade reads `window_transmission_details.u_value` / `solar_transmittance` + `window_width` × `window_height` + `orientation` + `window_location` — none of the descriptive divergences listed above affect SAP output. Diff count: 1 → 49 (surface, not regression). Cohort cascade pins green; pyright 0 errors on the fixture. Co-Authored-By: Claude Opus 4.7 --- .../tests/_elmhurst_worksheet_000474.py | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/domain/src/domain/sap/worksheet/tests/_elmhurst_worksheet_000474.py b/packages/domain/src/domain/sap/worksheet/tests/_elmhurst_worksheet_000474.py index 8b2d8dbd..970cbf90 100644 --- a/packages/domain/src/domain/sap/worksheet/tests/_elmhurst_worksheet_000474.py +++ b/packages/domain/src/domain/sap/worksheet/tests/_elmhurst_worksheet_000474.py @@ -401,20 +401,41 @@ LINE_73_M_TOTAL_INTERNAL_GAINS_W: tuple[float, ...] = ( # ============================================================================ # §6 Solar gains — cert-derived inputs + expected outputs # ============================================================================ -# 5 wall windows across 2 glazing types (Manufacturer-declared g⊥): -# "Double between 2002" g=0.72: E 3.74, SE 0.50, NW 1.98 -# "Double with unknown" g=0.76: E 3.74, NW 1.76 -# All PVC frame. No roof windows, no rooflights. +# 7 wall windows mirroring the Summary §11 1:1, matching the Elmhurst +# mapper's per-row extraction (mapper-vs-hand-built field-parity test). +# Per-window curtain-transform U_eff sums to the same total as the prior +# 5-window collapsed encoding (same total area per glazing-type group: +# g=0.72/U=2.0 → 6.22 m² across 4 rows; g=0.76/U=2.8 → 5.50 m² across +# 3 rows). Cascade output is unchanged at 1e-4. +# +# `window_location` carries the string bp identifier the Elmhurst mapper +# surfaces ("Main", "1st Extension", "2nd Extension") — the per-bp +# window apportionment in `heat_transmission_from_cert` (Slice 59) +# routes via `_window_bp_index` which handles both the str and int +# encodings; cohort 000474 has uniform wall U so the apportionment is +# heat-loss-invariant. SECTION_6_VERTICAL_WINDOWS: tuple[SapWindow, ...] = ( - # Windows 1 (PDF (27) U_eff=1.8519, raw U=2.0 post-2002 default; g_⊥=0.72): - # 3 entries, total area 6.22 m². - make_window(orientation=3, width=3.74, height=1.0, solar_transmittance=0.72, u_value=2.0), - make_window(orientation=4, width=0.50, height=1.0, solar_transmittance=0.72, u_value=2.0), - make_window(orientation=8, width=1.98, height=1.0, solar_transmittance=0.72, u_value=2.0), - # Windows 2 (PDF (27) U_eff=2.5180, raw U=2.8 pre-2002 default; g_⊥=0.76): - # 2 entries, total area 5.50 m². make_window default u_value=2.8 matches. - make_window(orientation=3, width=3.74, height=1.0, solar_transmittance=0.76), - make_window(orientation=8, width=1.76, height=1.0, solar_transmittance=0.76), + # Windows 1(Ext1) — NW + make_window(orientation=8, width=1.98, height=1.0, solar_transmittance=0.72, + u_value=2.0, window_location="1st Extension"), + # Windows 2(Ext1) — NW + make_window(orientation=8, width=1.76, height=1.0, solar_transmittance=0.76, + u_value=2.8, window_location="1st Extension"), + # Windows 3(Ext1) — E + make_window(orientation=3, width=1.98, height=1.0, solar_transmittance=0.72, + u_value=2.0, window_location="1st Extension"), + # Windows 3(Main) — E (0.50) + make_window(orientation=3, width=0.50, height=1.0, solar_transmittance=0.76, + u_value=2.8, window_location="Main"), + # Windows 3(Main) — E (1.76) + make_window(orientation=3, width=1.76, height=1.0, solar_transmittance=0.72, + u_value=2.0, window_location="Main"), + # Windows 3(Main) — SE (0.50) + make_window(orientation=4, width=0.50, height=1.0, solar_transmittance=0.72, + u_value=2.0, window_location="Main"), + # Windows 3(Ext2) — E + make_window(orientation=3, width=3.24, height=1.0, solar_transmittance=0.76, + u_value=2.8, window_location="2nd Extension"), ) SECTION_6_ROOF_WINDOWS: tuple[RoofWindowInput, ...] = () SECTION_6_ROOFLIGHTS: tuple[RooflightInput, ...] = ()