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

Referance Modelica Library

Referance Modelica Library

I am trying to get OMC to simulate my model directly (without an IDE like OMEdit).  I have a large about of models so I created a bat script to like the following to do it for me.

omc.exe "F:\Model_1.mo"
omc.exe plot(X)

However, i have been getting an error of

Error processing file "F:\model_1.mo"
[F:\model_1.mo:4:3-4:89:writable] Error: Class Modelica.SIunits.Voltage not found in scope Model_1.RampVoltage while instantiating SL_RampVoltageX.v.

I think i need to load the Modelica Library first, but I am unsure how as I'll I have found has been a .zip of it.
thanks in advance

Edited by: TSgarp - Jul-24-11 22:36:02

Re: Referance Modelica Library

You can run the following on Linux (and Windows if you setup paths correctly... which is a pain):

Code:

omc +s MyModel.mo Modelica

make -f MyModel.makefile
./MyModel

Or you can run:

Code:

omc MyModel.mos

MyModel.mos:

Code:

loadModel(Modelica);

loadFile("MyModel.mo");
simulate(MyModel, ...);
plot(x)

Or use plot3 instead of plot as it is nicer current/smile

Re: Referance Modelica Library

Hey thanks a bunch sjoelund.se

I get a file does not exist error if I try to run from my bat (or from a .mos, loaded into omc).

Code:

omc.exe loadModel(Modelica); 

OM Shell has no problem with the command, everything is installed to the standard location.  I'm I doing something wrong?

Code:

omc.exe loadModel(Modelica);

omc.exe loadFile("F:\model.mo");
omc.exe simulate(model);
omc.exe plot(x);  //or plot3 as was pointed out =)

Re: Referance Modelica Library

Note that this is not the way, the OMC API commands (the text) below, you put them in a file called script.mos

Code:


loadModel(Modelica);
loadFile("MyModel.mo");
simulate(MyModel, ...);
plot(x);

then you use the SHELL script command:

Code:


> omc script.mos

to run this sequence of OMC API commands from Modelica script file script.mos.

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