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

Help : A simple question

Help : A simple question

I am studying "Principles of Object-Oriented Modeling and Simulation with Modelica 2.1 (Peter Fritzson )". An example is as follows:
class Pendulum  "Planar Pendulum"
  constant  Real PI=3.141592653589793;
  parameter Real m=1, g=9.81, L=0.5;
  Real F;
  output    Real x(start=0.5),y(start=0);
  output    Real vx,vy;
equation
  m*der(vx)=-(x/L)*F;
  m*der(vy)=-(y/L)*F-m*g;
  der(x)=vx;
  der(y)=vy;
  x^2+y^2=L^2;
end Pendulum;

when:
simulate(Pendulum, stopTime=4)
plot(x)
it shows a figure the same as the book.
http://www.openmodelica.org/components/com_agora/img/members/137/01.png

But when stopTime=5 or other value, the result seems to be completely wrong.
http://www.openmodelica.org/components/com_agora/img/members/137/02.png

Can anybody tell me why?

Edited by: erer007a - Apr-14-10 17:37:13

Re: Help : A simple question

little body comes here

Re: Help : A simple question

Hi,

We're keeping an eye on the forum all the time but we're rather busy so it takes a while to reply.

I can't reproduce your error. For me plotting works rather fine for stopTime=5 and stopTime=20.
https://www.openmodelica.org/components/com_agora/img/members/55/plot-stopTime-04.png
https://www.openmodelica.org/components/com_agora/img/members/55/plot-stopTime-05.png
https://www.openmodelica.org/components/com_agora/img/members/55/plot-stopTime-20.png

I used this script file: Pendulum.mos

Code:

loadFile("Pendulum.mo");

getErrorString();
simulate(Pendulum, stopTime=4);
getErrorString();
plot2(x);
getErrorString();
simulate(Pendulum, stopTime=5);
getErrorString();
plot2(x);
getErrorString();
simulate(Pendulum, stopTime=20);
getErrorString();
plot2(x);
getErrorString();

What version of OpenModelica are you running?
I'm using 1.5.0 RC2: http://www.ida.liu.se/~pelab/modelica/O … dows/rc2/.
If you're not using the same version try to uninstall your current one and install this new one.

Cheers,
Adrian Pop/

Re: Help : A simple question

The version I'm running is 1.5.0 RC1, and earliy I used 1.4.5. I have tried this in more than three computers running WindowsXP, and got the same error as I described above, which is realy  a blow to the enthusiasm of learning Modelica for me.
I have tried 1.5.0 RC2 . It works good indeed.
Thanks a lot !

There are 0 guests and 0 other users also viewing this topic