# Avoiding body penetration in ball bouncing over harmonic displaced base

1 view (last 30 days)
German Martinez on 27 Dec 2016
Commented: German Martinez on 29 Dec 2016
Hi all,
I'm trying to adapt the bouncing ball model to include movement of the base (harmonic movement). The idea is the ball bounces in the base and the same time the base move up and down.
Until now, I get the ball and I get the base moving. But there are some impacts where the ball goes bellow the base (see second base cycle in the attached figure) or the ball dropping down and passing through the base.
Blue = base displacement. // Yellow = Ball displacement.
In the attached code, I implemented a logical operator which compare to zero the difference between the position of the bodies. If that value is negative, the integrators for velocity and displacement are reset to the x0 values (the velocity and displacement of the base). I assume when an impact is produced, the ball gets the same displacement and velocity as the plate, this assumption is clearly wrong, but I would like to get some reasonable figures before move to more complex analyses.
Please find attached the Simulink Model and a screenshot of it.
I would appreciate any advice or tip which can help me to solve my problem or improve my model.
Thanks very much.
German M.
##### 2 CommentsShow NoneHide None
José-Luis on 27 Dec 2016
Or maybe you're running into numerical precision issues?
German Martinez on 29 Dec 2016
Hi Jose Luis,
Thanks very much for your answer. Maybe, but, why do you think that?? I think the problem probably is related to the contact condition. I have a condition when the displacement of the ball is smaller than the base, the ball displacement is overwritten with the base displacement, so it should never goes under the base. But it does. I'm pretty confused.
Thanks very much. German

Hari Desanur on 29 Dec 2016
When I run your model, I can see that there are many warnings generated related to "Algebraic loop paths through integrator reset or IC ports".
This is the reason why the results might not be as expected. You will have to modify your Simulink model to avoid these algebraic loops involving the 'Integrator' blocks.
You will have to use the 'State Port' of the Integrator. Refer to the documentation regarding the 'State Port' and 'Self-Resetting Integrators' -
German Martinez on 29 Dec 2016
Hi Hari Desanur,
Thanks very much for your answer. You are right, those warnings could be a reason. But I need to feed to the compare block the difference between the position, and this difference should trigger the reset in the integrator. Hence, I'm not sure how to avoid that algebraic loop without delete the necessary compare block.
Thanks very much for your help!

### Categories

Find more on General Applications in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!