diff --git a/OMPython/__init__.py b/OMPython/__init__.py index be815f0..ad9a30d 100755 --- a/OMPython/__init__.py +++ b/OMPython/__init__.py @@ -944,7 +944,10 @@ def __getParameterValues(self, paraName = None): str_ = False self.pValuesList.append(str_) else: - self.pValuesList.append(float(str_)) + try: + self.pValuesList.append(float(str_)) + except ValueError: + self.pValuesList.append(str_) return self.pValuesList else: try: @@ -1163,8 +1166,7 @@ def getSolutions(self, *varList):#12 res_mat = '_res.mat' resFile = "".join([self.modelName, res_mat]) if (not os.path.exists(resFile)): - print ("Error: Result file does not exist") - exit() + raise IOError("Result file does not exist") else: if len(varList) == 0: #validSolution = ['time'] + self.__getInputNames() + self.__getContinuousNames() + self.__getParameterNames() @@ -1394,7 +1396,8 @@ def __setValue(self, nameVal, namesList, valuesList, quantity, index): if l.changable == 'false': print ("!!! value cannot be set for " + n) else: - l.start = float(nameVal.get(n)) + # l.start = float(nameVal.get(n)) + l.start = nameVal.get(n) index_ = namesList.index(n) valuesList[index_] = l.start @@ -1403,7 +1406,8 @@ def __setValue(self, nameVal, namesList, valuesList, quantity, index): if paramVar.get('name') == str(n): c=paramVar.getchildren() for attr in c: - val = float(nameVal.get(n)) + # val = float(nameVal.get(n)) + val = nameVal.get(n) attr.set('start', str(val)) self.tree.write(self.xmlFile, encoding='UTF-8', xml_declaration=True) index = index + 1