@@ -255,46 +255,6 @@ def definition(self) -> OMCSessionRunData:
255255
256256 return omc_run_data_updated
257257
258- @staticmethod
259- def parse_simflags (simflags : str ) -> dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]:
260- """
261- Parse a simflag definition; this is deprecated!
262-
263- The return data can be used as input for self.args_set().
264- """
265- warnings .warn (message = "The argument 'simflags' is depreciated and will be removed in future versions; "
266- "please use 'simargs' instead" ,
267- category = DeprecationWarning ,
268- stacklevel = 2 )
269-
270- simargs : dict [str , Optional [str | dict [str , Any ] | numbers .Number ]] = {}
271-
272- args = [s for s in simflags .split (' ' ) if s ]
273- for arg in args :
274- if arg [0 ] != '-' :
275- raise ModelicaSystemError (f"Invalid simulation flag: { arg } " )
276- arg = arg [1 :]
277- parts = arg .split ('=' )
278- if len (parts ) == 1 :
279- simargs [parts [0 ]] = None
280- elif parts [0 ] == 'override' :
281- override = '=' .join (parts [1 :])
282-
283- override_dict = {}
284- for item in override .split (',' ):
285- kv = item .split ('=' )
286- if not 0 < len (kv ) < 3 :
287- raise ModelicaSystemError (f"Invalid value for '-override': { override } " )
288- if kv [0 ]:
289- try :
290- override_dict [kv [0 ]] = kv [1 ]
291- except (KeyError , IndexError ) as ex :
292- raise ModelicaSystemError (f"Invalid value for '-override': { override } " ) from ex
293-
294- simargs [parts [0 ]] = override_dict
295-
296- return simargs
297-
298258
299259class ModelicaSystem :
300260 """
@@ -1067,7 +1027,6 @@ def _process_override_data(
10671027 def simulate_cmd (
10681028 self ,
10691029 result_file : OMCPath ,
1070- simflags : Optional [str ] = None ,
10711030 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
10721031 ) -> ModelicaSystemCmd :
10731032 """
@@ -1080,12 +1039,6 @@ def simulate_cmd(
10801039 However, if only non-structural parameters are used, it is possible to reuse an existing instance of
10811040 ModelicaSystem to create several version ModelicaSystemCmd to run the model using different settings.
10821041
1083- Parameters
1084- ----------
1085- result_file
1086- simflags
1087- simargs
1088-
10891042 Returns
10901043 -------
10911044 An instance if ModelicaSystemCmd to run the requested simulation.
@@ -1100,11 +1053,7 @@ def simulate_cmd(
11001053 # always define the result file to use
11011054 om_cmd .arg_set (key = "r" , val = result_file .as_posix ())
11021055
1103- # allow runtime simulation flags from user input
1104- if simflags is not None :
1105- om_cmd .args_set (args = om_cmd .parse_simflags (simflags = simflags ))
1106-
1107- if simargs :
1056+ if simargs is not None :
11081057 om_cmd .args_set (args = simargs )
11091058
11101059 self ._process_override_data (
@@ -1137,7 +1086,6 @@ def simulate_cmd(
11371086 def simulate (
11381087 self ,
11391088 resultfile : Optional [str | os .PathLike ] = None ,
1140- simflags : Optional [str ] = None ,
11411089 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
11421090 ) -> None :
11431091 """Simulate the model according to simulation options.
@@ -1146,8 +1094,6 @@ def simulate(
11461094
11471095 Args:
11481096 resultfile: Path to a custom result file
1149- simflags: String of extra command line flags for the model binary.
1150- This argument is deprecated, use simargs instead.
11511097 simargs: Dict with simulation runtime flags.
11521098
11531099 Examples:
@@ -1174,7 +1120,6 @@ def simulate(
11741120
11751121 om_cmd = self .simulate_cmd (
11761122 result_file = self ._result_file ,
1177- simflags = simflags ,
11781123 simargs = simargs ,
11791124 )
11801125
@@ -1757,7 +1702,6 @@ def optimize(self) -> dict[str, Any]:
17571702 def linearize (
17581703 self ,
17591704 lintime : Optional [float ] = None ,
1760- simflags : Optional [str ] = None ,
17611705 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
17621706 ) -> LinearizationResult :
17631707 """Linearize the model according to linearization options.
@@ -1766,8 +1710,6 @@ def linearize(
17661710
17671711 Args:
17681712 lintime: Override "stopTime" value.
1769- simflags: String of extra command line flags for the model binary.
1770- This argument is deprecated, use simargs instead.
17711713 simargs: A dict with command line flags and possible options; example: "simargs={'csvInput': 'a.csv'}"
17721714
17731715 Returns:
@@ -1817,11 +1759,7 @@ def linearize(
18171759 f"<= lintime <= { self ._linearization_options ['stopTime' ]} " )
18181760 om_cmd .arg_set (key = "l" , val = str (lintime ))
18191761
1820- # allow runtime simulation flags from user input
1821- if simflags is not None :
1822- om_cmd .args_set (args = om_cmd .parse_simflags (simflags = simflags ))
1823-
1824- if simargs :
1762+ if simargs is not None :
18251763 om_cmd .args_set (args = simargs )
18261764
18271765 # the file create by the model executable which contains the matrix and linear inputs, outputs and states
0 commit comments