modified energy estimate adjustment to use current epc rating rather than expected

This commit is contained in:
Khalim Conn-Kowlessar 2023-12-05 14:51:20 +00:00
parent db7eb69dd1
commit bf6020026a
2 changed files with 22 additions and 3 deletions

View file

@ -415,12 +415,10 @@ async def trigger_plan(body: PlanTriggerRequest):
# We sum up the SAP points of the default recommendations and calculate a new EPC category. This
# category is then used to produce adjusted energy figures
total_sap_points = sum([x["sap_points"] for x in representative_recs[property_id]])
expected_epc = sap_to_epc(float(property_instance.data["current-energy-efficiency"]) + total_sap_points)
expected_adjusted_energy = AnnualBillSavings.adjust_energy_to_metered(
epc_energy_consumption=expected_heat_demand,
current_epc_rating=expected_epc,
current_epc_rating=property_instance.data["current-energy-rating"],
)
heat_demand_change = (

View file

@ -18,6 +18,8 @@ class AnnualBillSavings:
# This is a weighted mean of the price caps, using the consumption figures above as weights
PRICE_FACTOR = 0.11183098591549295
EPC_BANDS = ["G", "F", "E", "D", "C", "B", "A"]
@classmethod
def estimate(cls, kwh: float):
"""
@ -70,3 +72,22 @@ class AnnualBillSavings:
adjusted_consumption = (epc_energy_consumption + consumption_difference)
return adjusted_consumption
@classmethod
def adjust_expected_band(cls, expected_epc_rating, current_epc_rating):
"""
Because of the differing intercepts and intercepts when adjusting, it's possible for
expected_adjusted_energy to be bigger than current_adjusted_energy. In this case, we'll
adjust, against at most 1 EPC band above the curent. This function performs the EPC adjustment
:param expected_epc_rating: The expected EPC rating
:param current_epc_rating: The current EPC rating
"""
# Find index of expected EPC rating
expected_index = cls.EPC_BANDS.index(expected_epc_rating)
current_index = cls.EPC_BANDS.index(current_epc_rating)
if expected_index - 1 < current_index:
return current_epc_rating
return cls.EPC_BANDS[expected_index - 1]