solved a bug found in the thermal zone when creating the classes related to the usage
This commit is contained in:
parent
04ef5d2c2e
commit
ba35ce361b
|
@ -292,6 +292,7 @@ class Surface:
|
|||
Divides a surface at Z plane
|
||||
:return: Surface, Surface, Any
|
||||
"""
|
||||
# todo: check return types
|
||||
# todo: recheck this method for LoD3 (windows)
|
||||
origin = Point([0, 0, z])
|
||||
normal = np.array([0, 0, 1])
|
||||
|
|
|
@ -32,18 +32,17 @@ class ThermalBoundary:
|
|||
self._outside_thermal_absorptance = None
|
||||
self._outside_visible_absorptance = None
|
||||
self._u_value = None
|
||||
self._shortwave_reflectance = None
|
||||
self._outside_shortwave_reflectance = None
|
||||
self._construction_name = None
|
||||
self._hi = ch().convective_heat_transfer_coefficient_interior
|
||||
self._he = ch().convective_heat_transfer_coefficient_exterior
|
||||
self._refurbishment_measure = None
|
||||
self._thickness = None
|
||||
self._virtual_internal_surface = None
|
||||
self._inside_emissivity = None
|
||||
self._alpha_coefficient = None
|
||||
self._radiative_coefficient = None
|
||||
self._window_ratio = None
|
||||
self._window_ration_is_calculated = False
|
||||
self._window_ratio_is_calculated = False
|
||||
self._vegetation = None
|
||||
|
||||
@property
|
||||
|
@ -135,7 +134,7 @@ class ThermalBoundary:
|
|||
"""
|
||||
if value is not None:
|
||||
self._outside_solar_absorptance = float(value)
|
||||
self._shortwave_reflectance = 1.0 - float(value)
|
||||
self._outside_shortwave_reflectance = 1.0 - float(value)
|
||||
|
||||
@property
|
||||
def outside_thermal_absorptance(self) -> Union[None, float]:
|
||||
|
@ -252,7 +251,7 @@ class ThermalBoundary:
|
|||
:return: float
|
||||
"""
|
||||
if self.windows_areas is not None:
|
||||
if not self._window_ration_is_calculated:
|
||||
if not self._window_ratio_is_calculated:
|
||||
_calculated = True
|
||||
if len(self.windows_areas) == 0:
|
||||
self._window_ratio = 0
|
||||
|
@ -269,7 +268,7 @@ class ThermalBoundary:
|
|||
Set thermal boundary window ratio
|
||||
:param value: str
|
||||
"""
|
||||
if self._window_ration_is_calculated:
|
||||
if self._window_ratio_is_calculated:
|
||||
raise ValueError('Window ratio cannot be assigned when the windows are defined in the geometry.')
|
||||
self._window_ratio = float(value)
|
||||
|
||||
|
@ -313,21 +312,21 @@ class ThermalBoundary:
|
|||
self._u_value = float(value)
|
||||
|
||||
@property
|
||||
def shortwave_reflectance(self) -> Union[None, float]:
|
||||
def outside_shortwave_reflectance(self) -> Union[None, float]:
|
||||
"""
|
||||
Get thermal boundary shortwave reflectance
|
||||
Get thermal boundary external shortwave reflectance
|
||||
:return: None or float
|
||||
"""
|
||||
return self._shortwave_reflectance
|
||||
return self._outside_shortwave_reflectance
|
||||
|
||||
@shortwave_reflectance.setter
|
||||
def shortwave_reflectance(self, value):
|
||||
@outside_shortwave_reflectance.setter
|
||||
def outside_shortwave_reflectance(self, value):
|
||||
"""
|
||||
Set thermal boundary shortwave reflectance
|
||||
Set thermal boundary external shortwave reflectance
|
||||
:param value: float
|
||||
"""
|
||||
if value is not None:
|
||||
self._shortwave_reflectance = float(value)
|
||||
self._outside_shortwave_reflectance = float(value)
|
||||
self._outside_solar_absorptance = 1.0 - float(value)
|
||||
|
||||
@property
|
||||
|
|
|
@ -309,38 +309,39 @@ class ThermalZone:
|
|||
if self.usage_zones is None:
|
||||
return None
|
||||
|
||||
self._occupancy = Occupancy()
|
||||
_occupancy_density = 0
|
||||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.occupancy is None:
|
||||
return None
|
||||
_occupancy_density += usage_zone.percentage * usage_zone.occupancy.occupancy_density
|
||||
if usage_zone.occupancy.sensible_convective_internal_gain is not None:
|
||||
_convective_part += usage_zone.percentage * usage_zone.occupancy.sensible_convective_internal_gain
|
||||
_radiative_part += usage_zone.percentage * usage_zone.occupancy.sensible_radiative_internal_gain
|
||||
_latent_part += usage_zone.percentage * usage_zone.occupancy.latent_internal_gain
|
||||
self._occupancy.occupancy_density = _occupancy_density
|
||||
self._occupancy.sensible_convective_internal_gain = _convective_part
|
||||
self._occupancy.sensible_radiative_internal_gain = _radiative_part
|
||||
self._occupancy.latent_internal_gain = _latent_part
|
||||
if self._occupancy is None:
|
||||
self._occupancy = Occupancy()
|
||||
_occupancy_density = 0
|
||||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.occupancy is None:
|
||||
return None
|
||||
_occupancy_density += usage_zone.percentage * usage_zone.occupancy.occupancy_density
|
||||
if usage_zone.occupancy.sensible_convective_internal_gain is not None:
|
||||
_convective_part += usage_zone.percentage * usage_zone.occupancy.sensible_convective_internal_gain
|
||||
_radiative_part += usage_zone.percentage * usage_zone.occupancy.sensible_radiative_internal_gain
|
||||
_latent_part += usage_zone.percentage * usage_zone.occupancy.latent_internal_gain
|
||||
self._occupancy.occupancy_density = _occupancy_density
|
||||
self._occupancy.sensible_convective_internal_gain = _convective_part
|
||||
self._occupancy.sensible_radiative_internal_gain = _radiative_part
|
||||
self._occupancy.latent_internal_gain = _latent_part
|
||||
|
||||
_occupancy_reference = self.usage_zones[0].occupancy
|
||||
if _occupancy_reference.occupancy_schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_occupancy_reference.occupancy_schedules)):
|
||||
schedule = copy.deepcopy(_occupancy_reference.occupancy_schedules[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_occupancy_reference.occupancy_schedules[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_new_value += usage_zone.percentage * usage_zone.occupancy.occupancy_schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
self._occupancy.occupancy_schedules = _schedules
|
||||
_occupancy_reference = self.usage_zones[0].occupancy
|
||||
if _occupancy_reference.occupancy_schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_occupancy_reference.occupancy_schedules)):
|
||||
schedule = copy.deepcopy(_occupancy_reference.occupancy_schedules[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_occupancy_reference.occupancy_schedules[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_new_value += usage_zone.percentage * usage_zone.occupancy.occupancy_schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
self._occupancy.occupancy_schedules = _schedules
|
||||
return self._occupancy
|
||||
|
||||
@property
|
||||
|
@ -352,46 +353,47 @@ class ThermalZone:
|
|||
if self.usage_zones is None:
|
||||
return None
|
||||
|
||||
self._lighting = Lighting()
|
||||
_lighting_density = 0
|
||||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.lighting is None:
|
||||
return None
|
||||
_lighting_density += usage_zone.percentage * usage_zone.lighting.density
|
||||
if usage_zone.lighting.convective_fraction is not None:
|
||||
_convective_part += usage_zone.percentage * usage_zone.lighting.density \
|
||||
* usage_zone.lighting.convective_fraction
|
||||
_radiative_part += usage_zone.percentage * usage_zone.lighting.density \
|
||||
* usage_zone.lighting.radiative_fraction
|
||||
_latent_part += usage_zone.percentage * usage_zone.lighting.density \
|
||||
* usage_zone.lighting.latent_fraction
|
||||
self._lighting.density = _lighting_density
|
||||
if _lighting_density > 0:
|
||||
self._lighting.convective_fraction = _convective_part / _lighting_density
|
||||
self._lighting.radiative_fraction = _radiative_part / _lighting_density
|
||||
self._lighting.latent_fraction = _latent_part / _lighting_density
|
||||
else:
|
||||
self._lighting.convective_fraction = 0
|
||||
self._lighting.radiative_fraction = 0
|
||||
self._lighting.latent_fraction = 0
|
||||
if self._lighting is None:
|
||||
self._lighting = Lighting()
|
||||
_lighting_density = 0
|
||||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.lighting is None:
|
||||
return None
|
||||
_lighting_density += usage_zone.percentage * usage_zone.lighting.density
|
||||
if usage_zone.lighting.convective_fraction is not None:
|
||||
_convective_part += usage_zone.percentage * usage_zone.lighting.density \
|
||||
* usage_zone.lighting.convective_fraction
|
||||
_radiative_part += usage_zone.percentage * usage_zone.lighting.density \
|
||||
* usage_zone.lighting.radiative_fraction
|
||||
_latent_part += usage_zone.percentage * usage_zone.lighting.density \
|
||||
* usage_zone.lighting.latent_fraction
|
||||
self._lighting.density = _lighting_density
|
||||
if _lighting_density > 0:
|
||||
self._lighting.convective_fraction = _convective_part / _lighting_density
|
||||
self._lighting.radiative_fraction = _radiative_part / _lighting_density
|
||||
self._lighting.latent_fraction = _latent_part / _lighting_density
|
||||
else:
|
||||
self._lighting.convective_fraction = 0
|
||||
self._lighting.radiative_fraction = 0
|
||||
self._lighting.latent_fraction = 0
|
||||
|
||||
_lighting_reference = self.usage_zones[0].lighting
|
||||
if _lighting_reference.schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_lighting_reference.schedules)):
|
||||
schedule = copy.deepcopy(_lighting_reference.schedules[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_lighting_reference.schedules[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_new_value += usage_zone.percentage * usage_zone.lighting.schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
self._lighting.schedules = _schedules
|
||||
_lighting_reference = self.usage_zones[0].lighting
|
||||
if _lighting_reference.schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_lighting_reference.schedules)):
|
||||
schedule = copy.deepcopy(_lighting_reference.schedules[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_lighting_reference.schedules[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_new_value += usage_zone.percentage * usage_zone.lighting.schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
self._lighting.schedules = _schedules
|
||||
return self._lighting
|
||||
|
||||
@property
|
||||
|
@ -403,46 +405,47 @@ class ThermalZone:
|
|||
if self.usage_zones is None:
|
||||
return None
|
||||
|
||||
self._appliances = Appliances()
|
||||
_appliances_density = 0
|
||||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.appliances is None:
|
||||
return None
|
||||
_appliances_density += usage_zone.percentage * usage_zone.appliances.density
|
||||
if usage_zone.appliances.convective_fraction is not None:
|
||||
_convective_part += usage_zone.percentage * usage_zone.appliances.density \
|
||||
* usage_zone.appliances.convective_fraction
|
||||
_radiative_part += usage_zone.percentage * usage_zone.appliances.density \
|
||||
* usage_zone.appliances.radiative_fraction
|
||||
_latent_part += usage_zone.percentage * usage_zone.appliances.density \
|
||||
* usage_zone.appliances.latent_fraction
|
||||
self._appliances.density = _appliances_density
|
||||
if _appliances_density > 0:
|
||||
self._appliances.convective_fraction = _convective_part / _appliances_density
|
||||
self._appliances.radiative_fraction = _radiative_part / _appliances_density
|
||||
self._appliances.latent_fraction = _latent_part / _appliances_density
|
||||
else:
|
||||
self._appliances.convective_fraction = 0
|
||||
self._appliances.radiative_fraction = 0
|
||||
self._appliances.latent_fraction = 0
|
||||
if self._appliances is None:
|
||||
self._appliances = Appliances()
|
||||
_appliances_density = 0
|
||||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.appliances is None:
|
||||
return None
|
||||
_appliances_density += usage_zone.percentage * usage_zone.appliances.density
|
||||
if usage_zone.appliances.convective_fraction is not None:
|
||||
_convective_part += usage_zone.percentage * usage_zone.appliances.density \
|
||||
* usage_zone.appliances.convective_fraction
|
||||
_radiative_part += usage_zone.percentage * usage_zone.appliances.density \
|
||||
* usage_zone.appliances.radiative_fraction
|
||||
_latent_part += usage_zone.percentage * usage_zone.appliances.density \
|
||||
* usage_zone.appliances.latent_fraction
|
||||
self._appliances.density = _appliances_density
|
||||
if _appliances_density > 0:
|
||||
self._appliances.convective_fraction = _convective_part / _appliances_density
|
||||
self._appliances.radiative_fraction = _radiative_part / _appliances_density
|
||||
self._appliances.latent_fraction = _latent_part / _appliances_density
|
||||
else:
|
||||
self._appliances.convective_fraction = 0
|
||||
self._appliances.radiative_fraction = 0
|
||||
self._appliances.latent_fraction = 0
|
||||
|
||||
_appliances_reference = self.usage_zones[0].appliances
|
||||
if _appliances_reference.schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_appliances_reference.schedules)):
|
||||
schedule = copy.deepcopy(_appliances_reference.schedules[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_appliances_reference.schedules[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_new_value += usage_zone.percentage * usage_zone.appliances.schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
self._appliances.schedules = _schedules
|
||||
_appliances_reference = self.usage_zones[0].appliances
|
||||
if _appliances_reference.schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_appliances_reference.schedules)):
|
||||
schedule = copy.deepcopy(_appliances_reference.schedules[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_appliances_reference.schedules[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_new_value += usage_zone.percentage * usage_zone.appliances.schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
self._appliances.schedules = _schedules
|
||||
return self._appliances
|
||||
|
||||
@property
|
||||
|
@ -454,53 +457,54 @@ class ThermalZone:
|
|||
if self.usage_zones is None:
|
||||
return None
|
||||
|
||||
_internal_gain = InternalGain()
|
||||
_days = [cte.MONDAY, cte.TUESDAY, cte.WEDNESDAY, cte.THURSDAY, cte.FRIDAY, cte.SATURDAY, cte.SUNDAY, cte.HOLIDAY]
|
||||
_average_internal_gain = 0
|
||||
_convective_fraction = 0
|
||||
_radiative_fraction = 0
|
||||
_latent_fraction = 0
|
||||
_schedules = None
|
||||
_base_schedule = Schedule()
|
||||
_base_schedule.type = cte.INTERNAL_GAINS
|
||||
_base_schedule.time_range = cte.DAY
|
||||
_base_schedule.time_step = cte.HOUR
|
||||
_base_schedule.data_type = cte.ANY_NUMBER
|
||||
_schedules_defined = True
|
||||
values = numpy.zeros([24, 8])
|
||||
for usage_zone in self.usage_zones:
|
||||
for internal_gain in usage_zone.internal_gains:
|
||||
_average_internal_gain += internal_gain.average_internal_gain * usage_zone.percentage
|
||||
_convective_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
* internal_gain.convective_fraction
|
||||
_radiative_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
* internal_gain.radiative_fraction
|
||||
_latent_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
* internal_gain.latent_fraction
|
||||
for usage_zone in self.usage_zones:
|
||||
for internal_gain in usage_zone.internal_gains:
|
||||
if len(internal_gain.schedules) == 0:
|
||||
_schedules_defined = False
|
||||
break
|
||||
for day, _schedule in enumerate(internal_gain.schedules):
|
||||
for v, value in enumerate(_schedule.values):
|
||||
values[v, day] += value * usage_zone.percentage
|
||||
if self._internal_gains is None:
|
||||
_internal_gain = InternalGain()
|
||||
_days = [cte.MONDAY, cte.TUESDAY, cte.WEDNESDAY, cte.THURSDAY, cte.FRIDAY, cte.SATURDAY, cte.SUNDAY, cte.HOLIDAY]
|
||||
_average_internal_gain = 0
|
||||
_convective_fraction = 0
|
||||
_radiative_fraction = 0
|
||||
_latent_fraction = 0
|
||||
_schedules = None
|
||||
_base_schedule = Schedule()
|
||||
_base_schedule.type = cte.INTERNAL_GAINS
|
||||
_base_schedule.time_range = cte.DAY
|
||||
_base_schedule.time_step = cte.HOUR
|
||||
_base_schedule.data_type = cte.ANY_NUMBER
|
||||
_schedules_defined = True
|
||||
values = numpy.zeros([24, 8])
|
||||
for usage_zone in self.usage_zones:
|
||||
for internal_gain in usage_zone.internal_gains:
|
||||
_average_internal_gain += internal_gain.average_internal_gain * usage_zone.percentage
|
||||
_convective_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
* internal_gain.convective_fraction
|
||||
_radiative_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
* internal_gain.radiative_fraction
|
||||
_latent_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
* internal_gain.latent_fraction
|
||||
for usage_zone in self.usage_zones:
|
||||
for internal_gain in usage_zone.internal_gains:
|
||||
if len(internal_gain.schedules) == 0:
|
||||
_schedules_defined = False
|
||||
break
|
||||
for day, _schedule in enumerate(internal_gain.schedules):
|
||||
for v, value in enumerate(_schedule.values):
|
||||
values[v, day] += value * usage_zone.percentage
|
||||
|
||||
if _schedules_defined:
|
||||
_schedules = []
|
||||
for day in range(0, len(_days)):
|
||||
_schedule = copy.deepcopy(_base_schedule)
|
||||
_schedule.day_types = [_days[day]]
|
||||
_schedule.values = values[:day]
|
||||
_schedules.append(_schedule)
|
||||
if _schedules_defined:
|
||||
_schedules = []
|
||||
for day in range(0, len(_days)):
|
||||
_schedule = copy.deepcopy(_base_schedule)
|
||||
_schedule.day_types = [_days[day]]
|
||||
_schedule.values = values[:day]
|
||||
_schedules.append(_schedule)
|
||||
|
||||
_internal_gain.convective_fraction = _convective_fraction / _average_internal_gain
|
||||
_internal_gain.radiative_fraction = _radiative_fraction / _average_internal_gain
|
||||
_internal_gain.latent_fraction = _latent_fraction / _average_internal_gain
|
||||
_internal_gain.average_internal_gain = _average_internal_gain
|
||||
_internal_gain.type = 'mean_value'
|
||||
_internal_gain.schedules = _schedules
|
||||
self._internal_gains = [_internal_gain]
|
||||
_internal_gain.convective_fraction = _convective_fraction / _average_internal_gain
|
||||
_internal_gain.radiative_fraction = _radiative_fraction / _average_internal_gain
|
||||
_internal_gain.latent_fraction = _latent_fraction / _average_internal_gain
|
||||
_internal_gain.average_internal_gain = _average_internal_gain
|
||||
_internal_gain.type = 'mean_value'
|
||||
_internal_gain.schedules = _schedules
|
||||
self._internal_gains = [_internal_gain]
|
||||
return self._internal_gains
|
||||
|
||||
@property
|
||||
|
@ -512,54 +516,55 @@ class ThermalZone:
|
|||
if self.usage_zones is None:
|
||||
return None
|
||||
|
||||
self._thermal_control = ThermalControl()
|
||||
_mean_heating_set_point = 0
|
||||
_heating_set_back = 0
|
||||
_mean_cooling_set_point = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_mean_heating_set_point += usage_zone.percentage * usage_zone.thermal_control.mean_heating_set_point
|
||||
_heating_set_back += usage_zone.percentage * usage_zone.thermal_control.heating_set_back
|
||||
_mean_cooling_set_point += usage_zone.percentage * usage_zone.thermal_control.mean_cooling_set_point
|
||||
self._thermal_control.mean_heating_set_point = _mean_heating_set_point
|
||||
self._thermal_control.heating_set_back = _heating_set_back
|
||||
self._thermal_control.mean_cooling_set_point = _mean_cooling_set_point
|
||||
if self._thermal_control is None:
|
||||
self._thermal_control = ThermalControl()
|
||||
_mean_heating_set_point = 0
|
||||
_heating_set_back = 0
|
||||
_mean_cooling_set_point = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
_mean_heating_set_point += usage_zone.percentage * usage_zone.thermal_control.mean_heating_set_point
|
||||
_heating_set_back += usage_zone.percentage * usage_zone.thermal_control.heating_set_back
|
||||
_mean_cooling_set_point += usage_zone.percentage * usage_zone.thermal_control.mean_cooling_set_point
|
||||
self._thermal_control.mean_heating_set_point = _mean_heating_set_point
|
||||
self._thermal_control.heating_set_back = _heating_set_back
|
||||
self._thermal_control.mean_cooling_set_point = _mean_cooling_set_point
|
||||
|
||||
_thermal_control_reference = self.usage_zones[0].thermal_control
|
||||
_types_reference = []
|
||||
if _thermal_control_reference.hvac_availability_schedules is not None:
|
||||
_types_reference.append([cte.HVAC_AVAILABILITY, _thermal_control_reference.hvac_availability_schedules])
|
||||
if _thermal_control_reference.heating_set_point_schedules is not None:
|
||||
_types_reference.append([cte.HEATING_SET_POINT, _thermal_control_reference.heating_set_point_schedules])
|
||||
if _thermal_control_reference.cooling_set_point_schedules is not None:
|
||||
_types_reference.append([cte.COOLING_SET_POINT, _thermal_control_reference.cooling_set_point_schedules])
|
||||
_thermal_control_reference = self.usage_zones[0].thermal_control
|
||||
_types_reference = []
|
||||
if _thermal_control_reference.hvac_availability_schedules is not None:
|
||||
_types_reference.append([cte.HVAC_AVAILABILITY, _thermal_control_reference.hvac_availability_schedules])
|
||||
if _thermal_control_reference.heating_set_point_schedules is not None:
|
||||
_types_reference.append([cte.HEATING_SET_POINT, _thermal_control_reference.heating_set_point_schedules])
|
||||
if _thermal_control_reference.cooling_set_point_schedules is not None:
|
||||
_types_reference.append([cte.COOLING_SET_POINT, _thermal_control_reference.cooling_set_point_schedules])
|
||||
|
||||
for i_type in range(0, len(_types_reference)):
|
||||
_schedules = []
|
||||
_schedule_type = _types_reference[i_type][1]
|
||||
for i_schedule in range(0, len(_schedule_type)):
|
||||
schedule = copy.deepcopy(_schedule_type[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_schedule_type[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if _types_reference[i_type][0] == cte.HVAC_AVAILABILITY:
|
||||
_new_value += usage_zone.percentage * \
|
||||
usage_zone.thermal_control.hvac_availability_schedules[i_schedule].values[i_value]
|
||||
elif _types_reference[i_type][0] == cte.HEATING_SET_POINT:
|
||||
_new_value += usage_zone.percentage * \
|
||||
usage_zone.thermal_control.heating_set_point_schedules[i_schedule].values[i_value]
|
||||
elif _types_reference[i_type][0] == cte.COOLING_SET_POINT:
|
||||
_new_value += usage_zone.percentage * \
|
||||
usage_zone.thermal_control.cooling_set_point_schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
if i_type == 0:
|
||||
self._thermal_control.hvac_availability_schedules = _schedules
|
||||
elif i_type == 1:
|
||||
self._thermal_control.heating_set_point_schedules = _schedules
|
||||
elif i_type == 2:
|
||||
self._thermal_control.cooling_set_point_schedules = _schedules
|
||||
for i_type in range(0, len(_types_reference)):
|
||||
_schedules = []
|
||||
_schedule_type = _types_reference[i_type][1]
|
||||
for i_schedule in range(0, len(_schedule_type)):
|
||||
schedule = copy.deepcopy(_schedule_type[i_schedule])
|
||||
new_values = []
|
||||
for i_value in range(0, len(_schedule_type[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if _types_reference[i_type][0] == cte.HVAC_AVAILABILITY:
|
||||
_new_value += usage_zone.percentage * \
|
||||
usage_zone.thermal_control.hvac_availability_schedules[i_schedule].values[i_value]
|
||||
elif _types_reference[i_type][0] == cte.HEATING_SET_POINT:
|
||||
_new_value += usage_zone.percentage * \
|
||||
usage_zone.thermal_control.heating_set_point_schedules[i_schedule].values[i_value]
|
||||
elif _types_reference[i_type][0] == cte.COOLING_SET_POINT:
|
||||
_new_value += usage_zone.percentage * \
|
||||
usage_zone.thermal_control.cooling_set_point_schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
if i_type == 0:
|
||||
self._thermal_control.hvac_availability_schedules = _schedules
|
||||
elif i_type == 1:
|
||||
self._thermal_control.heating_set_point_schedules = _schedules
|
||||
elif i_type == 2:
|
||||
self._thermal_control.cooling_set_point_schedules = _schedules
|
||||
|
||||
return self._thermal_control
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<buildingUsageLibrary>
|
||||
<name>Building Usage Library Reduced</name>
|
||||
<description>Library created by Rabeeh from whatever norm</description>
|
||||
<description>Library created by Sanam from HOT200 and ecobee</description>
|
||||
<source>https://www.engineeringtoolbox.com/metabolic-heat-persons-d_706.html</source>
|
||||
<zoneUsageType>
|
||||
<id>residential</id>
|
||||
|
|
|
@ -233,14 +233,17 @@ class Idf:
|
|||
self._idf.newidfobject(self._COMPACT_SCHEDULE, **_kwargs)
|
||||
return
|
||||
|
||||
def _add_schedules(self, usage, schedule_type, new_schedules, schedule_from_file=False):
|
||||
def _add_schedules(self, usage, schedule_type, new_schedules):
|
||||
schedule_from_file = False
|
||||
for schedule in new_schedules:
|
||||
if len(schedule.values) > 168: # Hours in one week
|
||||
schedule_from_file = True
|
||||
if schedule_from_file:
|
||||
new_schedule = new_schedules[0]
|
||||
for schedule in self._idf.idfobjects[self._FILE_SCHEDULE]:
|
||||
if schedule.Name == f'{schedule_type} schedules {usage}':
|
||||
return
|
||||
file_name = self._write_schedules_file(usage, new_schedule)
|
||||
return self._add_file_schedule(usage, new_schedule, file_name)
|
||||
file_name = self._write_schedules_file(usage, new_schedules[0])
|
||||
return self._add_file_schedule(usage, new_schedules[0], file_name)
|
||||
else:
|
||||
for schedule in self._idf.idfobjects[self._HOURLY_SCHEDULE]:
|
||||
if schedule.Name == f'{schedule_type} schedules {usage}':
|
||||
|
@ -382,7 +385,7 @@ class Idf:
|
|||
self._add_window_construction_and_material(thermal_opening)
|
||||
usage = thermal_zone.usage
|
||||
self._add_infiltration_schedules(thermal_zone)
|
||||
self._add_schedules(usage, 'Occupancy', thermal_zone.occupancy.occupancy_schedules, schedule_from_file=True)
|
||||
self._add_schedules(usage, 'Occupancy', thermal_zone.occupancy.occupancy_schedules)
|
||||
self._add_schedules(usage, 'HVAC AVAIL', thermal_zone.thermal_control.hvac_availability_schedules)
|
||||
self._add_schedules(usage, 'Heating thermostat', thermal_zone.thermal_control.heating_set_point_schedules)
|
||||
self._add_schedules(usage, 'Cooling thermostat', thermal_zone.thermal_control.cooling_set_point_schedules)
|
||||
|
|
|
@ -106,7 +106,7 @@ class TestConstructionFactory(TestCase):
|
|||
self.assertIsNotNone(thermal_boundary.thickness, 'thermal_boundary thickness is none')
|
||||
self.assertIsNotNone(thermal_boundary.type, 'thermal_boundary type is none')
|
||||
self.assertIsNotNone(thermal_boundary.outside_solar_absorptance, 'outside_solar_absorptance is none')
|
||||
self.assertIsNotNone(thermal_boundary.shortwave_reflectance, 'shortwave_reflectance is none')
|
||||
self.assertIsNotNone(thermal_boundary.outside_shortwave_reflectance, 'shortwave_reflectance is none')
|
||||
self.assertIsNotNone(thermal_boundary.thermal_openings, 'thermal_openings is none')
|
||||
self.assertIsNotNone(thermal_boundary.construction_name, 'construction_name is none')
|
||||
self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none')
|
||||
|
|
Loading…
Reference in New Issue
Block a user