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
18 changed files with 3849 additions and 974 deletions

View File

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

View File

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

View File

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

View File

@ -23,7 +23,10 @@ class Archetype:
extra_loses_due_to_thermal_bridges, extra_loses_due_to_thermal_bridges,
indirect_heated_ratio, indirect_heated_ratio,
infiltration_rate_for_ventilation_system_off, 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._id = archetype_id
self._name = name self._name = name
self._function = function self._function = function
@ -36,6 +39,8 @@ class Archetype:
self._indirect_heated_ratio = indirect_heated_ratio 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_off = infiltration_rate_for_ventilation_system_off
self._infiltration_rate_for_ventilation_system_on = infiltration_rate_for_ventilation_system_on 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 @property
def id(self): def id(self):
@ -133,6 +138,22 @@ class Archetype:
""" """
return self._infiltration_rate_for_ventilation_system_on 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): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
_constructions = [] _constructions = []
@ -149,6 +170,8 @@ class Archetype:
'indirect heated ratio': self.indirect_heated_ratio, '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 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 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 'constructions': _constructions
} }
} }

View File

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

View File

@ -20,6 +20,8 @@ class ThermalArchetype:
self._indirect_heated_ratio = None self._indirect_heated_ratio = None
self._infiltration_rate_for_ventilation_system_off = None self._infiltration_rate_for_ventilation_system_off = None
self._infiltration_rate_for_ventilation_system_on = 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 @property
def constructions(self) -> [Construction]: def constructions(self) -> [Construction]:
@ -132,3 +134,35 @@ class ThermalArchetype:
:param value: float :param value: float
""" """
self._infiltration_rate_for_ventilation_system_on = value 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._indirectly_heated_area_ratio = None
self._infiltration_rate_system_on = None self._infiltration_rate_system_on = None
self._infiltration_rate_system_off = 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._volume = volume
self._ordinate_number = None self._ordinate_number = None
self._view_factors_matrix = 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 self._infiltration_rate_system_off = self._parent_internal_zone.thermal_archetype.infiltration_rate_for_ventilation_system_off
return self._infiltration_rate_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 @property
def volume(self): 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 Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
""" """
import copy import copy
import datetime
import glob
import os
from pathlib import Path from pathlib import Path
from geomeppy import IDF from geomeppy import IDF
import hub.helpers.constants as cte import hub.helpers.constants as cte
@ -275,11 +278,12 @@ class Idf:
_kwargs[f'Field_{counter + 2}'] = 'Until: 24:00,0.0' _kwargs[f'Field_{counter + 2}'] = 'Until: 24:00,0.0'
self._idf.newidfobject(self._COMPACT_SCHEDULE, **_kwargs) self._idf.newidfobject(self._COMPACT_SCHEDULE, **_kwargs)
def _write_schedules_file(self, usage, schedule): def _write_schedules_file(self, schedule, usage):
file_name = str((Path(self._output_path) / f'{schedule.type} schedules {usage}.csv').resolve()) file_name = str((Path(self._output_path) / f'{schedule.type} schedules {usage.replace("/","_")}.csv').resolve())
with open(file_name, 'w', encoding='utf8') as file: if not Path(file_name).exists():
for value in schedule.values: with open(file_name, 'w', encoding='utf8') as file:
file.write(f'{str(value)},\n') for value in schedule.values:
file.write(f'{str(value)},\n')
return Path(file_name).name return Path(file_name).name
def _add_file_schedule(self, usage, schedule, file_name): def _add_file_schedule(self, usage, schedule, file_name):
@ -304,7 +308,7 @@ class Idf:
for schedule in self._idf.idfobjects[self._FILE_SCHEDULE]: for schedule in self._idf.idfobjects[self._FILE_SCHEDULE]:
if schedule.Name == f'{schedule_type} schedules {usage}': if schedule.Name == f'{schedule_type} schedules {usage}':
return 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) self._add_file_schedule(usage, new_schedules[0], file_name)
return return
@ -327,6 +331,7 @@ class Idf:
for material in self._idf.idfobjects[self._MATERIAL]: for material in self._idf.idfobjects[self._MATERIAL]:
if material.Name == "DefaultMaterial": if material.Name == "DefaultMaterial":
return return
self._idf.set_default_constructions() self._idf.set_default_constructions()
return return
for layer in thermal_boundary.layers: for layer in thermal_boundary.layers:
@ -388,9 +393,9 @@ class Idf:
thermostat = self._add_thermostat(thermal_zone) thermostat = self._add_thermostat(thermal_zone)
self._idf.newidfobject(self._IDEAL_LOAD_AIR_SYSTEM, self._idf.newidfobject(self._IDEAL_LOAD_AIR_SYSTEM,
Zone_Name=zone_name, Zone_Name=zone_name,
System_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'HVAC AVAIL SCHEDULES {thermal_zone.usage_name}', Heating_Availability_Schedule_Name=f'Thermostat_availability schedules {thermal_zone.usage_name}',
Cooling_Availability_Schedule_Name=f'HVAC AVAIL SCHEDULES {thermal_zone.usage_name}', Cooling_Availability_Schedule_Name=f'Thermostat_availability schedules {thermal_zone.usage_name}',
Template_Thermostat_Name=thermostat.Name) Template_Thermostat_Name=thermostat.Name)
def _add_occupancy(self, thermal_zone, zone_name): def _add_occupancy(self, thermal_zone, zone_name):
@ -450,7 +455,7 @@ class Idf:
) )
def _add_infiltration(self, thermal_zone, zone_name): 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 _infiltration = thermal_zone.infiltration_rate_system_off * cte.HOUR_TO_SECONDS
self._idf.newidfobject(self._INFILTRATION, self._idf.newidfobject(self._INFILTRATION,
Name=f'{zone_name}_infiltration', Name=f'{zone_name}_infiltration',
@ -460,6 +465,17 @@ class Idf:
Air_Changes_per_Hour=_infiltration 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): def _add_ventilation(self, thermal_zone, zone_name):
schedule = f'Ventilation schedules {thermal_zone.usage_name}' schedule = f'Ventilation schedules {thermal_zone.usage_name}'
_air_change = thermal_zone.mechanical_air_change * cte.HOUR_TO_SECONDS _air_change = thermal_zone.mechanical_air_change * cte.HOUR_TO_SECONDS
@ -471,7 +487,7 @@ class Idf:
Air_Changes_per_Hour=_air_change 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 peak_flow_rate = thermal_zone.domestic_hot_water.peak_flow * thermal_zone.total_floor_area
self._idf.newidfobject(self._DHW, self._idf.newidfobject(self._DHW,
Name=f'DHW {zone_name}', Name=f'DHW {zone_name}',
@ -479,7 +495,7 @@ class Idf:
Flow_Rate_Fraction_Schedule_Name=f'DHW_prof schedules {thermal_zone.usage_name}', 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}', 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}', 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}', EndUse_Subcategory=f'DHW {zone_name}',
Zone_Name=zone_name Zone_Name=zone_name
) )
@ -513,19 +529,25 @@ class Idf:
self._rename_building(self._city.name) self._rename_building(self._city.name)
self._lod = self._city.level_of_detail.geometry self._lod = self._city.level_of_detail.geometry
for building in self._city.buildings: 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: for internal_zone in building.internal_zones:
if internal_zone.thermal_zones_from_internal_zones is None: 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 continue
for thermal_zone in internal_zone.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:
self._add_construction(thermal_boundary) self._add_construction(thermal_boundary)
if thermal_boundary.parent_surface.vegetation is not None: if thermal_boundary.parent_surface.vegetation is not None:
self._add_vegetation_material(thermal_boundary.parent_surface.vegetation) self._add_vegetation_material(thermal_boundary.parent_surface.vegetation)
for thermal_opening in thermal_boundary.thermal_openings: for thermal_opening in thermal_boundary.thermal_openings:
self._add_window_construction_and_material(thermal_opening) self._add_window_construction_and_material(thermal_opening)
usage = thermal_zone.usage_name
if building.name in self._target_buildings or building.name in self._adjacent_buildings: if is_target:
start = datetime.datetime.now()
service_temperature = thermal_zone.domestic_hot_water.service_temperature
usage = thermal_zone.usage_name
_new_schedules = self._create_infiltration_schedules(thermal_zone) _new_schedules = self._create_infiltration_schedules(thermal_zone)
self._add_schedules(usage, 'Infiltration', _new_schedules) self._add_schedules(usage, 'Infiltration', _new_schedules)
_new_schedules = self._create_ventilation_schedules(thermal_zone) _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, 'Lighting', thermal_zone.lighting.schedules)
self._add_schedules(usage, 'Appliance', thermal_zone.appliances.schedules) self._add_schedules(usage, 'Appliance', thermal_zone.appliances.schedules)
self._add_schedules(usage, 'DHW_prof', thermal_zone.domestic_hot_water.schedules) self._add_schedules(usage, 'DHW_prof', thermal_zone.domestic_hot_water.schedules)
_new_schedules = self._create_yearly_values_schedules('cold_temp', _new_schedules = self._create_yearly_values_schedules('cold_temp', building.cold_water_temperature[cte.HOUR])
building.cold_water_temperature[cte.HOUR]) self._add_schedules(usage, 'cold_temp', _new_schedules)
self._add_schedules(building.name, 'cold_temp', _new_schedules) _new_schedules = self._create_constant_value_schedules('DHW_temp', service_temperature)
value = thermal_zone.domestic_hot_water.service_temperature
_new_schedules = self._create_constant_value_schedules('DHW_temp', value)
self._add_schedules(usage, 'DHW_temp', _new_schedules) 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 _occ = thermal_zone.occupancy
if _occ.occupancy_density == 0: if _occ.occupancy_density == 0:
_total_heat = 0 _total_heat = 0
@ -553,16 +577,18 @@ class Idf:
self._add_schedules(usage, 'Activity Level', _new_schedules) self._add_schedules(usage, 'Activity Level', _new_schedules)
self._add_zone(thermal_zone, building.name) self._add_zone(thermal_zone, building.name)
self._add_heating_system(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_ventilation(thermal_zone, building.name)
self._add_occupancy(thermal_zone, building.name) self._add_occupancy(thermal_zone, building.name)
self._add_lighting(thermal_zone, building.name) self._add_lighting(thermal_zone, building.name)
self._add_appliances(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 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: if building.thermal_zones_from_internal_zones is not None:
start = datetime.datetime.now()
self._add_surfaces(building, building.name) self._add_surfaces(building, building.name)
print(f'add surfaces {datetime.datetime.now() - start}')
else: else:
self._add_pure_geometry(building, building.name) self._add_pure_geometry(building, building.name)
else: else:
@ -600,6 +626,18 @@ class Idf:
Reporting_Frequency="Hourly", 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 # post-process to erase windows associated to adiabatic walls
windows_list = [] windows_list = []
for window in self._idf.idfobjects[self._WINDOW]: for window in self._idf.idfobjects[self._WINDOW]:

View File

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

View File

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

View File

@ -79,6 +79,8 @@ class NrcanPhysicsParameters:
thermal_archetype.indirect_heated_ratio = 0 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_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_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 = [] _constructions = []
for catalog_construction in catalog_archetype.constructions: for catalog_construction in catalog_archetype.constructions:
construction = Construction() construction = Construction()

View File

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

View File

@ -34,7 +34,7 @@ class SimplifiedRadiosityAlgorithm:
for key in self._results: for key in self._results:
_irradiance = {} _irradiance = {}
header_name = key.split(':') 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] city_object_name = header_name[1]
building = self._city.city_object(city_object_name) building = self._city.city_object(city_object_name)
surface_id = header_name[2] surface_id = header_name[2]

View File

View File

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

View File

@ -1,5 +1,5 @@
xmltodict xmltodict
numpy numpy==1.26.4
trimesh[all] trimesh[all]
pyproj pyproj
pandas pandas
@ -24,4 +24,5 @@ triangle
psycopg2-binary psycopg2-binary
Pillow Pillow
pathlib pathlib
sqlalchemy_utils 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