mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added override to wall insulation
This commit is contained in:
parent
8e2d823693
commit
0ede95cc4a
3 changed files with 29 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import ast
|
||||
from itertools import groupby
|
||||
import pandas as pd
|
||||
|
||||
|
|
@ -77,7 +78,8 @@ class Property:
|
|||
# This is a list of measures that have already been installed in the property, typically found as a result
|
||||
# of the non-invasive surveys. We reflect that this has been installed in the recommendations, but remove the
|
||||
# cost and instead, provide a message that the measure has already been installed
|
||||
self.override = override
|
||||
|
||||
self.override = ast.literal_eval(override['overrides']) if override is not None else []
|
||||
|
||||
self.uprn = epc_record.get("uprn")
|
||||
self.full_sap_epc = epc_record.get("full_sap_epc")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from backend.Property import Property
|
|||
from BaseUtility import Definitions
|
||||
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_wall_u_value
|
||||
get_recommended_part, get_wall_u_value, override_costs
|
||||
)
|
||||
from recommendations.config import PARTIALLY_FILLED_PERCENTAGE_ASSUMPTION
|
||||
from recommendations.Costs import Costs
|
||||
|
|
@ -221,6 +221,10 @@ class WallRecommendations(Definitions):
|
|||
material=material.to_dict(),
|
||||
)
|
||||
|
||||
is_override = "cavity_wall_insulation" in cost_result
|
||||
if is_override:
|
||||
cost_result = override_costs(cost_result)
|
||||
|
||||
recommendations.append(
|
||||
{
|
||||
"phase": phase,
|
||||
|
|
@ -237,6 +241,7 @@ class WallRecommendations(Definitions):
|
|||
"starting_u_value": u_value,
|
||||
"new_u_value": new_u_value,
|
||||
"sap_points": None,
|
||||
"is_override": is_override,
|
||||
**cost_result
|
||||
}
|
||||
)
|
||||
|
|
@ -277,12 +282,19 @@ class WallRecommendations(Definitions):
|
|||
material=material.to_dict(),
|
||||
non_insulation_materials=non_insulation_materials
|
||||
)
|
||||
is_override = "internal_wall_insulation" in cost_result
|
||||
if is_override:
|
||||
cost_result = override_costs(cost_result)
|
||||
|
||||
elif material["type"] == "external_wall_insulation":
|
||||
cost_result = self.costs.external_wall_insulation(
|
||||
wall_area=self.property.insulation_wall_area,
|
||||
material=material.to_dict(),
|
||||
non_insulation_materials=non_insulation_materials
|
||||
)
|
||||
is_override = "external_wall_insulation" in cost_result
|
||||
if is_override:
|
||||
cost_result = override_costs(cost_result)
|
||||
else:
|
||||
raise ValueError("Invalid material type")
|
||||
|
||||
|
|
@ -301,6 +313,7 @@ class WallRecommendations(Definitions):
|
|||
"description": self._make_description(material),
|
||||
"starting_u_value": u_value,
|
||||
"new_u_value": new_u_value,
|
||||
"is_override": is_override,
|
||||
"sap_points": None,
|
||||
**cost_result
|
||||
}
|
||||
|
|
|
|||
|
|
@ -767,3 +767,15 @@ def check_simulation_difference(old_config, new_config):
|
|||
differences = {key + "_ending": new_config[key] for key in new_config if old_config[key] != new_config[key]}
|
||||
|
||||
return differences
|
||||
|
||||
|
||||
def override_costs(costs):
|
||||
"""
|
||||
If the method is overridden, we want to make sure that the costs are zero. This function sets the costs to zero
|
||||
:param costs: Dictionary of costing, as returned by the Costs class
|
||||
:return:
|
||||
"""
|
||||
for k in costs:
|
||||
costs[k] = 0
|
||||
|
||||
return costs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue