diff --git a/domain/sap10_ml/rdsap_uvalues.py b/domain/sap10_ml/rdsap_uvalues.py index b75b17a4..725c7726 100644 --- a/domain/sap10_ml/rdsap_uvalues.py +++ b/domain/sap10_ml/rdsap_uvalues.py @@ -439,14 +439,16 @@ _CAVITY_FILLED_ENG: Final[list[float]] = [ # entries that differ from the England base. _COUNTRY_KLM_OVERRIDES: Final[dict[Country, dict[tuple[int, int], dict[str, float]]]] = { Country.SCT: { - # Scotland Cavity-as-built K-M: 0.25, 0.22, 0.17 (vs ENG 0.30, 0.28, 0.26). - (WALL_CAVITY, 0): {"H": 0.45, "K": 0.25, "L": 0.22, "M": 0.17}, - (WALL_STONE_GRANITE, 0): {"H": 0.45, "K": 0.25, "L": 0.22, "M": 0.17}, - (WALL_STONE_SANDSTONE, 0): {"H": 0.45, "K": 0.25, "L": 0.22, "M": 0.17}, - (WALL_SOLID_BRICK, 0): {"H": 0.45, "K": 0.25, "L": 0.22, "M": 0.17}, - (WALL_TIMBER_FRAME, 0): {"K": 0.25, "L": 0.22, "M": 0.17}, - (WALL_SYSTEM_BUILT, 0): {"H": 0.45, "K": 0.25, "L": 0.22, "M": 0.17}, - (WALL_COB, 0): {"K": 0.25, "L": 0.22, "M": 0.17}, + # Scotland (Table 7, PDF p.35) as-built bands that diverge from the + # England base: H 0.60→0.45 (not timber/cob, which are already 0.40/ + # 0.60), J 0.35→0.30 (ALL types), K 0.30→0.25, L 0.28→0.22, M 0.26→0.17. + (WALL_CAVITY, 0): {"H": 0.45, "J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, + (WALL_STONE_GRANITE, 0): {"H": 0.45, "J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, + (WALL_STONE_SANDSTONE, 0): {"H": 0.45, "J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, + (WALL_SOLID_BRICK, 0): {"H": 0.45, "J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, + (WALL_TIMBER_FRAME, 0): {"J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, + (WALL_SYSTEM_BUILT, 0): {"H": 0.45, "J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, + (WALL_COB, 0): {"J": 0.30, "K": 0.25, "L": 0.22, "M": 0.17}, }, Country.NIR: { (WALL_CAVITY, 0): {"M": 0.18}, diff --git a/domain/sap10_ml/tests/test_rdsap_uvalues.py b/domain/sap10_ml/tests/test_rdsap_uvalues.py index 210b97bf..8d670a2f 100644 --- a/domain/sap10_ml/tests/test_rdsap_uvalues.py +++ b/domain/sap10_ml/tests/test_rdsap_uvalues.py @@ -421,6 +421,42 @@ def test_u_wall_scotland_age_band_m_returns_country_specific_table7_value() -> N assert result == pytest.approx(0.17, abs=0.001) +def test_u_wall_scotland_age_band_j_returns_0_30_not_england_0_35_per_table7() -> None: + # Arrange — RdSAP 10 Table 7 (Scotland, PDF p.35) as-built band J is + # 0.30 for every uninsulated wall type, vs the England base 0.35 + # (Table 6). The _COUNTRY_KLM_OVERRIDES[SCT] dicts previously listed + # H/K/L/M but omitted J, so a Scotland band-J cavity wrongly fell + # through to England's 0.35. + + # Act + result = u_wall( + country=Country.SCT, + age_band="J", + construction=WALL_CAVITY, + insulation_thickness_mm=0, + ) + + # Assert + assert result == pytest.approx(0.30, abs=0.001) + + +def test_u_wall_scotland_age_band_j_timber_frame_returns_0_30_per_table7() -> None: + # Arrange — the J=0.30 override applies to all 7 as-built wall types, + # including timber frame (England base J = 0.35). Guards the type whose + # Scotland override has no H entry (timber H already 0.40 in England). + + # Act + result = u_wall( + country=Country.SCT, + age_band="J", + construction=WALL_TIMBER_FRAME, + insulation_thickness_mm=0, + ) + + # Assert + assert result == pytest.approx(0.30, abs=0.001) + + def test_u_wall_timber_frame_as_built_age_band_a_returns_table6_value() -> None: # Arrange — Timber frame as built, age A, England -> 2.5 W/m^2K.