""" Main SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2021 Project Author name guillermo.gutierrezmorote@concordia.ca Project Collaborator name peteryefi@gmail.com """ from catalog_factories.construction_catalog_factory import ConstructionCatalogFactory from catalog_factories.greenery_catalog_factory import GreeneryCatalogFactory from catalog_factories.usage_catalog_factory import UsageCatalogFactory from imports.construction_factory import ConstructionFactory from imports.geometry_factory import GeometryFactory from imports.life_cycle_assessment_factory import LifeCycleAssessment # from imports.schedules_factory import SchedulesFactory from imports.usage_factory import UsageFactory from imports.weather_factory import WeatherFactory from flask import Response import hub_api.helpers.session_helper as sh import datetime from pathlib import Path from bootstrap import app sh.begin_time = datetime.datetime.now() # initialize catalogs sh.greenery_catalog = GreeneryCatalogFactory('nrel').catalog sh.construction_catalog = ConstructionCatalogFactory('nrel').catalog sh.usage_catalog = UsageCatalogFactory('comnet').catalog # Enrich the city data_path = (Path(__file__).parent / 'data').resolve() rihno_path = (Path(data_path / 'dompark.3dm')).resolve() city = GeometryFactory('rhino', rihno_path).city for building in city.buildings: # Rihno files have no information about the function or the year of construction building.year_of_construction = 1995 building.function = 'industry' building.human_readable_name = "Dompark" ConstructionFactory('nrel', city).enrich() UsageFactory('comnet', city).enrich() # SchedulesFactory('comnet', city).enrich() LifeCycleAssessment('material', city).enrich() LifeCycleAssessment('machine', city).enrich() LifeCycleAssessment('fuel', city).enrich() LifeCycleAssessment('vehicle', city).enrich() montreal_weather_file = (Path(__file__).parent / './data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw').resolve() city.climate_file = (data_path / f'{city.climate_reference_city}.cli').resolve() WeatherFactory('epw', city, file_name=montreal_weather_file).enrich() # Rihno files have no information about the building location city.name = 'Montreal' city.climate_reference_city = 'Montreal' # SRA Calculations for building in city.buildings: building.heated = True building.cooled = True building.attic_heated = 0 building.basement_heated = 0 for surface in building.surfaces: surface.swr = 0.2 # Pass the city to the session helper to be used as default status. sh.city = city @app.route("/") def home(): return Response(headers={'Access-Control-Allow-Origin': '*'}) app.run(port=15789, host="0.0.0.0", debug=False)