Bug in gas costs solved. xml file

This commit is contained in:
Oriol Gavalda 2023-05-31 11:23:23 -04:00
parent d951252d02
commit a97c52bfae
2 changed files with 11 additions and 6 deletions

View File

@ -19,6 +19,7 @@ from hub.imports.energy_systems_factory import EnergySystemsFactory
from hub.imports.geometry_factory import GeometryFactory from hub.imports.geometry_factory import GeometryFactory
from hub.imports.usage_factory import UsageFactory from hub.imports.usage_factory import UsageFactory
from hub.imports.weather_factory import WeatherFactory from hub.imports.weather_factory import WeatherFactory
from hub.helpers import constants as cte
from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
from sra_engine import SraEngine from sra_engine import SraEngine
@ -111,7 +112,8 @@ for retrofitting_scenario in retrofitting_scenarios:
print('enrich systems... done') print('enrich systems... done')
MonthlyEnergyBalanceEngine(city, tmp_folder) MonthlyEnergyBalanceEngine(city, tmp_folder)
lightingdemand = city.buildings[0].lighting_electrical_demand[cte.YEAR]['insel meb'] / 1000
print(f'lighting first {lightingdemand}')
EnergySystemsSizing(city).enrich() EnergySystemsSizing(city).enrich()
print(f'beginning costing scenario {retrofitting_scenario} systems... done') print(f'beginning costing scenario {retrofitting_scenario} systems... done')

View File

@ -86,8 +86,8 @@ class LifeCycleCosts:
chapters = archetype.capital_cost chapters = archetype.capital_cost
peak_heating = building.heating_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] peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]/1000
# todo: change area pv when the variable exists # todo: change area pv when the variable exists
roof_area = 0 roof_area = 0
for roof in building.roofs: for roof in building.roofs:
@ -218,6 +218,7 @@ 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
@ -247,6 +248,7 @@ 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:
@ -254,10 +256,11 @@ 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'] = onsite_electricity_production * \ self._yearly_operational_incomes.loc[year, 'Incomes electricity'] = (
price_increase_electricity onsite_electricity_production * archetype.operational_cost.fuels[0].variable[0] * 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