@@ -967,26 +967,22 @@ def getSolutions(self, varList=None, resultfile=None): # 12
967967 return resultVars
968968
969969 if isinstance (varList , str ):
970- if varList not in resultVars and varList != "time" :
971- raise ModelicaSystemError (f"Requested data { repr (varList )} does not exist" )
972- res = self .sendExpression (f'readSimulationResult("{ result_file .as_posix ()} ", {{{ varList } }})' )
973- npRes = np .array (res )
974- self .sendExpression ("closeSimulationResultFile()" )
975- return npRes
976-
977- if isinstance (varList , list ):
978- for var in varList :
979- if var == "time" :
980- continue
981- if var not in resultVars :
982- raise ModelicaSystemError (f"Requested data { repr (var )} does not exist" )
983- variables = "," .join (varList )
984- res = self .sendExpression (f'readSimulationResult("{ result_file .as_posix ()} ",{{{ variables } }})' )
985- npRes = np .array (res )
986- self .sendExpression ("closeSimulationResultFile()" )
987- return npRes
988-
989- raise ModelicaSystemError ("Unhandled input for getSolutions()" )
970+ var_list_checked = [varList ]
971+ elif isinstance (varList , list ):
972+ var_list_checked = varList
973+ else :
974+ raise ModelicaSystemError ("Unhandled input for getSolutions()" )
975+
976+ for var in var_list_checked :
977+ if var == "time" :
978+ continue
979+ if var not in resultVars :
980+ raise ModelicaSystemError (f"Requested data { repr (var )} does not exist" )
981+ variables = "," .join (var_list_checked )
982+ res = self .sendExpression (f'readSimulationResult("{ result_file .as_posix ()} ",{{{ variables } }})' )
983+ npRes = np .array (res )
984+ self .sendExpression ("closeSimulationResultFile()" )
985+ return npRes
990986
991987 @staticmethod
992988 def _strip_space (name ):
0 commit comments