Merge remote-tracking branch 'origin/main'

# Conflicts:
#	hub/helpers/data/montreal_function_to_hub_function.py
#	hub/imports/construction/helpers/construction_helper.py
This commit is contained in:
Guille Gutierrez 2023-08-10 11:03:09 -04:00
commit d564218531
8 changed files with 94 additions and 52 deletions

View File

@ -440,8 +440,7 @@ class Building(CityObject):
""" """
results = {} results = {}
if cte.HOUR in self.heating_demand: if cte.HOUR in self.heating_demand:
monthly_values = PeakLoads().\ monthly_values = PeakLoads().peak_loads_from_hourly(self.heating_demand[cte.HOUR])
peak_loads_from_hourly(self.heating_demand[cte.HOUR])
else: else:
monthly_values = PeakLoads(self).heating_peak_loads_from_methodology monthly_values = PeakLoads(self).heating_peak_loads_from_methodology
if monthly_values is None: if monthly_values is None:

View File

@ -33,9 +33,7 @@ class ThermalControl:
def _minimum_value(schedules): def _minimum_value(schedules):
minimum = 1000 minimum = 1000
for schedule in schedules: for schedule in schedules:
for value in schedule.values: minimum = min(minimum, min(schedule.values))
if value < minimum:
minimum = value
return minimum return minimum
@property @property

View File

@ -166,6 +166,7 @@ PARKING_GARAGE = 'parking garage'
RELIGIOUS = 'religious' RELIGIOUS = 'religious'
NON_HEATED = 'non-heated' NON_HEATED = 'non-heated'
DATACENTER = 'datacenter' DATACENTER = 'datacenter'
FARM = 'farm'
LIGHTING = 'Lights' LIGHTING = 'Lights'
OCCUPANCY = 'Occupancy' OCCUPANCY = 'Occupancy'

View File

@ -584,6 +584,46 @@ class MontrealFunctionToHubFunction:
'3392': cte.INDUSTRY, '3392': cte.INDUSTRY,
'5114': cte.STRIP_MALL, '5114': cte.STRIP_MALL,
'5131': cte.STRIP_MALL, '5131': cte.STRIP_MALL,
'3641': cte.INDUSTRY,
'2614': cte.INDUSTRY,
'3661': cte.INDUSTRY,
'2081': cte.INDUSTRY,
'3340': cte.INDUSTRY,
'4928': cte.WORKSHOP,
'3712': cte.INDUSTRY,
'3253': cte.INDUSTRY,
'3860': cte.INDUSTRY,
'3892': cte.INDUSTRY,
'2992': cte.INDUSTRY,
'5598': cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD,
'4825': cte.NON_HEATED,
'2071': cte.INDUSTRY,
'6495': cte.INDUSTRY,
'2914': cte.INDUSTRY,
'3182': cte.INDUSTRY,
'3791': cte.INDUSTRY,
'3992': cte.INDUSTRY,
'3114': cte.INDUSTRY,
'7920': cte.OFFICE_AND_ADMINISTRATION,
'5891': cte.RESTAURANT,
'5835': cte.SMALL_HOTEL,
'6565': cte.HEALTH_CARE,
'3391': cte.INDUSTRY,
'6615': cte.INDUSTRY,
'3883': cte.INDUSTRY,
'2032': cte.INDUSTRY,
'2994': cte.INDUSTRY,
'4871': cte.INDUSTRY,
'5113': cte.WORKSHOP,
'3571': cte.INDUSTRY,
'2342': cte.INDUSTRY,
'3911': cte.INDUSTRY,
'7444': cte.EDUCATION,
'2221': cte.INDUSTRY,
'8192': cte.FARM,
'2439': cte.INDUSTRY,
'3891': cte.INDUSTRY,
'6354': cte.WORKSHOP,
'4815': cte.NON_HEATED, '4815': cte.NON_HEATED,
'6651': cte.WORKSHOP, '6651': cte.WORKSHOP,
'2822': cte.INDUSTRY, '2822': cte.INDUSTRY,

View File

@ -63,11 +63,10 @@ class LoadsCalculation:
:return: int :return: int
""" """
heating_load_transmitted = 0 heating_load_transmitted = 0
for internal_zone in self._building.internal_zones: for thermal_zone in self._building.thermal_zones_from_internal_zones:
for thermal_zone in internal_zone.thermal_zones_from_internal_zones: internal_temperature = thermal_zone.thermal_control.mean_heating_set_point
internal_temperature = thermal_zone.thermal_control.mean_heating_set_point heating_load_transmitted += self._get_load_transmitted(thermal_zone, internal_temperature, ambient_temperature,
heating_load_transmitted += self._get_load_transmitted(thermal_zone, internal_temperature, ambient_temperature, ground_temperature)
ground_temperature)
return heating_load_transmitted return heating_load_transmitted
def get_cooling_transmitted_load(self, ambient_temperature, ground_temperature): def get_cooling_transmitted_load(self, ambient_temperature, ground_temperature):
@ -76,11 +75,10 @@ class LoadsCalculation:
:return: int :return: int
""" """
cooling_load_transmitted = 0 cooling_load_transmitted = 0
for internal_zone in self._building.internal_zones: for thermal_zone in self._building.thermal_zones_from_internal_zones:
for thermal_zone in internal_zone.thermal_zones_from_internal_zones: internal_temperature = thermal_zone.thermal_control.mean_cooling_set_point
internal_temperature = thermal_zone.thermal_control.mean_cooling_set_point cooling_load_transmitted += self._get_load_transmitted(thermal_zone, internal_temperature, ambient_temperature,
cooling_load_transmitted += self._get_load_transmitted(thermal_zone, internal_temperature, ambient_temperature, ground_temperature)
ground_temperature)
return cooling_load_transmitted return cooling_load_transmitted
def get_heating_ventilation_load_sensible(self, ambient_temperature): def get_heating_ventilation_load_sensible(self, ambient_temperature):
@ -89,10 +87,9 @@ class LoadsCalculation:
:return: int :return: int
""" """
heating_ventilation_load = 0 heating_ventilation_load = 0
for internal_zone in self._building.internal_zones: for thermal_zone in self._building.thermal_zones_from_internal_zones:
for thermal_zone in internal_zone.thermal_zones_from_internal_zones: internal_temperature = thermal_zone.thermal_control.mean_heating_set_point
internal_temperature = thermal_zone.thermal_control.mean_heating_set_point heating_ventilation_load += self._get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature)
heating_ventilation_load += self._get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature)
return heating_ventilation_load return heating_ventilation_load
def get_cooling_ventilation_load_sensible(self, ambient_temperature): def get_cooling_ventilation_load_sensible(self, ambient_temperature):
@ -101,10 +98,9 @@ class LoadsCalculation:
:return: int :return: int
""" """
cooling_ventilation_load = 0 cooling_ventilation_load = 0
for internal_zone in self._building.internal_zones: for thermal_zone in self._building.thermal_zones_from_internal_zones:
for thermal_zone in internal_zone.thermal_zones_from_internal_zones: internal_temperature = thermal_zone.thermal_control.mean_cooling_set_point
internal_temperature = thermal_zone.thermal_control.mean_cooling_set_point cooling_ventilation_load += self._get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature)
cooling_ventilation_load += self._get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature)
return cooling_ventilation_load return cooling_ventilation_load
def get_internal_load_sensible(self): def get_internal_load_sensible(self):
@ -115,19 +111,18 @@ class LoadsCalculation:
cooling_load_occupancy_sensible = 0 cooling_load_occupancy_sensible = 0
cooling_load_lighting = 0 cooling_load_lighting = 0
cooling_load_equipment_sensible = 0 cooling_load_equipment_sensible = 0
for internal_zone in self._building.internal_zones: for thermal_zone in self._building.thermal_zones_from_internal_zones:
for thermal_zone in internal_zone.thermal_zones_from_internal_zones: cooling_load_occupancy_sensible += (thermal_zone.occupancy.sensible_convective_internal_gain
cooling_load_occupancy_sensible += (thermal_zone.occupancy.sensible_convective_internal_gain + thermal_zone.occupancy.sensible_radiative_internal_gain) \
+ thermal_zone.occupancy.sensible_radiative_internal_gain) \ * thermal_zone.footprint_area
* thermal_zone.footprint_area cooling_load_lighting += (
cooling_load_lighting += ( thermal_zone.lighting.density * thermal_zone.lighting.convective_fraction + thermal_zone.lighting.density *
thermal_zone.lighting.density * thermal_zone.lighting.convective_fraction + thermal_zone.lighting.density * thermal_zone.lighting.radiative_fraction
thermal_zone.lighting.radiative_fraction ) * thermal_zone.footprint_area
) * thermal_zone.footprint_area cooling_load_equipment_sensible += (
cooling_load_equipment_sensible += ( thermal_zone.appliances.density * thermal_zone.appliances.convective_fraction +
thermal_zone.appliances.density * thermal_zone.appliances.convective_fraction + thermal_zone.appliances.density * thermal_zone.appliances.radiative_fraction
thermal_zone.appliances.density * thermal_zone.appliances.radiative_fraction ) * thermal_zone.footprint_area
) * thermal_zone.footprint_area
internal_load = cooling_load_occupancy_sensible + cooling_load_lighting + cooling_load_equipment_sensible internal_load = cooling_load_occupancy_sensible + cooling_load_lighting + cooling_load_equipment_sensible
return internal_load return internal_load
@ -137,12 +132,11 @@ class LoadsCalculation:
:return: int :return: int
""" """
cooling_load_radiation = 0 cooling_load_radiation = 0
for internal_zone in self._building.internal_zones: for thermal_zone in self._building.thermal_zones_from_internal_zones:
for thermal_zone in internal_zone.thermal_zones_from_internal_zones: for thermal_boundary in thermal_zone.thermal_boundaries:
for thermal_boundary in thermal_zone.thermal_boundaries: for thermal_opening in thermal_boundary.thermal_openings:
for thermal_opening in thermal_boundary.thermal_openings: radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][hour] * cte.WATTS_HOUR_TO_JULES
radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][hour] * cte.WATTS_HOUR_TO_JULES cooling_load_radiation += (
cooling_load_radiation += ( thermal_opening.area * (1 - thermal_opening.frame_ratio) * thermal_opening.g_value * radiation
thermal_opening.area * (1 - thermal_opening.frame_ratio) * thermal_opening.g_value * radiation )
)
return cooling_load_radiation return cooling_load_radiation

View File

@ -54,13 +54,11 @@ class PeakLoads:
""" """
month = 1 month = 1
peaks = [0 for _ in range(12)] peaks = [0 for _ in range(12)]
print('hv', hourly_values)
for i in range(0, len(hourly_values)): for i in range(0, len(hourly_values)):
if _MONTH_STARTING_HOUR[month] <= i: if _MONTH_STARTING_HOUR[month] <= i:
month += 1 month += 1
if hourly_values[i] > peaks[month-1]: if hourly_values[i] > peaks[month-1]:
peaks[month-1] = hourly_values[i] peaks[month-1] = hourly_values[i]
print('peak', peaks)
return peaks return peaks
@property @property
@ -75,18 +73,15 @@ class PeakLoads:
ambient_temperature = self._building.external_temperature[cte.HOUR] ambient_temperature = self._building.external_temperature[cte.HOUR]
for month in range(0, 12): for month in range(0, 12):
ground_temperature = self._building.ground_temperature[cte.MONTH]['2'][month] ground_temperature = self._building.ground_temperature[cte.MONTH]['2'][month]
heating_ambient_temperature = 100
start_hour = _MONTH_STARTING_HOUR[month] start_hour = _MONTH_STARTING_HOUR[month]
end_hour = 8760 end_hour = 8760
if month < 11: if month < 11:
end_hour = _MONTH_STARTING_HOUR[month + 1] end_hour = _MONTH_STARTING_HOUR[month + 1]
for hour in range(start_hour, end_hour): heating_ambient_temperature = min(ambient_temperature[start_hour:end_hour])
temperature = ambient_temperature[hour]
if temperature < heating_ambient_temperature:
heating_ambient_temperature = temperature
loads = LoadsCalculation(self._building) loads = LoadsCalculation(self._building)
heating_load_transmitted = loads.get_heating_transmitted_load(heating_ambient_temperature, ground_temperature) heating_load_transmitted = loads.get_heating_transmitted_load(heating_ambient_temperature, ground_temperature)
heating_load_ventilation_sensible = loads.get_heating_ventilation_load_sensible(heating_ambient_temperature) heating_load_ventilation_sensible = loads.get_heating_ventilation_load_sensible(heating_ambient_temperature)
# todo: include heating ventilation latent
heating_load_ventilation_latent = 0 heating_load_ventilation_latent = 0
heating_load = heating_load_transmitted + heating_load_ventilation_sensible + heating_load_ventilation_latent heating_load = heating_load_transmitted + heating_load_ventilation_sensible + heating_load_ventilation_latent
heating_load = max(heating_load, 0) heating_load = max(heating_load, 0)

View File

@ -42,6 +42,21 @@ class ConstructionHelper:
'Varennes': '6', 'Varennes': '6',
'Laval': '6', 'Laval': '6',
'Longueuil': '6', 'Longueuil': '6',
'Mont-Royal': '6',
'Deux-Montagnes': '6',
'Dorval': '6',
'Dollard-Des Ormeaux': '6',
'Notre-Dame-de-Grace': '6',
'Westmount': '6',
'Cote-Saint-Luc': '6',
'Kirkland': '6',
'Beaconsfield': '6',
'Sainte-Catherine': '6',
'Vaudreuil-Dorion': '6',
'Saint-Laurent': '6',
'Pointe-Claire': '6',
'Boucherville': '6',
'Mascouche': '6',
'Saint-Leonard': '6', 'Saint-Leonard': '6',
'La Prairie': '6' 'La Prairie': '6'
} }

View File

@ -1,4 +1,4 @@
""" """
Hub version number Hub version number
""" """
__version__ = '0.1.8.3' __version__ = '0.1.8.5'