costs_workflow/costs/end_of_life_costs.py

35 lines
1.1 KiB
Python
Raw Normal View History

2023-07-14 15:37:12 -04:00
"""
End of life costs module
"""
import math
import pandas as pd
from hub.city_model_structure.building import Building
2023-07-17 14:35:12 -04:00
from costs.configuration import Configuration
2023-07-14 16:39:47 -04:00
from costs.cost_base import CostBase
2023-07-14 15:37:12 -04:00
2023-07-14 16:39:47 -04:00
class EndOfLifeCosts(CostBase):
2023-07-14 15:37:12 -04:00
"""
End of life costs class
"""
def __init__(self, building: Building, configuration: Configuration):
2023-07-14 16:39:47 -04:00
super().__init__(building, configuration)
self._yearly_end_of_life_costs = pd.DataFrame(index=self._rng, columns=['End_of_life_costs'], dtype='float')
2023-07-14 15:37:12 -04:00
def calculate(self):
"""
Calculate end of life costs
:return: pd.DataFrame
"""
archetype = self._archetype
total_floor_area = self._total_floor_area
for year in range(1, self._configuration.number_of_years + 1):
price_increase = math.pow(1 + self._configuration.consumer_price_index, year)
if year == self._configuration.number_of_years:
self._yearly_end_of_life_costs.at[year, 'End_of_life_costs'] = (
total_floor_area * archetype.end_of_life_cost * price_increase
)
self._yearly_end_of_life_costs.fillna(0, inplace=True)
return self._yearly_end_of_life_costs