correct scenario mapping
This commit is contained in:
parent
3d3a20f560
commit
6f344c8f2c
|
@ -11,8 +11,14 @@ from hub_api.mockup.building import Building
|
|||
|
||||
|
||||
class RetrofitResults(Resource, Config):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._scenario_ids = {'current status': 0,
|
||||
'skin retrofit': 1,
|
||||
'system retrofit and pv': 2,
|
||||
'skin and system retrofit with pv': 3
|
||||
}
|
||||
|
||||
def post(self):
|
||||
"""
|
||||
|
@ -41,11 +47,12 @@ class RetrofitResults(Resource, Config):
|
|||
return Response(json.dumps({'result': 'succeed', 'results': results}), status=200, headers=token)
|
||||
# deserialize the response to return pure json
|
||||
for scenario in results:
|
||||
scenario_id = self._scenario_ids[scenario]
|
||||
for building_results in results[scenario]:
|
||||
building_info = self.database.building(building_results['building'], user_id, application_id, scenario)
|
||||
archetype = self.energy_systems_catalog.get_entry(building_info.system_name)
|
||||
mockup_building = Building(building_info, building_results, archetype)
|
||||
life_cycle = Cost(mockup_building, retrofit_scenario=scenario).life_cycle
|
||||
life_cycle = Cost(mockup_building, retrofit_scenario=scenario_id).life_cycle
|
||||
operational_co2 = Co2Emission(mockup_building).operational_co2
|
||||
global_capital_costs = life_cycle[f'Scenario {scenario}']['global_capital_costs']
|
||||
global_operational_costs = life_cycle[f'Scenario {scenario}']['global_operational_costs']
|
||||
|
@ -71,7 +78,8 @@ class RetrofitResults(Resource, Config):
|
|||
'D5020_lighting_and_branch_wiring': global_capital_costs['D5020_lighting_and_branch_wiring'].tolist(),
|
||||
'D301010_photovoltaic_system': global_capital_costs['D301010_photovoltaic_system'].tolist(),
|
||||
},
|
||||
'global_end_of_life_costs': life_cycle[f'Scenario {scenario}']['global_end_of_life_costs']['End_of_life_costs'].tolist(),
|
||||
'global_end_of_life_costs': life_cycle[f'Scenario {scenario}']['global_end_of_life_costs'][
|
||||
'End_of_life_costs'].tolist(),
|
||||
'global_operational_costs': {
|
||||
'fixed_costs_electricity_peak': global_operational_costs['Fixed_costs_electricity_peak'].tolist(),
|
||||
'fixed_costs_electricity_monthly': global_operational_costs['Fixed_costs_electricity_monthly'].tolist(),
|
||||
|
@ -84,7 +92,8 @@ class RetrofitResults(Resource, Config):
|
|||
'cooling_maintenance': global_maintenance_costs['Cooling_maintenance'].tolist(),
|
||||
'pv_maintenance': global_maintenance_costs['PV_maintenance'].tolist(),
|
||||
},
|
||||
'global_operational_incomes': life_cycle[f'Scenario {scenario}']['global_operational_incomes']['Incomes electricity'].tolist(),
|
||||
'global_operational_incomes': life_cycle[f'Scenario {scenario}']['global_operational_incomes'][
|
||||
'Incomes electricity'].tolist(),
|
||||
'global_capital_incomes': {
|
||||
'subsidies_construction': global_capital_incomes['Subsidies construction'].tolist(),
|
||||
'subsidies_hvac': global_capital_incomes['Subsidies HVAC'].tolist(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user