fix(uvalues): apply metal-frame U 1.6 for 2022-or-later windows (RdSAP 10 Table 24, PDF p.51)

Table 24 "Double or triple glazed, 2022 or later" row gives U = 1.4 for
PVC/wooden frames and 1.6 for metal frames. `u_window` returned 1.4 for both,
ignoring the metal-frame variant and under-counting metal-frame heat loss on
post-2022 windows. The 2002-2021 and pre-2002 rows already split PVC/metal
correctly; this aligns the 2022+ row.

Spec-pinned in test_u_window_post_2022_metal_returns_table24_1_6_not_pvc_1_4.
pyright not installed in this container.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-20 14:09:21 +00:00
parent b22b27c0ff
commit 600684f5df
2 changed files with 14 additions and 1 deletions

View file

@ -1419,7 +1419,8 @@ def u_window(
# double/triple glazing — period bands.
if installed_year is not None and installed_year >= 2022:
return 1.4
# Table 24 "2022 or later" row: PVC/wood 1.4, metal 1.6.
return 1.6 if metal else 1.4
if installed_year is not None and installed_year >= 2002:
return 2.2 if metal else 2.0
# pre-2002 double/triple default to 12mm gap row.

View file

@ -1748,6 +1748,18 @@ def test_u_window_post_2022_pvc_returns_low_table24_value() -> None:
assert result == pytest.approx(1.4, abs=0.001)
def test_u_window_post_2022_metal_returns_table24_1_6_not_pvc_1_4() -> None:
# Arrange — Table 24 "2022 or later" row (PDF p.51): PVC/wooden frame
# 1.4, METAL frame 1.6. The metal frame variant was previously ignored
# (1.4 returned for both), under-counting metal-frame heat loss.
# Act
result = u_window(installed_year=2023, glazing_type="double", frame_type="metal")
# Assert
assert result == pytest.approx(1.6, abs=0.001)
def test_u_window_falls_back_to_mid_range_when_unknown() -> None:
# Arrange — nothing known.