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

Very simple question for beginner

Very simple question for beginner

Hello,

I know, Google is my friend, but i don't find the answer to a very simple question  current/hmm

How can I build a "model" (in fact it is not a model) to simulate an equation.

For exemple :
x = 0,5.a.t² in function of a.

How can I see the influence of the variation of the parameter "a" in only one graph.
I'd like to have, in one graph, the simulation for a = 5, a = 10, a = 15, a = 20

Is my question clear enought ???

Do you have a link for a documentation, a video ???

Thank you very much !
Guillaume

Re: Very simple question for beginner

Something like this.

Code:


package MyFirstPackage

model ReuseModel
Real x(start = 0, fixed = true); // change the start value if you need to
parameter Real a = 5;
equation
x = 0.5 * a * (time ^ 2);
end ReuseModel;


model RunSeveral
  ReuseModel f1(a = 5);
  ReuseModel f2(a = 10);
  ReuseModel f3(a = 15);
  ReuseModel f4(a = 20);
end RunSeveral;

end MyFirstPackage;

Then you can either simulate model ReuseModel, plot x, change a = 10 in the plot view, right click on the simulation results, say resimulate and simulates with a = 10, 15, 20.

Or you can simulate RunSeveral and plot f1.x, f2.x, f3.x, f4.x on the same plot.

https://paste.pics/7f3948ee0531f8eb470b46df86aa0d06

Re: Very simple question for beginner

Thank you I'll try

Re: Very simple question for beginner

adrpo wrote:



Then you can either simulate model ReuseModel, plot x, change a = 10 in the plot view, right click on the simulation results, say resimulate and simulates with a = 10, 15, 20.

Hallo adrpo,

a follow-up question from your answer. does OM save the "old" value(s) when a model is resimulated?

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