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-28 18:25:57 -05:00
|
|
|
from pathlib import Path
|
|
|
|
from imports.geometry_factory import GeometryFactory
|
|
|
|
from costs_workflow.capital_cost import CapitalCost
|
|
|
|
from catalog_factories.costs_catalog_factory import CostCatalogFactory
|
|
|
|
from imports.construction_factory import ConstructionFactory
|
2023-01-18 10:24:29 -05:00
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
class LifeCycleCosts:
|
|
|
|
|
2023-01-28 18:25:57 -05:00
|
|
|
number_of_years = 40
|
|
|
|
consumer_price_index = 0.1
|
|
|
|
catalog = CostCatalogFactory('montreal_catalog').catalog
|
|
|
|
content = catalog.entries()
|
|
|
|
construction_format = 'nrel'
|
|
|
|
usage_format = 'comnet'
|
|
|
|
base_path = Path(Path(__file__).parent / 'unittests/tests_data')
|
|
|
|
gml_file = str(base_path / 'one_building_in_kelowna.gml')
|
|
|
|
city = GeometryFactory('citygml', gml_file).city
|
|
|
|
for building in city.buildings:
|
|
|
|
building.year_of_construction = 2006
|
|
|
|
ConstructionFactory(construction_format, city).enrich()
|
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
# 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
|
2023-01-11 04:56:02 -05:00
|
|
|
|
2023-01-28 18:25:57 -05:00
|
|
|
def calculate_capitalcost(self, city):
|
|
|
|
for building in city.buildings:
|
|
|
|
# municipality = "montreal"
|
|
|
|
lcc.calculate_capitalcost(building, municipality, content)
|
2023-01-18 10:24:29 -05:00
|
|
|
building_volume = 0.0
|
|
|
|
building_area = 0.0
|
2023-01-28 18:25:57 -05:00
|
|
|
total_opaque_area = 0.0
|
|
|
|
total_transparent_area = 0.0
|
2023-01-18 10:24:29 -05:00
|
|
|
for internal_zone in one_building.internal_zones:
|
2023-01-28 18:25:57 -05:00
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
|
|
if thermal_boundary.opaque_area is not None:
|
|
|
|
total_opaque_area += thermal_boundary.opaque_area
|
|
|
|
if thermal_boundary.windows_areas is not None:
|
|
|
|
total_transparent_area += thermal_boundary.windows_areas
|
|
|
|
|
|
|
|
|
2023-01-18 10:24:29 -05:00
|
|
|
building_area += internal_zone.area
|
|
|
|
building_volume += internal_zone.volume
|
2023-01-28 18:25:57 -05:00
|
|
|
# print("Total building_volume ", building_volume)
|
|
|
|
# print("Total building_area ", building_area)
|
|
|
|
# print("Total opaque_area ", total_opaque_area)
|
|
|
|
|
|
|
|
CapitalCost.calculate_capital_cost(building_area, municipality, building_volume, total_opaque_area, total_transparent_area, content)
|