From 09e5b01c7eae7ff7e4dd535dc110e90cd7106156 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 10 Jul 2024 17:56:40 +0100 Subject: [PATCH] added the lifetime kwh figures --- backend/apis/GoogleSolarApi.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/apis/GoogleSolarApi.py b/backend/apis/GoogleSolarApi.py index d6bc58df..74de9c20 100644 --- a/backend/apis/GoogleSolarApi.py +++ b/backend/apis/GoogleSolarApi.py @@ -198,10 +198,11 @@ class GoogleSolarApi: ) @staticmethod - def lifetime_production_ac_kwh( + def lifetime_production_kwh( row, efficiency_depreciation_factor, - installation_life_span + installation_life_span, + column_name="initial_ac_kwh_per_year" ): """ Mimics the function described in the Google Solar API documentation, presenting the lifetime production @@ -209,7 +210,7 @@ class GoogleSolarApi: """ return ( - row["initial_ac_kwh_per_year"] * + row[column_name] * (1 - pow( efficiency_depreciation_factor, installation_life_span)) / @@ -284,10 +285,19 @@ class GoogleSolarApi: # 2) Calculate the liftime solar energy production panel_performance['lifetime_ac_kwh'] = panel_performance.apply( - self.lifetime_production_ac_kwh, + self.lifetime_production_kwh, axis=1, efficiency_depreciation_factor=self.efficiency_depreciation_factor, - installation_life_span=self.installation_life_span + installation_life_span=self.installation_life_span, + column_name="initial_ac_kwh_per_year" + ) + + panel_performance['lifetime_dc_kwh'] = panel_performance.apply( + self.lifetime_production_kwh, + axis=1, + efficiency_depreciation_factor=self.efficiency_depreciation_factor, + installation_life_span=self.installation_life_span, + column_name="yearly_dc_energy", ) # Now that we know the lifetime cnsumption of ac kwh, we can estimate the roi