Working through new costs

This commit is contained in:
Khalim Conn-Kowlessar 2023-11-28 19:40:50 +00:00
parent 96b49aa680
commit 7ad88efbd4
5 changed files with 36 additions and 7 deletions

View file

@ -219,6 +219,22 @@ async def trigger_plan(body: PlanTriggerRequest):
recommendations=recommendations
)
print("GET RID OF ME!")
rec_df = []
for rec_group in recommendations_with_impact:
for rec in rec_group:
rec_df.append(
{
"type": rec["type"],
"description": rec["description"],
"sap": rec["sap_points"],
"total": rec["total"],
"co2_equivalent_savings": rec["co2_equivalent_savings"],
"heat_demand": rec["heat_demand"]
}
)
rec_df = pd.DataFrame(rec_df)
input_measures = prepare_input_measures(recommendations_with_impact, body.goal)
if body.budget:

View file

@ -171,8 +171,13 @@ def create_recommendation_scoring_data(
if recommendation["type"] == "sealing_open_fireplace":
scoring_dict["NUMBER_OPEN_FIREPLACES_ENDING"] = 0
if recommendation["type"] == "low_energy_lighting":
scoring_dict["LOW_ENERGY_LIGHTING_ENDING"] = 100
scoring_dict["LIGHTING_ENERGY_EFF_STARTING"] = "Very Good"
if recommendation["type"] not in [
"wall_insulation", "floor_insulation", "roof_insulation", "mechanical_ventilation", "sealing_open_fireplace",
"low_energy_lighting"
]:
raise NotImplementedError("Implement me")

View file

@ -41,7 +41,7 @@ class Costs:
CONTINGENCY = 0.1
# Where there is more uncertainty, a higher contingency rate is used
HIGH_RISK_CONTINGENCY = 0.15
HIGH_RISK_CONTINGENCY = 0.2
# When there is less uncertainty, a lower contingency rate is used
LOW_RISK_CONTINGENCY = 0.05
@ -54,8 +54,8 @@ class Costs:
# have a preliminaries of 12-14% so we use 12% as the median for the preliminaries rate.
# For External wall insulation (EWI), we use 15% as the preliminaries rate if we think the property might
# need scaffolding, otherwise we use 12%. This is to account for any site preparation that might be required
EWI_NO_SCAFFOLDING_PRELIMINARIES = 0.12
EWI_SCAFFOLDING_PRELIMINARIES = 0.15
EWI_NO_SCAFFOLDING_PRELIMINARIES = 0.15
EWI_SCAFFOLDING_PRELIMINARIES = 0.20
VAT_RATE = 0.2
PROFIT_MARGIN = 0.2

View file

@ -53,11 +53,16 @@ class LightingRecommendations:
material=self.material
)
if number_non_lel_outlets == 1:
description = "Install low energy lighting in %s 1 remaining outlet"
else:
description = "Install low energy lighting in %s outlets" % str(number_non_lel_outlets)
self.recommendation = [
{
"parts": [],
"type": "sealing_open_fireplace",
"description": "Install low energy lighting in %s outlets" % str(number_non_lel_outlets),
"type": "low_energy_lighting",
"description": description,
"starting_u_value": None,
"new_u_value": None,
"sap_points": None,

View file

@ -263,12 +263,14 @@ class WallRecommendations(Definitions):
material=material.to_dict(),
non_insulation_materials=non_insulation_materials
)
description = "Install " + self._make_description(material) + " on internal walls"
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
)
description = "Install " + self._make_description(material) + " on external walls"
else:
raise ValueError("Invalid material type")
@ -283,7 +285,7 @@ class WallRecommendations(Definitions):
)
],
"type": "wall_insulation",
"description": "Install " + self._make_description(material),
"description": description,
"starting_u_value": u_value,
"new_u_value": new_u_value,
"sap_points": None,
@ -321,7 +323,8 @@ class WallRecommendations(Definitions):
self.recommendations += ewi_recommendations + iwi_recommendations
self.prune_diminishing_recommendations()
# We remove this temporarily
# self.prune_diminishing_recommendations()
@staticmethod
def _make_description(material):