Drag heat-network category and a community gas fuel for community boilers 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-30 17:39:42 +00:00
parent 098427e620
commit 1dc94e7cda

View file

@ -98,6 +98,16 @@ _ELECTRIC_ROOM_HEATER_CODES = frozenset(range(691, 702))
_HEAT_PUMP_CATEGORY = 4
_HEAT_PUMP_CODES = frozenset(range(211, 225)) | frozenset(range(521, 528))
# Community / heat-network heating (SAP Table 4a 301-304) is category 6; the
# calculator's `_is_heat_network` keys off code OR category 6. The boiler-driven
# schemes (301/302/303) are dominantly mains gas (community) — RdSAP main_fuel 20
# — per real community certs; the heat-pump scheme (304) is electricity
# (community), added with its archetype (ADR-0041).
_HEAT_NETWORK_CATEGORY = 6
_HEAT_NETWORK_CODES = frozenset({301, 302, 303, 304})
_COMMUNITY_BOILER_CODES = frozenset({301, 302, 303})
_COMMUNITY_GAS_FUEL = 20
# SAP Table 4c full boiler-control code: programmer + room thermostat + TRVs. The
# landlord names the boiler, not its controls — but a gas boiler installed under
# modern Building Regs must carry compliant controls, and this overlay already
@ -182,6 +192,8 @@ def _category_for(code: int) -> Optional[int]:
return _ROOM_HEATER_CATEGORY
if code in _HEAT_PUMP_CODES:
return _HEAT_PUMP_CATEGORY
if code in _HEAT_NETWORK_CODES:
return _HEAT_NETWORK_CATEGORY
return None
@ -193,6 +205,8 @@ def _natural_fuel_for(code: int) -> Optional[int]:
return _ELECTRICITY_FUEL
if code in _SOLID_FUEL_ROOM_HEATER_CODES:
return _HOUSE_COAL_FUEL
if code in _COMMUNITY_BOILER_CODES:
return _COMMUNITY_GAS_FUEL
return None