- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Python API with OpenModelica
Python API with OpenModelica
Python API with OpenModelica
Hello Everyone,
I am using OMPython to run the OpenModelica model. I would like to create the installer for distributing the application. Is it possible to run the python application without OpenModelica installed or How do I include the OpenModelica executable in Python application.
Thanks in advance for your help!
Re: Python API with OpenModelica
Hi,
I am quite new to OpenModelica but I have used JModelica for long time and that work with PyFMI in Python environment.
Recently I have started to use OpenModelica as a complement. There is an export function labelled FMI on the top row in OMEdit and there you choose export FMU.
The actual FMU-module you then find here: /tmp/OpenModelica_openmodelica/OMEdit
Here you after export get a folder with a name related to your application.
If you open that you find several files and one with extension .fmu
This fmu-file you bring to your Python environment.
Note that since the fmu is made in Linux environment you can only run it in another Linux environment.
Information about PyFMI you find here https://pypi.org/project/PyFMI/
I have used PyFMI in Python 2.x environment but there is now also versions for Python 3.5 and 3.6.
I guess OMPython is a good alternative to PyFMI and would be interesting to understand the differences and similarities.
Re: Python API with OpenModelica
Hi,
I am also new to OpenModelica and Python. I suspect that the OMPython requires OpenModelica run time to be presented in the end user system. Whereas the PyFMI is tool independent. Also I want to call the simulate method several times without re-initializing. I am not able to achieve this in PyFMI. These are the findings based on my study now.
Re: Python API with OpenModelica
Hi,
Yes using PyFMI you need to load the FMU for each new simulation (but you need not re-compile).
I think there is some re-init functionality in FMU from JModelica but I am. not too sure.
About OpenModelica FMU I do not know.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Python API with OpenModelica