another unit test covered

This commit is contained in:
Khalim Conn-Kowlessar 2024-09-16 19:48:25 +01:00
parent 942f1958db
commit 76154c5172
2 changed files with 56 additions and 5 deletions

View file

@ -19,6 +19,7 @@ class HeatingRecommender:
self.heating_control_recommendations = []
self.has_electric_heating_description = self.property.main_heating["has_electric"]
self.has_ashp = self.property.main_heating["has_air_source_heat_pump"]
def is_high_heat_retention_valid(self, ashp_only_heating_recommendation, measures):
"""
@ -31,8 +32,10 @@ class HeatingRecommender:
hhr_suitable = no_mains or self.has_electric_heating_description
# If there's already an ASHP in place, we don't recommend HHR
return (
hhr_suitable and (not ashp_only_heating_recommendation) and
hhr_suitable and (not ashp_only_heating_recommendation) and not self.has_ashp and
("high_heat_retention_storage_heater" in measures)
)
@ -86,7 +89,8 @@ class HeatingRecommender:
non_gas_boiler
) and
(not ashp_only_heating_recommendation) and
("boiler_upgrade" in measures)
("boiler_upgrade" in measures) and
(not self.has_ashp)
)
return is_valid, has_gas_boiler
@ -155,7 +159,11 @@ class HeatingRecommender:
# In the future, we'll allow overrides, so that non-intrusive surveys can contradict these conditions
# and either allow or prevent the recommendation of an air source heat pump
if self.property.is_ashp_valid(measures=measures) and non_invasive_ashp_recommendation["suitable"]:
if (
self.property.is_ashp_valid(measures=measures) and
non_invasive_ashp_recommendation["suitable"] and
not self.has_ashp
):
self.recommend_air_source_heat_pump(
phase=phase,
has_cavity_or_loft_recommendations=has_cavity_or_loft_recommendations,

View file

@ -1024,6 +1024,48 @@ testing_examples = [
],
"heating_controls_recommendation_descriptions": [],
"notes": "This is an end-terrace house, without mains gas connection, so all we recommend is HHR"
},
{
"epc": {
'lmk-key': '1281510829102015021321472533359578', 'address1': '6, Nags Head Lane', 'address2': 'Hargrave',
'address3': None, 'postcode': 'NN9 6BJ', 'building-reference-number': 134423378,
'current-energy-rating': 'F', 'potential-energy-rating': 'B', 'current-energy-efficiency': 38,
'potential-energy-efficiency': 84, 'property-type': 'House', 'built-form': 'End-Terrace',
'inspection-date': '2015-02-13', 'local-authority': 'E07000152', 'constituency': 'E14000648',
'county': 'Northamptonshire', 'lodgement-date': '2015-02-13',
'transaction-type': 'assessment for green deal', 'environment-impact-current': 45,
'environment-impact-potential': 85, 'energy-consumption-current': 400, 'energy-consumption-potential': 96,
'co2-emissions-current': 5.0, 'co2-emiss-curr-per-floor-area': 68, 'co2-emissions-potential': 1.2,
'lighting-cost-current': 87, 'lighting-cost-potential': 48, 'heating-cost-current': 1094,
'heating-cost-potential': 423, 'hot-water-cost-current': 240, 'hot-water-cost-potential': 144,
'total-floor-area': 74.0, 'energy-tariff': 'Single', 'mains-gas-flag': 'N', 'floor-level': 'NODATA!',
'flat-top-storey': None, 'flat-storey-count': None, 'main-heating-controls': 2204.0,
'multi-glaze-proportion': 100.0, 'glazed-type': 'double glazing installed before 2002',
'glazed-area': 'Normal', 'extension-count': 0, 'number-habitable-rooms': 5, 'number-heated-rooms': 5,
'low-energy-lighting': 18, 'number-open-fireplaces': 0, 'hotwater-description': 'From main system',
'hot-water-energy-eff': 'Poor', 'hot-water-env-eff': 'Good',
'floor-description': 'Solid, no insulation (assumed)', 'floor-energy-eff': 'NO DATA!',
'windows-description': 'Fully double glazed', 'windows-energy-eff': 'Average', 'windows-env-eff': 'Average',
'walls-description': 'Solid brick, as built, no insulation (assumed)', 'walls-energy-eff': 'Poor',
'walls-env-eff': 'Poor', 'secondheat-description': 'Room heaters, electric',
'roof-description': 'Pitched, 300 mm loft insulation', 'roof-energy-eff': 'Very Good',
'roof-env-eff': 'Very Good', 'mainheat-description': 'Air source heat pump, radiators, electric',
'mainheat-energy-eff': 'Poor', 'mainheat-env-eff': 'Good',
'mainheatcont-description': 'Programmer and room thermostat', 'mainheatc-energy-eff': 'Average',
'mainheatc-env-eff': 'Average', 'lighting-description': 'Low energy lighting in 18% of fixed outlets',
'lighting-energy-eff': 'Poor', 'lighting-env-eff': 'Poor', 'main-fuel': 'electricity (not community)',
'wind-turbine-count': 0, 'heat-loss-corridor': 'NO DATA!', 'unheated-corridor-length': None,
'floor-height': None, 'photo-supply': None, 'solar-water-heating-flag': 'N',
'mechanical-ventilation': 'natural', 'address': '6, Nags Head Lane, Hargrave',
'local-authority-label': 'East Northamptonshire', 'constituency-label': 'Corby',
'posttown': 'WELLINGBOROUGH', 'construction-age-band': 'England and Wales: 1930-1949',
'lodgement-datetime': '2015-02-13 21:47:25', 'tenure': 'rental (social)',
'fixed-lighting-outlets-count': None, 'low-energy-fixed-light-count': None, 'uprn': 100031045596,
'uprn-source': 'Address Matched', 'sheating-energy-eff': None, 'sheating-env-eff': None
},
"heating_recommendation_descriptions": [],
"heating_controls_recommendation_descriptions": [],
"notes": "This property already has an ashp. We don't recommend any heating upgrades"
}
]
@ -1081,7 +1123,8 @@ completed_descriptions = [
"Boiler and radiators, dual fuel (mineral and wood)",
"Boiler and radiators, coal",
"Boiler and radiators, smokeless fuel",
"Boiler and radiators, wood pellets"
"Boiler and radiators, wood pellets",
"Room heaters, dual fuel (mineral and wood)",
]
portfolio = pd.read_excel(
@ -1096,7 +1139,7 @@ portfolio["lodgement-datetime"] = portfolio["lodgement-datetime"].astype(str)
print(portfolio["mainheat-description"].value_counts())
eg = portfolio[
(portfolio["mainheat-description"] == "Room heaters, dual fuel (mineral and wood)")
(portfolio["mainheat-description"] == "Air source heat pump, radiators, electric")
].sample(1)
eg = eg.squeeze().to_dict()
print(eg)