@@ -1061,44 +1061,13 @@ def getSolutions(self, varList: Optional[str | list[str]] = None, resultfile: Op
10611061
10621062 @staticmethod
10631063 def _prepare_input_data (
1064- raw_input : str | list [ str ] | dict [str , Any ],
1064+ raw_input : dict [str , Any ],
10651065 ) -> dict [str , str ]:
10661066 """
10671067 Convert raw input to a structured dictionary {'key1': 'value1', 'key2': 'value2'}.
10681068 """
10691069
1070- def prepare_str (str_in : str ) -> dict [str , str ]:
1071- str_in = str_in .replace (" " , "" )
1072- key_val_list : list [str ] = str_in .split ("=" )
1073- if len (key_val_list ) != 2 :
1074- raise ModelicaSystemError (f"Invalid 'key=value' pair: { str_in } " )
1075-
1076- input_data_from_str : dict [str , str ] = {key_val_list [0 ]: key_val_list [1 ]}
1077-
1078- return input_data_from_str
1079-
10801070 input_data : dict [str , str ] = {}
1081-
1082- if isinstance (raw_input , str ):
1083- warnings .warn (message = "The definition of values to set should use a dictionary, "
1084- "i.e. {'key1': 'val1', 'key2': 'val2', ...}. Please convert all cases which "
1085- "use a string ('key=val') or list ['key1=val1', 'key2=val2', ...]" ,
1086- category = DeprecationWarning ,
1087- stacklevel = 3 )
1088- return prepare_str (raw_input )
1089-
1090- if isinstance (raw_input , list ):
1091- warnings .warn (message = "The definition of values to set should use a dictionary, "
1092- "i.e. {'key1': 'val1', 'key2': 'val2', ...}. Please convert all cases which "
1093- "use a string ('key=val') or list ['key1=val1', 'key2=val2', ...]" ,
1094- category = DeprecationWarning ,
1095- stacklevel = 3 )
1096-
1097- for item in raw_input :
1098- input_data |= prepare_str (item )
1099-
1100- return input_data
1101-
11021071 if isinstance (raw_input , dict ):
11031072 for key , val in raw_input .items ():
11041073 # convert all values to strings to align it on one type: dict[str, str]
@@ -1175,14 +1144,12 @@ def isParameterChangeable(
11751144
11761145 def setContinuous (
11771146 self ,
1178- cvals : str | list [ str ] | dict [str , Any ],
1147+ cvals : dict [str , Any ],
11791148 ) -> bool :
11801149 """
11811150 This method is used to set continuous values. It can be called:
11821151 with a sequence of continuous name and assigning corresponding values as arguments as show in the example below:
11831152 usage
1184- >>> setContinuous("Name=value") # depreciated
1185- >>> setContinuous(["Name1=value1","Name2=value2"]) # depreciated
11861153 >>> setContinuous(cvals={"Name1": "value1", "Name2": "value2"})
11871154 """
11881155 inputdata = self ._prepare_input_data (raw_input = cvals )
@@ -1195,14 +1162,12 @@ def setContinuous(
11951162
11961163 def setParameters (
11971164 self ,
1198- pvals : str | list [ str ] | dict [str , Any ],
1165+ pvals : dict [str , Any ],
11991166 ) -> bool :
12001167 """
12011168 This method is used to set parameter values. It can be called:
12021169 with a sequence of parameter name and assigning corresponding value as arguments as show in the example below:
12031170 usage
1204- >>> setParameters("Name=value") # depreciated
1205- >>> setParameters(["Name1=value1","Name2=value2"]) # depreciated
12061171 >>> setParameters(pvals={"Name1": "value1", "Name2": "value2"})
12071172 """
12081173 inputdata = self ._prepare_input_data (raw_input = pvals )
@@ -1215,14 +1180,12 @@ def setParameters(
12151180
12161181 def setSimulationOptions (
12171182 self ,
1218- simOptions : str | list [ str ] | dict [str , Any ],
1183+ simOptions : dict [str , Any ],
12191184 ) -> bool :
12201185 """
12211186 This method is used to set simulation options. It can be called:
12221187 with a sequence of simulation options name and assigning corresponding values as arguments as show in the example below:
12231188 usage
1224- >>> setSimulationOptions("Name=value") # depreciated
1225- >>> setSimulationOptions(["Name1=value1","Name2=value2"]) # depreciated
12261189 >>> setSimulationOptions(simOptions={"Name1": "value1", "Name2": "value2"})
12271190 """
12281191 inputdata = self ._prepare_input_data (raw_input = simOptions )
@@ -1235,14 +1198,12 @@ def setSimulationOptions(
12351198
12361199 def setLinearizationOptions (
12371200 self ,
1238- linearizationOptions : str | list [ str ] | dict [str , Any ],
1201+ linearizationOptions : dict [str , Any ],
12391202 ) -> bool :
12401203 """
12411204 This method is used to set linearization options. It can be called:
12421205 with a sequence of linearization options name and assigning corresponding value as arguments as show in the example below
12431206 usage
1244- >>> setLinearizationOptions("Name=value") # depreciated
1245- >>> setLinearizationOptions(["Name1=value1","Name2=value2"]) # depreciated
12461207 >>> setLinearizationOptions(linearizationOtions={"Name1": "value1", "Name2": "value2"})
12471208 """
12481209 inputdata = self ._prepare_input_data (raw_input = linearizationOptions )
@@ -1255,14 +1216,12 @@ def setLinearizationOptions(
12551216
12561217 def setOptimizationOptions (
12571218 self ,
1258- optimizationOptions : str | list [ str ] | dict [str , Any ],
1219+ optimizationOptions : dict [str , Any ],
12591220 ) -> bool :
12601221 """
12611222 This method is used to set optimization options. It can be called:
12621223 with a sequence of optimization options name and assigning corresponding values as arguments as show in the example below:
12631224 usage
1264- >>> setOptimizationOptions("Name=value") # depreciated
1265- >>> setOptimizationOptions(["Name1=value1","Name2=value2"]) # depreciated
12661225 >>> setOptimizationOptions(optimizationOptions={"Name1": "value1", "Name2": "value2"})
12671226 """
12681227 inputdata = self ._prepare_input_data (raw_input = optimizationOptions )
@@ -1275,16 +1234,14 @@ def setOptimizationOptions(
12751234
12761235 def setInputs (
12771236 self ,
1278- name : str | list [ str ] | dict [str , Any ],
1237+ name : dict [str , Any ],
12791238 ) -> bool :
12801239 """
12811240 This method is used to set input values. It can be called with a sequence of input name and assigning
12821241 corresponding values as arguments as show in the example below. Compared to other set*() methods this is a
12831242 special case as value could be a list of tuples - these are converted to a string in _prepare_input_data()
12841243 and restored here via ast.literal_eval().
12851244
1286- >>> setInputs("Name=value") # depreciated
1287- >>> setInputs(["Name1=value1","Name2=value2"]) # depreciated
12881245 >>> setInputs(name={"Name1": "value1", "Name2": "value2"})
12891246 """
12901247 inputdata = self ._prepare_input_data (raw_input = name )
0 commit comments