Clear Filters
Clear Filters

Maximum number of internal loops reached in simulink simulation error

4 views (last 30 days)
I am using hysteresis in simulink simulation but I am getting this error message: "Maximum number of internal loops reached" . In the s-function code initially number of MLOOPS was set to 200 but even after I changed it to 200000000000 I am getting same error.Please help.

Answers (1)

Saurabh
Saurabh on 25 May 2023
The "Maximum number of internal loops reached" error is Simulink's way of telling you that the simulation took too long to run. The error message indicates that the simulation exceeded the maximum number of internal time steps that Simulink is allowed to take to solve the system of differential equations.
It is not recommended to set the number of MLOOPS to an extremely high value as it can lead to other issues such as long simulation times and excessive memory usage.
One solution to this issue is to increase the simulation time span and test again. This can be done in the Simulation Settings by selecting the "Stop Time" option and setting it to a higher value.
Another solution could be to adjust the solver settings to be more efficient. You can try reducing the step size of the solver, using a different solver type such as ode15s or ode23t, or increasing the solver tolerance. You can find the solver settings under the Configuration Parameters dialog box by selecting the "Solver" option.
If the issue persists even after trying the above solutions, it could be due to issues with the hysteresis model itself. It is recommended to review the implementation of the hysteresis model to see if there are any obvious errors or inefficiencies that could be causing the simulation to fail.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!