Skip to content
Prev Previous commit
[MOdelicaSystem*] rename: command_line => command_line_options
  • Loading branch information
syntron committed Nov 19, 2025
commit 51fa6c8fa06ccd4cf5a750dbbd7fcf3fbdaeda35
14 changes: 7 additions & 7 deletions OMPython/ModelicaSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,15 @@ class ModelicaSystem:

def __init__(
self,
command_line: Optional[list[str]] = None,
command_line_options: Optional[list[str]] = None,
work_directory: Optional[str | os.PathLike] = None,
omhome: Optional[str] = None,
omc_process: Optional[OMCProcess] = None,
) -> None:
"""Create a ModelicaSystem instance. To define the model use model() or convertFmu2Mo().

Args:
command_line: List with extra command line options as elements. The list elements are
command_line_options: List with extra command line options as elements. The list elements are
provided to omc via setCommandLineOptions(). If set, the default values will be overridden.
To disable any command line options, use an empty list.
work_directory: Path to a directory to be used for temporary
Expand Down Expand Up @@ -378,14 +378,14 @@ def __init__(
self._session = OMCSessionZMQ(omhome=omhome)

# set commandLineOptions using default values or the user defined list
if command_line is None:
if command_line_options is None:
# set default command line options to improve the performance of linearization and to avoid recompilation if
# the simulation executable is reused in linearize() via the runtime flag '-l'
command_line = [
command_line_options = [
"--linearizationDumpLanguage=python",
"--generateSymbolicLinearization",
]
for opt in command_line:
for opt in command_line_options:
self.set_command_line_options(command_line_option=opt)
Comment thread
syntron marked this conversation as resolved.

self._simulated = False # True if the model has already been simulated
Expand Down Expand Up @@ -1958,7 +1958,7 @@ def __init__(
model_file: Optional[str | os.PathLike] = None,
model_name: Optional[str] = None,
libraries: Optional[list[str | tuple[str, str]]] = None,
command_line: Optional[list[str]] = None,
command_line_options: Optional[list[str]] = None,
variable_filter: Optional[str] = None,
work_directory: Optional[str | os.PathLike] = None,
omhome: Optional[str] = None,
Expand All @@ -1980,7 +1980,7 @@ def __init__(
raise ModelicaSystemError("No model name provided!")

self._mod = ModelicaSystem(
command_line=command_line,
command_line_options=command_line_options,
work_directory=work_directory,
omhome=omhome,
omc_process=omc_process,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_FMIImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_FMIImport(model_firstorder):

# import FMU & check & simulate
# TODO: why is '--allowNonStandardModelica=reinitInAlgorithms' needed? any example without this possible?
mod2 = OMPython.ModelicaSystem(command_line=['--allowNonStandardModelica=reinitInAlgorithms'])
mod2 = OMPython.ModelicaSystem(command_line_options=['--allowNonStandardModelica=reinitInAlgorithms'])
mo = mod2.convertFmu2Mo(fmu=fmu)
assert os.path.exists(mo)

Expand Down