Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up matching district generation types #690

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
vtnate marked this conversation as resolved.
Show resolved Hide resolved
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
Loading