energy_system_modelling_wor.../main.py
2024-06-24 11:48:01 -04:00

48 lines
1.9 KiB
Python

from pathlib import Path
from scripts.district_heating_network.simultinity_factor import DemandShiftProcessor
from scripts.ep_run_enrich import energy_plus_workflow
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 scripts.district_heating_network.road_processor import road_processor
from scripts.district_heating_network.district_heating_network_creator import DistrictHeatingNetworkCreator
from scripts.district_heating_network.geojson_graph_creator import networkx_to_geojson
import hub.helpers.constants as cte
file_path = (Path(__file__).parent / 'input_files' / 'output_buildings.geojson')
output_path = (Path(__file__).parent / 'out_files').resolve()
# Create city object from GeoJSON file
city = GeometryFactory('geojson',
path=file_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
ConstructionFactory('nrcan', city).enrich()
UsageFactory('nrcan', city).enrich()
WeatherFactory('epw', city).enrich()
energy_plus_workflow(city)
processor = DemandShiftProcessor(city)
processor.process_demands()
location = [45.43658024628209, -73.66134636914408]
roads_file = road_processor(location[1], location[0], 0.002)
dhn_creator = DistrictHeatingNetworkCreator(file_path, roads_file)
network_graph = dhn_creator.run()
networkx_to_geojson(network_graph)
dhn_creator.plot_network_graph()
print("Simultaneity Factor Heating:", city.simultaneity_factor_heating)
print("Simultaneity Factor Cooling:", city.simultaneity_factor_cooling)