mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
ModellingOrchestrator builds the ventilation dependency per Property (suppressed when already mechanically ventilated) and passes it to optimise_package, so a selected wall measure forces MEV into the package before the re-score. Ventilation joins the role-3 cascade in best-practice order (walls -> roof -> ventilation -> floor) and persists as a Plan Measure carrying its real negative marginal and its cost. Added the mechanical_ventilation contingency rate (0.26, per legacy Costs.CONTINGENCIES). Integration test now seeds the ventilation Product and asserts the forced measure persists with <=0 SAP and 2x900 cost; the full-pipeline test seeds the Product too (the dependency is built for every not-yet-ventilated dwelling). On 000490 the real calculator scores MEV at -1.275 SAP. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
883 B
Python
25 lines
883 B
Python
"""Per-Measure-Type contingency rates.
|
|
|
|
The one cost component carried separately from a Product's fully-loaded total
|
|
(CONTEXT.md). Mirrors the legacy `recommendations/Costs.py::Costs.CONTINGENCIES`;
|
|
extended as each measure type lands.
|
|
"""
|
|
|
|
_CONTINGENCY_RATES: dict[str, float] = {
|
|
"cavity_wall_insulation": 0.10,
|
|
"loft_insulation": 0.10,
|
|
"suspended_floor_insulation": 0.20,
|
|
"solid_floor_insulation": 0.26,
|
|
"mechanical_ventilation": 0.26,
|
|
}
|
|
|
|
|
|
def contingency_rate(measure_type: str) -> float:
|
|
"""Return the contingency rate for a Measure Type, raising if unknown
|
|
(strict — do not silently default, per the repo's strict-raise convention)."""
|
|
try:
|
|
return _CONTINGENCY_RATES[measure_type]
|
|
except KeyError as exc:
|
|
raise ValueError(
|
|
f"no contingency rate configured for measure type {measure_type!r}"
|
|
) from exc
|