Ticket #3857: BouncingBall.mo

File BouncingBall.mo, 396 bytes (added by anonymous, 10 years ago)
Line 
1model BouncingBall "The 'classic' bouncing ball model"
2 type Height=Real(unit="m");
3 type Velocity=Real(unit="m/s");
4 parameter Real e=0.8 "Coefficient of restitution";
5 parameter Height h0=1.0 "Initial height";
6 Height h;
7 Velocity v;
8initial equation
9 h = h0;
10equation
11 v = der(h);
12 der(v) = -9.81;
13 when h<0 then
14 reinit(v, -e*pre(v));
15 end when;
16end BouncingBall;