Main changed to incorporate NPV calculation for life cycle costs. Excel creation per building
This commit is contained in:
parent
520f0ee7a9
commit
b49fbcf4f4
|
@ -172,7 +172,7 @@ class LifeCycleCosts:
|
||||||
for year in range(1, self._number_of_years + 1):
|
for year in range(1, self._number_of_years + 1):
|
||||||
price_increase += math.pow(1 + self._consumer_price_index, year)
|
price_increase += math.pow(1 + self._consumer_price_index, year)
|
||||||
if year == self._number_of_years:
|
if year == self._number_of_years:
|
||||||
self._end_of_life_cost = total_floor_area * archetype.end_of_life_cost*price_increase
|
self._end_of_life_cost[year]['End_of_life_costs'] = total_floor_area * archetype.end_of_life_cost*price_increase
|
||||||
return self._end_of_life_cost
|
return self._end_of_life_cost
|
||||||
|
|
||||||
def calculate_total_operational_costs(self):
|
def calculate_total_operational_costs(self):
|
||||||
|
|
60
main.py
60
main.py
|
@ -9,6 +9,7 @@ import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
from hub.imports.construction_factory import ConstructionFactory
|
from hub.imports.construction_factory import ConstructionFactory
|
||||||
|
@ -26,6 +27,10 @@ from energy_systems_sizing import EnergySystemsSizing
|
||||||
|
|
||||||
from life_cycle_costs import LifeCycleCosts
|
from life_cycle_costs import LifeCycleCosts
|
||||||
|
|
||||||
|
def _npv_from_list(discount_rate, list_cashflow):
|
||||||
|
lcc_value = np.npv(discount_rate,list_cashflow)
|
||||||
|
raise KeyError('bad inputs')
|
||||||
|
|
||||||
def _search_archetype(costs_catalog, building_function):
|
def _search_archetype(costs_catalog, building_function):
|
||||||
costs_archetypes = costs_catalog.entries('archetypes').archetypes
|
costs_archetypes = costs_catalog.entries('archetypes').archetypes
|
||||||
for building_archetype in costs_archetypes:
|
for building_archetype in costs_archetypes:
|
||||||
|
@ -127,18 +132,49 @@ for retrofitting_scenario in retrofitting_scenarios:
|
||||||
lcc = LifeCycleCosts(building, archetype, number_of_years, consumer_price_index, electricity_peak_index,
|
lcc = LifeCycleCosts(building, archetype, number_of_years, consumer_price_index, electricity_peak_index,
|
||||||
electricity_price_index, gas_price_index, discount_rate, retrofitting_scenario)
|
electricity_price_index, gas_price_index, discount_rate, retrofitting_scenario)
|
||||||
|
|
||||||
total_capital_costs = lcc.calculate_capital_costs()
|
df_capital_costs_skin = lcc.calculate_capital_costs()['B2010_opaque_walls']+\
|
||||||
print(f'total capital costs {total_capital_costs}')
|
lcc.calculate_capital_costs()['B2020_transparent']+\
|
||||||
end_of_life_costs = lcc.calculate_end_of_life_costs()
|
lcc.calculate_capital_costs()['B3010_opaque_roof']+\
|
||||||
total_operational_costs = lcc.calculate_total_operational_costs()
|
lcc.calculate_capital_costs()['B10_superstructure']
|
||||||
total_maintenance_costs = lcc.calculate_total_maintenance_costs()
|
df_capital_costs_systems = lcc.calculate_capital_costs()['D3020_heat_generating_systems']+\
|
||||||
life_cycle_costs = total_capital_costs + end_of_life_costs + total_operational_costs + total_maintenance_costs
|
lcc.calculate_capital_costs()['D3030_cooling_generation_systems']+\
|
||||||
life_cycle_results[f'Scenario {retrofitting_scenario}'] = [total_capital_costs, end_of_life_costs,
|
lcc.calculate_capital_costs()['D3080_other_hvac_ahu']+\
|
||||||
total_operational_costs, total_maintenance_costs,
|
lcc.calculate_capital_costs()['D5020_lighting_and_branch_wiring']+\
|
||||||
life_cycle_costs]
|
lcc.calculate_capital_costs()['D301010_photovoltaic_system']
|
||||||
|
df_end_of_life_costs = lcc.calculate_end_of_life_costs()['End_of_life_costs']
|
||||||
|
df_operational_costs = lcc.calculate_total_operational_costs()['Fixed_costs_electricity_peak']+\
|
||||||
|
lcc.calculate_total_operational_costs()['Fixed_costs_electricity_monthly']+\
|
||||||
|
lcc.calculate_total_operational_costs()['Fixed_costs_electricity_peak']+\
|
||||||
|
lcc.calculate_total_operational_costs()['Fixed_costs_electricity_monthly']+\
|
||||||
|
lcc.calculate_total_operational_costs()['Variable_costs_electricity']+ \
|
||||||
|
lcc.calculate_total_operational_costs()['Fixed_costs_gas']+ \
|
||||||
|
lcc.calculate_total_operational_costs()['Variable_costs_gas']
|
||||||
|
df_maintenance_costs = lcc.calculate_total_operational_costs()['Heating_maintenance']+\
|
||||||
|
lcc.calculate_total_operational_costs()['Cooling_maintenance']+\
|
||||||
|
lcc.calculate_total_operational_costs()['PV_maintenance']
|
||||||
|
df_operational_incomes = lcc.calculate_total_operational_incomes()['Incomes electricity']
|
||||||
|
|
||||||
life_cycle_results.index = ['total_capital_costs','end_of_life_costs', 'total_operational_costs',
|
life_cycle_costs_capital_skin=_npv_from_list(discount_rate , df_capital_costs_skin.values.tolist())
|
||||||
'total_maintenance_costs','life_cycle_costs']
|
life_cycle_costs_capital_systems=_npv_from_list(discount_rate , df_capital_costs_systems.values.tolist())
|
||||||
|
life_cycle_costs_end_of_life_costs = _npv_from_list(discount_rate, df_end_of_life_costs.values.tolist())
|
||||||
|
life_cycle_operational_costs = _npv_from_list(discount_rate, df_operational_costs.values.tolist())
|
||||||
|
life_cycle_maintenance_costs = _npv_from_list(discount_rate, df_maintenance_costs.values.tolist())
|
||||||
|
life_cycle_operational_incomes = _npv_from_list(discount_rate, df_operational_incomes.values.tolist())
|
||||||
|
|
||||||
life_cycle_results.to_excel(Path(__file__).parent/'out_files'/'Results.xlsx', index=True)
|
life_cycle_costs = life_cycle_costs_capital_skin + life_cycle_costs_capital_systems + \
|
||||||
|
life_cycle_costs_end_of_life_costs + life_cycle_operational_costs + \
|
||||||
|
life_cycle_maintenance_costs - life_cycle_operational_incomes
|
||||||
|
|
||||||
|
life_cycle_results[f'Scenario {retrofitting_scenario}'] = [life_cycle_costs_capital_skin,
|
||||||
|
life_cycle_costs_capital_systems ,
|
||||||
|
life_cycle_costs_end_of_life_costs,
|
||||||
|
life_cycle_operational_costs,
|
||||||
|
life_cycle_maintenance_costs,
|
||||||
|
life_cycle_operational_incomes]
|
||||||
|
|
||||||
|
life_cycle_results.index = ['total_capital_costs_skin','total_capital_costs_systems','end_of_life_costs',
|
||||||
|
'total_operational_costs','total_maintenance_costs','life_cycle_costs',
|
||||||
|
'maintenance_costs']
|
||||||
|
|
||||||
|
life_cycle_results.to_excel(Path(__file__).parent/'out_files'/f'Results{building.name}.xlsx', index=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user