mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Merge pull request #640 from Hestia-Homes/eco-eligiblity-bug
added enforce fabric first option
This commit is contained in:
commit
0dd179bbb1
3 changed files with 8 additions and 3 deletions
|
|
@ -133,6 +133,9 @@ class PlanTriggerRequest(BaseModel):
|
|||
task_id: Optional[str] = None
|
||||
subtask_id: Optional[str] = None
|
||||
|
||||
# Optional flag to trigger a fabric first task
|
||||
enforce_fabric_first: Optional[bool] = False
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_indexes(self):
|
||||
if (self.index_start is None) != (self.index_end is None):
|
||||
|
|
|
|||
|
|
@ -1066,7 +1066,7 @@ async def model_engine(body: PlanTriggerRequest):
|
|||
budget=body.budget,
|
||||
target_gain=gain,
|
||||
enforce_heat_pump_insulation=True,
|
||||
enforce_fabric_first=False
|
||||
enforce_fabric_first=body.enforce_fabric_first
|
||||
)
|
||||
|
||||
# if handle the empty case
|
||||
|
|
@ -1119,7 +1119,7 @@ async def model_engine(body: PlanTriggerRequest):
|
|||
|
||||
# Add best practice measures (ventilation/trickle vents)
|
||||
selected = optimiser_functions.add_best_practice_measures(p.id, solution, recommendations, selected)
|
||||
# Final flattening
|
||||
# Final flattening - we pass what the battery SAP score would be, regardless if the battery was selected
|
||||
recommendations[p.id] = optimiser_functions.flatten_recommendations_with_defaults(
|
||||
p.id, recommendations, selected, battery_sap_score
|
||||
)
|
||||
|
|
|
|||
|
|
@ -681,7 +681,9 @@ def optimise_with_scenarios(
|
|||
# - Only once the fabric has been upgraded, do we consider heating upgrades
|
||||
|
||||
# This should be wall insulation, roof insulation, floor insulation and windows
|
||||
fabric_measures = WALL_INSULATION_MEASURES + ROOF_INSULATION_MEASURES + ECO4_ELIGIBILE_FABRIC_MEASURES
|
||||
fabric_measures = WALL_INSULATION_MEASURES + ROOF_INSULATION_MEASURES + ECO4_ELIGIBILE_FABRIC_MEASURES + [
|
||||
"internal_wall_insulation+mechanical_ventilation", "external_wall_insulation+mechanical_ventilation"
|
||||
]
|
||||
|
||||
fabric_only_measures = [
|
||||
[opt for opt in group if opt["type"] in fabric_measures] for group in optimisation_measures
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue