I’d like to understand when and how to use the function OpenModelica.Scripting.convertPackageToLibrary
. I think the documentation on this is very sparse and I am not successful trying to use it in any way.
Creating my own libraries I normally create one big .mo file containing a package with all subpackages and models in this file (in contrast to organizing it by creating folders for every subpackage with package.mo files and package.order files by using the ‘within …;’ expression in every .mo file).
I thought running the mentioned function in OMShell would create such a folder-structure with the corresponding .mo files but I already failed by giving the function the correct parameters.
I created a test case as follows:
package TestLibrary
package Subpackage1model Model1end Model1;end Subpackage1;
package Subpackage2model Model2end Model2;end Subpackage2;
end TestLibrary;
The .mo file containing this code is saved in my /home-directory (Ubuntu).
When I try this in OMShell:
loadFile("/home/roman/Modelica/TestLibrary.mo");convertPackageToLibrary(TestLibrary, Test, 0.0.1);
I get the following error message:
Error occurred building ASTSyntax Error[:1:0-1:22:writable]
Error: Parser error:Unexpected token near: convertPackageToLibrary (IDENT)
I also tried it with TestLibrary.mo and /home/roman/Modelica/TestLibrary.mo but no success.
Am I wrong in trying to use the function that way? Or am I missing some details?