diff --git a/backend/Property.py b/backend/Property.py index b8563b87..1e241b04 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -478,26 +478,6 @@ class Property: for recommendation in recommendations: # For the list of recommendations we have, we iteratively update the output - # Update description to indicate it's insulate - if recommendation["type"] in [ - "solid_floor_insulation", - "suspended_floor_insulation", - "exposed_floor_insulation", - ]: - if len(recommendation["parts"]) > 1: - raise NotImplementedError( - "Have more than 1 floor insulation part - handle this case" - ) - - # We don't really see above average for this in the training data - output["floor_insulation_thickness_ending"] = "average" - else: - if output["floor_thermal_transmittance_ending"] is None: - raise ValueError("We should not have a None value for the u value") - - if output["floor_insulation_thickness_ending"] is None: - output["floor_insulation_thickness_ending"] = "none" - if recommendation["type"] == "sealing_open_fireplace": output["number_open_fireplaces_ending"] = 0 @@ -542,6 +522,7 @@ class Property: "heating", "hot_water_tank_insulation", "heating_control", "secondary_heating", "internal_wall_insulation", "external_wall_insulation", "cavity_wall_insulation", "cylinder_thermostat", "loft_insulation", "room_roof_insulation", "flat_roof_insulation", + "solid_floor_insulation", "suspended_floor_insulation", ]: # We update the data, as defined in the recommendaton if output["walls_insulation_thickness_ending"] is None: @@ -556,6 +537,12 @@ class Property: if output["roof_thermal_transmittance_ending"] is None: raise ValueError("We should not have a None value for the u value") + if output["floor_thermal_transmittance_ending"] is None: + raise ValueError("We should not have a None value for the u value") + + if output["floor_insulation_thickness_ending"] is None: + output["floor_insulation_thickness_ending"] = "none" + simulation_config = recommendation["simulation_config"] # If any entries in simulation_config are None, we will set them to "Unknown" which is the cleaning # value @@ -572,7 +559,7 @@ class Property: "sealing_open_fireplace", "low_energy_lighting", "internal_wall_insulation", "external_wall_insulation", "cavity_wall_insulation", "loft_insulation", "room_roof_insulation", "flat_roof_insulation", - "solid_floor_insulation", "suspended_floor_insulation", "exposed_floor_insulation", + "solid_floor_insulation", "suspended_floor_insulation", "windows_glazing", "solar_pv", "heating", "hot_water_tank_insulation", "heating_control", "secondary_heating", "cylinder_thermostat" ]: diff --git a/recommendations/FloorRecommendations.py b/recommendations/FloorRecommendations.py index 9faedb89..5a8ad242 100644 --- a/recommendations/FloorRecommendations.py +++ b/recommendations/FloorRecommendations.py @@ -8,9 +8,10 @@ from datatypes.enums import QuantityUnits from backend.Property import Property from recommendations.recommendation_utils import ( r_value_per_mm_to_u_value, calculate_u_value_uplift, is_diminishing_returns, update_lowest_selected_u_value, - get_recommended_part, get_floor_u_value, override_costs + get_recommended_part, get_floor_u_value, override_costs, check_simulation_difference ) from recommendations.Costs import Costs +from etl.epc_clean.epc_attributes.FloorAttributes import FloorAttributes class FloorRecommendations(Definitions): @@ -118,7 +119,7 @@ class FloorRecommendations(Definitions): if u_value < self.BUILDING_REGULATIONS_PART_L_MAX_U_VALUE: return - if self.property.floor["is_suspended"]: + if self.property.floor["is_suspended"] or self.property.floor["is_to_unheated_space"]: # Given the U-value, we recommend underfloor insulation self.recommend_floor_insulation( phase=phase, @@ -197,6 +198,8 @@ class FloorRecommendations(Definitions): if already_installed: cost_result = override_costs(cost_result) + new_description = "Suspended, insulated" + elif material["type"] == "solid_floor_insulation": cost_result = self.costs.solid_floor_insulation( insulation_floor_area=self.property.insulation_floor_area, @@ -207,9 +210,21 @@ class FloorRecommendations(Definitions): already_installed = "solid_floor_insulation" in self.property.already_installed if already_installed: cost_result = override_costs(cost_result) + + new_description = "Solid, insulated" else: raise NotImplementedError("Implement me!") + floor_ending_config = FloorAttributes(new_description).process() + floor_simulation_config = check_simulation_difference( + new_config=floor_ending_config, old_config=self.property.floor, prefix="floor_" + ) + + simulation_config = { + **floor_simulation_config, + "floor_thermal_transmittance_ending": new_u_value, + } + self.recommendations.append( { "phase": phase, @@ -227,6 +242,7 @@ class FloorRecommendations(Definitions): "new_u_value": new_u_value, "sap_points": None, "already_installed": already_installed, + "simulation_config": simulation_config, "description_simulation": { "floor-description": "Solid, insulated" if material["type"] == "solid_floor_insulation"