mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
debugging structure of heating recommendations
This commit is contained in:
parent
391cb356ee
commit
8bd899bcba
3 changed files with 12 additions and 6 deletions
|
|
@ -380,6 +380,7 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
|
|
||||||
logger.info("Preparing data for scoring in sap change api")
|
logger.info("Preparing data for scoring in sap change api")
|
||||||
recommendations_scoring_data = pd.DataFrame(recommendations_scoring_data)
|
recommendations_scoring_data = pd.DataFrame(recommendations_scoring_data)
|
||||||
|
|
||||||
recommendations_scoring_data = recommendations_scoring_data.drop(
|
recommendations_scoring_data = recommendations_scoring_data.drop(
|
||||||
columns=["rdsap_change", "heat_demand_change", "carbon_change", "sap_ending", "heat_demand_ending",
|
columns=["rdsap_change", "heat_demand_change", "carbon_change", "sap_ending", "heat_demand_ending",
|
||||||
"carbon_ending"]
|
"carbon_ending"]
|
||||||
|
|
|
||||||
|
|
@ -399,7 +399,7 @@ class HeatingRecommender:
|
||||||
|
|
||||||
if not system_change and len(boiler_recommendation):
|
if not system_change and len(boiler_recommendation):
|
||||||
# If there is not a system change, we add the boiler recommendation at point.
|
# If there is not a system change, we add the boiler recommendation at point.
|
||||||
self.recommendations.append(boiler_recommendation)
|
self.recommendations.append([boiler_recommendation])
|
||||||
|
|
||||||
if system_change:
|
if system_change:
|
||||||
# We combine the heating and controls recommendations, in the case of a system change
|
# We combine the heating and controls recommendations, in the case of a system change
|
||||||
|
|
@ -417,12 +417,12 @@ class HeatingRecommender:
|
||||||
combined_recommendations.extend(combined_recommendation)
|
combined_recommendations.extend(combined_recommendation)
|
||||||
|
|
||||||
# Overwrite the existing boiler recommendation
|
# Overwrite the existing boiler recommendation
|
||||||
self.recommendations.extend(combined_recommendations)
|
self.recommendations.append(combined_recommendations)
|
||||||
else:
|
else:
|
||||||
# We increment the recommendation phase, since the heating controls are separate from the boiler upgrade
|
# We increment the recommendation phase, since the heating controls are separate from the boiler upgrade
|
||||||
# but we'll only upgrade if we have a heating recommendation
|
# but we'll only upgrade if we have a heating recommendation
|
||||||
has_heating_recommendation = any(
|
has_heating_recommendation = any(
|
||||||
recommendation["type"] == "heating" for recommendation in self.recommendations
|
rec["type"] == "heating" for recommendation in self.recommendations for rec in recommendation
|
||||||
)
|
)
|
||||||
if has_heating_recommendation:
|
if has_heating_recommendation:
|
||||||
recommendation_phase += 1
|
recommendation_phase += 1
|
||||||
|
|
@ -431,6 +431,6 @@ class HeatingRecommender:
|
||||||
for recommendation in controls_recommender.recommendation:
|
for recommendation in controls_recommender.recommendation:
|
||||||
recommendation["phase"] = recommendation_phase
|
recommendation["phase"] = recommendation_phase
|
||||||
|
|
||||||
self.recommendations.extend(controls_recommender.recommendation)
|
self.recommendations.append(controls_recommender.recommendation)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -111,11 +111,16 @@ class Recommendations:
|
||||||
if "heating" not in self.exclusions:
|
if "heating" not in self.exclusions:
|
||||||
self.heating_recommender.recommend(phase=phase)
|
self.heating_recommender.recommend(phase=phase)
|
||||||
if self.heating_recommender.recommendations:
|
if self.heating_recommender.recommendations:
|
||||||
property_recommendations.append(self.heating_recommender.recommendations)
|
if len(self.heating_recommender.recommendations) == 1:
|
||||||
|
property_recommendations.append(self.heating_recommender.recommendations)
|
||||||
|
else:
|
||||||
|
property_recommendations.extend(self.heating_recommender.recommendations)
|
||||||
# We check if we have distinct heating and heating controls recommendations
|
# We check if we have distinct heating and heating controls recommendations
|
||||||
# If so, we increment by 2 (one of the heating system, one for the heating controls)
|
# If so, we increment by 2 (one of the heating system, one for the heating controls)
|
||||||
# otherwise we incremenet by 1
|
# otherwise we incremenet by 1
|
||||||
max_used_phase = max([rec["phase"] for rec in self.heating_recommender.recommendations])
|
max_used_phase = max(
|
||||||
|
[rec["phase"] for recs in self.heating_recommender.recommendations for rec in recs]
|
||||||
|
)
|
||||||
amount_to_increment = max_used_phase - phase + 1
|
amount_to_increment = max_used_phase - phase + 1
|
||||||
phase += amount_to_increment
|
phase += amount_to_increment
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue