Added logging
This commit is contained in:
parent
2d301853d6
commit
3dc74371f4
|
@ -9,6 +9,7 @@ from typing import List, Union, Dict
|
||||||
import yaml
|
import yaml
|
||||||
from string import Template
|
from string import Template
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
from hub_logger import logger
|
||||||
|
|
||||||
|
|
||||||
class HeatPumpExport:
|
class HeatPumpExport:
|
||||||
|
@ -56,13 +57,15 @@ class HeatPumpExport:
|
||||||
insel_file_handler.write(insel_template)
|
insel_file_handler.write(insel_template)
|
||||||
# Now run insel
|
# Now run insel
|
||||||
self._delete_existing_output_files()
|
self._delete_existing_output_files()
|
||||||
os.system('/usr/local/bin/insel {}'.format(insel_file))
|
logger.info(f'Running Insel with user input: {user_input} and coefficients {capacity_coeff}')
|
||||||
|
os.system('insel {}'.format(insel_file))
|
||||||
# Writer headers to csv output files generated by insel
|
# Writer headers to csv output files generated by insel
|
||||||
self._write_insel_output_headers()
|
self._write_insel_output_headers()
|
||||||
# User output
|
# User output
|
||||||
return self._get_user_out_put()
|
return self._get_user_out_put()
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
print("I/O exception: {}".format(err))
|
print("I/O exception: {}".format(err))
|
||||||
|
logger.error(f'An I/O error occurred while running insel: {err}')
|
||||||
finally:
|
finally:
|
||||||
insel_file_handler.close()
|
insel_file_handler.close()
|
||||||
insel_template_handler.close()
|
insel_template_handler.close()
|
||||||
|
|
|
@ -8,6 +8,7 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
from imports.construction_factory import ConstructionFactory
|
from imports.construction_factory import ConstructionFactory
|
||||||
from imports.usage_factory import UsageFactory
|
from imports.usage_factory import UsageFactory
|
||||||
from imports.schedules_factory import SchedulesFactory
|
from imports.schedules_factory import SchedulesFactory
|
||||||
|
from hub_logger import logger
|
||||||
|
|
||||||
|
|
||||||
class EnrichCity:
|
class EnrichCity:
|
||||||
|
@ -36,6 +37,7 @@ class EnrichCity:
|
||||||
if self._enriched_city is None:
|
if self._enriched_city is None:
|
||||||
self._errors = []
|
self._errors = []
|
||||||
print('original:', len(self._city.buildings))
|
print('original:', len(self._city.buildings))
|
||||||
|
logger.info(f'Building length prior to enrichment: {len(self._city.buildings)}')
|
||||||
if not pickle_construction:
|
if not pickle_construction:
|
||||||
if construction_format is not None:
|
if construction_format is not None:
|
||||||
self._enriched_city = self._construction(construction_format)
|
self._enriched_city = self._construction(construction_format)
|
||||||
|
@ -83,6 +85,7 @@ class EnrichCity:
|
||||||
self._enriched_city = self._city
|
self._enriched_city = self._city
|
||||||
return self._enriched_city
|
return self._enriched_city
|
||||||
print('enriched with usage:', len(self._city.buildings))
|
print('enriched with usage:', len(self._city.buildings))
|
||||||
|
logger.info(f'City enriched with usage: {len(self._city.buildings)}')
|
||||||
return self._city
|
return self._city
|
||||||
|
|
||||||
def _schedules(self, schedules_format):
|
def _schedules(self, schedules_format):
|
||||||
|
@ -101,4 +104,5 @@ class EnrichCity:
|
||||||
self._enriched_city = self._city
|
self._enriched_city = self._city
|
||||||
return self._enriched_city
|
return self._enriched_city
|
||||||
print('enriched with occupancy:', len(self._city.buildings))
|
print('enriched with occupancy:', len(self._city.buildings))
|
||||||
|
logger.info(f'City enriched with occupancy: {len(self._city.buildings)}')
|
||||||
return self._city
|
return self._city
|
||||||
|
|
|
@ -12,6 +12,7 @@ from catalog_factories.construction_catalog_factory import ConstructionCatalogFa
|
||||||
from city_model_structure.building_demand.layer import Layer
|
from city_model_structure.building_demand.layer import Layer
|
||||||
from city_model_structure.building_demand.material import Material
|
from city_model_structure.building_demand.material import Material
|
||||||
from imports.construction.helpers.construction_helper import ConstructionHelper
|
from imports.construction.helpers.construction_helper import ConstructionHelper
|
||||||
|
from hub_logger import logger
|
||||||
|
|
||||||
|
|
||||||
class UsPhysicsParameters(NrelPhysicsInterface):
|
class UsPhysicsParameters(NrelPhysicsInterface):
|
||||||
|
@ -35,9 +36,14 @@ class UsPhysicsParameters(NrelPhysicsInterface):
|
||||||
try:
|
try:
|
||||||
archetype = self._search_archetype(building.function, building.year_of_construction, self._climate_zone)
|
archetype = self._search_archetype(building.function, building.year_of_construction, self._climate_zone)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
||||||
|
logger.error(f'Building {building.name} has unknown archetype for building function: {building.function} '
|
||||||
|
f'and building year of construction: {building.year_of_construction} '
|
||||||
|
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 archetype for building function: {building.function} '
|
||||||
f'and building year of construction: {building.year_of_construction} '
|
f'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
|
return
|
||||||
|
|
||||||
# if building has no thermal zones defined from geometry, one thermal zone per storey is assigned
|
# if building has no thermal zones defined from geometry, one thermal zone per storey is assigned
|
||||||
|
|
Loading…
Reference in New Issue
Block a user