OpenSim API: problem of muscle force velocity function with Millard muscle type

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
kaci chahrazed
Posts: 3
Joined: Wed Feb 02, 2022 3:06 am

OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by kaci chahrazed » Fri Apr 01, 2022 5:13 am

Hello Everyone,

I am trying to compute the muscle active force and passive force for one muscle for different velocities of elbow flexion on a model with Millard muscles type, and i noticed that the force remains the same what ever the velocity is. (this problem does not occur with Thelen muscles type)

Image

Here are the velocities i got:
Image

To notice: The getForceVelocityCurve() function retrieves the default parameters of the function representing the force velocity relationship of the muscle:
Image

[ 0.0, 0.25, 5.0, 0.15, 1.4, 0.6, 0.9]


Opensim version: 4.1
Python version : 3.7 ( 64bits)
Opensim model :MoBL-ARMS_upper_extremity



Is there any one who knows how to solve this problem?
Thank you in advance for any ideas


Chahrazed

Tags:

User avatar
Thomas Uchida
Posts: 1772
Joined: Wed May 16, 2012 11:40 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Thomas Uchida » Fri Apr 01, 2022 8:43 am

I was unable to reproduce this issue with the arm26 model. Perhaps you could try this on your end to confirm that the issue is model-specific. You could then try in a different pose in case this is a non-typical situation caused by path points and/or muscle wrapping.

User avatar
kaci chahrazed
Posts: 3
Joined: Wed Feb 02, 2022 3:06 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by kaci chahrazed » Mon Apr 04, 2022 7:59 am

Hello,

Thank you for your answer, i tried different positions on OpenSim and in fact the active force of the muscle changes for different values of elbow flexion. But that's because we change the length of the fiber by the different positions . Actually my concern is to change elbow flexion velocity and plot the corresponding changes in active fiber force . But when we change the velocity the force remains always the same for MoBL model.

For arm26 model, this problem does not occur that's why i supposed that the problem might come from the type of the muscle Thelen or Millard.

In the script below , i plotted the graphs of the active force depending on elbow velocity values even with varying values of "shoulder elevation angle "
Image

as you can see , with arm 26 model (Thelen muscle typle) the curve is decreasing while it is flat with MoBL model( Millard muscle type)

graphs with MoBL:

Image

Image

graphs with arm26:

Image

Image

Thank you

User avatar
Thomas Uchida
Posts: 1772
Joined: Wed May 16, 2012 11:40 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Thomas Uchida » Mon Apr 04, 2022 8:36 am

The Model::equilibrateMuscles() method (https://github.com/opensim-org/opensim- ... .cpp#L1181) calls Muscle::computeEquilibrium() (https://github.com/opensim-org/opensim- ... cle.h#L336) which is used for initialization. Perhaps try replacing model.equilibrateMuscles(state) with model.realizeDynamics(state) (https://simtk.org/api_docs/opensim/api_ ... 96e8844fe7).

User avatar
Jacob J. Banks
Posts: 88
Joined: Tue Jul 15, 2014 5:17 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Jacob J. Banks » Thu Apr 07, 2022 1:15 pm

Similar to Kaci, I can't seem to make sense of/match extracted Millard muscle force parameters using an API. However, I am looking at things a bit differently, as I am writing a custom SOpt API...

If one runs the SOpt tool on a trial/frame and then takes the SOpt_force and divides them by the SOpt_activations, you get the 'Optimal Force in that state', correct? However, when I input states via an API (similarly to how Kaci does above) I cannot match the aforementioned 'Optimal Force in that state' no matter the combination of Optimal Force by FL,FV, & pennation angle multiplier I use (and I should use them all). I have a feeling it is related to the FV multiplier, as the other values tend to fluctuate as expected while the FV multiplier doesn't.

Though I haven't gone back and looked in awhile, I pretty sure when I have used Thelen muscles (in a different model) these 2 numbers/methods aligned.

Any insights, investigation into this would be appreciated. I can also expand on this a bit more if need be (but feel Kaci demoed things as well I can/could, albeit in a different manner).
Jake Banks

User avatar
Jonathan SAVIN
Posts: 11
Joined: Wed Feb 10, 2021 12:52 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Jonathan SAVIN » Fri Apr 08, 2022 6:24 am

Thank you very much Mr. Uchida for this advice, replacing "equilibrateMuscles" with "realizeDynamics". Unfortunately, after implementing this change, the plot active_force vs joint_velocity remains flat. I've tried with "realizeVelocity" as well, the result is the same. This strange behaviour is also observed in Matlab scripting. Very strange indeed, as the force-velocity relation is a primary feature of muscle model.

User avatar
Jacob J. Banks
Posts: 88
Joined: Tue Jul 15, 2014 5:17 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Jacob J. Banks » Thu Apr 14, 2022 3:35 pm

As a quick follow-up to some of my initial concerns (admittedly I didn't start this post, but I did mention them above), I found that one needs to disable (i.e., 'set_ignore_...' to true (1)) the tendon and activation properties for the Millard muscles (see IV part 4):
https://simtk-confluence.stanford.edu:8 ... +in+MATLAB
This has allowed me to better align optimal forces for my custom SOpt function to what the OpenSim Tool produces. It may perhaps help you get better FV properties too.
Note: I still am having some issues with the first few frames, but may save that for a another post (quickly, seems that OpenSim doesn't use the velocity state calculated for the first frame, but rather and average from the proceeding frames?).
Jake Banks

User avatar
kaci chahrazed
Posts: 3
Joined: Wed Feb 02, 2022 3:06 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by kaci chahrazed » Fri Apr 15, 2022 2:32 am

Hello,

Thank you Jacob J.Banks, i will try this.

User avatar
Glen Lichtwark
Posts: 30
Joined: Mon Nov 19, 2007 10:02 pm

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Glen Lichtwark » Tue Jul 05, 2022 11:46 pm

I believe this is a problem with the implementation via Millard muscle type.

After setting the states in the model I have been calling the following -

Code: Select all

    Mod.realizePosition(state);   
    Mod.realizeVelocity(state);  
    Mod.equilibrateMuscles(state);  
When I do this, the I get force calculations, but the fibre velocity is essentially staying zero, hence I suspect its velocity is not be being calculated and therefore velocity effects are essentially ignored in the force calculations (not ideal).

When I undertake the exact same process with the Thelen muscle model, it works perfectly.

Any advice on what could be done to get the Millard model calculations would be greatly appreciated.

User avatar
Thomas Uchida
Posts: 1772
Joined: Wed May 16, 2012 11:40 am

Re: OpenSim API: problem of muscle force velocity function with Millard muscle type

Post by Thomas Uchida » Wed Jul 06, 2022 10:14 am

I think you can use Millard2012EquilibriumMuscle::getFiberVelocityInfo() (https://simtk.org/api_docs/opensim/api_ ... 39cda225cb). Here's a description of the information contained in the FiberVelocityInfo struct: https://simtk.org/api_docs/opensim/api_ ... ml#details. (IIRC, the data in this struct is what's used internally.)

POST REPLY