From 340e8118eb9a92819ce48a06fe65c07c40f3ef30 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 21 May 2024 14:40:57 +0100 Subject: [PATCH] adding in u-value extraction and handling cases of setting energy efficiency more elegantly --- backend/Property.py | 14 ++++++++------ recommendations/WallRecommendations.py | 15 +++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index a5918802..f2e6590c 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -351,7 +351,10 @@ class Property: # Setting the insulation thickness here to above average should be tested further because we # don't see a high volume of instances for this output["walls_insulation_thickness_ending"] = "average" - output["walls_energy_eff_ending"] = "Good" + # In some edge cases, or when running the mds report we might see the energy efficiency already + # in Good or Very Good + if output["walls_energy_eff_ending"] not in ["Good", "Very Good"]: + output["walls_energy_eff_ending"] = "Good" # Note: often when the wall is insulatied, the internal/external insulation is not noted so we should # test the impact of using these booleans @@ -384,11 +387,8 @@ class Property: "Have more than 1 floor insulation part - handle this case" ) - # output["floor_thermal_transmittance_ending"] = recommendation["new_u_value"] # We don't really see above average for this in the training data output["floor_insulation_thickness_ending"] = "average" - # This is rarely ever populated in the training data - # output["floor_energy_eff_ending"] = "Good" else: if output["floor_thermal_transmittance_ending"] is None: raise ValueError("We should not have a None value for the u value") @@ -439,7 +439,8 @@ class Property: if proposed_depth >= 270: output["roof_energy_eff_ending"] = "Very Good" else: - output["roof_energy_eff_ending"] = "Good" + if output["roof_energy_eff_ending"] not in ["Good", "Very Good"]: + output["roof_energy_eff_ending"] = "Good" else: output["roof_energy_eff_ending"] = "Very Good" else: @@ -459,7 +460,8 @@ class Property: if recommendation["type"] == "windows_glazing": output["multi_glaze_proportion_ending"] = 100 - output["windows_energy_eff_ending"] = "Average" + if output["windows_energy_eff_ending"] not in ["Average", "Good", "Very Good"]: + output["windows_energy_eff_ending"] = "Average" is_secondary_glazing = recommendation["is_secondary_glazing"] diff --git a/recommendations/WallRecommendations.py b/recommendations/WallRecommendations.py index 71996e5c..6cdfbfdd 100644 --- a/recommendations/WallRecommendations.py +++ b/recommendations/WallRecommendations.py @@ -124,12 +124,15 @@ class WallRecommendations(Definitions): # Function specifically for external wall insulation, for usage in the mds report self.recommendations = [] - 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"], - ) + u_value = self.property.walls["thermal_transmittance"] + + if u_value is None: + 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"], + ) # EWI ewi_recommendations = self._find_insulation(