Model/domain
Khalim Conn-Kowlessar 6dfe133e68 Slice S0380.110: per-rooflight g_L in Appendix L L2a (SAP 10.2 p.88)
SAP 10.2 Appendix L §L2a (PDF p.88) verbatim:

    GL = 0.9 × Σ (Aw × gL × FF × ZL) / TFA                  (L2a)

    where
      FF is the frame factor (fraction of window that is glazed) for
          the actual window or from Table 6c
      Aw is the area of a window, m²
      gL is the light transmittance factor from Table 6b
      ZL is the light access factor from Table 6d

Table 6b gL (PDF p.178) — light transmittance column:
  Single glazed                     0.90
  Double glazed (any variant)       0.80
  Triple glazed (any variant)       0.70

Table 6d note 2 (PDF p.178): "A solar access factor of 1.0 and a light
access factor of 1.0 should be used for roof windows/rooflights."

Pre-slice `_daylight_factor_from_cert` collapsed every rooflight into
a single `rooflight_total_area_m2 × _G_LIGHT_DEFAULT (0.80) ×
_FRAME_FACTOR_DEFAULT (0.70)` product, overcounting any Triple-glazed
rooflight (gL=0.70) or any non-default frame factor.

Cert 000565 §11 lodges 2 rooflights (per S0380.107 routing):
  Item 2 (Ext2 NR rooflight): 1.2 m², "Triple between 2002 and 2021",
    PVC FF=0.70 → gL=0.70 (Table 6b Triple). Correct numerator
    contribution 1.2 × 0.70 × 0.70 = 0.588; pre-slice cascade used
    1.2 × 0.80 × 0.70 = 0.672 (+0.084 over).
  Item 5 (Ext4 A rooflight): 0.5 m², "Double between 2002 and 2021",
    Wood FF=0.70 → gL=0.80 (Table 6b Double). Already matched.

The +0.084 numerator delta lowered GL → lowered C_daylight → lowered
worksheet (232) by 2.17 kWh/yr.

3-layer fix:
1. `datatypes/epc/domain/epc_property_data.py`: add `glazing_type:
   int = 3` to SapRoofWindow (default = Double 2002-2021, the cohort
   modal).
2. `datatypes/epc/domain/mapper.py` `_map_elmhurst_roof_window`:
   populate `glazing_type` via `_elmhurst_glazing_type_code(w.
   glazing_type)` — mirror of `_map_elmhurst_window`.
3. `domain/sap10_calculator/worksheet/internal_gains.py`
   `_daylight_factor_from_cert`: iterate `epc.sap_roof_windows` for
   the rooflight g_L numerator, dispatching via existing
   `_G_LIGHT_BY_GLAZING_CODE` + `rw.frame_factor`. Z_L = 1.0 per
   Table 6d note 2.

Test coverage:
- AAA test `test_summary_000565_rooflight_per_window_g_l_routes_via_
  glazing_type_per_sap_10_2_appendix_l_l2a` pins both per-rooflight
  glazing codes (9 Triple / 3 Double) AND `inputs.lighting_kwh_per_
  yr` at 1384.8353 ±1e-4.
- 000516 hand-built fixture updated to explicitly set glazing_type=2
  ("Double pre 2002") matching the lodged label.

Cert 000565 cascade snapshot (HEAD 98a4b5b9 → this):
  sap_score (int)             29       ✓ EXACT (preserved)
  lighting_kwh_per_yr     1382.6657 → 1384.8353  ✓ EXACT (-2.17 → 0)
  sap_score_continuous     28.5028  →  28.5002   (Δ -0.0059 → -0.0085)
  ecf                       5.3874  →   5.3877   (Δ +0.0008 → +0.0011)
  total_fuel_cost_gbp    4680.78    → 4681.01    (+0.52 → +0.75)
  co2_kg_per_yr          6448.34    → 6448.59    (+0.72 → +0.96)
  space_heating_kwh     59020.02    → 59019.18   (+11.67 → +10.83)
  main_heating_fuel     34717.66    → 34717.16   (+6.87  → +6.37)

Lighting closure exposes a previously-cancelling residual elsewhere —
continuous SAP magnitude widens slightly (-0.0059 → -0.0085) but the
spec-correct path is now in place, per [[feedback-spec-floor-
skepticism]]. SH + main_heating_fuel improve (added lighting energy
contributes internal gains, reducing SH demand). Integer SAP 29 ✓
EXACT preserved.

Cohort safety: 6 cohort certs have at most 1 rooflight each
(000516 W6 only, lodged "Double pre 2002" → code 2). Their gL still
resolves to 0.80 via the existing `_G_LIGHT_BY_GLAZING_CODE` table,
so the per-rooflight dispatch produces the same numerator as the
old default branch.

Pyright net-zero (50 → 50 errors across touched files).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 16:28:47 +00:00
..
addresses standardist Address 2026-05-22 10:13:32 +00:00
data_transformation moved classifier data transformation to an easy one 2026-06-01 14:53:34 +00:00
epc pr review, move domain and orhcestration 2026-06-01 14:00:31 +00:00
sap10_calculator Slice S0380.110: per-rooflight g_L in Appendix L L2a (SAP 10.2 p.88) 2026-06-01 16:28:47 +00:00
sap10_ml Slice S0380.109: Solid brick + insulation via §5.7 Table 13 + §5.8 Table 14 (RdSAP 10) 2026-06-01 16:28:47 +00:00
tasks added postcode splitter rewrite to ddd 2026-05-19 16:35:09 +00:00
postcode.py get rid of comments 2026-05-20 13:21:11 +00:00