OpenModelica


Forgot password? | Forgot username? | Register

model.exe

model.exe

Hi there,
With  OMShell  simulation("model.mo"), OM creates  model.exe file.

How can i use  model.exe?

How can get specifit value of parameters at specific time?
How can override model.exe?

Thanks

Oki

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

You can use buildModel(Model) to just build Model.exe.
With simulation(Model, stopTime=XX) it will simulate the model from 0 to XX seconds.
You can use val(variable, time) after simulate command in OMShell.

From command line you can use Model.exe directly or from OMShell via system("Model.exe");

Code:


> Model.exe -override var1=value1,var2=value2 -output outvariable1,outvariable2

- output variable1 will show variable1 value at the end of the simulation

You could also use simulate(Model, outputFormat="csv") and will get you a Model_res.csv with the values of variables at all time steps.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

First of all, Thanks for your answer,
My simulation timing: startTime=0, stopTime=1

model.exe -output R1.v     then i get,

time=1, R1.v=.0.234567..

How can i  value of R1.v at  0.2 second?

With override R1.R value we do not need simulation again for new result value  right?

How can plot (R1.v) ?

Thanks

Oki


Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

You can do this in OMShell (or script.mos and run it via omc script.mos)

Code:


simulate(Model);
val(R1.v, 0.2); // get the value at 0.2
val(R1.v, 0.4); // get the value at 0.4
plot(R1.v); // plot the variable

simulate command will always recompile the model.
Yes, with override you can reuse the same model model.
From command line you could do:

Code:


# override stopTime
> Model.exe -override stopTime=0.2 -output R1.v
# plot R1.v
> path\to\openmodelica\bin\OMPlot --filename=Model_res.mat R1.v

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

Thanks adpro,
with  Model.exe -override stopTime=0.2 -output R1.v      model_res.mat file not effected right?
Only with simulation  model_res.mat file  will change.

Oki

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

If you use:
Model.exe -override stopTime=0.2 -output R1.v
Model_res.mat will be affected.
To not generate any .mat (so is not affected) add -noemit:
Model.exe -override stopTime=0.2 -output R1.v -noemit

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

I got it.

According userguide.pdf i can communicate model.exe with socket/port connection, right?
How can i communicate model.exe?

Thanks
oki


Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

Where in the user's guide? If you are referring to the interactive simulation that was discontinued a while back I think 1.8.1 was the last release to have it.

You can communicate via tcp/ip with Model.exe but you need to do that using external functions in which you write the communication.

What exactly do you want to achieve?

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

Hi adpro,
ModelicaUserGuide 1.9.1 Chapter 5(page 83)

I tried model.exe -interactive -port 10500  (this call server machine)
Then  try to communicate with client machine via socket connection. 

My goal is getting simulation result from  server machine using socket connection

oki

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

As I said, the old interactive simulation is not available anymore.

There is a new one if you simulate with outputFormat="ia" but I don't know exactly how it works.
I'll ask somebody else to give you some hints.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: model.exe

Thanks anyway adpro

Oki

Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic