Page 1 of 1

Tension and strech of a biarticular Path Spring

Posted: Tue Jul 17, 2018 6:07 am
by pia5
Hi,

I replaced a muscle (gastrocnemius) of the right leg by a biarticular path spring as described in "Simulation-Based Design to Reduce Metabolic Cost" (https://simtk-confluence.stanford.edu/d ... bolic+Cost). Now I would like to see the Tension and length values of the path Spring over time. I cannot find these values, when I perform CMC. I know that the Tension can be calculated using the following Formula: tension = (K*s)*(1+D*ldot) where stretch, s = l-lo for l > lo, and 0 otherwise (https://simtk.org/api_docs/opensim/api_ ... ml#details). But to calculate the Tension I Need to know the length l of the spring.


Thank you in advance for your help.

Re: Tension and strech of a biarticular Path Spring

Posted: Tue Jul 17, 2018 9:41 am
by tkuchida
to calculate the Tension I Need to know the length l of the spring
See the getLength() method here: https://simtk.org/api_docs/opensim/api_ ... 55d5f629ac.

Re: Tension and strech of a biarticular Path Spring

Posted: Tue Jul 17, 2018 1:06 pm
by pia5
Thank you very much for your Reply!

Can you tell me if I can use the getLength() method in the scripting shell window or is this not possible?

Re: Tension and strech of a biarticular Path Spring

Posted: Tue Jul 17, 2018 2:23 pm
by tkuchida
Can you tell me if I can use the getLength() method in the scripting shell window or is this not possible?
Yes, you can use getLength() in the scripting shell. Here's an example (assuming the arm26 model has been opened):

Code: Select all

Jython Interactive Console
>>> model = getCurrentModel();
>>> state = model.getWorkingState();
>>> muscle = model.getMuscles().get('TRIlong');
>>> muscle.getGeometryPath().getLength(state)
0.27760917727192447
Information about scripting in the GUI can be found on the following pages in the Confluence documentation:
- Common Scripting Commands - https://simtk-confluence.stanford.edu/d ... g+Commands
- Scripting in the GUI - https://simtk-confluence.stanford.edu/d ... in+the+GUI
Also see the examples in your OpenSim installation directory (e.g., C:\OpenSim3.3\Scripts\GUI_Scripting).

Re: Tension and strech of a biarticular Path Spring

Posted: Wed Jul 18, 2018 8:44 am
by pia5
Thank you very much!

I managed to get the length with the following Code:
>>> model = getCurrentModel();
>>> state = model.getWorkingState();
>>> force = modeling.PathSpring.safeDownCast(model.getForceSet().get("BiarticularSpringDamper"))
>>> length= force.getGeometryPath().getLength(state)

I hope this is correct?

My problem is that I need the length of the biarticular path spring during the whole motion. Can you give me a hint how I can get the length at every time step? (I want to take the time steps for example from the motion file)

Thank you
Pia

Re: Tension and strech of a biarticular Path Spring

Posted: Wed Jul 18, 2018 9:43 am
by tkuchida
There are a few strategies. You could try writing a script (in the GUI, MATLAB, or Python) that steps through each row of the results, computing the length of the GeometryPath at each time point. Another strategy is to use the OutputReporter in OpenSim 4.0 to compute/plot the GeometryPath's length (see https://simtk.org/api_docs/opensim/api_ ... 3897ad3d0b).