Skip to content

Commit bc7f10b

Browse files
committed
Do not add simulation options to overrideFile
Pass them as arguments to simulation executable
1 parent 96e0b9d commit bc7f10b

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,10 +1065,15 @@ def simulate_cmd(
10651065
if self._override_variables or self._simulate_options_override:
10661066
override_file = result_file.parent / f"{result_file.stem}_override.txt"
10671067

1068+
# simulation options are not added to override file anymore
1069+
# pass them to simulation executable directly as individual arguments
1070+
# see https://github.com/OpenModelica/OpenModelica/pull/14813
1071+
for key, value in self._simulate_options_override.items():
1072+
om_cmd.arg_set(key=key, val=value)
1073+
10681074
override_content = (
1069-
"\n".join([f"{key}={value}" for key, value in self._override_variables.items()])
1070-
+ "\n".join([f"{key}={value}" for key, value in self._simulate_options_override.items()])
1071-
+ "\n"
1075+
"\n".join([f"{key}={value}" for key, value in self._override_variables.items()])
1076+
+ "\n"
10721077
)
10731078

10741079
override_file.write_text(override_content)
@@ -1752,10 +1757,12 @@ def linearize(
17521757
modelname=self._model_name,
17531758
)
17541759

1760+
for key, value in self._linearization_options.items():
1761+
om_cmd.arg_set(key=key, val=value)
1762+
17551763
override_content = (
1756-
"\n".join([f"{key}={value}" for key, value in self._override_variables.items()])
1757-
+ "\n".join([f"{key}={value}" for key, value in self._linearization_options.items()])
1758-
+ "\n"
1764+
"\n".join([f"{key}={value}" for key, value in self._override_variables.items()])
1765+
+ "\n"
17591766
)
17601767
override_file = self.getWorkDirectory() / f'{self._model_name}_override_linear.txt'
17611768
override_file.write_text(override_content)

0 commit comments

Comments
 (0)