- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Packages management when using...
Packages management when using compiler in bash mode
Packages management when using compiler in bash mode
I am trying to use the Modelica compiler in batch mode in order to compile multiple Modelica models (I currently use OpenModelica v1.9.1).
I use two packages : modelsRoot and modelsRoot.subModel1 (in two package.mo files).
When I run the following command line,
compilerModelicaOMC modelsRoot/subModel1/package.mo modelsRoot/package.mo
I get an error "Error: Failed to insert class subModel1 within modelsRoot;
Failed to parse file: modelsRoot/subModel1/package.mo"
Whereas when I run the following command line
compilerModelicaOMC modelsRoot/package.mo modelsRoot/subModel1/package.mo
it works fine. Is there a way to let the compiler know that the model files are not sorted ? Is there a way to avoid having to manually sort Modelica files according to package dependencies ?
Thank you in advance
Re: Packages management when using compiler in bash mode
You want to use a mos-script for this use-case, loadFile("modelsRoot/package.mo");
- sjoelund.se
- 1700 Posts
Re: Packages management when using compiler in bash mode
Thank you for your quick answer
Could you please give me an example mos file to load the two packages, one model model1 located in modelsRoot/subModel1/model1.mo (and within the subModel1 package), and run the compilerModelicaOMC command ?
Thank you very much
Re: Packages management when using compiler in bash mode
I did post the entire code (put in a file with .mos extension, for example a.mos). And then an instantiateModel(submodel1.model1); or translateModel(submodel1.model1); or buildModel(submodel1.model1);
Then just call the file: omc a.mos
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Packages management when using...