Skip to content

Commit

Permalink
clean up matching district generation types
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnate committed Jan 2, 2025
1 parent ad32d4d commit 0d7007e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
16 changes: 9 additions & 7 deletions geojson_modelica_translator/geojson_modelica_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,23 @@ def _parse_couplings(geojson, sys_params, sys_param_district_type):
time_series_load = TimeSeries(sys_params, geojson_load)
# couple each time series load to distribution
all_couplings.append(
Coupling(time_series_load, distribution, district_type="fifth_generation")
Coupling(time_series_load, distribution, district_type=sys_param_district_type)
)
all_couplings.append(
Coupling(time_series_load, ambient_water_stub, district_type="fifth_generation")
Coupling(time_series_load, ambient_water_stub, district_type=sys_param_district_type)
)
all_couplings.append(
Coupling(time_series_load, design_data, district_type="fifth_generation")
Coupling(time_series_load, design_data, district_type=sys_param_district_type)
)
# couple each borefield and distribution
all_couplings.append(Coupling(distribution, borefield, district_type="fifth_generation"))
all_couplings.append(Coupling(distribution, borefield, district_type=sys_param_district_type))
# couple distribution and ground coupling
all_couplings.append(Coupling(distribution, ground_coupling, district_type="fifth_generation"))
all_couplings.append(Coupling(distribution, ground_coupling, district_type=sys_param_district_type))
# empty couple between borefield and ground
all_couplings.append(Coupling(ground_coupling, borefield, district_type="fifth_generation"))
all_couplings.append(Coupling(ambient_water_stub, ambient_water_stub, district_type="fifth_generation"))
all_couplings.append(Coupling(ground_coupling, borefield, district_type=sys_param_district_type))
all_couplings.append(
Coupling(ambient_water_stub, ambient_water_stub, district_type=sys_param_district_type)
)
else:
pass # Create waste heat components & couplings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ def __init__(self, model_a, model_b, district_type=None):
self.district_type = district_type
self._template_base_name = f"{model_a.model_name}_{model_b.model_name}"

if self.district_type == "fifth_generation":
self._template_dir = Path(__file__).parent / "5G_templates" / self._template_base_name
else:
self._template_dir = Path(__file__).parent / "templates" / self._template_base_name
match self.district_type:
case "fifth_generation":
self._template_dir = Path(__file__).parent / "5G_templates" / self._template_base_name
case "fourth_generation" | None:
self._template_dir = Path(__file__).parent / "templates" / self._template_base_name
case _:
raise Exception(f"Invalid district type: {self.district_type}")
if not Path(self._template_dir).exists():
raise Exception(f"Invalid coupling. Missing {self._template_dir} directory.")

Expand Down

0 comments on commit 0d7007e

Please sign in to comment.