cleaned code. not found bug. not working

This commit is contained in:
Pilar Monsalvete 2023-07-07 10:47:22 -04:00
parent f15cfff55e
commit c9d345e1cb
5 changed files with 32 additions and 33 deletions

View File

@ -37,7 +37,6 @@ RETROFITTING_SCENARIOS = [
SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV
] ]
EMISSION_FACTOR_GAS_QUEBEC = 0.25
EMISSION_FACTOR_ELECTRICITY_QUEBEC = 0.0015 #https://www.cer-rec.gc.ca/en/data-analysis/energy-markets/provincial-territorial-energy-profiles/provincial-territorial-energy-profiles-quebec.html#:~:text=GHG%20Emissions,-Quebec's%20GHG%20emissions&text=The%20largest%20emitting%20sectors%20in,2.3%20MT%20CO2e. EMISSION_FACTOR_ELECTRICITY_QUEBEC = 0.0015 #https://www.cer-rec.gc.ca/en/data-analysis/energy-markets/provincial-territorial-energy-profiles/provincial-territorial-energy-profiles-quebec.html#:~:text=GHG%20Emissions,-Quebec's%20GHG%20emissions&text=The%20largest%20emitting%20sectors%20in,2.3%20MT%20CO2e.
EMISSION_FACTOR_GAS_QUEBEC = 0.183 #https://www.canada.ca/en/environment-climate-change/services/climate-change/pricing-pollution-how-it-will-work/output-based-pricing-system/federal-greenhouse-gas-offset-system/emission-factors-reference-values.html EMISSION_FACTOR_GAS_QUEBEC = 0.183 #https://www.canada.ca/en/environment-climate-change/services/climate-change/pricing-pollution-how-it-will-work/output-based-pricing-system/federal-greenhouse-gas-offset-system/emission-factors-reference-values.html
EMISSION_FACTOR_BIOMASS_QUEBEC = 0.035 #Data from Spain. https://www.miteco.gob.es/es/cambio-climatico/temas/mitigacion-politicas-y-medidas/factoresemision_tcm30-479095.pdf EMISSION_FACTOR_BIOMASS_QUEBEC = 0.035 #Data from Spain. https://www.miteco.gob.es/es/cambio-climatico/temas/mitigacion-politicas-y-medidas/factoresemision_tcm30-479095.pdf

View File

@ -18,23 +18,20 @@ from hub.imports.usage_factory import UsageFactory
from hub.imports.weather_factory import WeatherFactory from hub.imports.weather_factory import WeatherFactory
from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
from sra_engine import SraEngine from sra_engine import SraEngine
import numpy as np
from printing_results import * from printing_results import *
from hub.helpers import constants as cte from hub.helpers import constants as cte
from life_cycle_costs import LifeCycleCosts from life_cycle_costs import LifeCycleCosts
from costs import CLIMATE_REFERENCE_CITY, WEATHER_FILE, WEATHER_FORMAT, CONSTRUCTION_FORMAT, USAGE_FORMAT from costs import CONSTRUCTION_FORMAT
from costs import ENERGY_SYSTEM_FORMAT, ATTIC_HEATED_CASE, BASEMENT_HEATED_CASE, RETROFITTING_SCENARIOS, NUMBER_OF_YEARS from costs import ENERGY_SYSTEM_FORMAT, RETROFITTING_SCENARIOS, NUMBER_OF_YEARS
from costs import CONSUMER_PRICE_INDEX, ELECTRICITY_PEAK_INDEX, ELECTRICITY_PRICE_INDEX, GAS_PRICE_INDEX, DISCOUNT_RATE from costs import CONSUMER_PRICE_INDEX, ELECTRICITY_PEAK_INDEX, ELECTRICITY_PRICE_INDEX, GAS_PRICE_INDEX, DISCOUNT_RATE
from costs import SKIN_RETROFIT, SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV from costs import SKIN_RETROFIT, SYSTEM_RETROFIT_AND_PV, SKIN_RETROFIT_AND_SYSTEM_RETROFIT_AND_PV
from costs import RETROFITTING_YEAR_CONSTRUCTION from costs import RETROFITTING_YEAR_CONSTRUCTION
from costs import EMISSION_FACTOR_GAS_QUEBEC, EMISSION_FACTOR_ELECTRICITY_QUEBEC, EMISSION_FACTOR_GAS_QUEBEC,\
EMISSION_FACTOR_BIOMASS_QUEBEC, EMISSION_FACTOR_FUEL_OIL_QUEBEC, EMISSION_FACTOR_DIESEL_QUEBEC
# import paths # import paths
from results import Results from results import Results
def _npv_from_list(npv_discount_rate, list_cashflow): def _npv_from_list(npv_discount_rate, list_cashflow):
lcc_value = npf.npv(npv_discount_rate, list_cashflow) lcc_value = npf.npv(npv_discount_rate, list_cashflow)
return lcc_value return lcc_value
@ -147,27 +144,29 @@ for retrofitting_scenario in RETROFITTING_SCENARIOS:
global_operational_incomes.to_excel(writer, sheet_name='global_operational_incomes') global_operational_incomes.to_excel(writer, sheet_name='global_operational_incomes')
global_capital_incomes.to_excel(writer, sheet_name='global_capital_incomes') global_capital_incomes.to_excel(writer, sheet_name='global_capital_incomes')
investmentcosts = pd.DataFrame([])
print('RETROFITTING SCENARIO', retrofitting_scenario)
if retrofitting_scenario == 0: if retrofitting_scenario == 0:
investmentcosts = [global_capital_costs['B2010_opaque_walls'][0], investmentcosts = [global_capital_costs['B2010_opaque_walls'][0],
global_capital_costs['B2020_transparent'][0], global_capital_costs['B2020_transparent'][0],
global_capital_costs['B3010_opaque_roof'][0], global_capital_costs['B3010_opaque_roof'][0],
global_capital_costs['B10_superstructure'][0], global_capital_costs['B10_superstructure'][0],
global_capital_costs['D3020_heat_generating_systems'][0], global_capital_costs['D3020_heat_generating_systems'][0],
global_capital_costs['D3080_other_hvac_ahu'][0], global_capital_costs['D3080_other_hvac_ahu'][0],
global_capital_costs['D5020_lighting_and_branch_wiring'][0], global_capital_costs['D5020_lighting_and_branch_wiring'][0],
global_capital_costs['D301010_photovoltaic_system'][0]] global_capital_costs['D301010_photovoltaic_system'][0]]
investmentcosts = pd.DataFrame(investmentcosts) investmentcosts = pd.DataFrame(investmentcosts)
else: else:
investmentcosts[f'retrofitting_scenario {retrofitting_scenario}'] = [global_capital_costs['B2010_opaque_walls'][0], investmentcosts[f'retrofitting_scenario_{retrofitting_scenario}'] = \
global_capital_costs['B2020_transparent'][0], [global_capital_costs['B2010_opaque_walls'][0],
global_capital_costs['B3010_opaque_roof'][0], global_capital_costs['B2020_transparent'][0],
global_capital_costs['B10_superstructure'][0], global_capital_costs['B3010_opaque_roof'][0],
global_capital_costs['D3020_heat_generating_systems'][0], global_capital_costs['B10_superstructure'][0],
global_capital_costs['D3080_other_hvac_ahu'][0], global_capital_costs['D3020_heat_generating_systems'][0],
global_capital_costs['D5020_lighting_and_branch_wiring'][0], global_capital_costs['D3080_other_hvac_ahu'][0],
global_capital_costs['D301010_photovoltaic_system'][0]] global_capital_costs['D5020_lighting_and_branch_wiring'][0],
global_capital_costs['D301010_photovoltaic_system'][0]]
investmentcosts.index = ['Opaque walls', 'Transparent walls', 'Opaque roof', 'Superstructure', investmentcosts.index = ['Opaque walls', 'Transparent walls', 'Opaque roof', 'Superstructure',
'Heat generation systems', 'Other HVAC AHU', 'Lighting and branch wiring', 'PV systems'] 'Heat generation systems', 'Other HVAC AHU', 'Lighting and branch wiring', 'PV systems']
@ -242,7 +241,7 @@ for retrofitting_scenario in RETROFITTING_SCENARIOS:
print(f'Scenario {retrofitting_scenario} {life_cycle_costs}') print(f'Scenario {retrofitting_scenario} {life_cycle_costs}')
printing_results(investmentcosts,life_cycle_results,total_floor_area) # printing_results(investmentcosts, life_cycle_results, total_floor_area)

View File

@ -102,7 +102,6 @@ class LifeCycleCosts:
surface_transparent += thermal_boundary.opaque_area * thermal_boundary.window_ratio surface_transparent += thermal_boundary.opaque_area * thermal_boundary.window_ratio
chapters = archetype.capital_cost chapters = archetype.capital_cost
print('kk')
peak_heating = building.heating_peak_load[cte.YEAR][0]/1000 peak_heating = building.heating_peak_load[cte.YEAR][0]/1000
peak_cooling = building.cooling_peak_load[cte.YEAR][0]/1000 peak_cooling = building.cooling_peak_load[cte.YEAR][0]/1000
# todo: change area pv when the variable exists # todo: change area pv when the variable exists

View File

@ -1,16 +1,14 @@
import numpy as np
import plotly.graph_objects as go import plotly.graph_objects as go
import plotly.offline as offline
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import plotly.express as px import plotly.express as px
def printing_results(investmentcosts, life_cycle_results,total_floor_area): def printing_results(investmentcosts, life_cycle_results,total_floor_area):
labels = investmentcosts.index labels = investmentcosts.index
values = investmentcosts['retrofitting_scenario 1'] values = investmentcosts['retrofitting_scenario_1']
values2 = investmentcosts['retrofitting_scenario 2'] values2 = investmentcosts['retrofitting_scenario_2']
values3 = investmentcosts['retrofitting_scenario 3'] values3 = investmentcosts['retrofitting_scenario_3']
fig = go.Figure(data=[go.Pie(labels=labels, values=values)]) fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
fig2 = go.Figure(data=[go.Pie(labels=labels, values=values2)]) fig2 = go.Figure(data=[go.Pie(labels=labels, values=values2)])
@ -21,11 +19,11 @@ def printing_results(investmentcosts, life_cycle_results,total_floor_area):
showlegend=True showlegend=True
) )
fig2.update_layout( fig2.update_layout(
title='Retrofitting scenario 1', title='Retrofitting scenario 2',
showlegend=True showlegend=True
) )
fig3.update_layout( fig3.update_layout(
title='Retrofitting scenario 1', title='Retrofitting scenario 3',
showlegend=True showlegend=True
) )

4
out_files/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
.gitignore
# Except this file
!.gitignore