Refining of outputs and prepared outputs for the inclusion of system results.
This commit is contained in:
parent
b2bbc7f7ee
commit
c283f3a3e3
@ -15,8 +15,7 @@ import hub.helpers.constants as cte
|
|||||||
|
|
||||||
class LifeCycleCosts:
|
class LifeCycleCosts:
|
||||||
def __init__(self, building, archetype, number_of_years, consumer_price_index, discount_rate,
|
def __init__(self, building, archetype, number_of_years, consumer_price_index, discount_rate,
|
||||||
retrofitting_scenario, heating_scop, cooling_seer, peak_electricity_demand,
|
retrofitting_scenario):
|
||||||
factor_pv, factor_peak_lights):
|
|
||||||
self._building = building
|
self._building = building
|
||||||
self._number_of_years = number_of_years
|
self._number_of_years = number_of_years
|
||||||
self._consumer_price_index = consumer_price_index
|
self._consumer_price_index = consumer_price_index
|
||||||
@ -33,13 +32,8 @@ class LifeCycleCosts:
|
|||||||
for thermal_zone in internal_zone.thermal_zones:
|
for thermal_zone in internal_zone.thermal_zones:
|
||||||
self._total_floor_area += thermal_zone.total_floor_area
|
self._total_floor_area += thermal_zone.total_floor_area
|
||||||
|
|
||||||
self._heating_scop = heating_scop
|
|
||||||
self._cooling_seer = cooling_seer
|
|
||||||
self._peak_electricity_demand = peak_electricity_demand
|
|
||||||
self._factor_pv = factor_pv
|
|
||||||
self._peak_lights = factor_peak_lights
|
|
||||||
#todo: revise if it works
|
#todo: revise if it works
|
||||||
rng = range(40)
|
rng = range(number_of_years)
|
||||||
self._yearly_capital_costs = pd.DataFrame(index=rng, columns=['B2010_opaque_walls', 'B2020_transparent',
|
self._yearly_capital_costs = pd.DataFrame(index=rng, columns=['B2010_opaque_walls', 'B2020_transparent',
|
||||||
'B3010_opaque_roof','B10_superstructure',
|
'B3010_opaque_roof','B10_superstructure',
|
||||||
'D301010_photovoltaic_system','D3020_heat_generating_systems',
|
'D301010_photovoltaic_system','D3020_heat_generating_systems',
|
||||||
@ -51,7 +45,6 @@ class LifeCycleCosts:
|
|||||||
def calculate_capital_costs(self):
|
def calculate_capital_costs(self):
|
||||||
building = self._building
|
building = self._building
|
||||||
archetype = self._archetype
|
archetype = self._archetype
|
||||||
factor_pv = self._factor_pv
|
|
||||||
|
|
||||||
surface_opaque = 0
|
surface_opaque = 0
|
||||||
surface_transparent = 0
|
surface_transparent = 0
|
||||||
@ -75,8 +68,10 @@ class LifeCycleCosts:
|
|||||||
capital_cost_services = 0
|
capital_cost_services = 0
|
||||||
reposition_cost_pv = 0
|
reposition_cost_pv = 0
|
||||||
|
|
||||||
peak_heating = 0.1*self._total_floor_area
|
peak_heating = building.heating_peak_load[cte.YEAR].values[0]
|
||||||
peak_cooling = 0.1*self._total_floor_area
|
peak_cooling = building.cooling_peak_load[cte.YEAR].values[0]
|
||||||
|
#todo: put the value of area_pv when it exists
|
||||||
|
surface_pv = 10 #building.area_pv
|
||||||
|
|
||||||
if self._retrofitting_scenario == 1 or self._retrofitting_scenario == 3:
|
if self._retrofitting_scenario == 1 or self._retrofitting_scenario == 3:
|
||||||
chapter = chapters.chapter('B_shell')
|
chapter = chapters.chapter('B_shell')
|
||||||
@ -89,17 +84,18 @@ class LifeCycleCosts:
|
|||||||
self._yearly_capital_costs.loc[0]['B3010_opaque_roof'],self._yearly_capital_costs.loc[0]['B10_superstructure'],\
|
self._yearly_capital_costs.loc[0]['B3010_opaque_roof'],self._yearly_capital_costs.loc[0]['B10_superstructure'],\
|
||||||
self._yearly_capital_costs.loc[0]['B_Shell']\
|
self._yearly_capital_costs.loc[0]['B_Shell']\
|
||||||
=[capital_cost_opaque , capital_cost_transparent , capital_cost_roof , capital_cost_ground , capital_cost_skin]
|
=[capital_cost_opaque , capital_cost_transparent , capital_cost_roof , capital_cost_ground , capital_cost_skin]
|
||||||
|
|
||||||
if self._retrofitting_scenario == 2 or self._retrofitting_scenario == 3:
|
if self._retrofitting_scenario == 2 or self._retrofitting_scenario == 3:
|
||||||
chapter = chapters.chapter('D_services')
|
chapter = chapters.chapter('D_services')
|
||||||
capital_cost_pv = surface_roof * factor_pv * chapter.item('D301010_photovoltaic_system').initial_investment[0]
|
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
|
self._yearly_capital_costs.loc[0]['D301010_photovoltaic_system'] = capital_cost_pv
|
||||||
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) / math.pow(1 + self._discount_rate, year)
|
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
||||||
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
|
if (year % chapter.item('D301010_photovoltaic_system').lifetime) == 0:
|
||||||
reposition_cost_pv += surface_roof * factor_pv * chapter.item('D301010_photovoltaic_system').reposition[
|
reposition_cost_pv += surface_pv * chapter.item('D301010_photovoltaic_system').reposition[
|
||||||
0] * costs_increase
|
0] * costs_increase
|
||||||
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] = surface_roof * \
|
self._yearly_capital_costs.loc[year]['D301010_photovoltaic_system'] = surface_pv\
|
||||||
factor_pv * chapter.item('D301010_photovoltaic_system').reposition[0] * costs_increase
|
* chapter.item('D301010_photovoltaic_system').reposition[0] * costs_increase
|
||||||
capital_cost_heating_equipment = peak_heating \
|
capital_cost_heating_equipment = peak_heating \
|
||||||
* chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
* chapter.item('D3020_heat_generating_systems').initial_investment[0]
|
||||||
capital_cost_cooling_equipment = peak_cooling \
|
capital_cost_cooling_equipment = peak_cooling \
|
||||||
@ -107,12 +103,14 @@ class LifeCycleCosts:
|
|||||||
capital_cost_distribution_equipment = peak_cooling \
|
capital_cost_distribution_equipment = peak_cooling \
|
||||||
* chapter.item('D3040_distribution_systems').initial_investment[0]
|
* chapter.item('D3040_distribution_systems').initial_investment[0]
|
||||||
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
capital_cost_other_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').initial_investment[0]
|
||||||
|
|
||||||
capital_cost_lighting = total_floor_area * self._peak_lights \
|
capital_cost_lighting = total_floor_area * self._peak_lights \
|
||||||
* chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
* chapter.item('D5020_lighting_and_branch_wiring').initial_investment[0]
|
||||||
|
|
||||||
capital_cost_services = capital_cost_pv + capital_cost_heating_equipment + capital_cost_cooling_equipment\
|
capital_cost_services = capital_cost_pv + capital_cost_heating_equipment + capital_cost_cooling_equipment\
|
||||||
+ capital_cost_distribution_equipment + capital_cost_other_hvac_ahu \
|
+ capital_cost_distribution_equipment + capital_cost_other_hvac_ahu \
|
||||||
+ capital_cost_lighting
|
+ capital_cost_lighting
|
||||||
|
|
||||||
self._yearly_capital_costs.loc[0]['D3020_heat_generating_systems'], self._yearly_capital_costs.loc[0]['D3030_cooling_generation_systems'], \
|
self._yearly_capital_costs.loc[0]['D3020_heat_generating_systems'], self._yearly_capital_costs.loc[0]['D3030_cooling_generation_systems'], \
|
||||||
self._yearly_capital_costs.loc[0]['D3040_distribution_systems'], self._yearly_capital_costs.loc[0]['D3080_other_hvac_ahu'], \
|
self._yearly_capital_costs.loc[0]['D3040_distribution_systems'], self._yearly_capital_costs.loc[0]['D3080_other_hvac_ahu'], \
|
||||||
self._yearly_capital_costs.loc[0]['D5020_lighting_and_branch_wiring'], self._yearly_capital_costs.loc[0]['D_services'] \
|
self._yearly_capital_costs.loc[0]['D5020_lighting_and_branch_wiring'], self._yearly_capital_costs.loc[0]['D_services'] \
|
||||||
@ -127,22 +125,27 @@ class LifeCycleCosts:
|
|||||||
for year in range(1, self._number_of_years + 1):
|
for year in range(1, self._number_of_years + 1):
|
||||||
chapter = chapters.chapter('D_services')
|
chapter = chapters.chapter('D_services')
|
||||||
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
costs_increase = math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
||||||
|
|
||||||
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
if (year % chapter.item('D3020_heat_generating_systems').lifetime) == 0:
|
||||||
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
reposition_cost_heating_equipment = peak_heating * chapter.item('D3020_heat_generating_systems').reposition[0] \
|
||||||
* costs_increase
|
* costs_increase
|
||||||
self._yearly_capital_costs.loc[year]['D3020_heat_generating_systems'] = reposition_cost_heating_equipment
|
self._yearly_capital_costs.loc[year]['D3020_heat_generating_systems'] = reposition_cost_heating_equipment
|
||||||
|
|
||||||
if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0:
|
if (year % chapter.item('D3030_cooling_generation_systems').lifetime) == 0:
|
||||||
reposition_cost_cooling_equipment = peak_cooling \
|
reposition_cost_cooling_equipment = peak_cooling \
|
||||||
* chapter.item('D3030_cooling_generation_systems').reposition[0] \
|
* chapter.item('D3030_cooling_generation_systems').reposition[0] \
|
||||||
* costs_increase
|
* costs_increase
|
||||||
self._yearly_capital_costs.loc[year]['D3030_cooling_generation_systems'] = reposition_cost_cooling_equipment
|
self._yearly_capital_costs.loc[year]['D3030_cooling_generation_systems'] = reposition_cost_cooling_equipment
|
||||||
|
|
||||||
if (year % chapter.item('D3080_other_hvac_ahu').lifetime) == 0:
|
if (year % chapter.item('D3080_other_hvac_ahu').lifetime) == 0:
|
||||||
reposition_cost_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').reposition[0] * costs_increase
|
reposition_cost_hvac_ahu = peak_cooling * chapter.item('D3080_other_hvac_ahu').reposition[0] * costs_increase
|
||||||
self._yearly_capital_costs.loc[year]['D3080_other_hvac_ahu'] = reposition_cost_hvac_ahu
|
self._yearly_capital_costs.loc[year]['D3080_other_hvac_ahu'] = reposition_cost_hvac_ahu
|
||||||
|
|
||||||
if (year % chapter.item('D5020_lighting_and_branch_wiring').lifetime) == 0:
|
if (year % chapter.item('D5020_lighting_and_branch_wiring').lifetime) == 0:
|
||||||
reposition_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \
|
reposition_cost_lighting = total_floor_area * chapter.item('D5020_lighting_and_branch_wiring').reposition[0] \
|
||||||
* costs_increase
|
* costs_increase
|
||||||
self._yearly_capital_costs.loc[year]['D5020_lighting_and_branch_wiring'] = reposition_cost_lighting
|
self._yearly_capital_costs.loc[year]['D5020_lighting_and_branch_wiring'] = reposition_cost_lighting
|
||||||
|
|
||||||
capital_cost_subtotal = capital_cost_skin + capital_cost_services
|
capital_cost_subtotal = capital_cost_skin + capital_cost_services
|
||||||
|
|
||||||
capital_cost_total = capital_cost_subtotal * (1+chapters.design_allowance) * (1+chapters.overhead_and_profit)
|
capital_cost_total = capital_cost_subtotal * (1+chapters.design_allowance) * (1+chapters.overhead_and_profit)
|
||||||
@ -172,31 +175,34 @@ class LifeCycleCosts:
|
|||||||
def calculate_total_operational_costs(self):
|
def calculate_total_operational_costs(self):
|
||||||
building = self._building
|
building = self._building
|
||||||
archetype = self._archetype
|
archetype = self._archetype
|
||||||
|
|
||||||
total_operational_costs = 0
|
total_operational_costs = 0
|
||||||
peak_cost = 0
|
peak_cost = 0
|
||||||
monthly_cost = 0
|
monthly_cost = 0
|
||||||
variable_cost = 0
|
variable_cost = 0
|
||||||
|
variable_incomes = 0
|
||||||
total_floor_area = self._total_floor_area
|
total_floor_area = self._total_floor_area
|
||||||
|
#todo: split the heating between fuels
|
||||||
electricity_heating = building.heating[cte.YEAR]['insel meb'] / (self._heating_scop*1000)
|
electricity_heating = building.heating_consumption[cte.YEAR][0] / (1000)
|
||||||
electricity_cooling = building.cooling[cte.YEAR]['insel meb'] / (self._cooling_seer*1000)
|
electricity_cooling = building.cooling_consumption[cte.YEAR][0] / (1000)
|
||||||
electricity_lighting = building.lighting_electrical_demand['month']['insel meb'].sum()/1000
|
electricity_lighting = building.lighting_electrical_demand[cte.YEAR]['insel meb']/1000
|
||||||
domestic_hot_water_demand = building.domestic_hot_water_heat_demand['month']['insel meb'].sum()/1000
|
domestic_hot_water_demand = building.domestic_hot_water_consumption[cte.YEAR][0]/1000
|
||||||
electricity_plug_loads = building.appliances_electrical_demand['month']['insel meb'].sum()/1000
|
electricity_plug_loads = building.appliances_electrical_demand[cte.YEAR]['insel meb']/1000
|
||||||
total_electricity_consumption = electricity_cooling[0] + electricity_heating[0] + electricity_lighting \
|
if (building.onsite_electrical_production[cte.YEAR][0] is None):
|
||||||
|
onsite_electricity_production = 0
|
||||||
|
else:
|
||||||
|
onsite_electricity_production= building.onsite_electrical_production[cte.YEAR][0]/1000
|
||||||
|
total_electricity_consumption = electricity_cooling + electricity_heating + electricity_lighting \
|
||||||
+ domestic_hot_water_demand + electricity_plug_loads
|
+ domestic_hot_water_demand + electricity_plug_loads
|
||||||
|
|
||||||
print(f'total electricity consumption: {total_electricity_consumption}')
|
print(f'total electricity consumption: {total_electricity_consumption}')
|
||||||
|
print(f'total electricity production: {onsite_electricity_production}')
|
||||||
|
|
||||||
peak_electricity_demand = self._peak_electricity_demand
|
#todo: change when peak electricity demand is coded
|
||||||
|
peak_electricity_demand = 100 #self._peak_electricity_demand
|
||||||
operational_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
operational_cost_year_0 = total_electricity_consumption * archetype.operational_cost.fuels[0].variable[0]
|
||||||
peak_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
|
peak_cost_year_0 = peak_electricity_demand * archetype.operational_cost.fuels[0].fixed_power * 12
|
||||||
monthly_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * (total_floor_area/100)
|
monthly_cost_year_0 = archetype.operational_cost.fuels[0].fixed_monthly * 12 * (total_floor_area/100)
|
||||||
print(f'operational_cost_year_0 {operational_cost_year_0}')
|
incomes_year_0 = onsite_electricity_production * archetype.operational_cost.fuels[0].variable[0]
|
||||||
print(f'peak_cost_year_0 {peak_cost_year_0}')
|
|
||||||
print(f'monthly_cost_year_0 {monthly_cost_year_0}')
|
|
||||||
|
|
||||||
for year in range(1, self._number_of_years + 1):
|
for year in range(1, self._number_of_years + 1):
|
||||||
peak_cost += operational_cost_year_0 \
|
peak_cost += operational_cost_year_0 \
|
||||||
@ -205,27 +211,23 @@ class LifeCycleCosts:
|
|||||||
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
||||||
variable_cost += monthly_cost_year_0 \
|
variable_cost += monthly_cost_year_0 \
|
||||||
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
||||||
total_operational_costs = peak_cost + monthly_cost + variable_cost
|
variable_incomes += incomes_year_0 \
|
||||||
|
* math.pow(1 + self._consumer_price_index, year) / math.pow(1 + self._discount_rate, year)
|
||||||
|
total_operational_costs = peak_cost + monthly_cost + variable_cost - variable_incomes
|
||||||
|
|
||||||
return total_operational_costs
|
return total_operational_costs
|
||||||
|
|
||||||
def calculate_total_maintenance_costs(self):
|
def calculate_total_maintenance_costs(self):
|
||||||
building = self._building
|
building = self._building
|
||||||
archetype = self._archetype
|
archetype = self._archetype
|
||||||
factor_pv = self._factor_pv
|
#todo: change area pv when the variable exists
|
||||||
surface_roof = 0
|
surface_pv = 10 #building.area_pv
|
||||||
maintenance_pv = 0
|
maintenance_pv = 0
|
||||||
maintenance_heating = 0
|
maintenance_heating = 0
|
||||||
maintenance_cooling = 0
|
maintenance_cooling = 0
|
||||||
peak_heating = 0.1 * self._total_floor_area
|
peak_heating = building.heating_peak_load
|
||||||
peak_cooling = 0.1 * self._total_floor_area
|
peak_cooling = building.cooling_peak_load
|
||||||
|
|
||||||
for internal_zone in building.internal_zones:
|
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
|
||||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
||||||
if thermal_boundary.type == 'Roof':
|
|
||||||
surface_roof += thermal_boundary.opaque_area
|
|
||||||
surface_pv = surface_roof * factor_pv
|
|
||||||
maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv
|
maintenance_pv_0 = surface_pv * archetype.operational_cost.maintenance_pv
|
||||||
maintenance_heating_0 = peak_heating * archetype.operational_cost.maintenance_heating
|
maintenance_heating_0 = peak_heating * archetype.operational_cost.maintenance_heating
|
||||||
maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling
|
maintenance_cooling_0 = peak_cooling * archetype.operational_cost.maintenance_cooling
|
||||||
|
89
main.py
89
main.py
@ -21,10 +21,11 @@ from hub.catalog_factories.costs_catalog_factory import CostCatalogFactory
|
|||||||
import hub.helpers.constants as cte
|
import hub.helpers.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
|
||||||
|
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
||||||
|
from energy_systems_sizing import EnergySystemsSizing
|
||||||
|
|
||||||
from life_cycle_costs import LifeCycleCosts
|
from life_cycle_costs import LifeCycleCosts
|
||||||
|
|
||||||
|
|
||||||
def _search_archetype(costs_catalog, building_function):
|
def _search_archetype(costs_catalog, building_function):
|
||||||
costs_archetypes = costs_catalog.entries('archetypes').archetypes
|
costs_archetypes = costs_catalog.entries('archetypes').archetypes
|
||||||
for building_archetype in costs_archetypes:
|
for building_archetype in costs_archetypes:
|
||||||
@ -32,19 +33,18 @@ def _search_archetype(costs_catalog, building_function):
|
|||||||
return building_archetype
|
return building_archetype
|
||||||
raise KeyError('archetype not found')
|
raise KeyError('archetype not found')
|
||||||
|
|
||||||
|
|
||||||
file_path = (Path(__file__).parent.parent/'costs_workflow'/'input_files'/'selected_building_2864.geojson')
|
file_path = (Path(__file__).parent.parent/'costs_workflow'/'input_files'/'selected_building_2864.geojson')
|
||||||
climate_reference_city = 'Montreal'
|
climate_reference_city = 'Montreal'
|
||||||
weather_file = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
|
weather_file = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
|
||||||
weather_format = 'epw'
|
weather_format = 'epw'
|
||||||
construction_format = 'nrcan'
|
construction_format = 'nrcan'
|
||||||
usage_format = 'nrcan'
|
usage_format = 'comnet'
|
||||||
|
energy_systems_format = 'montreal_custom'
|
||||||
attic_heated_case = 0
|
attic_heated_case = 0
|
||||||
basement_heated_case = 1
|
basement_heated_case = 1
|
||||||
tmp_folder = (Path(__file__).parent.parent/'monthly_energy_balance_workflow'/'tmp')
|
tmp_folder = (Path(__file__).parent.parent/'monthly_energy_balance_workflow'/'tmp')
|
||||||
out_path = (Path(__file__).parent.parent / 'costs_workflow' / 'out_files')
|
out_path = (Path(__file__).parent.parent / 'costs_workflow' / 'out_files')
|
||||||
files = glob.glob(f'{out_path}/*')
|
files = glob.glob(f'{out_path}/*')
|
||||||
retrofitting_year_of_construction = 2015
|
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if file != '.gitignore':
|
if file != '.gitignore':
|
||||||
@ -53,22 +53,11 @@ for file in files:
|
|||||||
number_of_years = 30
|
number_of_years = 30
|
||||||
consumer_price_index = 0.04
|
consumer_price_index = 0.04
|
||||||
discount_rate = 0.03
|
discount_rate = 0.03
|
||||||
|
retrofitting_year_of_construction =2020
|
||||||
peak_electricity_demand = 33
|
|
||||||
factor_pv = 0.5
|
|
||||||
factor_peak_lights = 0.07
|
|
||||||
|
|
||||||
retrofitting_scenarios = [0, 1, 2, 3]
|
retrofitting_scenarios = [0, 1, 2, 3]
|
||||||
life_cycle_results = pd.DataFrame()
|
life_cycle_results = pd.DataFrame()
|
||||||
for retrofitting_scenario in retrofitting_scenarios:
|
print('[city creation start]')
|
||||||
if retrofitting_scenario == 2 or retrofitting_scenario == 3:
|
|
||||||
heating_scop = 3
|
|
||||||
cooling_seer = 4.5
|
|
||||||
else:
|
|
||||||
heating_scop = 1
|
|
||||||
cooling_seer = 2.8
|
|
||||||
|
|
||||||
print('[simulation start]')
|
|
||||||
city = GeometryFactory('geojson',
|
city = GeometryFactory('geojson',
|
||||||
path=file_path,
|
path=file_path,
|
||||||
height_field='heightmax',
|
height_field='heightmax',
|
||||||
@ -77,55 +66,66 @@ for retrofitting_scenario in retrofitting_scenarios:
|
|||||||
function_field='CODE_UTILI',
|
function_field='CODE_UTILI',
|
||||||
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
||||||
print(f'city created from {file_path}')
|
print(f'city created from {file_path}')
|
||||||
|
|
||||||
city.climate_reference_city = climate_reference_city
|
city.climate_reference_city = climate_reference_city
|
||||||
|
|
||||||
city.climate_file = (tmp_folder / f'{climate_reference_city}.cli').resolve()
|
city.climate_file = (tmp_folder / f'{climate_reference_city}.cli').resolve()
|
||||||
print(f'city created from {file_path}')
|
print(f'city created from {file_path}')
|
||||||
WeatherFactory(weather_format, city, file_name=weather_file).enrich()
|
WeatherFactory(weather_format, city, file_name=weather_file).enrich()
|
||||||
print('enrich weather... done')
|
print('enrich weather... done')
|
||||||
UsageFactory(usage_format, city).enrich()
|
|
||||||
print('enrich usage... done')
|
|
||||||
catalog = CostCatalogFactory('montreal_custom').catalog
|
|
||||||
print('costs catalog access... done')
|
|
||||||
|
|
||||||
if retrofitting_scenario == 0 or retrofitting_scenario == 2:
|
|
||||||
for building in city.buildings:
|
|
||||||
building.year_of_construction = retrofitting_year_of_construction
|
|
||||||
|
|
||||||
ConstructionFactory(construction_format, city).enrich()
|
ConstructionFactory(construction_format, city).enrich()
|
||||||
print('enrich constructions... done')
|
print('enrich constructions... done')
|
||||||
|
UsageFactory(usage_format, city).enrich()
|
||||||
# sra + monthly running
|
print('enrich usage... done')
|
||||||
|
for building in city.buildings:
|
||||||
|
building.energy_systems_archetype_name = 'system 1 gas'
|
||||||
|
EnergySystemsFactory(energy_systems_format, city).enrich()
|
||||||
|
print('enrich systems... done')
|
||||||
print('exporting:')
|
print('exporting:')
|
||||||
|
catalog = CostCatalogFactory('montreal_custom').catalog
|
||||||
|
print('costs catalog access... done')
|
||||||
sra_file = (tmp_folder / f'{city.name}_sra.xml').resolve()
|
sra_file = (tmp_folder / f'{city.name}_sra.xml').resolve()
|
||||||
SraEngine(city, sra_file, tmp_folder, weather_file)
|
SraEngine(city, sra_file, tmp_folder, weather_file)
|
||||||
# Assign radiation to the city
|
|
||||||
print(' sra processed...')
|
print(' sra processed...')
|
||||||
|
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
building.attic_heated = attic_heated_case
|
building.attic_heated = attic_heated_case
|
||||||
building.basement_heated = basement_heated_case
|
building.basement_heated = basement_heated_case
|
||||||
|
|
||||||
|
for retrofitting_scenario in retrofitting_scenarios:
|
||||||
|
|
||||||
|
if retrofitting_scenario == 1 or retrofitting_scenario==3:
|
||||||
|
for building in city.buildings:
|
||||||
|
building.year_of_construction=2020
|
||||||
|
ConstructionFactory(construction_format, city).enrich()
|
||||||
|
print('enrich retrofitted constructions... done')
|
||||||
|
|
||||||
|
if retrofitting_scenario==2 or retrofitting_scenario==3:
|
||||||
|
for building in city.buildings:
|
||||||
|
building.energy_systems_archetype_name = 'system 6 electricity pv'
|
||||||
|
EnergySystemsFactory(energy_systems_format, city).enrich()
|
||||||
|
print('enrich systems... done')
|
||||||
|
|
||||||
MonthlyEnergyBalanceEngine(city, tmp_folder)
|
MonthlyEnergyBalanceEngine(city, tmp_folder)
|
||||||
|
|
||||||
|
EnergySystemsSizing(city).enrich()
|
||||||
|
|
||||||
|
print(f'beginning costing scenario {retrofitting_scenario} systems... done')
|
||||||
|
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
try:
|
#try:
|
||||||
function = Dictionaries().hub_function_to_montreal_custom_costs_function[building.function]
|
function = Dictionaries().hub_function_to_montreal_custom_costs_function[building.function]
|
||||||
archetype = _search_archetype(catalog, function)
|
archetype = _search_archetype(catalog, function)
|
||||||
except KeyError:
|
#except KeyError:
|
||||||
logger.error(f'Building {building.name} has unknown costs archetype for building function: '
|
# logger.error(f'Building {building.name} has unknown costs archetype for building function: '
|
||||||
f'{building.function}\n')
|
# f'{building.function}\n')
|
||||||
sys.stderr.write(f'Building {building.name} has unknown costs archetype for building function: '
|
# sys.stderr.write(f'Building {building.name} has unknown costs archetype for building function: '
|
||||||
f'{building.function}\n')
|
# f'{building.function}\n')
|
||||||
continue
|
#continue
|
||||||
|
print('lcc for first building started')
|
||||||
lcc = LifeCycleCosts(building, archetype, number_of_years, consumer_price_index,
|
lcc = LifeCycleCosts(building, archetype, number_of_years, consumer_price_index,
|
||||||
discount_rate, retrofitting_scenario, heating_scop, cooling_seer,
|
discount_rate, retrofitting_scenario)
|
||||||
peak_electricity_demand, factor_pv,factor_peak_lights)
|
|
||||||
|
|
||||||
|
total_capital_costs = lcc.calculate_capital_costs()
|
||||||
total_capital_costs, yearly_capital_costs = lcc.calculate_capital_costs()
|
print(f'total capital costs {total_capital_costs}')
|
||||||
end_of_life_costs = lcc.calculate_end_of_life_costs()
|
end_of_life_costs = lcc.calculate_end_of_life_costs()
|
||||||
total_operational_costs = lcc.calculate_total_operational_costs()
|
total_operational_costs = lcc.calculate_total_operational_costs()
|
||||||
total_maintenance_costs = lcc.calculate_total_maintenance_costs()
|
total_maintenance_costs = lcc.calculate_total_maintenance_costs()
|
||||||
@ -133,6 +133,9 @@ for retrofitting_scenario in retrofitting_scenarios:
|
|||||||
life_cycle_results[f'Scenario {retrofitting_scenario}'] = [total_capital_costs, end_of_life_costs,
|
life_cycle_results[f'Scenario {retrofitting_scenario}'] = [total_capital_costs, end_of_life_costs,
|
||||||
total_operational_costs, total_maintenance_costs,
|
total_operational_costs, total_maintenance_costs,
|
||||||
life_cycle_costs]
|
life_cycle_costs]
|
||||||
|
|
||||||
life_cycle_results.index = ['total_capital_costs','end_of_life_costs', 'total_operational_costs',
|
life_cycle_results.index = ['total_capital_costs','end_of_life_costs', 'total_operational_costs',
|
||||||
'total_maintenance_costs','life_cycle_costs']
|
'total_maintenance_costs','life_cycle_costs']
|
||||||
|
|
||||||
life_cycle_results.to_excel(Path(__file__).parent/'out_files'/'Results.xlsx', index=True)
|
life_cycle_results.to_excel(Path(__file__).parent/'out_files'/'Results.xlsx', index=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user