P5.3: SapResult.intermediate exposes ventilation group

infiltration_ach (the cert-derived input) and infiltration_w_per_k
(the derived HLC_V = ACH × volume × 0.33 from SAP 10.2 §4.1) populated
on `intermediate`. Diagnostic surface for the §4 / Table 4g sweep.

133 SAP tests pass.
This commit is contained in:
Khalim Conn-Kowlessar 2026-05-19 10:20:27 +00:00
parent d5b1d0d483
commit 443a7697ff
2 changed files with 20 additions and 0 deletions

View file

@ -344,6 +344,8 @@ def calculate_sap_from_inputs(inputs: CalculatorInputs) -> SapResult:
"windows_w_per_k": ht.windows_w_per_k,
"doors_w_per_k": ht.doors_w_per_k,
"thermal_bridging_w_per_k": ht.thermal_bridging_w_per_k,
"infiltration_ach": inputs.infiltration_ach,
"infiltration_w_per_k": hlc_v,
}
return SapResult(

View file

@ -159,6 +159,24 @@ def test_calculate_exposes_heat_transmission_intermediates() -> None:
assert result.intermediate["thermal_bridging_w_per_k"] == ht.thermal_bridging_w_per_k
def test_calculate_exposes_ventilation_intermediates() -> None:
# Arrange — P5 trace mode: infiltration ach (the cert-derived input) and
# the derived ventilation heat-loss W/K must surface so §4 / Table 4g
# sweep slices can diff per-cert against the spec formula
# HLC_V = ACH × volume × 0.33 (SAP 10.2 §4.1).
inputs = _baseline_inputs()
# Act
result = calculate_sap_from_inputs(inputs)
# Assert
assert result.intermediate["infiltration_ach"] == inputs.infiltration_ach
expected_hlc_v = inputs.infiltration_ach * inputs.dimensions.volume_m3 * 0.33
assert result.intermediate["infiltration_w_per_k"] == pytest.approx(
expected_hlc_v, rel=1e-9
)
def test_higher_main_heating_efficiency_reduces_fuel_use() -> None:
# Arrange — Direction check: doubling the boiler efficiency must halve
# the main-heating fuel kWh, holding everything else constant.