diff --git a/.idea/Model.iml b/.idea/Model.iml
index b0f9c00d..4413bb06 100644
--- a/.idea/Model.iml
+++ b/.idea/Model.iml
@@ -7,7 +7,7 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index ca0e1cd9..3b05c6ac 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py
index ab0e32b5..400b2dee 100644
--- a/backend/app/plan/router.py
+++ b/backend/app/plan/router.py
@@ -122,6 +122,12 @@ async def trigger_plan(body: PlanTriggerRequest):
# import pickle
# with open("input_properties.pickle", "rb") as f:
# input_properties = pickle.load(f)
+ #
+ # with open("cleaned.pickle", "rb") as f:
+ # cleaned = pickle.load(f)
+ #
+ # with open("materials_by_type.pickle", "wb") as f:
+ # materials_by_type = pickle.load(f)
recommendations = {}
recommendations_scoring_data = []
diff --git a/recommendations/WallRecommendations.py b/recommendations/WallRecommendations.py
index 379f7026..66ecdf3b 100644
--- a/recommendations/WallRecommendations.py
+++ b/recommendations/WallRecommendations.py
@@ -112,7 +112,7 @@ class WallRecommendations(Definitions):
self.estimated_u_value = u_value
- if self.property.walls["is_solid_brick"]:
+ if self.property.walls["is_solid_brick"] | self.property.walls["is_system_built"]:
if u_value >= self.BUILDING_REGULATIONS_PART_L_MAX_U_VALUE:
self.find_insulation(u_value)
@@ -128,9 +128,7 @@ class WallRecommendations(Definitions):
return
- logger.error("Not implemented yet")
- return
- # NotImplementedError("Not implemented yet")
+ raise NotImplementedError("Not implemented yet")
def find_cavity_insulation(self, u_value, insulation_thickness):
"""
@@ -273,63 +271,6 @@ class WallRecommendations(Definitions):
self.recommendations += ewi_recommendations + iwi_recommendations
- # We also can recommend both internal and external wall insulation together
- # By looping through ewi first, if there is nothing there, that ensures not combinations are tested
- for ewi_part in ewi_parts:
- for iwi_part in iwi_parts:
- for (ewi_depth, ewi_cost_per_unit), (iwi_depth, iwi_cost_per_unit) in itertools.product(
- zip(ewi_part["depths"], ewi_part["cost"]),
- zip(iwi_part["depths"], iwi_part["cost"])
- ):
- ewi_part_u_value = r_value_per_mm_to_u_value(ewi_depth, ewi_part["r_value_per_mm"])
- iwi_part_u_value = r_value_per_mm_to_u_value(iwi_depth, iwi_part["r_value_per_mm"])
-
- # First calculate the new U-value after applying external wall insulation
- _, ewi_new_u_value = calculate_u_value_uplift(u_value, ewi_part_u_value)
- # Then calculate the new U-value after applying internal wall insulation
- _, combined_new_u_value = calculate_u_value_uplift(ewi_new_u_value, iwi_part_u_value)
- combined_new_u_value = round(combined_new_u_value, 2)
-
- if combined_new_u_value < self.DIMINISHING_RETURNS_U_VALUE:
- # We don't recommend an overkill solution
- continue
-
- # Check if the combined new U-value meets the requirement
- if combined_new_u_value - self.U_VALUE_ERROR <= self.BUILDING_REGULATIONS_PART_L_MAX_U_VALUE:
- # Here you might want to define a way to add both recommendations together.
- # For now, I'm adding them as separate items in the list
- ewi_esimtated_cost = ewi_cost_per_unit * self.property.insulation_wall_area
- iwi_esimtated_cost = iwi_cost_per_unit * self.property.insulation_wall_area
-
- recommendation = {
- "parts": [
- get_recommended_part(
- part=ewi_part,
- selected_depth=ewi_depth,
- quantity=self.property.insulation_wall_area,
- quantity_unit=QuantityUnits.m2.value,
- selected_total_cost=ewi_esimtated_cost
- ),
- get_recommended_part(
- part=iwi_part,
- selected_depth=iwi_depth,
- quantity=self.property.insulation_wall_area,
- quantity_unit=QuantityUnits.m2.value,
- selected_total_cost=iwi_esimtated_cost
- )
- ],
- "type": "wall_insulation",
- "description": (
- "Install " + self._make_description(ewi_part, ewi_depth) + " and " +
- self._make_description(iwi_part, iwi_depth)
- ),
- "starting_u_value": u_value,
- "new_u_value": combined_new_u_value,
- "sap_points": None,
- "cost": ewi_esimtated_cost + iwi_esimtated_cost,
- }
- self.recommendations.append(recommendation)
-
self.prune_diminishing_recommendations()
@staticmethod
diff --git a/recommendations/tests/test_wall_recommendations.py b/recommendations/tests/test_wall_recommendations.py
index e910a8f5..c25c00f9 100644
--- a/recommendations/tests/test_wall_recommendations.py
+++ b/recommendations/tests/test_wall_recommendations.py
@@ -503,3 +503,28 @@ class TestCavityWallRecommensations:
assert np.isclose(recommender.recommendations[1]["new_u_value"], 0.57)
assert np.isclose(recommender.recommendations[1]["cost"], 1250)
+
+ def test_system_built_wall(self):
+ input_property2 = Property(id=1, postcode="F4k3 2", address1="223 fake street", epc_client=Mock())
+ input_property2.walls = {
+ 'original_description': 'System built, as built, no insulation (assumed)',
+ 'clean_description': 'System built, as built, no insulation',
+ 'thermal_transmittance': None, 'thermal_transmittance_unit': None,
+ 'is_cavity_wall': False, 'is_filled_cavity': False, 'is_solid_brick': False,
+ 'is_system_built': True, 'is_timber_frame': False, 'is_granite_or_whinstone': False,
+ 'is_as_built': True, 'is_cob': False, 'is_assumed': True,
+ 'is_sandstone_or_limestone': False, 'is_park_home': False,
+ 'insulation_thickness': 'none', 'external_insulation': False,
+ 'internal_insulation': False
+ }
+ input_property2.age_band = "F"
+ input_property2.insulation_wall_area = 120
+
+ recommender2 = WallRecommendations(
+ property_instance=input_property2,
+ materials=internal_wall_insulation_parts + external_wall_insulation_parts
+ )
+
+ assert not recommender2.recommendations
+
+ recommender2.recommend()
\ No newline at end of file