OpenModelica-Python API Interface
Actively maintained. Last release 3 months ago, commits in 13 of the last 26 weeks. A safe choice.
$
pip install ompythonOMPython 
OMPython is a Python interface that uses ZeroMQ to communicate with OpenModelica.
Dependencies
- Python >= 3.10; Python >= 3.12 for
OMPathfunctionality (handle file system access via OMC using apathlib.Pathcompatible abstraction layer) - Additional packages: numpy, psutil, pyparsing and pyzmq
Installation
Installation using pip is recommended.
Via pip
pip install OMPython
Via conda
OMPython is also available as a conda package via conda-forge
conda install -c conda-forge ompython
See the ompython-feedstock for details.
Via source
Clone the repository and run:
cd <OMPythonPath>
python -m pip install -U .
Usage
Running the following commands should get you started
import OMPython
help(OMPython)
import OMPython
omc = OMPython.OMCSessionLocal()
omc.sendExpression("getVersion()")
or read the OMPython documentation online.
Bug Reports
- Submit bugs through the OpenModelica GitHub issues.
- Pull requests are welcome.