mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
test(modelling): pin ASHP radiator-count clamp to table bounds
Slice 6 of ADR-0025 costing. Characterises the distribution clamp built in the tracer: a radiator proxy below 4 prices as the 4-rad band, above 12 as the 12-rad band, in-range exact. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
fd9e020b09
commit
c7acf43b52
1 changed files with 27 additions and 0 deletions
|
|
@ -141,3 +141,30 @@ def test_heat_pump_rounds_design_heat_loss_up_to_the_next_band() -> None:
|
|||
assert abs(_pump_price(products, 15.0) - 10680.0) <= 1e-9
|
||||
assert abs(_pump_price(products, 15.01) - 11400.0) <= 1e-9 # above largest
|
||||
assert abs(_pump_price(products, 25.0) - 11400.0) <= 1e-9
|
||||
|
||||
|
||||
def _full_distribution(products: Products, radiator_count: int) -> float:
|
||||
"""Isolate the full distribution line: no-system (decommission 0) + pump
|
||||
(4 kW) 9720 + cylinder 2382.60 = 12102.60 base."""
|
||||
inputs = AshpCostInputs(
|
||||
existing_system=AshpExistingSystem.NONE,
|
||||
is_small_property=True,
|
||||
design_heat_loss_kw=4.0,
|
||||
radiator_count=radiator_count,
|
||||
has_reusable_wet_system=False,
|
||||
)
|
||||
return products.ashp_bundle_cost(inputs).total - 12102.60
|
||||
|
||||
|
||||
def test_radiator_count_is_clamped_to_the_distribution_table_bounds() -> None:
|
||||
# Arrange — the distribution table only spans 4-12 radiators, so a proxy
|
||||
# count outside that range is clamped to the nearest band (ADR-0025).
|
||||
products = Products()
|
||||
|
||||
# Act / Assert — below 4 prices as 4 (2220); above 12 prices as 12 (6288);
|
||||
# in-range is exact.
|
||||
assert abs(_full_distribution(products, 2) - 2220.0) <= 1e-9
|
||||
assert abs(_full_distribution(products, 4) - 2220.0) <= 1e-9
|
||||
assert abs(_full_distribution(products, 9) - 4680.0) <= 1e-9
|
||||
assert abs(_full_distribution(products, 12) - 6288.0) <= 1e-9
|
||||
assert abs(_full_distribution(products, 15) - 6288.0) <= 1e-9
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue