partial refactor
This commit is contained in:
parent
43eb91c889
commit
df45fc056c
@ -5,31 +5,3 @@ Copyright © 2022 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.mons
|
|||||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
import pandas as pd
|
|
||||||
from energy_systems_sizing import EnergySystemsSizing
|
|
||||||
|
|
||||||
from hub.helpers.dictionaries import Dictionaries
|
|
||||||
from hub.imports.construction_factory import ConstructionFactory
|
|
||||||
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
|
||||||
from hub.imports.geometry_factory import GeometryFactory
|
|
||||||
from hub.imports.usage_factory import UsageFactory
|
|
||||||
from hub.imports.weather_factory import WeatherFactory
|
|
||||||
from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
|
|
||||||
from sra_engine import SraEngine
|
|
||||||
|
|
||||||
from life_cycle_costs_old import LifeCycleCosts
|
|
||||||
|
|
||||||
# import constants
|
|
||||||
from costs import CLIMATE_REFERENCE_CITY, WEATHER_FILE, WEATHER_FORMAT, CONSTRUCTION_FORMAT, USAGE_FORMAT
|
|
||||||
from costs import ENERGY_SYSTEM_FORMAT, ATTIC_HEATED_CASE, BASEMENT_HEATED_CASE, RETROFITTING_SCENARIOS, NUMBER_OF_YEARS
|
|
||||||
from costs import CONSUMER_PRICE_INDEX, ELECTRICITY_PEAK_INDEX, ELECTRICITY_PRICE_INDEX, GAS_PRICE_INDEX, DISCOUNT_RATE
|
|
||||||
from costs import SKIN_RETROFIT, SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV
|
|
||||||
from costs import RETROFITTING_YEAR_CONSTRUCTION
|
|
||||||
|
|
||||||
# import paths
|
|
||||||
from costs import file_path, tmp_folder, out_path
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
from hub.persistence.models.city_object import CityObject
|
|
||||||
|
|
||||||
class Building(CityObject):
|
|
||||||
|
|
||||||
def __init__(self, ):
|
|
||||||
super()
|
|
@ -1,8 +1,9 @@
|
|||||||
"""
|
"""
|
||||||
Life cycle costs module
|
Life cycle costs module
|
||||||
"""
|
"""
|
||||||
|
import pandas as pd
|
||||||
from hub.city_model_structure.building import Building
|
from hub.city_model_structure.building import Building
|
||||||
|
import hub.helpers.constants as cte
|
||||||
from configuration import Configuration
|
from configuration import Configuration
|
||||||
|
|
||||||
|
|
||||||
@ -10,18 +11,61 @@ class LifeCycleCosts:
|
|||||||
"""
|
"""
|
||||||
Life cycle costs class
|
Life cycle costs class
|
||||||
"""
|
"""
|
||||||
def __init__(self, building: Building, configuration: Configuration):
|
def __init__(self, building: Building, configuration: Configuration, retrofit_scenario):
|
||||||
self._building = building
|
self._building = building
|
||||||
self._configuration = configuration
|
self._configuration = configuration
|
||||||
|
self._retrofit_scenario = retrofit_scenario
|
||||||
self._total_floor_area = 0
|
self._total_floor_area = 0
|
||||||
for internal_zone in building.internal_zones:
|
for internal_zone in building.internal_zones:
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
for thermal_zone in internal_zone.thermal_zones:
|
||||||
self._total_floor_area += thermal_zone.total_floor_area
|
self._total_floor_area += thermal_zone.total_floor_area
|
||||||
|
|
||||||
self._archetype = None
|
self._archetype = None
|
||||||
|
self._capital_costs_chapter = None
|
||||||
|
rng = range(configuration.number_of_years)
|
||||||
|
self._yearly_capital_costs = pd.DataFrame(
|
||||||
|
index=rng,
|
||||||
|
columns=[
|
||||||
|
'B2010_opaque_walls',
|
||||||
|
'B2020_transparent',
|
||||||
|
'B3010_opaque_roof',
|
||||||
|
'B10_superstructure',
|
||||||
|
'D301010_photovoltaic_system',
|
||||||
|
'D3020_heat_generating_systems',
|
||||||
|
'D3030_cooling_generation_systems',
|
||||||
|
'D3040_distribution_systems',
|
||||||
|
'D3080_other_hvac_ahu',
|
||||||
|
'D5020_lighting_and_branch_wiring'
|
||||||
|
],
|
||||||
|
dtype='float'
|
||||||
|
)
|
||||||
|
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0]['B2020_transparent'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0]['B10_superstructure'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = 0
|
||||||
|
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = 0
|
||||||
|
|
||||||
|
self._yearly_capital_incomes = pd.DataFrame(
|
||||||
|
index=rng,
|
||||||
|
columns=[
|
||||||
|
'Subsidies construction',
|
||||||
|
'Subsidies HVAC',
|
||||||
|
'Subsidies PV'
|
||||||
|
],
|
||||||
|
dtype='float'
|
||||||
|
)
|
||||||
|
self._yearly_capital_incomes.loc[0, 'Subsidies construction'] = 0
|
||||||
|
self._yearly_capital_incomes.loc[0, 'Subsidies HVAC'] = 0
|
||||||
|
self._yearly_capital_incomes.loc[0, 'Subsidies PV'] = 0
|
||||||
|
|
||||||
for archetype in self._configuration.cost_catalog.entries('archetypes').archetype:
|
for archetype in self._configuration.cost_catalog.entries('archetypes').archetype:
|
||||||
if str(building.function) == str(archetype.function):
|
if str(building.function) == str(archetype.function):
|
||||||
self._archetype = archetype
|
self._archetype = archetype
|
||||||
|
self._capital_costs_chapter = self._archetype.capital_cost
|
||||||
break
|
break
|
||||||
if not self._archetype:
|
if not self._archetype:
|
||||||
raise KeyError('archetype not found')
|
raise KeyError('archetype not found')
|
||||||
@ -46,9 +90,7 @@ class LifeCycleCosts:
|
|||||||
capital_cost_other_hvac_ahu = 0
|
capital_cost_other_hvac_ahu = 0
|
||||||
capital_cost_lighting = 0
|
capital_cost_lighting = 0
|
||||||
|
|
||||||
total_floor_area = self._building.floor_area
|
for internal_zone in self._building.internal_zones:
|
||||||
|
|
||||||
for internal_zone in building.internal_zones:
|
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
for thermal_zone in internal_zone.thermal_zones:
|
||||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||||
if thermal_boundary.type == 'Ground':
|
if thermal_boundary.type == 'Ground':
|
||||||
@ -59,30 +101,12 @@ class LifeCycleCosts:
|
|||||||
surface_opaque += thermal_boundary.opaque_area * (1 - thermal_boundary.window_ratio)
|
surface_opaque += thermal_boundary.opaque_area * (1 - thermal_boundary.window_ratio)
|
||||||
surface_transparent += thermal_boundary.opaque_area * thermal_boundary.window_ratio
|
surface_transparent += thermal_boundary.opaque_area * thermal_boundary.window_ratio
|
||||||
|
|
||||||
chapters = archetype.capital_cost
|
peak_heating = self._building.heating_peak_load[cte.YEAR].values[0] / 1000
|
||||||
|
peak_cooling = self._building.cooling_peak_load[cte.YEAR].values[0] / 1000
|
||||||
|
|
||||||
peak_heating = building.heating_peak_load[cte.YEAR].values[0]/1000
|
surface_pv = 0
|
||||||
peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]/1000
|
for roof in self._building.roofs:
|
||||||
# todo: change area pv when the variable exists
|
surface_pv += roof.solid_polygon.area * roof.solar_collectors_area_reduction_factor
|
||||||
roof_area = 0
|
|
||||||
for roof in building.roofs:
|
|
||||||
roof_area += roof.solid_polygon.area
|
|
||||||
surface_pv = roof_area * 0.5
|
|
||||||
|
|
||||||
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0]['B2020_transparent'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0]['B10_superstructure'] = 0
|
|
||||||
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = 0
|
|
||||||
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = 0
|
|
||||||
|
|
||||||
self._yearly_capital_incomes.loc[0, 'Subsidies construction'] = 0
|
|
||||||
self._yearly_capital_incomes.loc[0, 'Subsidies HVAC'] = 0
|
|
||||||
self._yearly_capital_incomes.loc[0, 'Subsidies PV'] = 0
|
|
||||||
|
|
||||||
self._yearly_capital_costs.fillna(0, inplace=True)
|
self._yearly_capital_costs.fillna(0, inplace=True)
|
||||||
if self._retrofitting_scenario in (SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
if self._retrofitting_scenario in (SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
||||||
|
Loading…
Reference in New Issue
Block a user