Simscape Multibody close to real time animation of model "ball on plate", solver and contact library question

9 views (last 30 days)
Dear Matlab Folks
In the process of a project for university I developed a simulation of a ball on plate model. I created a CAD-model and imported it with the "SimscapeMultibody Link Inventor Plug-In". Then I added a spheric solid as ball and included a "sphere to plane force" from the "contact forces library.
The goal of the project was to have a simulation that is close to real time and animation of the model. Providing input angles for the motors with udp and receive the position of the ball, also with udp.
The problems I am encountering, are at the moment that the simulation and animation is too slow. It is not near real time and I was wondering if there are certain steps that can be taken to improve the speed of the simulation and animation. A Problem that appeared lately is also, that the "sphere to plane force" block doesn't seem to know where the end of the plate is and the ball just keeps rolling.
I would be glad for any help or advice on the topic of simulating and animating with Simscape Multibody.
I attached a zip with the whole project if someone wants to try itself. I also included a screenshot of the simulink blocks here.
Thank you for your time
  1 Comment
David Brodmann
David Brodmann on 22 Oct 2020
Edited: David Brodmann on 24 Oct 2020
UPDATE: I managed to get the model really close to realtime, if anyone else is wondering how, here are my steps.
  • I set the solver to variable step size with ode23 solver and a minimum step size of 2e-4. This lead to a performance increase and as far as I can say it the simulation is stable with no unexpected behaviour.
  • I tried simulating with a desktop processor with a bigger single thread performance at 4.6Ghz, this lead to a big improvement obviously.
  • I removed the udp receiver block. This was definitely not obvious to me, but the udp receiver block kind of interrupted the simulation every 0.01s because of the sample time chose in it. I really thought the udp receiver would be executed in parallel but I was wrong. This leads to the question, how I can implement a udp receiver without delaying the simulation?

Sign in to comment.

Accepted Answer

Juan Sagarduy
Juan Sagarduy on 24 Oct 2020
Hello David,
I believe you took the right steps in your previous test. Keep in mind that in recent releases of Multibody (20a, 20b), we have the spatial force contact block to model contacts between various bodies (including now point and line contacts).
This could be good to test out, as it is most robust and convenient.
In some mechanic simulations, even ode45 can be an alternative from a performance perspective.
Regards Juan
  3 Comments
David Brodmann
David Brodmann on 25 Oct 2020
UPDATE: So I tried out the "Spatial Contact Force"-block in my model. The result is, that with "Frictional Force" enabled the model computes slower. Without "Frictional Force" though the model computes alot faster, which is absolutely great. Also it is nice that there are fewer steps to set up the contact force. I am glad the Frictional Force is not absolutely necessary for my model, so I am hapyy to use the new block now.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulation and Analysis in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!