Hello,
I have a MATLAB code that takes about 7-8 mins to run, with the following line taking more than 5 mins
state = manager.integrate(timed); with timed = time(i+1)-time(i);
I was looking for a way to speed up the integration process. Can we use any other method or function?
Any help would be appreciated.
Regards,
Shivangi
Speed up integrator
- Shivangi Giri
- Posts: 51
- Joined: Sun Jul 02, 2017 3:04 am
- Carmichael Ong
- Posts: 393
- Joined: Fri Feb 24, 2012 11:50 am
Re: Speed up integrator
If you're using the default integrator in OpenSim, it will use the Runge-Kutta-Merson integrator which is a variable step integrator. This means that it will take as large of time steps that it can take, while keeping error below some tolerance for each step. If you are integrating in a loop, you may be disrupting this variable step, if the time step you've chosen is smaller than the time step the integrator would have taken otherwise. So, it may be good to just let the integrate() function try to integrate to the final time in one go.
You may also be able to use setIntegratorAccuracy() to allow the integrator to take larger steps, but then it would be important to do a sensitivity analysis to ensure that the results are reasonable ant not changing too much as you loosen the accuracy.
You may also be able to use setIntegratorAccuracy() to allow the integrator to take larger steps, but then it would be important to do a sensitivity analysis to ensure that the results are reasonable ant not changing too much as you loosen the accuracy.