costs_workflow/life_cycle_costs.py

57 lines
2.2 KiB
Python

"""
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
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
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