Matlab Simulation Error

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mikael Koeneke
Posts: 4
Joined: Wed Jul 10, 2019 10:23 am

Matlab Simulation Error

Post by Mikael Koeneke » Mon Jul 13, 2020 3:53 pm

Hello everyone,

I've been trying to run a model simulation in Matlab, but I keep getting this error:

Exception caught in Millard2012EquilibriumMuscle::calcMuscleDynamicsInfo from DELT1
Exception caught in Millard2012EquilibriumMuscle::calcFiberVelocityInfo from DELT1
SimTK Exception thrown at MuscleFixedWidthPennationModel.cpp:169:
Error detected by Simbody method MuscleFixedWidthPennationModel::calcPennationAngularVelocity: Fiber length cannot be zero.
(Required condition 'fiberLength > 0' was not met.)

I'm trying to mimic the "build_and_simulate_simple_arm.m" example given in the files, but with our model instead of building one. I talked to my professor and she said the code could be reading the fiber length as NaN.

Here is the test code we're trying to run:

clc;clear;

import org.opensim.modeling.*
modelFile = 'MOBL_ARMS_6_29_18_4.1.osim';
model = Model(modelFile);

muscles = model.getMuscles();
BIClong = muscles.get("BIClong");
elb = model.getJointSet().get('elbow') ;
elbflex = elb.getCoordinate();

reporter = ConsoleReporter();
reporter.set_report_time_interval(1.0);
reporter.addToReport(BIClong.getOutput('fiber_force'));
reporter.addToReport(elb.getCoordinate().getOutput('value'), 'elbow_angle');
model.addComponent(reporter);

state = model.initSystem();
model.equilibrateMuscles(state);
elbflex.setSpeedValue(state,0);
elbflex.setValue(state,90*pi/180);

manager = Manager(model);
manager.initialize(state)
state = manager.integrate(10);

Any guidance would be helpful.
Thanks.

Tags:

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

Re: Matlab Simulation Error

Post by Thomas Uchida » Wed Jul 15, 2020 4:37 am

You might try plotting the muscle fiber length to get a sense of what's going on and diagnose the issue (e.g., using the MuscleAnalysis, https://simtk.org/api_docs/opensim/api_ ... lysis.html). You could also check the publication accompanying the model to ensure you aren't using it beyond the range of motion for which it was designed.

POST REPLY