This commit is contained in:
Pilar Monsalvete 2023-03-21 14:27:37 -04:00
parent 63b4b2dc70
commit eedfd64559

View File

@ -4,25 +4,17 @@ import sys
from pathlib import Path
import csv
sys.path.append('../hub')
from hub.imports.geometry_factory import GeometryFactory
from hub.imports.construction_factory import ConstructionFactory
from hub.imports.usage_factory import UsageFactory
from hub.exports.exports_factory import ExportsFactory
from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory
from hub.helpers.dictionaries import Dictionaries
sys.path.append('./')
from imports.geometry_factory import GeometryFactory
from imports.construction_factory import ConstructionFactory
from imports.usage_factory import UsageFactory
from exports.exports_factory import ExportsFactory
from exports.energy_building_exports_factory import EnergyBuildingsExportsFactory
try:
gml = ''
for argument_tuple in sys.argv[1:]:
print(argument_tuple)
argument = argument_tuple.split(' ')
option = argument[0]
value = argument[1]
if option == '-g':
gml = value
file_path = (Path(__file__).parent.parent / 'input_files' / 'selected_building.geojson')
out_path = (Path(__file__).parent.parent / 'out_files')
files = glob.glob(f'{out_path}/*')
for file in files:
@ -30,17 +22,16 @@ try:
os.remove(file)
print('[simulation start]')
city = GeometryFactory('citygml', gml).city
print(f'city created from {gml}')
for building in city.buildings:
building.year_of_construction = 2006
if building.function is None:
building.function = 'large office'
for building in city.buildings:
print(building.function)
ConstructionFactory('nrel', city).enrich()
city = GeometryFactory('geojson',
path=file_path,
height_field='heightmax',
year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
print(f'city created from {file_path}')
ConstructionFactory('nrcan', city).enrich()
print('enrich constructions... done')
UsageFactory('comnet', city).enrich()
UsageFactory('nrcan', city).enrich()
print('enrich usage... done')
area = 0
@ -52,9 +43,6 @@ try:
print('exporting:')
ExportsFactory('obj', city, out_path).export()
print(' geometry exported...')
# todo: _idf exporter does not catch errors in exporting
_idf = EnergyBuildingsExportsFactory('idf', city, out_path).export_debug()
print(' idf exported...')
_idf.run()