mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
103 lines
3.7 KiB
Python
103 lines
3.7 KiB
Python
from typing import Dict, Union
|
|
from epc_data.attributes.attribute_utils import clean_description, remove_punctuation, find_keyword
|
|
|
|
|
|
class MainheatControlAttributes:
|
|
# These systems allow for the automatic regulation of temperature
|
|
THERMOSTATIC_CONTROL_KEYWORDS = [
|
|
'room thermostats',
|
|
'appliance thermostats',
|
|
'room thermostat',
|
|
'temperature zone control',
|
|
'time and temperature zone control',
|
|
# 'no thermostatic control',
|
|
# 'no room thermostat'
|
|
]
|
|
|
|
# TRVs stands for Thermostatic Radiator Valves which control the heating temperature of individual radiators
|
|
# This is split out distinctly
|
|
TRVS_KEYWORDS = [
|
|
'trvs',
|
|
]
|
|
|
|
# These systems provide a way to store and manage energy usage
|
|
CHARGING_SYSTEM_KEYWORDS = [
|
|
'charging system',
|
|
'automatic charge control',
|
|
'manual charge control',
|
|
'flat rate charging',
|
|
'high heat retention storage heaters'
|
|
]
|
|
|
|
# These systems are mainly focused on on/off operations
|
|
SWITCH_SYSTEM_KEYWORDS = [
|
|
'programmer',
|
|
]
|
|
|
|
# These systems enhance operation, efficiency, or safety. e.g. a boiler energy manager
|
|
# manages the efficiency of boiler operation. There is an argument to separate 'boiler energy manager' and 'bypass'
|
|
AUXILIARY_SYSTEM_KEYWORDS = [
|
|
'boiler energy manager',
|
|
'bypass',
|
|
'flow switch',
|
|
]
|
|
|
|
# These keywords indicate a lack of control system
|
|
NO_CONTROL_SYSTEM_KEYWORDS = [
|
|
'no time or thermostatic control',
|
|
'no thermostatic control',
|
|
'none',
|
|
'no room thermostat'
|
|
]
|
|
|
|
# These systems provide control specifically for Domestic Hot Water
|
|
DHW_CONTROL_KEYWORDS = [
|
|
'dhw only'
|
|
]
|
|
|
|
# This system indicates the use of community heating
|
|
COMMUNITY_HEATING_KEYWORDS = [
|
|
'use of community heating'
|
|
]
|
|
|
|
MULTIPLE_ROOM_THERMOSTATS_PHRASES = [
|
|
'at least two room stats',
|
|
'at least two room thermostats'
|
|
]
|
|
|
|
def __init__(self, description: str):
|
|
self.description: str = clean_description(description.lower())
|
|
|
|
if not any(
|
|
self._keyword_in_description(keywords)
|
|
for keywords in [
|
|
self.THERMOSTATIC_CONTROL_KEYWORDS,
|
|
self.CHARGING_SYSTEM_KEYWORDS,
|
|
self.SWITCH_SYSTEM_KEYWORDS,
|
|
self.DHW_CONTROL_KEYWORDS,
|
|
self.COMMUNITY_HEATING_KEYWORDS,
|
|
self.TRVS_KEYWORDS,
|
|
self.NO_CONTROL_SYSTEM_KEYWORDS
|
|
]
|
|
):
|
|
raise ValueError('Invalid description')
|
|
|
|
def _keyword_in_description(self, keywords):
|
|
return any(keyword in self.description for keyword in keywords)
|
|
|
|
def process(self) -> Dict[str, Union[str, bool]]:
|
|
result: Dict[str, Union[str, bool]] = {
|
|
"thermostatic_control": find_keyword(self.description, self.THERMOSTATIC_CONTROL_KEYWORDS),
|
|
"charging_system": find_keyword(self.description, self.CHARGING_SYSTEM_KEYWORDS),
|
|
"switch_system": find_keyword(self.description, self.SWITCH_SYSTEM_KEYWORDS),
|
|
"no_control": find_keyword(self.description, self.NO_CONTROL_SYSTEM_KEYWORDS),
|
|
"dhw_control": find_keyword(self.description, self.DHW_CONTROL_KEYWORDS),
|
|
"community_heating": find_keyword(self.description, self.COMMUNITY_HEATING_KEYWORDS),
|
|
"multiple_room_thermostats": any(
|
|
phrase in self.description for phrase in self.MULTIPLE_ROOM_THERMOSTATS_PHRASES
|
|
),
|
|
"auxiliary_systems": find_keyword(self.description, self.AUXILIARY_SYSTEM_KEYWORDS),
|
|
"trvs": find_keyword(self.description, self.TRVS_KEYWORDS)
|
|
}
|
|
|
|
return result
|