@@ -282,44 +282,6 @@ def definition(self) -> OMCSessionRunData:
282282
283283 return omc_run_data_updated
284284
285- @staticmethod
286- def parse_simflags (simflags : str ) -> dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]:
287- """
288- Parse a simflag definition; this is deprecated!
289-
290- The return data can be used as input for self.args_set().
291- """
292- warnings .warn ("The argument 'simflags' is depreciated and will be removed in future versions; "
293- "please use 'simargs' instead" , DeprecationWarning , stacklevel = 2 )
294-
295- simargs : dict [str , Optional [str | dict [str , Any ] | numbers .Number ]] = {}
296-
297- args = [s for s in simflags .split (' ' ) if s ]
298- for arg in args :
299- if arg [0 ] != '-' :
300- raise ModelicaSystemError (f"Invalid simulation flag: { arg } " )
301- arg = arg [1 :]
302- parts = arg .split ('=' )
303- if len (parts ) == 1 :
304- simargs [parts [0 ]] = None
305- elif parts [0 ] == 'override' :
306- override = '=' .join (parts [1 :])
307-
308- override_dict = {}
309- for item in override .split (',' ):
310- kv = item .split ('=' )
311- if not 0 < len (kv ) < 3 :
312- raise ModelicaSystemError (f"Invalid value for '-override': { override } " )
313- if kv [0 ]:
314- try :
315- override_dict [kv [0 ]] = kv [1 ]
316- except (KeyError , IndexError ) as ex :
317- raise ModelicaSystemError (f"Invalid value for '-override': { override } " ) from ex
318-
319- simargs [parts [0 ]] = override_dict
320-
321- return simargs
322-
323285
324286class ModelicaSystem :
325287 def __init__ (
@@ -1003,7 +965,6 @@ def getOptimizationOptions(self, names: Optional[str | list[str]] = None) -> dic
1003965 def simulate_cmd (
1004966 self ,
1005967 result_file : OMCPath ,
1006- simflags : Optional [str ] = None ,
1007968 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
1008969 timeout : Optional [float ] = None ,
1009970 ) -> ModelicaSystemCmd :
@@ -1017,13 +978,6 @@ def simulate_cmd(
1017978 However, if only non-structural parameters are used, it is possible to reuse an existing instance of
1018979 ModelicaSystem to create several version ModelicaSystemCmd to run the model using different settings.
1019980
1020- Parameters
1021- ----------
1022- result_file
1023- simflags
1024- simargs
1025- timeout
1026-
1027981 Returns
1028982 -------
1029983 An instance if ModelicaSystemCmd to run the requested simulation.
@@ -1039,11 +993,7 @@ def simulate_cmd(
1039993 # always define the result file to use
1040994 om_cmd .arg_set (key = "r" , val = result_file .as_posix ())
1041995
1042- # allow runtime simulation flags from user input
1043- if simflags is not None :
1044- om_cmd .args_set (args = om_cmd .parse_simflags (simflags = simflags ))
1045-
1046- if simargs :
996+ if simargs is not None :
1047997 om_cmd .args_set (args = simargs )
1048998
1049999 if self ._override_variables or self ._simulate_options_override :
@@ -1082,7 +1032,6 @@ def simulate_cmd(
10821032 def simulate (
10831033 self ,
10841034 resultfile : Optional [str ] = None ,
1085- simflags : Optional [str ] = None ,
10861035 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
10871036 timeout : Optional [float ] = None ,
10881037 ) -> None :
@@ -1092,8 +1041,6 @@ def simulate(
10921041
10931042 Args:
10941043 resultfile: Path to a custom result file
1095- simflags: String of extra command line flags for the model binary.
1096- This argument is deprecated, use simargs instead.
10971044 simargs: Dict with simulation runtime flags.
10981045 timeout: Maximum execution time in seconds.
10991046
@@ -1121,7 +1068,6 @@ def simulate(
11211068
11221069 om_cmd = self .simulate_cmd (
11231070 result_file = self ._result_file ,
1124- simflags = simflags ,
11251071 simargs = simargs ,
11261072 timeout = timeout ,
11271073 )
@@ -1700,7 +1646,6 @@ def optimize(self) -> dict[str, Any]:
17001646 def linearize (
17011647 self ,
17021648 lintime : Optional [float ] = None ,
1703- simflags : Optional [str ] = None ,
17041649 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
17051650 timeout : Optional [float ] = None ,
17061651 ) -> LinearizationResult :
@@ -1710,8 +1655,6 @@ def linearize(
17101655
17111656 Args:
17121657 lintime: Override "stopTime" value.
1713- simflags: String of extra command line flags for the model binary.
1714- This argument is deprecated, use simargs instead.
17151658 simargs: A dict with command line flags and possible options; example: "simargs={'csvInput': 'a.csv'}"
17161659 timeout: Maximum execution time in seconds.
17171660
@@ -1760,11 +1703,7 @@ def linearize(
17601703
17611704 om_cmd .arg_set (key = "l" , val = str (lintime or self ._linearization_options ["stopTime" ]))
17621705
1763- # allow runtime simulation flags from user input
1764- if simflags is not None :
1765- om_cmd .args_set (args = om_cmd .parse_simflags (simflags = simflags ))
1766-
1767- if simargs :
1706+ if simargs is not None :
17681707 om_cmd .args_set (args = simargs )
17691708
17701709 # the file create by the model executable which contains the matrix and linear inputs, outputs and states
0 commit comments