Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Sina Porsa
- Posts: 99
- Joined: Thu Feb 03, 2011 7:21 pm
Post
by Sina Porsa » Mon May 19, 2014 12:42 am
Hi all
I am trying to report fiber active and passive forces using matlab API. Here is my code:
Code: Select all
% load model
osimModel = Model('test.osim');
% initiate states and set proper values
defaultStates = osimModel.initSystem();
...
% geting the fiber force
fiberForce = muscle.getFiberForce(defaultStates)
But it returns an error:
Error using findFiberLength (line 37)
Java exception occurred:
java.lang.RuntimeException: Exception caught in
Thelen2003Muscle::calcMuscleDynamicsInfo
of ercspn_r
Exception caught in Thelen2003Muscle::calcFiberVelocityInfo
of ercspn_r
SimTK Exception thrown at State.cpp:2080:
State Cache entry was out of date at Stage Position. This entry depends on
version 11 of Stage Position but was last updated at version 0.
at org.opensim.modeling.opensimModelJNI.Muscle_getFiberForce(Native Method)
at org.opensim.modeling.Muscle.getFiberForce(Muscle.java:557)
Is there anyway to realize the system into a new stage?
Thanks
Sina
-
jimmy d
- Posts: 1375
- Joined: Thu Oct 04, 2007 11:51 pm
Post
by jimmy d » Tue May 27, 2014 3:45 pm
Hi Sina,
the problem may be in the '...', perhaps there is a change in the model or states and system picks up on it.
You could also use computeStateVariableDerivatives() to force a realize up to accelerations.
hope that helps,
-james
-
David John Saxby
- Posts: 83
- Joined: Mon May 09, 2011 8:39 pm
Post
by David John Saxby » Wed Apr 01, 2015 10:04 pm
Hey Guys,
I've experienced the same error as Sina.
I am moving a model (2392) through the complex knee flexion/extension range and am interested in the force-length relationship.
Code: (model already initialized, moved into x gen coordinate and state updated)
muscleOfInterest = Muscle.safeDownCast(model.getMuscles().get('myMuscle'));
% set activation to 1
muscleOfInterest.setActivation(state, double(1.0));
% compute fiber force
muscleOfInterest_FiberForce = muscleOfInterest.getFiberForce(state);
Then the same error as Sina.
Is this an issue with Thelen class muscles? Have I really updated the states?
Or is there something more fundamentally wrong with what I am asking OpenSim to do?
Best,
David
-
David John Saxby
- Posts: 83
- Joined: Mon May 09, 2011 8:39 pm
Post
by David John Saxby » Sun Apr 05, 2015 8:26 pm
James,
Thanks for this reply. I'm going to update my code with your section and let you know how it goes.
Best,
David