partial refactor
This commit is contained in:
parent
df45fc056c
commit
d597ec41af
@ -5,9 +5,6 @@ import glob
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# constant
|
|
||||||
|
|
||||||
|
|
||||||
# to remove
|
# to remove
|
||||||
|
|
||||||
file_path = Path('./data/selected_building_2864.geojson').resolve()
|
file_path = Path('./data/selected_building_2864.geojson').resolve()
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
"""
|
"""
|
||||||
Life cycle costs module
|
Life cycle costs module
|
||||||
"""
|
"""
|
||||||
|
import math
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import numpy_financial as npf
|
||||||
from hub.city_model_structure.building import Building
|
from hub.city_model_structure.building import Building
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
from configuration import Configuration
|
from configuration import Configuration
|
||||||
|
from costs import SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV, SYSTEM_RETROFIT_AND_PV
|
||||||
|
|
||||||
|
|
||||||
class LifeCycleCosts:
|
class LifeCycleCosts:
|
||||||
@ -109,69 +113,78 @@ class LifeCycleCosts:
|
|||||||
surface_pv += roof.solid_polygon.area * roof.solar_collectors_area_reduction_factor
|
surface_pv += roof.solid_polygon.area * roof.solar_collectors_area_reduction_factor
|
||||||
|
|
||||||
self._yearly_capital_costs.fillna(0, inplace=True)
|
self._yearly_capital_costs.fillna(0, inplace=True)
|
||||||
if self._retrofitting_scenario in (SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
own_capital = (1 - self._configuration.percentage_credit)
|
||||||
chapter = chapters.chapter('B_shell')
|
if self._retrofit_scenario in (SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
||||||
|
chapter = self._capital_costs_chapter.chapter('B_shell')
|
||||||
capital_cost_opaque = surface_opaque * chapter.item('B2010_opaque_walls').refurbishment[0]
|
capital_cost_opaque = surface_opaque * chapter.item('B2010_opaque_walls').refurbishment[0]
|
||||||
capital_cost_transparent = surface_transparent * chapter.item('B2020_transparent').refurbishment[0]
|
capital_cost_transparent = surface_transparent * chapter.item('B2020_transparent').refurbishment[0]
|
||||||
capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0]
|
capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0]
|
||||||
capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0]
|
capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0]
|
||||||
|
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = capital_cost_opaque * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0]['B2020_transparent'] = capital_cost_transparent * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = capital_cost_roof * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0]['B10_superstructure'] = capital_cost_ground * own_capital
|
||||||
|
|
||||||
|
if self._retrofit_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
||||||
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = capital_cost_opaque * (1-PERCENTAGE_CREDIT)
|
chapter = self._capital_costs_chapter.chapter('D_services')
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
if self._retrofitting_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
|
||||||
chapter = chapters.chapter('D_services')
|
|
||||||
capital_cost_pv = surface_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0]
|
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
|
capital_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
||||||
capital_cost_heating_equipment = (
|
capital_cost_cooling_equipment = peak_cooling * chapter.item('D3030_cooling_generation_systems').initial_investment[0]
|
||||||
peak_heating * chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
capital_cost_distribution_equipment = peak_cooling * chapter.item('D3040_distribution_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]
|
|
||||||
)
|
|
||||||
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
||||||
capital_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
capital_cost_lighting = self._total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
||||||
|
self._yearly_capital_costs.loc[0]['D301010_photovoltaic_system'] = capital_cost_pv
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = capital_cost_heating_equipment * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = capital_cost_cooling_equipment * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = capital_cost_distribution_equipment * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = capital_cost_other_hvac_ahu * own_capital
|
||||||
|
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = capital_cost_lighting * own_capital
|
||||||
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = capital_cost_heating_equipment * (1-PERCENTAGE_CREDIT)
|
for year in range(1, self._configuration.number_of_years):
|
||||||
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = capital_cost_cooling_equipment * (1-PERCENTAGE_CREDIT)
|
chapter = self._capital_costs_chapter.chapter('D_services')
|
||||||
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = capital_cost_distribution_equipment * (1-PERCENTAGE_CREDIT)
|
costs_increase = math.pow(1 + self._configuration.consumer_price_index, year)
|
||||||
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = capital_cost_other_hvac_ahu * (1-PERCENTAGE_CREDIT)
|
self._yearly_capital_costs.loc[year, 'B2010_opaque_walls'] = (
|
||||||
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = capital_cost_lighting * (1-PERCENTAGE_CREDIT)
|
-npf.pmt(
|
||||||
|
self._configuration.interest_rate,
|
||||||
for year in range(1, self._number_of_years):
|
self._configuration.credit_years,
|
||||||
chapter = chapters.chapter('D_services')
|
capital_cost_opaque * self._configuration.percentage_credit
|
||||||
costs_increase = math.pow(1 + self._consumer_price_index, year)
|
|
||||||
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, 'B2020_transparent'] = (
|
||||||
self._yearly_capital_costs.loc[year, 'B10_superstructure'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
-npf.pmt(
|
||||||
capital_cost_ground * (PERCENTAGE_CREDIT))
|
self._configuration.interest_rate,
|
||||||
self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] = -npf.pmt(INTEREST_RATE,CREDIT_YEARS,
|
self._configuration.credit_years,
|
||||||
|
capital_cost_transparent * self._configuration.percentage_credit
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self._yearly_capital_costs.loc[year, 'B3010_opaque_roof'] = (
|
||||||
|
-npf.pmt(
|
||||||
|
self._configuration.interest_rate,
|
||||||
|
self._configuration.credit_years,capital_cost_roof * self._configuration.percentage_credit
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self._yearly_capital_costs.loc[year, 'B10_superstructure'] = (
|
||||||
|
-npf.pmt(
|
||||||
|
self._configuration.interest_rate,
|
||||||
|
self._configuration.credit_years,
|
||||||
|
capital_cost_ground * self._configuration.percentage_credit
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] = -npf.pmt(self._configuration.interest_rate,self._configuration.credit_years,
|
||||||
capital_cost_heating_equipment
|
capital_cost_heating_equipment
|
||||||
* (PERCENTAGE_CREDIT))
|
* (self._configuration.percentage_credit))
|
||||||
self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] = -npf.pmt(self._configuration.interest_rate, self._configuration.credit_years,
|
||||||
capital_cost_cooling_equipment
|
capital_cost_cooling_equipment
|
||||||
* (PERCENTAGE_CREDIT))
|
* (self._configuration.percentage_credit))
|
||||||
self._yearly_capital_costs.loc[year, 'D3040_distribution_systems'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
self._yearly_capital_costs.loc[year, 'D3040_distribution_systems'] = -npf.pmt(self._configuration.interest_rate, self._configuration.credit_years,
|
||||||
capital_cost_distribution_equipment
|
capital_cost_distribution_equipment
|
||||||
* (PERCENTAGE_CREDIT))
|
* (self._configuration.percentage_credit))
|
||||||
self._yearly_capital_costs.loc[year, 'D3080_other_hvac_ahu'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
self._yearly_capital_costs.loc[year, 'D3080_other_hvac_ahu'] = -npf.pmt(self._configuration.interest_rate, self._configuration.credit_years,
|
||||||
capital_cost_other_hvac_ahu
|
capital_cost_other_hvac_ahu
|
||||||
* (PERCENTAGE_CREDIT))
|
* (self._configuration.percentage_credit))
|
||||||
self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] = -npf.pmt(self._configuration.interest_rate, self._configuration.credit_years,
|
||||||
capital_cost_lighting
|
capital_cost_lighting
|
||||||
* (PERCENTAGE_CREDIT))
|
* (self._configuration.percentage_credit))
|
||||||
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
||||||
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
||||||
* costs_increase
|
* costs_increase
|
||||||
|
Loading…
Reference in New Issue
Block a user