finished optimisation and output

This commit is contained in:
Khalim Conn-Kowlessar 2024-06-04 18:11:36 +01:00
parent 1393a99b8b
commit 7ed4002d04
3 changed files with 19 additions and 7 deletions

View file

@ -999,6 +999,7 @@ async def build_mds(body: MdsRequest):
res = results[results["uprn"] == p.uprn]
wall = p.walls
heating = p.main_heating
heating_controls = p.main_heating_controls
wall_recommendation = [
x for x in res["measures"].values[0] if
x in ["internal_wall_insulation", "external_wall_insulation", "cavity_wall_insulation"]
@ -1044,6 +1045,7 @@ async def build_mds(body: MdsRequest):
"address": p.address,
"postcode": p.postcode,
"heating": heating["clean_description"],
"heating_controls": heating_controls["clean_description"],
"recommendation": hhr_recommendation,
"possible_measures": possible_measures,
"selected_measures": res["measures"].values[0],

View file

@ -62,6 +62,8 @@ class HeatingRecommender:
if self.is_high_heat_retention_valid():
# Recommend high heat retention storage heaters
# TODO: We need to allow for the possibility that the property aleady has storage heaters, but just
# needs the controls
self.recommend_hhr_storage_heaters(phase=phase, system_change=True, heating_controls_only=False)
# if the property has mains heating with boiler and radiators, we recommend optimal heating controls
@ -341,17 +343,19 @@ class HeatingRecommender:
"""
already_has_hhr = "Electric storage heaters" in self.property.main_heating["clean_description"]
# Some electric storage heaters will show that the controls are "Manual charge controls" which are indicative
# of the old model of electric storage heaters, originating from 1961.
# Newer HHR storage heaters will charge up over night but will retain the heat durin the day for when warmth
# is actually needed, unlike traditional storage heaters that charge up at night and release heat during the day
# which isn't always ideal for the occupants.
already_has_hhr_contols = (
self.property.main_heating_controls[
"clean_description"
].lower() == self.high_heat_retention_contols_desc.lower()
)
# Conditions for not needing this recommendation
# Modern hhr storage heaters will have the specific controls so we can check for this
already_installed_hh_retention = already_has_hhr and already_has_hhr_contols
return already_installed_hh_retention
return already_has_hhr and already_has_hhr_contols
def recommend_hhr_storage_heaters(self, phase, system_change, heating_controls_only, _return=False):
"""
@ -374,8 +378,9 @@ class HeatingRecommender:
if self.property.main_heating_controls["clean_description"] != self.high_heat_retention_contols_desc:
controls_recommender.recommend(heating_description="Electric storage heaters, radiators")
has_hhr = self.is_hhr_already_installed()
# Conditions for not recommending electric storage heaters
if self.is_hhr_already_installed():
if has_hhr:
# No recommendation needed
return

View file

@ -173,9 +173,14 @@ class Mds:
continue
if measure == "high_heat_retention_storage_heaters":
# For the moment, we recommend storage heaters if the property doesn't already
# and don't make it contngent on controls
already_has_hhr = self.heating_recommender.is_hhr_already_installed()
if (
self.heating_recommender.is_high_heat_retention_valid() and
not self.heating_recommender.is_hhr_already_installed()
not already_has_hhr
):
pruned_measures.append(measure)
continue