MATLAB: Questions regarding ‘Using fixed-cost consistency runtime iterations’ option in Simscape Configuration Solver

Simscape

I have the following questions regarding the 'Using fixed-cost consistency runtime iterations' option in Simscape Configuration Solver:
1) When the fixed-cost is not selected und unlimited iterations are possible, how can I see the actual number of iterations used for each step? E.g. directly and some secondsafter triggering a brake in my model.
2) When setting the fixed-cost e.g. to 10, are for each step exactly 10 iterations used?
3) When increasing the number of iterations, should the convergence of the resulting step be improved? Even though I even get convergence errors for fixed-cost>100, but for 3 iterations the same model is running.
4) What is the maximum number of iterations recommended? Should it be possible with 3 to get proper results?

Best Answer

1) When the fixed-cost is not selected and unlimited iterations are possible, how can I see the actual number of iterations used for each step? E.g. directly and some seconds after triggering a brake in my model.
Unfortunately it is not possible to view the number of iterations taken when "Use fixed-cost runtime consistency iterations" is unchecked.
2) When setting the fixed-cost e.g. to 10, are for each step exactly 10 iterations used?
Yes. Convergence criteria are not used and instead the solver simply takes 10 nonlinear iterations.
3) When increasing the number of iterations, should the convergence of the resulting step be improved? Even though I even get convergence errors for fixed-cost>100, but for 3 iterations the same model is running.
_Typically, for a small number of iterations, for example 2 iterations -> 5 iterations the accuracy of the simulation may improve. The absolute numerical differences are however very dependent on each specific model and the nonlinearities present. However once the nonlinear solution converges, additional iterations do not improve simulation results and can introduce numerical oscillations. The recommendation would be to use the variable step solver initially which incorporates error control to achieve convergence and then tune the fixed step solver sample time / consistency iterations to match the variable step results. Without your specific model it is not possible to provide any further advice as to why it behaves as it does.
If a large number of consistency iterations are required, I would investigate the model itself as there may be robustness issues that could be fixed by changing the model. The Simulink solver profiler when used with a variable step solver can help to identify these general robustness issues. For example, see: https://www.mathworks.com/help/simulink/ug/examine-solver-behavior-using-solver-profiler.html_
4) What is the maximum number of iterations recommended? Should it be possible with 3 to get proper results?
_Typically less than 12 iterations are required, however there is no generic maximum recommendation. For exponentials (e.g. exponential diode) in particular, one tends to get large numbers of iterations (if you write out Newton’s method for e^(ax) – c you’ll see that x changes by a (nearly) constant value on every iteration until x is fairly close to the solution). Internally we have seen some specific models involving exponentials taking ~60 iterations (and succeeding).
Again, using the variable step solver and Simulink solver profiler to address any underlying modeling issues will likely resolve sensitivities associated with this number._
Related Question