Drift in simMechanics forward dynamics solver(with link to example model)

I didn't know how to bump the old question and add this link...so I re-asked, sorry.
Link to a model with this problem:
I have boiled this down to the following simple example:
Say you were trying to model a plank not attached to the ground in SimMechanics (for a simple 2-D case). You would need a body with two joints attached to ground, one at -Rarm from the center of gravity, one at +Rarm from the center of gravity. These joints would need 1 prismatic DOF(allowing the up and down motion) and 1 rotational DOF (allowing their relative angles to change.
If you apply the same upward force to each side, (essentially pushing up on both sides of the plank with the same force) you would expect the entire body to move upward without rotation. However, when I attempt this, not only do I get the expected upward motion, I also get a very slight rotation.
If I put a body sensor on it, the angular accel looks like numerical noise around 0... the angular rate looks like a ramp and the angle looks parabolic. I assume someone is going to say something like--once you double integrate the error in angular acceleration your angle drift is pretty bad. But why is there any error at all if the forces are exactly the same at exactly the same distances away?

 Risposta accettata

Looking at the model, it seems to be doing exactly what's expected. Change the stop time to 10s, max step size to 0.01s (you might want to turn off the visualization), and demux each of the 3 outputs coming out of your body sensor block to plot them on 3 scopes with 3 axes each.
You'll see that the z displacement (third signal of the first output) increases to about 8e5 m, while the y stays at 0 and the x as well (approximately, around -8e-18m max, that's just numerical error).
Similarly, the angular velocity only shows a non zero in the rotation around the y axis, with a max of -1e-6 rad/s. Again, just numerical error. The angular acceleration also shows a non zero component only in the y direction with a max of approx. -4e-7 rad/s^2, again numerical error.
BTW, your AbsTol and RelTol are very small. Setting them to 1e-4 and 1e-3 respectively should be more than enough.
HTH,
Arnaud

7 Commenti

But these angular rotations fall in with what I am trying to measure, is there any way to decrease the numerical error. That is why I had decreased the tolerances. Does the numerical error come from the double integration of a double precision number and cannot be improved upon?
What do you mean by what you are trying to measure? What is it you are trying to do? If there is no rotation, you can get rid of the revolute primitive in the custom joints or simply use a prismatic joint. The mass and inertia parameters are also tiny, and that's likely to cause numerical problems (when it comes to inverting the mass matrix, which will have a very small determinant)
Yes, they are tiny values but real. I mean to close the loop around the revolute primitive, but the force is proportional to 1/d^2 of the prismatic distances...so when it rotates these distances go apart and the controller has to respond to drive the numerical drift to zero as well as the accel I am trying to measure. Would it help to scale all the values up by 1e6 and work in micrometers?
The model I provided was a striped down version of the plant with only 1 revolute and 1 prismatic. I am modeling a levitating disk with 6 degrees of freedom, but the fundamental problem is in the model I showed.
The full plant model is extended by another revolute and all four points at (0,Rarm,0)(0,-Rarm,0)(Rarm,0,0)(-Rarm,0,0) are controlled by forcing them in the prismatic z direction. So, not only is the revolute necessary, there is actually another one.
By the way, your ability to quickly cut to the most likely causes is very impressive. Thanks for your help so far.
Not sure what else to suggest. Adding some control over the revolute joint will definitely help (I think) or in the short term, adding a stiff joint spring & damper to restrict the rotation. With regards to your problem, did you have a look at the Stewart platform demo models that ship with SimMechanics? It's not exactly what you're doing, but is fairly similar. See for example mech_stewart_trajectory.mdl.
yes, the Stewart platform is very close to my system...thanks for your help.

Accedi per commentare.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by