First internal wall insulation recommendation

This commit is contained in:
Khalim Conn-Kowlessar 2023-06-20 15:43:47 +01:00
parent b549a9ead1
commit 9bbed2f5ef

View file

@ -1,3 +1,5 @@
import math
from model_data.Property import Property
import pandas as pd
@ -19,8 +21,11 @@ wall_parts = [
class WallRecommendations:
YEAR_WALLS_BUILT_WITH_INSULATION = 1990
U_VALUE_UNIT = 'w/m-¦k'
BUILDING_REGULATIONS_NEW_BUILD_L_MAX_U_VALUE = 0.18
BUILDING_REGULATIONS_EXISTING_BUILD_L_MAX_U_VALUE = 0.3
BUILDING_REGULATIONS_PART_L_MAX_U_VALUE = 0.18
# Add some error so that if, for example, a new part we recommend provides a u-value of 0.19,
# we still consider it as an option
U_VALUE_ERROR = 0.01
def __init__(self, property_instance: Property):
self.property = property_instance
@ -54,12 +59,13 @@ class WallRecommendations:
raise NotImplementedError("Haven't handled the case of other u value units yet")
if (not is_cavity_wall) and (self.year_built >= self.YEAR_WALLS_BUILT_WITH_INSULATION) and (
u_value >= self.BUILDING_REGULATIONS_EXISTING_BUILD_L_MAX_U_VALUE
u_value >= self.BUILDING_REGULATIONS_PART_L_MAX_U_VALUE
):
# Recommend internal wall insulation
iwi_parts = [part for part in wall_parts if part["type"] == "internal_wall_insulation"]
for part in iwi_parts:
_, new_u_value = self.calculate_u_value_uplift(u_value, part["u_value"])
new_u_value = round(new_u_value, 2)
self.recommendations.append(
{