2022-11-02 17:28:51 -04:00
|
|
|
"""
|
|
|
|
Costs Workflow
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Project Author Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
|
|
"""
|
|
|
|
|
2023-04-25 09:22:44 -04:00
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import sys
|
2022-11-02 17:28:51 -04:00
|
|
|
from pathlib import Path
|
2023-04-25 09:22:44 -04:00
|
|
|
import csv
|
|
|
|
|
|
|
|
from hub.imports.construction_factory import ConstructionFactory
|
|
|
|
from hub.imports.usage_factory import UsageFactory
|
|
|
|
from hub.exports.exports_factory import ExportsFactory
|
|
|
|
from hub.exports.energy_building_exports_factory import EnergyBuildingsExportsFactory
|
|
|
|
from hub.helpers.dictionaries import Dictionaries
|
|
|
|
from pathlib import Path
|
|
|
|
from hub.imports.geometry_factory import GeometryFactory
|
2022-11-02 17:28:51 -04:00
|
|
|
from life_cycle_costs import LifeCycleCosts
|
2023-04-25 09:22:44 -04:00
|
|
|
import hub.catalog_factories.costs_catalog_factory as CostCatalogFactory
|
|
|
|
from hub.catalog_factories.cost.montreal_custom_catalog import MontrealCustomCatalog
|
2022-11-02 17:28:51 -04:00
|
|
|
|
2023-04-25 09:22:44 -04:00
|
|
|
file_path = (Path(__file__).parent.parent / 'costs_workflow' / 'input_files' / 'Citylayers_neighbours.geojson')
|
|
|
|
out_path = (Path(__file__).parent.parent / 'costs_workflow' / 'out_files')
|
|
|
|
files = glob.glob(f'{out_path}/*')
|
|
|
|
for file in files:
|
|
|
|
if file != '.gitignore':
|
|
|
|
os.remove(file)
|
2022-11-02 17:28:51 -04:00
|
|
|
|
2023-04-25 09:22:44 -04:00
|
|
|
print('[simulation start]')
|
|
|
|
city = GeometryFactory('geojson',
|
|
|
|
path=file_path,
|
|
|
|
height_field='heightmax',
|
|
|
|
year_of_construction_field='ANNEE_CONS',
|
|
|
|
name_field='OBJECTID_12',
|
|
|
|
function_field='CODE_UTILI',
|
|
|
|
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
|
|
|
print(f'city created from {file_path}')
|
|
|
|
ConstructionFactory('nrcan', city).enrich()
|
|
|
|
print('enrich constructions... done')
|
2022-11-02 17:28:51 -04:00
|
|
|
number_of_years = 40
|
|
|
|
consumer_price_index = 0.1
|
2023-04-25 09:22:44 -04:00
|
|
|
discount_rate=0.06
|
|
|
|
retrofitting_scenario = 1
|
2022-11-02 17:28:51 -04:00
|
|
|
|
2023-04-25 09:22:44 -04:00
|
|
|
lcc = LifeCycleCosts(city, number_of_years, consumer_price_index, discount_rate, retrofitting_scenario)
|
|
|
|
total_capital_costs = lcc.calculate_capital_costs()
|
|
|
|
# end_of_life_costs = lcc.calculate_end_of_life_costs()
|
|
|
|
# total_operational_costs = lcc.calculate_total_operational_costs()
|
|
|
|
# total_maintenance_costs = lcc.calculate_total_maintenance_costs()
|
|
|
|
# life_cycle_costs = total_capital_costs + end_of_life_costs + total_operational_costs + total_maintenance_costs
|
2022-11-02 17:28:51 -04:00
|
|
|
|
|
|
|
print(f'Building name: {building.name}')
|
|
|
|
print(f'Capital costs: {total_capital_costs}')
|
2023-04-25 09:22:44 -04:00
|
|
|
# print(f'End of life costs: {end_of_life_costs}')
|
|
|
|
# print(f'Operational costs: {total_operational_costs}')
|
|
|
|
# print(f'Maintenance costs: {total_maintenance_costs}')
|
|
|
|
# print(f'Life cycle costs: {life_cycle_costs}')
|