@@ -1057,44 +1057,13 @@ def getSolutions(self, varList: Optional[str | list[str]] = None, resultfile: Op
10571057
10581058 @staticmethod
10591059 def _prepare_input_data (
1060- raw_input : str | list [ str ] | dict [str , Any ],
1060+ raw_input : dict [str , Any ],
10611061 ) -> dict [str , str ]:
10621062 """
10631063 Convert raw input to a structured dictionary {'key1': 'value1', 'key2': 'value2'}.
10641064 """
10651065
1066- def prepare_str (str_in : str ) -> dict [str , str ]:
1067- str_in = str_in .replace (" " , "" )
1068- key_val_list : list [str ] = str_in .split ("=" )
1069- if len (key_val_list ) != 2 :
1070- raise ModelicaSystemError (f"Invalid 'key=value' pair: { str_in } " )
1071-
1072- input_data_from_str : dict [str , str ] = {key_val_list [0 ]: key_val_list [1 ]}
1073-
1074- return input_data_from_str
1075-
10761066 input_data : dict [str , str ] = {}
1077-
1078- if isinstance (raw_input , str ):
1079- warnings .warn (message = "The definition of values to set should use a dictionary, "
1080- "i.e. {'key1': 'val1', 'key2': 'val2', ...}. Please convert all cases which "
1081- "use a string ('key=val') or list ['key1=val1', 'key2=val2', ...]" ,
1082- category = DeprecationWarning ,
1083- stacklevel = 3 )
1084- return prepare_str (raw_input )
1085-
1086- if isinstance (raw_input , list ):
1087- warnings .warn (message = "The definition of values to set should use a dictionary, "
1088- "i.e. {'key1': 'val1', 'key2': 'val2', ...}. Please convert all cases which "
1089- "use a string ('key=val') or list ['key1=val1', 'key2=val2', ...]" ,
1090- category = DeprecationWarning ,
1091- stacklevel = 3 )
1092-
1093- for item in raw_input :
1094- input_data |= prepare_str (item )
1095-
1096- return input_data
1097-
10981067 if isinstance (raw_input , dict ):
10991068 for key , val in raw_input .items ():
11001069 # convert all values to strings to align it on one type: dict[str, str]
@@ -1171,14 +1140,12 @@ def isParameterChangeable(
11711140
11721141 def setContinuous (
11731142 self ,
1174- cvals : str | list [ str ] | dict [str , Any ],
1143+ cvals : dict [str , Any ],
11751144 ) -> bool :
11761145 """
11771146 This method is used to set continuous values. It can be called:
11781147 with a sequence of continuous name and assigning corresponding values as arguments as show in the example below:
11791148 usage
1180- >>> setContinuous("Name=value") # depreciated
1181- >>> setContinuous(["Name1=value1","Name2=value2"]) # depreciated
11821149 >>> setContinuous(cvals={"Name1": "value1", "Name2": "value2"})
11831150 """
11841151 inputdata = self ._prepare_input_data (raw_input = cvals )
@@ -1191,14 +1158,12 @@ def setContinuous(
11911158
11921159 def setParameters (
11931160 self ,
1194- pvals : str | list [ str ] | dict [str , Any ],
1161+ pvals : dict [str , Any ],
11951162 ) -> bool :
11961163 """
11971164 This method is used to set parameter values. It can be called:
11981165 with a sequence of parameter name and assigning corresponding value as arguments as show in the example below:
11991166 usage
1200- >>> setParameters("Name=value") # depreciated
1201- >>> setParameters(["Name1=value1","Name2=value2"]) # depreciated
12021167 >>> setParameters(pvals={"Name1": "value1", "Name2": "value2"})
12031168 """
12041169 inputdata = self ._prepare_input_data (raw_input = pvals )
@@ -1211,14 +1176,12 @@ def setParameters(
12111176
12121177 def setSimulationOptions (
12131178 self ,
1214- simOptions : str | list [ str ] | dict [str , Any ],
1179+ simOptions : dict [str , Any ],
12151180 ) -> bool :
12161181 """
12171182 This method is used to set simulation options. It can be called:
12181183 with a sequence of simulation options name and assigning corresponding values as arguments as show in the example below:
12191184 usage
1220- >>> setSimulationOptions("Name=value") # depreciated
1221- >>> setSimulationOptions(["Name1=value1","Name2=value2"]) # depreciated
12221185 >>> setSimulationOptions(simOptions={"Name1": "value1", "Name2": "value2"})
12231186 """
12241187 inputdata = self ._prepare_input_data (raw_input = simOptions )
@@ -1231,14 +1194,12 @@ def setSimulationOptions(
12311194
12321195 def setLinearizationOptions (
12331196 self ,
1234- linearizationOptions : str | list [ str ] | dict [str , Any ],
1197+ linearizationOptions : dict [str , Any ],
12351198 ) -> bool :
12361199 """
12371200 This method is used to set linearization options. It can be called:
12381201 with a sequence of linearization options name and assigning corresponding value as arguments as show in the example below
12391202 usage
1240- >>> setLinearizationOptions("Name=value") # depreciated
1241- >>> setLinearizationOptions(["Name1=value1","Name2=value2"]) # depreciated
12421203 >>> setLinearizationOptions(linearizationOtions={"Name1": "value1", "Name2": "value2"})
12431204 """
12441205 inputdata = self ._prepare_input_data (raw_input = linearizationOptions )
@@ -1251,14 +1212,12 @@ def setLinearizationOptions(
12511212
12521213 def setOptimizationOptions (
12531214 self ,
1254- optimizationOptions : str | list [ str ] | dict [str , Any ],
1215+ optimizationOptions : dict [str , Any ],
12551216 ) -> bool :
12561217 """
12571218 This method is used to set optimization options. It can be called:
12581219 with a sequence of optimization options name and assigning corresponding values as arguments as show in the example below:
12591220 usage
1260- >>> setOptimizationOptions("Name=value") # depreciated
1261- >>> setOptimizationOptions(["Name1=value1","Name2=value2"]) # depreciated
12621221 >>> setOptimizationOptions(optimizationOptions={"Name1": "value1", "Name2": "value2"})
12631222 """
12641223 inputdata = self ._prepare_input_data (raw_input = optimizationOptions )
@@ -1271,16 +1230,14 @@ def setOptimizationOptions(
12711230
12721231 def setInputs (
12731232 self ,
1274- name : str | list [ str ] | dict [str , Any ],
1233+ name : dict [str , Any ],
12751234 ) -> bool :
12761235 """
12771236 This method is used to set input values. It can be called with a sequence of input name and assigning
12781237 corresponding values as arguments as show in the example below. Compared to other set*() methods this is a
12791238 special case as value could be a list of tuples - these are converted to a string in _prepare_input_data()
12801239 and restored here via ast.literal_eval().
12811240
1282- >>> setInputs("Name=value") # depreciated
1283- >>> setInputs(["Name1=value1","Name2=value2"]) # depreciated
12841241 >>> setInputs(name={"Name1": "value1", "Name2": "value2"})
12851242 """
12861243 inputdata = self ._prepare_input_data (raw_input = name )
0 commit comments