Bugfixing in packet
This commit is contained in:
parent
890171dc3a
commit
d3bdf3d485
@ -1,32 +1,9 @@
|
||||
"""
|
||||
Cost workflow initialization
|
||||
"""
|
||||
import glob
|
||||
import os
|
||||
from pathlib import Path
|
||||
from .capital_costs import CapitalCosts
|
||||
from .end_of_life_costs import EndOfLifeCosts
|
||||
from .total_maintenance_costs import TotalMaintenanceCosts
|
||||
from .total_operational_costs import TotalOperationalCosts
|
||||
from .total_operational_incomes import TotalOperationalIncomes
|
||||
|
||||
|
||||
# to remove
|
||||
|
||||
file_path = Path('./data/selected_building_2864.geojson').resolve()
|
||||
CONSTRUCTION_FORMAT = 'nrcan'
|
||||
USAGE_FORMAT = 'comnet'
|
||||
ENERGY_SYSTEM_FORMAT = 'montreal_custom'
|
||||
ATTIC_HEATED_CASE = 0
|
||||
BASEMENT_HEATED_CASE = 1
|
||||
CLIMATE_REFERENCE_CITY = 'Montreal'
|
||||
WEATHER_FILE = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
|
||||
WEATHER_FORMAT = 'epw'
|
||||
|
||||
tmp_folder = Path('./tmp').resolve()
|
||||
out_path = Path('./outputs').resolve()
|
||||
files = glob.glob(f'{out_path}/*')
|
||||
print('path', file_path)
|
||||
for file in files:
|
||||
if file != '.gitignore':
|
||||
os.remove(file)
|
||||
|
@ -23,7 +23,8 @@ class Configuration:
|
||||
retrofitting_year_construction,
|
||||
factories_handler,
|
||||
retrofit_scenario,
|
||||
fuel_type
|
||||
fuel_type,
|
||||
dictionary
|
||||
):
|
||||
self._number_of_years = number_of_years
|
||||
self._percentage_credit = percentage_credit
|
||||
@ -36,9 +37,10 @@ class Configuration:
|
||||
self._discount_rate = discount_rate
|
||||
self._retrofitting_year_construction = retrofitting_year_construction
|
||||
self._factories_handler = factories_handler
|
||||
self._cost_catalog = CostsCatalogFactory(factories_handler).catalog
|
||||
self._costs_catalog = CostsCatalogFactory(factories_handler).catalog
|
||||
self._retrofit_scenario = retrofit_scenario
|
||||
self._fuel_type = fuel_type
|
||||
self._dictionary = dictionary
|
||||
|
||||
@property
|
||||
def number_of_years(self):
|
||||
@ -195,11 +197,11 @@ class Configuration:
|
||||
self._factories_handler = value
|
||||
|
||||
@property
|
||||
def cost_catalog(self) -> Catalog:
|
||||
def costs_catalog(self) -> Catalog:
|
||||
"""
|
||||
Get cost catalog
|
||||
Get costs catalog
|
||||
"""
|
||||
return self._cost_catalog
|
||||
return self._costs_catalog
|
||||
|
||||
@property
|
||||
def retrofit_scenario(self):
|
||||
@ -214,3 +216,10 @@ class Configuration:
|
||||
Get fuel type (0: Electricity, 1: Gas)
|
||||
"""
|
||||
return self._fuel_type
|
||||
|
||||
@property
|
||||
def dictionary(self):
|
||||
"""
|
||||
Get hub function to cost function dictionary
|
||||
"""
|
||||
return self._dictionary
|
@ -1,6 +1,7 @@
|
||||
"""
|
||||
Cost module
|
||||
"""
|
||||
import hub.helpers.dictionaries
|
||||
import pandas as pd
|
||||
import numpy_financial as npf
|
||||
from hub.city_model_structure.building import Building
|
||||
@ -28,7 +29,8 @@ class Cost:
|
||||
discount_rate=0.03,
|
||||
retrofitting_year_construction=2020,
|
||||
factories_handler='montreal_custom',
|
||||
retrofit_scenario=CURRENT_STATUS):
|
||||
retrofit_scenario=CURRENT_STATUS,
|
||||
dictionary=hub.helpers.dictionaries.Dictionaries().hub_function_to_montreal_custom_costs_function):
|
||||
self._building = building
|
||||
fuel_type = 0
|
||||
if "gas" in building.energy_systems_archetype_name:
|
||||
@ -44,7 +46,8 @@ class Cost:
|
||||
retrofitting_year_construction,
|
||||
factories_handler,
|
||||
retrofit_scenario,
|
||||
fuel_type)
|
||||
fuel_type,
|
||||
dictionary)
|
||||
|
||||
@property
|
||||
def building(self) -> Building:
|
||||
|
@ -3,6 +3,7 @@ Cost base module
|
||||
"""
|
||||
|
||||
from hub.city_model_structure.building import Building
|
||||
from hub.helpers.dictionaries import Dictionaries
|
||||
|
||||
from costs.configuration import Configuration
|
||||
|
||||
@ -19,13 +20,14 @@ class CostBase:
|
||||
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):
|
||||
|
||||
for archetype in self._configuration.costs_catalog.entries().archetypes:
|
||||
if str(building.function) == configuration.dictionary[str(archetype.function)]:
|
||||
self._archetype = archetype
|
||||
self._capital_costs_chapter = self._archetype.capital_cost
|
||||
break
|
||||
if not self._archetype:
|
||||
raise KeyError('archetype not found')
|
||||
raise KeyError(f'archetype not found for function {building.function}')
|
||||
|
||||
self._capital_costs_chapter = None
|
||||
self._rng = range(configuration.number_of_years)
|
||||
|
Loading…
Reference in New Issue
Block a user