2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
ThermalControl module
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
from typing import Union, List
|
2022-03-08 19:19:52 -05:00
|
|
|
from city_model_structure.attributes.schedule import Schedule
|
|
|
|
|
|
|
|
|
|
|
|
class ThermalControl:
|
|
|
|
"""
|
|
|
|
ThermalControl class
|
|
|
|
"""
|
|
|
|
def __init__(self):
|
2022-03-17 18:49:44 -04:00
|
|
|
self._mean_heating_set_point = None
|
2022-03-08 19:19:52 -05:00
|
|
|
self._heating_set_back = None
|
2022-03-17 18:49:44 -04:00
|
|
|
self._mean_cooling_set_point = None
|
|
|
|
self._hvac_availability_schedules = None
|
|
|
|
self._heating_set_point_schedules = None
|
|
|
|
self._cooling_set_point_schedules = None
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def _maximum_value(schedules):
|
|
|
|
maximum = -1000
|
|
|
|
for schedule in schedules:
|
|
|
|
for value in schedule.values:
|
|
|
|
if value > maximum:
|
|
|
|
maximum = value
|
|
|
|
return maximum
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def _minimum_value(schedules):
|
|
|
|
minimum = 1000
|
|
|
|
for schedule in schedules:
|
|
|
|
for value in schedule.values:
|
|
|
|
if value < minimum:
|
|
|
|
minimum = value
|
|
|
|
return minimum
|
2022-03-08 19:19:52 -05:00
|
|
|
|
|
|
|
@property
|
2022-03-17 18:49:44 -04:00
|
|
|
def mean_heating_set_point(self) -> Union[None, float]:
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
Get heating set point defined for a thermal zone in Celsius
|
2022-03-17 18:49:44 -04:00
|
|
|
:return: None or float
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
if self._mean_heating_set_point is None:
|
|
|
|
if self.heating_set_point_schedules is not None:
|
|
|
|
self._mean_heating_set_point = self._maximum_value(self.heating_set_point_schedules)
|
|
|
|
return self._mean_heating_set_point
|
2022-03-08 19:19:52 -05:00
|
|
|
|
2022-03-17 18:49:44 -04:00
|
|
|
@mean_heating_set_point.setter
|
|
|
|
def mean_heating_set_point(self, value):
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
Set heating set point defined for a thermal zone in Celsius
|
2022-03-17 18:49:44 -04:00
|
|
|
:param value: float
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-04-07 16:50:36 -04:00
|
|
|
self._mean_heating_set_point = float(value)
|
2022-03-08 19:19:52 -05:00
|
|
|
|
|
|
|
@property
|
|
|
|
def heating_set_back(self) -> Union[None, float]:
|
|
|
|
"""
|
|
|
|
Get heating set back defined for a thermal zone in Celsius
|
|
|
|
:return: None or float
|
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
if self._heating_set_back is None:
|
|
|
|
if self.heating_set_point_schedules is not None:
|
|
|
|
self._heating_set_back = self._minimum_value(self.heating_set_point_schedules)
|
2022-03-08 19:19:52 -05:00
|
|
|
return self._heating_set_back
|
|
|
|
|
|
|
|
@heating_set_back.setter
|
|
|
|
def heating_set_back(self, value):
|
|
|
|
"""
|
|
|
|
Set heating set back defined for a thermal zone in Celsius
|
|
|
|
:param value: float
|
|
|
|
"""
|
|
|
|
if value is not None:
|
|
|
|
self._heating_set_back = float(value)
|
|
|
|
|
|
|
|
@property
|
2022-03-17 18:49:44 -04:00
|
|
|
def mean_cooling_set_point(self) -> Union[None, float]:
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
Get cooling set point defined for a thermal zone in Celsius
|
2022-03-17 18:49:44 -04:00
|
|
|
:return: None or float
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
if self._mean_cooling_set_point is None:
|
|
|
|
if self.cooling_set_point_schedules is not None:
|
|
|
|
self._mean_cooling_set_point = self._minimum_value(self.cooling_set_point_schedules)
|
|
|
|
return self._mean_cooling_set_point
|
2022-03-08 19:19:52 -05:00
|
|
|
|
2022-03-17 18:49:44 -04:00
|
|
|
@mean_cooling_set_point.setter
|
|
|
|
def mean_cooling_set_point(self, value):
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
Set cooling set point defined for a thermal zone in Celsius
|
2022-03-17 18:49:44 -04:00
|
|
|
:param value: float
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-04-07 16:50:36 -04:00
|
|
|
self._mean_cooling_set_point = float(value)
|
2022-03-08 19:19:52 -05:00
|
|
|
|
|
|
|
@property
|
2022-03-17 18:49:44 -04:00
|
|
|
def hvac_availability_schedules(self) -> Union[None, List[Schedule]]:
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
Get the availability of the conditioning system defined for a thermal zone
|
2022-04-06 16:06:55 -04:00
|
|
|
dataType = on/off
|
2022-03-17 18:49:44 -04:00
|
|
|
:return: None or [Schedule]
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
return self._hvac_availability_schedules
|
2022-03-08 19:19:52 -05:00
|
|
|
|
2022-03-17 18:49:44 -04:00
|
|
|
@hvac_availability_schedules.setter
|
|
|
|
def hvac_availability_schedules(self, value):
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
|
|
|
Set the availability of the conditioning system defined for a thermal zone
|
2022-04-06 16:06:55 -04:00
|
|
|
dataType = on/off
|
2022-03-17 18:49:44 -04:00
|
|
|
:param value: [Schedule]
|
|
|
|
"""
|
|
|
|
self._hvac_availability_schedules = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def heating_set_point_schedules(self) -> Union[None, List[Schedule]]:
|
|
|
|
"""
|
|
|
|
Get heating set point schedule defined for a thermal zone in Celsius
|
2022-04-06 16:06:55 -04:00
|
|
|
dataType = temperature
|
2022-03-17 18:49:44 -04:00
|
|
|
:return: None or [Schedule]
|
2022-03-08 19:19:52 -05:00
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
return self._heating_set_point_schedules
|
2022-03-08 19:19:52 -05:00
|
|
|
|
2022-03-17 18:49:44 -04:00
|
|
|
@heating_set_point_schedules.setter
|
|
|
|
def heating_set_point_schedules(self, value):
|
|
|
|
"""
|
|
|
|
Set heating set point schedule defined for a thermal zone in Celsius
|
2022-04-06 16:06:55 -04:00
|
|
|
dataType = temperature
|
2022-03-17 18:49:44 -04:00
|
|
|
:param value: [Schedule]
|
|
|
|
"""
|
|
|
|
self._heating_set_point_schedules = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def cooling_set_point_schedules(self) -> Union[None, List[Schedule]]:
|
|
|
|
"""
|
|
|
|
Get cooling set point schedule defined for a thermal zone in Celsius
|
2022-04-06 16:06:55 -04:00
|
|
|
dataType = temperature
|
2022-03-17 18:49:44 -04:00
|
|
|
:return: None or [Schedule]
|
|
|
|
"""
|
|
|
|
return self._cooling_set_point_schedules
|
|
|
|
|
|
|
|
@cooling_set_point_schedules.setter
|
|
|
|
def cooling_set_point_schedules(self, value):
|
|
|
|
"""
|
|
|
|
Set cooling set point schedule defined for a thermal zone in Celsius
|
2022-04-06 16:06:55 -04:00
|
|
|
dataType = temperature
|
2022-03-17 18:49:44 -04:00
|
|
|
:param value: [Schedule]
|
|
|
|
"""
|
|
|
|
self._cooling_set_point_schedules = value
|