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
|
2023-05-01 16:38:45 -04:00
|
|
|
Project contributor © 2023 Author Oriol Gavaldà Torrellas oriol.gavalda@concordia.ca
|
2022-11-02 17:28:51 -04:00
|
|
|
"""
|
2023-04-26 16:26:06 -04:00
|
|
|
|
2023-04-25 18:33:09 -04:00
|
|
|
import math
|
2023-05-01 16:38:45 -04:00
|
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
from datetime import date
|
2022-11-02 17:28:51 -04:00
|
|
|
|
2023-04-27 10:20:14 -04:00
|
|
|
import hub.helpers.constants as cte
|
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
class LifeCycleCosts:
|
2023-04-26 16:26:06 -04:00
|
|
|
def __init__(self, building, archetype, number_of_years, consumer_price_index, discount_rate,
|
2023-05-01 16:38:45 -04:00
|
|
|
retrofitting_scenario, heating_scop, cooling_seer, peak_electricity_demand, factor_pv,factor_peak_lights):
|
2023-04-25 11:49:17 -04:00
|
|
|
self._building = building
|
2022-11-02 17:28:51 -04:00
|
|
|
self._number_of_years = number_of_years
|
|
|
|
self._consumer_price_index = consumer_price_index
|
|
|
|
self._discount_rate = discount_rate
|
2023-04-26 16:26:06 -04:00
|
|
|
self._archetype = archetype
|
2023-04-25 09:22:44 -04:00
|
|
|
self._end_of_life_cost = 0
|
|
|
|
self._capital_costs_at_year_0 = 0
|
|
|
|
self._items = 0
|
|
|
|
self._fuels = 0
|
|
|
|
self._concepts = 0
|
|
|
|
self._retrofitting_scenario = retrofitting_scenario
|
2023-04-27 10:20:14 -04:00
|
|
|
self._total_floor_area = 0
|
|
|
|
for internal_zone in building.internal_zones:
|
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
self._total_floor_area += thermal_zone.total_floor_area
|
|
|
|
|
|
|
|
self._heating_scop = heating_scop
|
|
|
|
self._cooling_seer = cooling_seer
|
|
|
|
self._peak_electricity_demand = peak_electricity_demand
|
|
|
|
self._factor_pv = factor_pv
|
2023-05-01 16:38:45 -04:00
|
|
|
self._peak_lights = factor_peak_lights
|
|
|
|
#todo: revise if it works
|
|
|
|
rng = range(40)
|
|
|
|
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',
|
|
|
|
'D_services'], dtype='float')
|
|
|
|
self._yearly_capital_costs.replace(np.nan,0)
|
2022-11-02 17:28:51 -04:00
|
|
|
|
|
|
|
def calculate_capital_costs(self):
|
2023-04-25 11:49:17 -04:00
|
|
|
building = self._building
|
2023-04-26 16:26:06 -04:00
|
|
|
archetype = self._archetype
|
2023-04-27 10:20:14 -04:00
|
|
|
factor_pv = self._factor_pv
|
2023-04-26 16:26:06 -04:00
|
|
|
|
2023-04-25 11:49:17 -04:00
|
|
|
surface_opaque = 0
|
|
|
|
surface_transparent = 0
|
2023-04-25 18:33:09 -04:00
|
|
|
surface_roof = 0
|
|
|
|
surface_ground = 0
|
2023-04-27 10:20:14 -04:00
|
|
|
total_floor_area = self._total_floor_area
|
2023-04-25 11:49:17 -04:00
|
|
|
|
2023-05-01 16:38:45 -04:00
|
|
|
|
2023-04-25 11:49:17 -04:00
|
|
|
for internal_zone in building.internal_zones:
|
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
2023-04-25 18:33:09 -04:00
|
|
|
if thermal_boundary.type == 'Ground':
|
|
|
|
surface_ground += thermal_boundary.opaque_area
|
|
|
|
elif thermal_boundary.type == 'Roof':
|
|
|
|
surface_roof += thermal_boundary.opaque_area
|
|
|
|
elif thermal_boundary.type == 'Wall':
|
|
|
|
surface_opaque += thermal_boundary.opaque_area * (1-thermal_boundary.window_ratio)
|
2023-04-25 11:49:17 -04:00
|
|
|
surface_transparent += thermal_boundary.opaque_area * thermal_boundary.window_ratio
|
|
|
|
|
2023-04-25 18:33:09 -04:00
|
|
|
chapters = archetype.capital_cost
|
2023-04-26 16:26:06 -04:00
|
|
|
capital_cost_skin = 0
|
|
|
|
capital_cost_services = 0
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_pv = 0
|
|
|
|
|
2023-05-01 16:38:45 -04:00
|
|
|
peak_heating = 0.1*self._total_floor_area
|
|
|
|
peak_cooling = 0.1*self._total_floor_area
|
2023-04-27 10:20:14 -04:00
|
|
|
|
2023-04-25 11:49:17 -04:00
|
|
|
if self._retrofitting_scenario == 1 or self._retrofitting_scenario == 3:
|
|
|
|
chapter = chapters.chapter('B_shell')
|
|
|
|
capital_cost_opaque = surface_opaque * chapter.item('B2010_opaque_walls').refurbishment[0]
|
|
|
|
capital_cost_transparent = surface_transparent * chapter.item('B2020_transparent').refurbishment[0]
|
2023-04-25 18:33:09 -04:00
|
|
|
capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0]
|
|
|
|
capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0]
|
2023-04-27 10:20:14 -04:00
|
|
|
capital_cost_skin = capital_cost_opaque+capital_cost_transparent+capital_cost_roof+capital_cost_ground
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[0]['B2010_opaque_walls'],self._yearly_capital_costs.loc[0]['B2020_transparent'], \
|
|
|
|
self._yearly_capital_costs.loc[0]['B3010_opaque_roof'],self._yearly_capital_costs.loc[0]['B10_superstructure'],\
|
|
|
|
self._yearly_capital_costs.loc[0]['B_Shell']\
|
|
|
|
=[capital_cost_opaque , capital_cost_transparent , capital_cost_roof , capital_cost_ground , capital_cost_skin]
|
2023-04-25 18:33:09 -04:00
|
|
|
if self._retrofitting_scenario == 2 or self._retrofitting_scenario == 3:
|
|
|
|
chapter = chapters.chapter('D_services')
|
|
|
|
capital_cost_pv = surface_roof * factor_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0]
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[0]['D301010_photovoltaic_system']=capital_cost_pv
|
2023-04-25 21:00:19 -04:00
|
|
|
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)
|
|
|
|
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
|
2023-04-26 16:26:06 -04:00
|
|
|
reposition_cost_pv += surface_roof * factor_pv * chapter.item('D301010_photovoltaic_system').reposition[
|
2023-04-25 21:00:19 -04:00
|
|
|
0] * costs_increase
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] = surface_roof * \
|
|
|
|
factor_pv * chapter.item('D301010_photovoltaic_system').reposition[0] * costs_increase
|
2023-04-27 10:20:14 -04:00
|
|
|
capital_cost_heating_equipment = peak_heating \
|
2023-04-26 16:26:06 -04:00
|
|
|
* chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
2023-04-27 10:20:14 -04:00
|
|
|
capital_cost_cooling_equipment = peak_cooling \
|
2023-04-26 16:26:06 -04:00
|
|
|
* chapter.item('D3030_cooling_generation_systems').initial_investment[0]
|
2023-04-27 10:20:14 -04:00
|
|
|
capital_cost_distribution_equipment = peak_cooling \
|
2023-04-26 16:26:06 -04:00
|
|
|
* chapter.item('D3040_distribution_systems').initial_investment[0]
|
2023-04-27 10:20:14 -04:00
|
|
|
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
2023-05-01 16:38:45 -04:00
|
|
|
capital_cost_lighting = total_floor_area * self._peak_lights \
|
2023-04-26 16:26:06 -04:00
|
|
|
* chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
2023-04-25 21:00:19 -04:00
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
capital_cost_services = capital_cost_pv + capital_cost_heating_equipment + capital_cost_cooling_equipment\
|
|
|
|
+ capital_cost_distribution_equipment + capital_cost_other_hvac_ahu \
|
|
|
|
+ capital_cost_lighting
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[0]['D3020_heat_generating_systems'], self._yearly_capital_costs.loc[0]['D3030_cooling_generation_systems'], \
|
|
|
|
self._yearly_capital_costs.loc[0]['D3040_distribution_systems'], self._yearly_capital_costs.loc[0]['D3080_other_hvac_ahu'], \
|
|
|
|
self._yearly_capital_costs.loc[0]['D5020_lighting_and_branch_wiring'], self._yearly_capital_costs.loc[0]['D_services'] \
|
|
|
|
= [capital_cost_heating_equipment, capital_cost_cooling_equipment, capital_cost_distribution_equipment,
|
|
|
|
capital_cost_other_hvac_ahu, capital_cost_lighting, capital_cost_services]
|
2023-04-25 11:49:17 -04:00
|
|
|
|
2023-04-25 21:00:19 -04:00
|
|
|
reposition_cost_heating_equipment = 0
|
|
|
|
reposition_cost_cooling_equipment = 0
|
|
|
|
reposition_cost_lighting = 0
|
|
|
|
reposition_cost_hvac_ahu = 0
|
|
|
|
|
|
|
|
for year in range(1, self._number_of_years + 1):
|
|
|
|
chapter = chapters.chapter('D_services')
|
|
|
|
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
|
|
|
* costs_increase
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[year]['D3020_heat_generating_systems'] = reposition_cost_heating_equipment
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0:
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_cooling_equipment = peak_cooling \
|
|
|
|
* chapter.item('D3030_cooling_generation_systems').reposition[0] \
|
|
|
|
* costs_increase
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[year]['D3030_cooling_generation_systems'] = reposition_cost_cooling_equipment
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D3080_other_hvac_ahu').lifetime) == 0:
|
2023-04-27 10:20:14 -04:00
|
|
|
reposition_cost_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').reposition[0] * costs_increase
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[year]['D3080_other_hvac_ahu'] = reposition_cost_hvac_ahu
|
2023-04-25 21:00:19 -04:00
|
|
|
if (year % chapter.item('D5020_lighting_and_branch_wiring').lifetime) == 0:
|
2023-04-26 16:26:06 -04:00
|
|
|
reposition_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \
|
|
|
|
* costs_increase
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.loc[year]['D5020_lighting_and_branch_wiring'] = reposition_cost_lighting
|
2023-04-25 18:33:09 -04:00
|
|
|
capital_cost_subtotal = capital_cost_skin + capital_cost_services
|
2023-04-25 11:49:17 -04:00
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
capital_cost_total = capital_cost_subtotal * (1+chapters.design_allowance) * (1+chapters.overhead_and_profit)
|
2023-04-25 21:00:19 -04:00
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
reposition_cost_subtotal = reposition_cost_pv + reposition_cost_heating_equipment \
|
|
|
|
+ reposition_cost_cooling_equipment + reposition_cost_hvac_ahu \
|
|
|
|
+ reposition_cost_hvac_ahu + reposition_cost_lighting
|
2023-04-25 21:00:19 -04:00
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
reposition_cost_total = reposition_cost_subtotal * (1+chapters.design_allowance) * (1+chapters.overhead_and_profit)
|
2023-04-25 21:00:19 -04:00
|
|
|
|
|
|
|
life_cycle_cost_capital_total = capital_cost_total + reposition_cost_total
|
2023-05-01 16:38:45 -04:00
|
|
|
self._yearly_capital_costs.fillna(0,inplace=True)
|
2023-04-25 21:00:19 -04:00
|
|
|
|
|
|
|
return life_cycle_cost_capital_total
|
2023-04-25 11:49:17 -04:00
|
|
|
|
2023-04-25 18:33:09 -04:00
|
|
|
def calculate_end_of_life_costs(self):
|
2023-04-26 16:26:06 -04:00
|
|
|
archetype = self._archetype
|
2023-04-25 09:22:44 -04:00
|
|
|
|
2023-04-27 10:20:14 -04:00
|
|
|
total_floor_area = self._total_floor_area
|
2022-11-02 17:28:51 -04:00
|
|
|
|
|
|
|
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)
|
2023-04-25 18:33:09 -04:00
|
|
|
price_increase_average = price_increase/self._number_of_years
|
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
return total_floor_area * archetype.end_of_life_cost*price_increase_average
|
2022-11-02 17:28:51 -04:00
|
|
|
|
|
|
|
def calculate_total_operational_costs(self):
|
2023-04-25 18:33:09 -04:00
|
|
|
building = self._building
|
2023-04-26 16:26:06 -04:00
|
|
|
archetype = self._archetype
|
2023-04-25 18:33:09 -04:00
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
total_operational_costs = 0
|
|
|
|
peak_cost = 0
|
|
|
|
monthly_cost = 0
|
|
|
|
variable_cost = 0
|
2023-04-27 10:20:14 -04:00
|
|
|
total_floor_area = self._total_floor_area
|
2023-04-25 18:33:09 -04:00
|
|
|
|
2023-05-01 16:38:45 -04:00
|
|
|
electricity_heating = building.heating[cte.YEAR]['insel meb'] / (self._heating_scop*1000)
|
|
|
|
electricity_cooling = building.cooling[cte.YEAR]['insel meb'] / (self._cooling_seer*1000)
|
|
|
|
electricity_lighting = building.lighting_electrical_demand['month']['insel meb'].sum()/1000
|
|
|
|
domestic_hot_water_demand = building.domestic_hot_water_heat_demand['month']['insel meb'].sum()/1000
|
|
|
|
electricity_plug_loads = building.appliances_electrical_demand['month']['insel meb'].sum()/1000
|
|
|
|
total_electricity_consumption = electricity_cooling[0] + electricity_heating[0] + electricity_lighting \
|
2023-04-26 16:26:06 -04:00
|
|
|
+ domestic_hot_water_demand + electricity_plug_loads
|
2023-04-25 18:33:09 -04:00
|
|
|
|
2023-05-01 16:38:45 -04:00
|
|
|
print(f'total electricity consumption: {total_electricity_consumption}')
|
|
|
|
|
2023-04-27 10:20:14 -04:00
|
|
|
peak_electricity_demand = self._peak_electricity_demand
|
2023-04-25 18:33:09 -04:00
|
|
|
|
2023-04-26 16:26:06 -04:00
|
|
|
operational_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
|
|
|
peak_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
|
|
|
|
monthly_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * (total_floor_area/100)
|
2023-04-25 18:33:09 -04:00
|
|
|
print(f'operational_cost_year_0 {operational_cost_year_0}')
|
|
|
|
print(f'peak_cost_year_0 {peak_cost_year_0}')
|
|
|
|
print(f'monthly_cost_year_0 {monthly_cost_year_0}')
|
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
for year in range(1, self._number_of_years + 1):
|
2023-04-25 18:33:09 -04:00
|
|
|
peak_cost += operational_cost_year_0 \
|
2023-04-26 16:26:06 -04:00
|
|
|
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
monthly_cost += peak_cost_year_0 \
|
|
|
|
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
|
|
|
variable_cost += monthly_cost_year_0 \
|
|
|
|
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
2023-04-25 18:33:09 -04:00
|
|
|
total_operational_costs = peak_cost + monthly_cost + variable_cost
|
|
|
|
|
2022-11-02 17:28:51 -04:00
|
|
|
return total_operational_costs
|
|
|
|
|
|
|
|
def calculate_total_maintenance_costs(self):
|
2023-04-25 18:33:09 -04:00
|
|
|
building = self._building
|
2023-04-26 16:26:06 -04:00
|
|
|
archetype = self._archetype
|
2023-04-27 10:20:14 -04:00
|
|
|
factor_pv = self._factor_pv
|
2023-04-25 18:33:09 -04:00
|
|
|
surface_roof = 0
|
|
|
|
maintenance_pv = 0
|
|
|
|
maintenance_heating = 0
|
|
|
|
maintenance_cooling = 0
|
2023-05-01 16:38:45 -04:00
|
|
|
peak_heating = 0.1 * self._total_floor_area
|
|
|
|
peak_cooling = 0.1 * self._total_floor_area
|
2023-04-27 10:20:14 -04:00
|
|
|
|
2023-04-25 18:33:09 -04:00
|
|
|
for internal_zone in building.internal_zones:
|
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
|
|
if thermal_boundary.type == 'Roof':
|
|
|
|
surface_roof += thermal_boundary.opaque_area
|
2023-04-27 10:20:14 -04:00
|
|
|
surface_pv = surface_roof * factor_pv
|
2023-04-26 16:26:06 -04:00
|
|
|
maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv
|
2023-04-27 10:20:14 -04:00
|
|
|
maintenance_heating_0 = peak_heating * archetype.operational_cost.maintenance_heating
|
|
|
|
maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling
|
2022-11-02 17:28:51 -04:00
|
|
|
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)
|
2023-04-26 16:26:06 -04:00
|
|
|
maintenance_pv += maintenance_pv_0 * costs_increase
|
|
|
|
maintenance_heating += maintenance_heating_0 * costs_increase
|
|
|
|
maintenance_cooling += maintenance_cooling_0 * costs_increase
|
2023-04-25 18:33:09 -04:00
|
|
|
total_maintenance_costs = maintenance_pv + maintenance_heating + maintenance_cooling
|
|
|
|
return total_maintenance_costs
|