-
Notifications
You must be signed in to change notification settings - Fork 61
[ModelicaSystem] only local omc process allowed #309
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
base: master
Are you sure you want to change the base?
[ModelicaSystem] only local omc process allowed #309
Conversation
21aaab8
to
c40bc06
Compare
Does this mean we can't use docker and wsl instances with ModelicaSystem? Is this just because if I/O permission issues? |
@adeas31 no, the reason is that ModelicaSystem accesses the file system directly without using OMC (create csv file; read result data, etc.). Due to this, the class can only used locally ... |
Here some more analyses: ModelicaSystem(Cmd) are using Python functions to access files from the OMC model; if this code is replaced by calls to OMC, the ModelicaSystem classes would be completly independent from the use OMCSessionZMQ(OMCProcess) version used. However, it would also mean, that some simple functionality is replaced by code which has to go through OMC in the case of a local usage - but it should be possible to abstract the access to the local filesystem! Thus, ModelicaSystem can be used for all systems for which OMCSessionZMQ is defined. Use cases (line numbers based on master):
|
Another big issue is the call to the executable in simulate() and linearize() using ModelicaSystemCmd(). A solution for this case is also needed - how to call / run the executable from the host within docker / wsl and also local? |
Another point: if the model executeable is used, the evaluation of the library paths is done for Windows (using *.bat file). However, I never tested this part for linux (docker, wsl). How can we ensure, that the needed (external) libraries are found in this case? |
c40bc06
to
fdd63e8
Compare
All of this filesystem access is needed because we are running the executable directly instead of using simulate api. This was an intentional change a while back to keep the control in OMPython. OMC might crash/hang during simulation so to have the control over the simulation we run the executable directly from OMPython. The batch file is only needed in Windows to set the executable PATH so it can find all the dependencies. I think we don't need this in linux as it is handled automatically using rpath. |
I think this is a quite good descission as it allows to run control the execution of the model in more detail; see also the possibility of running DoEs (see PR #312). However, it also limits the usability of the class ModelicaSystem if it is not run locally, i.e. in docker or WSL. I do not know the history - was ModelicaSystem in the past useable via docker? The linux case still needs to be tested (including external C libraries like SDF) ... currently I'm only able to run OMC in docker or on Windows. |
fdd63e8
to
eb14d85
Compare
@arun3688 can you please comment on this? Is Saw that docker test is skipped so I enabled it in PR #319. However, the test is very basic. We should try to enhance it to see if we can test model simulation using docker. @syntron I am assuming that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
ModelicaSystem relies on read access to files and the possibility to execute the compiled model; thus, it only works if OMC is started locally
Use OMCProcessLocal to ensure that this requirement is defined
Based on PR #295