@@ -39,13 +39,15 @@ def __init__(
3939 work_directory : Optional [str | os .PathLike ] = None ,
4040 omhome : Optional [str ] = None ,
4141 session : Optional [OMSessionABC ] = None ,
42+ use_default_command_line_options : bool = True ,
4243 ) -> None :
4344 """Create a ModelicaSystem instance. To define the model use model() or convertFmu2Mo().
4445
4546 Args:
4647 command_line_options: List with extra command line options as elements. The list elements are
47- provided to omc via setCommandLineOptions(). If set, the default values will be overridden.
48- To disable any command line options, use an empty list.
48+ provided to omc via setCommandLineOptions() in addition to OMPython's default options.
49+ use_default_command_line_options: Whether to set OMPython's default options for linearization.
50+ Set to False to use only command_line_options, or no options if it is unspecified or empty.
4951 work_directory: Path to a directory to be used for temporary
5052 files like the model executable. If left unspecified, a tmp
5153 directory will be created.
@@ -62,15 +64,17 @@ def __init__(
6264 work_directory = work_directory ,
6365 )
6466
65- # set commandLineOptions using default values or the user defined list
66- if command_line_options is None :
67+ options : list [ str ] = []
68+ if use_default_command_line_options :
6769 # set default command line options to improve the performance of linearization and to avoid recompilation if
6870 # the simulation executable is reused in linearize() via the runtime flag '-l'
69- command_line_options = [
71+ options . extend ( [
7072 "--linearizationDumpLanguage=python" ,
7173 "--generateSymbolicLinearization" ,
72- ]
73- for opt in command_line_options :
74+ ])
75+ if command_line_options is not None :
76+ options .extend (command_line_options )
77+ for opt in options :
7478 self .set_command_line_options (command_line_option = opt )
7579
7680 def model (
0 commit comments