hub/city_model_structure/building_demand/thermal_opening.py

289 lines
7.3 KiB
Python

"""
ThermalOpening module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import uuid
from typing import TypeVar
Polygon = TypeVar('Polygon')
class ThermalOpening:
"""
ThermalOpening class
"""
def __init__(self):
self._id = None
self._area = None
self._openable_ratio = None
self._conductivity = None
self._frame_ratio = None
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 = None
self._he = None
self._surface_geometry = None
self._inside_emissivity = None
self._alpha_coefficient = None
self._radiative_coefficient = None
@property
def id(self):
"""
Get thermal zone id, an universally unique identifier randomly generated
:return: str
"""
if self._id is None:
self._id = uuid.uuid4()
return self._id
@property
def area(self):
"""
Get thermal opening area in square meters
:return: float
"""
return self._area
@area.setter
def area(self, value):
"""
Set thermal opening area in square meters
:param value: float
"""
self._area = value
@property
def openable_ratio(self):
"""
Raises not implemented error
"""
raise NotImplementedError
@openable_ratio.setter
def openable_ratio(self, value):
"""
Raises not implemented error
"""
raise NotImplementedError
@property
def conductivity(self):
"""
Get thermal opening conductivity in W/mK
:return: float
"""
return self._conductivity
@conductivity.setter
def conductivity(self, value):
"""
Set thermal opening conductivity in W/mK
:param value: float
"""
# 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
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
"""
self._frame_ratio = value
@property
def g_value(self):
"""
Get thermal opening g-value
:return: float
"""
return self._g_value
@g_value.setter
def g_value(self, value):
"""
Set thermal opening g-value
:param value: float
"""
self._g_value = value
@property
def thickness(self):
"""
Get thermal opening thickness in meters
:return: float
"""
return self._thickness
@thickness.setter
def thickness(self, value):
"""
Set thermal opening thickness in meters
:param value: float
"""
# 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
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
"""
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
"""
self._back_side_solar_transmittance_at_normal_incidence = value
@property
def overall_u_value(self):
"""
Get thermal opening overall U-value in W/m2K
:return: float
"""
return self._overall_u_value
@overall_u_value.setter
def overall_u_value(self, value):
"""
Set thermal opening overall U-value in W/m2K
:param value: float
"""
self._overall_u_value = value
@property
def hi(self):
"""
Get internal convective heat transfer coefficient (W/m2K)
:return: float
"""
return self._hi
@hi.setter
def hi(self, value):
"""
Set internal convective heat transfer coefficient (W/m2K)
:param value: float
"""
self._hi = value
@property
def he(self):
"""
Get external convective heat transfer coefficient (W/m2K)
:return: float
"""
return self._he
@he.setter
def he(self, value):
"""
Set external convective heat transfer coefficient (W/m2K)
:param value: float
"""
self._he = value
@property
def surface_geometry(self) -> Polygon:
"""
Get the polygon that defines the thermal opening
:return: Polygon
"""
return self._surface_geometry
# todo: need extract information from construction library or assume them at the beginning of workflows
@property
def inside_emissivity(self):
"""
Get the short wave emissivity factor of the thermal opening's internal surface (-)
:return: float
"""
return self._inside_emissivity
@inside_emissivity.setter
def inside_emissivity(self, value):
"""
Set short wave emissivity factor of the thermal opening's internal surface (-)
:param value: float
"""
self._inside_emissivity = value
@property
def alpha_coefficient(self):
"""
Get the long wave emissivity factor of the thermal opening's internal surface (-)
:return: float
"""
return self._alpha_coefficient
@alpha_coefficient.setter
def alpha_coefficient(self, value):
"""
Set long wave emissivity factor of the thermal opening's internal surface (-)
:param value: float
"""
self._alpha_coefficient = value
@property
def radiative_coefficient(self):
"""
Get the radiative coefficient of the thermal opening's external surface (-)
:return: float
"""
return self._radiative_coefficient
@radiative_coefficient.setter
def radiative_coefficient(self, value):
"""
Set radiative coefficient of the thermal opening's external surface (-)
:param value: float
"""
self._radiative_coefficient = value