From 1f35c31f24ca11e0a29bb08ea91ce1e6b92436e2 Mon Sep 17 00:00:00 2001 From: Guille Date: Wed, 31 May 2023 10:49:17 -0400 Subject: [PATCH] Complete basic clean up and warning removal --- life_cycle_costs.py | 64 +++++++++++++++++++++++++-------------------- resources.txt | 3 ++- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/life_cycle_costs.py b/life_cycle_costs.py index e859e74..18c7dee 100644 --- a/life_cycle_costs.py +++ b/life_cycle_costs.py @@ -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 - 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] + 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 + 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 @@ -224,27 +227,28 @@ 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_monthly'] = monthly_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, '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 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: @@ -254,8 +258,9 @@ class LifeCycleCosts: for year in range(1, self._number_of_years + 1): price_increase_electricity += math.pow(1 + self._electricity_price_index, year) - self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = onsite_electricity_production * \ - 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 @@ -278,11 +283,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 diff --git a/resources.txt b/resources.txt index 32ed54c..bc8992f 100644 --- a/resources.txt +++ b/resources.txt @@ -1 +1,2 @@ -numpy_financial \ No newline at end of file +numpy_financial +cerc_hub \ No newline at end of file