correct weird mix of implementations
This commit is contained in:
parent
6ed85fc1bb
commit
ece4801c2d
|
@ -6,4 +6,3 @@ from .end_of_life_costs import EndOfLifeCosts
|
||||||
from .total_maintenance_costs import TotalMaintenanceCosts
|
from .total_maintenance_costs import TotalMaintenanceCosts
|
||||||
from .total_operational_costs import TotalOperationalCosts
|
from .total_operational_costs import TotalOperationalCosts
|
||||||
from .total_operational_incomes import TotalOperationalIncomes
|
from .total_operational_incomes import TotalOperationalIncomes
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Constants module
|
||||||
|
"""
|
||||||
|
|
||||||
# constants
|
# constants
|
||||||
CURRENT_STATUS = 0
|
CURRENT_STATUS = 0
|
||||||
SKIN_RETROFIT = 1
|
SKIN_RETROFIT = 1
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
"""
|
"""
|
||||||
Cost module
|
Cost module
|
||||||
"""
|
"""
|
||||||
import hub.helpers.dictionaries
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy_financial as npf
|
import numpy_financial as npf
|
||||||
from hub.city_model_structure.building import Building
|
from hub.city_model_structure.building import Building
|
||||||
|
from hub.helpers.dictionaries import Dictionaries
|
||||||
|
|
||||||
from costs.configuration import Configuration
|
from costs.configuration import Configuration
|
||||||
from costs import CapitalCosts, EndOfLifeCosts, TotalMaintenanceCosts, TotalOperationalCosts, TotalOperationalIncomes
|
from costs import CapitalCosts, EndOfLifeCosts, TotalMaintenanceCosts, TotalOperationalCosts, TotalOperationalIncomes
|
||||||
|
@ -30,7 +30,9 @@ class Cost:
|
||||||
retrofitting_year_construction=2020,
|
retrofitting_year_construction=2020,
|
||||||
factories_handler='montreal_custom',
|
factories_handler='montreal_custom',
|
||||||
retrofit_scenario=CURRENT_STATUS,
|
retrofit_scenario=CURRENT_STATUS,
|
||||||
dictionary=hub.helpers.dictionaries.Dictionaries().hub_function_to_montreal_custom_costs_function):
|
dictionary=None):
|
||||||
|
if dictionary is None:
|
||||||
|
dictionary = Dictionaries().hub_function_to_montreal_custom_costs_function
|
||||||
self._building = building
|
self._building = building
|
||||||
fuel_type = 0
|
fuel_type = 0
|
||||||
if "gas" in building.energy_systems_archetype_name:
|
if "gas" in building.energy_systems_archetype_name:
|
||||||
|
|
|
@ -3,7 +3,6 @@ Cost base module
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from hub.city_model_structure.building import Building
|
from hub.city_model_structure.building import Building
|
||||||
from hub.helpers.dictionaries import Dictionaries
|
|
||||||
|
|
||||||
from costs.configuration import Configuration
|
from costs.configuration import Configuration
|
||||||
|
|
||||||
|
|
|
@ -1,313 +0,0 @@
|
||||||
"""
|
|
||||||
Life cycle cost module
|
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
||||||
Copyright © 2022 Project Author Guille Gutierrez Guillermo.GutierrezMorote@concordia.ca
|
|
||||||
Code contributor Pilar Monsalvete Alvarez de Uribarri pilar_monsalvete@concordia.ca
|
|
||||||
Code contributor Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
|
|
||||||
"""
|
|
||||||
|
|
||||||
from hub.persistence.models.city_object import CityObject
|
|
||||||
from configuration import Configuration
|
|
||||||
|
|
||||||
|
|
||||||
class LifeCycleCosts:
|
|
||||||
"""
|
|
||||||
Life cycle costs class
|
|
||||||
"""
|
|
||||||
def __init__(self, building: CityObject, building_results: dict, configuration: Configuration):
|
|
||||||
self._building = building
|
|
||||||
self._building_results = building_results
|
|
||||||
self._configuration = configuration
|
|
||||||
self._archetype = None
|
|
||||||
for archetype in self._configuration.cost_catalog.entries('archetypes').archetype:
|
|
||||||
if str(building.function) == str(archetype.function):
|
|
||||||
self._archetype = archetype
|
|
||||||
break
|
|
||||||
if not self._archetype:
|
|
||||||
raise KeyError('archetype not found')
|
|
||||||
|
|
||||||
@property
|
|
||||||
def calculate_capital_costs(self):
|
|
||||||
"""
|
|
||||||
Calculate capital cost
|
|
||||||
:return: pd.DataFrame
|
|
||||||
"""
|
|
||||||
capital_cost_pv = 0
|
|
||||||
capital_cost_opaque = 0
|
|
||||||
capital_cost_ground = 0
|
|
||||||
capital_cost_transparent = 0
|
|
||||||
capital_cost_roof = 0
|
|
||||||
capital_cost_heating_equipment = 0
|
|
||||||
capital_cost_cooling_equipment = 0
|
|
||||||
capital_cost_distribution_equipment = 0
|
|
||||||
capital_cost_other_hvac_ahu = 0
|
|
||||||
capital_cost_lighting = 0
|
|
||||||
|
|
||||||
chapters = self._archetype.capital_cost
|
|
||||||
|
|
||||||
peak_heating = self._building_results.heating_peak_load[cte.YEAR].values[0]/1000
|
|
||||||
peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]/1000
|
|
||||||
# todo: change area pv when the variable exists
|
|
||||||
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)
|
|
||||||
if self._retrofitting_scenario in (SKIN_RETROFIT, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
|
||||||
chapter = chapters.chapter('B_shell')
|
|
||||||
capital_cost_opaque = self._building.wall_area * chapter.item('B2010_opaque_walls').refurbishment[0]
|
|
||||||
capital_cost_transparent = self._building.windows_area * chapter.item('B2020_transparent').refurbishment[0]
|
|
||||||
capital_cost_roof = self._building.roof_area * chapter.item('B3010_opaque_roof').refurbishment[0]
|
|
||||||
capital_cost_ground = self._building.area * chapter.item('B10_superstructure').refurbishment[0]
|
|
||||||
|
|
||||||
|
|
||||||
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'] = capital_cost_opaque * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0]['B2020_transparent'] = capital_cost_transparent * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0, 'B3010_opaque_roof'] = capital_cost_roof * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0]['B10_superstructure'] = capital_cost_ground * (1-PERCENTAGE_CREDIT)
|
|
||||||
|
|
||||||
|
|
||||||
if self._retrofitting_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
|
||||||
chapter = chapters.chapter('D_services')
|
|
||||||
capital_cost_pv = surface_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0]
|
|
||||||
self._yearly_capital_costs.loc[0]['D301010_photovoltaic_system'] = capital_cost_pv
|
|
||||||
capital_cost_heating_equipment = (
|
|
||||||
peak_heating * chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
|
||||||
)
|
|
||||||
capital_cost_cooling_equipment = (
|
|
||||||
peak_cooling * chapter.item('D3030_cooling_generation_systems').initial_investment[0]
|
|
||||||
)
|
|
||||||
capital_cost_distribution_equipment = (
|
|
||||||
peak_cooling * chapter.item('D3040_distribution_systems').initial_investment[0]
|
|
||||||
)
|
|
||||||
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
|
||||||
capital_cost_lighting = self._building.total_heating_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
|
||||||
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3020_heat_generating_systems'] = capital_cost_heating_equipment * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3030_cooling_generation_systems'] = capital_cost_cooling_equipment * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3040_distribution_systems'] = capital_cost_distribution_equipment * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'] = capital_cost_other_hvac_ahu * (1-PERCENTAGE_CREDIT)
|
|
||||||
self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] = capital_cost_lighting * (1-PERCENTAGE_CREDIT)
|
|
||||||
|
|
||||||
for year in range(1, self._number_of_years):
|
|
||||||
chapter = chapters.chapter('D_services')
|
|
||||||
costs_increase = math.pow(1 + self._consumer_price_index, year)
|
|
||||||
self._yearly_capital_costs.loc[year, 'B2010_opaque_walls'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_opaque * (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'B2020_transparent'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_transparent * (PERCENTAGE_CREDIT)
|
|
||||||
)
|
|
||||||
self._yearly_capital_costs.loc[year, 'B3010_opaque_roof'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,capital_cost_roof
|
|
||||||
* (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'B10_superstructure'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_ground * (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] = -npf.pmt(INTEREST_RATE,CREDIT_YEARS,
|
|
||||||
capital_cost_heating_equipment
|
|
||||||
* (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_cooling_equipment
|
|
||||||
* (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3040_distribution_systems'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_distribution_equipment
|
|
||||||
* (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3080_other_hvac_ahu'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_other_hvac_ahu
|
|
||||||
* (PERCENTAGE_CREDIT))
|
|
||||||
self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] = -npf.pmt(INTEREST_RATE, CREDIT_YEARS,
|
|
||||||
capital_cost_lighting
|
|
||||||
* (PERCENTAGE_CREDIT))
|
|
||||||
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
|
||||||
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
|
||||||
* costs_increase
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] += reposition_cost_heating_equipment
|
|
||||||
|
|
||||||
if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0:
|
|
||||||
reposition_cost_cooling_equipment = peak_cooling \
|
|
||||||
* chapter.item('D3030_cooling_generation_systems').reposition[0] \
|
|
||||||
* costs_increase
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] += reposition_cost_cooling_equipment
|
|
||||||
|
|
||||||
if (year % chapter.item('D3080_other_hvac_ahu').lifetime) == 0:
|
|
||||||
reposition_cost_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').reposition[0] * costs_increase
|
|
||||||
self._yearly_capital_costs.loc[year, 'D3080_other_hvac_ahu'] = reposition_cost_hvac_ahu
|
|
||||||
|
|
||||||
if (year % chapter.item('D5020_lighting_and_branch_wiring').lifetime) == 0:
|
|
||||||
reposition_cost_lighting = self._building.total_heating_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \
|
|
||||||
* costs_increase
|
|
||||||
self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] += reposition_cost_lighting
|
|
||||||
|
|
||||||
if self._retrofitting_scenario in (SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
|
|
||||||
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
|
|
||||||
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] += surface_pv \
|
|
||||||
* chapter.item(
|
|
||||||
'D301010_photovoltaic_system').reposition[0] * costs_increase
|
|
||||||
capital_cost_skin = capital_cost_opaque + capital_cost_ground + capital_cost_transparent + capital_cost_roof
|
|
||||||
capital_cost_hvac = (
|
|
||||||
capital_cost_heating_equipment +
|
|
||||||
capital_cost_cooling_equipment +
|
|
||||||
capital_cost_distribution_equipment +
|
|
||||||
capital_cost_other_hvac_ahu + capital_cost_lighting
|
|
||||||
)
|
|
||||||
|
|
||||||
self._yearly_capital_incomes.loc[0, 'Subsidies construction'] = (
|
|
||||||
capital_cost_skin * archetype.income.construction_subsidy/100
|
|
||||||
)
|
|
||||||
self._yearly_capital_incomes.loc[0, 'Subsidies HVAC'] = capital_cost_hvac * archetype.income.hvac_subsidy/100
|
|
||||||
self._yearly_capital_incomes.loc[0, 'Subsidies PV'] = capital_cost_pv * archetype.income.photovoltaic_subsidy/100
|
|
||||||
self._yearly_capital_incomes.fillna(0, inplace=True)
|
|
||||||
return self._yearly_capital_costs, self._yearly_capital_incomes
|
|
||||||
|
|
||||||
@property
|
|
||||||
def calculate_end_of_life_costs(self):
|
|
||||||
"""
|
|
||||||
Calculate end of life costs
|
|
||||||
:return: pd.DataFrame
|
|
||||||
"""
|
|
||||||
archetype = self._archetype
|
|
||||||
|
|
||||||
for year in range(1, self._number_of_years + 1):
|
|
||||||
price_increase = math.pow(1 + self._consumer_price_index, year)
|
|
||||||
if year == self._number_of_years:
|
|
||||||
self._yearly_end_of_life_costs.at[
|
|
||||||
year, 'End_of_life_costs'] = self._building.total_heating_area * archetype.end_of_life_cost * price_increase
|
|
||||||
self._yearly_end_of_life_costs.fillna(0, inplace=True)
|
|
||||||
return self._yearly_end_of_life_costs
|
|
||||||
|
|
||||||
@property
|
|
||||||
def calculate_total_operational_costs(self):
|
|
||||||
"""
|
|
||||||
Calculate total operational costs
|
|
||||||
:return: pd.DataFrame
|
|
||||||
"""
|
|
||||||
building = self._building
|
|
||||||
archetype = self._archetype
|
|
||||||
|
|
||||||
factor_residential = self._building.total_heating_area / 80
|
|
||||||
# todo: split the heating between fuels
|
|
||||||
fixed_gas_cost_year_0 = 0
|
|
||||||
variable_gas_cost_year_0 = 0
|
|
||||||
electricity_heating = 0
|
|
||||||
domestic_hot_water_electricity = 0
|
|
||||||
if self._fuel_type == 1:
|
|
||||||
fixed_gas_cost_year_0 = archetype.operational_cost.fuels[1].fixed_monthly * 12 * factor_residential
|
|
||||||
variable_gas_cost_year_0 = (
|
|
||||||
(building.heating_consumption[cte.YEAR][0] + building.domestic_hot_water_consumption[cte.YEAR][0]) / 1000 *
|
|
||||||
archetype.operational_cost.fuels[1].variable[0]
|
|
||||||
)
|
|
||||||
if self._fuel_type == 0:
|
|
||||||
electricity_heating = building.heating_consumption[cte.YEAR][0] / 1000
|
|
||||||
domestic_hot_water_electricity = building.domestic_hot_water_consumption[cte.YEAR][0] / 1000
|
|
||||||
|
|
||||||
electricity_cooling = building.cooling_consumption[cte.YEAR][0] / 1000
|
|
||||||
electricity_lighting = building.lighting_electrical_demand[cte.YEAR]['insel meb'] / 1000
|
|
||||||
electricity_plug_loads = building.appliances_electrical_demand[cte.YEAR]['insel meb'] / 1000
|
|
||||||
electricity_distribution = 0
|
|
||||||
total_electricity_consumption = (
|
|
||||||
electricity_heating + electricity_cooling + electricity_lighting + domestic_hot_water_electricity +
|
|
||||||
electricity_plug_loads + electricity_distribution
|
|
||||||
)
|
|
||||||
|
|
||||||
# todo: change when peak electricity demand is coded. Careful with factor residential
|
|
||||||
peak_electricity_demand = 100 # self._peak_electricity_demand
|
|
||||||
variable_electricity_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
|
||||||
peak_electricity_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
|
|
||||||
monthly_electricity_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * factor_residential
|
|
||||||
|
|
||||||
for year in range(1, self._number_of_years + 1):
|
|
||||||
price_increase_electricity = math.pow(1 + self._electricity_price_index, year)
|
|
||||||
price_increase_peak_electricity = math.pow(1 + self._electricity_peak_index, year)
|
|
||||||
price_increase_gas = math.pow(1 + self._gas_price_index, year)
|
|
||||||
self._yearly_operational_costs.at[year, 'Fixed_costs_electricity_peak'] = (
|
|
||||||
peak_electricity_cost_year_0 * price_increase_peak_electricity
|
|
||||||
)
|
|
||||||
|
|
||||||
self._yearly_operational_costs.at[year, 'Fixed_costs_electricity_monthly'] = (
|
|
||||||
monthly_electricity_cost_year_0 * price_increase_peak_electricity
|
|
||||||
)
|
|
||||||
self._yearly_operational_costs.at[year, 'Variable_costs_electricity'] = float(
|
|
||||||
variable_electricity_cost_year_0 * price_increase_electricity
|
|
||||||
)
|
|
||||||
self._yearly_operational_costs.at[year, 'Fixed_costs_gas'] = fixed_gas_cost_year_0 * price_increase_gas
|
|
||||||
self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = (
|
|
||||||
variable_gas_cost_year_0 * price_increase_peak_electricity
|
|
||||||
)
|
|
||||||
self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = (
|
|
||||||
variable_gas_cost_year_0 * price_increase_peak_electricity
|
|
||||||
)
|
|
||||||
self._yearly_operational_costs.fillna(0, inplace=True)
|
|
||||||
|
|
||||||
return self._yearly_operational_costs
|
|
||||||
|
|
||||||
@property
|
|
||||||
def calculate_total_operational_incomes(self):
|
|
||||||
"""
|
|
||||||
Calculate total operational incomes
|
|
||||||
:return: pd.DataFrame
|
|
||||||
"""
|
|
||||||
building = self._building
|
|
||||||
if cte.YEAR not in building.onsite_electrical_production:
|
|
||||||
onsite_electricity_production = 0
|
|
||||||
else:
|
|
||||||
onsite_electricity_production = building.onsite_electrical_production[cte.YEAR][0]/1000
|
|
||||||
|
|
||||||
for year in range(1, self._number_of_years + 1):
|
|
||||||
price_increase_electricity = math.pow(1 + self._electricity_price_index, year)
|
|
||||||
# todo: check the adequate assignation of price. Pilar
|
|
||||||
price_export = 0.075 # archetype.income.electricity_export
|
|
||||||
self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = (
|
|
||||||
onsite_electricity_production * price_export * price_increase_electricity
|
|
||||||
)
|
|
||||||
|
|
||||||
self._yearly_operational_incomes.fillna(0, inplace=True)
|
|
||||||
return self._yearly_operational_incomes
|
|
||||||
|
|
||||||
@property
|
|
||||||
def calculate_total_maintenance_costs(self):
|
|
||||||
"""
|
|
||||||
Calculate total maintenance costs
|
|
||||||
:return: pd.DataFrame
|
|
||||||
"""
|
|
||||||
building = self._building
|
|
||||||
archetype = self._archetype
|
|
||||||
# todo: change area pv when the variable exists
|
|
||||||
roof_area = 0
|
|
||||||
for roof in building.roofs:
|
|
||||||
roof_area += roof.solid_polygon.area
|
|
||||||
surface_pv = roof_area * 0.5
|
|
||||||
|
|
||||||
peak_heating = building.heating_peak_load[cte.YEAR][cte.HEATING_PEAK_LOAD][0]
|
|
||||||
peak_cooling = building.cooling_peak_load[cte.YEAR][cte.COOLING_PEAK_LOAD][0]
|
|
||||||
|
|
||||||
maintenance_heating_0 = peak_heating * archetype.operational_cost.maintenance_heating
|
|
||||||
maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling
|
|
||||||
maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv
|
|
||||||
|
|
||||||
for year in range(1, self._number_of_years + 1):
|
|
||||||
costs_increase = math.pow(1 + self._consumer_price_index, year)
|
|
||||||
self._yearly_maintenance_costs.loc[year, 'Heating_maintenance'] = (
|
|
||||||
maintenance_heating_0 * costs_increase
|
|
||||||
)
|
|
||||||
self._yearly_maintenance_costs.loc[year, 'Cooling_maintenance'] = (
|
|
||||||
maintenance_cooling_0 * costs_increase
|
|
||||||
)
|
|
||||||
self._yearly_maintenance_costs.loc[year, 'PV_maintenance'] = (
|
|
||||||
maintenance_pv_0 * costs_increase
|
|
||||||
)
|
|
||||||
self._yearly_maintenance_costs.fillna(0, inplace=True)
|
|
||||||
return self._yearly_maintenance_costs
|
|
52
costs/peak_load.py
Normal file
52
costs/peak_load.py
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
|
||||||
|
class PeakLoad:
|
||||||
|
|
||||||
|
def __init__(self, building):
|
||||||
|
self._building = building
|
||||||
|
|
||||||
|
@property
|
||||||
|
def electricity_peak_load(self):
|
||||||
|
array = [None] * 12
|
||||||
|
heating = 0
|
||||||
|
cooling = 0
|
||||||
|
for system in self._building.energy_systems:
|
||||||
|
for demand_type in system.demand_types:
|
||||||
|
if demand_type == cte.HEATING:
|
||||||
|
heating = 1
|
||||||
|
if demand_type == cte.COOLING:
|
||||||
|
cooling = 1
|
||||||
|
if cte.MONTH in self._building.heating_peak_load.keys() and cte.MONTH in self._building.cooling_peak_load.keys():
|
||||||
|
peak_lighting = 0
|
||||||
|
peak_appliances = 0
|
||||||
|
for thermal_zone in self._building.internal_zones[0].thermal_zones:
|
||||||
|
lighting = thermal_zone.lighting
|
||||||
|
for schedule in lighting.schedules:
|
||||||
|
for value in schedule.values:
|
||||||
|
if value * lighting.density * thermal_zone.total_floor_area > peak_lighting:
|
||||||
|
peak_lighting = value * lighting.density * thermal_zone.total_floor_area
|
||||||
|
appliances = thermal_zone.appliances
|
||||||
|
for schedule in appliances.schedules:
|
||||||
|
for value in schedule.values:
|
||||||
|
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances:
|
||||||
|
peak_appliances = value * appliances.density * thermal_zone.total_floor_area
|
||||||
|
|
||||||
|
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
|
||||||
|
conditioning_peak = []
|
||||||
|
for i, value in enumerate(self._building.heating_peak_load[cte.MONTH]):
|
||||||
|
if cooling * self._building.cooling_peak_load[cte.MONTH][i] > heating * value:
|
||||||
|
conditioning_peak.append(cooling * self._building.cooling_peak_load[cte.MONTH][i])
|
||||||
|
else:
|
||||||
|
conditioning_peak.append(heating * value)
|
||||||
|
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
||||||
|
electricity_peak_load_results = pd.DataFrame(
|
||||||
|
monthly_electricity_peak,
|
||||||
|
columns=[f'{self._building.name} electricity peak load W']
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
electricity_peak_load_results = pd.DataFrame(array, columns=[f'{self._building.name} electricity peak load W'])
|
||||||
|
|
||||||
|
return electricity_peak_load_results
|
122
costs/results.py
122
costs/results.py
|
@ -1,122 +0,0 @@
|
||||||
class Results:
|
|
||||||
def __init__(self, building_results: dict):
|
|
||||||
self._monthly_cooling_peak_load = building_results['monthly_cooling_peak_load']
|
|
||||||
self._yearly_cooling_peak_load = building_results['yearly_cooling_peak_load']
|
|
||||||
self._monthly_heating_peak_load = building_results['monthly_heating_peak_load']
|
|
||||||
self._yearly_heating_peak_load = building_results['yearly_heating_peak_load']
|
|
||||||
self._monthly_cooling_demand = building_results['monthly_cooling_demand']
|
|
||||||
self._yearly_cooling_demand = building_results['yearly_cooling_demand']
|
|
||||||
self._monthly_heating_demand = building_results['monthly_heating_demand']
|
|
||||||
self._yearly_heating_demand = building_results['yearly_heating_demand']
|
|
||||||
self._monthly_lighting_electrical_demand = building_results['monthly_lighting_electrical_demand']
|
|
||||||
self._yearly_lighting_electrical_demand = building_results['yearly_lighting_electrical_demand']
|
|
||||||
self._monthly_appliances_electrical_demand = building_results['monthly_appliances_electrical_demand']
|
|
||||||
self._yearly_appliances_electrical_demand = building_results['yearly_appliances_electrical_demand']
|
|
||||||
self._monthly_domestic_hot_water_heat_demand = building_results['monthly_domestic_hot_water_heat_demand']
|
|
||||||
self._yearly_domestic_hot_water_heat_demand = building_results['yearly_domestic_hot_water_heat_demand']
|
|
||||||
self._monthly_heating_consumption = building_results['monthly_heating_consumption']
|
|
||||||
self._yearly_heating_consumption = building_results['yearly_heating_consumption']
|
|
||||||
self._monthly_cooling_consumption = building_results['monthly_cooling_consumption']
|
|
||||||
self._yearly_cooling_consumption = building_results['yearly_cooling_consumption']
|
|
||||||
self._monthly_domestic_hot_water_consumption = building_results['monthly_domestic_hot_water_consumption']
|
|
||||||
self._yearly_domestic_hot_water_consumption = building_results['yearly_domestic_hot_water_consumption']
|
|
||||||
self._monthly_distribution_systems_electrical_consumption = building_results['monthly_distribution_systems_electrical_consumption']
|
|
||||||
self._yearly_distribution_systems_electrical_consumption = building_results['yearly_distribution_systems_electrical_consumption']
|
|
||||||
self._monthly_on_site_electrical_production = building_results['monthly_on_site_electrical_production']
|
|
||||||
self._yearly_on_site_electrical_production = building_results['yearly_on_site_electrical_production']
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_cooling_peak_load(self):
|
|
||||||
return self._monthly_cooling_peak_load
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_cooling_peak_load(self):
|
|
||||||
return self._yearly_cooling_peak_load
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_heating_peak_load(self):
|
|
||||||
return self._monthly_heating_peak_load
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_heating_peak_load(self):
|
|
||||||
return self._yearly_heating_peak_load
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_cooling_demand(self):
|
|
||||||
return self._monthly_cooling_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_cooling_demand(self):
|
|
||||||
return self._yearly_cooling_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_heating_demand(self):
|
|
||||||
return self._monthly_heating_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_heating_demand(self):
|
|
||||||
return self._yearly_heating_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_lighting_electrical_demand(self):
|
|
||||||
return self._monthly_lighting_electrical_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_lighting_electrical_demand(self):
|
|
||||||
return self._yearly_lighting_electrical_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_appliances_electrical_demand(self):
|
|
||||||
return self._monthly_appliances_electrical_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_appliances_electrical_demand(self):
|
|
||||||
return self._yearly_appliances_electrical_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_domestic_hot_water_heat_demand(self):
|
|
||||||
return self._monthly_heating_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_domestic_hot_water_heat_demand(self):
|
|
||||||
return self._yearly_heating_demand
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_heating_consumption(self):
|
|
||||||
return self._monthly_heating_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_heating_consumption(self):
|
|
||||||
return self._yearly_heating_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_cooling_consumption(self):
|
|
||||||
return self._monthly_cooling_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_cooling_consumption(self):
|
|
||||||
return self._yearly_cooling_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_domestic_hot_water_consumption(self):
|
|
||||||
return self._monthly_domestic_hot_water_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_domestic_hot_water_consumption(self):
|
|
||||||
return self._yearly_domestic_hot_water_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_distribution_systems_electrical_consumption(self):
|
|
||||||
return self._monthly_distribution_systems_electrical_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_distribution_systems_electrical_consumption(self):
|
|
||||||
return self._yearly_distribution_systems_electrical_consumption
|
|
||||||
|
|
||||||
@property
|
|
||||||
def monthly_on_site_electrical_production(self):
|
|
||||||
return self._monthly_on_site_electrical_production
|
|
||||||
|
|
||||||
@property
|
|
||||||
def yearly_on_site_electrical_production(self):
|
|
||||||
return self._yearly_on_site_electrical_production
|
|
|
@ -9,48 +9,7 @@ import hub.helpers.constants as cte
|
||||||
|
|
||||||
from costs.configuration import Configuration
|
from costs.configuration import Configuration
|
||||||
from costs.cost_base import CostBase
|
from costs.cost_base import CostBase
|
||||||
|
from costs.peak_load import PeakLoad
|
||||||
|
|
||||||
def Peak_load(building):
|
|
||||||
array = [None] * 12
|
|
||||||
heating = 0
|
|
||||||
cooling = 0
|
|
||||||
for system in building.energy_systems:
|
|
||||||
for demand_type in system.demand_types:
|
|
||||||
if demand_type == cte.HEATING:
|
|
||||||
heating = 1
|
|
||||||
if demand_type == cte.COOLING:
|
|
||||||
cooling = 1
|
|
||||||
if cte.MONTH in building.heating_peak_load.keys() and cte.MONTH in building.cooling_peak_load.keys():
|
|
||||||
peak_lighting = 0
|
|
||||||
peak_appliances = 0
|
|
||||||
for thermal_zone in building.internal_zones[0].thermal_zones:
|
|
||||||
lighting = thermal_zone.lighting
|
|
||||||
for schedule in lighting.schedules:
|
|
||||||
for value in schedule.values:
|
|
||||||
if value * lighting.density * thermal_zone.total_floor_area > peak_lighting:
|
|
||||||
peak_lighting = value * lighting.density * thermal_zone.total_floor_area
|
|
||||||
appliances = thermal_zone.appliances
|
|
||||||
for schedule in appliances.schedules:
|
|
||||||
for value in schedule.values:
|
|
||||||
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances:
|
|
||||||
peak_appliances = value * appliances.density * thermal_zone.total_floor_area
|
|
||||||
|
|
||||||
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
|
|
||||||
conditioning_peak = []
|
|
||||||
for i, value in enumerate(building.heating_peak_load[cte.MONTH]):
|
|
||||||
if cooling * building.cooling_peak_load[cte.MONTH][i] > heating * value:
|
|
||||||
conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH][i])
|
|
||||||
else:
|
|
||||||
conditioning_peak.append(heating * value)
|
|
||||||
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
|
||||||
|
|
||||||
electricity_peak_load_results = pd.DataFrame(monthly_electricity_peak
|
|
||||||
, columns=[f'{building.name} electricity peak load W'])
|
|
||||||
else:
|
|
||||||
electricity_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} electricity peak load W'])
|
|
||||||
|
|
||||||
return electricity_peak_load_results
|
|
||||||
|
|
||||||
|
|
||||||
class TotalOperationalCosts(CostBase):
|
class TotalOperationalCosts(CostBase):
|
||||||
|
@ -106,7 +65,7 @@ class TotalOperationalCosts(CostBase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# todo: change when peak electricity demand is coded. Careful with factor residential
|
# todo: change when peak electricity demand is coded. Careful with factor residential
|
||||||
peak_electricity_load = Peak_load(building)
|
peak_electricity_load = PeakLoad(building).electricity_peak_load
|
||||||
peak_load_value = peak_electricity_load.max(axis=1)
|
peak_load_value = peak_electricity_load.max(axis=1)
|
||||||
peak_electricity_demand = peak_load_value[1]/1000 # self._peak_electricity_demand adapted to kW
|
peak_electricity_demand = peak_load_value[1]/1000 # self._peak_electricity_demand adapted to kW
|
||||||
variable_electricity_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
variable_electricity_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user