Changes hub to incorporate change of units in infiltration

This commit is contained in:
Oriol Gavalda 2023-03-31 08:28:49 -04:00
parent d78ab8010c
commit 4ea93230eb
5 changed files with 377 additions and 45 deletions

View File

@ -0,0 +1,109 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 2195,
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.56187987465643,
45.603573161871964
],
[
-73.56154997455167,
45.603344761951234
],
[
-73.56133437468162,
45.603498162010624
],
[
-73.56166427478644,
45.60372666175607
],
[
-73.56187987465643,
45.603573161871964
]
]
]
},
"properties": {
"OBJECTID_12_13": 2195,
"ID_UEV": "02036049",
"CIVIQUE_DE": " 7801",
"CIVIQUE_FI": " 7811",
"NOM_RUE": "boulevard Louis-H.-La Fontaine (ANJ+MTL)",
"SUITE_DEBU": " ",
"MUNICIPALI": "50",
"ETAGE_HORS": 0,
"NOMBRE_LOG": 0,
"ANNEE_CONS": 1977,
"CODE_UTILI": "6000",
"LETTRE_DEB": " ",
"LETTRE_FIN": " ",
"LIBELLE_UT": "Immeuble \u00c3\u00a0 bureaux",
"CATEGORIE_": "R\u00c3\u00a9gulier",
"MATRICULE8": "9951-95-9324-0-000-0000",
"SUPERFICIE": 3138,
"SUPERFIC_1": 5154,
"NO_ARROND_": "REM09",
"Shape_Leng": 0.00133181909486,
"OBJECTID": 2195,
"Join_Count": 1,
"TARGET_FID": 2195,
"feature_id": "0450eea8-8539-49b3-8f82-3012ab8a4fbf",
"md_id": " ",
"acqtech": 1360,
"acqtech_en": "Lidar",
"acqtech_fr": "Lidar",
"provider": 461,
"provideren": "Municipal",
"providerfr": "Municipal",
"datemin": "20151124",
"datemax": "20151208",
"haccmin": 2,
"haccmax": 2,
"vaccmin": 1,
"vaccmax": 1,
"heightmin": 0.88,
"heightmax": 52.01,
"elevmin": 42.22,
"elevmax": 42.79,
"bldgarea": 865.78,
"comment": " ",
"OBJECTID_1": 2195,
"Shape_Le_1": 0.00133181909486,
"Shape_Ar_1": 9.98769750036e-08,
"OBJECTID_12": 2195,
"Join_Count_1": 1,
"TARGET_FID_1": 2194,
"g_objectid": "899552",
"g_co_mrc": "66023",
"g_code_mun": "66023",
"g_arrond": "REM09",
"g_anrole": "2019",
"g_usag_pre": "Service",
"g_no_lot": "1114291",
"g_nb_poly_": "1",
"g_utilisat": "6000",
"g_nb_logem": " ",
"g_nb_locau": "12",
"g_descript": "Unit\u00c3\u00a9 d'\u00c3\u00a9valuation",
"g_id_provi": "66023995195932400000000",
"g_sup_tota": "3137.8",
"g_geometry": "0.00248417",
"g_geomet_1": "3.5989e-007",
"g_dat_acqu": "2020-02-12 00:00:00.0000000",
"g_dat_char": "2020-02-17 00:00:00.0000000",
"Shape_Leng_1": 0.00133181909486,
"Shape_Area_1": 9.98769750036e-08,
"Shape_Length": 0.001331818832464929,
"Shape_Area": 9.98769750036e-08
}
}
]
}

View File

@ -0,0 +1,109 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 3212,
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.56319817555533,
45.607645262419
],
[
-73.56305237566659,
45.60758216238696
],
[
-73.56292617560246,
45.60772556198515
],
[
-73.56307197639057,
45.60778876184196
],
[
-73.56319817555533,
45.607645262419
]
]
]
},
"properties": {
"OBJECTID_12_13": 3212,
"ID_UEV": "02034223",
"CIVIQUE_DE": " 7950",
"CIVIQUE_FI": " 7960",
"NOM_RUE": "boulevard M\u00c3\u00a9tropolitain Est (ANJ+MTE+MTL+SLN)",
"SUITE_DEBU": " ",
"MUNICIPALI": "50",
"ETAGE_HORS": 0,
"NOMBRE_LOG": 0,
"ANNEE_CONS": 1990,
"CODE_UTILI": "6000",
"LETTRE_DEB": " ",
"LETTRE_FIN": " ",
"LIBELLE_UT": "Immeuble \u00c3\u00a0 bureaux",
"CATEGORIE_": "R\u00c3\u00a9gulier",
"MATRICULE8": "9951-89-7779-0-000-0000",
"SUPERFICIE": 1074,
"SUPERFIC_1": 472,
"NO_ARROND_": "REM09",
"Shape_Leng": 0.000699899255932,
"OBJECTID": 3212,
"Join_Count": 1,
"TARGET_FID": 3212,
"feature_id": "c26f3093-10e8-40fa-a891-5b39a78c13a0",
"md_id": " ",
"acqtech": 1360,
"acqtech_en": "Lidar",
"acqtech_fr": "Lidar",
"provider": 461,
"provideren": "Municipal",
"providerfr": "Municipal",
"datemin": "20151124",
"datemax": "20151208",
"haccmin": 2,
"haccmax": 2,
"vaccmin": 1,
"vaccmax": 1,
"heightmin": 1.12,
"heightmax": 11.43,
"elevmin": 41.2,
"elevmax": 41.56,
"bldgarea": 250.44,
"comment": " ",
"OBJECTID_1": 3212,
"Shape_Le_1": 0.000699899255932,
"Shape_Ar_1": 2.888454e-08,
"OBJECTID_12": 3212,
"Join_Count_1": 1,
"TARGET_FID_1": 3211,
"g_objectid": "899600",
"g_co_mrc": "66023",
"g_code_mun": "66023",
"g_arrond": "REM09",
"g_anrole": "2019",
"g_usag_pre": "Service",
"g_no_lot": "1113835",
"g_nb_poly_": "1",
"g_utilisat": "6000",
"g_nb_logem": " ",
"g_nb_locau": "2",
"g_descript": "Unit\u00c3\u00a9 d'\u00c3\u00a9valuation",
"g_id_provi": "66023995189777900000000",
"g_sup_tota": "1074.3",
"g_geometry": "0.00146921",
"g_geomet_1": "1.24096e-007",
"g_dat_acqu": "2020-02-12 00:00:00.0000000",
"g_dat_char": "2020-02-17 00:00:00.0000000",
"Shape_Leng_1": 0.000699899255932,
"Shape_Area_1": 2.888454e-08,
"Shape_Length": 0.0006998985885455892,
"Shape_Area": 2.888454e-08
}
}
]
}

View File

@ -0,0 +1,113 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 839,
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-73.53597016639003,
45.594489960643216
],
[
-73.5359648657859,
45.594488360749324
],
[
-73.53570136622506,
45.59440716096174
],
[
-73.53559426596257,
45.59457846112713
],
[
-73.53586306612755,
45.59466126080861
],
[
-73.53597016639003,
45.594489960643216
]
]
]
},
"properties": {
"OBJECTID_12_13": 839,
"ID_UEV": "02053563",
"CIVIQUE_DE": " 7744",
"CIVIQUE_FI": " 7744",
"NOM_RUE": "rue Sherbrooke Est (MTE+MTL)",
"SUITE_DEBU": " ",
"MUNICIPALI": "50",
"ETAGE_HORS": 3,
"NOMBRE_LOG": 0,
"ANNEE_CONS": 1984,
"CODE_UTILI": "6000",
"LETTRE_DEB": " ",
"LETTRE_FIN": " ",
"LIBELLE_UT": "Immeuble \u00c3\u00a0 bureaux",
"CATEGORIE_": "R\u00c3\u00a9gulier",
"MATRICULE8": "0250-05-1114-8-000-0000",
"SUPERFICIE": 899,
"SUPERFIC_1": 1470,
"NO_ARROND_": "REM22",
"Shape_Leng": 0.000966577525564,
"OBJECTID": 839,
"Join_Count": 1,
"TARGET_FID": 839,
"feature_id": "47324f3e-be9b-4567-862b-5b790cc29e31",
"md_id": " ",
"acqtech": 1360,
"acqtech_en": "Lidar",
"acqtech_fr": "Lidar",
"provider": 461,
"provideren": "Municipal",
"providerfr": "Municipal",
"datemin": "20151124",
"datemax": "20151208",
"haccmin": 2,
"haccmax": 2,
"vaccmin": 1,
"vaccmax": 1,
"heightmin": 4.5,
"heightmax": 44.42,
"elevmin": 28.66,
"elevmax": 31.51,
"bldgarea": 476.19,
"comment": " ",
"OBJECTID_1": 839,
"Shape_Le_1": 0.000966577525564,
"Shape_Ar_1": 5.49089399978e-08,
"OBJECTID_12": 839,
"Join_Count_1": 1,
"TARGET_FID_1": 838,
"g_objectid": "1052007",
"g_co_mrc": "66023",
"g_code_mun": "66023",
"g_arrond": "REM22",
"g_anrole": "2019",
"g_usag_pre": "Service",
"g_no_lot": "1323631",
"g_nb_poly_": "1",
"g_utilisat": "6000",
"g_nb_logem": " ",
"g_nb_locau": "5",
"g_descript": "Unit\u00c3\u00a9 d'\u00c3\u00a9valuation",
"g_id_provi": "66023025005111480000000",
"g_sup_tota": "899.2",
"g_geometry": "0.00137524",
"g_geomet_1": "1.03313e-007",
"g_dat_acqu": "2020-02-12 00:00:00.0000000",
"g_dat_char": "2020-02-17 00:00:00.0000000",
"Shape_Leng_1": 0.000966577525564,
"Shape_Area_1": 5.49089399978e-08,
"Shape_Length": 0.000966578213732475,
"Shape_Area": 5.49089399978e-08
}
}
]
}

90
main.py
View File

@ -10,56 +10,56 @@ from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
from sra_engine import SraEngine from sra_engine import SraEngine
try: #try:
file_path = (Path(__file__).parent / 'input_files' / 'selected_building.geojson') file_path = (Path(__file__).parent / 'input_files' / 'selected_building_2195.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 = 'nrcan'
attic_heated_case = 0 attic_heated_case = 0
basement_heated_case = 1 basement_heated_case = 1
out_path = (Path(__file__).parent / 'output_files') out_path = (Path(__file__).parent / 'output_files')
tmp_folder = (Path(__file__).parent / 'tmp') tmp_folder = (Path(__file__).parent / 'tmp')
print('[simulation start]') print('[simulation start]')
city = GeometryFactory('geojson', city = GeometryFactory('geojson',
path=file_path, path=file_path,
height_field='building_height', height_field='heightmax',
year_of_construction_field='ANNEE_CONS', year_of_construction_field='ANNEE_CONS',
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
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')
ConstructionFactory(construction_format, city).enrich() ConstructionFactory(construction_format, city).enrich()
print('enrich constructions... done') print('enrich constructions... done')
UsageFactory(usage_format, city).enrich() UsageFactory(usage_format, city).enrich()
print('enrich usage... done') print('enrich usage... done')
print('exporting:') print('exporting:')
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 # 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
MonthlyEnergyBalanceEngine(city, tmp_folder) MonthlyEnergyBalanceEngine(city, tmp_folder)
print(' insel processed...') print(' insel processed...')
results = Results(city, out_path) results = Results(city, out_path)
results.print() results.print()
print('print results...') print('print results...')
print('[simulation end]') print('[simulation end]')
except Exception as ex: #except Exception as ex:
print(ex) # print(ex)
print('error: ', ex) # print('error: ', ex)
print('[simulation abort]') #print('[simulation abort]')

View File

@ -27,3 +27,4 @@ class MonthlyEnergyBalanceEngine:
subprocess.run(['insel', str(insel_file)], stdout=subprocess.DEVNULL) subprocess.run(['insel', str(insel_file)], stdout=subprocess.DEVNULL)
except (SubprocessError, TimeoutExpired, CalledProcessError) as error: except (SubprocessError, TimeoutExpired, CalledProcessError) as error:
raise Exception(error) raise Exception(error)