Stop a System-built landlord override being mis-read as a basement 🟩

System-built is RdSAP code 6, colliding with the gov-EPC code-6 basement
sentinel that main_wall_is_basement falls back to. The wall overlay now pins
wall_is_basement=False for system-built, mirroring the gov-API mapper's
_clear_basement_flag_when_system_built, so the override no longer adds a phantom
basement (which inflated both wall and ground-floor heat loss).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-29 19:37:11 +00:00
parent da17ddce8f
commit 6279924773

View file

@ -31,6 +31,9 @@ _MATERIAL_CONSTRUCTION: dict[str, int] = {
"Curtain Wall": 9,
}
# RdSAP `WALL_SYSTEM_BUILT` — shares code 6 with the gov-EPC basement sentinel.
_WALL_SYSTEM_BUILT = 6
# RdSAP `wall_insulation_type` codes by insulation-state suffix
# (domain/sap10_ml/rdsap_uvalues.py): external 1, filled-cavity 2, internal 3,
# as-built/uninsulated 4, cavity+external 6, cavity+internal 7.
@ -66,11 +69,18 @@ def wall_overlay_for(
if building_part == 0
else BuildingPartIdentifier.extension(building_part)
)
# System-built is RdSAP code 6, which collides with the gov-EPC code-6
# basement sentinel that `main_wall_is_basement` falls back to. A landlord
# naming a System-built wall is asserting the material, not a basement — pin
# the flag False so the override isn't mis-read as one (ADR-0033 / the
# overlay mirror of the mapper's `_clear_basement_flag_when_system_built`).
wall_is_basement = False if construction == _WALL_SYSTEM_BUILT else None
return EpcSimulation(
building_parts={
identifier: BuildingPartOverlay(
wall_construction=construction,
wall_insulation_type=insulation,
wall_is_basement=wall_is_basement,
)
}
)