Page 1 of 1

Matlab Simulation Error

Posted: Mon Jul 13, 2020 3:53 pm
by mikaelkoeneke
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.

Re: Matlab Simulation Error

Posted: Wed Jul 15, 2020 4:37 am
by tkuchida
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.