diff --git a/datatypes/epc/domain/mapper.py b/datatypes/epc/domain/mapper.py index c12f87d4e..9818c6fa7 100644 --- a/datatypes/epc/domain/mapper.py +++ b/datatypes/epc/domain/mapper.py @@ -6,6 +6,7 @@ from datetime import date from decimal import ROUND_HALF_UP, Decimal from typing import ( Any, + Callable, Dict, Final, List, @@ -6031,6 +6032,8 @@ def _pashub_room_in_roof( details: Optional[List[RoomInRoofSurfaceDetail]], kind: Optional[str], insulation_thickness_mm: Optional[int] = None, + area_of: Callable[[float, float], float] = lambda length, height: length + * height, ) -> None: for d in details or []: if d.length_m is None or d.height_m is None: @@ -6048,7 +6051,7 @@ def _pashub_room_in_roof( surfaces.append( SapRoomInRoofSurface( kind=surface_kind, - area_m2=d.length_m * d.height_m, + area_m2=area_of(d.length_m, d.height_m), u_value=d.u_value, insulation_thickness_mm=thickness, ) @@ -6056,12 +6059,20 @@ def _pashub_room_in_roof( _add(rir.gables, None) _add(rir.slopes, "slope", roof_thickness) - # "Common wall" lodges as a Detailed-mode stud wall (Table 17 col 3): - # kind="common_wall" is a §3.9.2 Simplified-Type-2-only concept (different - # area formula, billed at the main-wall U); every worksheet-validated - # Detailed §3.10 fixture (000516/000487/000477/000480) uses stud_wall for - # this low internal wall. - _add(rir.common_walls, "stud_wall", roof_thickness) + if rir.roof_room_type is not None: + # Simplified approach ("Roof room type" lodged, RdSAP §3.9.2): a + # "common wall" is billed as an external wall at the storey-below + # main-wall U (SAP kind `common_wall`), spec area L × (0.25 + H) — + # NOT a Detailed §3.10 `stud_wall` roof surface, which would drop to + # the Table 18 col(4) "all elements uninsulated" default on a no- + # loft-access dwelling (78/72 North Road, deals 499538003156/ + # 499627236560). + _add(rir.common_walls, "common_wall", area_of=lambda l, h: l * (0.25 + h)) + else: + # Detailed §3.10: "common wall" lodges as a stud wall (Table 17 col + # 3, raw L × H area); every worksheet-validated Detailed fixture + # (000516/000487/000477/000480) uses stud_wall for this low wall. + _add(rir.common_walls, "stud_wall", roof_thickness) _add(rir.flat_ceilings, "flat_ceiling", roof_thickness) if rir.floor_area_m2 is None: return None