Reviewed d18599 and adjusted the exporter consequently

This commit is contained in:
Pilar 2022-11-28 14:11:26 -05:00
parent 241ca4298f
commit 48c17680df
5 changed files with 17 additions and 8 deletions

View File

@ -7,6 +7,7 @@ The following assumptions are taken:
- All buildings have basement but those are not heated - All buildings have basement but those are not heated
- The construction details come from nrel - The construction details come from nrel
- The usage details come from comnet - The usage details come from comnet
- The heated volume is 85% of the total volume, assuming that the rest is occupied by internal walls
#### Dependencies #### Dependencies

View File

@ -1,5 +1,5 @@
""" """
InselMonthlyEnergyBalance exports models to insel format Monthly energy balance using Insel workflow
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
@ -23,10 +23,10 @@ class MonthlyEnergyBalance:
for building in self._city.buildings: for building in self._city.buildings:
building.attic_heated = attic_heated_case building.attic_heated = attic_heated_case
building.basement_heated = basement_heated_case building.basement_heated = basement_heated_case
self.sanity_check() self._sanity_check()
self.workflow() self._workflow()
def sanity_check(self): def _sanity_check(self):
levels_of_detail = self._city.level_of_detail levels_of_detail = self._city.level_of_detail
if levels_of_detail.geometry is None: if levels_of_detail.geometry is None:
raise Exception(f'Level of detail of geometry not assigned') raise Exception(f'Level of detail of geometry not assigned')
@ -48,7 +48,7 @@ class MonthlyEnergyBalance:
if cte.HOUR not in surface.global_irradiance: if cte.HOUR not in surface.global_irradiance:
raise Exception(f'Building {building.name} does not have global irradiance on surfaces assigned') raise Exception(f'Building {building.name} does not have global irradiance on surfaces assigned')
def workflow(self): def _workflow(self):
for building in self._city.buildings: for building in self._city.buildings:
if cte.MONTH not in building.external_temperature: if cte.MONTH not in building.external_temperature:
building.external_temperature[cte.MONTH] = MonthlyValues(). \ building.external_temperature[cte.MONTH] = MonthlyValues(). \
@ -57,7 +57,7 @@ class MonthlyEnergyBalance:
for surface in building.surfaces: for surface in building.surfaces:
if surface.type != cte.GROUND: if surface.type != cte.GROUND:
if cte.MONTH not in surface.global_irradiance: if cte.MONTH not in surface.global_irradiance:
surface.global_irradiance[cte.MONTH] = MonthlyValues().get_total_month(surface.global_irradiance[cte.HOUR]) surface.global_irradiance[cte.MONTH] = MonthlyValues().get_mean_values(surface.global_irradiance[cte.HOUR])
tmp_path = (Path(__file__).parent / 'tmp').resolve() tmp_path = (Path(__file__).parent / 'tmp').resolve()
EnergyBuildingsExportsFactory('insel_monthly_energy_balance', self._city, tmp_path).export() EnergyBuildingsExportsFactory('insel_monthly_energy_balance', self._city, tmp_path).export()

4
tmp/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -81,8 +81,8 @@ class TestMonthlyEnergyBalanceWorkflow(TestCase):
for building in city.buildings: for building in city.buildings:
building.year_of_construction = 2006 building.year_of_construction = 2006
if building.function is None: building.function = cte.LARGE_OFFICE
building.function = cte.LARGE_OFFICE print(building.function)
ConstructionFactory(construction_format, city).enrich() ConstructionFactory(construction_format, city).enrich()
UsageFactory(usage_format, city).enrich() UsageFactory(usage_format, city).enrich()

4
unittests/tests_outputs/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore