Merge remote-tracking branch 'origin/main'

# Conflicts:
#	life_cycle_costs.py
This commit is contained in:
Oriol Gavalda 2023-05-31 11:25:09 -04:00
commit a9744a2818
2 changed files with 39 additions and 32 deletions

View File

@ -120,7 +120,7 @@ class LifeCycleCosts:
self._yearly_capital_costs.loc[0]['B10_superstructure'] = capital_cost_ground
self._yearly_capital_costs.loc[0, 'B_Shell'] = capital_cost_skin
if self._retrofitting_scenario in (self.SYSTEM_RETROFIT_AND_PV , self.SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV):
if self._retrofitting_scenario in (self.SYSTEM_RETROFIT_AND_PV, self.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
@ -197,19 +197,22 @@ class LifeCycleCosts:
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) * \
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)
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_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 # 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
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
@ -218,7 +221,6 @@ class LifeCycleCosts:
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]}')
print(f'price_gas {archetype.operational_cost.fuels[1].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
@ -227,20 +229,23 @@ class LifeCycleCosts:
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_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, '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.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
@ -248,7 +253,6 @@ class LifeCycleCosts:
def calculate_total_operational_incomes(self):
building = self._building
archetype = self._archetype
if cte.YEAR not in building.onsite_electrical_production:
onsite_electricity_production = 0
else:
@ -256,11 +260,10 @@ class LifeCycleCosts:
price_increase_electricity = 0
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 * archetype.operational_cost.fuels[0].variable[0] * price_increase_electricity
)
self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = onsite_electricity_production * \
price_increase_electricity
self._yearly_operational_incomes.fillna(0, inplace=True)
return self._yearly_operational_incomes
@ -283,11 +286,14 @@ class LifeCycleCosts:
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.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

View File

@ -1 +1,2 @@
numpy_financial
cerc_hub