Changes in physics library related files to control mandatory and optional properties, w/ and w/o default values

This commit is contained in:
pilar 2020-06-09 15:17:19 -04:00
parent eea722d16d
commit 59c9d28afe
6 changed files with 86 additions and 40 deletions

View File

@ -12,13 +12,13 @@ class ThermalBoundary:
# ToDo: up to at least LOD2 will be just one thermal opening per Thermal boundary, review for LOD3 and LOD4 # ToDo: up to at least LOD2 will be just one thermal opening per Thermal boundary, review for LOD3 and LOD4
self._thermal_openings = [ThermalOpening()] self._thermal_openings = [ThermalOpening()]
self._layers = None self._layers = None
self._outside_solar_absorptance = None self._outside_solar_absorptance = Configuration().outside_solar_absorptance
self._outside_thermal_absorptance = None self._outside_thermal_absorptance = None
self._outside_visible_absorptance = None self._outside_visible_absorptance = None
self._window_ratio = None self._window_ratio = None
self._u_value = None self._u_value = None
self._window_area = None self._window_area = None
self._shortwave_reflectance = None self._shortwave_reflectance = 1 - self._outside_solar_absorptance
@property @property
def delimits(self) -> List[ThermalZone]: def delimits(self) -> List[ThermalZone]:
@ -51,6 +51,7 @@ class ThermalBoundary:
@outside_solar_absorptance.setter @outside_solar_absorptance.setter
def outside_solar_absorptance(self, value): def outside_solar_absorptance(self, value):
self._outside_solar_absorptance = value self._outside_solar_absorptance = value
self._shortwave_reflectance = 1.0 - float(value)
@property @property
def outside_thermal_absorptance(self): def outside_thermal_absorptance(self):
@ -124,9 +125,9 @@ class ThermalBoundary:
@property @property
def shortwave_reflectance(self): def shortwave_reflectance(self):
if self._shortwave_reflectance is None:
try:
self._shortwave_reflectance = 1.0 - float(self.outside_solar_absorptance)
except TypeError:
raise Exception('Outside solar absorptance is not initialized')
return self._shortwave_reflectance return self._shortwave_reflectance
@shortwave_reflectance.setter
def shortwave_reflectance(self, value):
self._shortwave_reflectance = value
self._outside_solar_absorptance = 1.0 - float(value)

View File

@ -8,9 +8,9 @@ class ThermalOpening:
self._frame_ratio = Configuration().frame_ratio self._frame_ratio = Configuration().frame_ratio
self._g_value = None self._g_value = None
self._thickness_m = None self._thickness_m = None
self._inside_reflectance = None self._front_side_solar_transmittance_at_normal_incidence = None
self._outside_reflectance = None self._back_side_solar_transmittance_at_normal_incidence = None
self._u_value = None self._overall_u_value = None
@property @property
def openable_ratio(self): def openable_ratio(self):
@ -26,7 +26,14 @@ class ThermalOpening:
@conductivity_w_mk.setter @conductivity_w_mk.setter
def conductivity_w_mk(self, value): def conductivity_w_mk(self, value):
# 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_w_mk = value self._conductivity_w_mk = value
if self._overall_u_value is None and self.thickness_m is not None:
h_i = Configuration().h_i
h_e = Configuration().h_e
r_value = 1 / h_i + 1 / h_e + float(self.conductivity_w_mk) / float(self.thickness_m)
self._overall_u_value = 1 / r_value
@property @property
def frame_ratio(self): def frame_ratio(self):
@ -50,32 +57,35 @@ class ThermalOpening:
@thickness_m.setter @thickness_m.setter
def thickness_m(self, value): def thickness_m(self, value):
# The code to calculate overall_u_value is duplicated here and in conductivity_w_mk.
# This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read.
self._thickness_m = value self._thickness_m = value
if self._overall_u_value is None and self.conductivity_w_mk is not None:
h_i = Configuration().h_i
h_e = Configuration().h_e
r_value = 1 / h_i + 1 / h_e + float(self.conductivity_w_mk) / float(self.thickness_m)
self._overall_u_value = 1 / r_value
@property @property
def inside_reflectance(self): def front_side_solar_transmittance_at_normal_incidence(self):
return self._inside_reflectance return self._front_side_solar_transmittance_at_normal_incidence
@inside_reflectance.setter @front_side_solar_transmittance_at_normal_incidence.setter
def inside_reflectance(self, value): def front_side_solar_transmittance_at_normal_incidence(self, value):
self._inside_reflectance = value self._front_side_solar_transmittance_at_normal_incidence = value
@property @property
def outside_reflectance(self): def back_side_solar_transmittance_at_normal_incidence(self):
return self._outside_reflectance return self._back_side_solar_transmittance_at_normal_incidence
@outside_reflectance.setter @back_side_solar_transmittance_at_normal_incidence.setter
def outside_reflectance(self, value): def back_side_solar_transmittance_at_normal_incidence(self, value):
self._outside_reflectance = value self._back_side_solar_transmittance_at_normal_incidence = value
@property @property
def u_value(self): def overall_u_value(self):
if self._u_value is None: return self._overall_u_value
try:
h_i = Configuration().h_i @overall_u_value.setter
h_e = Configuration().h_e def overall_u_value(self, value):
r_value = 1 / h_i + 1 / h_e + float(self.conductivity_w_mk) / float(self.thickness_m) self._overall_u_value = value
self._u_value = 1 / r_value
except TypeError:
Exception('Thermal opening is not initialized')
return self._u_value

View File

@ -1,19 +1,20 @@
from typing import List from typing import List
from city_model_structure.thermal_boundary import ThermalBoundary from city_model_structure.thermal_boundary import ThermalBoundary
from city_model_structure.usage_zone import UsageZone from city_model_structure.usage_zone import UsageZone
from helpers.configuration import Configuration
class ThermalZone: class ThermalZone:
def __init__(self, surfaces, heated=True, cooled=True): def __init__(self, surfaces):
self._surfaces = surfaces self._surfaces = surfaces
self._floor_area = None self._floor_area = None
self._bounded = None self._bounded = None
self._heated = heated self._heated = Configuration().heated
self._cooled = cooled self._cooled = Configuration().cooled
self._additional_thermal_bridge_u_value = None self._additional_thermal_bridge_u_value = Configuration().additional_thermal_bridge_u_value
self._effective_thermal_capacity = None self._effective_thermal_capacity = None
self._indirectly_heated_area_ratio = None self._indirectly_heated_area_ratio = Configuration().indirectly_heated_area_ratio
self._infiltration_rate_system_on = None self._infiltration_rate_system_on = Configuration().infiltration_rate_system_on
self._infiltration_rate_system_off = None self._infiltration_rate_system_off = None
self._usage_zones = None self._usage_zones = None

View File

@ -5,3 +5,12 @@ h_e = 25 # W/m2K
[windows] [windows]
frame_ratio = 0 frame_ratio = 0
[thermal_zones]
heated = True
cooled = True
additional_thermal_bridge_u_value = 0
indirectly_heated_area_ratio = 0
infiltration_rate_system_on = 0
outside_solar_absorptance = 0.2
shortwave_reflectance = 0.8

View File

@ -19,4 +19,28 @@ class Configuration:
@property @property
def frame_ratio(self): def frame_ratio(self):
return self._config.getint('windows', 'frame_ratio') return self._config.getfloat('windows', 'frame_ratio')
@property
def heated(self):
return self._config.getboolean('thermal_zones', 'heated')
@property
def cooled(self):
return self._config.getboolean('thermal_zones', 'cooled')
@property
def additional_thermal_bridge_u_value(self):
return self._config.getfloat('thermal_zones', 'additional_thermal_bridge_u_value')
@property
def indirectly_heated_area_ratio(self):
return self._config.getfloat('thermal_zones', 'indirectly_heated_area_ratio')
@property
def infiltration_rate_system_on(self):
return self._config.getfloat('thermal_zones', 'infiltration_rate_system_on')
@property
def outside_solar_absorptance(self):
return self._config.getfloat('thermal_zones', 'outside_solar_absorptance')

View File

@ -79,9 +79,10 @@ class UsBasePhysicsParameters:
opening.frame_ratio = w_lib['frame_ratio']['#text'] opening.frame_ratio = w_lib['frame_ratio']['#text']
opening.g_value = w_lib['solar_transmittance_at_normal_incidence']['#text'] opening.g_value = w_lib['solar_transmittance_at_normal_incidence']['#text']
opening.thickness_m = w_lib['thickness']['#text'] opening.thickness_m = w_lib['thickness']['#text']
opening.inside_reflectance = 1.0-float(w_lib['back_side_solar_transmittance_at_normal_incidence']['#text']) opening.back_side_solar_transmittance_at_normal_incidence = \
opening.outside_reflectance = \ w_lib['back_side_solar_transmittance_at_normal_incidence']['#text']
1.0-float(w_lib['front_side_solar_transmittance_at_normal_incidence']['#text']) opening.front_side_solar_transmittance_at_normal_incidence = \
w_lib['front_side_solar_transmittance_at_normal_incidence']['#text']
def search_archetype(self, building_type, standard, climate_zone): def search_archetype(self, building_type, standard, climate_zone):
for archetype in self._archetypes['archetypes']['archetype']: for archetype in self._archetypes['archetypes']['archetype']: