blips in simulated muscle variables

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ton van den Bogert
Posts: 166
Joined: Thu Apr 27, 2006 11:37 am

blips in simulated muscle variables

Post by Ton van den Bogert » Mon Aug 29, 2022 10:06 am

We're experimenting with a simple arm model, based on build_and_simulate_simple_arm.m which comes with the OpenSim installation.

A TableReporter is used to report some variables, and the plots have some strange glitches in the muscle variables. This happens for both muscle models we tried; DeGrooteFregly2016 (figure 1) and Millard2012Equilibrium (figure 2). Sometimes the glitches are very large.
Figure2.png
Simulation result with DeGrooteFregly2016Muscle
Figure2.png (44.68 KiB) Viewed 710 times
Figure1.png
Simulation result with Millard2012EquilibriumMuscle
Figure1.png (45.98 KiB) Viewed 710 times
The glitches are very short and I suspect that the simulation is still accurate. But it makes the output look ugly, and real muscles can never produce such output, of course.

Is there a way to avoid this?

I experimented with manager.setIntegratorMaximumStepSize but that did not make a difference.

Ton van den Bogert

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: blips in simulated muscle variables

Post by Ayman Habib » Thu Sep 01, 2022 12:44 pm

Thanks for reporting, Ton.

Can you provide the modified code to get/plot the data from the TableReporter so we can reproduce (since the provided script uses a console reporter with a sparse reporting interval).

Thank you,
-Ayman

User avatar
Ton van den Bogert
Posts: 166
Joined: Thu Apr 27, 2006 11:37 am

Re: blips in simulated muscle variables

Post by Ton van den Bogert » Fri Sep 02, 2022 10:36 am

Thanks, Ayman.

To keep the issue as simple as possible, I went back to the original simple arm example, removed the ConsoleReporter, and added the TableReporter and plotting code. See attached build_and_simulate_simple_arm_modified.m. I had to rename to .txt because the forum did not accept a .m file.

The blips are smaller but they are definitely there (see Figure below). Could it be that the reporter picks up some data from the ODE solver iterations that were not accepted as successful time steps?

Our altered model had different mass properties, muscle properties, and had wrapping cylinders, which may have increased the problem, but fundamentally I think it was already there in the original model. If anyone wants to try the altered model, I have attached those files also. Just run test.m, which calls makemodel.m. In OpenSim 4.3, this produces the plots I reported earlier. Today I tried this for the first time in OpenSim 4.4. The same code now produces the following error message:

Code: Select all

  Error detected by Simbody method AbstractIntegrator::takeOneStep(): Unable to advance time past 0.618081.
Maybe this is a clue that the solver has difficulties.

By the way, I never saw any output from the original ConsoleReporter. I expected this to appear in the Command window, but nothing appeared. I assumed that this only works outside of Matlab.

Ton
Untitled.png
Untitled.png (98.28 KiB) Viewed 542 times
Attachments
test.txt
(4.38 KiB) Downloaded 34 times
makemodel.txt
(6.96 KiB) Downloaded 28 times
build_and_simulate_simple_arm_modified.txt
(6.46 KiB) Downloaded 37 times

POST REPLY