From aa97c777475cd036ee60004617cbb891f454f254 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 7 Oct 2024 10:38:38 +0100 Subject: [PATCH] using elmhurst roof area methodology --- backend/Property.py | 17 ++------------ backend/apis/GoogleSolarApi.py | 1 - recommendations/recommendation_utils.py | 31 ++++++------------------- 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 491a886f..9108d40c 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -623,9 +623,7 @@ class Property: self.find_energy_sources() self.set_current_energy(kwh_client, kwh_predictions) - def set_solar_panel_configuration( - self, solar_panel_configuration, roof_area - ): + def set_solar_panel_configuration(self, solar_panel_configuration): """ This funtion inserts the solar panel configuration into the property object """ @@ -634,22 +632,11 @@ class Property: if not self.roof["is_flat"]: default_roof_area = estimate_pitched_roof_area( floor_area=self.insulation_floor_area, - floor_height=self.floor_height ) else: default_roof_area = self.insulation_floor_area - # Keep a record - self.roof_area_comparison = { - "api": roof_area, - "estimated": default_roof_area - } - - # We also set the roof area - if roof_area is None: - self.roof_area = default_roof_area - else: - self.roof_area = roof_area + self.roof_area = default_roof_area def set_current_energy(self, kwh_client, kwh_predictions): """ diff --git a/backend/apis/GoogleSolarApi.py b/backend/apis/GoogleSolarApi.py index bf67a786..606b6970 100644 --- a/backend/apis/GoogleSolarApi.py +++ b/backend/apis/GoogleSolarApi.py @@ -766,7 +766,6 @@ class GoogleSolarApi: "panel_performance": cls.default_panel_performance(property_instance=property_instance), "unit_share_of_energy": 1 }, - roof_area=None ) continue diff --git a/recommendations/recommendation_utils.py b/recommendations/recommendation_utils.py index 3a0412b2..dcdd9c06 100644 --- a/recommendations/recommendation_utils.py +++ b/recommendations/recommendation_utils.py @@ -205,7 +205,7 @@ def get_wall_u_value( mapped_value = wall_uvalues_df[ wall_uvalues_df["Wall_type"] == mapped_description - ][age_band].values[0] + ][age_band].values[0] if pd.isnull(mapped_value) and "Park home" in mapped_description: # We don't know enough in this case so we default to 0 @@ -505,7 +505,7 @@ def get_floor_u_value( insulation_lookup = s11[ s11["Age_band"].str.contains(age_band) & s11["Floor_construction"] == floor_type - ] + ] if insulation_lookup.empty: insulation_thickness = 0 else: @@ -700,34 +700,17 @@ def convert_thickness_to_numeric(string_thickness, is_pitched, is_flat): return int(string_thickness) -def estimate_pitched_roof_area(floor_area: float, floor_height: float) -> float: +def estimate_pitched_roof_area(floor_area: float) -> float: """ - This function will estimate the area of a pitched roof, given the floor area below the roof and the floor - height of the property. - - Given limited information about the home, this is a very rough method to estimate the roof area and we - assume the the room is a gable roof. - - We assume a roughly average pitch of 45 degrees - - Note that both floor area and height should be in the same units. E.g. if floor area is meters squared, - floor height should be in meters + This function mimics the methodology for calculating floor area in Elmhurst, so that we can simulate the outcomes + in a way that is consistent with the Elmhurst methodology. :param floor_area: area of the home's floor - :param floor_height: height of the home's floors :return: Numerical estimate of the surface area of the top of the pitched roof """ - # We estimate the length of the wall by just modelling the house as a square - wall_width = np.sqrt(floor_area) - - # We're modelling the roof as two triangles where we know two of the three sides. - # The floor height makes up one side and half of the wall width makes up the other side - slope = np.sqrt(np.square(wall_width / 2) + np.square(floor_height)) - - area = 2 * (slope * wall_width) - - return area + scalar = 1.0571283428862048 + return scalar * (floor_area / np.cos(np.radians(30))) def estimate_windows(