From d059a75e8d6c5b2b82aec914963f8281d89411f6 Mon Sep 17 00:00:00 2001 From: Guille Date: Mon, 22 Jan 2024 07:15:08 +0100 Subject: [PATCH] correct retrofit results bug --- hub_api/persistence/retrofit_results.py | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hub_api/persistence/retrofit_results.py b/hub_api/persistence/retrofit_results.py index ce72aba..7a86e65 100644 --- a/hub_api/persistence/retrofit_results.py +++ b/hub_api/persistence/retrofit_results.py @@ -54,19 +54,19 @@ class RetrofitResults(Resource, Config): mockup_building = Building(building_info, building_results, archetype) 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'] - global_capital_incomes = life_cycle[f'Scenario {scenario}']['global_capital_incomes'] - global_maintenance_costs = life_cycle[f'Scenario {scenario}']['global_maintenance_costs'] + global_capital_costs = life_cycle[f'Scenario {scenario_id}']['global_capital_costs'] + global_operational_costs = life_cycle[f'Scenario {scenario_id}']['global_operational_costs'] + global_capital_incomes = life_cycle[f'Scenario {scenario_id}']['global_capital_incomes'] + global_maintenance_costs = life_cycle[f'Scenario {scenario_id}']['global_maintenance_costs'] building_results['costs'] = { - 'total_capital_costs_skin': life_cycle[f'Scenario {scenario}']['total_capital_costs_skin'], - 'total_capital_costs_systems': life_cycle[f'Scenario {scenario}']['total_capital_costs_systems'], - 'end_of_life_costs': life_cycle[f'Scenario {scenario}']['end_of_life_costs'], - 'total_operational_costs': life_cycle[f'Scenario {scenario}']['total_operational_costs'], - 'total_maintenance_costs': life_cycle[f'Scenario {scenario}']['total_maintenance_costs'], - 'operational_incomes': life_cycle[f'Scenario {scenario}']['operational_incomes'], - 'capital_incomes': life_cycle[f'Scenario {scenario}']['capital_incomes'], + 'total_capital_costs_skin': life_cycle[f'Scenario {scenario_id}']['total_capital_costs_skin'], + 'total_capital_costs_systems': life_cycle[f'Scenario {scenario_id}']['total_capital_costs_systems'], + 'end_of_life_costs': life_cycle[f'Scenario {scenario_id}']['end_of_life_costs'], + 'total_operational_costs': life_cycle[f'Scenario {scenario_id}']['total_operational_costs'], + 'total_maintenance_costs': life_cycle[f'Scenario {scenario_id}']['total_maintenance_costs'], + 'operational_incomes': life_cycle[f'Scenario {scenario_id}']['operational_incomes'], + 'capital_incomes': life_cycle[f'Scenario {scenario_id}']['capital_incomes'], 'global_capital_costs': { 'B2010_opaque_walls': global_capital_costs['B2010_opaque_walls'].tolist(), 'B2020_transparent': global_capital_costs['B2020_transparent'].tolist(), @@ -78,7 +78,7 @@ 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'][ + 'global_end_of_life_costs': life_cycle[f'Scenario {scenario_id}']['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(), @@ -92,7 +92,7 @@ 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'][ + 'global_operational_incomes': life_cycle[f'Scenario {scenario_id}']['global_operational_incomes'][ 'Incomes electricity'].tolist(), 'global_capital_incomes': { 'subsidies_construction': global_capital_incomes['Subsidies construction'].tolist(),