From 6600ad516c247ade7a54b26466536ea21fa6e861 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 17 Oct 2024 14:23:02 +0100 Subject: [PATCH] added extension cavity wall insulation as a recommendation --- recommendations/Recommendations.py | 6 ++ recommendations/WallRecommendations.py | 80 ++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index 684b0915..be713e91 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -128,6 +128,12 @@ class Recommendations: property_recommendations.append(self.wall_recomender.recommendations) phase += 1 + # We handle recommendations covering specific non-invasive measures + self.wall_recomender.recommend_extended(measures=measures) + if self.wall_recomender.extended_recommendations: + property_recommendations.append(self.wall_recomender.extended_recommendations) + # We don't have any phasing here + self.roof_recommender.recommend(phase=phase, measures=measures, default_u_values=self.default_u_values) if self.roof_recommender.recommendations: property_recommendations.append(self.roof_recommender.recommendations) diff --git a/recommendations/WallRecommendations.py b/recommendations/WallRecommendations.py index 358547dc..aca87edf 100644 --- a/recommendations/WallRecommendations.py +++ b/recommendations/WallRecommendations.py @@ -1,6 +1,7 @@ import math from typing import List +import numpy as np import pandas as pd from datatypes.enums import QuantityUnits @@ -99,6 +100,8 @@ class WallRecommendations(Definitions): # Will contains a list of recommended measures self.recommendations = [] + # Contains a list of extended recommendation measures, such as extension insulation + self.extended_recommendations = [] self.cavity_wall_insulation_materials = [ part for part in materials if part["type"] == "cavity_wall_insulation" @@ -267,6 +270,83 @@ class WallRecommendations(Definitions): # If the u-value is within regulations, we don't do anything return + def recommend_extended(self, measures): + """ + Where we have extended measures, such as extension insulation, which cannot typically be picked up + from the EPC api, we handle the recommendation of these here + :param measures: + :return: + """ + + # These are the measures that are covered by this function + extended_measures = ["extension_cavity_wall_insulation"] + + measures_to_recommend = [measure for measure in measures if measure in extended_measures] + if not measures_to_recommend: + return + + # We reset this to be empty + self.extended_recommendations = [] + + for measure in measures_to_recommend: + if measure == "extension_cavity_wall_insulation": + recommendation = self.recommend_extension_cavity_wall_insulation() + else: + raise NotImplementedError(f"Measure {measure} is not implemented") + + self.extended_recommendations.append(recommendation) + + return + + def recommend_extension_cavity_wall_insulation(self): + """ + This function produces the recommendation for extension cavity wall insulation + :return: + """ + + # TODO: We aren't provided with carbon, heat or bill savings figures for this measure + + extension_cavity_insulation_recommendation = [ + r for r in self.property.non_invasive_recommendations if r["type"] == "extension_cavity_wall_insulation" + ][0] + + # https://surreybuildingprojects.co.uk/how-much-does-a-24m2-extension-cost + average_extension_floor_area = 24 + # https://assets.publishing.service.gov.uk/media/5f047a01d3bf7f2be8350262 + # /Size_of_English_Homes_Fact_Sheet_EHS_2018.pdf + # This is rough + average_house_floor_area = 94 + + proposed_extension_floor_area = self.property.floor_area * ( + average_extension_floor_area / average_house_floor_area + ) + # assume 3 walls are external + proposed_extension_insulation_wall_area = ( + np.sqrt(proposed_extension_floor_area) * self.property.floor_height * 3 + ) + + cost_result = self.costs.cavity_wall_insulation( + wall_area=proposed_extension_insulation_wall_area, + material=self.cavity_wall_insulation_materials[0], + ) + + recommendation = { + "phase": None, + "parts": [], + "type": "extension_cavity_wall_insulation", + "measure_type": "extension_cavity_wall_insulation", + "description": "Insulate the cavity walls of the extension", + "starting_u_value": None, + "new_u_value": None, + "sap_points": extension_cavity_insulation_recommendation["sap_points"], + "already_installed": False, + "simulation_config": {}, + "description_simulation": {}, + **cost_result + } + + return recommendation + def find_cavity_insulation(self, u_value, insulation_thickness, phase, measures, default_u_values): """ This method tests different materials to fill the cavity wall, determining which