""" UsageZone module SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Contributors Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ import uuid from typing import List, TypeVar, Union import ast InternalGains = TypeVar('InternalGains') Occupants = TypeVar('Occupants') Polyhedron = TypeVar('Polyhedron') Schedule = TypeVar('Schedule') class UsageZone: """ UsageZone class """ def __init__(self): self._id = None self._usage = None self._internal_gains = None self._heating_setpoint = None self._heating_setback = None self._cooling_setpoint = None self._occupancy_density = None self._hours_day = None self._days_year = None self._dhw_average_volume_pers_day = None self._dhw_preparation_temperature = None self._electrical_app_average_consumption_sqm_year = None self._mechanical_air_change = None self._occupants = None self._schedules = None self._volume = None self._volume_geometry = None self._is_heated = False self._is_cooled = False @property def id(self): """ Get usage zone id, an universally unique identifier randomly generated :return: str """ if self._id is None: self._id = uuid.uuid4() return self._id @property def internal_gains(self) -> List[InternalGains]: """ Get usage zone internal gains :return: [InternalGains] """ return self._internal_gains @internal_gains.setter def internal_gains(self, value): """ Set usage zone internal gains :param value: [InternalGains] """ self._internal_gains = value @property def heating_setpoint(self) -> Union[None, float]: """ Get usage zone heating set point in Celsius :return: None or float """ return self._heating_setpoint @heating_setpoint.setter def heating_setpoint(self, value): """ Set usage zone heating set point in Celsius :param value: float """ if value is not None: self._heating_setpoint = float(value) @property def heating_setback(self) -> Union[None, float]: """ Get usage zone heating setback in Celsius :return: None or float """ return self._heating_setback @heating_setback.setter def heating_setback(self, value): """ Set usage zone heating setback in Celsius :param value: float """ if value is not None: self._heating_setback = float(value) @property def cooling_setpoint(self) -> Union[None, float]: """ Get usage zone cooling setpoint in Celsius :return: None or float """ return self._cooling_setpoint @cooling_setpoint.setter def cooling_setpoint(self, value): """ Set usage zone cooling setpoint in Celsius :param value: float """ if value is not None: self._cooling_setpoint = float(value) @property def hours_day(self) -> Union[None, float]: """ Get usage zone usage hours per day :return: None or float """ return self._hours_day @hours_day.setter def hours_day(self, value): """ Set usage zone usage hours per day :param value: float """ if value is not None: self._hours_day = float(value) @property def days_year(self) -> Union[None, float]: """ Get usage zone usage days per year :return: None or float """ return self._days_year @days_year.setter def days_year(self, value): """ Set usage zone usage days per year :param value: float """ if value is not None: self._days_year = float(value) @property def mechanical_air_change(self) -> Union[None, float]: """ Get usage zone mechanical air change in air change per hour (ACH) :return: None or float """ return self._mechanical_air_change @mechanical_air_change.setter def mechanical_air_change(self, value): """ Set usage zone mechanical air change in air change per hour (ACH) :param value: float """ if value is not None: self._mechanical_air_change = float(value) @property def usage(self) -> Union[None, str]: """ Get usage zone usage :return: None or str """ return self._usage @usage.setter def usage(self, value): """ Set usage zone usage :param value: str """ if value is not None: self._usage = str(value) @property def occupants(self) -> List[Occupants]: """ Get occupants data :return: [Occupants] """ return self._occupants @occupants.setter def occupants(self, values): """ Set occupants data :param values: [Occupants] """ self._occupants = values @property def schedules(self) -> List[Schedule]: """ Get usage zone schedules :return: List[Schedule] """ return self._schedules @schedules.setter def schedules(self, values): """ Set usage zone schedules :param values: List[Schedule] """ self._schedules = values @property def occupancy_density(self) -> Union[None, float]: """ Get density in persons per m2 :return: None or float """ return self._occupancy_density @occupancy_density.setter def occupancy_density(self, value): """ Set density in persons per m2 :param value: float """ if value is not None: self._occupancy_density = float(value) @property def dhw_average_volume_pers_day(self) -> Union[None, float]: """ Get average DHW consumption in cubic meters per person per day :return: None or float """ return self._dhw_average_volume_pers_day @dhw_average_volume_pers_day.setter def dhw_average_volume_pers_day(self, value): """ Set average DHW consumption in cubic meters per person per day :param value: float """ if value is not None: self._dhw_average_volume_pers_day = float(value) @property def dhw_preparation_temperature(self) -> Union[None, float]: """ Get preparation temperature of the DHW in Celsius :return: None or float """ return self._dhw_preparation_temperature @dhw_preparation_temperature.setter def dhw_preparation_temperature(self, value): """ Set preparation temperature of the DHW in Celsius :param value: float """ if value is not None: self._dhw_preparation_temperature = float(value) @property def electrical_app_average_consumption_sqm_year(self) -> Union[None, float]: """ Get average consumption of electrical appliances in Joules hour per square meter and year (J/m2yr) :return: None or float """ return self._electrical_app_average_consumption_sqm_year @electrical_app_average_consumption_sqm_year.setter def electrical_app_average_consumption_sqm_year(self, value): """ Set average consumption of electrical appliances in Joules per square meter and year (J/m2yr) :param value: float """ if value is not None: self._electrical_app_average_consumption_sqm_year = float(value) @property def volume_geometry(self) -> Polyhedron: """ Get the polyhedron defined by the usage zone :return: Polyhedron """ return self._volume_geometry @property def volume(self) -> Union[None, float]: """ Get the volume in cubic meters :return: None or float """ return self._volume @volume.setter def volume(self, value): """ Set volume in cubic meters :param value: float """ if value is not None: self._volume = float(value) @property def is_heated(self) -> Union[None, bool]: """ Get thermal zone heated flag :return: None or Boolean """ return self._is_heated @is_heated.setter def is_heated(self, value): """ Set thermal zone heated flag :param value: Boolean """ if value is not None: self._is_heated = ast.literal_eval(value) @property def is_cooled(self) -> Union[None, bool]: """ Get thermal zone cooled flag :return: None or Boolean """ return self._is_cooled @is_cooled.setter def is_cooled(self, value): """ Set thermal zone cooled flag :param value: Boolean """ if value is not None: self._is_cooled = ast.literal_eval(value)