debuging_meb #6

Merged
p_monsalvete merged 4 commits from debuging_meb into main 2023-03-16 15:58:24 -04:00
16 changed files with 552 additions and 525 deletions

View File

@ -18,3 +18,4 @@ convective_heat_transfer_coefficient_exterior = 20
soil_conductivity = 3 soil_conductivity = 3
#m #m
soil_thickness = 0.5 soil_thickness = 0.5
short_wave_reflectance = 0.3

View File

@ -7,6 +7,8 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
import numpy as np import numpy as np
from pathlib import Path from pathlib import Path
import sys
from hub.hub_logger import logger
from hub.exports.formats.insel import Insel from hub.exports.formats.insel import Insel
from hub.imports.weather.helpers.weather import Weather from hub.imports.weather.helpers.weather import Weather
@ -38,6 +40,10 @@ class InselMonthlyEnergyBalance(Insel):
if building.internal_zones is not None: if building.internal_zones is not None:
for internal_zone in building.internal_zones: for internal_zone in building.internal_zones:
if internal_zone.thermal_zones is None: if internal_zone.thermal_zones is None:
logger.error(f'Building {building.name} has missing values. '
f'Monthly Energy Balance cannot be processed\n')
sys.stderr.write(f'Building {building.name} has missing values. '
f'Monthly Energy Balance cannot be processed\n')
break break
self._contents.append( self._contents.append(
self.generate_meb_template(building, output_path, self._radiation_calculation_method,self._weather_format) self.generate_meb_template(building, output_path, self._radiation_calculation_method,self._weather_format)

View File

@ -8,6 +8,7 @@ import xmltodict
from hub.imports.weather_factory import WeatherFactory from hub.imports.weather_factory import WeatherFactory
import hub.helpers.constants as cte import hub.helpers.constants as cte
from hub.helpers.configuration_helper import ConfigurationHelper
class SimplifiedRadiosityAlgorithm: class SimplifiedRadiosityAlgorithm:
@ -88,10 +89,15 @@ class SimplifiedRadiosityAlgorithm:
'@Simulate': f'{simulate}' '@Simulate': f'{simulate}'
} }
walls, roofs, floors = [], [], [] walls, roofs, floors = [], [], []
default_short_wave_reflectance = ConfigurationHelper().short_wave_reflectance
for surface in building.surfaces: for surface in building.surfaces:
if surface.short_wave_reflectance is None:
short_wave_reflectance = default_short_wave_reflectance
else:
short_wave_reflectance = surface.short_wave_reflectance
surface_dict = { surface_dict = {
'@id': f'{surface.id}', '@id': f'{surface.id}',
'@ShortWaveReflectance': f'{surface.short_wave_reflectance}' '@ShortWaveReflectance': f'{short_wave_reflectance}'
} }
for point_index, point in enumerate(surface.perimeter_polygon.coordinates): for point_index, point in enumerate(surface.perimeter_polygon.coordinates):
point = self._correct_point(point) point = self._correct_point(point)

View File

@ -138,3 +138,11 @@ class ConfigurationHelper:
:return: 0.5 :return: 0.5
""" """
return self._config.getfloat('buildings', 'soil_thickness').real return self._config.getfloat('buildings', 'soil_thickness').real
@property
def short_wave_reflectance(self) -> float:
"""
Get configured short wave reflectance for surfaces that don't have construction assigned
:return: 0.3
"""
return self._config.getfloat('buildings', 'short_wave_reflectance').real

View File

@ -8,6 +8,7 @@ Project Coder Guille Gutierrez Guillermo.GutierrezMorote@concordia.ca
import hub.helpers.constants as cte import hub.helpers.constants as cte
class AlkisFunctionToHubFunction: class AlkisFunctionToHubFunction:
def __init__(self): def __init__(self):

View File

@ -34,16 +34,16 @@ class HubUsageToNrcanUsage:
cte.SECONDARY_SCHOOL: 'School/university', cte.SECONDARY_SCHOOL: 'School/university',
cte.UNIVERSITY: 'School/university', cte.UNIVERSITY: 'School/university',
cte.LABORATORY_AND_RESEARCH_CENTER: 'School/university', cte.LABORATORY_AND_RESEARCH_CENTER: 'School/university',
cte.STAND_ALONE_RETAIL: 'Retail', cte.STAND_ALONE_RETAIL: 'Retail area',
cte.HOSPITAL: 'Hospital', cte.HOSPITAL: 'Hospital',
cte.OUT_PATIENT_HEALTH_CARE: 'Health-care clinic', cte.OUT_PATIENT_HEALTH_CARE: 'Health-care clinic',
cte.HEALTH_CARE: 'Health-care clinic', cte.HEALTH_CARE: 'Health-care clinic',
cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Health-care clinic', cte.RETIREMENT_HOME_OR_ORPHANAGE: 'Health-care clinic',
cte.COMMERCIAL: 'Retail', cte.COMMERCIAL: 'Retail area',
cte.STRIP_MALL: 'Retail', cte.STRIP_MALL: 'Retail area',
cte.SUPERMARKET: 'Retail', cte.SUPERMARKET: 'Retail area',
cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'Retail', cte.RETAIL_SHOP_WITHOUT_REFRIGERATED_FOOD: 'Retail area',
cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'Retail', cte.RETAIL_SHOP_WITH_REFRIGERATED_FOOD: 'Retail area',
cte.RESTAURANT: 'Dining - bar/lounge', cte.RESTAURANT: 'Dining - bar/lounge',
cte.QUICK_SERVICE_RESTAURANT: 'Dining - cafeteria', cte.QUICK_SERVICE_RESTAURANT: 'Dining - cafeteria',
cte.FULL_SERVICE_RESTAURANT: 'Dining - bar/lounge', cte.FULL_SERVICE_RESTAURANT: 'Dining - bar/lounge',

View File

@ -4,8 +4,10 @@ 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
""" """
import math import math
import sys import sys
from hub.hub_logger import logger
import hub.helpers.constants as cte import hub.helpers.constants as cte
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
@ -37,10 +39,13 @@ class NrcanPhysicsParameters:
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function] function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone) archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone)
except KeyError: except KeyError:
logger.error(f'Building {building.name} has unknown construction archetype for building function: '
f'{building.function}, building year of construction: {building.year_of_construction} '
f'and climate zone {self._climate_zone}\n')
sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: ' sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: '
f'{building.function}, building year of construction: {building.year_of_construction} ' f'{building.function}, building year of construction: {building.year_of_construction} '
f'and climate zone {self._climate_zone}\n') f'and climate zone {self._climate_zone}\n')
return continue
# if building has no thermal zones defined from geometry, and the building will be divided in storeys, # if building has no thermal zones defined from geometry, and the building will be divided in storeys,
# one thermal zone per storey is assigned # one thermal zone per storey is assigned
if len(building.internal_zones) == 1: if len(building.internal_zones) == 1:

View File

@ -39,14 +39,14 @@ class NrelPhysicsParameters:
archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction, archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction,
self._climate_zone) self._climate_zone)
except KeyError: except KeyError:
logger.error(f'Building {building.name} has unknown archetype for building function: {building.function} ' logger.error(f'Building {building.name} has unknown construction archetype for building function: '
f'and building year of construction: {building.year_of_construction} ' f'{building.function} and building year of construction: {building.year_of_construction} '
f'and climate zone reference norm {self._climate_zone}\n') f'and climate zone reference norm {self._climate_zone}\n')
sys.stderr.write(f'Building {building.name} has unknown archetype for building function: {building.function} ' sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: '
f'and building year of construction: {building.year_of_construction} ' f'{building.function} and building year of construction: {building.year_of_construction} '
f'and climate zone reference norm {self._climate_zone}\n') f'and climate zone reference norm {self._climate_zone}\n')
return continue
# if building has no thermal zones defined from geometry, and the building will be divided in storeys, # if building has no thermal zones defined from geometry, and the building will be divided in storeys,
# one thermal zone per storey is assigned # one thermal zone per storey is assigned

View File

@ -42,7 +42,7 @@ class ComnetUsageParameters:
except KeyError: except KeyError:
sys.stderr.write(f'Building {building.name} has unknown usage archetype for building function:' sys.stderr.write(f'Building {building.name} has unknown usage archetype for building function:'
f' {building.function}') f' {building.function}')
return continue
for internal_zone in building.internal_zones: for internal_zone in building.internal_zones:
if internal_zone.area is None: if internal_zone.area is None:

View File

@ -41,7 +41,7 @@ class NrcanUsageParameters:
except KeyError: except KeyError:
sys.stderr.write(f'Building {building.name} has unknown usage archetype for building function:' sys.stderr.write(f'Building {building.name} has unknown usage archetype for building function:'
f' {building.function}') f' {building.function}')
return continue
usage_name = Dictionaries().hub_usage_to_comnet_usage[building.function] usage_name = Dictionaries().hub_usage_to_comnet_usage[building.function]
try: try:
@ -49,7 +49,7 @@ class NrcanUsageParameters:
except KeyError: except KeyError:
sys.stderr.write(f'Building {building.name} has unknown usage archetype for building function:' sys.stderr.write(f'Building {building.name} has unknown usage archetype for building function:'
f' {building.function}') f' {building.function}')
return continue
for internal_zone in building.internal_zones: for internal_zone in building.internal_zones:
if internal_zone.area is None: if internal_zone.area is None: