2022-11-02 17:28:51 -04:00
|
|
|
"""
|
|
|
|
LifeCycleCosts calculates the life cycle costs of one building
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Project Author Pilar Monsalvete Alvarez de Uribarri pilar_monsalvete@concordia.ca
|
|
|
|
"""
|
|
|
|
import math
|
2023-01-11 04:56:02 -05:00
|
|
|
from capital_cost import CapitalCost
|
2022-11-02 17:28:51 -04:00
|
|
|
|
2023-01-18 10:24:29 -05:00
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
class LifeCycleCosts:
|
|
|
|
|
|
|
|
# todo: this should be (city, costs_catalog) or similar
|
|
|
|
def __init__(self, building, number_of_years, consumer_price_index, discount_rate, end_of_life_cost,
|
|
|
|
capital_costs_at_year_0, items, fuels, concepts):
|
|
|
|
self._building = building
|
|
|
|
self._number_of_years = number_of_years
|
|
|
|
self._consumer_price_index = consumer_price_index
|
|
|
|
self._discount_rate = discount_rate
|
|
|
|
|
|
|
|
self._end_of_life_cost = end_of_life_cost
|
|
|
|
|
|
|
|
self._capital_costs_at_year_0 = capital_costs_at_year_0
|
|
|
|
self._items = items
|
|
|
|
|
|
|
|
self._fuels = fuels
|
|
|
|
|
|
|
|
self._concepts = concepts
|
|
|
|
|
2023-01-18 10:24:29 -05:00
|
|
|
|
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
def calculate_capital_costs(self):
|
|
|
|
total_capital_costs = self._capital_costs_at_year_0
|
|
|
|
for year in range(1, self._number_of_years + 1):
|
|
|
|
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
for item in self._items:
|
|
|
|
total_capital_costs += item.reposition_costs[year] * costs_increase
|
|
|
|
return total_capital_costs
|
|
|
|
|
|
|
|
def calculate_end_of_life_costs(self):
|
|
|
|
price_increase = 0
|
|
|
|
for year in range(1, self._number_of_years + 1):
|
|
|
|
price_increase += math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
return self._end_of_life_cost * price_increase
|
|
|
|
|
|
|
|
def calculate_total_operational_costs(self):
|
|
|
|
total_operational_costs = 0
|
|
|
|
for year in range(1, self._number_of_years + 1):
|
|
|
|
for fuel in self._fuels:
|
|
|
|
total_operational_costs += fuel.operational_cost \
|
|
|
|
* math.pow(1 + fuel.energy_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
return total_operational_costs
|
|
|
|
|
|
|
|
def calculate_total_maintenance_costs(self):
|
|
|
|
total_maintenance_costs = 0
|
|
|
|
for year in range(1, self._number_of_years + 1):
|
|
|
|
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
for concept in self._concepts:
|
|
|
|
total_maintenance_costs += concept.mantainance_costs * costs_increase
|
|
|
|
return total_maintenance_costs
|
2023-01-11 04:56:02 -05:00
|
|
|
|
2023-01-18 10:24:29 -05:00
|
|
|
def capital_cost(one_building, content):
|
|
|
|
# print(len(one_building.internal_zones))
|
|
|
|
building_volume = 0.0
|
|
|
|
building_area = 0.0
|
|
|
|
for internal_zone in one_building.internal_zones:
|
|
|
|
building_area += internal_zone.area
|
|
|
|
building_volume += internal_zone.volume
|
|
|
|
# print("area of the building ", building_area)
|
|
|
|
# print("volume of the building ", building_volume)
|
|
|
|
CapitalCost.calculate_capital_cost(building_area, building_volume, content)
|