68 lines
4.2 KiB
Python
68 lines
4.2 KiB
Python
|
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
||
|
from hub.imports.results_factory import ResultFactory
|
||
|
from pathlib import Path
|
||
|
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
|
||
|
import json
|
||
|
import hub.helpers.constants as cte
|
||
|
from scripts.energy_system_sizing_and_simulation_factory import EnergySystemsSimulationFactory
|
||
|
|
||
|
# Specify the GeoJSON file path
|
||
|
input_files_path = (Path(__file__).parent / 'input_files')
|
||
|
geojson_file_path = input_files_path / 'omhm_selected_buildings.geojson'
|
||
|
output_path = (Path(__file__).parent / 'out_files').resolve()
|
||
|
output_path.mkdir(parents=True, exist_ok=True)
|
||
|
ep_output_path = output_path / 'ep_outputs'
|
||
|
ep_output_path.mkdir(parents=True, exist_ok=True)
|
||
|
# Create city object from GeoJSON file
|
||
|
city = GeometryFactory('geojson',
|
||
|
path=geojson_file_path,
|
||
|
height_field='Hieght_LiD',
|
||
|
year_of_construction_field='ANNEE_CONS',
|
||
|
function_field='CODE_UTILI',
|
||
|
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
||
|
# Enrich city data
|
||
|
ConstructionFactory('nrcan', city).enrich()
|
||
|
UsageFactory('nrcan', city).enrich()
|
||
|
WeatherFactory('epw', city).enrich()
|
||
|
ResultFactory('energy_plus_multiple_buildings', city, ep_output_path).enrich()
|
||
|
for building in city.buildings:
|
||
|
building.energy_systems_archetype_name = 'system 1 gas'
|
||
|
EnergySystemsFactory('montreal_custom', city).enrich()
|
||
|
# for building in city.buildings:
|
||
|
# building.energy_systems_archetype_name = 'PV+4Pipe+DHW'
|
||
|
# EnergySystemsFactory('montreal_future', city).enrich()
|
||
|
# for building in city.buildings:
|
||
|
# EnergySystemsSimulationFactory('archetype13', building=building, output_path=output_path).enrich()
|
||
|
month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||
|
building_data = {}
|
||
|
for building in city.buildings:
|
||
|
building_data[f'building_{building.name}'] = {'id': building.name,
|
||
|
'total_floor_area':
|
||
|
building.thermal_zones_from_internal_zones[0].total_floor_area,
|
||
|
'yearly_heating_consumption_kWh':
|
||
|
building.heating_consumption[cte.YEAR][0] / 3.6e6,
|
||
|
'yearly_cooling_consumption_kWh':
|
||
|
building.cooling_consumption[cte.YEAR][0] / 3.6e6,
|
||
|
'yearly_dhw_consumption_kWh':
|
||
|
building.domestic_hot_water_consumption[cte.YEAR][0] / 3.6e6,
|
||
|
'heating_peak_load_kW': max(
|
||
|
building.heating_consumption[cte.HOUR]) / 3.6e6,
|
||
|
'cooling_peak_load_kW': max(
|
||
|
building.cooling_consumption[cte.HOUR]) / 3.6e6,
|
||
|
'monthly_heating_consumption_kWh':
|
||
|
{month_name: building.heating_consumption[cte.MONTH][i] / 3.6e6
|
||
|
for (i, month_name) in enumerate(month_names)},
|
||
|
'monthly_cooling_consumption_kWh':
|
||
|
{month_name: building.cooling_consumption[cte.MONTH][i] / 3.6e6
|
||
|
for (i, month_name) in enumerate(month_names)},
|
||
|
'monthly_dhw_consumption_kWh':
|
||
|
{month_name: building.domestic_hot_water_consumption[cte.MONTH][i] /
|
||
|
3.6e6 for (i, month_name) in enumerate(month_names)}}
|
||
|
|
||
|
with open(output_path / "base_case_buildings_data.json", "w") as json_file:
|
||
|
json.dump(building_data, json_file, indent=4)
|