complete results
This commit is contained in:
parent
d9a464e6d9
commit
beed9f4e22
|
@ -6,7 +6,11 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
|
from hub.helpers.dictionaries import Dictionaries
|
||||||
|
|
||||||
|
|
||||||
from hub_api.mockup.properties import *
|
from hub_api.mockup.properties import *
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
class Building:
|
class Building:
|
||||||
|
@ -27,6 +31,7 @@ class Building:
|
||||||
cte.YEAR: results['yearly_heating_consumption'],
|
cte.YEAR: results['yearly_heating_consumption'],
|
||||||
cte.MONTH: results['monthly_heating_consumption']
|
cte.MONTH: results['monthly_heating_consumption']
|
||||||
}
|
}
|
||||||
|
print(self._heating_consumption)
|
||||||
self._cooling_consumption = {
|
self._cooling_consumption = {
|
||||||
cte.YEAR: results['yearly_cooling_consumption'],
|
cte.YEAR: results['yearly_cooling_consumption'],
|
||||||
cte.MONTH: results['monthly_cooling_consumption']
|
cte.MONTH: results['monthly_cooling_consumption']
|
||||||
|
@ -36,10 +41,12 @@ class Building:
|
||||||
cte.MONTH: results['monthly_domestic_hot_water_consumption']
|
cte.MONTH: results['monthly_domestic_hot_water_consumption']
|
||||||
}
|
}
|
||||||
self._lighting_electrical_demand = {
|
self._lighting_electrical_demand = {
|
||||||
cte.YEAR: {'insel meb': results['yearly_lighting_electrical_demand'][0]}
|
cte.YEAR: pd.DataFrame(results['yearly_lighting_electrical_demand'], columns=['insel meb']),
|
||||||
|
cte.MONTH: pd.DataFrame(results['monthly_lighting_electrical_demand'], columns=['insel meb'])
|
||||||
}
|
}
|
||||||
self._appliances_electrical_demand = {
|
self._appliances_electrical_demand = {
|
||||||
cte.YEAR: {'insel meb': results['yearly_appliances_electrical_demand'][0]}
|
cte.YEAR: pd.DataFrame(results['yearly_appliances_electrical_demand'], columns=['insel meb']),
|
||||||
|
cte.MONTH: pd.DataFrame(results['monthly_appliances_electrical_demand'], columns=['insel meb'])
|
||||||
}
|
}
|
||||||
self._heating_peak_load = {
|
self._heating_peak_load = {
|
||||||
cte.YEAR: results['yearly_heating_peak_load'],
|
cte.YEAR: results['yearly_heating_peak_load'],
|
||||||
|
@ -144,10 +151,13 @@ class Building:
|
||||||
@property
|
@property
|
||||||
def energy_systems(self):
|
def energy_systems(self):
|
||||||
_energy_systems = []
|
_energy_systems = []
|
||||||
|
|
||||||
for system in self._catalog_archetype.systems:
|
for system in self._catalog_archetype.systems:
|
||||||
demands = system.demand_types
|
_hub_demand_types = []
|
||||||
fuel_type = system.generation_system.fuel_type
|
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]
|
||||||
generic_generation_system = GenericGenerationSystem()
|
generic_generation_system = GenericGenerationSystem()
|
||||||
generic_generation_system.fuel_type = fuel_type
|
generic_generation_system.fuel_type = fuel_type
|
||||||
generation_system = GenerationSystem()
|
generation_system = GenerationSystem()
|
||||||
|
|
|
@ -3,10 +3,11 @@ import json
|
||||||
from flask import Response, request
|
from flask import Response, request
|
||||||
from flask_restful import Resource
|
from flask_restful import Resource
|
||||||
|
|
||||||
|
from costs.cost import Cost
|
||||||
|
from co2_emission.co2_emission import Co2Emission
|
||||||
from hub_api.config import Config
|
from hub_api.config import Config
|
||||||
from hub_api.helpers.session_helper import session, refresh_session
|
from hub_api.helpers.session_helper import session, refresh_session
|
||||||
from hub_api.mockup.building import Building
|
from hub_api.mockup.building import Building
|
||||||
from costs.cost import Cost
|
|
||||||
|
|
||||||
|
|
||||||
class RetrofitResults(Resource, Config):
|
class RetrofitResults(Resource, Config):
|
||||||
|
@ -17,6 +18,7 @@ class RetrofitResults(Resource, Config):
|
||||||
"""
|
"""
|
||||||
API call for requesting a specified list of enriched persistence
|
API call for requesting a specified list of enriched persistence
|
||||||
"""
|
"""
|
||||||
|
# todo: cost and co2 libraries are using default canadians values, in the future need to be optionally API configurable
|
||||||
session_id = request.headers.get('session-id', None)
|
session_id = request.headers.get('session-id', None)
|
||||||
token = request.headers.get('token', None)
|
token = request.headers.get('token', None)
|
||||||
application_uuid = request.headers.get('application-uuid', None)
|
application_uuid = request.headers.get('application-uuid', None)
|
||||||
|
@ -50,6 +52,8 @@ class RetrofitResults(Resource, Config):
|
||||||
building_results['insel meb'] = values
|
building_results['insel meb'] = values
|
||||||
mockup_building = Building(building_info, results_dictionary, archetype)
|
mockup_building = Building(building_info, results_dictionary, archetype)
|
||||||
life_cycle = Cost(mockup_building, retrofit_scenario=scenario).life_cycle
|
life_cycle = Cost(mockup_building, retrofit_scenario=scenario).life_cycle
|
||||||
|
|
||||||
|
operational_co2 = Co2Emission(mockup_building).operational_co2
|
||||||
global_capital_costs = life_cycle[f'Scenario {scenario}']['global_capital_costs']
|
global_capital_costs = life_cycle[f'Scenario {scenario}']['global_capital_costs']
|
||||||
global_operational_costs = life_cycle[f'Scenario {scenario}']['global_operational_costs']
|
global_operational_costs = life_cycle[f'Scenario {scenario}']['global_operational_costs']
|
||||||
global_capital_incomes = life_cycle[f'Scenario {scenario}']['global_capital_incomes']
|
global_capital_incomes = life_cycle[f'Scenario {scenario}']['global_capital_incomes']
|
||||||
|
@ -93,5 +97,6 @@ class RetrofitResults(Resource, Config):
|
||||||
'subsidies_pv': global_capital_incomes['Subsidies PV'].tolist()
|
'subsidies_pv': global_capital_incomes['Subsidies PV'].tolist()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print(results)
|
print(operational_co2)
|
||||||
|
building_results['operational_co2'] = operational_co2
|
||||||
return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=token)
|
return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=token)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user