OpenModelica compiler (omc) interface for Python>=3.6
Project description
OpenModelicaCompilerForPython
OpenModelica compiler (omc) interface for Python>=3.6
What's this?
When omc4py.open_session() is called in with-statement, it returns session instance bound to omc executable.
from omc4py import open_session
with open_session() as session:
...
If open_session()
cannot find the executable of omc,
One solution is to add destination of omc executable to the environ PATH
.
Another solution is to specify omc executable path by argument of open_session(${path_to_omc})
.
# open/close different version sessions
from omc4py import open_session
with open_session(
"C:/Program Files/OpenModelica1.14.0-64bit/bin/omc.exe"
) as session:
...
with open_session(
"C:/Program Files/OpenModelica1.14.1-64bit/bin/omc.exe"
) as session:
...
All methods of session are function in OpenModelica.Scripting.*
. If you want to know accurate signature, read help(session)
or UserGuide for OpenModelica Scripting API
# Show current omc version
from omc4py import open_session
with open_session() as session:
print(session.getVersion())
Features in:
OpenModelica.Scripting.Internal
OpenModelica.Scripting.Experimental
available from absolute reference
# Call "stat" in "OpenModelica.Scripting.Internal"
from omc4py import open_session
with open_session() as session:
print(session.OpenModelica.Scripting.Internal.stat(__file__))
All types of arguments for function call checked by session.
# "sortString" only take one sequence of string as argument
from omc4py import open_session
with open_session() as session:
session.sortStrings(
["a", "b", "0", "1e5"]
) # OK
# session.sortStrings(
# ["a", "b", 0, "1e5"]
# ) # NG
# session.sortStrings(
# ["a", "b", "0", 1e5]
# ) # NG
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for OpenModelicaCompiler-0.0.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa3ee9a5fc12e039df125f26d1ec57e1b4ca7f514fc05377418ae99a5a45c865 |
|
MD5 | fdf4bf1d7aa538acb9c974ed696573b9 |
|
BLAKE2b-256 | 9023cb87d7c828a30d667ad755d4d2d8dd05fe380c78146299052859a64b2cc0 |
Hashes for OpenModelicaCompiler-0.0.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c955c546d4636aa394d6316098f5de09430e2b45bb44e25a854eb0f3099b73f7 |
|
MD5 | c39f405c2f36e2d253fefa4ee0b861df |
|
BLAKE2b-256 | ce76ffd35b84c5c9b83f6f35235e6435894c15bfb9f09fd8ae46acf291e711ca |