From 8d6085be0f7f3130538449b5f1a3cc2a953220d9 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 21 May 2024 11:49:17 +0100 Subject: [PATCH] added mds cavity wall insulation --- backend/ml_models/Valuation.py | 4 ++++ recommendations/HeatingRecommender.py | 6 +++++- recommendations/Mds.py | 30 ++++++++++++++++++++------ recommendations/WallRecommendations.py | 17 +++++++++++++++ 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/backend/ml_models/Valuation.py b/backend/ml_models/Valuation.py index cfd775e7..dd77fb4b 100644 --- a/backend/ml_models/Valuation.py +++ b/backend/ml_models/Valuation.py @@ -150,6 +150,10 @@ class PropertyValuation: ] + # Additional sources: + # https://superhomes.org.uk/wp-content/uploads/2024/05/The-Impact-of-Retrofit-on-Residential-Property-Market + # -Values-7-rotated-1.pdf + EPC_BANDS = ["G", "F", "E", "D", "C", "B", "A"] @classmethod diff --git a/recommendations/HeatingRecommender.py b/recommendations/HeatingRecommender.py index a51803f2..3163f84f 100644 --- a/recommendations/HeatingRecommender.py +++ b/recommendations/HeatingRecommender.py @@ -312,7 +312,7 @@ class HeatingRecommender: return output - def recommend_hhr_storage_heaters(self, phase, system_change, heating_controls_only): + def recommend_hhr_storage_heaters(self, phase, system_change, heating_controls_only, _return=False): """ We will recommend upgrading to a high heat retention storage system, if the current system is not already high heat retention storage @@ -321,6 +321,8 @@ class HeatingRecommender: :param system_change: Indicates if we are recommending a different type of heating system, compared to the current system :param heating_controls_only: Indicates if we should include a recommendation for just heating controls + :param _return: Indicates if we should return the recommendations, rather than appending them to the + recommendations list :return: """ @@ -374,6 +376,8 @@ class HeatingRecommender: heating_controls_only=heating_controls_only, system_change=system_change ) + if _return: + return recommendations self.heating_recommendations.extend(recommendations) diff --git a/recommendations/Mds.py b/recommendations/Mds.py index 78a7a510..0eeb19a2 100644 --- a/recommendations/Mds.py +++ b/recommendations/Mds.py @@ -10,6 +10,7 @@ from recommendations.WindowsRecommendations import WindowsRecommendations from recommendations.HeatingRecommender import HeatingRecommender from recommendations.HotwaterRecommendations import HotwaterRecommendations from recommendations.SecondaryHeating import SecondaryHeating +from recommendations.Recommendations import Recommendations class Mds: @@ -57,6 +58,8 @@ class Mds: if any([m in not_implemented_measures for m in measure_config_list]): raise NotImplementedError("Not implemented measure in the property - implement me") + mds_recommendations = [] + if "external_wall_insulation" in measure_config_list: raise Exception("check me out") self.wall_recommender.recommend(phase=0) @@ -65,10 +68,9 @@ class Mds: # TODO: Insert the recommendation identifier into this recommendation if "cavity_wall_insulation" in measure_config_list: - raise Exception("check me out 2") - # TODO: get cwi - self.wall_recommender.recommend(phase=0) - cwi_recommendations = self.wall_recommender.recommendations + recs = self.wall_recommender.mds_recommend_cavity_wall_insulation(phase=0) + recs = self.insert_recommendation_id(recs, measures, "cavity_wall_insulation") + mds_recommendations.append(recs) if "loft_insulation" in measure_config_list: raise Exception("check me out 3") @@ -91,8 +93,11 @@ class Mds: self.heating_recommender.recommend(phase=0) if "electric_storage_heaters" in measure_config_list: - raise Exception("check me out 8") - self.heating_recommender.recommend(phase=0) + recs = self.heating_recommender.recommend_hhr_storage_heaters( + phase=0, system_change=True, heating_controls_only=False, _return=True + ) + recs = self.insert_recommendation_id(recs, measures) + mds_recommendations.append(recs) if "low_energy_lighting" in measure_config_list: raise Exception("check me out 9") @@ -137,3 +142,16 @@ class Mds: if "room_in_roof_insulation" in measure_config_list: raise Exception("check me out 19") self.roof_recommender.recommend(phase=0) + + property_representative_recommendations = Recommendations.create_representative_recommendations( + mds_recommendations, non_invasive_recommendations=[] + ) + + @staticmethod + def insert_recommendation_id(recommendations, measures, measure_name): + # Insert the recommendation identifier into this recommendation + measure_config = [m for m in measures if measure_name in m][0] + for r in recommendations: + r["recommendation_id"] = list(measure_config.values())[0] + + return recommendations diff --git a/recommendations/WallRecommendations.py b/recommendations/WallRecommendations.py index 20fc453c..3e38704e 100644 --- a/recommendations/WallRecommendations.py +++ b/recommendations/WallRecommendations.py @@ -103,6 +103,23 @@ class WallRecommendations(Definitions): return True + def mds_recommend_cavity_wall_insulation(self, phase=None): + # Function specifically for cavity wall insulation, for usage in the mds report + self.recommendations = [] + insulation_thickness = self.property.walls["insulation_thickness"] + + u_value = get_wall_u_value( + clean_description=self.property.walls["clean_description"], + age_band=self.property.age_band, + is_granite_or_whinstone=self.property.walls["is_granite_or_whinstone"], + is_sandstone_or_limestone=self.property.walls["is_sandstone_or_limestone"], + ) + + # Test filling cavity + self.find_cavity_insulation(u_value, insulation_thickness, phase) + + return self.recommendations + def recommend(self, phase=0): # if building built after 1990 + we're able to identify U-value + # U-value less than 0.18 and if in or close to a conversation area,