- Index
- » Users
- » leo7
- » Profile
Posts
Posts
# Anyway - the first example working for OMPython version 2.0
#---------------------
from OMPython import OMCSession
OMPython = OMCSession()
OMPython.execute('getVersion()')
print OMPython.execute("loadModel(Modelica)")
print OMPython.execute ("loadFile(\"C:/OpenModelica1.9.1/share/doc/omc/testmodels/BouncingBall.mo\")")
result = OMPython.execute("simulate(BouncingBall)")
print OMPython.execute("plot(h)")
print '\n' ,'result = ', '\n', result,'\n' ,'\n'
Hmmm there are more things changed as for instance the get
from OMPython import OMCSession
OMPython = OMCSession()
OMPython.execute('getVersion()')
OMPython.execute("loadModel(Modelica)")
OMPython.execute("loadFile(\"C:/OpenModelica1.9.1/testmodels/BouncingBall.mo\")")
result = OMPython.execute("simulate(BouncingBall)")
OMPython.execute("plot(h)")
print '\n' ,'result = ', '\n', result,'\n' ,'\n'
print OMPython.get(result, 'SET2.Elements.Line3.Properties.Values')
--> Error
Is there any help examples for version 2?
Thanks,
Leo
Hi sjoelund.se,
That is good to know...
I googled on this error but could not find this info..
(Maybe something to be updated in manuals etc. - for now from now on your answer post will pop up if people google this)
Thanks !,
Leo
Hello everybody..
I am using Python trying to get connected to OpenModelica
I have the exact same error: "OMPython.run() AttributeError: 'module' object has no attribute 'run"
My 'program':
import OMPython
OMPython.run()
installed OMPython using:
1- setup.py from the Open Modelica 1.9.1 dir
2- pip install OMPython
same results
Help is very welcome !
- Index
- » Users
- » leo7
- » Profile