diff --git a/__main__.py b/__main__.py index 7098c41..80dd618 100644 --- a/__main__.py +++ b/__main__.py @@ -134,6 +134,15 @@ for retrofitting_scenario in retrofitting_scenarios: global_operational_costs = lcc.calculate_total_operational_costs() global_maintenance_costs = lcc.calculate_total_maintenance_costs() 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 = ( global_capital_costs['B2010_opaque_walls'] + global_capital_costs['B2020_transparent'] + global_capital_costs['B3010_opaque_roof'] + global_capital_costs['B10_superstructure'] diff --git a/life_cycle_costs.py b/life_cycle_costs.py index 18c7dee..fcc4e4f 100644 --- a/life_cycle_costs.py +++ b/life_cycle_costs.py @@ -143,7 +143,7 @@ class LifeCycleCosts: for year in range(1, self._number_of_years): 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: reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \ @@ -178,7 +178,7 @@ class LifeCycleCosts: price_increase = 0 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: self._yearly_end_of_life_costs.at[ year, 'End_of_life_costs'] = total_floor_area * archetype.end_of_life_cost * price_increase @@ -196,11 +196,10 @@ class LifeCycleCosts: 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 - 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] - ) + 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 @@ -209,30 +208,29 @@ class LifeCycleCosts: 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 # building.distribution_systems_electrical_consumption[cte.YEAR][0]/1000 - total_electricity_consumption = ( - electricity_heating + electricity_cooling + electricity_lighting + domestic_hot_water_electricity + - electricity_plug_loads + electricity_distribution - ) + 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 - + 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] 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 - price_increase_electricity = 0 - price_increase_peak_electricity = 0 - price_increase_gas = 0 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 - ) + 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 )