Difference CMC 3.3 and 4.0?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Pierre Kibleur
Posts: 19
Joined: Tue Sep 19, 2017 2:16 am

Difference CMC 3.3 and 4.0?

Post by Pierre Kibleur » Mon Apr 09, 2018 8:09 am

Hello,

From using OpenSim's Windows GUI, I recently started using OpenSim on Linux with the API instead, which I believe is associated to SimBody 4.0. I am trying to run CMC on my model, but with the latest change I made (the addition of a degree of freedom), I cannot successfully run CMC from the API. At around half the simulation time, I have the following message, for all muscles in the model, and the computations stop.

Code: Select all

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

WARNING- MuscleAnalysis::record() unable to evaluate muscle forces at time 3.69311 for reason: Exception caught in Millard2012EquilibriumMuscle::calcMuscleDynamicsInfo from MUSCLE
Exception caught in Millard2012EquilibriumMuscle::calcFiberVelocityInfo from MUSCLE
SimTK Exception thrown at MuscleFixedWidthPennationModel.cpp:161:
  Error detected by Simbody method MuscleFixedWidthPennationModel::calcPennationAngularVelocity: Fiber length cannot be zero.
  (Required condition 'fiberLength > 0' was not met.)
What is weird is that after rebooting on Windows, I tried the same exact thing from the GUI, which worked flawlessly (I imported the setup file, the tasks and reserves file).

Would anybody have any idea what I've been doing wrong, or if there was a change in the implementation that could explain this?
I may be forgetting something, because CMC from the API was working before this last change...

Best,
Pierre

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Difference CMC 3.3 and 4.0?

Post by Dimitar Stanev » Mon Apr 09, 2018 10:39 am

It is possible that the two versions are different. I would suggest that you compare the two simulations until 3.68s and see if there are any differences. It may be that you are not setting up the CMC tool properly through the API.

User avatar
Pierre Kibleur
Posts: 19
Joined: Tue Sep 19, 2017 2:16 am

Re: Difference CMC 3.3 and 4.0?

Post by Pierre Kibleur » Mon Apr 09, 2018 12:44 pm

Hello Dimitar,

Thank you for your answer. Just to be sure, and while I look deeper into the differences in output: I've been running the CMC tool as follows. Does it look ok?

Code: Select all

model.initSystem()

tool = osim.CMCTool("CMC_setup.xml", False) 
tool.setModel(model) 

tool.setInitialTime(3)
tool.setFinalTime(4.5)
tool.run()


User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Difference CMC 3.3 and 4.0?

Post by Dimitar Stanev » Mon Apr 09, 2018 10:44 pm

I think this should be:

Code: Select all

tool = osim.CMCTool("CMC_setup.xml") 

User avatar
Pierre Kibleur
Posts: 19
Joined: Tue Sep 19, 2017 2:16 am

Re: Difference CMC 3.3 and 4.0?

Post by Pierre Kibleur » Tue Apr 10, 2018 1:38 am

Yes it is indeed simpler that way, thank you. The "False" option prevents the tool from loading an "Unassigned" model file (which it instantly fails to do), as the setup file was created from the GUI, and that appears to be a default setting.

Update:
After following your advice and simply changing those two lines in the script and adding my model in the <model_file> of the CMC_setup.xml, the CMC tool ran properly from the API. I'm quite puzzled as a result, because there's only three things that changed, compared to yesterday when it didn't work:

1)

Code: Select all

model.initSystem()
which is now obsolete, as "model" isn't called in the following of the script (but I kept it, which I guess is un-necessary)

2)

Code: Select all

tool.setModel(model)
Which I commented out

3) Today is actually a Tuesday.

Intuitively, I would say that No.1 is the culprit. I hope that the whole thing continues to run well as I move on.

I'll add that the difference between the two CMC outputs is minor, but globally:
-contraction velocities are smoother out of OpenSim 4.0
-Some muscle activations differ (max abs difference = .60, 9/40 muscle activations differ by more than .10, mean abs diff = 0.008, avg std = 0.012)

Thanks for the help Dimitar,

Best,
Pierre

POST REPLY