Skip to content

Commit

Permalink
WIP: first steps in reading & handling multiple ghes during regular u…
Browse files Browse the repository at this point in the history
…sage
  • Loading branch information
vtnate committed Aug 7, 2024
1 parent 8c8c03e commit fd9a78a
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions geojson_modelica_translator/geojson_modelica_translator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md

import json
import logging
from pathlib import Path

Expand Down Expand Up @@ -31,13 +30,12 @@
}


def _parse_couplings(geojson, sys_params, sys_params_filepath, sys_param_district_type): #
def _parse_couplings(geojson, sys_params, sys_param_district_type): #
"""Given config files, construct the necessary models and their couplings which
can then be passed to CouplingGraph.
:param geojson: UrbanOptGeoJson
:param sys_params: SystemParameters
:param sys_params_filepath: str - path to system parameters file
:param sys_param_district_type: str - type of district ["fourth_generation", "fifth_generation"]
:return: list[Coupling], list of couplings to be passed to CouplingGraph
"""
Expand Down Expand Up @@ -65,15 +63,13 @@ def _parse_couplings(geojson, sys_params, sys_params_filepath, sys_param_distric
ambient_water_stub = NetworkDistributionPump(sys_params)

if sys_params.get_param("$.district_system.fifth_generation.ghe_parameters"):
# load loop order from ThermalNetwork library
ghe_loop_order_path = Path(sys_params_filepath).parent / "ghe_loop_order.json"
load_loop_order_path = Path(sys_params_filepath).parent / "loop_order.json"
if not ghe_loop_order_path.is_file() or not load_loop_order_path.is_file():
# load loop order file exported from ThermalNetwork library
loop_order_path = Path(sys_params.filename).parent / "_loop_order.json"
if not loop_order_path.is_file():
raise SystemExit(
"Sizing data from ThermalNetwork library not found. That is required to generate a GHE model. Exiting."
"Sizing data from ThermalNetwork library not found. Required to generate a GHE model. Exiting."
)
ghe_order: dict = json.loads(ghe_loop_order_path.read_text())
load_order: dict = json.loads(load_loop_order_path.read_text())
# loop_order: dict = json.loads(loop_order_path.read_text())
# create ground coupling
ground_coupling = GroundCoupling(sys_params)
for ghe in sys_params.get_param("$.district_system.fifth_generation.ghe_parameters.ghe_specific_params"):
Expand Down Expand Up @@ -156,9 +152,7 @@ def __init__(
# Use different couplings for each district system type
# The first key of district_system is always the district system type
sys_param_district_type = next(iter(self._system_parameters.get_param("district_system")))
self._couplings = _parse_couplings(
self._geojson, self._system_parameters, sys_params_filepath, sys_param_district_type
)
self._couplings = _parse_couplings(self._geojson, self._system_parameters, sys_param_district_type)

self._root_dir = root_dir
self._project_name = project_name
Expand Down

0 comments on commit fd9a78a

Please sign in to comment.