updated trickle vent rec

This commit is contained in:
Khalim Conn-Kowlessar 2025-08-17 18:03:00 +01:00
parent b63822c3f9
commit cc13843e67

View file

@ -18,7 +18,8 @@ class VentilationRecommendations(Definitions):
self.property = property_instance
self.recommendation = None
self.materials = [part for part in materials if part["type"] == "mechanical_ventilation"]
self.mechanical_ventilation_materials = [part for part in materials if part["type"] == "mechanical_ventilation"]
self.trickle_vent_materials = [part for part in materials if part["type"] == "trickle_vent"]
def recommend(self, phase):
"""
@ -33,13 +34,10 @@ class VentilationRecommendations(Definitions):
if self.property.has_ventilation:
return
if len(self.materials) != 1:
raise NotImplementedError("Only handled the case of having one venilation option")
# We recommend installing 2 units
n_units = 2
parts = self.materials.copy()
parts = self.mechanical_ventilation_materials.copy()
already_installed = "cavity_wall_insulation" in self.property.already_installed
@ -103,6 +101,10 @@ class VentilationRecommendations(Definitions):
else trickle_vents_recommendation_config["description"]
)
cheapest_trickle_vent = min(
self.trickle_vent_materials, key=lambda x: x["total_cost"]
)
return [
{
"phase": None,
@ -118,7 +120,7 @@ class VentilationRecommendations(Definitions):
"kwh_savings": 0,
"co2_equivalent_savings": 0,
"energy_cost_savings": 0,
"total": trickle_vents_recommendation_config["cost"],
"total": cheapest_trickle_vent["total_cost"] * self.property.number_of_windows,
# We use a very simple and rough estimate of 4 hours per unit
"labour_hours": trickle_vents_recommendation_config.get("labour_hours", 8),
"labour_days": trickle_vents_recommendation_config.get("labour_days", 1), # Assume 8 hour day