2023-07-14 15:37:12 -04:00
|
|
|
"""
|
|
|
|
Total maintenance costs module
|
|
|
|
"""
|
|
|
|
import math
|
|
|
|
import pandas as pd
|
|
|
|
from hub.city_model_structure.building import Building
|
|
|
|
import hub.helpers.constants as cte
|
|
|
|
|
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 TotalMaintenanceCosts(CostBase):
|
2023-07-14 15:37:12 -04:00
|
|
|
"""
|
|
|
|
Total maintenance costs class
|
|
|
|
"""
|
|
|
|
def __init__(self, building: Building, configuration: Configuration):
|
2023-07-14 16:39:47 -04:00
|
|
|
super().__init__(building, configuration)
|
2023-07-14 15:37:12 -04:00
|
|
|
self._yearly_maintenance_costs = pd.DataFrame(
|
2023-07-14 16:39:47 -04:00
|
|
|
index=self._rng,
|
2023-07-14 15:37:12 -04:00
|
|
|
columns=[
|
|
|
|
'Heating_maintenance',
|
|
|
|
'Cooling_maintenance',
|
|
|
|
'PV_maintenance'
|
|
|
|
],
|
|
|
|
dtype='float'
|
|
|
|
)
|
|
|
|
|
|
|
|
def calculate(self) -> pd.DataFrame:
|
|
|
|
"""
|
|
|
|
Calculate total maintenance costs
|
|
|
|
:return: pd.DataFrame
|
|
|
|
"""
|
|
|
|
building = self._building
|
|
|
|
archetype = self._archetype
|
|
|
|
# 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
|
|
|
|
|
2023-07-17 15:35:21 -04:00
|
|
|
peak_heating = building.heating_peak_load[cte.YEAR][0]
|
|
|
|
peak_cooling = building.cooling_peak_load[cte.YEAR][0]
|
2023-07-14 15:37:12 -04:00
|
|
|
|
|
|
|
maintenance_heating_0 = peak_heating * archetype.operational_cost.maintenance_heating
|
|
|
|
maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling
|
|
|
|
maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv
|
|
|
|
|
|
|
|
for year in range(1, self._configuration.number_of_years + 1):
|
|
|
|
costs_increase = math.pow(1 + self._configuration.consumer_price_index, year)
|
|
|
|
self._yearly_maintenance_costs.loc[year, 'Heating_maintenance'] = (
|
|
|
|
maintenance_heating_0 * costs_increase
|
|
|
|
)
|
|
|
|
self._yearly_maintenance_costs.loc[year, 'Cooling_maintenance'] = (
|
|
|
|
maintenance_cooling_0 * costs_increase
|
|
|
|
)
|
|
|
|
self._yearly_maintenance_costs.loc[year, 'PV_maintenance'] = (
|
|
|
|
maintenance_pv_0 * costs_increase
|
|
|
|
)
|
|
|
|
self._yearly_maintenance_costs.fillna(0, inplace=True)
|
|
|
|
return self._yearly_maintenance_costs
|