Compare commits

..

No commits in common. "feature/athena_paper" and "main" have entirely different histories.

12 changed files with 15 additions and 12956 deletions

View File

@ -29,7 +29,7 @@ residential_systems_percentage = {'system 1 gas': 15,
'system 8 electricity': 35}
residential_new_systems_percentage = {
'Central Hydronic Air and Gas Source Heating System with Unitary Split Cooling and Air Source HP DHW and Grid Tied PV': 0,
'Central Hydronic Air and Gas Source Heating System with Unitary Split Cooling and Air Source HP DHW and Grid Tied PV': 100,
'Central Hydronic Air and Electricity Source Heating System with Unitary Split Cooling and Air Source HP DHW and Grid Tied PV': 0,
'Central Hydronic Ground and Gas Source Heating System with Unitary Split Cooling and Air Source HP DHW and Grid Tied PV': 0,
'Central Hydronic Ground and Electricity Source Heating System with Unitary Split Cooling and Air Source HP DHW '
@ -43,7 +43,7 @@ residential_new_systems_percentage = {
'Central Hydronic Ground and Electricity Source Heating System with Unitary Split and Air Source HP DHW': 0,
'Central Hydronic Water and Gas Source Heating System with Unitary Split and Air Source HP DHW': 0,
'Central Hydronic Water and Electricity Source Heating System with Unitary Split and Air Source HP DHW': 0,
'Grid Tied PV System': 100,
'Grid Tied PV System': 0,
'system 1 gas': 0,
'system 1 gas grid tied pv': 0,
'system 1 electricity': 0,
@ -70,12 +70,12 @@ non_residential_systems_percentage = {'system 1 gas': 0,
'system 1 electricity': 0,
'system 2 gas': 0,
'system 2 electricity': 0,
'system 3 and 4 gas': 50,
'system 3 and 4 electricity': 0,
'system 3 and 4 gas': 39,
'system 3 and 4 electricity': 36,
'system 5 gas': 0,
'system 5 electricity': 0,
'system 6 gas': 50,
'system 6 electricity': 0,
'system 6 gas': 13,
'system 6 electricity': 12,
'system 8 gas': 0,
'system 8 electricity': 0}

View File

@ -449,19 +449,19 @@
<generation_system_id>12</generation_system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<model_name>CS7N650MS</model_name>
<model_name>445MS</model_name>
<manufacturer>Canadian Solar</manufacturer>
<nominal_electricity_output>487</nominal_electricity_output>
<electricity_efficiency>0.209</electricity_efficiency>
<nominal_electricity_output>332</nominal_electricity_output>
<electricity_efficiency>0.201</electricity_efficiency>
<nominal_ambient_temperature>20</nominal_ambient_temperature>
<nominal_cell_temperature>41</nominal_cell_temperature>
<nominal_cell_temperature>40</nominal_cell_temperature>
<nominal_radiation>800</nominal_radiation>
<standard_test_condition_cell_temperature>25</standard_test_condition_cell_temperature>
<standard_test_condition_radiation>1000</standard_test_condition_radiation>
<standard_test_condition_maximum_power>650</standard_test_condition_maximum_power>
<standard_test_condition_maximum_power>445</standard_test_condition_maximum_power>
<cell_temperature_coefficient>0.35</cell_temperature_coefficient>
<width>2.4</width>
<height>1.3</height>
<width>2.01</width>
<height>1.048</height>
<distribution_systems/>
<energy_storage_systems/>
</pv_generation_component>

View File

@ -39,11 +39,7 @@ class ComnetUsageParameters:
comnet_archetype_usages = []
building_functions = building.function.split('_')
for function in building_functions:
try:
float(function.split('-')[0])
usages.append(function.split('-', maxsplit=1))
except ValueError:
usages.append([function])
usages.append(function.split('-'))
for usage in usages:
comnet_usage_name = Dictionaries().hub_usage_to_comnet_usage[usage[-1]]
try:

View File

@ -39,11 +39,7 @@ class NrcanUsageParameters:
comnet_archetype_usages = []
building_functions = building.function.split('_')
for function in building_functions:
try:
float(function.split('-')[0])
usages.append(function.split('-', maxsplit=1))
except ValueError:
usages.append([function])
usages.append(function.split('-'))
for usage in usages:
usage_name = Dictionaries().hub_usage_to_nrcan_usage[usage[-1]]
try:

View File

@ -1,715 +0,0 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62432779137377,
45.52978144689687
],
[
-73.62428948978814,
45.529843646754976
],
[
-73.62428715558241,
45.529842935722385
],
[
-73.62428669129987,
45.529843722686806
],
[
-73.62455917130055,
45.529925054786936
],
[
-73.6245595909436,
45.52992434615607
],
[
-73.62446519135095,
45.529896246299536
],
[
-73.62446849104188,
45.52989064570577
],
[
-73.62447769109625,
45.52987094630427
],
[
-73.62453029161364,
45.52988294591553
],
[
-73.62454669110254,
45.52984724672134
],
[
-73.6246024951276,
45.529859959978204
],
[
-73.62438782808039,
45.52979717731113
],
[
-73.62438648986468,
45.52979934558061
],
[
-73.62432779137377,
45.52978144689687
]
]
]
},
"id": 80682,
"properties": {
"name": "03081999",
"address": "avenue Ogilvy (MTL) 430",
"function": 1000,
"height": 9,
"year_of_construction": 1920
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62303571588387,
45.52932724388041
],
[
-73.62299948818809,
45.52938813901005
],
[
-73.62331805045449,
45.529481055767306
],
[
-73.6233566220688,
45.52941843031552
],
[
-73.62303571588387,
45.52932724388041
]
]
]
},
"id": 88639,
"properties": {
"name": "03081852",
"address": "rue Jean-Talon Ouest (MTL+MTR) 439",
"function": 5010,
"height": 26,
"year_of_construction": 1949
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62311241248345,
45.52919840147415
],
[
-73.62311019024206,
45.52920204641776
],
[
-73.62303573502088,
45.52932721326529
],
[
-73.62335661696743,
45.52941843931942
],
[
-73.62343249037193,
45.52929514599691
],
[
-73.62315944683472,
45.52921215790384
],
[
-73.62311241248345,
45.52919840147415
]
]
]
},
"id": 90169,
"properties": {
"name": "03081854",
"address": "rue Jean-Talon Ouest (MTL+MTR) 449",
"function": 6000,
"height": 26,
"year_of_construction": 1958
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62299948818809,
45.52938813901005
],
[
-73.62296415348037,
45.529447606021584
],
[
-73.62329827662954,
45.52954713699512
],
[
-73.62330071539078,
45.52954297710646
],
[
-73.62328318983691,
45.52953764647924
],
[
-73.62331805045449,
45.529481055767306
],
[
-73.62299948818809,
45.52938813901005
]
]
]
},
"id": 94008,
"properties": {
"name": "03081850",
"address": "rue Jean-Talon Ouest (MTL+MTR) 431",
"function": 5010,
"height": 25,
"year_of_construction": 1947
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62396269703619,
45.529933785089675
],
[
-73.624056068251,
45.529774883742355
],
[
-73.62296337152156,
45.52944890803058
],
[
-73.62286618381245,
45.5296136588529
],
[
-73.62396269703619,
45.529933785089675
]
]
]
},
"id": 94612,
"properties": {
"name": "03078306",
"address": "rue Hutchison (MTL+OUT) 7270",
"function": 6911,
"height": 19,
"year_of_construction": 1967
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.6233942899051,
45.529522745764815
],
[
-73.62363619020377,
45.52959334652593
],
[
-73.62375659127079,
45.529389846227495
],
[
-73.62351469019796,
45.52931914673739
],
[
-73.6233942899051,
45.529522745764815
]
]
]
},
"id": 97189,
"properties": {
"name": "03078077",
"address": "rue Durocher (MTL) 7225",
"function": 1000,
"height": 22,
"year_of_construction": 1988
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62448097226299,
45.52975016004159
],
[
-73.62441599080704,
45.52975224647492
],
[
-73.62441549044436,
45.52975234600218
],
[
-73.62438782808039,
45.52979717731113
],
[
-73.6246024951276,
45.529859959978204
],
[
-73.62462789041342,
45.52986574613387
],
[
-73.62462799027377,
45.52986574602493
],
[
-73.62466419006458,
45.52980504657923
],
[
-73.62463488996796,
45.52979634651428
],
[
-73.6246354856489,
45.52979534974257
],
[
-73.62448097226299,
45.52975016004159
]
]
]
},
"id": 98067,
"properties": {
"name": "03081997",
"address": "avenue Ogilvy (MTL) 436",
"function": 1000,
"height": 9,
"year_of_construction": 1924
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62306608986638,
45.53123514589538
],
[
-73.62307609011799,
45.53123684661453
],
[
-73.62307128947408,
45.531251146625266
],
[
-73.62307169042535,
45.53125124697522
],
[
-73.62324729035045,
45.53128454694852
],
[
-73.62324749110766,
45.53128384665737
],
[
-73.6232837901444,
45.53114324637413
],
[
-73.62354719026658,
45.531176747141714
],
[
-73.62354719132621,
45.53117664635862
],
[
-73.62373849147549,
45.53086894638473
],
[
-73.62381089067591,
45.53089124602803
],
[
-73.62387648993575,
45.53078564721059
],
[
-73.6237958908445,
45.53075994610609
],
[
-73.62387469036925,
45.530637746251344
],
[
-73.62389849084242,
45.5306453465733
],
[
-73.62402016196077,
45.530424373385436
],
[
-73.62400124661674,
45.53041888420673
],
[
-73.6240288982657,
45.53037181240913
],
[
-73.62370894342085,
45.53027896844428
],
[
-73.62371270490526,
45.530272563816474
],
[
-73.62369550245748,
45.530267572142506
],
[
-73.62366339055015,
45.53030374624078
],
[
-73.62352199140788,
45.5305327471539
],
[
-73.62354028982347,
45.53053714647435
],
[
-73.6234729907425,
45.530675846612866
],
[
-73.62347579097046,
45.53067654636016
],
[
-73.62353679058056,
45.530686746668756
],
[
-73.6235217906812,
45.53073114654062
],
[
-73.62344559093653,
45.530718345920064
],
[
-73.6234348905377,
45.53075004620763
],
[
-73.6224527899842,
45.530586646872344
],
[
-73.62245609060858,
45.530576646124366
],
[
-73.62245539007843,
45.53057654609339
],
[
-73.62233359060535,
45.53055644642029
],
[
-73.62231499003069,
45.530612246449806
],
[
-73.62233099021513,
45.53061484694738
],
[
-73.62229219028784,
45.530731346535255
],
[
-73.62236219082739,
45.530743045964314
],
[
-73.62224229077214,
45.53109754615554
],
[
-73.62306608986638,
45.53123514589538
]
]
]
},
"id": 107729,
"properties": {
"name": "05014001",
"address": "rue Jean-Talon Ouest (MTL+MTR) 375",
"function": 5499,
"height": 16,
"year_of_construction": 1931
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62412409067701,
45.52965594651627
],
[
-73.62410669036326,
45.529683746151875
],
[
-73.62410689030298,
45.529683845816784
],
[
-73.62425989088317,
45.529730045489586
],
[
-73.62434759049171,
45.52958384679624
],
[
-73.62434329108127,
45.529582545809944
],
[
-73.62382999065228,
45.52941664667557
],
[
-73.62382858976096,
45.529418846500974
],
[
-73.62375149120163,
45.52954534663778
],
[
-73.6237561902518,
45.52954674619571
],
[
-73.62381459005861,
45.529561746216324
],
[
-73.62379778991384,
45.529594146931544
],
[
-73.6237978897737,
45.529594146823314
],
[
-73.62396899141011,
45.52964674581957
],
[
-73.62398899105872,
45.529614445987995
],
[
-73.62412409067701,
45.52965594651627
]
]
]
},
"id": 115302,
"properties": {
"name": "03078079",
"address": "rue Durocher (MTL) 7255",
"function": 1000,
"height": 21,
"year_of_construction": 1981
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.624056068251,
45.529774883742355
],
[
-73.62396269703619,
45.529933785089675
],
[
-73.624466791505,
45.530080746635406
],
[
-73.62455917130055,
45.529925054786936
],
[
-73.624056068251,
45.529774883742355
]
]
]
},
"id": 123929,
"properties": {
"name": "03078303",
"address": "rue Hutchison (MTL+OUT) 7300",
"function": 9510,
"height": 9,
"year_of_construction": 1950
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.62452499092255,
45.529748746108915
],
[
-73.62448097226299,
45.52975016004159
],
[
-73.6246354856489,
45.52979534974257
],
[
-73.62471119047582,
45.529668646272796
],
[
-73.62470479138236,
45.52966674649997
],
[
-73.62445938853517,
45.52959235809751
],
[
-73.62445536849485,
45.52959118278851
],
[
-73.6243847903687,
45.52970614660761
],
[
-73.62452499092255,
45.529748746108915
],
[
-73.6245255898649,
45.52974864647372
],
[
-73.62452549044556,
45.52974884634636
],
[
-73.62452499092255,
45.529748746108915
]
]
]
},
"id": 128445,
"properties": {
"name": "03081995",
"address": "avenue Ogilvy (MTL) 444",
"function": 1000,
"height": 10,
"year_of_construction": 1955
}
}
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

132
main.py
View File

@ -1,132 +0,0 @@
from pathlib import Path
import pandas as pd
from building_modelling.ep_run_enrich import energy_plus_workflow
from hub.helpers.dictionaries import Dictionaries
from hub.imports.construction_factory import ConstructionFactory
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 energy_system_modelling_package import random_assignation
from energy_system_modelling_package.energy_system_modelling_factories.pv_assessment.electricity_demand_calculator import HourlyElectricityDemand
import hub.helpers.constants as cte
import json
base_path = Path(__file__).parent.resolve()
input_files_path = base_path / 'input_files'
input_files_path.mkdir(parents=True, exist_ok=True)
output_files_path = base_path / 'out_files'
output_files_path.mkdir(exist_ok=True, parents=True)
energy_plus_output_path = output_files_path / 'energy_plus_outputs'
energy_plus_output_path.mkdir(parents=True, exist_ok=True)
geojson_path = input_files_path / 'selected_buildings.geojson'
city = GeometryFactory(file_type='geojson',
path=geojson_path,
aliases_field=['address'],
height_field='height',
year_of_construction_field='year_of_construction',
function_field='function',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
for building in city.buildings:
if Dictionaries().hub_function_to_nrcan_construction_function[building.function] == 'n/a':
building.function = cte.WAREHOUSE
ConstructionFactory('nrcan', city).enrich()
UsageFactory('nrcan', city).enrich()
WeatherFactory('epw', city).enrich()
residential_buildings = []
non_residential_buildings = []
for building in city.buildings:
if building.function == cte.RESIDENTIAL:
residential_buildings.append(building)
else:
non_residential_buildings.append(building)
# random_assignation.call_random(residential_buildings, random_assignation.residential_systems_percentage)
# random_assignation.call_random(non_residential_buildings, random_assignation.non_residential_systems_percentage)
# EnergySystemsFactory('montreal_future', city).enrich()
base_results = pd.read_csv(output_files_path / 'results_summary.csv')
energy_system_archetypes = base_results['energy_system_archetype_name'].to_list()
for (i, building) in enumerate(city.buildings):
building.energy_systems_archetype_name = energy_system_archetypes[i]
EnergySystemsFactory('montreal_future', city).enrich()
energy_plus_workflow(city, energy_plus_output_path)
# hourly_simulation_results = {}
# hourly_elec_consumption = pd.DataFrame()
# hourly_lighting_appliance_consumption = pd.DataFrame()
# for building in city.buildings:
# hourly_electricity_consumption = HourlyElectricityDemand(building).calculate()
# heating_electricity_consumption = building.heating_consumption[
# cte.HOUR] if 'electricity' in building.energy_systems_archetype_name else [0] * len(
# building.heating_demand[cte.HOUR])
# dhw_electricity_consumption = building.domestic_hot_water_consumption[
# cte.HOUR] if 'electricity' in building.energy_systems_archetype_name else [0] * len(
# building.domestic_hot_water_heat_demand[cte.HOUR])
# if building.cooling_consumption[cte.YEAR][0] == 0:
# cooling_electricity_consumption = [building.cooling_demand[cte.HOUR][i] / (2 * 3.23) for i in
# range(len(building.cooling_consumption[cte.HOUR]))]
# hourly_electricity_consumption = [hourly_electricity_consumption[i] + cooling_electricity_consumption[i] for i in range(len(hourly_electricity_consumption))]
# else:
# cooling_electricity_consumption = building.cooling_consumption[cte.HOUR]
# lighting = building.lighting_electrical_demand[cte.HOUR]
# appliance = building.appliances_electrical_demand[cte.HOUR]
#
# results = pd.DataFrame()
# results['heating_electricity_consumption_kWh'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in
# heating_electricity_consumption]
# results['cooling_electricity_consumption_kWh'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in
# cooling_electricity_consumption]
# results['dhw_electricity_consumption_kWh'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in
# dhw_electricity_consumption]
# results['lighting_kWh'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in lighting]
#
# results['appliance_kWh'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in appliance]
# results['lighting_appliance_total_kWh'] = [(lighting[i] + appliance[i]) / (cte.WATTS_HOUR_TO_JULES * 1000)
# for i in range(len(lighting))]
# results['total_electricity_consumption_kWh'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in hourly_electricity_consumption]
# results.to_csv(output_files_path / 'paper_results' / 'individual_building_simulation_results' / f'{building.name}.csv')
# hourly_elec_consumption[f'{building.name}'] = [x / (cte.WATTS_HOUR_TO_JULES * 1000) for x in hourly_electricity_consumption]
# hourly_lighting_appliance_consumption[f'{building.name}'] = [(lighting[i] + appliance[i]) / (cte.WATTS_HOUR_TO_JULES * 1000)
# for i in range(len(lighting))]
#
# hourly_elec_consumption.to_csv(output_files_path / 'paper_results' / 'total_hourly_electricity_consumption.csv')
# hourly_lighting_appliance_consumption.to_csv(output_files_path / 'paper_results' / 'total_lighting_appliance.csv')
building_names = [building.name for building in city.buildings]
building_addresses = [building.aliases[0] for building in city.buildings]
building_heights = [building.max_height for building in city.buildings]
buildings_total_floor_areas = [building.thermal_zones_from_internal_zones[0].total_floor_area
for building in city.buildings]
buildings_roof_areas = [building.roofs[0].perimeter_area for building in city.buildings]
building_energy_system_archetype_names = [building.energy_systems_archetype_name for building in city.buildings]
building_yearly_heating_electricity_consumptions = []
building_yearly_dhw_electricity_consumptions = []
for building in city.buildings:
if 'electricity' in building.energy_systems_archetype_name:
building_yearly_heating_electricity_consumptions.append(building.heating_consumption[cte.YEAR][0] /
(cte.WATTS_HOUR_TO_JULES * 1000))
building_yearly_dhw_electricity_consumptions.append(building.domestic_hot_water_consumption[cte.YEAR][0] /
(cte.WATTS_HOUR_TO_JULES * 1000))
else:
building_yearly_heating_electricity_consumptions.append(0)
building_yearly_dhw_electricity_consumptions.append(0)
building_yearly_cooling_consumptions = []
for building in city.buildings:
if building.cooling_consumption[cte.YEAR][0] == 0:
building_yearly_cooling_consumptions.append(building.cooling_demand[cte.YEAR][0] / (2 * 3.23 * cte.WATTS_HOUR_TO_JULES * 1000))
else:
building_yearly_cooling_consumptions.append(building.cooling_consumption[cte.YEAR][0] / (cte.WATTS_HOUR_TO_JULES * 1000))
building_yearly_lighting_demands = [building.lighting_electrical_demand[cte.YEAR][0] / (cte.WATTS_HOUR_TO_JULES * 1000)
for building in city.buildings]
building_yearly_appliance_demands = [building.appliances_electrical_demand[cte.YEAR][0] / (cte.WATTS_HOUR_TO_JULES * 1000)
for building in city.buildings]
summary = pd.DataFrame()
summary['building_name'] = building_names
summary['building_address'] = building_addresses
summary['building_height_m'] = building_heights
summary['total_floor_area_m2'] = buildings_total_floor_areas
summary['roof_area_m2'] = buildings_roof_areas
summary['energy_system_archetype_name'] = building_energy_system_archetype_names
summary['yearly_heating_electricity_consumption_kWh'] = building_yearly_heating_electricity_consumptions
summary['yearly_cooling_electricity_consumption_kWh'] = building_yearly_cooling_consumptions
summary['yearly_dhw_electricity_consumption_kWh'] = building_yearly_dhw_electricity_consumptions
summary['yearly_lighting_consumption_kWh'] = building_yearly_lighting_demands
summary['yearly_appliance_consumption_kWh'] = building_yearly_appliance_demands
summary.to_csv(output_files_path / 'yearly_results.csv', index=False)

View File

@ -1,98 +0,0 @@
from pathlib import Path
import subprocess
import pandas as pd
from energy_system_modelling_package import random_assignation
from energy_system_modelling_package.energy_system_modelling_factories.pv_assessment.pv_system_assessment import \
PvSystemAssessment
from energy_system_modelling_package.energy_system_modelling_factories.pv_assessment.solar_calculator import \
SolarCalculator
from hub.imports.energy_systems_factory import EnergySystemsFactory
from hub.imports.geometry_factory import GeometryFactory
from hub.helpers.dictionaries import Dictionaries
from hub.imports.construction_factory import ConstructionFactory
from hub.imports.usage_factory import UsageFactory
from hub.imports.weather_factory import WeatherFactory
from hub.imports.results_factory import ResultFactory
from hub.exports.exports_factory import ExportsFactory
import hub.helpers.constants as cte
# Define paths for input and output directories, ensuring directories are created if they do not exist
base_path = Path(__file__).parent.resolve()
input_files_path = base_path / 'input_files'
input_files_path.mkdir(parents=True, exist_ok=True)
output_files_path = base_path / 'out_files'
output_files_path.mkdir(exist_ok=True, parents=True)
energy_plus_output_path = output_files_path / 'energy_plus_outputs'
energy_plus_output_path.mkdir(parents=True, exist_ok=True)
geojson_path = input_files_path / 'selected_buildings.geojson'
sra_output_path = output_files_path / 'sra_outputs'
sra_output_path.mkdir(parents=True, exist_ok=True)
pv_assessment_path = output_files_path / 'pv_outputs'
pv_assessment_path.mkdir(parents=True, exist_ok=True)
# Generate a GeoJSON file for city buildings based on latitude, longitude, and building dimensions
# Initialize a city object from the geojson file, mapping building functions using a predefined dictionary
city = GeometryFactory(file_type='geojson',
path=geojson_path,
height_field='height',
year_of_construction_field='year_of_construction',
function_field='function',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
# Enrich city data with construction, usage, and weather information specific to the location
for building in city.buildings:
if Dictionaries().hub_function_to_nrcan_construction_function[building.function] == 'n/a':
building.function = cte.WAREHOUSE
ConstructionFactory('nrcan', city).enrich()
UsageFactory('nrcan', city).enrich()
WeatherFactory('epw', city).enrich()
# Execute the EnergyPlus workflow to simulate building energy performance and generate output
# energy_plus_workflow(city, energy_plus_output_path)
# Export the city data in SRA-compatible format to facilitate solar radiation assessment
ExportsFactory('sra', city, sra_output_path).export()
# Run SRA simulation using an external command, passing the generated SRA XML file path as input
sra_path = (sra_output_path / f'{city.name}_sra.xml').resolve()
subprocess.run(['sra', str(sra_path)])
# Enrich city data with SRA simulation results for subsequent analysis
ResultFactory('sra', city, sra_output_path).enrich()
# Assign PV system archetype name to the buildings in city
random_assignation.call_random(city.buildings, random_assignation.residential_new_systems_percentage)
# Enrich city model with Montreal future systems parameters
EnergySystemsFactory('montreal_future', city).enrich()
# # Initialize solar calculation parameters (e.g., azimuth, altitude) and compute irradiance and solar angles
tilt_angle = 37
solar_parameters = SolarCalculator(city=city,
surface_azimuth_angle=180,
tilt_angle=tilt_angle,
standard_meridian=-75)
solar_angles = solar_parameters.solar_angles # Obtain solar angles for further analysis
solar_parameters.tilted_irradiance_calculator() # Calculate the solar radiation on a tilted surface
# # PV modelling building by building
# List of available PV modules ['RE400CAA Pure 2', 'RE410CAA Pure 2', 'RE420CAA Pure 2', 'RE430CAA Pure 2',
# 'REC600AA Pro M', 'REC610AA Pro M', 'REC620AA Pro M', 'REC630AA Pro M', 'REC640AA Pro M']
building_names = []
hourly_pv_outputs = pd.DataFrame()
for building in city.buildings:
building_names.append(building.name)
pv_modeller = PvSystemAssessment(building=building,
pv_system=None,
battery=None,
tilt_angle=tilt_angle,
solar_angles=solar_angles,
pv_installation_type='rooftop',
simulation_model_type='explicit',
module_model_name='CS7N650MS',
inverter_efficiency=0.95,
system_catalogue_handler='montreal_future',
roof_percentage_coverage=0.75,
facade_coverage_percentage=0,
csv_output=False,
output_path=pv_assessment_path)
pv_modeller.enrich()
results = pv_modeller.results
pv_output = [x / 1000 for x in results['total_hourly_pv_system_output_W']]
hourly_pv_outputs[f'{building.name}'] = pv_output
hourly_pv_outputs.to_csv(output_files_path / 'paper_results' / 'hourly_pv_outputs.csv')

File diff suppressed because one or more lines are too long