Page 1 of 1

Equations of motion with weld constraints (SOLVED)

Posted: Wed Aug 26, 2020 6:05 am
by hbquoc
Hello,

I'm trying to understand how the equations of motion is established when weld constraints are implemented. The model I used is in the attached file. I applied the theories from the documentation of SImbody Matter Subsystem in this link
https://simbody.github.io/simbody-3.6-d ... ystem.html
and calculated these four following terms
  • Mdu = Mass matrix * generalized acceleration (M * UDot)
  • cor = Centrifugal and Coriolis forces by the method
    calcResidualForceIgnoringConstraints(state, Vector(0), Vector_<SpatialVec>(0), Vector(0), cor)
  • gra = Gravity by the method
    multiplyBySystemJacobianTranspose(state, model.getGravityForce().getBodyForces(state), gra)
It seems to me that Mdu + cor + genConstr - gra should be zero. However, it was never the case.

What am I missing here? I suspect that cor was not correct but am not sure.

Thank you in advance!

Re: Equations of motion with weld constraints

Posted: Wed Aug 26, 2020 9:30 am
by sherm
Hi, Bach. This is a good exercise and it is worth pursuing until everything is clear.

A few thoughts:
  • Is gravity really the only applied force?
  • Once you have udot and lambda, you should be able to call CalcResidualForces() and get a zero residual. That will tell you whether you've accounted for all the forces. Then you can proceed to do it term by term.
  • I would suggest working incrementally -- make a small system that has no constraints and make sure you can account for everything in the equations of motion. Then add a single constraint to that so that you know only the constraint forces need to be added in. Once all that is working as you expect it to, try the larger system.
  • It is easy to make sign errors since some of the terms are forces and some are -forces.
Regards,
Sherm

Re: Equations of motion with weld constraints

Posted: Wed Aug 26, 2020 11:40 am
by hbquoc
Thank you for the feedback! It's very reasonable to check what you proposed.

I can confirm that:
  • The gravity is the only applied force. At each integration step, I make sure that the muscle forces are 0.
  • The value of elements of the residual force produced by calcResidualForce are of the order of 1e-15
  • I've been working with different models without constraints. For these models, the equation Mdu + cor = f_applied was verified to be respected. I'm also aware that body forces and mobility forces are on the right hand side of the equations.

I found the error. The value of inertial and gravity forces were taken at the previous time step.