Aborting stiff foward dynamic simulations from MATLAB

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Peter Bishop
Posts: 21
Joined: Thu Aug 28, 2014 10:47 pm

Aborting stiff foward dynamic simulations from MATLAB

Post by Peter Bishop » Thu Aug 02, 2018 12:19 am

Hello,
I have been running forward dynamic simulations via an optimization framework implemented in MATLAB (optimizing control values sent to torque actuators to drive the model forwards), to maximize a given objective function such as forwards running speed. Every now and then a particular combination of control values (which are ~stochastically generated in the optimization algorithm) leads to the system becoming stiff at some point during the simulation, requiring many very small time-steps. For all intents and purposes it becomes stuck.

Obviously I will ultimately need to better 'tune' my model to avoid the possibility of this occurring (I already have CoordinateLimitForces implemented on every DOF). But in the short term, I was wondering if there was a way to just abort the simulation and have MATLAB move on to the next combination of control parameters to test, e.g. something like this:

for i=1:NumIterations
do simulation i, get results, etc
if simulation becomes stiff/stuck
abort simulation
continue
end
end

Currently, the only way I've been able to escape from these stiff simulations is to close MATLAB down and restart it....not ideal.

Many thanks in advance for any help!

Peter Bishop.

Tags:

POST REPLY