Simulink: What is an Algebraic Loop?

If you have worked with Simulink for more than a few hours you have no doubt seen the error message “Warning world about to end, Algebraic loop detected. You have 10 seconds to snip (insert unit delay) to prevent model from exploding

Ok, so I exaggerated the error message, however why there are algebraic loops in the system is often a source of confusion for people. If we look at the model above and “translate it” to into the mathmatical equation we have

 y = y - 0.5 * y

This equation, written in C is perfectly legal; however there is a hidden assumption of the initial value of Y. Let’s look at how Simulink would like you to set this up and then look at what that does depending on how you break the algebraic loop.

We have three examples of breaking the algebraic loop. For the sake of argument let’s say that the input is a constant value of 1 and let us change it to a sum operation

Form 1Form 2Form 3
T = 01.521
T = 11.7521.5
T = 21.98321.875
T=inf222

If the IC value for the unit delay is switched to 0 (zero) then form 1 and 2 result in the same outputs, with output values of 1, then 1.5 while form 3 has an initial output of 1, then 1, then 1.5.

Recommendations

General best practice is to insert the unit delay block where the data is consumed, in this example it would be placed before the “Sum” block. By doing this we ensure that only the paths that need the last pass data receive last past data. Form “3” in the example shows the effect of inserting the unit delay at the source.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.