ligament models

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Glen Lichtwark
Posts: 30
Joined: Mon Nov 19, 2007 10:02 pm

ligament models

Post by Glen Lichtwark » Wed Aug 20, 2014 5:59 am

Hi everyone,

I was wondering if someone may be able to help me out with regard to the Ligament model in the latest version of Opensim (3.2).

I have read a few recent posts, but I would like the following to be clarified -

How does the 'pcsa' value scale the ligament force-length relationship. Does it just multiply the y-values (presumably force) by this value to give the force in Newtons?
- I notice that when I modify this value, it also then changes the 'maxIsometricForce' to the same value, which seems to be a better name of this scalar, as PCSA would suggest that some peak stress would be required that could be be scaled to a peak force based on a given PCSA.

What do the x-values for the force-length relationship represent?
- I assume this is a strain value (relative to the resting length property), not an absolute length. But understanding this critical, because the current standard is a force length relationship which increases from zero force, zero length and then increases (in a standard curvi-linear fashion) to a value of one force at one length. Since ligaments are unlikely to strain to values of 1 (100%) and are more likely to fail at values of around 0.15 (15%) then scaling with these factors seems awkward without having to rescale the x-values.

Would it be best to set the maxIsometricForce (or pcsa if this is the same thing) to 1 and then create customised force-length relationships?

I read in an old post that the scaling of the ligament lengths was to be updated in future versions of the software. Has this been implemented yet?

I am having trouble implementing the 'getTension' method of the ligament class when calling using the API through Matlab. After setting the initial state I am able to determine the length of the ligaments and change the state (e.g. change joint angles) and get the new length of the ligament. However, when I try the 'getTension' method, this crashed Matlab. I have worked around this by interpolating the force-length relationship at the strain value calculated, but this does not seem efficient, particularly given that I am not sure about the properties of the model.

Thanks in advance for any help that any of you can provide.

Glen

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

Re: ligament models

Post by Glen Lichtwark » Thu Aug 21, 2014 2:57 am

I just wanted to add that I have been able to fix the problem with the 'getTension' method. Somewhere along the line the states that I were not adjusting were being reset to some default values which was causing the crash.

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

Re: ligament models

Post by Glen Lichtwark » Tue Aug 26, 2014 5:40 am

Some things I have learnt about the following questions through exploration and communication with Ayman Habib (thanks Ayman)
What do the x-values for the force-length relationship represent?
The equation used to calculate ligament force or tension is

Tension = forceLengthCurve(path.getLength(s)/restingLength))* pcsaForce;

Therefore the x-scale is the normalised length relative to resting length (not the strain which would be the length change (i.e. getLength-restingLength) divided by resting length. Hence the tension should start to raise at a value of 1, not 0 as is used in the examples and as the standard values for the ligament class. This is certainly not intuitive, but if you essentially add one to the standard curve provided, you should get reasonable forces out.
How does the 'pcsa' value scale the ligament force-length relationship. Does it just multiply the y-values (presumably force) by this value to give the force in Newtons?
This does certainly just scale the y-value of the force-length relationship defined in the ligament (see equation above). It doesn't really have anything to do with PCSA at all. Note that the peak value in the standard function provided reaches a value near 1 at an x-value of 1 (which is essentially 100%). So to utilise this PCSA value with some physiological meaning you should essentially calculate the failure strain (lets say 20% or a x-value of 1.2), then find the y-value of the function at this value and then divide the maximum failure force by this value. E.g. if failure strain is 20% and failure strength/force is 400, the y-value is 0.175 at 1.2, therefore a PCSA value of 400/0.175 = 2285 is reasonable. This will then produce a value of 400 at 20% strain.
Would it be best to set the maxIsometricForce (or pcsa if this is the same thing) to 1 and then create customised force-length relationships?
This seems to be the case when you look at the code for the ligament force component.
I read in an old post that the scaling of the ligament lengths was to be updated in future versions of the software. Has this been implemented yet?
The ligament paths are scaled with the model, however the resting lengths are not scaled when using the scaling tool. I do however note, that when looking at Ligament.cpp , that there is code to try and scale the resting length. I am not sure why this isn't working, but suspect that something has changed in the implementation of newer versions of Opensim. Any suggestions from out there?

I hope this helps.

Glen

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

Re: ligament models

Post by Glen Lichtwark » Thu Aug 28, 2014 4:47 am

Sorry to keep reposting on my own post - but it seems that the path scaling is NOT working in the current version. At least in my implementation using the ScaleTool.

User avatar
Mary K
Posts: 37
Joined: Mon Feb 24, 2014 9:15 am

Re: ligament models

Post by Mary K » Thu Sep 04, 2014 10:45 am

Hello there,
you did a great job. I also had many of yours queries so thank you :)

In the source code there is this function - look what it does:

Code: Select all

bool Ligament::setMaxIsometricForce(double aMaxIsometricForce)
{
	set_pcsa_force(aMaxIsometricForce);
	return true;
}
so I think we can assume that pcsa_force is really the same thing as aMaxIsometricForce...(??) :roll:

Would it be best to set the maxIsometricForce (or pcsa if this is the same thing) to 1 and then create customised force-length relationships?
Seems to me like a 'yes'. But still cannot really tell what's the purpose of parameter "pcsa_force".

User avatar
Luca Modenese
Posts: 43
Joined: Wed Jan 21, 2009 9:16 am

Re: ligament models

Post by Luca Modenese » Tue Sep 09, 2014 2:59 am

Thank you Glen for the very useful post! Another way of preventing a Matlab crash when using the 'getTension' method (without having to specify directly the joint angles that you are not adjusting in the state) seems to be updating a visualizer associated with the model before calling that function.

Luca

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

Re: ligament models

Post by Glen Lichtwark » Wed Sep 10, 2014 4:54 am

Yes, Luca. I have also found this to be the case. In which case there must be something called within the visualiser that adjusts the states properly. Does anyone know what this step is so I can call it directly from the API?

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

Re: ligament models

Post by Michael Sherman » Wed Sep 10, 2014 10:14 am

Hi, Glen.

After changes to state variables, a state must be "realized", which means to perform calculations that depend on the new values. The results are then cached internally in the State object from which they were calculated. This is done to ensure that out-of-date values can never be returned, and to avoid unnecessary recalculations.

Most OpenSim operations realize the state to obtain the values they need. The Visualizer realizes the state it is given to get values it is asked to display, such as the spatial locations of the bodies. Probably as a side effect that makes the getTension() result available which is why it worked here.

You can realize the state explicitly by calling

Code: Select all

model.getMultibodySystem().realize(state);
. By default this calculates everything through accelerations; there are variants for calculating less.

There may be a better way to do this in OpenSim (anyone know?) but this is one way.

Regards,
Sherm

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

Re: ligament models

Post by Glen Lichtwark » Thu Sep 11, 2014 2:13 am

Thanks for this Sherm. This is exactly what I expected after looking into the visualiser code. The getMultibodyDynamics class is not exposed such that it can be accessed from Matlab or Python, however after looking at some previous posts I was able to achieve the same thing using -

Code: Select all

model.computeStateVariableDerivatives(state);
Thanks for everyone's comments.

User avatar
Giuliano Lamberto
Posts: 5
Joined: Fri Feb 24, 2012 11:48 am

Re: ligament models

Post by Giuliano Lamberto » Fri Sep 12, 2014 3:57 am

Hi,

First of all, thanks a lot for the suggestions shared.

I'm working on a lower limb opensim model with ligaments and I'm running some walking simulations (scale tool, IK, ID and SO). After the manual scaling of ligaments origins and insertions and the x-translation of the force-length relation, the results are quite good until the ID. Unfortunately, the static optimization doesn't work properly:
- muscular activations/forces are strongly affected by adding ligaments in the simulation;
- ligament forces have a spike shape and they are about 10 times bigger than they should be.

Does anyone of you know which is the role that the ligaments play in the static optimization tool?
I tried to run some basic simulations (tug of war with ligaments) but I wasn't able to find a solution.

What tools do you usually use to quantify the forces on ligaments?
What are the advantages using the 'getTension' method?

thanks in advance
Giuliano

POST REPLY