Skip to content

Commit

Permalink
Use CaseGroup/CaseName to refer to hydsim cases
Browse files Browse the repository at this point in the history
`CaseGroup/CaseName` is established syntax used in various UIs, Optimal
Gateway, and Automation Framework. As discussed in
Volue/energy-sim#742 (comment).

There's an argument for more user friendly error handling here, but I
think this is API compatible with a future improvement, and I want to
get this API break done ASAP. For now you'll get a `ValueError` if the
split doesn't split.

Closes #398.
  • Loading branch information
erny-powel committed Jan 22, 2024
1 parent ea7e2df commit d4e0507
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/volue/mesh/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ def update_rating_curve_versions(
def run_simulation(
self,
model: str,
case_group: str,
case: str,
start_time: datetime,
end_time: datetime,
Expand All @@ -390,7 +389,9 @@ def run_simulation(
if start_time is None or end_time is None:
raise TypeError("start_time and end_time must both have a value")

simulation = f"Model/{model}/{case_group}.has_OptimisationCases/{case}.has_OptimisationParameters/Optimal.has_HydroSimulation/HydroSimulation"
case_group, case_name = case.split("/", maxsplit=1)

simulation = f"Model/{model}/{case_group}.has_OptimisationCases/{case_name}.has_OptimisationParameters/Optimal.has_HydroSimulation/HydroSimulation"

request = core_pb2.SimulationRequest(
session_id=_to_proto_guid(self.session_id),
Expand Down

0 comments on commit d4e0507

Please sign in to comment.