import glob import os import sys from pathlib import Path from hub.imports.geometry_factory import GeometryFactory from hub.imports.construction_factory import ConstructionFactory from hub.imports.usage_factory import UsageFactory from hub.imports.weather_factory import WeatherFactory from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory from hub.helpers.dictionaries import Dictionaries from hub.imports.results_factory import ResultFactory import hub.helpers.constants as cte sys.path.append('./') file_path = Path('./input_files/GullBayWithYOC.geojson').resolve() out_path = Path('./output_files').resolve() files = glob.glob(f'{out_path}/*') for file in files: if file != '.gitignore': os.remove(file) GullBay_dictionary = {'RESIDENTIAL' : cte.RESIDENTIAL, 'FIRE_STATION' : cte.LARGE_OFFICE, 'GYMNASIUM' : cte.LARGE_OFFICE, 'OUT_PATIENT_HEALTH_CARE' : cte.LARGE_OFFICE, #cte.OUT_PATIENT_HEALTH_CARE was original 'POLICE_STATION' : cte.LARGE_OFFICE, 'OFFICE_AND_ADMINISTRATION' : cte.OFFICE_AND_ADMINISTRATION, 'RELIGIOUS' : cte.LARGE_OFFICE, 'STAND_ALONE_RETAIL' : cte.STAND_ALONE_RETAIL, 'EDUCATION' : cte.EDUCATION, 'WAREHOUSE' : cte.WAREHOUSE} print('[simulation start]') city = GeometryFactory('geojson', path=file_path, height_field='Height', year_of_construction_field='year_of_construction', function_field='Archetype').city for building in city.buildings: building.function = GullBay_dictionary[building.function] building.energy_systems_archetype_name = 'system 8 gas' building.storeys_above_ground = 1 print(f'city created from {file_path}') ConstructionFactory('nrcan', city).enrich() print('enrich constructions... done') UsageFactory('nrcan', city).enrich() print('enrich usage... done') WeatherFactory('epw', city).enrich() print('enrich weather... done') area = 0 volume = 0 for building in city.buildings: volume = building.volume for ground in building.grounds: area += ground.perimeter_polygon.area print('exporting:') _idf = EnergyBuildingsExportsFactory('idf', city, out_path).export() print(' idf exported...') _idf.run() csv_file = str((out_path / f'{city.name}_out.csv').resolve()) eso_file = str((out_path / f'{city.name}_out.eso').resolve()) idf_file = str((out_path / f'{city.name}.idf').resolve()) obj_file = str((out_path / f'{city.name}.obj').resolve()) #ResultFactory('energy_plus_multiple_buildings', city, out_path).enrich()