This commit is contained in:
Guille Gutierrez 2024-04-18 07:32:32 +02:00
parent 0623faaafc
commit 8cfd6ebe82
2 changed files with 1 additions and 6 deletions

View File

@ -10,7 +10,6 @@ from hub.helpers.dictionaries import Dictionaries
from hub_api.mockup.properties import *
import pandas as pd
class Building:
@ -214,14 +213,13 @@ class Building:
:return: [EnergySystem]
"""
_energy_systems = []
for system in self._catalog_archetype.systems:
_hub_demand_types = []
for demand_type in system.demand_types:
# todo: generalize this when we have more catalogs
_hub_demand_types.append(Dictionaries().montreal_demand_type_to_hub_energy_demand_type[demand_type])
demands = _hub_demand_types
fuel_type = Dictionaries().montreal_custom_fuel_to_hub_fuel[system.generation_system.fuel_type]
fuel_type = Dictionaries().montreal_custom_fuel_to_hub_fuel[system.generation_systems[0].fuel_type]
generic_generation_system = GenericGenerationSystem()
generic_generation_system.fuel_type = fuel_type
generation_system = GenerationSystem()

View File

@ -97,9 +97,7 @@ class RetrofitResults(Resource, Config):
payload = request.get_json()
if 'scenarios' not in payload:
return Response(json.dumps({'error': 'Bad request'}), status=400, headers=token)
start = datetime.datetime.now()
results = self.database.results(user_id, application_id, payload)
print(f'{datetime.datetime.now()- start}')
if results == {}:
# no data found for the given parameters
return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=token)
@ -117,5 +115,4 @@ class RetrofitResults(Resource, Config):
f.start()
for f in t:
f.join()
print(f'retrieve calculations {datetime.datetime.now() - start}')
return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=token)