76 lines
2.6 KiB
Python
76 lines
2.6 KiB
Python
|
"""
|
||
|
Total maintenance costs module
|
||
|
"""
|
||
|
import math
|
||
|
import pandas as pd
|
||
|
from hub.city_model_structure.building import Building
|
||
|
import hub.helpers.constants as cte
|
||
|
|
||
|
from configuration import Configuration
|
||
|
|
||
|
|
||
|
class TotalMaintenanceCosts:
|
||
|
"""
|
||
|
Total maintenance costs class
|
||
|
"""
|
||
|
def __init__(self, building: Building, configuration: Configuration):
|
||
|
self._building = building
|
||
|
self._configuration = configuration
|
||
|
self._total_floor_area = 0
|
||
|
for internal_zone in building.internal_zones:
|
||
|
for thermal_zone in internal_zone.thermal_zones:
|
||
|
self._total_floor_area += thermal_zone.total_floor_area
|
||
|
self._archetype = None
|
||
|
for archetype in self._configuration.cost_catalog.entries('archetypes').archetype:
|
||
|
if str(building.function) == str(archetype.function):
|
||
|
self._archetype = archetype
|
||
|
self._capital_costs_chapter = self._archetype.capital_cost
|
||
|
break
|
||
|
if not self._archetype:
|
||
|
raise KeyError('archetype not found')
|
||
|
|
||
|
rng = range(configuration.number_of_years)
|
||
|
self._yearly_maintenance_costs = pd.DataFrame(
|
||
|
index=rng,
|
||
|
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
|
||
|
|
||
|
peak_heating = building.heating_peak_load[cte.YEAR][cte.HEATING_PEAK_LOAD][0]
|
||
|
peak_cooling = building.cooling_peak_load[cte.YEAR][cte.COOLING_PEAK_LOAD][0]
|
||
|
|
||
|
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
|