@@ -1059,44 +1059,13 @@ def getSolutions(self, varList: Optional[str | list[str]] = None, resultfile: Op
10591059
10601060 @staticmethod
10611061 def _prepare_input_data (
1062- raw_input : str | list [ str ] | dict [str , Any ],
1062+ raw_input : dict [str , Any ],
10631063 ) -> dict [str , str ]:
10641064 """
10651065 Convert raw input to a structured dictionary {'key1': 'value1', 'key2': 'value2'}.
10661066 """
10671067
1068- def prepare_str (str_in : str ) -> dict [str , str ]:
1069- str_in = str_in .replace (" " , "" )
1070- key_val_list : list [str ] = str_in .split ("=" )
1071- if len (key_val_list ) != 2 :
1072- raise ModelicaSystemError (f"Invalid 'key=value' pair: { str_in } " )
1073-
1074- input_data_from_str : dict [str , str ] = {key_val_list [0 ]: key_val_list [1 ]}
1075-
1076- return input_data_from_str
1077-
10781068 input_data : dict [str , str ] = {}
1079-
1080- if isinstance (raw_input , str ):
1081- warnings .warn (message = "The definition of values to set should use a dictionary, "
1082- "i.e. {'key1': 'val1', 'key2': 'val2', ...}. Please convert all cases which "
1083- "use a string ('key=val') or list ['key1=val1', 'key2=val2', ...]" ,
1084- category = DeprecationWarning ,
1085- stacklevel = 3 )
1086- return prepare_str (raw_input )
1087-
1088- if isinstance (raw_input , list ):
1089- warnings .warn (message = "The definition of values to set should use a dictionary, "
1090- "i.e. {'key1': 'val1', 'key2': 'val2', ...}. Please convert all cases which "
1091- "use a string ('key=val') or list ['key1=val1', 'key2=val2', ...]" ,
1092- category = DeprecationWarning ,
1093- stacklevel = 3 )
1094-
1095- for item in raw_input :
1096- input_data |= prepare_str (item )
1097-
1098- return input_data
1099-
11001069 if isinstance (raw_input , dict ):
11011070 for key , val in raw_input .items ():
11021071 # convert all values to strings to align it on one type: dict[str, str]
@@ -1173,14 +1142,12 @@ def isParameterChangeable(
11731142
11741143 def setContinuous (
11751144 self ,
1176- cvals : str | list [ str ] | dict [str , Any ],
1145+ cvals : dict [str , Any ],
11771146 ) -> bool :
11781147 """
11791148 This method is used to set continuous values. It can be called:
11801149 with a sequence of continuous name and assigning corresponding values as arguments as show in the example below:
11811150 usage
1182- >>> setContinuous("Name=value") # depreciated
1183- >>> setContinuous(["Name1=value1","Name2=value2"]) # depreciated
11841151 >>> setContinuous(cvals={"Name1": "value1", "Name2": "value2"})
11851152 """
11861153 inputdata = self ._prepare_input_data (raw_input = cvals )
@@ -1193,14 +1160,12 @@ def setContinuous(
11931160
11941161 def setParameters (
11951162 self ,
1196- pvals : str | list [ str ] | dict [str , Any ],
1163+ pvals : dict [str , Any ],
11971164 ) -> bool :
11981165 """
11991166 This method is used to set parameter values. It can be called:
12001167 with a sequence of parameter name and assigning corresponding value as arguments as show in the example below:
12011168 usage
1202- >>> setParameters("Name=value") # depreciated
1203- >>> setParameters(["Name1=value1","Name2=value2"]) # depreciated
12041169 >>> setParameters(pvals={"Name1": "value1", "Name2": "value2"})
12051170 """
12061171 inputdata = self ._prepare_input_data (raw_input = pvals )
@@ -1213,14 +1178,12 @@ def setParameters(
12131178
12141179 def setSimulationOptions (
12151180 self ,
1216- simOptions : str | list [ str ] | dict [str , Any ],
1181+ simOptions : dict [str , Any ],
12171182 ) -> bool :
12181183 """
12191184 This method is used to set simulation options. It can be called:
12201185 with a sequence of simulation options name and assigning corresponding values as arguments as show in the example below:
12211186 usage
1222- >>> setSimulationOptions("Name=value") # depreciated
1223- >>> setSimulationOptions(["Name1=value1","Name2=value2"]) # depreciated
12241187 >>> setSimulationOptions(simOptions={"Name1": "value1", "Name2": "value2"})
12251188 """
12261189 inputdata = self ._prepare_input_data (raw_input = simOptions )
@@ -1233,14 +1196,12 @@ def setSimulationOptions(
12331196
12341197 def setLinearizationOptions (
12351198 self ,
1236- linearizationOptions : str | list [ str ] | dict [str , Any ],
1199+ linearizationOptions : dict [str , Any ],
12371200 ) -> bool :
12381201 """
12391202 This method is used to set linearization options. It can be called:
12401203 with a sequence of linearization options name and assigning corresponding value as arguments as show in the example below
12411204 usage
1242- >>> setLinearizationOptions("Name=value") # depreciated
1243- >>> setLinearizationOptions(["Name1=value1","Name2=value2"]) # depreciated
12441205 >>> setLinearizationOptions(linearizationOtions={"Name1": "value1", "Name2": "value2"})
12451206 """
12461207 inputdata = self ._prepare_input_data (raw_input = linearizationOptions )
@@ -1253,14 +1214,12 @@ def setLinearizationOptions(
12531214
12541215 def setOptimizationOptions (
12551216 self ,
1256- optimizationOptions : str | list [ str ] | dict [str , Any ],
1217+ optimizationOptions : dict [str , Any ],
12571218 ) -> bool :
12581219 """
12591220 This method is used to set optimization options. It can be called:
12601221 with a sequence of optimization options name and assigning corresponding values as arguments as show in the example below:
12611222 usage
1262- >>> setOptimizationOptions("Name=value") # depreciated
1263- >>> setOptimizationOptions(["Name1=value1","Name2=value2"]) # depreciated
12641223 >>> setOptimizationOptions(optimizationOptions={"Name1": "value1", "Name2": "value2"})
12651224 """
12661225 inputdata = self ._prepare_input_data (raw_input = optimizationOptions )
@@ -1273,16 +1232,14 @@ def setOptimizationOptions(
12731232
12741233 def setInputs (
12751234 self ,
1276- name : str | list [ str ] | dict [str , Any ],
1235+ name : dict [str , Any ],
12771236 ) -> bool :
12781237 """
12791238 This method is used to set input values. It can be called with a sequence of input name and assigning
12801239 corresponding values as arguments as show in the example below. Compared to other set*() methods this is a
12811240 special case as value could be a list of tuples - these are converted to a string in _prepare_input_data()
12821241 and restored here via ast.literal_eval().
12831242
1284- >>> setInputs("Name=value") # depreciated
1285- >>> setInputs(["Name1=value1","Name2=value2"]) # depreciated
12861243 >>> setInputs(name={"Name1": "value1", "Name2": "value2"})
12871244 """
12881245 inputdata = self ._prepare_input_data (raw_input = name )
0 commit comments