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

Pendulum example

Pendulum example

Hi

I am using OM 1.8.0 and trying the pendulum example.  It fails at about 0.2 sec because it is not converging. Is this a bug?

Here is my input and the message I get:

class Pendulum "Planar Pendulum"
  constant Real PI = 3.14159265358979;
  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) = -(x / L) * F - m * g;
  der(x) = vx;
  der(y) = vy;
  x ^ 2 + y ^ 2 = L ^ 2;
end Pendulum;




Simulated 'Pendulum' successfully! with message:
DASSL--  AT CURRENT T (=R1)  500 STEPS
      In above message,  R1 =   .2054502887339E+00
DASSL--  TAKEN ON THIS CALL BEFORE REACHING TOUT
| warning | DDASRT: A large amount of work has been expended.(About 500 steps). Trying to continue ...
DASSL--  AT CURRENT T (=R1)  500 STEPS
      In above message,  R1 =   .2054502887357E+00
DASSL--  TAKEN ON THIS CALL BEFORE REACHING TOUT
| warning | DDASRT: A large amount of work has been expended.(About 500 steps). Trying to continue ...
DASSL--  AT CURRENT T (=R1)  500 STEPS
      In above message,  R1 =   .2054502887362E+00
DASSL--  TAKEN ON THIS CALL BEFORE REACHING TOUT
| warning | DDASRT: A large amount of work has been expended.(About 500 steps). Trying to continue ...
DASSL--  AT CURRENT T (=R1)  500 STEPS
      In above message,  R1 =   .2054502887364E+00
DASSL--  TAKEN ON THIS CALL BEFORE REACHING TOUT
| warning | DDASRT: A large amount of work has been expended.(About 500 steps). Trying to continue ...
DASSL--  AT T (=R1) AND STEPSIZE H (=R2) THE
      In above,  R1 =   .2054502887365E+00   R2 =   .1164869998510E-15
DASSL--  CORRECTOR FAILED TO CONVERGE REPEATEDLY
DASSL--  OR WITH ABS(H)=HMIN

Error in Simulation. Solver exit with error.

| error | DDASRT: The corrector could not converge.

Edited by: cporowski - Oct-26-11 12:33:41

Re: Pendulum example

Hi,

Try to use this one:

Code:


model Pendulum
  parameter Real m=0.5;
  parameter Real g=9.82;
  parameter Real L=1;
  Real x(start=L),y(start=0),xd,yd;
  Real Fo;
equation
  der(y)=yd;
  der(x)=xd;
  m*der(xd) = -x*Fo/L;
  m*der(yd) = -m*g-Fo*y/L;
  x*x+y*y=L^2;
end Pendulum;

Cheers,
Adrian Pop/

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