- Index
- » Users
- » Stefanache
- » Profile
Posts
Posts
as example you can see this sample for Windows
-create one new folder in windows
-in this folder put/create 2 new files file1.py and file2.bat
--the file1.py content is:
import os
import sys
sys.path.insert(0, "C:\OpenModelica1.11.0-32bit\share\omc\scripts\PythonInterface")
from OMPython import OMCSession
sys.path.insert(0, "C:\OpenModelica1.11.0-32bit\lib\python")
os.environ['USER'] = 'stefanache'
omc = OMCSession()
omc.sendExpression("loadModel(Modelica)")
omc.sendExpression("loadFile(getInstallationDirectoryPath() + \"/share/doc/omc/testmodels/BouncingBall.mo\")")
omc.sendExpression("instantiateModel(BouncingBall)")
omc.sendExpression("simulate(BouncingBall)")
omc.sendExpression("plot(h)")
--the file2.bat content is
@echo off
python file1.py
pause
-then click on file2.bat
... and please be patient!
must apear the plotted result window
- Index
- » Users
- » Stefanache
- » Profile