Merge branch 'main' of github.com:Hestia-Homes/Model into michael-initial

This commit is contained in:
Michael Duong 2023-08-12 11:35:14 +00:00
commit e3be4ba344
3 changed files with 26 additions and 6 deletions

View file

@ -226,15 +226,15 @@ async def trigger_plan(body: PlanTriggerRequest):
(x['walls-env-eff'] == p.data["walls-env-eff"] if p.data["walls-env-eff"] != 'N/A' else True)
]
wall_recomendations = WallRecommendations(
wall_recomender = WallRecommendations(
property_instance=p,
uvalue_estimates=walls_u_value_estimate,
total_floor_area_group_decile=total_floor_area_group_decile,
materials=materials_by_type["external_wall_insulation"] + materials_by_type["internal_wall_insulation"]
)
wall_recomendations.recommend()
wall_recomender.recommend()
property_recommendations.extend(wall_recomendations.recommendations)
property_recommendations.extend(wall_recomender.recommendations)
recommendations[p.id] = property_recommendations
@ -274,11 +274,11 @@ async def trigger_plan(body: PlanTriggerRequest):
recommendation_id = create_recommendation(
{
"type": rec["type"], # TODO: Add this to output
"description": rec["description"], # TODO: Add this to output
"type": rec["type"],
"description": rec["description"],
"estimated_cost": estimated_cost,
"default": True,
"starting_u_value": rec.get("starting_u_value"), # TODO: Add this to output
"starting_u_value": rec.get("starting_u_value"),
"new_u_value": rec.get("new_u_value"),
"sap_points": rec["sap_points"] # TODO: Add this to output
# Remaining outputs yet to be handled

View file

@ -272,6 +272,10 @@ class FloorRecommendations(BaseUtility):
# Given the U-value, we recommend solid floor insulation options which are usually solid foam
self.recommend_floor_insulation(u_value=u_value, parts=solid_floor_insulation_parts)
@staticmethod
def _make_floor_description(part, depth):
return f"Install {depth}{part['depth_unit']} {part['description']} insulation"
def recommend_floor_insulation(self, u_value, parts):
"""
This method is tasked with estimating the impact of performing suspended floor insulation
@ -298,6 +302,9 @@ class FloorRecommendations(BaseUtility):
"parts": [
get_recommended_part(part, depth),
],
"type": "floor_insulation",
"description": self._make_floor_description(part, depth),
"starting_u_value": u_value,
"new_u_value": new_u_value,
}
)

View file

@ -334,6 +334,9 @@ class WallRecommendations(BaseUtility):
recommendations.append(
{
"parts": [get_recommended_part(part, depth)],
"type": "wall_insulation",
"description": "Install " + self._make_description(part, depth),
"starting_u_value": u_value,
"new_u_value": new_u_value,
}
)
@ -390,12 +393,22 @@ class WallRecommendations(BaseUtility):
get_recommended_part(ewi_part, ewi_depth),
get_recommended_part(iwi_part, iwi_depth)
],
"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,
}
self.recommendations.append(recommendation)
self.prune_diminishing_recommendations()
@staticmethod
def _make_description(part, depth):
return f"{depth}{part['depth_unit']} {part['description']}"
def prune_diminishing_recommendations(self):
# For any recommendations, if we have at least 1 reommendation that does not exhibit diminishing returns
# we trim all others that are beyond the diminishing returns threshold