2022-11-02 17:28:51 -04:00
|
|
|
"""
|
2023-06-01 14:07:41 -04:00
|
|
|
Life cycle costs module
|
2022-11-02 17:28:51 -04:00
|
|
|
"""
|
2023-04-26 16:26:06 -04:00
|
|
|
|
2023-06-01 14:07:41 -04:00
|
|
|
from hub.city_model_structure.building import Building
|
|
|
|
from configuration import Configuration
|
2023-04-27 10:20:14 -04:00
|
|
|
|
2023-05-02 10:49:53 -04:00
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
class LifeCycleCosts:
|
2023-05-31 12:20:03 -04:00
|
|
|
"""
|
2023-06-01 14:07:41 -04:00
|
|
|
Life cycle costs class
|
2023-05-31 12:20:03 -04:00
|
|
|
"""
|
2023-06-01 14:07:41 -04:00
|
|
|
def __init__(self, building: Building, configuration: Configuration):
|
2023-04-25 11:49:17 -04:00
|
|
|
self._building = building
|
2023-06-01 14:07:41 -04:00
|
|
|
self._configuration = configuration
|
2023-04-27 10:20:14 -04:00
|
|
|
self._total_floor_area = 0
|
|
|
|
for internal_zone in building.internal_zones:
|
2023-05-30 14:42:49 -04:00
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
self._total_floor_area += thermal_zone.total_floor_area
|
2023-04-27 10:20:14 -04:00
|
|
|
|
2023-06-01 14:07:41 -04:00
|
|
|
self._archetype = None
|
|
|
|
for archetype in self._configuration.cost_catalog.entries('archetypes').archetype:
|
|
|
|
if str(building.function) == str(archetype.function):
|
|
|
|
self._archetype = archetype
|
|
|
|
break
|
|
|
|
if not self._archetype:
|
|
|
|
raise KeyError('archetype not found')
|
2023-05-31 12:53:59 -04:00
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
def calculate_capital_costs(self):
|
2023-05-31 12:20:03 -04:00
|
|
|
"""
|
|
|
|
Calculate capital cost
|
|
|
|
:return: pd.DataFrame
|
|
|
|
"""
|
2023-04-25 11:49:17 -04:00
|
|
|
surface_opaque = 0
|
|
|
|
surface_transparent = 0
|
2023-04-25 18:33:09 -04:00
|
|
|
surface_roof = 0
|
|
|
|
surface_ground = 0
|
2023-05-31 12:26:01 -04:00
|
|
|
capital_cost_pv = 0
|
|
|
|
capital_cost_opaque = 0
|
|
|
|
capital_cost_ground = 0
|
|
|
|
capital_cost_transparent = 0
|
|
|
|
capital_cost_roof = 0
|
|
|
|
capital_cost_heating_equipment = 0
|
|
|
|
capital_cost_cooling_equipment = 0
|
|
|
|
capital_cost_distribution_equipment = 0
|
|
|
|
capital_cost_other_hvac_ahu = 0
|
|
|
|
capital_cost_lighting = 0
|
|
|
|
|
2023-06-01 14:07:41 -04:00
|
|
|
total_floor_area = self._building.floor_area
|
2023-04-25 11:49:17 -04:00
|
|
|
|
|
|
|
for internal_zone in building.internal_zones:
|
2023-05-30 14:42:49 -04:00
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
|
|
if thermal_boundary.type == 'Ground':
|
|
|
|
surface_ground += thermal_boundary.opaque_area
|
|
|
|
elif thermal_boundary.type == 'Roof':
|
|
|
|
surface_roof += thermal_boundary.opaque_area
|
|
|
|
elif thermal_boundary.type == 'Wall':
|
|
|
|
surface_opaque += thermal_boundary.opaque_area * (1 - thermal_boundary.window_ratio)
|
|
|
|
surface_transparent += thermal_boundary.opaque_area * thermal_boundary.window_ratio
|
2023-04-25 11:49:17 -04:00
|
|
|
|
2023-04-25 18:33:09 -04:00
|
|
|
chapters = archetype.capital_cost
|
2023-04-27 10:20:14 -04:00
|
|
|
|
2023-05-31 11:23:23 -04:00
|
|
|
peak_heating = building.heating_peak_load[cte.YEAR].values[0]/1000
|
|
|
|
peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]/1000
|
2023-05-30 15:08:11 -04:00
|
|
|
# todo: change area pv when the variable exists
|
|
|
|
roof_area = 0
|
|
|
|
for roof in building.roofs:
|
|
|
|
roof_area += roof.solid_polygon.area
|
|
|
|
surface_pv = roof_area * 0.5
|
|
|
|
|
|
|
|
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0]['B2020_transparent'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0]['B10_superstructure'] = 0
|
|
|
|
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = 0
|
|
|
|
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = 0
|
|
|
|
|
2023-05-31 12:26:01 -04:00
|
|
|
self._yearly_capital_incomes.loc[0, 'Subsidies construction'] = 0
|
|
|
|
self._yearly_capital_incomes.loc[0, 'Subsidies HVAC'] = 0
|
|
|
|
self._yearly_capital_incomes.loc[0, 'Subsidies PV'] = 0
|
|
|
|
|
2023-05-30 14:42:49 -04:00
|
|
|
self._yearly_capital_costs.fillna(0, inplace=True)
|
2023-05-31 12:20:03 -04:00
|
|
|
if self._retrofitting_scenario in (SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
2023-04-25 11:49:17 -04:00
|
|
|
chapter = chapters.chapter('B_shell')
|
|
|
|
capital_cost_opaque = surface_opaque * chapter.item('B2010_opaque_walls').refurbishment[0]
|
|
|
|
capital_cost_transparent = surface_transparent * chapter.item('B2020_transparent').refurbishment[0]
|
2023-04-25 18:33:09 -04:00
|
|
|
capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0]
|
|
|
|
capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0]
|
2023-05-31 12:26:01 -04:00
|
|
|
|
|
|
|
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = capital_cost_opaque * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0]['B2020_transparent'] = capital_cost_transparent * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = capital_cost_roof * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0]['B10_superstructure'] = capital_cost_ground * (1-PERCENTAGE_CREDIT)
|
2023-05-31 12:26:01 -04:00
|
|
|
|
2023-05-27 09:32:42 -04:00
|
|
|
|
2023-05-31 12:20:03 -04:00
|
|
|
if self._retrofitting_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
2023-04-25 18:33:09 -04:00
|
|
|
chapter = chapters.chapter('D_services')
|
2023-05-27 09:32:42 -04:00
|
|
|
capital_cost_pv = surface_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0]
|
|
|
|
self._yearly_capital_costs.loc[0]['D301010_photovoltaic_system'] = capital_cost_pv
|
2023-05-30 15:08:11 -04:00
|
|
|
capital_cost_heating_equipment = (
|
|
|
|
peak_heating * chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
|
|
|
)
|
|
|
|
capital_cost_cooling_equipment = (
|
|
|
|
peak_cooling * chapter.item('D3030_cooling_generation_systems').initial_investment[0]
|
|
|
|
)
|
|
|
|
capital_cost_distribution_equipment = (
|
|
|
|
peak_cooling * chapter.item('D3040_distribution_systems').initial_investment[0]
|
|
|
|
)
|
2023-04-27 10:20:14 -04:00
|
|
|
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
2023-05-29 22:10:43 -04:00
|
|
|
capital_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
2023-05-31 12:26:01 -04:00
|
|
|
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = capital_cost_heating_equipment * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = capital_cost_cooling_equipment * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = capital_cost_distribution_equipment * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = capital_cost_other_hvac_ahu * (1-PERCENTAGE_CREDIT)
|
|
|
|
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = capital_cost_lighting * (1-PERCENTAGE_CREDIT)
|
2023-04-25 21:00:19 -04:00
|
|
|
|
2023-05-29 22:10:43 -04:00
|
|
|
for year in range(1, self._number_of_years):
|
2023-04-25 21:00:19 -04:00
|
|
|
chapter = chapters.chapter('D_services')
|
2023-05-31 10:38:16 -04:00
|
|
|
costs_increase = math.pow(1 + self._consumer_price_index, year)
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[year, 'B2010_opaque_walls'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_opaque * (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'B2020_transparent'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_transparent * (PERCENTAGE_CREDIT)
|
|
|
|
)
|
|
|
|
self._yearly_capital_costs.loc[year, 'B3010_opaque_roof'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,capital_cost_roof
|
|
|
|
* (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'B10_superstructure'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_ground * (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] = -npf.pmt(INTEREST_RATE,CREDIT_YEARS,
|
|
|
|
capital_cost_heating_equipment
|
|
|
|
* (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_cooling_equipment
|
|
|
|
* (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'D3040_distribution_systems'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_distribution_equipment
|
|
|
|
* (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'D3080_other_hvac_ahu'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_other_hvac_ahu
|
|
|
|
* (PERCENTAGE_CREDIT))
|
|
|
|
self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
|
|
capital_cost_lighting
|
|
|
|
* (PERCENTAGE_CREDIT))
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
|
|
|
* costs_increase
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] += reposition_cost_heating_equipment
|
2023-05-27 09:32:42 -04:00
|
|
|
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0:
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_cooling_equipment = peak_cooling \
|
|
|
|
* chapter.item('D3030_cooling_generation_systems').reposition[0] \
|
|
|
|
* costs_increase
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] += reposition_cost_cooling_equipment
|
2023-05-27 09:32:42 -04:00
|
|
|
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D3080_other_hvac_ahu').lifetime) == 0:
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').reposition[0] * costs_increase
|
2023-05-30 14:42:49 -04:00
|
|
|
self._yearly_capital_costs.loc[year, 'D3080_other_hvac_ahu'] = reposition_cost_hvac_ahu
|
2023-05-27 09:32:42 -04:00
|
|
|
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D5020_lighting_and_branch_wiring').lifetime) == 0:
|
2023-04-26 16:26:06 -04:00
|
|
|
reposition_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \
|
|
|
|
* costs_increase
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] += reposition_cost_lighting
|
2023-05-27 09:32:42 -04:00
|
|
|
|
2023-05-31 12:20:03 -04:00
|
|
|
if self._retrofitting_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
2023-05-29 08:06:58 -04:00
|
|
|
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
|
2023-06-01 08:41:10 -04:00
|
|
|
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] += surface_pv \
|
2023-05-30 14:42:49 -04:00
|
|
|
* chapter.item(
|
|
|
|
'D301010_photovoltaic_system').reposition[0] * costs_increase
|
2023-05-31 12:26:01 -04:00
|
|
|
capital_cost_skin = capital_cost_opaque + capital_cost_ground + capital_cost_transparent + capital_cost_roof
|
2023-05-31 12:53:59 -04:00
|
|
|
capital_cost_hvac = (
|
|
|
|
capital_cost_heating_equipment +
|
|
|
|
capital_cost_cooling_equipment +
|
|
|
|
capital_cost_distribution_equipment +
|
|
|
|
capital_cost_other_hvac_ahu + capital_cost_lighting
|
|
|
|
)
|
2023-05-31 12:26:01 -04:00
|
|
|
|
2023-05-31 12:53:59 -04:00
|
|
|
self._yearly_capital_incomes.loc[0, 'Subsidies construction'] = (
|
|
|
|
capital_cost_skin * archetype.income.construction_subsidy/100
|
|
|
|
)
|
2023-05-31 12:26:01 -04:00
|
|
|
self._yearly_capital_incomes.loc[0, 'Subsidies HVAC'] = capital_cost_hvac * archetype.income.hvac_subsidy/100
|
|
|
|
self._yearly_capital_incomes.loc[0, 'Subsidies PV'] = capital_cost_pv * archetype.income.photovoltaic_subsidy/100
|
|
|
|
self._yearly_capital_incomes.fillna(0, inplace=True)
|
|
|
|
return self._yearly_capital_costs, self._yearly_capital_incomes
|