changing the logic we use to recommend a combi boiler

This commit is contained in:
Khalim Conn-Kowlessar 2024-04-11 10:56:17 +01:00
parent 43af0de047
commit db6fd58af4
2 changed files with 36 additions and 13 deletions

View file

@ -55,7 +55,13 @@ class Property:
DATA_ANOMALY_MATCHES = DATA_ANOMALY_MATCHES
def __init__(self, id, postcode, address, epc_record):
# Surplus information, that can be provided as optional inputs, by a customer
n_bathrooms = None
n_bedrooms = None
def __init__(
self, id, postcode, address, epc_record, **kwargs
):
self.epc_record = epc_record
@ -133,6 +139,11 @@ class Property:
self.recommendations_scoring_data = []
def parse_kwargs(self, kwargs):
# We extract the elements from kwargs that we recognise. Anything additional is ignored
self.n_bathrooms = kwargs.get("n_bathrooms", None)
self.n_bedrooms = kwargs.get("n_bedrooms", None)
def create_base_difference_epc_record(self, cleaned_lookup: dict):
"""
Creates a EPCDifferenceRecord object, which is used to store the difference between the current and

View file

@ -34,7 +34,6 @@ class HeatingRecommender:
if has_electric_heating_description or no_heating_no_mains:
# Recommend high heat retention storage heaters
self.recommend_electric_storage_heaters(phase=phase, system_change=True, heating_controls_only=False)
return
# if the property has mains heating with boiler and radiators, we recommend optimal heating controls
has_boiler = self.property.main_heating["clean_description"] in ["Boiler and radiators, mains gas"]
@ -44,9 +43,16 @@ class HeatingRecommender:
'No system present, electric heaters assumed'
] and self.property.data["mains-gas-flag"]
if has_boiler or no_heating_has_mains:
self.recommend_boiler_upgrades(phase=phase, no_heating_has_mains=no_heating_has_mains)
return
# We also check if the property has electric heating, but it has access to the mains gas
electic_heating_has_mains = has_electric_heating_description and self.property.data["mains-gas-flag"]
if has_boiler or no_heating_has_mains or electic_heating_has_mains:
# This indicates that the home previously did not have a boiler in place and so would require
# an overhaul to the system
system_change = not has_boiler
self.recommend_boiler_upgrades(phase=phase, system_change=system_change)
return
@staticmethod
def check_simulation_difference(old_config, new_config):
@ -256,12 +262,14 @@ class HeatingRecommender:
return closest_size
def recommend_boiler_upgrades(self, phase, no_heating_has_mains):
def recommend_boiler_upgrades(self, phase, system_change):
"""
This boiler recommendation will only recommend a like-for-like upgrade, since changing the system
is generally more expensive
:param phase:
:param no_heating_has_mains: indicaes if the property has no heating system, but has access to the mains gas
:param system_change: Indicates if the property would be undergoing a heating system change. This could be true
if the home didn't have a heating system in place, or if the home had electric heating
previously
:return:
"""
@ -279,17 +287,21 @@ class HeatingRecommender:
num_heated_rooms=self.property.data["number-heated-rooms"],
)
# If heating and hot water come from the mains, we need a combi boiler, otherwise we need a regular boiler
hotwater_from_mains = self.property.hotwater["clean_description"] in ["From main system"]
is_combi = hotwater_from_mains or no_heating_has_mains
# We recommend a combi boiler under the following conditions
# 1) If there are 4 or fewer rooms (we don't use heqted rooms because none of the rooms could be
# heated if there is no existing heating system).
# 2) There is more than 1 bathroom
is_combi = (
(self.property.data["number-heated-rooms"] <= 4) or
(self.property.n_bathrooms not in [None, 0, 1])
)
if is_combi:
description = "Upgrade to a new combi boiler"
else:
description = "Upgrade to a new boiler"
description = "Upgrade to a new gas condensing boiler"
simulation_config = {"mainheat_energy_eff_ending": "Good"}
if no_heating_has_mains:
if system_change:
# Installation of a boiler improves the hot water system so we need to reflect this in
# the outcome of the recommendation
heating_ending_config = MainHeatAttributes("Boiler and radiators, mains gas").process()