From 59271a5009e081429b7fcd33b8df40848d62f67c Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 9 Feb 2024 20:07:37 +0000 Subject: [PATCH] Tweaking simulations in recommendation engine --- backend/app/plan/router.py | 3 ++- backend/ml_models/AnnualBillSavings.py | 4 ++-- recommendations/SolarPvRecommendations.py | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 89c5187b..5e1b5a53 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -165,6 +165,7 @@ async def trigger_plan(body: PlanTriggerRequest): model_api = ModelApi(portfolio_id=body.portfolio_id, timestamp=created_at) # recommendations_scoring_data.loc[17, 'photo_supply_ending'] = 50 + recommendations_scoring_data.loc[5, 'walls_thermal_transmittance_ending'] = 0.25 all_predictions = model_api.predict_all( df=recommendations_scoring_data, @@ -239,7 +240,7 @@ async def trigger_plan(body: PlanTriggerRequest): ] recommendations[property_id] = final_recommendations - # impact_df = pd.DataFrame(recommendations[input_properties[0].id]) + impact_df = pd.DataFrame(recommendations[input_properties[0].id]) # This is a temporary step, to estimate the impact of the measured on heat demand and carbon # TODO: This needs to be cleaned up, if it happens to be kept diff --git a/backend/ml_models/AnnualBillSavings.py b/backend/ml_models/AnnualBillSavings.py index 5e65cc5c..99fae4db 100644 --- a/backend/ml_models/AnnualBillSavings.py +++ b/backend/ml_models/AnnualBillSavings.py @@ -75,10 +75,10 @@ class AnnualBillSavings: # This should be negative consumption_difference = gradient * epc_energy_consumption + intercept - if consumption_difference > 0: - raise ValueError("consumption_difference should be negative") adjusted_consumption = (epc_energy_consumption + consumption_difference) + if adjusted_consumption < 0: + raise ValueError("consumption_difference should be negative") return adjusted_consumption diff --git a/recommendations/SolarPvRecommendations.py b/recommendations/SolarPvRecommendations.py index 230671f1..8a773570 100644 --- a/recommendations/SolarPvRecommendations.py +++ b/recommendations/SolarPvRecommendations.py @@ -43,6 +43,8 @@ class SolarPvRecommendations: number_solar_panels = np.floor(self.property.solar_pv_roof_area / self.SOLAR_PANEL_AREA) solar_panel_wattage = number_solar_panels * self.SOLAR_PANEL_WATTAGE + roof_coverage_percent = round(self.property.solar_pv_percentage * 100) + # Given the wattage, we estimate the cost of the solar PV system. This is based on the MCS database # of solar PV installations cost_result = self.costs.solar_pv(wattage=solar_panel_wattage) @@ -53,7 +55,8 @@ class SolarPvRecommendations: { "parts": [], "type": "solar_pv", - "description": f"Install a {kw} kilowatt-peak (kWp) solar photovoltaic (PV) panel system on the roof", + "description": f"Install a {kw} kilowatt-peak (kWp) solar photovoltaic (PV) panel system on " + f"{roof_coverage_percent}% the roof", "starting_u_value": None, "new_u_value": None, "sap_points": None,