bug correction

This commit is contained in:
Guille Gutierrez 2023-05-30 14:42:49 -04:00
parent fff569b46f
commit 3a7ecb2472
3 changed files with 97 additions and 94 deletions

View File

@ -15,8 +15,8 @@ import hub.helpers.constants as cte
class LifeCycleCosts: class LifeCycleCosts:
def __init__(self, building, archetype, number_of_years, consumer_price_index, electricity_peak_index, def __init__(self, building, archetype, number_of_years, consumer_price_index, electricity_peak_index,
electricity_price_index, gas_price_index, discount_rate, electricity_price_index, gas_price_index, discount_rate,
retrofitting_scenario,fuel_type): retrofitting_scenario, fuel_type):
self._building = building self._building = building
self._number_of_years = number_of_years self._number_of_years = number_of_years
self._consumer_price_index = consumer_price_index self._consumer_price_index = consumer_price_index
@ -34,26 +34,29 @@ class LifeCycleCosts:
self._total_floor_area = 0 self._total_floor_area = 0
self._fuel_type = fuel_type self._fuel_type = fuel_type
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
#todo: revise if it works # todo: revise if it works
rng = range(number_of_years) rng = range(number_of_years)
self._yearly_capital_costs = pd.DataFrame(index=rng, columns=['B2010_opaque_walls', 'B2020_transparent', self._yearly_capital_costs = pd.DataFrame(index=rng, columns=['B2010_opaque_walls', 'B2020_transparent',
'B3010_opaque_roof','B10_superstructure', 'B3010_opaque_roof', 'B10_superstructure',
'D301010_photovoltaic_system','D3020_heat_generating_systems', 'D301010_photovoltaic_system',
'D3030_cooling_generation_systems','D3040_distribution_systems', 'D3020_heat_generating_systems',
'D3080_other_hvac_ahu','D5020_lighting_and_branch_wiring'], 'D3030_cooling_generation_systems',
'D3040_distribution_systems',
'D3080_other_hvac_ahu',
'D5020_lighting_and_branch_wiring'],
dtype='float') dtype='float')
self._yearly_end_of_life_costs = pd.DataFrame(index=rng, columns=['End_of_life_costs'], dtype='float') self._yearly_end_of_life_costs = pd.DataFrame(index=rng, columns=['End_of_life_costs'], dtype='float')
self._yearly_operational_costs = pd.DataFrame(index=rng, columns=['Fixed_costs_electricity_peak', self._yearly_operational_costs = pd.DataFrame(index=rng, columns=['Fixed_costs_electricity_peak',
'Fixed_costs_electricity_monthly', 'Fixed_costs_electricity_monthly',
'Variable_costs_electricity','Fixed_costs_gas', 'Variable_costs_electricity', 'Fixed_costs_gas',
'Variable_costs_gas'], 'Variable_costs_gas'],
dtype='float') dtype='float')
self._yearly_maintenance_costs = pd.DataFrame(index=rng, columns=['Heating_maintenance','Cooling_maintenance', self._yearly_maintenance_costs = pd.DataFrame(index=rng, columns=['Heating_maintenance', 'Cooling_maintenance',
'PV_maintenance'], dtype='float') 'PV_maintenance'], dtype='float')
self._yearly_operational_incomes = pd.DataFrame(index=rng, columns=['Incomes electricity'],dtype='float') self._yearly_operational_incomes = pd.DataFrame(index=rng, columns=['Incomes electricity'], dtype='float')
def calculate_capital_costs(self): def calculate_capital_costs(self):
building = self._building building = self._building
@ -66,15 +69,15 @@ class LifeCycleCosts:
total_floor_area = self._total_floor_area total_floor_area = self._total_floor_area
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:
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':
surface_ground += thermal_boundary.opaque_area surface_ground += thermal_boundary.opaque_area
elif thermal_boundary.type == 'Roof': elif thermal_boundary.type == 'Roof':
surface_roof += thermal_boundary.opaque_area surface_roof += thermal_boundary.opaque_area
elif thermal_boundary.type == 'Wall': elif thermal_boundary.type == 'Wall':
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 chapters = archetype.capital_cost
capital_cost_skin = 0 capital_cost_skin = 0
@ -83,8 +86,8 @@ class LifeCycleCosts:
peak_heating = building.heating_peak_load[cte.YEAR].values[0] peak_heating = building.heating_peak_load[cte.YEAR].values[0]
peak_cooling = building.cooling_peak_load[cte.YEAR].values[0] peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]
#todo: put the value of area_pv when it exists # todo: put the value of area_pv when it exists
surface_pv = 10 #building.area_pv surface_pv = 10 # building.area_pv
self._yearly_capital_costs.loc[0, 'B2010_opaque_walls'], self._yearly_capital_costs.loc[0]['B2020_transparent'], \ 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, 'B3010_opaque_roof'], self._yearly_capital_costs.loc[0]['B10_superstructure'], \
self._yearly_capital_costs.loc[0, 'B_Shell'] \ self._yearly_capital_costs.loc[0, 'B_Shell'] \
@ -95,21 +98,20 @@ class LifeCycleCosts:
self._yearly_capital_costs.loc[0, 'D3080_other_hvac_ahu'], \ 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, 'D5020_lighting_and_branch_wiring'] \
= [0, 0, 0, 0, 0] = [0, 0, 0, 0, 0]
self._yearly_capital_costs.fillna(0,inplace=True) self._yearly_capital_costs.fillna(0, inplace=True)
if self._retrofitting_scenario == 1 or self._retrofitting_scenario == 3: if self._retrofitting_scenario == 1 or self._retrofitting_scenario == 3:
chapter = chapters.chapter('B_shell') chapter = chapters.chapter('B_shell')
capital_cost_opaque = surface_opaque * chapter.item('B2010_opaque_walls').refurbishment[0] capital_cost_opaque = surface_opaque * chapter.item('B2010_opaque_walls').refurbishment[0]
capital_cost_transparent = surface_transparent * chapter.item('B2020_transparent').refurbishment[0] capital_cost_transparent = surface_transparent * chapter.item('B2020_transparent').refurbishment[0]
capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0] capital_cost_roof = surface_roof * chapter.item('B3010_opaque_roof').refurbishment[0]
capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0] capital_cost_ground = surface_ground * chapter.item('B10_superstructure').refurbishment[0]
capital_cost_skin = capital_cost_opaque+capital_cost_transparent+capital_cost_roof+capital_cost_ground capital_cost_skin = capital_cost_opaque + capital_cost_transparent + capital_cost_roof + capital_cost_ground
self._yearly_capital_costs.loc[0,'B2010_opaque_walls'],self._yearly_capital_costs.loc[0]['B2020_transparent'], \ 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, 'B3010_opaque_roof'], self._yearly_capital_costs.loc[0]['B10_superstructure'], \
self._yearly_capital_costs.loc[0,'B_Shell']\ self._yearly_capital_costs.loc[0, 'B_Shell'] \
=[capital_cost_opaque , capital_cost_transparent , capital_cost_roof , capital_cost_ground , capital_cost_skin] = [capital_cost_opaque, capital_cost_transparent, capital_cost_roof, capital_cost_ground, capital_cost_skin]
if self._retrofitting_scenario == 2 or self._retrofitting_scenario == 3: if self._retrofitting_scenario == 2 or self._retrofitting_scenario == 3:
chapter = chapters.chapter('D_services') chapter = chapters.chapter('D_services')
capital_cost_pv = surface_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0] capital_cost_pv = surface_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0]
@ -126,11 +128,11 @@ class LifeCycleCosts:
capital_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0] capital_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
self._yearly_capital_costs.loc[0,'D3020_heat_generating_systems'], \ 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, 'D3030_cooling_generation_systems'], \
self._yearly_capital_costs.loc[0,'D3040_distribution_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, 'D3080_other_hvac_ahu'], \
self._yearly_capital_costs.loc[0,'D5020_lighting_and_branch_wiring']\ self._yearly_capital_costs.loc[0, 'D5020_lighting_and_branch_wiring'] \
= [capital_cost_heating_equipment, capital_cost_cooling_equipment, capital_cost_distribution_equipment, = [capital_cost_heating_equipment, capital_cost_cooling_equipment, capital_cost_distribution_equipment,
capital_cost_other_hvac_ahu, capital_cost_lighting] capital_cost_other_hvac_ahu, capital_cost_lighting]
for year in range(1, self._number_of_years): for year in range(1, self._number_of_years):
@ -140,27 +142,28 @@ class LifeCycleCosts:
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0: if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \ reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
* costs_increase * costs_increase
self._yearly_capital_costs.loc[year,'D3020_heat_generating_systems'] = reposition_cost_heating_equipment self._yearly_capital_costs.loc[year, 'D3020_heat_generating_systems'] = reposition_cost_heating_equipment
if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0: if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0:
reposition_cost_cooling_equipment = peak_cooling \ reposition_cost_cooling_equipment = peak_cooling \
* chapter.item('D3030_cooling_generation_systems').reposition[0] \ * chapter.item('D3030_cooling_generation_systems').reposition[0] \
* costs_increase * costs_increase
self._yearly_capital_costs.loc[year,'D3030_cooling_generation_systems'] = reposition_cost_cooling_equipment self._yearly_capital_costs.loc[year, 'D3030_cooling_generation_systems'] = reposition_cost_cooling_equipment
if (year % chapter.item('D3080_other_hvac_ahu').lifetime) == 0: 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 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 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: if (year % chapter.item('D5020_lighting_and_branch_wiring').lifetime) == 0:
reposition_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \ reposition_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \
* costs_increase * costs_increase
self._yearly_capital_costs.loc[year,'D5020_lighting_and_branch_wiring'] = reposition_cost_lighting self._yearly_capital_costs.loc[year, 'D5020_lighting_and_branch_wiring'] = reposition_cost_lighting
if self._retrofitting_scenario==2 or self._retrofitting_scenario==3 : if self._retrofitting_scenario == 2 or self._retrofitting_scenario == 3:
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0: if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] = surface_pv \ self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] = surface_pv \
* chapter.item('D301010_photovoltaic_system').reposition[0] * costs_increase * chapter.item(
'D301010_photovoltaic_system').reposition[0] * costs_increase
return self._yearly_capital_costs return self._yearly_capital_costs
def calculate_end_of_life_costs(self): def calculate_end_of_life_costs(self):
@ -171,8 +174,9 @@ class LifeCycleCosts:
for year in range(1, self._number_of_years + 1): for year in range(1, self._number_of_years + 1):
price_increase += math.pow(1 + self._consumer_price_index, year) price_increase += math.pow(1 + self._consumer_price_index, year)
if year == self._number_of_years: if year == self._number_of_years:
self._yearly_end_of_life_costs.at[year,'End_of_life_costs'] = total_floor_area * archetype.end_of_life_cost*price_increase self._yearly_end_of_life_costs.at[
self._yearly_end_of_life_costs.fillna(0,inplace=True) year, 'End_of_life_costs'] = total_floor_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 return self._yearly_end_of_life_costs
def calculate_total_operational_costs(self): def calculate_total_operational_costs(self):
@ -180,14 +184,14 @@ class LifeCycleCosts:
archetype = self._archetype archetype = self._archetype
total_floor_area = self._total_floor_area total_floor_area = self._total_floor_area
factor_residential = total_floor_area / 80 factor_residential = total_floor_area / 80
#todo: split the heating between fuels # todo: split the heating between fuels
fixed_gas_cost_year_0 = 0 fixed_gas_cost_year_0 = 0
variable_gas_cost_year_0 = 0 variable_gas_cost_year_0 = 0
electricity_heating = 0 electricity_heating = 0
domestic_hot_water_electricity = 0 domestic_hot_water_electricity = 0
if self._fuel_type == 1: if self._fuel_type == 1:
fixed_gas_cost_year_0 = archetype.operational_cost.fuels[1].fixed_monthly fixed_gas_cost_year_0 = archetype.operational_cost.fuels[1].fixed_monthly
variable_gas_cost_year_0 = (building.heating_consumption[cte.YEAR][0]+ variable_gas_cost_year_0 = (building.heating_consumption[cte.YEAR][0] +
building.domestic_hot_water_consumption[cte.YEAR][0]) / (1000) * \ building.domestic_hot_water_consumption[cte.YEAR][0]) / (1000) * \
archetype.operational_cost.fuels[1].variable[0] archetype.operational_cost.fuels[1].variable[0]
if self._fuel_type == 0: if self._fuel_type == 0:
@ -195,13 +199,13 @@ class LifeCycleCosts:
domestic_hot_water_electricity = building.domestic_hot_water_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_cooling = building.cooling_consumption[cte.YEAR][0] / (1000)
electricity_lighting = building.lighting_electrical_demand[cte.YEAR]['insel meb']/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_plug_loads = building.appliances_electrical_demand[cte.YEAR]['insel meb'] / 1000
electricity_distribution = 0 #building.distribution_systems_electrical_consumption[cte.YEAR][0]/1000 electricity_distribution = 0 # building.distribution_systems_electrical_consumption[cte.YEAR][0]/1000
total_electricity_consumption = electricity_heating + electricity_cooling + electricity_lighting + \ total_electricity_consumption = electricity_heating + electricity_cooling + electricity_lighting + \
domestic_hot_water_electricity + electricity_plug_loads + electricity_distribution domestic_hot_water_electricity + electricity_plug_loads + electricity_distribution
#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_demand = 100 #self._peak_electricity_demand peak_electricity_demand = 100 # self._peak_electricity_demand
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]
peak_electricity_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12 peak_electricity_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
@ -214,64 +218,65 @@ class LifeCycleCosts:
price_increase_electricity += math.pow(1 + self._electricity_price_index, year) 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_peak_electricity += math.pow(1 + self._electricity_peak_index, year)
price_increase_gas += math.pow(1 + self._gas_price_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*\ self._yearly_operational_costs.at[year, 'Fixed_costs_electricity_peak'] = peak_electricity_cost_year_0 * \
price_increase_peak_electricity price_increase_peak_electricity
self._yearly_operational_costs.at[year,'Fixed_costs_electricity_monthly'] = monthly_electricity_cost_year_0 * \ self._yearly_operational_costs.at[year, 'Fixed_costs_electricity_monthly'] = monthly_electricity_cost_year_0 * \
price_increase_peak_electricity price_increase_peak_electricity
self._yearly_operational_costs.at[year,'Variable_costs_electricity'] = variable_electricity_cost_year_0 * \ self._yearly_operational_costs.at[year, 'Variable_costs_electricity'] = float(
price_increase_electricity 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, 'Fixed_costs_gas'] = fixed_gas_cost_year_0 * \
self._yearly_operational_costs.at[year,'Variable_costs_gas'] = variable_gas_cost_year_0* \ price_increase_gas
price_increase_peak_electricity self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = variable_gas_cost_year_0 * \
self._yearly_operational_costs.at[year,'Variable_costs_gas'] = variable_gas_cost_year_0 * \ price_increase_peak_electricity
price_increase_peak_electricity self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = variable_gas_cost_year_0 * \
self._yearly_operational_costs.fillna(0,inplace=True) price_increase_peak_electricity
self._yearly_operational_costs.fillna(0, inplace=True)
return self._yearly_operational_costs return self._yearly_operational_costs
def calculate_total_operational_incomes(self): def calculate_total_operational_incomes(self):
building = self._building building = self._building
archetype = self._archetype archetype = self._archetype
if cte.YEAR not in building.onsite_electrical_production:
if (building.onsite_electrical_production is None):
onsite_electricity_production = 0 onsite_electricity_production = 0
else: else:
onsite_electricity_production= 100 #building.onsite_electrical_production[cte.YEAR]/1000 onsite_electricity_production = building.onsite_electrical_production[cte.YEAR][0]/1000
price_increase_electricity = 0 price_increase_electricity = 0
for year in range(1, self._number_of_years + 1): for year in range(1, self._number_of_years + 1):
price_increase_electricity += math.pow(1 + self._electricity_price_index, year) price_increase_electricity += math.pow(1 + self._electricity_price_index, year)
self._yearly_operational_incomes.loc[year,'Incomes electricity']=onsite_electricity_production*\ self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = onsite_electricity_production * \
price_increase_electricity price_increase_electricity
self._yearly_operational_incomes.fillna(0,inplace=True) self._yearly_operational_incomes.fillna(0, inplace=True)
return self._yearly_operational_incomes return self._yearly_operational_incomes
def calculate_total_maintenance_costs(self): def calculate_total_maintenance_costs(self):
building = self._building building = self._building
archetype = self._archetype archetype = self._archetype
#todo: change area pv when the variable exists # todo: change area pv when the variable exists
surface_pv = 10 #building.area_pv roof_area = 0
for roof in building.roofs:
roof_area += roof.solid_polygon.area
surface_pv = roof_area * 0.5
peak_heating = 100#building.heating_peak_load[cte.YEAR][0] peak_heating = building.heating_peak_load[cte.YEAR][cte.HEATING_PEAK_LOAD][0]
peak_cooling = 100#building.cooling_peak_load[cte.YEAR][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_heating_0 = peak_heating * archetype.operational_cost.maintenance_heating
maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling
maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv
print(f'peak_heating{peak_heating}')
print(f'maintenance_cost{archetype.operational_cost.maintenance_heating}')
for year in range(1, self._number_of_years + 1): for year in range(1, self._number_of_years + 1):
costs_increase = math.pow(1 + self._consumer_price_index, year) costs_increase = math.pow(1 + self._consumer_price_index, year)
self._yearly_maintenance_costs.loc[year,'Heating_maintenance'] = maintenance_heating_0 * \ self._yearly_maintenance_costs.loc[year, 'Heating_maintenance'] = maintenance_heating_0 * \
costs_increase costs_increase
self._yearly_maintenance_costs.loc[year,'Cooling_maintenance'] = maintenance_cooling_0 * \ self._yearly_maintenance_costs.loc[year, 'Cooling_maintenance'] = maintenance_cooling_0 * \
costs_increase costs_increase
self._yearly_maintenance_costs.loc[year,'PV_maintenance'] = maintenance_pv_0 * \ self._yearly_maintenance_costs.loc[year, 'PV_maintenance'] = maintenance_pv_0 * \
costs_increase costs_increase
self._yearly_maintenance_costs.fillna(0,inplace=True) self._yearly_maintenance_costs.fillna(0, inplace=True)
return self._yearly_maintenance_costs return self._yearly_maintenance_costs

19
main.py
View File

@ -7,25 +7,23 @@ Copyright © 2022 Project Author Pilar Monsalvete Álvarez de Uribarri pilar.mon
import glob import glob
import os import os
from pathlib import Path from pathlib import Path
import sys
import pandas as pd
import numpy_financial as npf import numpy_financial as npf
import pandas as pd
from energy_systems_sizing import EnergySystemsSizing
from hub.imports.construction_factory import ConstructionFactory from hub.catalog_factories.costs_catalog_factory import CostCatalogFactory
from hub.helpers.dictionaries import Dictionaries 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.geometry_factory import GeometryFactory
from hub.imports.usage_factory import UsageFactory from hub.imports.usage_factory import UsageFactory
from hub.imports.weather_factory import WeatherFactory from hub.imports.weather_factory import WeatherFactory
from hub.catalog_factories.costs_catalog_factory import CostCatalogFactory
import hub.helpers.constants as cte
from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
from sra_engine import SraEngine from sra_engine import SraEngine
from hub.imports.energy_systems_factory import EnergySystemsFactory
from energy_systems_sizing import EnergySystemsSizing
from life_cycle_costs import LifeCycleCosts from life_cycle_costs import LifeCycleCosts
def _npv_from_list(npv_discount_rate, list_cashflow): def _npv_from_list(npv_discount_rate, list_cashflow):
lcc_value = npf.npv(npv_discount_rate, list_cashflow) lcc_value = npf.npv(npv_discount_rate, list_cashflow)
return lcc_value return lcc_value
@ -188,6 +186,5 @@ for retrofitting_scenario in retrofitting_scenarios:
print(life_cycle_results) print(life_cycle_results)
print(f'Scenario {retrofitting_scenario} {life_cycle_costs}') print(f'Scenario {retrofitting_scenario} {life_cycle_costs}')
#todo: change if there is more than 1 building
life_cycle_results.to_excel(Path(__file__).parent/'out_files'/f'Results.xlsx', index=True)

1
resources.txt Normal file
View File

@ -0,0 +1 @@
numpy_financial