- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » bouncing ball simulation fails
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?
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » bouncing ball simulation fails