- Index
- » Users
- » aggajjar
- » Profile
Posts
Posts
Dear all,
I am not able to understand how to use when loop for bouncing ball problem. The standard code given in Michael Tiller's book is as follows:
model BouncingBall "The 'classic' bouncing ball model"
type Height=Real(unit="m");
type Velocity=Real(unit="m/s");
parameter Real e=0.8 "Coefficient of restitution";
parameter Height h0=1.0 "Initial height";
Height h;
Velocity v;
initial equation
h = h0;
equation
v = der(h);
der(v) = -9.81;
when h<0 then
reinit(v, -e*pre(v));
end when;
end BouncingBall;
This code works extremely fine but let's say when I make h==0 (instead of h<0 i.e. ball hits the ground) in when statement then I get weird output in simulation and I am not able to understand it. So, any help would be appreciated.
Thank you.
- Index
- » Users
- » aggajjar
- » Profile