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

bouncing ball simulation fails

bouncing ball simulation fails

At this point of time I'm learning simulation with OM from a book. Right now I'm trying to simulate a bouncing ball which falls to the ground from a certain height and stands still after a certain time. But my problem is that the Ball falls through the ground after a certain point of time although I've included some mechanisms to prevent OM from doing this.

Here's the code:

model huepfenderBall02
  parameter Real k = 0.825; //collision factor
  parameter Real g = 9.81;
  parameter Real v_min = 0.05; //min. speed

  Real x(start = 1.5); //height
  Real x_pkt; // speed
  Real beschleunigung(start = g);  //acceleration
 
equation
  x_pkt = der(x);  //Integration of path
  -beschleunigung = der(x_pkt); // Integration of speed
  when x <= 0.0 then
      beschleunigung = if abs(pre(x_pkt)) > v_min then g else 0.0; // one mechanism to prevent the ball falling through the ground
    reinit(x_pkt, if abs(pre(x_pkt)) > v_min then -k * pre(x_pkt) else 0.0); // scnd mechasim
    reinit(x, 0.0);
 
  end when;
end huepfenderBall02;

Can anyone help me?

Edited by: meadowstress - Sep-21-12 21:58:59

Re: bouncing ball simulation fails

I'm sorry for posting this in the wrong topic. I've opened an new thread in "Programming Modelica Language". As I couldn't find any erase function I guess I have to leave this thread here.

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