Opened 9 years ago
Last modified 9 years ago
#4229 new defect
Augmented bouncing ball model falls through if exported and imported as FMU
| Reported by: | Bernhard Thiele | Owned by: | Adeel Asghar |
|---|---|---|---|
| Priority: | high | Milestone: | Future |
| Component: | FMI | Version: | |
| Keywords: | Cc: | Peter Fritzson, alejandro.danos@…, rd.castro@…, Martin Sjölund, Lennart Ochel, Willi Braun |
Description
The following bouncing ball model
model BouncingBall parameter Real e=0.7 "coefficient of restitution"; parameter Real g=9.81 "gravity acceleration"; Real h(start=1) "height of ball"; Real v "velocity of ball"; Boolean flying(start=true) "true, if ball is flying"; equation der(h) = v; der(v) = if flying then -g else 0; flying = not (h <= 0 and v <= 0); when h <= 0.0 then reinit(v, -e*pre(v)); end when; end BouncingBall;
avoids the well-known "fall-through" effect by the additional logic around the flying flag.
However if one exports and imports the model by the following MOS script, the ball will fall through.
bb_file_path :=realpath("BouncingBall.mo");
loadFile(bb_file_path);
translateModelFMU(BouncingBall);
bb_fmu_file_path := realpath("BouncingBall.fmu");
imported_fmu_mo_file := importFMU("BouncingBall.fmu");
loadFile(imported_fmu_mo_file);
simulate(BouncingBall_me_FMU, stopTime=3.0,outputFormat="csv");
Attachments (4)
Change History (6)
by , 9 years ago
| Attachment: | bouncingballplot.png added |
|---|
by , 9 years ago
| Attachment: | BouncingBall.mo added |
|---|
by , 9 years ago
| Attachment: | writeBB.mos added |
|---|
by , 9 years ago
| Attachment: | readBB.mos added |
|---|
comment:1 by , 9 years ago
| Cc: | added |
|---|
comment:2 by , 9 years ago
| Cc: | added |
|---|
AFAIR, Willi told me that this is because OpenModelica run-time takes an extra event at the end.
Note:
See TracTickets
for help on using tickets.


Bouncing ball plot