-
Notifications
You must be signed in to change notification settings - Fork 65
Om python syntron #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Om python syntron #226
Conversation
* difference between win and linux is only in the definition of my_env
…ction * merge all calls to executeables into one function - _run_cmd() * simplify & cleanup the code
15d0c86 to
3dfc0de
Compare
|
Please provide the example model that doesn't work. The compiler generates a <model_name>.bat file on Windows that contains list of all the dependencies. We should read from that file and set the process environment accordingly. |
Thanks for reviewing the code! Thus, your proposal would be to read the *.bat file and set the path based on the content in this file? My change is based on the interpretation, that the path is build using the variable dllPath which is created within Python; thus, I could add the needed content directly at this point. Some background: The attached files are: Besides the above listed point to run the model with the external library in OMPython, I also would like to create an FMU. However, this also fails and I expect a similar root cause ... |
Yes.
I suppose you mean it works fine from OMEdit, right?
|
OMPython ModelicaSystem calls |
sure i will change the simulate API to use the batch file to set up the environment |
The example script is attached to my comment above => see (1) python test script - test_OMPython.py.txt (rename from *.py.txt to *.py) |
OK; I'm ready to test the change. Would the definition of _run_cmd() still be interesting? It would run for *.exe and *.bat files ... |
|
From [arun3688](#226 (comment)):
From #226 (comment):
Would something like this also help for FMU creation? |
|
@syntron I have added some tests and the PR looks good thanks for the contribution |
|
@arun3688 this was not supposed to be merged. The implementation is unnecessary. The correct way is to read the batch file and the set the process environment as I commented above. |
|
@adeas31 Yes that is true but this is basically some refactoring of code to run the executable for |
Thanks for the merge! I was first confused about the commit message - it is the meassage from the first of 3 commits in the pull request ... Any hint where to look to get FMU compilation working for external libraries? |
I just tested it - with the development version 1.25 (exactly: OpenModelica-v1.25.0-dev-106-g982563026f-64bit.exe) it is working fine! |
Related Issues
Use OMPython with models which include external libraries (with compiled C code). Currently, the dll files are not
found if these libraries are added via the lmodel option.
Purpose
Allow building such models.
Approach
Adding the path based on the settings in lmodel to the environment variable.
Additionally, some cleanup of the code to execute a (Modelica) command is included (=> _run_cmd()).