-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
I am trying to plot results using the ModelicaSystem API, but the plot window is not shown.
This is on Windows, using OMPython master and a recent OM nightly(OpenModelica v1.18.0-dev.beta1 (64-bit)).
Based on examples from the documentation, using the omc API works, it shows a plot window (the sleep is just there so that the window does not immediately disappear when the script is finished):
from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
cmds = [
'loadFile(getInstallationDirectoryPath() + "/share/doc/omc/testmodels/BouncingBall.mo")',
"simulate(BouncingBall)",
"plot(h)"
]
for cmd in cmds:
answer = omc.sendExpression(cmd)
print("\n{}:\n{}".format(cmd, answer))
from time import sleep
sleep(5)
Doing the same thing (I hope?!) with the ModelicaSystem API does not show a window:
from time import sleep
from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
model_path=omc.sendExpression("getInstallationDirectoryPath()") + "/share/doc/omc/testmodels/"
from OMPython import ModelicaSystem
mod=ModelicaSystem(model_path + "BouncingBall.mo","BouncingBall")
mod.simulate()
print('now plot ')
mod.sendExpression('plot(h)')
print(mod.requestApi('getErrorString'))
print('done, now sleep')
sleep(5)
output (notice: nothing in the error string):
LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
LOG_SUCCESS | info | The simulation finished successfully.
now plot
done, now sleep
I tried to find out what's going wrong, but couldn't find anything.
Metadata
Metadata
Assignees
Labels
No labels