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

@ -197,19 +197,22 @@ class LifeCycleCosts:
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 * 12 * factor_residential 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.domestic_hot_water_consumption[cte.YEAR][0]) / (1000) * \ (building.heating_consumption[cte.YEAR][0] + 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:
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 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
total_electricity_consumption = electricity_heating + electricity_cooling + electricity_lighting + \ total_electricity_consumption = (
domestic_hot_water_electricity + electricity_plug_loads + electricity_distribution 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 # 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
@ -218,7 +221,6 @@ class LifeCycleCosts:
print(f'total_electricity_plug_loads {electricity_plug_loads}') print(f'total_electricity_plug_loads {electricity_plug_loads}')
print(f'total_electricity_consumption {total_electricity_consumption}') print(f'total_electricity_consumption {total_electricity_consumption}')
print(f'price_electricity {archetype.operational_cost.fuels[0].variable[0]}') 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] 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
@ -227,20 +229,23 @@ 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'] = (
price_increase_peak_electricity peak_electricity_cost_year_0 * 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'] = (
price_increase_peak_electricity monthly_electricity_cost_year_0 * price_increase_peak_electricity
)
self._yearly_operational_costs.at[year, 'Variable_costs_electricity'] = float( self._yearly_operational_costs.at[year, 'Variable_costs_electricity'] = float(
variable_electricity_cost_year_0 * 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 * \ self._yearly_operational_costs.at[year, 'Fixed_costs_gas'] = fixed_gas_cost_year_0 * price_increase_gas
price_increase_gas self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = (
self._yearly_operational_costs.at[year, 'Variable_costs_gas'] = variable_gas_cost_year_0 * \ 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.at[year, 'Variable_costs_gas'] = (
price_increase_peak_electricity variable_gas_cost_year_0 * price_increase_peak_electricity
)
self._yearly_operational_costs.fillna(0, inplace=True) self._yearly_operational_costs.fillna(0, inplace=True)
return self._yearly_operational_costs return self._yearly_operational_costs
@ -248,7 +253,6 @@ class LifeCycleCosts:
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 cte.YEAR not in building.onsite_electrical_production:
onsite_electricity_production = 0 onsite_electricity_production = 0
else: else:
@ -256,11 +260,10 @@ class LifeCycleCosts:
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'] = ( self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = onsite_electricity_production * \
onsite_electricity_production * archetype.operational_cost.fuels[0].variable[0] * 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
@ -283,11 +286,14 @@ class LifeCycleCosts:
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'] = (
costs_increase maintenance_heating_0 * costs_increase
self._yearly_maintenance_costs.loc[year, 'Cooling_maintenance'] = maintenance_cooling_0 * \ )
costs_increase self._yearly_maintenance_costs.loc[year, 'Cooling_maintenance'] = (
self._yearly_maintenance_costs.loc[year, 'PV_maintenance'] = maintenance_pv_0 * \ maintenance_cooling_0 * costs_increase
costs_increase )
self._yearly_maintenance_costs.loc[year, 'PV_maintenance'] = (
maintenance_pv_0 * 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

View File

@ -1 +1,2 @@
numpy_financial numpy_financial
cerc_hub