From 9f205e3dce06498cb28964a9a5e95b7037634cbc Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 20 Feb 2024 20:50:17 +0000 Subject: [PATCH] roughly implemented hot water insulation jacket tank insulation --- etl/epc_clean/app.py | 1 + recommendations/Costs.py | 18 +++++++++ recommendations/HotwaterRecommendations.py | 46 ++++++++++++++++++++-- recommendations/Recommendations.py | 2 + 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/etl/epc_clean/app.py b/etl/epc_clean/app.py index cf75f24a..53c1a329 100644 --- a/etl/epc_clean/app.py +++ b/etl/epc_clean/app.py @@ -35,6 +35,7 @@ def app(): cleaned_data = {} epc_directories = [entry for entry in EPC_DIRECTORY.iterdir() if entry.is_dir()] + for directory in tqdm(epc_directories): data = pd.read_csv(directory / "certificates.csv", low_memory=False) # Rename the columns to the same format as the api returns diff --git a/recommendations/Costs.py b/recommendations/Costs.py index c94eb79c..b2874f28 100644 --- a/recommendations/Costs.py +++ b/recommendations/Costs.py @@ -980,3 +980,21 @@ class Costs: "labour_hours": 4, "labour_days": 1, } + + def hot_water_tank_insulation(self): + """ + Calculate the cost of installing hot water tank insulation + """ + + # The £50 cost is a rough estimate based on internet research + total_cost = 50 + subtotal_before_vat = total_cost / (1 + self.VAT_RATE) + vat = total_cost - subtotal_before_vat + + return { + "total": total_cost, + "subtotal": subtotal_before_vat, + "vat": vat, + "labour_hours": 0, + "labour_days": 0, + } diff --git a/recommendations/HotwaterRecommendations.py b/recommendations/HotwaterRecommendations.py index b628f9a2..298671a2 100644 --- a/recommendations/HotwaterRecommendations.py +++ b/recommendations/HotwaterRecommendations.py @@ -7,7 +7,47 @@ class HotwaterRecommendations: self.property = property_instance self.costs = Costs(self.property) - self.recommendation = [] + self.recommendations = [] - def recommend(self): - pass + def recommend(self, phase): + """ + There are maybe a number of recommendations that are simultaneously applicable to the property. + If this is true then the phase may need to be incrememnted from within this recommendation + + :param phase: + :return: + """ + # Reset the recommendations + self.recommendations = [] + + # This first iteration of the recommender will provide very basic recommendation + # We recommend heating controls based on the main heating system + if (self.property.hotwater["heater_type"] in ["electric immersion"]) & \ + (self.property.data["hot-water-energy-eff"] == "Very Poor"): + self.recommend_tank_insulation(phase=phase) + return + + def recommend_tank_insulation(self, phase): + """ + If the home has a very poor hot water system, this is often indicative of a lack of insulation on the hot water + tank. This is a very simple and cost effective improvement that can be made to the home. + """ + + recommendation_cost = self.costs.hot_water_tank_insulation() + + self.recommendations.append( + { + "phase": phase, + "parts": [ + # TODO + ], + "type": "hot_water_tank_insulation", + "description": "Insulate the hot water tank with an insulation jacket", + "starting_u_value": None, + "new_u_value": None, + "sap_points": None, + **recommendation_cost, + "simulation_config": {"hot_water_energy_eff_ending": "Average"} + } + ) + return diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index e5391626..3ea29ca2 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -10,6 +10,7 @@ from recommendations.LightingRecommendations import LightingRecommendations from recommendations.SolarPvRecommendations import SolarPvRecommendations from recommendations.WindowsRecommendations import WindowsRecommendations from recommendations.HeatingRecommender import HeatingRecommender +from recommendations.HotwaterRecommendations import HotwaterRecommendations from backend.ml_models.AnnualBillSavings import AnnualBillSavings @@ -42,6 +43,7 @@ class Recommendations: self.windows_recommender = WindowsRecommendations(property_instance=property_instance, materials=materials) self.solar_recommender = SolarPvRecommendations(property_instance=property_instance) self.heating_recommender = HeatingRecommender(property_instance=property_instance) + self.hotwater_recommender = HotwaterRecommendations(property_instance=property_instance) def recommend(self):