Remap every window's glazing from a landlord glazing override 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-06-19 13:21:42 +00:00
parent 8ce22a5ccb
commit 608e96bb09

View file

@ -19,6 +19,7 @@ from datatypes.epc.domain.epc_property_data import (
)
from domain.modelling.simulation import (
EpcSimulation,
GlazingOverlay,
HeatingOverlay,
LightingOverlay,
SecondaryHeatingOverlay,
@ -53,6 +54,8 @@ def apply_simulations(
)
if simulation.lighting is not None:
_fold_lighting(result, simulation.lighting)
if simulation.glazing is not None:
_fold_glazing(result, simulation.glazing)
if simulation.heating is not None:
_fold_heating(result, simulation.heating)
if simulation.secondary_heating is not None:
@ -202,6 +205,21 @@ def _fold_window(window: SapWindow, overlay: WindowOverlay) -> None:
details.solar_transmittance = overlay.solar_transmittance
def _fold_glazing(epc: EpcPropertyData, overlay: GlazingOverlay) -> None:
"""Expand a whole-dwelling `GlazingOverlay` across every window: set each
window's `glazing_type` to the corrected SAP10 code AND clear its lodged
transmission U, so `heat_transmission`'s Table-24 cascade re-derives U from
the new type (the lodged U was for the old, mis-recorded glazing). A landlord
glazing override carries no per-window geometry, so it applies uniformly
the expansion lives here because the baseline window list is known only at
fold time."""
if overlay.glazing_type is None:
return
for window in epc.sap_windows:
window.glazing_type = overlay.glazing_type
window.window_transmission_details = None
def _fold_ventilation(
baseline: Optional[SapVentilation], overlay: VentilationOverlay
) -> SapVentilation: