ERROR: trouble solving algebraic loop - cant solve it

I would be very grateful if you could help me with an issue, which after performing several tests, still don't know how to solve. :-(
I am developing a Simulink model; but, while running it, an error window pops up -always at the same simulation step- with the following text: "trouble solving algebraic loop containing my_subsystem_name. There may be a singularity in the solution. If the model is correct, try reducing the step size".
The block where the error comes about is an enabled subsystem. This subsystem consists, among others, of a max running reseteable block and, the reset input for this one, enables also the following piece of calculations at the same level (inside the same subsystem, my_subsystem_name).
Apparently the program is unable to calculate the maximum at some extent of decimals; but when isolating the subsystem and setting the input values with the same values as the ones taken at the simulation step where the issue occurs, the model works.
I have also isolated the subsystem from the smallest piece to the largest and tested, concluding that it just fails when sticked to the rest of the model.
Have also thought of the multiple enable ports inside the subsystem; nevertheless the model seems to work for the first simulations steps...
Any clue to solve this? It will be pretty much appreciated.
Many thanks

 Risposta accettata

There is no definite way to resolve an algebraic loop problem. If you are sure your model is right, you can click menu Simulation->Configuration Parameters->Diagnostics, and change the setting for Algebraic loop from "error" to "warning" or "none".
But usually, it indicates that your model has problem. You can try to add a Unit Delay block at the place where the error occurred. Searching for "Algebraic loop" in document will lead you to the explanation of it.

4 Commenti

Hi Jiang, many thanks for your quick reply.
Regarding the first option, my simulation was already set as "warning" for the algebraic loop, so no workaround for there.
But it looks like the second option, in spite of further adjustments to match the results expected, solves my issue!! So many thanks for this!!
All right, as a note for future reference. Adding a Unit Delay block may eliminate the algebraic loop problem but it may also impact the simulation result. Users need to do "further adjustments" to make sure the result is intended.
Thanks Jiang....Your answer solved my problem also...
I am unable to solve the same error Jiang.After adding a unit delay,another error popped up i.e. in another Multiport switch same error persisted. Is there any solution to it?

Accedi per commentare.

Più risposte (1)

mado
mado il 3 Ott 2012
Modificato: mado il 3 Ott 2012
I put unit delay of order zero but the output was square wave at constant level and it shouldn't be

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Richiesto:

N
N
il 23 Ago 2011

Commentato:

il 23 Apr 2014

Community Treasure Hunt

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

Start Hunting!

Translated by