Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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");

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

There are 0 guests and 0 other users also viewing this topic
You are here: