fixing wall recommendations

This commit is contained in:
Khalim Conn-Kowlessar 2023-09-12 15:26:55 +01:00
parent 1ece494614
commit df878007d2
2 changed files with 81 additions and 72 deletions

View file

@ -9,66 +9,6 @@ from recommendations.recommendation_utils import (
get_recommended_part, get_uvalue_estimate
)
suspended_floor_insulation_parts = [
{
# Example product
# https://www.insulationsuperstore.co.uk/product/recticel-eurothane-general-purpose-pir-insulation-board-2400
# -x-1200-x-100mm.html
# All product data_types here:
# https://www.insulationsuperstore.co.uk/browse/insulation/brand/recticel/filterby/application/floors.html
"type": "suspended_floor_insulation",
"description": "Rigid Insulation Foam Boards",
"depths": [25, 30, 40, 50, 60, 70, 75, 80, 90, 100, 110, 120, 130, 140, 150],
"depth_unit": "mm",
"cost": None,
"cost_unit": None,
"r_value_per_mm": 0.04545454545454546,
"r_value_unit": "square_meter_kelvin_per_watt",
"thermal_conductivity": 0.022,
"thermal_conductivity_unit": "watt_per_meter_kelvin"
},
{
# Example product
# https://www.insulationsuperstore.co.uk/product/rockwool-rwa45-acoustic-insulation-slab-100mm-2-88m2-pack.html
# All product data_types here:
# https://www.insulationsuperstore.co.uk/browse/insulation/brand/rockwool/filterby/application/floors
# /material/mineral-wool.html
"type": "suspended_floor_insulation",
"description": "Mineral Wool Floor Insulation",
"depths": [25, 40, 50, 60, 75, 100],
"depth_unit": "mm",
"cost": None,
"cost_unit": None,
"r_value_per_mm": 0.02857142857142857,
"r_value_unit": "square_meter_kelvin_per_watt",
"thermal_conductivity": 0.035,
"thermal_conductivity_unit": "watt_per_meter_kelvin"
},
]
solid_floor_insulation_parts = [
{
# Example product
# https://www.insulationexpress.co.uk/floor-insulation/solid-floor-insulation/k103-100mm
# All product data_types here:
# https://www.insulationexpress.co.uk/floor-insulation/solid-floor-insulation?brand=7015&p=1
# Example screed https://www.screwfix.com/p/mapei-ultraplan-3240-self-levelling-compound-25kg/4959f
"type": "solid_floor_insulation",
"description": "Rigid Insulation Foam Boards with floor screed",
"depths": [25, 50, 70, 75, 100],
"depth_unit": "mm",
"cost": None,
"cost_unit": None,
"r_value_per_mm": 0.04545454545454546,
"r_value_unit": "square_meter_kelvin_per_watt",
"thermal_conductivity": 0.052631578947368425,
"thermal_conductivity_unit": "watt_per_meter_kelvin"
},
]
parts = suspended_floor_insulation_parts + solid_floor_insulation_parts
class FloorRecommendations(Definitions):
# part L building regulations indicate that any rennovations on an existing property's walls should
@ -101,7 +41,7 @@ class FloorRecommendations(Definitions):
property_instance: Property,
uvalue_estimates: List,
total_floor_area_group_decile: str,
materials: List = None,
materials: List,
):
self.property = property_instance
self.uvalue_estimates = uvalue_estimates
@ -112,10 +52,7 @@ class FloorRecommendations(Definitions):
# Will contains a list of recommended measures
self.recommendations = []
if materials:
self.materials = materials
else:
self.materials = parts
self.materials = materials
self.suspended_floor_insulation_parts = [
part for part in self.materials if part["type"] == "suspended_floor_insulation"

View file

@ -4,7 +4,6 @@ import os
from unittest.mock import Mock
from recommendations.FloorRecommendations import FloorRecommendations
# with open(
# os.path.abspath(os.path.dirname(__file__)) + "/recommendations/tests/test_data/input_properties.pkl", "rb"
# ) as f:
@ -16,6 +15,67 @@ from recommendations.FloorRecommendations import FloorRecommendations
# uvalue_estimates = pickle.load(f)
suspended_floor_insulation_parts = [
{
# Example product
# https://www.insulationsuperstore.co.uk/product/recticel-eurothane-general-purpose-pir-insulation-board-2400
# -x-1200-x-100mm.html
# All product data_types here:
# https://www.insulationsuperstore.co.uk/browse/insulation/brand/recticel/filterby/application/floors.html
"type": "suspended_floor_insulation",
"description": "Rigid Insulation Foam Boards",
"depths": [25, 30, 40, 50, 60, 70, 75, 80, 90, 100, 110, 120, 130, 140, 150],
"depth_unit": "mm",
"cost": [25, 30, 40, 50, 60, 70, 75, 80, 90, 100, 110, 120, 130, 140, 150],
"cost_unit": "gbp_sq_meter",
"r_value_per_mm": 0.04545454545454546,
"r_value_unit": "square_meter_kelvin_per_watt",
"thermal_conductivity": 0.022,
"thermal_conductivity_unit": "watt_per_meter_kelvin"
},
{
# Example product
# https://www.insulationsuperstore.co.uk/product/rockwool-rwa45-acoustic-insulation-slab-100mm-2-88m2-pack.html
# All product data_types here:
# https://www.insulationsuperstore.co.uk/browse/insulation/brand/rockwool/filterby/application/floors
# /material/mineral-wool.html
"type": "suspended_floor_insulation",
"description": "Mineral Wool Floor Insulation",
"depths": [25, 40, 50, 60, 75, 100],
"depth_unit": "mm",
"cost": [25, 40, 50, 60, 75, 100],
"cost_unit": "gbp_sq_meter",
"r_value_per_mm": 0.02857142857142857,
"r_value_unit": "square_meter_kelvin_per_watt",
"thermal_conductivity": 0.035,
"thermal_conductivity_unit": "watt_per_meter_kelvin"
},
]
solid_floor_insulation_parts = [
{
# Example product
# https://www.insulationexpress.co.uk/floor-insulation/solid-floor-insulation/k103-100mm
# All product data_types here:
# https://www.insulationexpress.co.uk/floor-insulation/solid-floor-insulation?brand=7015&p=1
# Example screed https://www.screwfix.com/p/mapei-ultraplan-3240-self-levelling-compound-25kg/4959f
"type": "solid_floor_insulation",
"description": "Rigid Insulation Foam Boards with floor screed",
"depths": [25, 50, 70, 75, 100],
"depth_unit": "mm",
"cost": [25, 40, 50, 60, 75, 100],
"cost_unit": "gbp_sq_meter",
"r_value_per_mm": 0.04545454545454546,
"r_value_unit": "square_meter_kelvin_per_watt",
"thermal_conductivity": 0.052631578947368425,
"thermal_conductivity_unit": "watt_per_meter_kelvin"
},
]
parts = suspended_floor_insulation_parts + solid_floor_insulation_parts
class TestWallRecommendations:
@pytest.fixture
@ -48,7 +108,8 @@ class TestWallRecommendations:
obj = FloorRecommendations(
property_instance=input_properties[0],
uvalue_estimates=uvalue_estimates,
total_floor_area_group_decile="Decile 1"
total_floor_area_group_decile="Decile 1",
materials=parts
)
assert obj
assert obj.property
@ -59,7 +120,8 @@ class TestWallRecommendations:
recommender = FloorRecommendations(
property_instance=input_properties[0],
uvalue_estimates=uvalue_estimates,
total_floor_area_group_decile="Decile 1"
total_floor_area_group_decile="Decile 1",
materials=parts
)
recommender.recommend()
assert recommender.property.floor["another_property_below"]
@ -71,10 +133,14 @@ class TestWallRecommendations:
For a suspended floor without insulation, we use the rdsap methogology to estimate a U-value for the floor
:return:
"""
input_properties[2].floor_area = 50
recommender = FloorRecommendations(
property_instance=input_properties[2],
uvalue_estimates=uvalue_estimates,
total_floor_area_group_decile="Decile 1"
total_floor_area_group_decile="Decile 1",
materials=parts
)
assert recommender.estimated_u_value is None
recommender.recommend()
@ -95,7 +161,8 @@ class TestWallRecommendations:
recommender = FloorRecommendations(
property_instance=input_properties[3],
uvalue_estimates=uvalue_estimates,
total_floor_area_group_decile="Decile 1"
total_floor_area_group_decile="Decile 1",
materials=parts
)
assert recommender.estimated_u_value is None
recommender.recommend()
@ -108,10 +175,14 @@ class TestWallRecommendations:
"""
:return:
"""
input_properties[4].floor_area = 100
recommender = FloorRecommendations(
property_instance=input_properties[4],
uvalue_estimates=uvalue_estimates,
total_floor_area_group_decile="Decile 1"
total_floor_area_group_decile="Decile 1",
materials=parts
)
assert recommender.estimated_u_value is None
recommender.recommend()
@ -132,7 +203,8 @@ class TestWallRecommendations:
recommender = FloorRecommendations(
property_instance=input_properties[6],
uvalue_estimates=uvalue_estimates,
total_floor_area_group_decile="Decile 1"
total_floor_area_group_decile="Decile 1",
materials=parts
)
assert recommender.estimated_u_value is None
recommender.recommend()