How can I resolve algebraic loops in my Simulink model in Simulink 6.5 (R2006b)?

45 views (last 30 days)
I am looking for some general diagnostic steps which I can follow so as to troubleshoot algebraic loop issues.
For example, I have a simple algebraic loop model consisting of a Constant and a Sum block. When I increase the value of the Constant to 1e8 and above, I receive the following error:
Trouble solving algebraic loop containing 'algebraicloop_problem/Sum1' at time 0. Stopping simulation. There may be a singularity in the solution. If the model is correct, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances).
I do not receive this error when the Constant value is less than 1e8. What would be the best way to troubleshoot such an issue?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 6 Dec 2011
Algebraic loop solving is an iterative process. A successful solution results only if the algebraic loop solver converges to a definite answer. Some algebraic loops will not converge and the algebraic loop solver in Simulink tests to determine when this is the case. When the algebraic loop fails to converge, or converges too slowly, the iterative procedure will not yield a result and will exit with no solution, thereby resulting in an error message.
As an example, consider this simple model that implements an algebraic loop with the Constant block value set to more than 1e8. Use the IC block under Signal Attributes in the Simulink Library and place it after the algebraic variable which in this case is the Sum block in algebraicloop_problem.mdl. Set the IC value to the value in the Constant block. This loop would converge to a solution for the constant value of 1e7, but fails when the constant is 1e8. By providing an initial condition closer to the solution the convergence tests pass, and a solution is found.
As general diagnostics, follow the instructions given below to troubleshoot algebraic loop issues:
1. Type the following at the MATLAB command prompt:
2. To view a list of all the Simulink debugger commands:
3. Show list of algebraic loops.
4. Set the algebraic loop trace level to 4, i.e. everything:
atrace level 4
5. Set the solver trace level to 4, i.e. everything:
strace level 4
6. Go to the next simulation point:
step top
Or continue to the next break point:
To quit the Simulink Debugger and return to the MATLAB Command Prompt:
The output obtained with these commands will also provide information on the number of iterations taken by the algebraic loop solver to solve the algebraic variable.

More Answers (2)

Kutaiba sabah
Kutaiba sabah on 13 Jun 2017
Hi there,
I had a similar problem to yours and I solved it by reducing the PQ tolerance to 0.001, and this value not fixed depend on the number of buses in your model when you have many buses, you need to reduce that value more until the system works.

luciana lima
luciana lima on 4 Jun 2015
Then I started running sldebug in the MATLAB window, happened that the program was running but stopped in 71% , all day. Then I closed the MATLAB. I think that the "sldebug" will show me what loop (s) is wrong But if It hasn't completed 100% I am not understaning yet. How can I solver this

MathWorks Support


Find more on Configure Simulation Conditions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!