mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Slice 4 of the lighting generator (ADR-0023): run recommend_lighting in _candidate_recommendations (no planning gate). Price low_energy_lighting in the offline catalogue + contingency table (0.26, the legacy rate); the _GENERATOR_MEASURE_TYPES forcing test enforces both. A run_modelling test pins the wiring end-to-end (an incandescent-lit dwelling gets the LED upgrade in the optimised package). Downstream updates, all because lighting now fires on any cert with non-LED bulbs: report.py gains the low_energy_lighting trigger (the non-LED counts); the two golden-cert report tests and the multi-measure integration test now expect low_energy_lighting alongside the fabric measures (the sample/golden EPCs lodge low-energy-unknown bulbs); first-run integration seeds a low_energy_lighting MaterialRow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
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,
|
|
"sloping_ceiling_insulation": 0.10,
|
|
"flat_roof_insulation": 0.10,
|
|
"suspended_floor_insulation": 0.20,
|
|
"solid_floor_insulation": 0.26,
|
|
"mechanical_ventilation": 0.26,
|
|
"external_wall_insulation": 0.26,
|
|
"internal_wall_insulation": 0.26,
|
|
"double_glazing": 0.15,
|
|
"secondary_glazing": 0.15,
|
|
"low_energy_lighting": 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
|