@@ -352,7 +352,7 @@ def __init__(
352
352
fileName : Optional [str | os .PathLike | pathlib .Path ] = None ,
353
353
modelName : Optional [str ] = None ,
354
354
lmodel : Optional [list [str | tuple [str , str ]]] = None ,
355
- commandLineOptions : Optional [str ] = None ,
355
+ commandLineOptions : Optional [list [ str ] ] = None ,
356
356
variableFilter : Optional [str ] = None ,
357
357
customBuildDirectory : Optional [str | os .PathLike ] = None ,
358
358
omhome : Optional [str ] = None ,
@@ -374,8 +374,9 @@ def __init__(
374
374
lmodel=["Modelica"] for just the library name
375
375
and lmodel=[("Modelica","3.2.3")] for specifying both the name
376
376
and the version.
377
- commandLineOptions: String with extra command line options to be
378
- provided to omc via setCommandLineOptions().
377
+ commandLineOptions: List with extra command line options as elements. The list elements are
378
+ provided to omc via setCommandLineOptions(). If set, the default values will be overridden.
379
+ To disable any command line options, use an empty list.
379
380
variableFilter: A regular expression. Only variables fully
380
381
matching the regexp will be stored in the result file.
381
382
Leaving it unspecified is equivalent to ".*".
@@ -426,8 +427,17 @@ def __init__(
426
427
else :
427
428
self ._getconn = OMCSessionZMQ (omhome = omhome )
428
429
429
- # set commandLineOptions if provided by users
430
- self .setCommandLineOptions (commandLineOptions = commandLineOptions )
430
+ # set commandLineOptions using default values or the user defined list
431
+ if commandLineOptions is None :
432
+ # set default command Line Options for linearization as
433
+ # linearize() will use the simulation executable and runtime
434
+ # flag -l to perform linearization
435
+ commandLineOptions = [
436
+ "--linearizationDumpLanguage=python" ,
437
+ "--generateSymbolicLinearization" ,
438
+ ]
439
+ for opt in commandLineOptions :
440
+ self .setCommandLineOptions (commandLineOptions = opt )
431
441
432
442
if lmodel is None :
433
443
lmodel = []
@@ -445,12 +455,6 @@ def __init__(
445
455
if self ._file_name is not None and not self ._file_name .is_file (): # if file does not exist
446
456
raise IOError (f"{ self ._file_name } does not exist!" )
447
457
448
- # set default command Line Options for linearization as
449
- # linearize() will use the simulation executable and runtime
450
- # flag -l to perform linearization
451
- self .setCommandLineOptions ("--linearizationDumpLanguage=python" )
452
- self .setCommandLineOptions ("--generateSymbolicLinearization" )
453
-
454
458
self ._work_dir : pathlib .Path = self .setWorkDirectory (customBuildDirectory )
455
459
456
460
if self ._file_name is not None :
0 commit comments