Page 1 of 1

Static Optimization with new Muscle Model

Posted: Fri Sep 03, 2021 9:18 am
by st115990
Hello OpenSim Team,

we developed a new muscle model where the activation is not a State variable anymore but depending on the normalized Calcium concentration.
After finishing this model, we tested it with some forward simulation. (Just simple excitation of the muscle) This forward simulation worked all fine. Then we tried some inverse simulation, here the inverse kinematics and the inverse dynamics work fine but if we start a static optimization, the solver just "hangs". It neither finds a solution nor the maximum iterations are reached, it just does nothing.
We tested the same setup with the Millard muscle model, which worked fine.

Now we are wondering where is the difference between the muscle models and which methods/state variables do new muscle models need to be used for static optimization?

Many thanks in advance.

Best
Mike

Re: Static Optimization with new Muscle Model

Posted: Mon Sep 06, 2021 9:22 am
by st115990
During a deeper investigation of the problem, I came across the following error:
- I build the debug version of OpenSim from Scratch (latest master and the included muscle model)
- when I set up a Static Optimization with the AnalyzeTool and the cpp API, this error message occurs:

Assertion failed: t >= x[0] && t <= x[x.size()-1], file C:\mike-repos\opensim-core\dependencies\simbody\SimTKmath\Geometry\include\simmath/internal/GCVSPLUtil.h, line 95

If I use the same code and compile it for a release version of OpenSim no error is produced.

Is this a bug or is it currently not possible to debug a static optimization run? And if not, is there a workaround or a possiblility to get to know which elements need to be included in a Muscle Model to work for SO?

Best
Mike

Re: Static Optimization with new Muscle Model

Posted: Mon Sep 06, 2021 12:15 pm
by tkuchida
The assert() check will be skipped in Release mode- the problem is still there, but the check isn't being performed and therefore the problem isn't being reported. Based on the assertion, it looks like you are trying to evaluate a function at a point outside the permissible domain (i.e., t is not between x[0] and x[x.size()-1]). Even if the function still works, the value it's returning may not be useful.