handling edge case of community hot water, non-community heating

This commit is contained in:
Khalim Conn-Kowlessar 2025-11-14 22:44:14 +00:00
parent 005c6b844a
commit 9f457d24d2
4 changed files with 16 additions and 4 deletions

View file

@ -80,6 +80,7 @@ DESCRIPTIONS_TO_FUEL_TYPES = {
},
"Electric heat pump for water heating only": {"fuel": "Electricity", "cop": 1},
"Ground source heat pump, warm air, electric": {"fuel": "Electricity", "cop": AVERAGE_ASHP_EFFICIENCY / 100},
"Room heaters, mains gas, Electric storage heaters": {"fuel": "Natural Gas", "cop": 0.85}
}
# These are the measure types where if there is a ventilation recommendation, we force the inclusion of it

View file

@ -263,7 +263,8 @@ class AnnualBillSavings:
if fuel == "Electricity":
return (kwh / cop) * cls.ELECTRICITY_PRICE_CAP
if fuel in ["Natural Gas", "Natural Gas (Community Scheme)"]:
# We handle "Unmapped" in a similar fashion to gas
if fuel in ["Natural Gas", "Natural Gas (Community Scheme)", "Unmapped"]:
return (kwh / cop) * cls.GAS_PRICE_CAP
if fuel == "LPG":

View file

@ -1161,6 +1161,7 @@ class HeatingRecommender:
if recommendation_type not in [
"boiler",
"hhr",
]:
raise ValueError(f"Given invalid recommendation type {recommendation_type}")

View file

@ -681,7 +681,9 @@ class Recommendations:
):
# Handle the case of community schemes
if (heating_description == "Community scheme") or (hotwater_description == "Community scheme"):
if (heating_description == "Community scheme") or (hotwater_description == "Community scheme") and (
"not community" not in main_fuel_description
):
if main_fuel_description in ["mains gas (community)", "UNKNOWN"]:
return {
"heating_fuel_type": "Natural Gas (Community Scheme)",
@ -702,7 +704,7 @@ class Recommendations:
if hotwater_description in [
"From main system", "From main system, no cylinder thermostat",
'From main system, waste water heat recovery'
'From main system, waste water heat recovery',
]:
return {
"heating_fuel_type": heating_fuel, "hotwater_fuel_type": heating_fuel,
@ -718,7 +720,14 @@ class Recommendations:
"heating_cop": mapped["cop"], "hotwater_cop": 1
}
mapped_hotwater = descriptions_to_fuel_types[hotwater_description]
mapped_hotwater = descriptions_to_fuel_types.get(hotwater_description)
if mapped_hotwater is None:
# TODO: This is a non-ideal placeholder but we put something in place for a process that falls over
# fairly regularly. A task has been added to planner to refactor this
# We have observed an edge case where the fuel is described as not being community
# but the hot water is. We handle as such
logger.warning("Hot water description not mapped: %s", heating_description)
mapped_hotwater = {"fuel": 'Unmapped', "cop": 0.9}
return {
"heating_fuel_type": heating_fuel, "hotwater_fuel_type": mapped_hotwater["fuel"],