@@ -283,46 +283,6 @@ def definition(self) -> OMCSessionRunData:
283283
284284 return omc_run_data_updated
285285
286- @staticmethod
287- def parse_simflags (simflags : str ) -> dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]:
288- """
289- Parse a simflag definition; this is deprecated!
290-
291- The return data can be used as input for self.args_set().
292- """
293- warnings .warn (message = "The argument 'simflags' is depreciated and will be removed in future versions; "
294- "please use 'simargs' instead" ,
295- category = DeprecationWarning ,
296- stacklevel = 2 )
297-
298- simargs : dict [str , Optional [str | dict [str , Any ] | numbers .Number ]] = {}
299-
300- args = [s for s in simflags .split (' ' ) if s ]
301- for arg in args :
302- if arg [0 ] != '-' :
303- raise ModelicaSystemError (f"Invalid simulation flag: { arg } " )
304- arg = arg [1 :]
305- parts = arg .split ('=' )
306- if len (parts ) == 1 :
307- simargs [parts [0 ]] = None
308- elif parts [0 ] == 'override' :
309- override = '=' .join (parts [1 :])
310-
311- override_dict = {}
312- for item in override .split (',' ):
313- kv = item .split ('=' )
314- if not 0 < len (kv ) < 3 :
315- raise ModelicaSystemError (f"Invalid value for '-override': { override } " )
316- if kv [0 ]:
317- try :
318- override_dict [kv [0 ]] = kv [1 ]
319- except (KeyError , IndexError ) as ex :
320- raise ModelicaSystemError (f"Invalid value for '-override': { override } " ) from ex
321-
322- simargs [parts [0 ]] = override_dict
323-
324- return simargs
325-
326286
327287class ModelicaSystem :
328288 """
@@ -1053,7 +1013,6 @@ def getOptimizationOptions(
10531013 def simulate_cmd (
10541014 self ,
10551015 result_file : OMCPath ,
1056- simflags : Optional [str ] = None ,
10571016 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
10581017 ) -> ModelicaSystemCmd :
10591018 """
@@ -1066,12 +1025,6 @@ def simulate_cmd(
10661025 However, if only non-structural parameters are used, it is possible to reuse an existing instance of
10671026 ModelicaSystem to create several version ModelicaSystemCmd to run the model using different settings.
10681027
1069- Parameters
1070- ----------
1071- result_file
1072- simflags
1073- simargs
1074-
10751028 Returns
10761029 -------
10771030 An instance if ModelicaSystemCmd to run the requested simulation.
@@ -1086,11 +1039,7 @@ def simulate_cmd(
10861039 # always define the result file to use
10871040 om_cmd .arg_set (key = "r" , val = result_file .as_posix ())
10881041
1089- # allow runtime simulation flags from user input
1090- if simflags is not None :
1091- om_cmd .args_set (args = om_cmd .parse_simflags (simflags = simflags ))
1092-
1093- if simargs :
1042+ if simargs is not None :
10941043 om_cmd .args_set (args = simargs )
10951044
10961045 if self ._override_variables or self ._simulate_options_override :
@@ -1128,7 +1077,6 @@ def simulate_cmd(
11281077 def simulate (
11291078 self ,
11301079 resultfile : Optional [str | os .PathLike ] = None ,
1131- simflags : Optional [str ] = None ,
11321080 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
11331081 ) -> None :
11341082 """Simulate the model according to simulation options.
@@ -1137,8 +1085,6 @@ def simulate(
11371085
11381086 Args:
11391087 resultfile: Path to a custom result file
1140- simflags: String of extra command line flags for the model binary.
1141- This argument is deprecated, use simargs instead.
11421088 simargs: Dict with simulation runtime flags.
11431089
11441090 Examples:
@@ -1165,7 +1111,6 @@ def simulate(
11651111
11661112 om_cmd = self .simulate_cmd (
11671113 result_file = self ._result_file ,
1168- simflags = simflags ,
11691114 simargs = simargs ,
11701115 )
11711116
@@ -1748,7 +1693,6 @@ def optimize(self) -> dict[str, Any]:
17481693 def linearize (
17491694 self ,
17501695 lintime : Optional [float ] = None ,
1751- simflags : Optional [str ] = None ,
17521696 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
17531697 ) -> LinearizationResult :
17541698 """Linearize the model according to linearization options.
@@ -1757,8 +1701,6 @@ def linearize(
17571701
17581702 Args:
17591703 lintime: Override "stopTime" value.
1760- simflags: String of extra command line flags for the model binary.
1761- This argument is deprecated, use simargs instead.
17621704 simargs: A dict with command line flags and possible options; example: "simargs={'csvInput': 'a.csv'}"
17631705
17641706 Returns:
@@ -1804,11 +1746,7 @@ def linearize(
18041746
18051747 om_cmd .arg_set (key = "l" , val = str (lintime or self ._linearization_options ["stopTime" ]))
18061748
1807- # allow runtime simulation flags from user input
1808- if simflags is not None :
1809- om_cmd .args_set (args = om_cmd .parse_simflags (simflags = simflags ))
1810-
1811- if simargs :
1749+ if simargs is not None :
18121750 om_cmd .args_set (args = simargs )
18131751
18141752 # the file create by the model executable which contains the matrix and linear inputs, outputs and states
0 commit comments