From 1e16babab3964c1b9f3b360be52af7b856c196e2 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 13 Aug 2024 18:28:38 +0100 Subject: [PATCH] added heating and hot water consumption per property to db --- backend/Property.py | 34 ++++++------------------------ backend/app/db/models/portfolio.py | 3 ++- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 966dd7cb..c4b1b969 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -174,7 +174,7 @@ class Property: self.solar_pv_percentage = None self.current_energy_consumption = None - self.expected_adjusted_energy = None + self.current_energy_consumption_heating_hotwater = None self.current_energy_bill = None self.expected_energy_bill = None @@ -724,13 +724,6 @@ class Property: "appliances": float(appliances_kwh) } - adjusted_kwh_estimates = { - k: AnnualBillSavings.adjust_energy_to_metered( - epc_energy=v, - current_epc_rating=self.data["current-energy-rating"], - ) for k, v in unadjusted_kwh_estimates.items() - } - unadjusted_heating_costs = { "heating": None, "hot_water": None, @@ -738,18 +731,13 @@ class Property: "appliances": float(appliances_kwh) * AnnualBillSavings.ELECTRICITY_PRICE_CAP } - adjusted_heating_costs = { - k: AnnualBillSavings.adjust_energy_to_metered( - epc_energy=v, - current_epc_rating=self.data["current-energy-rating"], - ) for k, v in unadjusted_heating_costs.items() if v is not None - } - # Sum up the adjusted kwh figures self.current_energy_consumption = sum(list(unadjusted_kwh_estimates.values())) + self.current_energy_consumption_heating_hotwater = ( + unadjusted_kwh_estimates["heating"] + unadjusted_kwh_estimates["hot_water"] + ) self.energy_cost_estimates = { - # "adjusted": adjusted_heating_costs, "unadjusted": unadjusted_heating_costs, "epc": { "heating": float(self.data["heating-cost-current"]), @@ -759,7 +747,6 @@ class Property: } self.energy_consumption_estimates = { - # "adjusted": adjusted_kwh_estimates, "unadjusted": unadjusted_kwh_estimates } @@ -899,7 +886,8 @@ class Property: "energy_tariff": self.data["energy-tariff"], "primary_energy_consumption": self.energy["primary_energy_consumption"], "co2_emissions": self.energy["co2_emissions"], - # "adjusted_energy_consumption": self.current_adjusted_energy, + "current_energy_demand": self.current_energy_consumption, + "current_energy_demand_heating_hotwater": self.current_energy_consumption_heating_hotwater, "estimated": self.data.get("estimated", False), } @@ -1097,16 +1085,6 @@ class Property: return component_data - def set_adjusted_energy( - self, expected_adjusted_energy, expected_energy_bill - ): - """ - Stores these values for usage later - """ - - self.expected_adjusted_energy = expected_adjusted_energy - self.expected_energy_bill = expected_energy_bill - def set_windows_count(self): """ Using the estimate_windows function, this method will set the number of windows in the property diff --git a/backend/app/db/models/portfolio.py b/backend/app/db/models/portfolio.py index aa0146c0..5ac092a7 100644 --- a/backend/app/db/models/portfolio.py +++ b/backend/app/db/models/portfolio.py @@ -168,7 +168,8 @@ class PropertyDetailsEpcModel(Base): energy_tariff = Column(Text) primary_energy_consumption = Column(Float) co2_emissions = Column(Float) - adjusted_energy_consumption = Column(Float) + current_energy_demand = Column(Float) + current_energy_demand_heating_hotwater = Column(Float) estimated = Column(Boolean, default=False)