Solving bug in increase of prices, detection of problem with electrical demand from buildings

This commit is contained in:
Oriol Gavalda 2023-05-31 10:38:16 -04:00
parent 3fd0202f7a
commit d951252d02
2 changed files with 21 additions and 10 deletions

View File

@ -134,6 +134,15 @@ for retrofitting_scenario in retrofitting_scenarios:
global_operational_costs = lcc.calculate_total_operational_costs() global_operational_costs = lcc.calculate_total_operational_costs()
global_maintenance_costs = lcc.calculate_total_maintenance_costs() global_maintenance_costs = lcc.calculate_total_maintenance_costs()
global_operational_incomes = lcc.calculate_total_operational_incomes() global_operational_incomes = lcc.calculate_total_operational_incomes()
full_path_output = Path(out_path / f'output {retrofitting_scenario} {building.name}.xlsx').resolve()
with pd.ExcelWriter(full_path_output) as writer:
global_capital_costs.to_excel(writer, sheet_name='global_capital_costs')
global_end_of_life_costs.to_excel(writer, sheet_name='global_end_of_life_costs')
global_operational_costs.to_excel(writer, sheet_name='global_operational_costs')
global_maintenance_costs.to_excel(writer, sheet_name='global_maintenance_costs')
global_operational_incomes.to_excel(writer, sheet_name='global_operational_incomes')
df_capital_costs_skin = ( df_capital_costs_skin = (
global_capital_costs['B2010_opaque_walls'] + global_capital_costs['B2020_transparent'] + global_capital_costs['B2010_opaque_walls'] + global_capital_costs['B2020_transparent'] +
global_capital_costs['B3010_opaque_roof'] + global_capital_costs['B10_superstructure'] global_capital_costs['B3010_opaque_roof'] + global_capital_costs['B10_superstructure']

View File

@ -143,7 +143,7 @@ class LifeCycleCosts:
for year in range(1, self._number_of_years): for year in range(1, self._number_of_years):
chapter = chapters.chapter('D_services') chapter = chapters.chapter('D_services')
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year) costs_increase = math.pow(1 + self._consumer_price_index, year)
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] \
@ -178,7 +178,7 @@ class LifeCycleCosts:
price_increase = 0 price_increase = 0
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[ self._yearly_end_of_life_costs.at[
year, 'End_of_life_costs'] = total_floor_area * archetype.end_of_life_cost * price_increase year, 'End_of_life_costs'] = total_floor_area * archetype.end_of_life_cost * price_increase
@ -196,7 +196,7 @@ class LifeCycleCosts:
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 * 12 * factor_residential
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]
@ -210,20 +210,22 @@ class LifeCycleCosts:
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
print(f'total_electricity_cooling {electricity_cooling}')
print(f'total_electricity_lighting {electricity_lighting}')
print(f'total_electricity_plug_loads {electricity_plug_loads}')
print(f'total_electricity_consumption {total_electricity_consumption}')
print(f'price_electricity {archetype.operational_cost.fuels[0].variable[0]}')
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
monthly_electricity_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * factor_residential monthly_electricity_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * factor_residential
price_increase_electricity = 0
price_increase_peak_electricity = 0
price_increase_gas = 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)
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