diff --git a/model_data/app.py b/model_data/app.py index 0a8a6aaa..4d8bd342 100644 --- a/model_data/app.py +++ b/model_data/app.py @@ -123,10 +123,10 @@ def handler(): [{"address1": p.address1, **p.floor} for p in input_properties] ) - input_properties[2].data["address1"] - input_properties[2].data["postcode"] - floors_df["address1"].values[2] - floors_df["original_description"].values[2] + input_properties[3].data["address1"] + input_properties[3].data["postcode"] + floors_df["address1"].values[3] + floors_df["original_description"].values[3] df = pd.DataFrame( [ @@ -136,7 +136,7 @@ def handler(): df["property-type"].unique() from model_data.recommendations.FloorRecommendations import FloorRecommendations - self = FloorRecommendations(property_instance=input_properties[2], uvalue_estimates=uvalue_estimates) + self = FloorRecommendations(property_instance=input_properties[3], uvalue_estimates=uvalue_estimates) # We need to deduce a U-value for "Good" energy effieciency diff --git a/model_data/recommendations/FloorRecommendations.py b/model_data/recommendations/FloorRecommendations.py index 3208378f..09d5b8e6 100644 --- a/model_data/recommendations/FloorRecommendations.py +++ b/model_data/recommendations/FloorRecommendations.py @@ -60,6 +60,8 @@ class FloorRecommendations(BaseUtility): "England and Wales": "England_Wales", } + PART_L_YEAR_CUTOFF = 2002 + def __init__(self, property_instance: Property, uvalue_estimates: UvalueEstimations): self.property = property_instance self.uvalue_estimates = uvalue_estimates @@ -144,12 +146,13 @@ class FloorRecommendations(BaseUtility): return u def recommend(self): + u_value = self.property.floor["thermal_transmittance"] is_suspended = self.property.floor["is_suspended"] insulation_thickness = self.property.floor["insulation_thickness"] # Check which floor the property is on - self.property.year_built + year_built = self.property.year_built self.property.data["floor-energy-eff"] self.property.data["floor-env-eff"] @@ -159,8 +162,20 @@ class FloorRecommendations(BaseUtility): # If there's another property below, it's likely impractical to recommend a floor upgrade return - if is_suspended: + if u_value: + if self.property.data["property-type"] != "House": + raise NotImplementedError("Implement me") + # By being built more recently than this, it means that the property was likely build with soild + # concrete floors with insulation already + if year_built < self.PART_L_YEAR_CUTOFF: + raise NotImplementedError("Not investigated this use case") + + if u_value <= self.BUILDING_REGULATIONS_PART_L_MAX_U_VALUE: + # The floor is already compliant + return + + if is_suspended: total_floor_area = float(self.property.data["total-floor-area"]) number_of_rooms = float(self.property.data["number-habitable-rooms"])