You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently running OMLT in a Docker container with a custom image based on openmodelica/openmodelica:v1.21.0-ompython, with the intention to test a local package.
When loading a model from the package using omc, this works as expected (except for an unrelated error fixed in OM master OpenModelica/OpenModelica#10564)
It is clear that the MODELICAPATH is incomplete/wrong, considering the value of the env var OPENMODELICALIBRARY.
(As an aside, in the config file libraryVersion MUST be "", otherwise loading the package fails even though it has a matching version annotation in its package.mo.)
To work around this, one needs to manually pass the env var to test.py with --libraries $OPENMODELICALIBRARY. In some circumstances it was even necessary to manually find and prepend the "default" location: --libraries ~/.openmodelica/libraries/:$OPENMODELICALIBRARY, otherwise MSL etc. would not be loaded.
Possible solution
I think the default value for the libraries argument should be the value of $OPENMODELICALIBRARY. Only if that is empty/undefined, maybe the current hard-coded /home/openmodelicausers/.openmodelica/libraries/ might be appropriate, but I don't know enough about the inner workings of omc to assess if that would do that internally, anyway.
The text was updated successfully, but these errors were encountered:
I am currently running OMLT in a Docker container with a custom image based on
openmodelica/openmodelica:v1.21.0-ompython
, with the intention to test a local package.To "install" my package as per the README, based on https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/faq.html?highlight=openmodelicalibrary#openmodelica-general and https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/packagemanager.html#overview-of-basic-modelica-package-management-concepts, I append the location of my package to the environment variable
OPENMODELICALIBRARY
. (At first, it was not clear to me how to "install" a package that is not available in the package manager)When loading a model from the package using
omc
, this works as expected (except for an unrelated error fixed in OM master OpenModelica/OpenModelica#10564)Expected behaviour
For
test.py
to pick up and use the value of$OPENMODELICALIBRARY
Observed behaviour
However,
test.py
does not seem to honor the content of that environment variable:It is clear that the MODELICAPATH is incomplete/wrong, considering the value of the env var
OPENMODELICALIBRARY
.(As an aside, in the config file
libraryVersion
MUST be""
, otherwise loading the package fails even though it has a matchingversion
annotation in itspackage.mo
.)I suspect the reason is a hard-coded default for the
--libraries
argument at https://github.com/OpenModelica/OpenModelicaLibraryTesting/blob/9aa10d5f1091bb6d6eafb7f5e3cf6c9cfb164acd/test.py#L95C24-L95C33Workaround
To work around this, one needs to manually pass the env var to
test.py
with--libraries $OPENMODELICALIBRARY
. In some circumstances it was even necessary to manually find and prepend the "default" location:--libraries ~/.openmodelica/libraries/:$OPENMODELICALIBRARY
, otherwise MSL etc. would not be loaded.Possible solution
I think the default value for the
libraries
argument should be the value of$OPENMODELICALIBRARY
. Only if that is empty/undefined, maybe the current hard-coded/home/openmodelicausers/.openmodelica/libraries/
might be appropriate, but I don't know enough about the inner workings ofomc
to assess if that would do that internally, anyway.The text was updated successfully, but these errors were encountered: