Compare commits

...

29 Commits

Author SHA1 Message Date
df2d7a3054 Geojson class modified for the geojson format Guille suggested 2024-10-17 07:40:13 -04:00
47810737fa geojson, construction and usage importers are all modified for mixed use buildings 2024-10-17 07:40:13 -04:00
99535a979c Update hub/version.py 2024-10-17 00:19:27 -04:00
9986552ec1 Merge remote-tracking branch 'origin/main' 2024-10-17 06:17:48 +02:00
d1719b50ed Merge branch 'infilt_availability_oriol' 2024-10-17 06:15:04 +02:00
5e01f4eb7f Merge pull request 'Remove build from setup.py and add it to requirements.txt' (#69) from fix/fix-build into main
Reviewed-on: #69
2024-10-03 14:08:37 -04:00
d38150ac2d Remove build from setup.py and add it to requirements.txt 2024-10-03 13:05:56 -05:00
5e5129ecd7 Merge pull request 'Add build package to setup.py and remove texttest' (#68) from fix/update-setup.py into main
Reviewed-on: #68
2024-10-02 12:07:55 -04:00
3905f228dc correct unittests 2024-10-02 06:30:43 +02:00
33049441f0 Add build package to setup.py and remove texttest 2024-10-01 14:35:08 -05:00
70dd9f7c6a Merge pull request 'fix: change building names in ep_multiple_buildings.py to upper case' (#66) from fix/ep-result-factory-naming-bug into main
Reviewed-on: #66
2024-10-01 10:15:40 -04:00
0ce392ea06 fix: change building names in ep_multiple_buildings.py to upper case 2024-10-01 09:43:57 -04:00
ogavalda
4b6a942324 Small change. test 2024-09-30 15:58:21 -04:00
2495046c44 correct typo 2024-09-30 19:46:07 +02:00
4738de0d8c Merge branch 'infilt_availability_oriol' 2024-09-30 15:17:05 +02:00
e220bf2c0d Merge remote-tracking branch 'origin/main' 2024-09-23 18:26:33 +02:00
a45cf02b28 Update hub/version.py 2024-09-23 11:57:33 -04:00
ef62e2531f add weather file to the EnergyBuildingsExportsFactory 2024-09-23 17:56:58 +02:00
ogavalda
cd34435a9f Including air temperature output 2024-09-16 15:49:18 -04:00
ogavalda
15b96fe154 Changing the full structure to incorporate a second way of entering infiltration (infiltration per outdoor area) 2024-09-16 15:41:27 -04:00
ogavalda
54a6e6b2db Adding infiltration per m2 2024-09-15 10:22:07 -04:00
ogavalda
a7375f0b53 Adding infiltration per m2 2024-09-15 10:15:41 -04:00
ogavalda
725746fbcb Changes in infiltration profiles and the source of values for infiltration 2024-09-15 09:44:07 -04:00
ec320a2e1c Merge pull request 'fix: small bugs in the irradiance units were fixed.' (#65) from irradiance_unit_fixing into main
Reviewed-on: #65
2024-09-09 13:27:05 -04:00
8a68118503 fix: small bugs in the irradiance units were fixed. 2024-09-09 11:11:33 -04:00
a3ec3c7e19 Merge pull request 'Add version number to numpy' (#64) from fix/downgrade-numpy into main
Reviewed-on: https://nextgenerations-cities.encs.concordia.ca/gitea/CERC/hub/pulls/64

Hi Connor, I have accepted the change, but some additional review will be needed, it creates a hard dependency from a specific version of numpy with almost sure will create issues with other libraries, will be nice if you could keep an eye on the issue resolution from sqlalchemy
2024-09-02 12:35:30 -04:00
connor
ace666553a Add version number to numpy 2024-08-30 18:01:26 -04:00
c4636c2c3c Merge remote-tracking branch 'origin/main' 2024-07-25 18:11:10 +02:00
4a01ac51d8 Remove the building from the targets if needed 2024-07-25 18:10:51 +02:00
21 changed files with 3986 additions and 1026 deletions

View File

@ -22,6 +22,7 @@ class EilatCatalog(Catalog):
"""
Eilat catalog class
"""
def __init__(self, path):
_path_archetypes = Path(path / 'eilat_archetypes.json').resolve()
_path_constructions = (path / 'eilat_constructions.json').resolve()
@ -121,8 +122,10 @@ class EilatCatalog(Catalog):
construction_period = archetype['period_of_construction']
average_storey_height = archetype['average_storey_height']
extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_thermal_bridges']
infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off'] / cte.HOUR_TO_SECONDS
infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on'] / cte.HOUR_TO_SECONDS
infiltration_rate_for_ventilation_system_off = archetype[
'infiltration_rate_for_ventilation_system_off'] / cte.HOUR_TO_SECONDS
infiltration_rate_for_ventilation_system_on = archetype[
'infiltration_rate_for_ventilation_system_on'] / cte.HOUR_TO_SECONDS
archetype_constructions = []
for archetype_construction in archetype['constructions']:
@ -160,7 +163,9 @@ class EilatCatalog(Catalog):
extra_loses_due_to_thermal_bridges,
None,
infiltration_rate_for_ventilation_system_off,
infiltration_rate_for_ventilation_system_on))
infiltration_rate_for_ventilation_system_on,
0,
0))
return _catalog_archetypes
def names(self, category=None):

View File

@ -128,6 +128,12 @@ class NrcanCatalog(Catalog):
infiltration_rate_for_ventilation_system_on = (
archetype['infiltration_rate_for_ventilation_system_on'] / cte.HOUR_TO_SECONDS
)
infiltration_rate_area_for_ventilation_system_off = (
archetype['infiltration_rate_area_for_ventilation_system_off'] * 1
)
infiltration_rate_area_for_ventilation_system_on = (
archetype['infiltration_rate_area_for_ventilation_system_on'] * 1
)
archetype_constructions = []
for archetype_construction in archetype['constructions']:
@ -153,7 +159,6 @@ class NrcanCatalog(Catalog):
_window)
archetype_constructions.append(_construction)
break
_catalog_archetypes.append(Archetype(archetype_id,
name,
function,
@ -165,7 +170,10 @@ class NrcanCatalog(Catalog):
extra_loses_due_to_thermal_bridges,
None,
infiltration_rate_for_ventilation_system_off,
infiltration_rate_for_ventilation_system_on))
infiltration_rate_for_ventilation_system_on,
infiltration_rate_area_for_ventilation_system_off,
infiltration_rate_area_for_ventilation_system_on
))
return _catalog_archetypes
def names(self, category=None):

View File

@ -162,7 +162,9 @@ class NrelCatalog(Catalog):
extra_loses_due_to_thermal_bridges,
indirect_heated_ratio,
infiltration_rate_for_ventilation_system_off,
infiltration_rate_for_ventilation_system_on))
infiltration_rate_for_ventilation_system_on,
0,
0))
return _catalog_archetypes
def names(self, category=None):

View File

@ -23,7 +23,10 @@ class Archetype:
extra_loses_due_to_thermal_bridges,
indirect_heated_ratio,
infiltration_rate_for_ventilation_system_off,
infiltration_rate_for_ventilation_system_on):
infiltration_rate_for_ventilation_system_on,
infiltration_rate_area_for_ventilation_system_off,
infiltration_rate_area_for_ventilation_system_on
):
self._id = archetype_id
self._name = name
self._function = function
@ -36,6 +39,8 @@ class Archetype:
self._indirect_heated_ratio = indirect_heated_ratio
self._infiltration_rate_for_ventilation_system_off = infiltration_rate_for_ventilation_system_off
self._infiltration_rate_for_ventilation_system_on = infiltration_rate_for_ventilation_system_on
self._infiltration_rate_area_for_ventilation_system_off = infiltration_rate_area_for_ventilation_system_off
self._infiltration_rate_area_for_ventilation_system_on = infiltration_rate_area_for_ventilation_system_on
@property
def id(self):
@ -133,6 +138,22 @@ class Archetype:
"""
return self._infiltration_rate_for_ventilation_system_on
@property
def infiltration_rate_area_for_ventilation_system_off(self):
"""
Get archetype infiltration rate for ventilation system off in m3/sm2
:return: float
"""
return self._infiltration_rate_area_for_ventilation_system_off
@property
def infiltration_rate_area_for_ventilation_system_on(self):
"""
Get archetype infiltration rate for ventilation system on in m3/sm2
:return: float
"""
return self._infiltration_rate_for_ventilation_system_on
def to_dictionary(self):
"""Class content to dictionary"""
_constructions = []
@ -149,6 +170,8 @@ class Archetype:
'indirect heated ratio': self.indirect_heated_ratio,
'infiltration rate for ventilation off [1/s]': self.infiltration_rate_for_ventilation_system_off,
'infiltration rate for ventilation on [1/s]': self.infiltration_rate_for_ventilation_system_on,
'infiltration rate area for ventilation off [m3/sm2]': self.infiltration_rate_area_for_ventilation_system_off,
'infiltration rate area for ventilation on [m3/sm2]': self.infiltration_rate_area_for_ventilation_system_on,
'constructions': _constructions
}
}

View File

@ -180,7 +180,7 @@ class Surface:
@property
def global_irradiance(self) -> dict:
"""
Get global irradiance on surface in J/m2
Get global irradiance on surface in W/m2
:return: dict
"""
return self._global_irradiance
@ -188,7 +188,7 @@ class Surface:
@global_irradiance.setter
def global_irradiance(self, value):
"""
Set global irradiance on surface in J/m2
Set global irradiance on surface in W/m2
:param value: dict
"""
self._global_irradiance = value
@ -390,7 +390,7 @@ class Surface:
@property
def global_irradiance_tilted(self) -> dict:
"""
Get global irradiance on a tilted surface in J/m2
Get global irradiance on a tilted surface in W/m2
:return: dict
"""
return self._global_irradiance_tilted
@ -398,7 +398,7 @@ class Surface:
@global_irradiance_tilted.setter
def global_irradiance_tilted(self, value):
"""
Set global irradiance on a tilted surface in J/m2
Set global irradiance on a tilted surface in W/m2
:param value: dict
"""
self._global_irradiance_tilted = value

View File

@ -20,6 +20,8 @@ class ThermalArchetype:
self._indirect_heated_ratio = None
self._infiltration_rate_for_ventilation_system_off = None
self._infiltration_rate_for_ventilation_system_on = None
self._infiltration_rate_area_for_ventilation_system_off=None
self._infiltration_rate_area_for_ventilation_system_on=None
@property
def constructions(self) -> [Construction]:
@ -132,3 +134,35 @@ class ThermalArchetype:
:param value: float
"""
self._infiltration_rate_for_ventilation_system_on = value
@property
def infiltration_rate_area_for_ventilation_system_off(self):
"""
Get infiltration rate for ventilation system off in l/s/m2
:return: float
"""
return self._infiltration_rate_for_ventilation_system_off
@infiltration_rate_area_for_ventilation_system_off.setter
def infiltration_rate_area_for_ventilation_system_off(self, value):
"""
Set infiltration rate for ventilation system off in l/s/m2
:param value: float
"""
self._infiltration_rate_for_ventilation_system_off = value
@property
def infiltration_rate_area_for_ventilation_system_on(self):
"""
Get infiltration rate for ventilation system on in l/s/m2
:return: float
"""
return self._infiltration_rate_for_ventilation_system_on
@infiltration_rate_area_for_ventilation_system_on.setter
def infiltration_rate_area_for_ventilation_system_on(self, value):
"""
Set infiltration rate for ventilation system on in l/s/m2
:param value: float
"""
self._infiltration_rate_for_ventilation_system_on = value

View File

@ -44,6 +44,8 @@ class ThermalZone:
self._indirectly_heated_area_ratio = None
self._infiltration_rate_system_on = None
self._infiltration_rate_system_off = None
self._infiltration_rate_area_system_on = None
self._infiltration_rate_area_system_off = None
self._volume = volume
self._ordinate_number = None
self._view_factors_matrix = None
@ -166,6 +168,24 @@ class ThermalZone:
self._infiltration_rate_system_off = self._parent_internal_zone.thermal_archetype.infiltration_rate_for_ventilation_system_off
return self._infiltration_rate_system_off
@property
def infiltration_rate_area_system_on(self):
"""
Get thermal zone infiltration rate system on in air changes per second (1/s)
:return: None or float
"""
self._infiltration_rate_area_system_on = self._parent_internal_zone.thermal_archetype.infiltration_rate_area_for_ventilation_system_on
return self._infiltration_rate_area_system_on
@property
def infiltration_rate_area_system_off(self):
"""
Get thermal zone infiltration rate system off in air changes per second (1/s)
:return: None or float
"""
self._infiltration_rate_area_system_off = self._parent_internal_zone.thermal_archetype.infiltration_rate_area_for_ventilation_system_off
return self._infiltration_rate_area_system_off
@property
def volume(self):
"""

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,9 @@ Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concord
Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
"""
import copy
import datetime
import glob
import os
from pathlib import Path
from geomeppy import IDF
import hub.helpers.constants as cte
@ -275,8 +278,9 @@ class Idf:
_kwargs[f'Field_{counter + 2}'] = 'Until: 24:00,0.0'
self._idf.newidfobject(self._COMPACT_SCHEDULE, **_kwargs)
def _write_schedules_file(self, usage, schedule):
file_name = str((Path(self._output_path) / f'{schedule.type} schedules {usage}.csv').resolve())
def _write_schedules_file(self, schedule, usage):
file_name = str((Path(self._output_path) / f'{schedule.type} schedules {usage.replace("/","_")}.csv').resolve())
if not Path(file_name).exists():
with open(file_name, 'w', encoding='utf8') as file:
for value in schedule.values:
file.write(f'{str(value)},\n')
@ -304,7 +308,7 @@ class Idf:
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_schedules[0])
file_name = self._write_schedules_file(new_schedules[0], usage)
self._add_file_schedule(usage, new_schedules[0], file_name)
return
@ -327,6 +331,7 @@ class Idf:
for material in self._idf.idfobjects[self._MATERIAL]:
if material.Name == "DefaultMaterial":
return
self._idf.set_default_constructions()
return
for layer in thermal_boundary.layers:
@ -388,9 +393,9 @@ class Idf:
thermostat = self._add_thermostat(thermal_zone)
self._idf.newidfobject(self._IDEAL_LOAD_AIR_SYSTEM,
Zone_Name=zone_name,
System_Availability_Schedule_Name=f'HVAC AVAIL SCHEDULES {thermal_zone.usage_name}',
Heating_Availability_Schedule_Name=f'HVAC AVAIL SCHEDULES {thermal_zone.usage_name}',
Cooling_Availability_Schedule_Name=f'HVAC AVAIL SCHEDULES {thermal_zone.usage_name}',
System_Availability_Schedule_Name=f'Thermostat_availability schedules {thermal_zone.usage_name}',
Heating_Availability_Schedule_Name=f'Thermostat_availability schedules {thermal_zone.usage_name}',
Cooling_Availability_Schedule_Name=f'Thermostat_availability schedules {thermal_zone.usage_name}',
Template_Thermostat_Name=thermostat.Name)
def _add_occupancy(self, thermal_zone, zone_name):
@ -450,7 +455,7 @@ class Idf:
)
def _add_infiltration(self, thermal_zone, zone_name):
schedule = f'Infiltration schedules {thermal_zone.usage_name}'
schedule = f'INF_CONST schedules {thermal_zone.usage_name}'
_infiltration = thermal_zone.infiltration_rate_system_off * cte.HOUR_TO_SECONDS
self._idf.newidfobject(self._INFILTRATION,
Name=f'{zone_name}_infiltration',
@ -460,6 +465,17 @@ class Idf:
Air_Changes_per_Hour=_infiltration
)
def _add_infiltration_surface(self, thermal_zone, zone_name):
schedule = f'INF_CONST schedules {thermal_zone.usage_name}'
_infiltration = thermal_zone.infiltration_rate_area_system_off*1
self._idf.newidfobject(self._INFILTRATION,
Name=f'{zone_name}_infiltration',
Zone_or_ZoneList_or_Space_or_SpaceList_Name=zone_name,
Schedule_Name=schedule,
Design_Flow_Rate_Calculation_Method='Flow/ExteriorWallArea',
Flow_Rate_per_Exterior_Surface_Area=_infiltration
)
def _add_ventilation(self, thermal_zone, zone_name):
schedule = f'Ventilation schedules {thermal_zone.usage_name}'
_air_change = thermal_zone.mechanical_air_change * cte.HOUR_TO_SECONDS
@ -471,7 +487,7 @@ class Idf:
Air_Changes_per_Hour=_air_change
)
def _add_dhw(self, thermal_zone, zone_name):
def _add_dhw(self, thermal_zone, zone_name, usage):
peak_flow_rate = thermal_zone.domestic_hot_water.peak_flow * thermal_zone.total_floor_area
self._idf.newidfobject(self._DHW,
Name=f'DHW {zone_name}',
@ -479,7 +495,7 @@ class Idf:
Flow_Rate_Fraction_Schedule_Name=f'DHW_prof schedules {thermal_zone.usage_name}',
Target_Temperature_Schedule_Name=f'DHW_temp schedules {thermal_zone.usage_name}',
Hot_Water_Supply_Temperature_Schedule_Name=f'DHW_temp schedules {thermal_zone.usage_name}',
Cold_Water_Supply_Temperature_Schedule_Name=f'cold_temp schedules {zone_name}',
Cold_Water_Supply_Temperature_Schedule_Name=f'cold_temp schedules {usage}',
EndUse_Subcategory=f'DHW {zone_name}',
Zone_Name=zone_name
)
@ -513,19 +529,25 @@ class Idf:
self._rename_building(self._city.name)
self._lod = self._city.level_of_detail.geometry
for building in self._city.buildings:
is_target = building.name in self._target_buildings or building.name in self._adjacent_buildings
for internal_zone in building.internal_zones:
if internal_zone.thermal_zones_from_internal_zones is None:
self._target_buildings.remove(building.name)
self._target_buildings.remoidf_surface_typeve(building.name)
is_target = False
continue
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
for thermal_boundary in thermal_zone.thermal_boundaries:
self._add_construction(thermal_boundary)
if thermal_boundary.parent_surface.vegetation is not None:
self._add_vegetation_material(thermal_boundary.parent_surface.vegetation)
for thermal_opening in thermal_boundary.thermal_openings:
self._add_window_construction_and_material(thermal_opening)
if is_target:
start = datetime.datetime.now()
service_temperature = thermal_zone.domestic_hot_water.service_temperature
usage = thermal_zone.usage_name
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
_new_schedules = self._create_infiltration_schedules(thermal_zone)
self._add_schedules(usage, 'Infiltration', _new_schedules)
_new_schedules = self._create_ventilation_schedules(thermal_zone)
@ -537,12 +559,14 @@ class Idf:
self._add_schedules(usage, 'Lighting', thermal_zone.lighting.schedules)
self._add_schedules(usage, 'Appliance', thermal_zone.appliances.schedules)
self._add_schedules(usage, 'DHW_prof', thermal_zone.domestic_hot_water.schedules)
_new_schedules = self._create_yearly_values_schedules('cold_temp',
building.cold_water_temperature[cte.HOUR])
self._add_schedules(building.name, 'cold_temp', _new_schedules)
value = thermal_zone.domestic_hot_water.service_temperature
_new_schedules = self._create_constant_value_schedules('DHW_temp', value)
_new_schedules = self._create_yearly_values_schedules('cold_temp', building.cold_water_temperature[cte.HOUR])
self._add_schedules(usage, 'cold_temp', _new_schedules)
_new_schedules = self._create_constant_value_schedules('DHW_temp', service_temperature)
self._add_schedules(usage, 'DHW_temp', _new_schedules)
_new_schedules = self._create_constant_value_schedules('INF_CONST', 1)
self._add_schedules(usage, 'INF_CONST', _new_schedules)
_new_schedules = self._create_constant_value_schedules('Thermostat_availability', 1)
self._add_schedules(usage, 'Thermostat_availability', _new_schedules)
_occ = thermal_zone.occupancy
if _occ.occupancy_density == 0:
_total_heat = 0
@ -553,16 +577,18 @@ class Idf:
self._add_schedules(usage, 'Activity Level', _new_schedules)
self._add_zone(thermal_zone, building.name)
self._add_heating_system(thermal_zone, building.name)
self._add_infiltration(thermal_zone, building.name)
self._add_infiltration_surface(thermal_zone, building.name)
self._add_ventilation(thermal_zone, building.name)
self._add_occupancy(thermal_zone, building.name)
self._add_lighting(thermal_zone, building.name)
self._add_appliances(thermal_zone, building.name)
self._add_dhw(thermal_zone, building.name)
self._add_dhw(thermal_zone, building.name, usage)
if self._export_type == "Surfaces":
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
if is_target:
if building.thermal_zones_from_internal_zones is not None:
start = datetime.datetime.now()
self._add_surfaces(building, building.name)
print(f'add surfaces {datetime.datetime.now() - start}')
else:
self._add_pure_geometry(building, building.name)
else:
@ -600,6 +626,18 @@ class Idf:
Reporting_Frequency="Hourly",
)
self._idf.newidfobject(
"OUTPUT:VARIABLE",
Variable_Name="Zone Air Temperature",
Reporting_Frequency="Hourly",
)
self._idf.newidfobject(
"OUTPUT:VARIABLE",
Variable_Name="Zone Air Relative Humidity",
Reporting_Frequency="Hourly",
)
# post-process to erase windows associated to adiabatic walls
windows_list = []
for window in self._idf.idfobjects[self._WINDOW]:

View File

@ -20,9 +20,10 @@ class EnergyBuildingsExportsFactory:
"""
Energy Buildings exports factory class
"""
def __init__(self, handler, city, path, custom_insel_block='d18599', target_buildings=None):
def __init__(self, handler, city, path, custom_insel_block='d18599', target_buildings=None, weather_file=None):
self._city = city
self._export_type = '_' + handler.lower()
self._weather_file = weather_file
validate_import_export_type(EnergyBuildingsExportsFactory, handler)
if isinstance(path, str):
path = Path(path)
@ -53,12 +54,13 @@ class EnergyBuildingsExportsFactory:
"""
idf_data_path = (Path(__file__).parent / './building_energy/idf_files/').resolve()
url = wh().epw_file(self._city.region_code)
weather_path = (Path(__file__).parent.parent / f'data/weather/epw/{url.rsplit("/", 1)[1]}').resolve()
if not weather_path.exists():
with open(weather_path, 'wb') as epw_file:
if self._weather_file is None:
self._weather_file = (Path(__file__).parent.parent / f'data/weather/epw/{url.rsplit("/", 1)[1]}').resolve()
if not self._weather_file.exists():
with open(self._weather_file, 'wb') as epw_file:
epw_file.write(requests.get(url, allow_redirects=True).content)
return Idf(self._city, self._path, (idf_data_path / 'Minimal.idf'), (idf_data_path / 'Energy+.idd'), weather_path,
target_buildings=self._target_buildings)
return Idf(self._city, self._path, (idf_data_path / 'Minimal.idf'), (idf_data_path / 'Energy+.idd'),
self._weather_file, target_buildings=self._target_buildings)
@property
def _insel_monthly_energy_balance(self):

View File

@ -25,6 +25,7 @@ KILO_WATTS_HOUR_TO_JULES = 3600000
WATTS_HOUR_TO_JULES = 3600
GALLONS_TO_QUBIC_METERS = 0.0037854117954011185
# time
SECOND = 'second'
MINUTE = 'minute'

View File

@ -3,6 +3,7 @@ NrcanPhysicsParameters import the construction and material information defined
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Project Collaborator Saeed Ranjbar saeed.ranjbar@concordia.ca
"""
import logging
@ -32,10 +33,21 @@ class NrcanPhysicsParameters:
city = self._city
nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
for building in city.buildings:
if building.function not in Dictionaries().hub_function_to_nrcan_construction_function:
logging.error('Building %s has an unknown building function %s', building.name, building.function)
main_function = None
functions = building.function.split('_')
if len(functions) > 1:
maximum_percentage = 0
for function in functions:
percentage_and_function = function.split('-')
if float(percentage_and_function[0]) > maximum_percentage:
maximum_percentage = float(percentage_and_function[0])
main_function = percentage_and_function[-1]
else:
main_function = functions[-1]
if main_function not in Dictionaries().hub_function_to_nrcan_construction_function:
logging.error('Building %s has an unknown building function %s', building.name, main_function)
continue
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
function = Dictionaries().hub_function_to_nrcan_construction_function[main_function]
try:
archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone)
@ -67,6 +79,8 @@ class NrcanPhysicsParameters:
thermal_archetype.indirect_heated_ratio = 0
thermal_archetype.infiltration_rate_for_ventilation_system_on = catalog_archetype.infiltration_rate_for_ventilation_system_on
thermal_archetype.infiltration_rate_for_ventilation_system_off = catalog_archetype.infiltration_rate_for_ventilation_system_off
thermal_archetype.infiltration_rate_area_for_ventilation_system_on = catalog_archetype.infiltration_rate_area_for_ventilation_system_on
thermal_archetype.infiltration_rate_area_for_ventilation_system_off = catalog_archetype.infiltration_rate_area_for_ventilation_system_off
_constructions = []
for catalog_construction in catalog_archetype.constructions:
construction = Construction()

View File

@ -127,6 +127,27 @@ class Geojson:
function = None
if self._function_field is not None:
function = str(feature['properties'][self._function_field])
if function == 'Mixed use' or function == 'mixed use':
function_parts = []
if 'usages' in feature['properties']:
usages = feature['properties']['usages']
for usage in usages:
if self._function_to_hub is not None and usage['usage'] in self._function_to_hub:
function_parts.append(f"{usage['percentage']}-{self._function_to_hub[usage['usage']]}")
else:
function_parts.append(f"{usage['percentage']}-{usage['usage']}")
else:
for key, value in feature['properties'].items():
if key.startswith("mixed_type_") and not key.endswith("_percentage"):
type_key = key
percentage_key = f"{key}_percentage"
if percentage_key in feature['properties']:
if self._function_to_hub is not None and feature['properties'][type_key] in self._function_to_hub:
usage_function = self._function_to_hub[feature['properties'][type_key]]
function_parts.append(f"{feature['properties'][percentage_key]}-{usage_function}")
else:
function_parts.append(f"{feature['properties'][percentage_key]}-{feature['properties'][type_key]}")
function = "_".join(function_parts)
if self._function_to_hub is not None:
# use the transformation dictionary to retrieve the proper function
if function in self._function_to_hub:

View File

@ -24,7 +24,7 @@ class EnergyPlusMultipleBuildings:
csv_output = list(csv.DictReader(csv_file))
for building in self._city.buildings:
building_name = building.name
building_name = building.name.upper()
buildings_energy_demands[f'Building {building_name} Heating Demand (J)'] = [
float(
row[f"{building_name} IDEAL LOADS AIR SYSTEM:Zone Ideal Loads Supply Air Total Heating Energy [J](Hourly)"])
@ -36,7 +36,7 @@ class EnergyPlusMultipleBuildings:
for row in csv_output
]
buildings_energy_demands[f'Building {building_name} DHW Demand (W)'] = [
float(row[f"DHW {building.name}:Water Use Equipment Heating Rate [W](Hourly)"])
float(row[f"DHW {building_name}:Water Use Equipment Heating Rate [W](Hourly)"])
for row in csv_output
]
buildings_energy_demands[f'Building {building_name} Appliances (W)'] = [
@ -58,14 +58,15 @@ class EnergyPlusMultipleBuildings:
if energy_plus_output_file_path.is_file():
building_energy_demands = self._building_energy_demands(energy_plus_output_file_path)
for building in self._city.buildings:
building.heating_demand[cte.HOUR] = building_energy_demands[f'Building {building.name} Heating Demand (J)']
building.cooling_demand[cte.HOUR] = building_energy_demands[f'Building {building.name} Cooling Demand (J)']
building_name = building.name.upper()
building.heating_demand[cte.HOUR] = building_energy_demands[f'Building {building_name} Heating Demand (J)']
building.cooling_demand[cte.HOUR] = building_energy_demands[f'Building {building_name} Cooling Demand (J)']
building.domestic_hot_water_heat_demand[cte.HOUR] = \
[x * cte.WATTS_HOUR_TO_JULES for x in building_energy_demands[f'Building {building.name} DHW Demand (W)']]
[x * cte.WATTS_HOUR_TO_JULES for x in building_energy_demands[f'Building {building_name} DHW Demand (W)']]
building.appliances_electrical_demand[cte.HOUR] = \
[x * cte.WATTS_HOUR_TO_JULES for x in building_energy_demands[f'Building {building.name} Appliances (W)']]
[x * cte.WATTS_HOUR_TO_JULES for x in building_energy_demands[f'Building {building_name} Appliances (W)']]
building.lighting_electrical_demand[cte.HOUR] = \
[x * cte.WATTS_HOUR_TO_JULES for x in building_energy_demands[f'Building {building.name} Lighting (W)']]
[x * cte.WATTS_HOUR_TO_JULES for x in building_energy_demands[f'Building {building_name} Lighting (W)']]
building.heating_demand[cte.MONTH] = MonthlyValues.get_total_month(building.heating_demand[cte.HOUR])
building.cooling_demand[cte.MONTH] = MonthlyValues.get_total_month(building.cooling_demand[cte.HOUR])
building.domestic_hot_water_heat_demand[cte.MONTH] = (

View File

@ -34,7 +34,7 @@ class SimplifiedRadiosityAlgorithm:
for key in self._results:
_irradiance = {}
header_name = key.split(':')
result = [x * cte.WATTS_HOUR_TO_JULES for x in self._results[key]]
result = [x for x in self._results[key]]
city_object_name = header_name[1]
building = self._city.city_object(city_object_name)
surface_id = header_name[2]

View File

@ -3,6 +3,7 @@ ComnetUsageParameters extracts the usage properties from Comnet catalog and assi
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Project Collaborator Saeed Ranjbar saeed.ranjbar@concordia.ca
"""
import copy
import logging
@ -35,29 +36,60 @@ class ComnetUsageParameters:
city = self._city
comnet_catalog = UsageCatalogFactory('comnet').catalog
for building in city.buildings:
usage_name = Dictionaries().hub_usage_to_comnet_usage[building.function]
usages = []
comnet_archetype_usages = []
building_functions = building.function.split('_')
for function in building_functions:
usages.append(function.split('-'))
for usage in usages:
comnet_usage_name = Dictionaries().hub_usage_to_comnet_usage[usage[-1]]
try:
archetype_usage = self._search_archetypes(comnet_catalog, usage_name)
comnet_archetype_usage = self._search_archetypes(comnet_catalog, comnet_usage_name)
comnet_archetype_usages.append(comnet_archetype_usage)
except KeyError:
logging.error('Building %s has unknown usage archetype for usage %s', building.name, usage_name)
logging.error('Building %s has unknown usage archetype for usage %s', building.name, comnet_usage_name)
continue
for internal_zone in building.internal_zones:
for (i, internal_zone) in enumerate(building.internal_zones):
internal_zone_usages = []
if len(building.internal_zones) > 1:
volume_per_area = 0
if internal_zone.area is None:
raise TypeError('Internal zone area not defined, ACH cannot be calculated')
logging.error('Building %s has internal zone area not defined, ACH cannot be calculated for usage %s',
building.name, usages[i][-1])
continue
if internal_zone.volume is None:
raise TypeError('Internal zone volume not defined, ACH cannot be calculated')
logging.error('Building %s has internal zone volume not defined, ACH cannot be calculated for usage %s',
building.name, usages[i][-1])
continue
if internal_zone.area <= 0:
raise TypeError('Internal zone area is zero, ACH cannot be calculated')
volume_per_area = internal_zone.volume / internal_zone.area
logging.error('Building %s has internal zone area equal to 0, ACH cannot be calculated for usage %s',
building.name, usages[i][-1])
continue
volume_per_area += internal_zone.volume / internal_zone.area
usage = Usage()
usage.name = usage_name
self._assign_values(usage, archetype_usage, volume_per_area, building.cold_water_temperature)
usage.name = usages[i][-1]
self._assign_values(usage, comnet_archetype_usages[i], volume_per_area, building.cold_water_temperature)
usage.percentage = 1
self._calculate_reduced_values_from_extended_library(usage, archetype_usage)
internal_zone.usages = [usage]
self._calculate_reduced_values_from_extended_library(usage, comnet_archetype_usages[i])
internal_zone_usages.append(usage)
else:
if building.storeys_above_ground is None:
logging.error('Building %s no number of storeys assigned, ACH cannot be calculated for usage %s',
building.name, usages)
continue
volume_per_area = building.volume / building.floor_area / building.storeys_above_ground
for (j, mixed_usage) in enumerate(usages):
usage = Usage()
usage.name = mixed_usage[-1]
if len(usages) > 1:
usage.percentage = float(mixed_usage[0]) / 100
else:
usage.percentage = 1
self._assign_values(usage, comnet_archetype_usages[j], volume_per_area, building.cold_water_temperature)
self._calculate_reduced_values_from_extended_library(usage, comnet_archetype_usages[j])
internal_zone_usages.append(usage)
internal_zone.usages = internal_zone_usages
@staticmethod
def _search_archetypes(comnet_catalog, usage_name):
comnet_archetypes = comnet_catalog.entries('archetypes').usages

View File

@ -3,6 +3,7 @@ NrcanUsageParameters extracts the usage properties from NRCAN catalog and assign
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Project Collaborator Saeed Ranjbar saeed.ranjbar@concordia.ca
"""
import logging
@ -33,53 +34,72 @@ class NrcanUsageParameters:
city = self._city
nrcan_catalog = UsageCatalogFactory('nrcan').catalog
comnet_catalog = UsageCatalogFactory('comnet').catalog
for building in city.buildings:
usage_name = Dictionaries().hub_usage_to_nrcan_usage[building.function]
usages = []
nrcan_archetype_usages = []
comnet_archetype_usages = []
building_functions = building.function.split('_')
for function in building_functions:
usages.append(function.split('-'))
for usage in usages:
usage_name = Dictionaries().hub_usage_to_nrcan_usage[usage[-1]]
try:
archetype_usage = self._search_archetypes(nrcan_catalog, usage_name)
nrcan_archetype_usages.append(archetype_usage)
except KeyError:
logging.error('Building %s has unknown usage archetype for usage %s', building.name, usage_name)
continue
comnet_usage_name = Dictionaries().hub_usage_to_comnet_usage[building.function]
comnet_usage_name = Dictionaries().hub_usage_to_comnet_usage[usage[-1]]
try:
comnet_archetype_usage = self._search_archetypes(comnet_catalog, comnet_usage_name)
comnet_archetype_usages.append(comnet_archetype_usage)
except KeyError:
logging.error('Building %s has unknown usage archetype for usage %s', building.name, comnet_usage_name)
continue
for internal_zone in building.internal_zones:
for (i, internal_zone) in enumerate(building.internal_zones):
internal_zone_usages = []
if len(building.internal_zones) > 1:
volume_per_area = 0
if internal_zone.area is None:
logging.error('Building %s has internal zone area not defined, ACH cannot be calculated for usage %s',
building.name, usage_name)
building.name, usages[i][-1])
continue
if internal_zone.volume is None:
logging.error('Building %s has internal zone volume not defined, ACH cannot be calculated for usage %s',
building.name, usage_name)
building.name, usages[i][-1])
continue
if internal_zone.area <= 0:
logging.error('Building %s has internal zone area equal to 0, ACH cannot be calculated for usage %s',
building.name, usage_name)
building.name, usages[i][-1])
continue
volume_per_area += internal_zone.volume / internal_zone.area
usage = Usage()
usage.name = usages[i][-1]
self._assign_values(usage, nrcan_archetype_usages[i], volume_per_area, building.cold_water_temperature)
self._assign_comnet_extra_values(usage, comnet_archetype_usages[i], nrcan_archetype_usages[i].occupancy.occupancy_density)
usage.percentage = 1
self._calculate_reduced_values_from_extended_library(usage, nrcan_archetype_usages[i])
internal_zone_usages.append(usage)
else:
if building.storeys_above_ground is None:
logging.error('Building %s no number of storeys assigned, ACH cannot be calculated for usage %s',
building.name, usage_name)
building.name, usages)
continue
volume_per_area = building.volume / building.floor_area / building.storeys_above_ground
for (j, mixed_usage) in enumerate(usages):
usage = Usage()
usage.name = usage_name
self._assign_values(usage, archetype_usage, volume_per_area, building.cold_water_temperature)
self._assign_comnet_extra_values(usage, comnet_archetype_usage, archetype_usage.occupancy.occupancy_density)
usage.name = mixed_usage[-1]
if len(usages) > 1:
usage.percentage = float(mixed_usage[0]) / 100
else:
usage.percentage = 1
self._calculate_reduced_values_from_extended_library(usage, archetype_usage)
self._assign_values(usage, nrcan_archetype_usages[j], volume_per_area, building.cold_water_temperature)
self._assign_comnet_extra_values(usage, comnet_archetype_usages[j], nrcan_archetype_usages[j].occupancy.occupancy_density)
self._calculate_reduced_values_from_extended_library(usage, nrcan_archetype_usages[j])
internal_zone_usages.append(usage)
internal_zone.usages = [usage]
internal_zone.usages = internal_zone_usages
@staticmethod
def _search_archetypes(catalog, usage_name):

View File

View File

@ -1,4 +1,4 @@
"""
Hub version number
"""
__version__ = '0.2.0.8'
__version__ = '0.2.0.10'

View File

@ -1,5 +1,5 @@
xmltodict
numpy
numpy==1.26.4
trimesh[all]
pyproj
pandas
@ -25,3 +25,4 @@ psycopg2-binary
Pillow
pathlib
sqlalchemy_utils
build

142
texttest
View File

@ -1,142 +0,0 @@
ZoneControl:Thermostat,
Room_180_7ad8616b Thermostat, !- Name
Room_180_7ad8616b, !- Zone or ZoneList Name
Room_180_7ad8616b Thermostat Schedule, !- Control Type Schedule Name
ThermostatSetpoint:DualSetpoint, !- Control 1 Object Type
LargeOffice Building_Setpoint 26, !- Control 1 Name
, !- Control 2 Object Type
, !- Control 2 Name
, !- Control 3 Object Type
, !- Control 3 Name
, !- Control 4 Object Type
, !- Control 4 Name
0; !- Temperature Difference Between Cutout And Setpoint {deltaC}
Schedule:Compact,
Room_180_7ad8616b Thermostat Schedule, !- Name
Room_180_7ad8616b Thermostat Schedule Type Limits, !- Schedule Type Limits Name
Through: 12/31, !- Field 1
For: AllDays, !- Field 2
Until: 24:00, !- Field 3
4; !- Field 4
ScheduleTypeLimits,
Room_180_7ad8616b Thermostat Schedule Type Limits, !- Name
0, !- Lower Limit Value {BasedOnField A3}
4, !- Upper Limit Value {BasedOnField A3}
DISCRETE; !- Numeric Type
ThermostatSetpoint:DualSetpoint,
LargeOffice Building_Setpoint 26, !- Name
LargeOffice Building_Setpoint_HtgSetp Schedule, !- Heating Setpoint Temperature Schedule Name
LargeOffice Building_Setpoint_ClgSetp Schedule; !- Cooling Setpoint Temperature Schedule Name
ZoneHVAC:EquipmentConnections,
Room_180_7ad8616b, !- Zone Name
Room_180_7ad8616b Equipment List, !- Zone Conditioning Equipment List Name
Room_180_7ad8616b Inlet Node List, !- Zone Air Inlet Node or NodeList Name
, !- Zone Air Exhaust Node or NodeList Name
Node 27, !- Zone Air Node Name
Room_180_7ad8616b Return Node List; !- Zone Return Air Node or NodeList Name
NodeList,
Room_180_7ad8616b Inlet Node List, !- Name
Node 305; !- Node Name 1
NodeList,
Room_180_7ad8616b Return Node List, !- Name
Node 308; !- Node Name 1
ZoneHVAC:Baseboard:Convective:Electric,
Elec Baseboard 1, !- Name
Always On Discrete hvac_library, !- Availability Schedule Name
, !- Heating Design Capacity Method
Autosize, !- Heating Design Capacity {W}
, !- Heating Design Capacity Per Floor Area {W/m2}
, !- Fraction of Autosized Heating Design Capacity
1; !- Efficiency
AirTerminal:SingleDuct:ConstantVolume:NoReheat,
Diffuser 21, !- Name
Always On Discrete hvac_library, !- Availability Schedule Name
Node 307, !- Air Inlet Node Name
Node 305, !- Air Outlet Node Name
AutoSize; !- Maximum Air Flow Rate {m3/s}
ZoneHVAC:AirDistributionUnit,
ADU Diffuser 21, !- Name
Node 305, !- Air Distribution Unit Outlet Node Name
AirTerminal:SingleDuct:ConstantVolume:NoReheat, !- Air Terminal Object Type
Diffuser 21; !- Air Terminal Name
ZoneHVAC:EquipmentList,
Room_180_7ad8616b Equipment List, !- Name
SequentialLoad, !- Load Distribution Scheme
ZoneHVAC:Baseboard:Convective:Electric, !- Zone Equipment Object Type 1
Elec Baseboard 1, !- Zone Equipment Name 1
1, !- Zone Equipment Cooling Sequence 1
1, !- Zone Equipment Heating or No-Load Sequence 1
, !- Zone Equipment Sequential Cooling Fraction Schedule Name 1
, !- Zone Equipment Sequential Heating Fraction Schedule Name 1
ZoneHVAC:AirDistributionUnit, !- Zone Equipment Object Type 2
ADU Diffuser 21, !- Zone Equipment Name 2
2, !- Zone Equipment Cooling Sequence 2
2, !- Zone Equipment Heating or No-Load Sequence 2
, !- Zone Equipment Sequential Cooling Fraction Schedule Name 2
; !- Zone Equipment Sequential Heating Fraction Schedule Name 2
Sizing:Zone,
Room_180_7ad8616b, !- Zone or ZoneList Name
SupplyAirTemperature, !- Zone Cooling Design Supply Air Temperature Input Method
14, !- Zone Cooling Design Supply Air Temperature {C}
11.11, !- Zone Cooling Design Supply Air Temperature Difference {deltaC}
SupplyAirTemperature, !- Zone Heating Design Supply Air Temperature Input Method
40, !- Zone Heating Design Supply Air Temperature {C}
11.11, !- Zone Heating Design Supply Air Temperature Difference {deltaC}
0.0085, !- Zone Cooling Design Supply Air Humidity Ratio {kgWater/kgDryAir}
0.008, !- Zone Heating Design Supply Air Humidity Ratio {kgWater/kgDryAir}
Room_180_7ad8616b DSOA Space List, !- Design Specification Outdoor Air Object Name
, !- Zone Heating Sizing Factor
, !- Zone Cooling Sizing Factor
DesignDay, !- Cooling Design Air Flow Method
0, !- Cooling Design Air Flow Rate {m3/s}
0.000762, !- Cooling Minimum Air Flow per Zone Floor Area {m3/s-m2}
0, !- Cooling Minimum Air Flow {m3/s}
0, !- Cooling Minimum Air Flow Fraction
DesignDay, !- Heating Design Air Flow Method
0, !- Heating Design Air Flow Rate {m3/s}
0.002032, !- Heating Maximum Air Flow per Zone Floor Area {m3/s-m2}
0.1415762, !- Heating Maximum Air Flow {m3/s}
0.3, !- Heating Maximum Air Flow Fraction
, !- Design Specification Zone Air Distribution Object Name
No, !- Account for Dedicated Outdoor Air System
, !- Dedicated Outdoor Air System Control Strategy
, !- Dedicated Outdoor Air Low Setpoint Temperature for Design {C}
, !- Dedicated Outdoor Air High Setpoint Temperature for Design {C}
Sensible Load Only No Latent Load, !- Zone Load Sizing Method
HumidityRatioDifference, !- Zone Latent Cooling Design Supply Air Humidity Ratio Input Method
, !- Zone Dehumidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}
0.005, !- Zone Cooling Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}
HumidityRatioDifference, !- Zone Latent Heating Design Supply Air Humidity Ratio Input Method
, !- Zone Humidification Design Supply Air Humidity Ratio {kgWater/kgDryAir}
0.005; !- Zone Humidification Design Supply Air Humidity Ratio Difference {kgWater/kgDryAir}
DesignSpecification:OutdoorAir:SpaceList,
Room_180_7ad8616b DSOA Space List, !- Name
Room_180_7ad8616b_Space, !- Space Name 1
MidriseApartment Apartment Ventilation; !- Space Design Specification Outdoor Air Object Name 1
Zone,
Room_181_3a411b5d, !- Name
, !- Direction of Relative North {deg}
0, !- X Origin {m}
0, !- Y Origin {m}
0, !- Z Origin {m}
, !- Type
1, !- Multiplier
4, !- Ceiling Height {m}
291.62935408288, !- Volume {m3}
, !- Floor Area {m2}
, !- Zone Inside Convection Algorithm
, !- Zone Outside Convection Algorithm
Yes; !- Part of Total Floor Area