system_assignation/city_model_structure/attributes/thermal_opening.py

174 lines
4.6 KiB
Python
Raw Normal View History

2020-10-28 13:42:58 -04:00
"""
ThermalOpening module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
2020-11-26 09:26:55 -05:00
Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
2020-10-28 13:42:58 -04:00
"""
class ThermalOpening:
"""
ThermalOpening class
"""
def __init__(self, hi, he):
2020-10-28 13:42:58 -04:00
self._openable_ratio = None
self._conductivity = None
self._frame_ratio = 0
2020-10-28 13:42:58 -04:00
self._g_value = None
self._thickness = None
self._front_side_solar_transmittance_at_normal_incidence = None
self._back_side_solar_transmittance_at_normal_incidence = None
self._overall_u_value = None
self._hi = hi
self._he = he
2020-10-28 13:42:58 -04:00
@property
def openable_ratio(self):
"""
Get thermal opening openable ratio, NOT IMPLEMENTED
:return: Exception
"""
raise NotImplementedError()
@openable_ratio.setter
def openable_ratio(self, value):
"""
Set thermal opening openable ratio, NOT IMPLEMENTED
:param value: Any
:return: Exception
"""
raise NotImplementedError()
@property
def conductivity(self):
"""
Get thermal opening conductivity in W/mK
:return: float
"""
return self._conductivity
@conductivity.setter
def conductivity(self, value):
"""
Get thermal opening conductivity in W/mK
:param value: float
:return: None
"""
# The code to calculate overall_u_value is duplicated here and in thickness_m.
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
self._conductivity = value
if self._overall_u_value is None and self.thickness is not None:
h_i = self._hi
h_e = self._he
2020-10-28 13:42:58 -04:00
r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness)
self._overall_u_value = 1 / r_value
@property
def frame_ratio(self):
"""
Get thermal opening frame ratio
:return: float
"""
return self._frame_ratio
@frame_ratio.setter
def frame_ratio(self, value):
"""
Set thermal opening frame ratio
:param value: float
:return: None
"""
self._frame_ratio = value
@property
def g_value(self):
"""
Get thermal opening g-value
2020-10-28 13:42:58 -04:00
:return: float
"""
return self._g_value
@g_value.setter
def g_value(self, value):
"""
Set thermal opening g-value
2020-10-28 13:42:58 -04:00
:param value:
:return:
"""
self._g_value = value
@property
def thickness(self):
"""
Get thermal opening thickness in meters
:return:
"""
return self._thickness
@thickness.setter
def thickness(self, value):
"""
Set thermal opening thickness in meters
:param value: float
:return: None
"""
# The code to calculate overall_u_value is duplicated here and in conductivity.
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
self._thickness = value
if self._overall_u_value is None and self.conductivity is not None:
h_i = self._hi
h_e = self._he
2020-10-28 13:42:58 -04:00
r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness)
self._overall_u_value = 1 / r_value
@property
def front_side_solar_transmittance_at_normal_incidence(self):
"""
Get thermal opening front side solar transmittance at normal incidence
:return: float
"""
return self._front_side_solar_transmittance_at_normal_incidence
@front_side_solar_transmittance_at_normal_incidence.setter
def front_side_solar_transmittance_at_normal_incidence(self, value):
"""
Set thermal opening front side solar transmittance at normal incidence
:param value: float
:return: None
"""
self._front_side_solar_transmittance_at_normal_incidence = value
@property
def back_side_solar_transmittance_at_normal_incidence(self):
"""
Get thermal opening back side solar transmittance at normal incidence
:return: float
"""
return self._back_side_solar_transmittance_at_normal_incidence
@back_side_solar_transmittance_at_normal_incidence.setter
def back_side_solar_transmittance_at_normal_incidence(self, value):
"""
Set thermal opening back side solar transmittance at normal incidence
:param value: float
:return: None
"""
self._back_side_solar_transmittance_at_normal_incidence = value
@property
def overall_u_value(self):
"""
Get thermal opening overall U-value in W/m2K
2020-10-28 13:42:58 -04:00
:return: float
"""
return self._overall_u_value
@overall_u_value.setter
def overall_u_value(self, value):
"""
Get thermal opening overall U-value in W/m2K
2020-10-28 13:42:58 -04:00
:param value: float
:return: None
"""
self._overall_u_value = value