A community override keeps an assessor-observed Group 3 control 🟥

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-03 16:33:40 +00:00
parent 72ccc920c5
commit 04810896e0

View file

@ -647,6 +647,51 @@ def test_unresolvable_or_unmodelled_heating_produces_no_overlay(
assert simulation is None
def test_community_override_keeps_an_observed_group_3_control() -> None:
# A community override on a cert that ALREADY lodges community heating is a
# confirmation, not a system switch — the assessor observed the control
# (e.g. 2306, "charging linked to use, programmer and TRVs", worth ~1-2 SAP
# over the flat-rate default). Stamping the 2313 default over it would
# destroy real information, so the overlay opts into keeping an existing
# Table 4e GROUP 3 control (the heat-network mirror of
# `keep_existing_off_peak_meter`, ADR-0053).
# Arrange — a cert lodging community heating with an observed 2306.
baseline = build_epc()
main = baseline.sap_heating.main_heating_details[0]
main.sap_main_heating_code = 301
main.main_heating_category = 6
main.main_heating_control = 2306
overlay = main_heating_overlay_for("Community heating, boilers", 0)
assert overlay is not None
# Act
result = apply_simulations(baseline, [overlay])
# Assert — the observed usage-linked control survives.
assert result.sap_heating.main_heating_details[0].main_heating_control == 2306
def test_community_override_replaces_a_cross_family_control() -> None:
# When the replaced system was a DIFFERENT family, its control is stale by
# definition — a Group-1 boiler zone control (2110) has no meaning on a
# heat network (two live portfolio-796 dwellings carried exactly that) —
# so the Group 3 default is stamped (ADR-0053).
# Arrange — a cert lodging a gas boiler with zone control.
baseline = build_epc()
main = baseline.sap_heating.main_heating_details[0]
main.sap_main_heating_code = 102
main.main_heating_category = 2
main.main_heating_control = 2110
overlay = main_heating_overlay_for("Community heating, boilers", 0)
assert overlay is not None
# Act
result = apply_simulations(baseline, [overlay])
# Assert — the stale boiler control is replaced by the Group 3 default.
assert result.sap_heating.main_heating_details[0].main_heating_control == 2313
def test_main_heating_override_remaps_the_primary_system_code() -> None:
# Arrange
baseline = build_epc()