forked from s_ranjbar/city_retrofit
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
import glob
|
|
import sys
|
|
from pathlib import Path
|
|
from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory
|
|
from hub.imports.results_factory import ResultFactory
|
|
|
|
sys.path.append('./')
|
|
|
|
|
|
def energy_plus_workflow(city):
|
|
try:
|
|
out_path = (Path(__file__).parent.parent / 'out_files')
|
|
area = 0
|
|
for building in city.buildings:
|
|
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()
|
|
|
|
except Exception as ex:
|
|
print(ex)
|
|
print('error: ', ex)
|
|
print('[simulation abort]')
|
|
sys.stdout.flush()
|