Equations of motion with weld constraints (SOLVED)

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Bach Quoc Hoa
Posts: 24
Joined: Thu Jul 13, 2017 7:03 am

Equations of motion with weld constraints (SOLVED)

Post by Bach Quoc Hoa » Wed Aug 26, 2020 6:05 am

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!
Attachments
testmodel3_weldconstraints.osim
(142.57 KiB) Downloaded 53 times
Last edited by Bach Quoc Hoa on Thu Aug 27, 2020 6:56 am, edited 1 time in total.

Tags:

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

Re: Equations of motion with weld constraints

Post by Michael Sherman » Wed Aug 26, 2020 9:30 am

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

User avatar
Bach Quoc Hoa
Posts: 24
Joined: Thu Jul 13, 2017 7:03 am

Re: Equations of motion with weld constraints

Post by Bach Quoc Hoa » Wed Aug 26, 2020 11:40 am

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.

POST REPLY