Skip to content

Improvements to behaviour of ModelicaSystem class #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions OMPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down