From b052c9925f9064d2462442cccecac08bc511cc21 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 12 Apr 2024 15:41:52 +0100 Subject: [PATCH] Added heating override --- recommendations/FireplaceRecommendations.py | 4 ++- recommendations/FloorRecommendations.py | 2 +- recommendations/HeatingRecommender.py | 22 ++++++++++++----- recommendations/WindowsRecommendations.py | 27 +++++++++++++-------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/recommendations/FireplaceRecommendations.py b/recommendations/FireplaceRecommendations.py index 5d620d49..c1114f31 100644 --- a/recommendations/FireplaceRecommendations.py +++ b/recommendations/FireplaceRecommendations.py @@ -32,7 +32,8 @@ class FireplaceRecommendations(Definitions): if number_open_fireplaces == 0: return - estimated_cost = number_open_fireplaces * self.COST_OF_WORK + is_override = "sealing_open_fireplace" in self.property.override + estimated_cost = number_open_fireplaces * self.COST_OF_WORK if not is_override else 0 # We recommend installing two mechanical ventilation systems self.recommendation = [ @@ -44,6 +45,7 @@ class FireplaceRecommendations(Definitions): "starting_u_value": None, "new_u_value": None, "sap_points": None, + "is_override": is_override, "total": estimated_cost, # Take a very basic estimate of 6 hours, multipled by the number of open fireplaces to seal "labour_hours": 6 * number_open_fireplaces, diff --git a/recommendations/FloorRecommendations.py b/recommendations/FloorRecommendations.py index 1744a928..b7bd370c 100644 --- a/recommendations/FloorRecommendations.py +++ b/recommendations/FloorRecommendations.py @@ -207,7 +207,6 @@ class FloorRecommendations(Definitions): is_override = "solid_floor_insulation" in self.property.override if is_override: cost_result = override_costs(cost_result) - else: raise NotImplementedError("Implement me!") @@ -227,6 +226,7 @@ class FloorRecommendations(Definitions): "starting_u_value": u_value, "new_u_value": new_u_value, "sap_points": None, + "is_override": is_override, **cost_result } ) diff --git a/recommendations/HeatingRecommender.py b/recommendations/HeatingRecommender.py index 92457a27..27e4985a 100644 --- a/recommendations/HeatingRecommender.py +++ b/recommendations/HeatingRecommender.py @@ -1,7 +1,7 @@ import pandas as pd from recommendations.Costs import Costs -from recommendations.recommendation_utils import check_simulation_difference +from recommendations.recommendation_utils import check_simulation_difference, override_costs from backend.Property import Property from etl.epc_clean.epc_attributes.MainheatAttributes import MainHeatAttributes from etl.epc_clean.epc_attributes.HotWaterAttributes import HotWaterAttributes @@ -33,7 +33,7 @@ class HeatingRecommender: if has_electric_heating_description or no_heating_no_mains: # Recommend high heat retention storage heaters - self.recommend_electric_storage_heaters(phase=phase, system_change=True, heating_controls_only=False) + self.recommend_hhr_storage_heaters(phase=phase, system_change=True, heating_controls_only=False) # if the property has mains heating with boiler and radiators, we recommend optimal heating controls has_boiler = self.property.main_heating["clean_description"] in ["Boiler and radiators, mains gas"] @@ -89,9 +89,8 @@ class HeatingRecommender: return differences - @staticmethod def combine_heating_and_controls( - controls_recommendations, heating_simulation_config, costs, description, phase, heating_controls_only, + self, controls_recommendations, heating_simulation_config, costs, description, phase, heating_controls_only, system_change ): """ @@ -140,6 +139,11 @@ class HeatingRecommender: recommendation_description = f"{description} and {controls_description}" + is_override = "cavity_wall_insulation" in self.property.override + if is_override: + total_costs = override_costs(total_costs) + recommendation_description = "Heating system has already been upgraded, no further action needed." + recommendation = { "phase": phase, "parts": [ @@ -150,6 +154,7 @@ class HeatingRecommender: "starting_u_value": None, "new_u_value": None, "sap_points": None, + "is_override": is_override, **total_costs, "simulation_config": recommendation_simulation_config } @@ -181,9 +186,8 @@ class HeatingRecommender: return output - def recommend_electric_storage_heaters(self, phase, system_change, heating_controls_only): + def recommend_hhr_storage_heaters(self, phase, system_change, heating_controls_only): """ - We recommend electric storage heaters as an upgrade to the heating system. We will recommend upgrading to a high heat retention storage system, if the current system is not already high heat retention storage @@ -360,6 +364,11 @@ class HeatingRecommender: n_heated_rooms=self.property.data["number-heated-rooms"] ) + is_override = "heating" in self.property.override + if is_override: + boiler_costs = override_costs(boiler_costs) + description = "Heating system has already been upgraded, no further action needed." + boiler_recommendation = { "phase": recommendation_phase, "parts": [ @@ -370,6 +379,7 @@ class HeatingRecommender: "starting_u_value": None, "new_u_value": None, "sap_points": None, + "is_override": is_override, "simulation_config": simulation_config, **boiler_costs } diff --git a/recommendations/WindowsRecommendations.py b/recommendations/WindowsRecommendations.py index d7404e3b..b2fe20a6 100644 --- a/recommendations/WindowsRecommendations.py +++ b/recommendations/WindowsRecommendations.py @@ -4,6 +4,7 @@ import numpy as np from backend.Property import Property from recommendations.Costs import Costs +from recommendation_utils import override_costs class WindowsRecommendations: @@ -70,18 +71,23 @@ class WindowsRecommendations: is_secondary_glazing=is_secondary_glazing ) - glazing_type = "secondary glazing" if is_secondary_glazing else "double glazing" - if self.property.windows["glazing_coverage"] in ["partial", "most"]: - description = f"Install {glazing_type} to the remaining windows" + is_override = "windows_glazing" in self.property.override + if is_override: + cost_result = override_costs(cost_result) + description = "The property already has double glazing installed. No further action is required." else: - description = f"Install {glazing_type} to all windows" + glazing_type = "secondary glazing" if is_secondary_glazing else "double glazing" + if self.property.windows["glazing_coverage"] in ["partial", "most"]: + description = f"Install {glazing_type} to the remaining windows" + else: + description = f"Install {glazing_type} to all windows" - if self.property.is_listed: - description += ". Secondary glazing recommended due to listed building status" - elif self.property.is_heritage: - description += ". Secondary glazing recommended due to herigate building status" - elif self.property.in_conservation_area: - description += ". Secondary glazing recommended due to conservation area status" + if self.property.is_listed: + description += ". Secondary glazing recommended due to listed building status" + elif self.property.is_heritage: + description += ". Secondary glazing recommended due to herigate building status" + elif self.property.in_conservation_area: + description += ". Secondary glazing recommended due to conservation area status" self.recommendation = [ { @@ -92,6 +98,7 @@ class WindowsRecommendations: "starting_u_value": None, "new_u_value": None, "sap_points": None, + "is_override": is_override, **cost_result, "is_secondary_glazing": is_secondary_glazing }