Merge branch 'fixing_errors_from_merge' into 'master'
Fixing errors from merge See merge request Guille/hub!51
This commit is contained in:
commit
94f1abbc29
|
@ -398,8 +398,8 @@ class Building(CityObject):
|
|||
return False
|
||||
for internal_zone in self.internal_zones:
|
||||
if internal_zone.usages is not None:
|
||||
for usage_zone in internal_zone.usages:
|
||||
if usage_zone.thermal_control is not None:
|
||||
for usage in internal_zone.usages:
|
||||
if usage.thermal_control is not None:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class ThermalZone:
|
|||
self._usages = None
|
||||
|
||||
@property
|
||||
def usage_zones(self):
|
||||
def usages(self):
|
||||
# example 70-office_30-residential
|
||||
if self._usage_from_parent:
|
||||
self._usages = copy.deepcopy(self._parent_internal_zone.usages)
|
||||
|
@ -234,8 +234,8 @@ class ThermalZone:
|
|||
if self._parent_internal_zone.usages is None:
|
||||
return None
|
||||
self._usage_name = ''
|
||||
for usage_zone in self._parent_internal_zone.usages:
|
||||
self._usage_name += str(round(usage_zone.percentage * 100)) + '-' + usage_zone.name + '_'
|
||||
for usage in self._parent_internal_zone.usages:
|
||||
self._usage_name += str(round(usage.percentage * 100)) + '-' + usage.name + '_'
|
||||
self._usage_name = self._usage_name[:-1]
|
||||
return self._usage_name
|
||||
|
||||
|
@ -253,12 +253,12 @@ class ThermalZone:
|
|||
Get thermal zone usage hours per day
|
||||
:return: None or float
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
if self._hours_day is None:
|
||||
self._hours_day = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
self._hours_day += usage_zone.percentage * usage_zone.hours_day
|
||||
for usage in self.usages:
|
||||
self._hours_day += usage.percentage * usage.hours_day
|
||||
return self._hours_day
|
||||
|
||||
@property
|
||||
|
@ -267,12 +267,12 @@ class ThermalZone:
|
|||
Get thermal zone usage days per year
|
||||
:return: None or float
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
if self._days_year is None:
|
||||
self._days_year = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
self._days_year += usage_zone.percentage * usage_zone.days_year
|
||||
for usage in self.usages:
|
||||
self._days_year += usage.percentage * usage.days_year
|
||||
return self._days_year
|
||||
|
||||
@property
|
||||
|
@ -281,14 +281,14 @@ class ThermalZone:
|
|||
Get thermal zone mechanical air change in air change per hour (ACH)
|
||||
:return: None or float
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
if self._mechanical_air_change is None:
|
||||
self._mechanical_air_change = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.mechanical_air_change is None:
|
||||
for usage in self.usages:
|
||||
if usage.mechanical_air_change is None:
|
||||
return None
|
||||
self._mechanical_air_change += usage_zone.percentage * usage_zone.mechanical_air_change
|
||||
self._mechanical_air_change += usage.percentage * usage.mechanical_air_change
|
||||
return self._mechanical_air_change
|
||||
|
||||
@property
|
||||
|
@ -297,7 +297,7 @@ class ThermalZone:
|
|||
Get occupancy in the thermal zone
|
||||
:return: None or Occupancy
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
|
||||
if self._occupancy is None:
|
||||
|
@ -306,20 +306,20 @@ class ThermalZone:
|
|||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.occupancy is None:
|
||||
for usage in self.usages:
|
||||
if usage.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
|
||||
_occupancy_density += usage.percentage * usage.occupancy.occupancy_density
|
||||
if usage.occupancy.sensible_convective_internal_gain is not None:
|
||||
_convective_part += usage.percentage * usage.occupancy.sensible_convective_internal_gain
|
||||
_radiative_part += usage.percentage * usage.occupancy.sensible_radiative_internal_gain
|
||||
_latent_part += usage.percentage * usage.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
|
||||
_occupancy_reference = self.usages[0].occupancy
|
||||
if _occupancy_reference.occupancy_schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_occupancy_reference.occupancy_schedules)):
|
||||
|
@ -333,8 +333,8 @@ class ThermalZone:
|
|||
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]
|
||||
for usage in self.usages:
|
||||
_new_value += usage.percentage * usage.occupancy.occupancy_schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
|
@ -347,7 +347,7 @@ class ThermalZone:
|
|||
Get lighting information
|
||||
:return: None or Lighting
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
|
||||
if self._lighting is None:
|
||||
|
@ -356,17 +356,17 @@ class ThermalZone:
|
|||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.lighting is None:
|
||||
for usage in self.usages:
|
||||
if usage.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
|
||||
_lighting_density += usage.percentage * usage.lighting.density
|
||||
if usage.lighting.convective_fraction is not None:
|
||||
_convective_part += usage.percentage * usage.lighting.density \
|
||||
* usage.lighting.convective_fraction
|
||||
_radiative_part += usage.percentage * usage.lighting.density \
|
||||
* usage.lighting.radiative_fraction
|
||||
_latent_part += usage.percentage * usage.lighting.density \
|
||||
* usage.lighting.latent_fraction
|
||||
self._lighting.density = _lighting_density
|
||||
if _lighting_density > 0:
|
||||
self._lighting.convective_fraction = _convective_part / _lighting_density
|
||||
|
@ -377,7 +377,7 @@ class ThermalZone:
|
|||
self._lighting.radiative_fraction = 0
|
||||
self._lighting.latent_fraction = 0
|
||||
|
||||
_lighting_reference = self.usage_zones[0].lighting
|
||||
_lighting_reference = self.usages[0].lighting
|
||||
if _lighting_reference.schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_lighting_reference.schedules)):
|
||||
|
@ -391,8 +391,8 @@ class ThermalZone:
|
|||
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]
|
||||
for usage in self.usages:
|
||||
_new_value += usage.percentage * usage.lighting.schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
|
@ -405,7 +405,7 @@ class ThermalZone:
|
|||
Get appliances information
|
||||
:return: None or Appliances
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
|
||||
if self._appliances is None:
|
||||
|
@ -414,17 +414,17 @@ class ThermalZone:
|
|||
_convective_part = 0
|
||||
_radiative_part = 0
|
||||
_latent_part = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
if usage_zone.appliances is None:
|
||||
for usage in self.usages:
|
||||
if usage.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
|
||||
_appliances_density += usage.percentage * usage.appliances.density
|
||||
if usage.appliances.convective_fraction is not None:
|
||||
_convective_part += usage.percentage * usage.appliances.density \
|
||||
* usage.appliances.convective_fraction
|
||||
_radiative_part += usage.percentage * usage.appliances.density \
|
||||
* usage.appliances.radiative_fraction
|
||||
_latent_part += usage.percentage * usage.appliances.density \
|
||||
* usage.appliances.latent_fraction
|
||||
self._appliances.density = _appliances_density
|
||||
if _appliances_density > 0:
|
||||
self._appliances.convective_fraction = _convective_part / _appliances_density
|
||||
|
@ -435,7 +435,7 @@ class ThermalZone:
|
|||
self._appliances.radiative_fraction = 0
|
||||
self._appliances.latent_fraction = 0
|
||||
|
||||
_appliances_reference = self.usage_zones[0].appliances
|
||||
_appliances_reference = self.usages[0].appliances
|
||||
if _appliances_reference.schedules is not None:
|
||||
_schedules = []
|
||||
for i_schedule in range(0, len(_appliances_reference.schedules)):
|
||||
|
@ -449,8 +449,8 @@ class ThermalZone:
|
|||
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]
|
||||
for usage in self.usages:
|
||||
_new_value += usage.percentage * usage.appliances.schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
|
@ -463,7 +463,7 @@ class ThermalZone:
|
|||
Calculates and returns the list of all internal gains defined
|
||||
:return: [InternalGain]
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
|
||||
if self._internal_gains is None:
|
||||
|
@ -481,17 +481,17 @@ class ThermalZone:
|
|||
_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 \
|
||||
for usage in self.usages:
|
||||
for internal_gain in usage.internal_gains:
|
||||
_average_internal_gain += internal_gain.average_internal_gain * usage.percentage
|
||||
_convective_fraction += internal_gain.average_internal_gain * usage.percentage \
|
||||
* internal_gain.convective_fraction
|
||||
_radiative_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
_radiative_fraction += internal_gain.average_internal_gain * usage.percentage \
|
||||
* internal_gain.radiative_fraction
|
||||
_latent_fraction += internal_gain.average_internal_gain * usage_zone.percentage \
|
||||
_latent_fraction += internal_gain.average_internal_gain * usage.percentage \
|
||||
* internal_gain.latent_fraction
|
||||
for usage_zone in self.usage_zones:
|
||||
for internal_gain in usage_zone.internal_gains:
|
||||
for usage in self.usages:
|
||||
for internal_gain in usage.internal_gains:
|
||||
if internal_gain.schedules is None:
|
||||
_schedules_defined = False
|
||||
break
|
||||
|
@ -500,7 +500,7 @@ class ThermalZone:
|
|||
break
|
||||
for day, _schedule in enumerate(internal_gain.schedules):
|
||||
for v, value in enumerate(_schedule.values):
|
||||
values[v, day] += value * usage_zone.percentage
|
||||
values[v, day] += value * usage.percentage
|
||||
|
||||
if _schedules_defined:
|
||||
_schedules = []
|
||||
|
@ -525,7 +525,7 @@ class ThermalZone:
|
|||
Get thermal control of this thermal zone
|
||||
:return: None or ThermalControl
|
||||
"""
|
||||
if self.usage_zones is None:
|
||||
if self.usages is None:
|
||||
return None
|
||||
|
||||
if self._thermal_control is None:
|
||||
|
@ -533,15 +533,15 @@ class ThermalZone:
|
|||
_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
|
||||
for usage in self.usages:
|
||||
_mean_heating_set_point += usage.percentage * usage.thermal_control.mean_heating_set_point
|
||||
_heating_set_back += usage.percentage * usage.thermal_control.heating_set_back
|
||||
_mean_cooling_set_point += usage.percentage * usage.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
|
||||
_thermal_control_reference = self.usages[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])
|
||||
|
@ -564,16 +564,16 @@ class ThermalZone:
|
|||
new_values = []
|
||||
for i_value in range(0, len(_schedule_type[i_schedule].values)):
|
||||
_new_value = 0
|
||||
for usage_zone in self.usage_zones:
|
||||
for usage in self.usages:
|
||||
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]
|
||||
_new_value += usage.percentage * \
|
||||
usage.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]
|
||||
_new_value += usage.percentage * \
|
||||
usage.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_value += usage.percentage * \
|
||||
usage.thermal_control.cooling_set_point_schedules[i_schedule].values[i_value]
|
||||
new_values.append(_new_value)
|
||||
schedule.values = new_values
|
||||
_schedules.append(schedule)
|
||||
|
|
|
@ -265,9 +265,9 @@ class EnergyAde:
|
|||
def _thermal_zones(self, building, city):
|
||||
thermal_zones = []
|
||||
for index, thermal_zone in enumerate(building.thermal_zones):
|
||||
usage_zones = []
|
||||
for usage_zone in thermal_zone.usages:
|
||||
usage_zones.append({'@xlink:href': f'#GML_{usage_zone.id}'})
|
||||
usages = []
|
||||
for usage in thermal_zone.usages:
|
||||
usages.append({'@xlink:href': f'#GML_{usage.id}'})
|
||||
thermal_zone_dic = {
|
||||
'energy:ThermalZone': {
|
||||
'@gml:id': f'GML_{thermal_zone.id}',
|
||||
|
@ -309,7 +309,7 @@ class EnergyAde:
|
|||
'energy:boundedBy': self._thermal_boundaries(city, thermal_zone)
|
||||
}
|
||||
}
|
||||
thermal_zone_dic['energy:ThermalZone']['energy:contains'] = usage_zones
|
||||
thermal_zone_dic['energy:ThermalZone']['energy:contains'] = usages
|
||||
thermal_zones.append(thermal_zone_dic)
|
||||
return thermal_zones
|
||||
|
||||
|
|
|
@ -461,8 +461,8 @@ class Idf:
|
|||
if surface.Type == self.idf_surfaces[boundary.surface.type]:
|
||||
surface.Construction_Name = boundary.construction_name
|
||||
break
|
||||
for usage_zone in thermal_zone.usages:
|
||||
surface.Zone_Name = usage_zone.id
|
||||
for usage in thermal_zone.usages:
|
||||
surface.Zone_Name = usage.id
|
||||
break
|
||||
break
|
||||
self._idf.intersect_match()
|
||||
|
|
|
@ -79,23 +79,23 @@ class InselMonthlyEnergyBalance(Insel):
|
|||
# ZONES AND SURFACES
|
||||
parameters.append(f'{len(internal_zone.usages)} % BP(10) Number of zones')
|
||||
|
||||
for i, usage_zone in enumerate(internal_zone.usages):
|
||||
percentage_usage = usage_zone.percentage
|
||||
for i, usage in enumerate(internal_zone.usages):
|
||||
percentage_usage = usage.percentage
|
||||
parameters.append(f'{float(internal_zone.area) * percentage_usage} % BP(11) #1 Area of zone {i + 1} (m2)')
|
||||
total_internal_gain = 0
|
||||
for ig in usage_zone.internal_gains:
|
||||
for ig in usage.internal_gains:
|
||||
total_internal_gain += float(ig.average_internal_gain) * \
|
||||
(float(ig.convective_fraction) + float(ig.radiative_fraction))
|
||||
parameters.append(f'{total_internal_gain} % BP(12) #2 Internal gains of zone {i + 1}')
|
||||
parameters.append(f'{usage_zone.thermal_control.mean_heating_set_point} % BP(13) #3 Heating setpoint temperature '
|
||||
parameters.append(f'{usage.thermal_control.mean_heating_set_point} % BP(13) #3 Heating setpoint temperature '
|
||||
f'zone {i + 1} (degree Celsius)')
|
||||
parameters.append(f'{usage_zone.thermal_control.heating_set_back} % BP(14) #4 Heating setback temperature '
|
||||
parameters.append(f'{usage.thermal_control.heating_set_back} % BP(14) #4 Heating setback temperature '
|
||||
f'zone {i + 1} (degree Celsius)')
|
||||
parameters.append(f'{usage_zone.thermal_control.mean_cooling_set_point} % BP(15) #5 Cooling setpoint temperature '
|
||||
parameters.append(f'{usage.thermal_control.mean_cooling_set_point} % BP(15) #5 Cooling setpoint temperature '
|
||||
f'zone {i + 1} (degree Celsius)')
|
||||
parameters.append(f'{usage_zone.hours_day} % BP(16) #6 Usage hours per day zone {i + 1}')
|
||||
parameters.append(f'{usage_zone.days_year} % BP(17) #7 Usage days per year zone {i + 1}')
|
||||
parameters.append(f'{usage_zone.mechanical_air_change} % BP(18) #8 Minimum air change rate zone {i + 1} (ACH)')
|
||||
parameters.append(f'{usage.hours_day} % BP(16) #6 Usage hours per day zone {i + 1}')
|
||||
parameters.append(f'{usage.days_year} % BP(17) #7 Usage days per year zone {i + 1}')
|
||||
parameters.append(f'{usage.mechanical_air_change} % BP(18) #8 Minimum air change rate zone {i + 1} (ACH)')
|
||||
|
||||
parameters.append(f'{len(thermal_zone.thermal_boundaries)} % Number of surfaces = BP(11+8z) \n'
|
||||
f'% 1. Surface type (1=wall, 2=ground 3=roof, 4=flat roof)\n'
|
||||
|
|
|
@ -29,13 +29,13 @@ class MonthlyToHourlyDemand:
|
|||
# todo: this method and the insel model have to be reviewed for more than one thermal zone
|
||||
external_temp = self._building.external_temperature[cte.HOUR]
|
||||
# todo: review index depending on how the schedules are defined, either 8760 or 24 hours
|
||||
for usage_zone in self._building.usages:
|
||||
temp_set = float(usage_zone.heating_setpoint)-3
|
||||
temp_back = float(usage_zone.heating_setback)-3
|
||||
for usage in self._building.usages:
|
||||
temp_set = float(usage.heating_setpoint)-3
|
||||
temp_back = float(usage.heating_setback)-3
|
||||
# todo: if these are data frames, then they should be called as (Occupancy should be in low case):
|
||||
# usage_zone.schedules.Occupancy
|
||||
# usage.schedules.Occupancy
|
||||
# self._conditioning_seasons.heating
|
||||
occupancy = Occupant().get_complete_year_schedule(usage_zone.schedules['Occupancy'])
|
||||
occupancy = Occupant().get_complete_year_schedule(usage.schedules['Occupancy'])
|
||||
heating_schedule = self._conditioning_seasons['heating']
|
||||
|
||||
hourly_heating = []
|
||||
|
@ -90,10 +90,10 @@ class MonthlyToHourlyDemand:
|
|||
# todo: this method and the insel model have to be reviewed for more than one thermal zone
|
||||
external_temp = self._building.external_temperature[cte.HOUR]
|
||||
# todo: review index depending on how the schedules are defined, either 8760 or 24 hours
|
||||
for usage_zone in self._building.usages:
|
||||
temp_set = float(usage_zone.cooling_setpoint)
|
||||
for usage in self._building.usages:
|
||||
temp_set = float(usage.cooling_setpoint)
|
||||
temp_back = 100
|
||||
occupancy = Occupant().get_complete_year_schedule(usage_zone.schedules['Occupancy'])
|
||||
occupancy = Occupant().get_complete_year_schedule(usage.schedules['Occupancy'])
|
||||
cooling_schedule = self._conditioning_seasons['cooling']
|
||||
|
||||
hourly_cooling = []
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
"""
|
||||
BuildingArchetype stores construction information by building archetypes
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from typing import List
|
||||
from hub.imports.construction.data_classes.thermal_boundary_archetype import ThermalBoundaryArchetype
|
||||
|
||||
|
||||
class BuildingArchetype:
|
||||
"""
|
||||
BuildingArchetype class
|
||||
"""
|
||||
def __init__(self, archetype_keys, average_storey_height, storeys_above_ground, effective_thermal_capacity,
|
||||
additional_thermal_bridge_u_value, indirectly_heated_area_ratio, infiltration_rate_system_off,
|
||||
infiltration_rate_system_on, thermal_boundary_archetypes):
|
||||
self._archetype_keys = archetype_keys
|
||||
self._average_storey_height = average_storey_height
|
||||
self._storeys_above_ground = storeys_above_ground
|
||||
self._effective_thermal_capacity = effective_thermal_capacity
|
||||
self._additional_thermal_bridge_u_value = additional_thermal_bridge_u_value
|
||||
self._indirectly_heated_area_ratio = indirectly_heated_area_ratio
|
||||
self._infiltration_rate_system_off = infiltration_rate_system_off
|
||||
self._infiltration_rate_system_on = infiltration_rate_system_on
|
||||
self._thermal_boundary_archetypes = thermal_boundary_archetypes
|
||||
|
||||
@property
|
||||
def archetype_keys(self) -> {}:
|
||||
"""
|
||||
Get keys that define the archetype
|
||||
:return: dictionary
|
||||
"""
|
||||
return self._archetype_keys
|
||||
|
||||
@property
|
||||
def average_storey_height(self):
|
||||
"""
|
||||
Get archetype's building storey height in meters
|
||||
:return: float
|
||||
"""
|
||||
return self._average_storey_height
|
||||
|
||||
@property
|
||||
def storeys_above_ground(self):
|
||||
"""
|
||||
Get archetype's building storey height in meters
|
||||
:return: float
|
||||
"""
|
||||
return self._storeys_above_ground
|
||||
|
||||
@property
|
||||
def effective_thermal_capacity(self):
|
||||
"""
|
||||
Get archetype's effective thermal capacity in J/m2K
|
||||
:return: float
|
||||
"""
|
||||
return self._effective_thermal_capacity
|
||||
|
||||
@property
|
||||
def additional_thermal_bridge_u_value(self):
|
||||
"""
|
||||
Get archetype's additional U value due to thermal bridges per area of shell in W/m2K
|
||||
:return: float
|
||||
"""
|
||||
return self._additional_thermal_bridge_u_value
|
||||
|
||||
@property
|
||||
def indirectly_heated_area_ratio(self):
|
||||
"""
|
||||
Get archetype's indirectly heated area ratio
|
||||
:return: float
|
||||
"""
|
||||
return self._indirectly_heated_area_ratio
|
||||
|
||||
@property
|
||||
def infiltration_rate_system_off(self):
|
||||
"""
|
||||
Get archetype's infiltration rate when conditioning systems OFF in air changes per hour (ACH)
|
||||
:return: float
|
||||
"""
|
||||
return self._infiltration_rate_system_off
|
||||
|
||||
@property
|
||||
def infiltration_rate_system_on(self):
|
||||
"""
|
||||
Get archetype's infiltration rate when conditioning systems ON in air changes per hour (ACH)
|
||||
:return: float
|
||||
"""
|
||||
return self._infiltration_rate_system_on
|
||||
|
||||
@property
|
||||
def thermal_boundary_archetypes(self) -> List[ThermalBoundaryArchetype]:
|
||||
"""
|
||||
Get thermal boundary archetypes associated to the building archetype
|
||||
:return: list of boundary archetypes
|
||||
"""
|
||||
return self._thermal_boundary_archetypes
|
|
@ -1,104 +0,0 @@
|
|||
"""
|
||||
LayerArchetype stores layer and materials information, complementing the BuildingArchetype class
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
|
||||
class LayerArchetype:
|
||||
"""
|
||||
LayerArchetype class
|
||||
"""
|
||||
def __init__(self, name, solar_absorptance, thermal_absorptance, visible_absorptance, thickness=None,
|
||||
conductivity=None, specific_heat=None, density=None, no_mass=False, thermal_resistance=None):
|
||||
self._thickness = thickness
|
||||
self._conductivity = conductivity
|
||||
self._specific_heat = specific_heat
|
||||
self._density = density
|
||||
self._solar_absorptance = solar_absorptance
|
||||
self._thermal_absorptance = thermal_absorptance
|
||||
self._visible_absorptance = visible_absorptance
|
||||
self._no_mass = no_mass
|
||||
self._name = name
|
||||
self._thermal_resistance = thermal_resistance
|
||||
|
||||
@property
|
||||
def thickness(self):
|
||||
"""
|
||||
Get thickness in meters
|
||||
:return: float
|
||||
"""
|
||||
return self._thickness
|
||||
|
||||
@property
|
||||
def conductivity(self):
|
||||
"""
|
||||
Get conductivity in W/mK
|
||||
:return: float
|
||||
"""
|
||||
return self._conductivity
|
||||
|
||||
@property
|
||||
def specific_heat(self):
|
||||
"""
|
||||
Get specific heat in J/kgK
|
||||
:return: float
|
||||
"""
|
||||
return self._specific_heat
|
||||
|
||||
@property
|
||||
def density(self):
|
||||
"""
|
||||
Get density in kg/m3
|
||||
:return: float
|
||||
"""
|
||||
return self._density
|
||||
|
||||
@property
|
||||
def solar_absorptance(self):
|
||||
"""
|
||||
Get solar absorptance
|
||||
:return: float
|
||||
"""
|
||||
return self._solar_absorptance
|
||||
|
||||
@property
|
||||
def thermal_absorptance(self):
|
||||
"""
|
||||
Get thermal absorptance
|
||||
:return: float
|
||||
"""
|
||||
return self._thermal_absorptance
|
||||
|
||||
@property
|
||||
def visible_absorptance(self):
|
||||
"""
|
||||
Get visible absorptance
|
||||
:return: float
|
||||
"""
|
||||
return self._visible_absorptance
|
||||
|
||||
@property
|
||||
def no_mass(self) -> bool:
|
||||
"""
|
||||
Get no mass flag
|
||||
:return: Boolean
|
||||
"""
|
||||
return self._no_mass
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""
|
||||
Get name
|
||||
:return: str
|
||||
"""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def thermal_resistance(self):
|
||||
"""
|
||||
Get thermal resistance in m2K/W
|
||||
:return: float
|
||||
"""
|
||||
return self._thermal_resistance
|
|
@ -1,137 +0,0 @@
|
|||
"""
|
||||
ThermalBoundaryArchetype stores thermal boundaries information, complementing the BuildingArchetype class
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from typing import List
|
||||
|
||||
from hub.imports.construction.data_classes.layer_archetype import LayerArchetype
|
||||
from hub.imports.construction.data_classes.thermal_opening_archetype import ThermalOpeningArchetype
|
||||
|
||||
|
||||
class ThermalBoundaryArchetype:
|
||||
"""
|
||||
ThermalBoundaryArchetype class
|
||||
"""
|
||||
def __init__(self, boundary_type, window_ratio, construction_name, layers, thermal_opening,
|
||||
outside_solar_absorptance=None, outside_thermal_absorptance=None, outside_visible_absorptance=None,
|
||||
overall_u_value=None, shortwave_reflectance=None, inside_emissivity=None, alpha_coefficient=None,
|
||||
radiative_coefficient=None):
|
||||
self._boundary_type = boundary_type
|
||||
self._outside_solar_absorptance = outside_solar_absorptance
|
||||
self._outside_thermal_absorptance = outside_thermal_absorptance
|
||||
self._outside_visible_absorptance = outside_visible_absorptance
|
||||
self._window_ratio = window_ratio
|
||||
self._construction_name = construction_name
|
||||
self._overall_u_value = overall_u_value
|
||||
self._layers = layers
|
||||
self._thermal_opening_archetype = thermal_opening
|
||||
self._shortwave_reflectance = shortwave_reflectance
|
||||
self._inside_emissivity = inside_emissivity
|
||||
self._alpha_coefficient = alpha_coefficient
|
||||
self._radiative_coefficient = radiative_coefficient
|
||||
|
||||
@property
|
||||
def boundary_type(self):
|
||||
"""
|
||||
Get type
|
||||
:return: str
|
||||
"""
|
||||
return self._boundary_type
|
||||
|
||||
@property
|
||||
def outside_solar_absorptance(self):
|
||||
"""
|
||||
Get outside solar absorptance
|
||||
:return: float
|
||||
"""
|
||||
return self._outside_solar_absorptance
|
||||
|
||||
@property
|
||||
def outside_thermal_absorptance(self):
|
||||
"""
|
||||
Get outside thermal absorptance
|
||||
:return: float
|
||||
"""
|
||||
return self._outside_thermal_absorptance
|
||||
|
||||
@property
|
||||
def outside_visible_absorptance(self):
|
||||
"""
|
||||
Get outside visible absorptance
|
||||
:return: float
|
||||
"""
|
||||
return self._outside_visible_absorptance
|
||||
|
||||
@property
|
||||
def window_ratio(self):
|
||||
"""
|
||||
Get window ratio
|
||||
:return: float
|
||||
"""
|
||||
return self._window_ratio
|
||||
|
||||
@property
|
||||
def construction_name(self):
|
||||
"""
|
||||
Get construction name
|
||||
:return: str
|
||||
"""
|
||||
return self._construction_name
|
||||
|
||||
@property
|
||||
def layers(self) -> List[LayerArchetype]:
|
||||
"""
|
||||
Get layers
|
||||
:return: [NrelLayerArchetype]
|
||||
"""
|
||||
return self._layers
|
||||
|
||||
@property
|
||||
def thermal_opening_archetype(self) -> ThermalOpeningArchetype:
|
||||
"""
|
||||
Get thermal opening archetype
|
||||
:return: ThermalOpeningArchetype
|
||||
"""
|
||||
return self._thermal_opening_archetype
|
||||
|
||||
@property
|
||||
def overall_u_value(self):
|
||||
"""
|
||||
Get overall U-value in W/m2K
|
||||
:return: float
|
||||
"""
|
||||
return self._overall_u_value
|
||||
|
||||
@property
|
||||
def shortwave_reflectance(self):
|
||||
"""
|
||||
Get shortwave reflectance
|
||||
:return: float
|
||||
"""
|
||||
return self._shortwave_reflectance
|
||||
|
||||
@property
|
||||
def inside_emissivity(self):
|
||||
"""
|
||||
Get emissivity inside
|
||||
:return: float
|
||||
"""
|
||||
return self._inside_emissivity
|
||||
|
||||
@property
|
||||
def alpha_coefficient(self):
|
||||
"""
|
||||
Get alpha coefficient
|
||||
:return: float
|
||||
"""
|
||||
return self._alpha_coefficient
|
||||
|
||||
@property
|
||||
def radiative_coefficient(self):
|
||||
"""
|
||||
Get radiative coefficient
|
||||
:return: float
|
||||
"""
|
||||
return self._radiative_coefficient
|
|
@ -1,131 +0,0 @@
|
|||
"""
|
||||
ThermalOpeningArchetype stores thermal openings information, complementing the BuildingArchetype class
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
|
||||
class ThermalOpeningArchetype:
|
||||
"""
|
||||
ThermalOpeningArchetype class
|
||||
"""
|
||||
def __init__(self, conductivity=None, frame_ratio=None, g_value=None, thickness=None,
|
||||
back_side_solar_transmittance_at_normal_incidence=None,
|
||||
front_side_solar_transmittance_at_normal_incidence=None, overall_u_value=None,
|
||||
openable_ratio=None, inside_emissivity=None, alpha_coefficient=None, radiative_coefficient=None,
|
||||
construction_name=None):
|
||||
self._conductivity = conductivity
|
||||
self._frame_ratio = frame_ratio
|
||||
self._g_value = g_value
|
||||
self._thickness = thickness
|
||||
self._back_side_solar_transmittance_at_normal_incidence = back_side_solar_transmittance_at_normal_incidence
|
||||
self._front_side_solar_transmittance_at_normal_incidence = front_side_solar_transmittance_at_normal_incidence
|
||||
self._overall_u_value = overall_u_value
|
||||
self._openable_ratio = openable_ratio
|
||||
self._inside_emissivity = inside_emissivity
|
||||
self._alpha_coefficient = alpha_coefficient
|
||||
self._radiative_coefficient = radiative_coefficient
|
||||
self._construction_name = construction_name
|
||||
|
||||
@property
|
||||
def conductivity(self):
|
||||
"""
|
||||
Get conductivity in W/mK
|
||||
:return: float
|
||||
"""
|
||||
return self._conductivity
|
||||
|
||||
@property
|
||||
def frame_ratio(self):
|
||||
"""
|
||||
Get frame ratio
|
||||
:return: float
|
||||
"""
|
||||
return self._frame_ratio
|
||||
|
||||
@property
|
||||
def g_value(self):
|
||||
"""
|
||||
Get g-value, also called shgc
|
||||
:return: float
|
||||
"""
|
||||
return self._g_value
|
||||
|
||||
@property
|
||||
def thickness(self):
|
||||
"""
|
||||
Get thickness in meters
|
||||
:return: float
|
||||
"""
|
||||
return self._thickness
|
||||
|
||||
@property
|
||||
def back_side_solar_transmittance_at_normal_incidence(self):
|
||||
"""
|
||||
Get back side solar transmittance at normal incidence
|
||||
:return: float
|
||||
"""
|
||||
return self._back_side_solar_transmittance_at_normal_incidence
|
||||
|
||||
@property
|
||||
def front_side_solar_transmittance_at_normal_incidence(self):
|
||||
"""
|
||||
Get front side solar transmittance at normal incidence
|
||||
:return: float
|
||||
"""
|
||||
return self._front_side_solar_transmittance_at_normal_incidence
|
||||
|
||||
@property
|
||||
def overall_u_value(self):
|
||||
"""
|
||||
Get overall U-value in W/m2K
|
||||
:return: float
|
||||
"""
|
||||
return self._overall_u_value
|
||||
|
||||
@property
|
||||
def openable_ratio(self):
|
||||
"""
|
||||
Get openable ratio
|
||||
:return: float
|
||||
"""
|
||||
return self._openable_ratio
|
||||
|
||||
@property
|
||||
def inside_emissivity(self):
|
||||
"""
|
||||
Get emissivity inside
|
||||
:return: float
|
||||
"""
|
||||
return self._inside_emissivity
|
||||
|
||||
@property
|
||||
def alpha_coefficient(self):
|
||||
"""
|
||||
Get alpha coefficient
|
||||
:return: float
|
||||
"""
|
||||
return self._alpha_coefficient
|
||||
|
||||
@property
|
||||
def radiative_coefficient(self):
|
||||
"""
|
||||
Get radiative coefficient
|
||||
:return: float
|
||||
"""
|
||||
return self._radiative_coefficient
|
||||
|
||||
@property
|
||||
def construction_name(self):
|
||||
"""
|
||||
Get thermal opening construction name
|
||||
"""
|
||||
return self._construction_name
|
||||
|
||||
@construction_name.setter
|
||||
def construction_name(self, value):
|
||||
"""
|
||||
Set thermal opening construction name
|
||||
"""
|
||||
self._construction_name = value
|
|
@ -1,71 +0,0 @@
|
|||
"""
|
||||
Nrel-based interface, it reads format defined within the CERC team based on NREL structure
|
||||
and enriches the city with archetypes and materials
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
from hub.imports.construction.helpers.storeys_generation import StoreysGeneration
|
||||
|
||||
|
||||
class NrelPhysicsInterface:
|
||||
"""
|
||||
NrelPhysicsInterface abstract class
|
||||
"""
|
||||
|
||||
# todo: verify windows
|
||||
@staticmethod
|
||||
def _calculate_view_factors(thermal_zone):
|
||||
"""
|
||||
Get thermal zone view factors matrix
|
||||
:return: [[float]]
|
||||
"""
|
||||
total_area = 0
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
total_area += thermal_boundary.opaque_area
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
total_area += thermal_opening.area
|
||||
|
||||
view_factors_matrix = []
|
||||
for thermal_boundary_1 in thermal_zone.thermal_boundaries:
|
||||
values = []
|
||||
for thermal_boundary_2 in thermal_zone.thermal_boundaries:
|
||||
value = 0
|
||||
if thermal_boundary_1.id != thermal_boundary_2.id:
|
||||
value = thermal_boundary_2.opaque_area / (total_area - thermal_boundary_1.opaque_area)
|
||||
values.append(value)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
value = thermal_opening.area / (total_area - thermal_boundary_1.opaque_area)
|
||||
values.append(value)
|
||||
view_factors_matrix.append(values)
|
||||
|
||||
for thermal_boundary_1 in thermal_zone.thermal_boundaries:
|
||||
values = []
|
||||
for thermal_opening_1 in thermal_boundary_1.thermal_openings:
|
||||
for thermal_boundary_2 in thermal_zone.thermal_boundaries:
|
||||
value = thermal_boundary_2.opaque_area / (total_area - thermal_opening_1.area)
|
||||
values.append(value)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening_2 in thermal_boundary.thermal_openings:
|
||||
value = 0
|
||||
if thermal_opening_1.id != thermal_opening_2.id:
|
||||
value = thermal_opening_2.area / (total_area - thermal_opening_1.area)
|
||||
values.append(value)
|
||||
view_factors_matrix.append(values)
|
||||
thermal_zone.view_factors_matrix = view_factors_matrix
|
||||
|
||||
@staticmethod
|
||||
def _create_storeys(building, archetype, divide_in_storeys):
|
||||
building.average_storey_height = archetype.average_storey_height
|
||||
building.storeys_above_ground = 1
|
||||
thermal_zones = StoreysGeneration(building, building.internal_zones[0],
|
||||
divide_in_storeys=divide_in_storeys).thermal_zones
|
||||
building.internal_zones[0].thermal_zones = thermal_zones
|
||||
|
||||
def enrich_buildings(self):
|
||||
"""
|
||||
Raise not implemented error
|
||||
"""
|
||||
raise NotImplementedError
|
|
@ -1,196 +0,0 @@
|
|||
"""
|
||||
NrelPhysicsParameters import the construction and material information defined by NREL
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
import sys
|
||||
|
||||
from hub.hub_logger import logger
|
||||
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
|
||||
from hub.city_model_structure.building_demand.layer import Layer
|
||||
from hub.city_model_structure.building_demand.material import Material
|
||||
from hub.helpers.dictionaries import Dictionaries
|
||||
from hub.imports.construction.helpers.construction_helper import ConstructionHelper
|
||||
from hub.imports.construction.helpers.storeys_generation import StoreysGeneration
|
||||
|
||||
|
||||
class NrelPhysicsParameters:
|
||||
"""
|
||||
NrelPhysicsParameters class
|
||||
"""
|
||||
def __init__(self, city, base_path, divide_in_storeys=False):
|
||||
self._city = city
|
||||
self._path = base_path
|
||||
self._divide_in_storeys = divide_in_storeys
|
||||
self._climate_zone = ConstructionHelper.city_to_nrel_climate_zone(city.name)
|
||||
|
||||
def enrich_buildings(self):
|
||||
"""
|
||||
Returns the city with the construction parameters assigned to the buildings
|
||||
"""
|
||||
city = self._city
|
||||
nrel_catalog = ConstructionCatalogFactory('nrel').catalog
|
||||
for building in city.buildings:
|
||||
try:
|
||||
function = Dictionaries().hub_function_to_nrel_construction_function[building.function]
|
||||
archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction,
|
||||
self._climate_zone)
|
||||
except KeyError:
|
||||
|
||||
logger.error(f'Building {building.name} has unknown archetype for building function: {building.function} '
|
||||
f'and building year of construction: {building.year_of_construction} '
|
||||
f'and climate zone reference norm {self._climate_zone}\n')
|
||||
sys.stderr.write(f'Building {building.name} has unknown archetype for building function: {building.function} '
|
||||
f'and building year of construction: {building.year_of_construction} '
|
||||
f'and climate zone reference norm {self._climate_zone}\n')
|
||||
|
||||
return
|
||||
|
||||
# if building has no thermal zones defined from geometry, and the building will be divided in storeys,
|
||||
# one thermal zone per storey is assigned
|
||||
if len(building.internal_zones) == 1:
|
||||
if building.internal_zones[0].thermal_zones is None:
|
||||
self._create_storeys(building, archetype, self._divide_in_storeys)
|
||||
if self._divide_in_storeys:
|
||||
for internal_zone in building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
thermal_zone.total_floor_area = thermal_zone.footprint_area
|
||||
else:
|
||||
number_of_storeys = int(float(building.eave_height) / float(building.average_storey_height))
|
||||
thermal_zone = building.internal_zones[0].thermal_zones[0]
|
||||
thermal_zone.total_floor_area = thermal_zone.footprint_area * number_of_storeys
|
||||
else:
|
||||
for internal_zone in building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
thermal_zone.total_floor_area = thermal_zone.footprint_area
|
||||
|
||||
for internal_zone in building.internal_zones:
|
||||
self._assign_values(internal_zone.thermal_zones, archetype)
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
self._calculate_view_factors(thermal_zone)
|
||||
|
||||
@staticmethod
|
||||
def _search_archetype(nrel_catalog, function, year_of_construction, climate_zone):
|
||||
nrel_archetypes = nrel_catalog.entries('archetypes')
|
||||
for building_archetype in nrel_archetypes:
|
||||
construction_period_limits = building_archetype.construction_period.split(' - ')
|
||||
if construction_period_limits[1] == 'PRESENT':
|
||||
construction_period_limits[1] = 3000
|
||||
if int(construction_period_limits[0]) <= int(year_of_construction) < int(construction_period_limits[1]):
|
||||
if (str(function) == str(building_archetype.function)) and \
|
||||
(climate_zone == str(building_archetype.climate_zone)):
|
||||
return building_archetype
|
||||
raise KeyError('archetype not found')
|
||||
|
||||
@staticmethod
|
||||
def _search_construction_in_archetype(archetype, construction_type):
|
||||
construction_archetypes = archetype.constructions
|
||||
for construction_archetype in construction_archetypes:
|
||||
if str(construction_type) == str(construction_archetype.type):
|
||||
return construction_archetype
|
||||
return None
|
||||
|
||||
def _assign_values(self, thermal_zones, archetype):
|
||||
for thermal_zone in thermal_zones:
|
||||
thermal_zone.additional_thermal_bridge_u_value = archetype.extra_loses_due_to_thermal_bridges
|
||||
thermal_zone.effective_thermal_capacity = archetype.thermal_capacity
|
||||
thermal_zone.indirectly_heated_area_ratio = archetype.indirect_heated_ratio
|
||||
thermal_zone.infiltration_rate_system_on = archetype.infiltration_rate_for_ventilation_system_on
|
||||
thermal_zone.infiltration_rate_system_off = archetype.infiltration_rate_for_ventilation_system_off
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
construction_archetype = self._search_construction_in_archetype(archetype, thermal_boundary.type)
|
||||
thermal_boundary.construction_name = construction_archetype.name
|
||||
try:
|
||||
thermal_boundary.window_ratio = construction_archetype.window_ratio
|
||||
except ValueError:
|
||||
# This is the normal operation way when the windows are defined in the geometry
|
||||
continue
|
||||
thermal_boundary.layers = []
|
||||
for layer_archetype in construction_archetype.layers:
|
||||
layer = Layer()
|
||||
layer.thickness = layer_archetype.thickness
|
||||
material = Material()
|
||||
archetype_material = layer_archetype.material
|
||||
material.name = archetype_material.name
|
||||
material.id = archetype_material.id
|
||||
material.no_mass = archetype_material.no_mass
|
||||
if archetype_material.no_mass:
|
||||
material.thermal_resistance = archetype_material.thermal_resistance
|
||||
else:
|
||||
material.density = archetype_material.density
|
||||
material.conductivity = archetype_material.conductivity
|
||||
material.specific_heat = archetype_material.specific_heat
|
||||
material.solar_absorptance = archetype_material.solar_absorptance
|
||||
material.thermal_absorptance = archetype_material.thermal_absorptance
|
||||
material.visible_absorptance = archetype_material.visible_absorptance
|
||||
layer.material = material
|
||||
thermal_boundary.layers.append(layer)
|
||||
# The agreement is that the layers are defined from outside to inside
|
||||
external_layer = construction_archetype.layers[0]
|
||||
external_surface = thermal_boundary.parent_surface
|
||||
external_surface.short_wave_reflectance = 1 - float(external_layer.material.solar_absorptance)
|
||||
external_surface.long_wave_emittance = 1 - float(external_layer.material.solar_absorptance)
|
||||
internal_layer = construction_archetype.layers[len(construction_archetype.layers) - 1]
|
||||
internal_surface = thermal_boundary.internal_surface
|
||||
internal_surface.short_wave_reflectance = 1 - float(internal_layer.material.solar_absorptance)
|
||||
internal_surface.long_wave_emittance = 1 - float(internal_layer.material.solar_absorptance)
|
||||
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
if construction_archetype.window is not None:
|
||||
window_archetype = construction_archetype.window
|
||||
thermal_opening.construction_name = window_archetype.name
|
||||
thermal_opening.frame_ratio = window_archetype.frame_ratio
|
||||
thermal_opening.g_value = window_archetype.g_value
|
||||
thermal_opening.overall_u_value = window_archetype.overall_u_value
|
||||
|
||||
# todo: verify windows
|
||||
@staticmethod
|
||||
def _calculate_view_factors(thermal_zone):
|
||||
"""
|
||||
Get thermal zone view factors matrix
|
||||
:return: [[float]]
|
||||
"""
|
||||
total_area = 0
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
total_area += thermal_boundary.opaque_area
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
total_area += thermal_opening.area
|
||||
|
||||
view_factors_matrix = []
|
||||
for thermal_boundary_1 in thermal_zone.thermal_boundaries:
|
||||
values = []
|
||||
for thermal_boundary_2 in thermal_zone.thermal_boundaries:
|
||||
value = 0
|
||||
if thermal_boundary_1.id != thermal_boundary_2.id:
|
||||
value = thermal_boundary_2.opaque_area / (total_area - thermal_boundary_1.opaque_area)
|
||||
values.append(value)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
value = thermal_opening.area / (total_area - thermal_boundary_1.opaque_area)
|
||||
values.append(value)
|
||||
view_factors_matrix.append(values)
|
||||
|
||||
for thermal_boundary_1 in thermal_zone.thermal_boundaries:
|
||||
values = []
|
||||
for thermal_opening_1 in thermal_boundary_1.thermal_openings:
|
||||
for thermal_boundary_2 in thermal_zone.thermal_boundaries:
|
||||
value = thermal_boundary_2.opaque_area / (total_area - thermal_opening_1.area)
|
||||
values.append(value)
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening_2 in thermal_boundary.thermal_openings:
|
||||
value = 0
|
||||
if thermal_opening_1.id != thermal_opening_2.id:
|
||||
value = thermal_opening_2.area / (total_area - thermal_opening_1.area)
|
||||
values.append(value)
|
||||
view_factors_matrix.append(values)
|
||||
thermal_zone.view_factors_matrix = view_factors_matrix
|
||||
|
||||
@staticmethod
|
||||
def _create_storeys(building, archetype, divide_in_storeys):
|
||||
building.average_storey_height = archetype.average_storey_height
|
||||
building.storeys_above_ground = 1
|
||||
thermal_zones = StoreysGeneration(building, building.internal_zones[0],
|
||||
divide_in_storeys=divide_in_storeys).thermal_zones
|
||||
building.internal_zones[0].thermal_zones = thermal_zones
|
|
@ -52,13 +52,13 @@ class ComnetUsageParameters:
|
|||
if internal_zone.area <= 0:
|
||||
raise Exception('Internal zone area is zero, ACH cannot be calculated')
|
||||
volume_per_area = internal_zone.volume / internal_zone.area
|
||||
usage_zone = Usage()
|
||||
usage_zone.name = usage_name
|
||||
self._assign_values(usage_zone, archetype_usage, volume_per_area)
|
||||
usage_zone.percentage = 1
|
||||
self._calculate_reduced_values_from_extended_library(usage_zone, archetype_usage)
|
||||
usage = Usage()
|
||||
usage.name = usage_name
|
||||
self._assign_values(usage, archetype_usage, volume_per_area)
|
||||
usage.percentage = 1
|
||||
self._calculate_reduced_values_from_extended_library(usage, archetype_usage)
|
||||
|
||||
internal_zone.usages = [usage_zone]
|
||||
internal_zone.usages = [usage]
|
||||
|
||||
@staticmethod
|
||||
def _search_archetypes(comnet_catalog, usage_name):
|
||||
|
@ -69,41 +69,41 @@ class ComnetUsageParameters:
|
|||
raise KeyError('archetype not found')
|
||||
|
||||
@staticmethod
|
||||
def _assign_values(usage_zone, archetype, volume_per_area):
|
||||
def _assign_values(usage, archetype, volume_per_area):
|
||||
# Due to the fact that python is not a typed language, the wrong object type is assigned to
|
||||
# usage_zone.occupancy when writing usage_zone.occupancy = archetype.occupancy.
|
||||
# usage.occupancy when writing usage.occupancy = archetype.occupancy.
|
||||
# Same happens for lighting and appliances. Therefore, this walk around has been done.
|
||||
usage_zone.mechanical_air_change = archetype.ventilation_rate / volume_per_area \
|
||||
* cte.HOUR_TO_MINUTES * cte.MINUTES_TO_SECONDS
|
||||
usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area \
|
||||
* cte.HOUR_TO_MINUTES * cte.MINUTES_TO_SECONDS
|
||||
_occupancy = Occupancy()
|
||||
_occupancy.occupancy_density = archetype.occupancy.occupancy_density
|
||||
_occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain
|
||||
_occupancy.latent_internal_gain = archetype.occupancy.latent_internal_gain
|
||||
_occupancy.sensible_convective_internal_gain = archetype.occupancy.sensible_convective_internal_gain
|
||||
_occupancy.occupancy_schedules = archetype.occupancy.schedules
|
||||
usage_zone.occupancy = _occupancy
|
||||
usage.occupancy = _occupancy
|
||||
_lighting = Lighting()
|
||||
_lighting.density = archetype.lighting.density
|
||||
_lighting.convective_fraction = archetype.lighting.convective_fraction
|
||||
_lighting.radiative_fraction = archetype.lighting.radiative_fraction
|
||||
_lighting.latent_fraction = archetype.lighting.latent_fraction
|
||||
_lighting.schedules = archetype.lighting.schedules
|
||||
usage_zone.lighting = _lighting
|
||||
usage.lighting = _lighting
|
||||
_appliances = Appliances()
|
||||
_appliances.density = archetype.appliances.density
|
||||
_appliances.convective_fraction = archetype.appliances.convective_fraction
|
||||
_appliances.radiative_fraction = archetype.appliances.radiative_fraction
|
||||
_appliances.latent_fraction = archetype.appliances.latent_fraction
|
||||
_appliances.schedules = archetype.appliances.schedules
|
||||
usage_zone.appliances = _appliances
|
||||
usage.appliances = _appliances
|
||||
_control = ThermalControl()
|
||||
_control.cooling_set_point_schedules = archetype.thermal_control.cooling_set_point_schedules
|
||||
_control.heating_set_point_schedules = archetype.thermal_control.heating_set_point_schedules
|
||||
_control.hvac_availability_schedules = archetype.thermal_control.hvac_availability_schedules
|
||||
usage_zone.thermal_control = _control
|
||||
usage.thermal_control = _control
|
||||
|
||||
@staticmethod
|
||||
def _calculate_reduced_values_from_extended_library(usage_zone, archetype):
|
||||
def _calculate_reduced_values_from_extended_library(usage, archetype):
|
||||
number_of_days_per_type = {'WD': 251, 'Sat': 52, 'Sun': 62}
|
||||
total = 0
|
||||
for schedule in archetype.thermal_control.hvac_availability_schedules:
|
||||
|
@ -117,8 +117,8 @@ class ComnetUsageParameters:
|
|||
for value in schedule.values:
|
||||
total += value * number_of_days_per_type['WD']
|
||||
|
||||
usage_zone.hours_day = total / 365
|
||||
usage_zone.days_year = 365
|
||||
usage.hours_day = total / 365
|
||||
usage.days_year = 365
|
||||
|
||||
max_heating_setpoint = cte.MIN_FLOAT
|
||||
min_heating_setpoint = cte.MAX_FLOAT
|
||||
|
@ -141,9 +141,9 @@ class ComnetUsageParameters:
|
|||
if min(schedule.values) < min_cooling_setpoint:
|
||||
min_cooling_setpoint = min(schedule.values)
|
||||
|
||||
usage_zone.thermal_control.mean_heating_set_point = max_heating_setpoint
|
||||
usage_zone.thermal_control.heating_set_back = min_heating_setpoint
|
||||
usage_zone.thermal_control.mean_cooling_set_point = min_cooling_setpoint
|
||||
usage.thermal_control.mean_heating_set_point = max_heating_setpoint
|
||||
usage.thermal_control.heating_set_back = min_heating_setpoint
|
||||
usage.thermal_control.mean_cooling_set_point = min_cooling_setpoint
|
||||
|
||||
@staticmethod
|
||||
def _calculate_internal_gains(archetype):
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
"""
|
||||
Schedules helper
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
import sys
|
||||
import hub.helpers.constants as cte
|
||||
|
||||
|
||||
class SchedulesHelper:
|
||||
"""
|
||||
Schedules helper
|
||||
"""
|
||||
_usage_to_comnet = {
|
||||
cte.RESIDENTIAL: 'C-12 Residential',
|
||||
cte.INDUSTRY: 'C-10 Warehouse',
|
||||
cte.OFFICE_AND_ADMINISTRATION: 'C-5 Office',
|
||||
cte.HOTEL: 'C-3 Hotel',
|
||||
cte.HEALTH_CARE: 'C-2 Health',
|
||||
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'C-8 Retail',
|
||||
cte.HALL: 'C-8 Retail',
|
||||
cte.RESTAURANT: 'C-7 Restaurant',
|
||||
cte.EDUCATION: 'C-9 School'
|
||||
}
|
||||
|
||||
_comnet_to_data_type = {
|
||||
'Fraction': cte.FRACTION,
|
||||
'OnOff': cte.ON_OFF,
|
||||
'Temperature': cte.ANY_NUMBER
|
||||
}
|
||||
|
||||
# usage
|
||||
_function_to_usage = {
|
||||
'full service restaurant': cte.RESTAURANT,
|
||||
'high-rise apartment': cte.RESIDENTIAL,
|
||||
'hospital': cte.HEALTH_CARE,
|
||||
'large hotel': cte.HOTEL,
|
||||
'large office': cte.OFFICE_AND_ADMINISTRATION,
|
||||
'medium office': cte.OFFICE_AND_ADMINISTRATION,
|
||||
'midrise apartment': cte.RESIDENTIAL,
|
||||
'outpatient healthcare': cte.HEALTH_CARE,
|
||||
'primary school': cte.EDUCATION,
|
||||
'quick service restaurant': cte.RESTAURANT,
|
||||
'secondary school': cte.EDUCATION,
|
||||
'small hotel': cte.HOTEL,
|
||||
'small office': cte.OFFICE_AND_ADMINISTRATION,
|
||||
'stand-alone-retail': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
|
||||
'strip mall': cte.HALL,
|
||||
'supermarket': cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD,
|
||||
'warehouse': cte.INDUSTRY,
|
||||
'residential': cte.RESIDENTIAL
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def comnet_from_usage(usage):
|
||||
"""
|
||||
Get Comnet usage from the given internal usage key
|
||||
:param usage: str
|
||||
:return: str
|
||||
"""
|
||||
try:
|
||||
return SchedulesHelper._usage_to_comnet[usage]
|
||||
except KeyError:
|
||||
sys.stderr.write('Error: keyword not found.\n')
|
||||
|
||||
@staticmethod
|
||||
def data_type_from_comnet(comnet_data_type):
|
||||
"""
|
||||
Get data_type from the Comnet data type definitions
|
||||
:param comnet_data_type: str
|
||||
:return: str
|
||||
"""
|
||||
try:
|
||||
return SchedulesHelper._comnet_to_data_type[comnet_data_type]
|
||||
except KeyError:
|
||||
raise ValueError(f"Error: comnet data type keyword not found.")
|
||||
|
||||
@staticmethod
|
||||
def usage_from_function(building_function):
|
||||
"""
|
||||
Get the internal usage for the given internal building function
|
||||
:param building_function: str
|
||||
:return: str
|
||||
"""
|
||||
return SchedulesHelper._function_to_usage[building_function]
|
|
@ -1,93 +0,0 @@
|
|||
"""
|
||||
Usage helper
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
import sys
|
||||
import hub.helpers.constants as cte
|
||||
|
||||
|
||||
class UsageHelper:
|
||||
"""
|
||||
Usage helper class
|
||||
"""
|
||||
|
||||
_usage_to_comnet = {
|
||||
cte.RESIDENTIAL: 'BA Multifamily',
|
||||
cte.SINGLE_FAMILY_HOUSE: 'BA Multifamily',
|
||||
cte.MULTI_FAMILY_HOUSE: 'BA Multifamily',
|
||||
cte.EDUCATION: 'BA School/University',
|
||||
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'BA Retail',
|
||||
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'BA Retail',
|
||||
cte.HOTEL: 'BA Hotel',
|
||||
cte.HOTEL_MEDIUM_CLASS: 'BA Hotel',
|
||||
cte.DORMITORY: 'BA Dormitory',
|
||||
cte.INDUSTRY: 'BA Manufacturing Facility',
|
||||
cte.RESTAURANT: 'BA Dining: Family',
|
||||
cte.HEALTH_CARE: 'BA Hospital',
|
||||
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'BA Multifamily',
|
||||
cte.OFFICE_AND_ADMINISTRATION: 'BA Office',
|
||||
cte.EVENT_LOCATION: 'BA Convention Center',
|
||||
cte.HALL: 'BA Convention Center',
|
||||
cte.SPORTS_LOCATION: 'BA Sports Arena',
|
||||
cte.GREEN_HOUSE: cte.GREEN_HOUSE,
|
||||
cte.NON_HEATED: cte.NON_HEATED
|
||||
}
|
||||
|
||||
_comnet_schedules_key_to_comnet_schedules = {
|
||||
'C-1 Assembly': 'C-1 Assembly',
|
||||
'C-2 Public': 'C-2 Health',
|
||||
'C-3 Hotel Motel': 'C-3 Hotel',
|
||||
'C-4 Manufacturing': 'C-4 Manufacturing',
|
||||
'C-5 Office': 'C-5 Office',
|
||||
'C-6 Parking Garage': 'C-6 Parking',
|
||||
'C-7 Restaurant': 'C-7 Restaurant',
|
||||
'C-8 Retail': 'C-8 Retail',
|
||||
'C-9 Schools': 'C-9 School',
|
||||
'C-10 Warehouse': 'C-10 Warehouse',
|
||||
'C-11 Laboratory': 'C-11 Lab',
|
||||
'C-12 Residential': 'C-12 Residential',
|
||||
'C-13 Data Center': 'C-13 Data',
|
||||
'C-14 Gymnasium': 'C-14 Gymnasium'}
|
||||
|
||||
_comnet_schedules_key_to_usage = {
|
||||
'C-1 Assembly': 'C-1 Assembly',
|
||||
'C-2 Public': 'C-2 Health',
|
||||
'C-3 Hotel Motel': 'C-3 Hotel',
|
||||
'C-4 Manufacturing': 'C-4 Manufacturing',
|
||||
'C-5 Office': 'C-5 Office',
|
||||
'C-6 Parking Garage': 'C-6 Parking',
|
||||
'C-7 Restaurant': 'C-7 Restaurant',
|
||||
'C-8 Retail': 'C-8 Retail',
|
||||
'C-9 Schools': 'C-9 School',
|
||||
'C-10 Warehouse': 'C-10 Warehouse',
|
||||
'C-11 Laboratory': 'C-11 Lab',
|
||||
'C-12 Residential': 'C-12 Residential',
|
||||
'C-13 Data Center': 'C-13 Data',
|
||||
'C-14 Gymnasium': 'C-14 Gymnasium'}
|
||||
|
||||
@staticmethod
|
||||
def comnet_from_libs_usage(usage):
|
||||
"""
|
||||
Get Comnet usage from the given internal usage key
|
||||
:param usage: str
|
||||
:return: str
|
||||
"""
|
||||
try:
|
||||
return UsageHelper._usage_to_comnet[usage]
|
||||
except KeyError:
|
||||
sys.stderr.write('Error: keyword not found to translate from libs_usage to comnet usage.\n')
|
||||
|
||||
@staticmethod
|
||||
def schedules_key(usage):
|
||||
"""
|
||||
Get Comnet schedules key from the list found in the Comnet usage file
|
||||
:param usage: str
|
||||
:return: str
|
||||
"""
|
||||
try:
|
||||
return UsageHelper._comnet_schedules_key_to_comnet_schedules[usage]
|
||||
except KeyError:
|
||||
sys.stderr.write('Error: Comnet keyword not found. An update of the Comnet files might have been '
|
||||
'done changing the keywords.\n')
|
|
@ -59,14 +59,14 @@ class NrcanUsageParameters:
|
|||
if internal_zone.area <= 0:
|
||||
raise Exception('Internal zone area is zero, ACH cannot be calculated')
|
||||
volume_per_area = internal_zone.volume / internal_zone.area
|
||||
usage_zone = Usage()
|
||||
usage_zone.name = usage_name
|
||||
self._assign_values(usage_zone, archetype_usage, volume_per_area)
|
||||
self._assign_comnet_extra_values(usage_zone, comnet_archetype_usage)
|
||||
usage_zone.percentage = 1
|
||||
self._calculate_reduced_values_from_extended_library(usage_zone, archetype_usage)
|
||||
usage = Usage()
|
||||
usage.name = usage_name
|
||||
self._assign_values(usage, archetype_usage, volume_per_area)
|
||||
self._assign_comnet_extra_values(usage, comnet_archetype_usage)
|
||||
usage.percentage = 1
|
||||
self._calculate_reduced_values_from_extended_library(usage, archetype_usage)
|
||||
|
||||
internal_zone.usages = [usage_zone]
|
||||
internal_zone.usages = [usage]
|
||||
|
||||
@staticmethod
|
||||
def _search_archetypes(catalog, usage_name):
|
||||
|
@ -77,50 +77,50 @@ class NrcanUsageParameters:
|
|||
raise KeyError('archetype not found')
|
||||
|
||||
@staticmethod
|
||||
def _assign_values(usage_zone, archetype, volume_per_area):
|
||||
def _assign_values(usage, archetype, volume_per_area):
|
||||
if archetype.mechanical_air_change > 0:
|
||||
usage_zone.mechanical_air_change = archetype.mechanical_air_change
|
||||
usage.mechanical_air_change = archetype.mechanical_air_change
|
||||
elif archetype.ventilation_rate > 0:
|
||||
usage_zone.mechanical_air_change = archetype.ventilation_rate / volume_per_area \
|
||||
* cte.HOUR_TO_MINUTES * cte.MINUTES_TO_SECONDS
|
||||
usage.mechanical_air_change = archetype.ventilation_rate / volume_per_area \
|
||||
* cte.HOUR_TO_MINUTES * cte.MINUTES_TO_SECONDS
|
||||
else:
|
||||
usage_zone.mechanical_air_change = 0
|
||||
usage.mechanical_air_change = 0
|
||||
_occupancy = Occupancy()
|
||||
_occupancy.occupancy_density = archetype.occupancy.occupancy_density
|
||||
_occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain
|
||||
_occupancy.latent_internal_gain = archetype.occupancy.latent_internal_gain
|
||||
_occupancy.sensible_convective_internal_gain = archetype.occupancy.sensible_convective_internal_gain
|
||||
_occupancy.occupancy_schedules = archetype.occupancy.schedules
|
||||
usage_zone.occupancy = _occupancy
|
||||
usage.occupancy = _occupancy
|
||||
_lighting = Lighting()
|
||||
_lighting.density = archetype.lighting.density
|
||||
_lighting.convective_fraction = archetype.lighting.convective_fraction
|
||||
_lighting.radiative_fraction = archetype.lighting.radiative_fraction
|
||||
_lighting.latent_fraction = archetype.lighting.latent_fraction
|
||||
_lighting.schedules = archetype.lighting.schedules
|
||||
usage_zone.lighting = _lighting
|
||||
usage.lighting = _lighting
|
||||
_appliances = Appliances()
|
||||
_appliances.density = archetype.appliances.density
|
||||
_appliances.convective_fraction = archetype.appliances.convective_fraction
|
||||
_appliances.radiative_fraction = archetype.appliances.radiative_fraction
|
||||
_appliances.latent_fraction = archetype.appliances.latent_fraction
|
||||
_appliances.schedules = archetype.appliances.schedules
|
||||
usage_zone.appliances = _appliances
|
||||
usage.appliances = _appliances
|
||||
_control = ThermalControl()
|
||||
_control.cooling_set_point_schedules = archetype.thermal_control.cooling_set_point_schedules
|
||||
_control.heating_set_point_schedules = archetype.thermal_control.heating_set_point_schedules
|
||||
_control.hvac_availability_schedules = archetype.thermal_control.hvac_availability_schedules
|
||||
usage_zone.thermal_control = _control
|
||||
usage.thermal_control = _control
|
||||
|
||||
@staticmethod
|
||||
def _assign_comnet_extra_values(usage_zone, archetype):
|
||||
_occupancy = usage_zone.occupancy
|
||||
def _assign_comnet_extra_values(usage, archetype):
|
||||
_occupancy = usage.occupancy
|
||||
_occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain
|
||||
_occupancy.latent_internal_gain = archetype.occupancy.latent_internal_gain
|
||||
_occupancy.sensible_convective_internal_gain = archetype.occupancy.sensible_convective_internal_gain
|
||||
|
||||
@staticmethod
|
||||
def _calculate_reduced_values_from_extended_library(usage_zone, archetype):
|
||||
def _calculate_reduced_values_from_extended_library(usage, archetype):
|
||||
number_of_days_per_type = {'WD': 251, 'Sat': 52, 'Sun': 62}
|
||||
total = 0
|
||||
for schedule in archetype.thermal_control.hvac_availability_schedules:
|
||||
|
@ -134,8 +134,8 @@ class NrcanUsageParameters:
|
|||
for value in schedule.values:
|
||||
total += value * number_of_days_per_type['WD']
|
||||
|
||||
usage_zone.hours_day = total / 365
|
||||
usage_zone.days_year = 365
|
||||
usage.hours_day = total / 365
|
||||
usage.days_year = 365
|
||||
|
||||
max_heating_setpoint = cte.MIN_FLOAT
|
||||
min_heating_setpoint = cte.MAX_FLOAT
|
||||
|
@ -158,6 +158,6 @@ class NrcanUsageParameters:
|
|||
if min(schedule.values) < min_cooling_setpoint:
|
||||
min_cooling_setpoint = min(schedule.values)
|
||||
|
||||
usage_zone.thermal_control.mean_heating_set_point = max_heating_setpoint
|
||||
usage_zone.thermal_control.heating_set_back = min_heating_setpoint
|
||||
usage_zone.thermal_control.mean_cooling_set_point = min_cooling_setpoint
|
||||
usage.thermal_control.mean_heating_set_point = max_heating_setpoint
|
||||
usage.thermal_control.heating_set_back = min_heating_setpoint
|
||||
usage.thermal_control.mean_cooling_set_point = min_cooling_setpoint
|
||||
|
|
|
@ -35,9 +35,9 @@ class TestGeometryFactory(TestCase):
|
|||
self._check_buildings(city)
|
||||
for building in city.buildings:
|
||||
for internal_zone in building.internal_zones:
|
||||
self.assertIsNot(len(internal_zone.usages), 0, 'no building usage_zones defined')
|
||||
for usage_zone in internal_zone.usages:
|
||||
self.assertIsNotNone(usage_zone.id, 'usage id is none')
|
||||
self.assertIsNot(len(internal_zone.usages), 0, 'no building usages defined')
|
||||
for usage in internal_zone.usages:
|
||||
self.assertIsNotNone(usage.id, 'usage id is none')
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
self._check_thermal_zone(thermal_zone)
|
||||
|
||||
|
|
|
@ -133,13 +133,13 @@ class TestExports(TestCase):
|
|||
if thermal_boundary.type is not cte.GROUND:
|
||||
self.assertIsNotNone(thermal_boundary.parent_surface.short_wave_reflectance)
|
||||
|
||||
for usage_zone in internal_zone.usages:
|
||||
self.assertIsNotNone(usage_zone.percentage, f'usage zone {usage_zone.name} percentage is none')
|
||||
self.assertIsNotNone(usage_zone.internal_gains, f'usage zone {usage_zone.name} internal_gains is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control, f'usage zone {usage_zone.name} thermal_control is none')
|
||||
self.assertIsNotNone(usage_zone.hours_day, f'usage zone {usage_zone.name} hours_day is none')
|
||||
self.assertIsNotNone(usage_zone.days_year, f'usage zone {usage_zone.name} days_year is none')
|
||||
self.assertIsNotNone(usage_zone.mechanical_air_change, f'usage zone {usage_zone.name} '
|
||||
for usage in internal_zone.usages:
|
||||
self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none')
|
||||
self.assertIsNotNone(usage.internal_gains, f'usage zone {usage.name} internal_gains is none')
|
||||
self.assertIsNotNone(usage.thermal_control, f'usage zone {usage.name} thermal_control is none')
|
||||
self.assertIsNotNone(usage.hours_day, f'usage zone {usage.name} hours_day is none')
|
||||
self.assertIsNotNone(usage.days_year, f'usage zone {usage.name} days_year is none')
|
||||
self.assertIsNotNone(usage.mechanical_air_change, f'usage zone {usage.name} '
|
||||
f'mechanical_air_change is none')
|
||||
# export files
|
||||
try:
|
||||
|
|
|
@ -68,15 +68,15 @@ class TestUsageFactory(TestCase):
|
|||
self.assertIsNone(building.households, 'building households is not none')
|
||||
self.assertTrue(building.is_conditioned, 'building is not conditioned')
|
||||
|
||||
def _check_usage_zone(self, usage_zone):
|
||||
self.assertIsNotNone(usage_zone.name, 'usage is none')
|
||||
self.assertIsNotNone(usage_zone.percentage, 'usage percentage is none')
|
||||
self.assertIsNotNone(usage_zone.hours_day, 'hours per day is none')
|
||||
self.assertIsNotNone(usage_zone.days_year, 'days per year is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control, 'thermal control is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control.mean_heating_set_point, 'control heating set point is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control.heating_set_back, 'control heating set back is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control.mean_cooling_set_point, 'control cooling set point is none')
|
||||
def _check_usage(self, usage):
|
||||
self.assertIsNotNone(usage.name, 'usage is none')
|
||||
self.assertIsNotNone(usage.percentage, 'usage percentage is none')
|
||||
self.assertIsNotNone(usage.hours_day, 'hours per day is none')
|
||||
self.assertIsNotNone(usage.days_year, 'days per year is none')
|
||||
self.assertIsNotNone(usage.thermal_control, 'thermal control is none')
|
||||
self.assertIsNotNone(usage.thermal_control.mean_heating_set_point, 'control heating set point is none')
|
||||
self.assertIsNotNone(usage.thermal_control.heating_set_back, 'control heating set back is none')
|
||||
self.assertIsNotNone(usage.thermal_control.mean_cooling_set_point, 'control cooling set point is none')
|
||||
|
||||
def test_import_comnet(self):
|
||||
"""
|
||||
|
@ -91,16 +91,16 @@ class TestUsageFactory(TestCase):
|
|||
self._check_buildings(city)
|
||||
for building in city.buildings:
|
||||
for internal_zone in building.internal_zones:
|
||||
self.assertIsNot(len(internal_zone.usages), 0, 'no building usage_zones defined')
|
||||
for usage_zone in internal_zone.usages:
|
||||
self._check_usage_zone(usage_zone)
|
||||
self.assertIsNotNone(usage_zone.mechanical_air_change, 'mechanical air change is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control.heating_set_point_schedules,
|
||||
self.assertIsNot(len(internal_zone.usages), 0, 'no building usage defined')
|
||||
for usage in internal_zone.usages:
|
||||
self._check_usage(usage)
|
||||
self.assertIsNotNone(usage.mechanical_air_change, 'mechanical air change is none')
|
||||
self.assertIsNotNone(usage.thermal_control.heating_set_point_schedules,
|
||||
'control heating set point schedule is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control.cooling_set_point_schedules,
|
||||
self.assertIsNotNone(usage.thermal_control.cooling_set_point_schedules,
|
||||
'control cooling set point schedule is none')
|
||||
self.assertIsNotNone(usage_zone.occupancy, 'occupancy is none')
|
||||
occupancy = usage_zone.occupancy
|
||||
self.assertIsNotNone(usage.occupancy, 'occupancy is none')
|
||||
occupancy = usage.occupancy
|
||||
self.assertIsNotNone(occupancy.occupancy_density, 'occupancy density is none')
|
||||
self.assertIsNotNone(occupancy.latent_internal_gain, 'occupancy latent internal gain is none')
|
||||
self.assertIsNotNone(occupancy.sensible_convective_internal_gain,
|
||||
|
@ -109,19 +109,19 @@ class TestUsageFactory(TestCase):
|
|||
'occupancy sensible radiant internal gain is none')
|
||||
self.assertIsNotNone(occupancy.occupancy_schedules, 'occupancy schedule is none')
|
||||
self.assertIsNone(occupancy.occupants, 'occupancy density is not none')
|
||||
self.assertIsNotNone(usage_zone.lighting, 'lighting is none')
|
||||
lighting = usage_zone.lighting
|
||||
self.assertIsNotNone(usage.lighting, 'lighting is none')
|
||||
lighting = usage.lighting
|
||||
self.assertIsNotNone(lighting.density, 'lighting density is none')
|
||||
self.assertIsNotNone(lighting.latent_fraction, 'lighting latent fraction is none')
|
||||
self.assertIsNotNone(lighting.convective_fraction, 'lighting convective fraction is none')
|
||||
self.assertIsNotNone(lighting.radiative_fraction, 'lighting radiant fraction is none')
|
||||
self.assertIsNotNone(lighting.schedules, 'lighting schedule is none')
|
||||
self.assertIsNotNone(usage_zone.appliances, 'appliances is none')
|
||||
appliances = usage_zone.appliances
|
||||
self.assertIsNotNone(usage.appliances, 'appliances is none')
|
||||
appliances = usage.appliances
|
||||
self.assertIsNotNone(appliances.density, 'appliances density is none')
|
||||
self.assertIsNotNone(appliances.latent_fraction, 'appliances latent fraction is none')
|
||||
self.assertIsNotNone(appliances.convective_fraction, 'appliances convective fraction is none')
|
||||
self.assertIsNotNone(appliances.radiative_fraction, 'appliances radiant fraction is none')
|
||||
self.assertIsNotNone(appliances.schedules, 'appliances schedule is none')
|
||||
self.assertIsNotNone(usage_zone.thermal_control.hvac_availability_schedules,
|
||||
self.assertIsNotNone(usage.thermal_control.hvac_availability_schedules,
|
||||
'control hvac availability is none')
|
||||
|
|
Loading…
Reference in New Issue
Block a user