From a97c52bfae82791e85824f21d40ac84d211feb52 Mon Sep 17 00:00:00 2001 From: jgavalda Date: Wed, 31 May 2023 11:23:23 -0400 Subject: [PATCH] Bug in gas costs solved. xml file --- __main__.py | 4 +++- life_cycle_costs.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/__main__.py b/__main__.py index 80dd618..786ef2a 100644 --- a/__main__.py +++ b/__main__.py @@ -19,6 +19,7 @@ from hub.imports.energy_systems_factory import EnergySystemsFactory from hub.imports.geometry_factory import GeometryFactory from hub.imports.usage_factory import UsageFactory from hub.imports.weather_factory import WeatherFactory +from hub.helpers import constants as cte from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine from sra_engine import SraEngine @@ -111,7 +112,8 @@ for retrofitting_scenario in retrofitting_scenarios: print('enrich systems... done') MonthlyEnergyBalanceEngine(city, tmp_folder) - + lightingdemand = city.buildings[0].lighting_electrical_demand[cte.YEAR]['insel meb'] / 1000 + print(f'lighting first {lightingdemand}') EnergySystemsSizing(city).enrich() print(f'beginning costing scenario {retrofitting_scenario} systems... done') diff --git a/life_cycle_costs.py b/life_cycle_costs.py index 25e90f6..b1d396b 100644 --- a/life_cycle_costs.py +++ b/life_cycle_costs.py @@ -86,8 +86,8 @@ class LifeCycleCosts: chapters = archetype.capital_cost - peak_heating = building.heating_peak_load[cte.YEAR].values[0] - peak_cooling = building.cooling_peak_load[cte.YEAR].values[0] + peak_heating = building.heating_peak_load[cte.YEAR].values[0]/1000 + peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]/1000 # todo: change area pv when the variable exists roof_area = 0 for roof in building.roofs: @@ -218,6 +218,7 @@ 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 @@ -247,6 +248,7 @@ 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: @@ -254,10 +256,11 @@ 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 * \ - price_increase_electricity + 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.fillna(0, inplace=True) return self._yearly_operational_incomes