Fixed-Cost Simulation for Real-Time Viability
The step size and number of iterations that you specify affect the computational cost of your real-time simulation. As you decrease the step size or increase the number of iterations, the results become more accurate, but the simulation costs more so it can take longer to simulate. Simulation overrun occurs if the step size is too small or if there are too many iterations for the solver to calculate a solution in a single real-time computational frame.
Limit the computational cost by specifying the solver step size and, for implicit solvers, the number of iterations for the Simulink® global solver and for each Simscape™ local solver in your model.
For best results when specifying the step size of a fixed-step solver for real-time simulation:
Specify a sample time that results in time steps that are no greater than the maximum step size.
Specify the sample time for each local solver independently and as an integer multiple of the sample time that you specify for the global solver.
Choose a step size that is larger than the minimum step size for required speed and smaller than the maximum step size for required accuracy.
To configure the number of iterations for real-time simulation with a fixed-step solver:
For local solvers, specify the number of nonlinear iterations for each independently configured Solver Configuration block.
For global solvers ode14x and ode1be, specify the number of Newton’s iterations.
To optimize the number of iterations your model uses for fixed-cost, use