ASHP cost sizes to the threaded design heat loss over the floor-area proxy 🟥

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-03 10:29:14 +00:00
parent 2dd637a657
commit 6f70e65bc4
2 changed files with 23 additions and 3 deletions

View file

@ -283,10 +283,14 @@ _OIL_FUEL_CODES = frozenset({28, 4, 71, 73, 75, 76})
_LPG_FUEL_CODES = frozenset({27, 2, 3, 5, 9})
def ashp_cost_inputs(epc: EpcPropertyData) -> AshpCostInputs:
def ashp_cost_inputs(
epc: EpcPropertyData, design_heat_loss_kw: Optional[float] = None
) -> AshpCostInputs:
"""Read an `EpcPropertyData` into the typed inputs `Products.ashp_bundle_cost`
needs: the existing system, property-size band, design heat loss (floor-area
proxy), radiator count, and whether a wet system can be reused (ADR-0025)."""
needs: the existing system, property-size band, design heat loss, radiator
count, and whether a wet system can be reused (ADR-0025). ``design_heat_loss_kw``
(the calculator's value, ADR-0049) sizes the cost band; when omitted it falls
back to the floor-area proxy so cost and pump size share one figure."""
system: AshpExistingSystem = _existing_system(epc)
floor_area: float = epc.total_floor_area_m2
return AshpCostInputs(

View file

@ -82,3 +82,19 @@ def test_oil_and_lpg_dwellings_are_reusable_wet_systems() -> None:
assert ashp_cost_inputs(_with_fuel(28)).existing_system is AshpExistingSystem.OIL
assert ashp_cost_inputs(_with_fuel(27)).existing_system is AshpExistingSystem.LPG
assert ashp_cost_inputs(_with_fuel(28)).has_reusable_wet_system is True
def test_threaded_design_heat_loss_drives_the_cost_band_over_the_proxy() -> None:
# When the caller threads the calculator's real design heat loss (ADR-0049),
# the ASHP cost sizes to it — not the floor-area proxy — so a leaky dwelling's
# bigger pump is priced on the right band.
# Arrange
epc = parse_recommendation_summary(
"ashp_from_system_boiler_with_cylinder_001431_before.pdf"
)
# Act
inputs: AshpCostInputs = ashp_cost_inputs(epc, design_heat_loss_kw=17.5)
# Assert — the threaded value, not the 4.5 kW proxy.
assert inputs.design_heat_loss_kw == 17.5