From e602298f48a4cdddb5ac79b7ff67d77cfd15e89a Mon Sep 17 00:00:00 2001 From: Joerg Wangemann Date: Fri, 3 Oct 2014 12:34:27 +0200 Subject: [PATCH] API of OMPython was modified. --- python/test.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/python/test.py b/python/test.py index e2939fe..dc2f616 100644 --- a/python/test.py +++ b/python/test.py @@ -1,13 +1,17 @@ # file: test.py #!/usr/bin/python import OMPython -cmds = ["loadModel(Modelica)", - "model test end test;", - "loadFile(\"../OpenBLDC/package.mo\")", - "simulate(OpenBLDC.Assemblies.HallCalibration, stopTime=0.25)", - "plot(h)"] +cmds = ["loadModel(Modelica)", + "model test end test;", + "loadFile(\"../OpenBLDC/package.mo\")", + "simulate(OpenBLDC.Tests.TestPWM, fileNamePrefix=\"Result\", stopTime=0.25)", + "plotAll()"] +_omc = OMPython.OMCSession() for cmd in cmds: - answer = OMPython.execute(cmd) - print "\nResult:\n%s" %answer + answer = _omc.sendExpression(cmd) + print "\nResult:\n%s" %answer + if not answer: + print _omc.sendExpression("getErrorString()") +