COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Need help with solving an algebraic loop error.

• Email
• Follow

```I've read around and tried a bunch of the recommended fixes; however, I am not too familiar with Simulink and how it works and am therefore having issues finding a workable solution to fixing my algebraic loop error.

I have posted my model here: http://dl.dropbox.com/u/53213/valve_AMA_sim_troubleshoot.mdl

I would appreciate any assistance in understanding what is causing this error and how I might remedy it.

Sorry if the model is messy, I am still trying to get comfortable with Simulink.
```
 0

See related articles to this posting

```You have two algebraic loops in this model, they can both be fixed using a simple time delay if that would be acceptable in your model.  I'd suggest using a transfer function on the signal just before it enters Q.i and similarly on the deltaL_a.  Change the denominator of the transfer function to be [1 x] where x is an appropriate time delay in seconds.
You will get the correct steady state responses from the model but your dynamic responses may be affected slightly by the time delay.  If you select a time delay an order of magnitude faster than the dynamic response it shouldn't be too bad.
```
 0

```I see. That does seem to take care of the issue. What is it that the time delay does that allows the the solver to work?

```
 0

```The algebraic loop is formed when an input to an equation relies on the output from the same equation.  Basically, Matlab doesn't know where to start in the loop.  By introducing a time delay Matlab can start the loop off using a 'fake' input because the real input to the equation is controlled by the time delay and is at least one time step behind the output (for the best dynamic response you should make the time delay one time step).
In dynamic responses you won't get a perfect result because the input to your equations will be using the result from a delayed output, but if your dynamic transients are much slower that the time steps this likely will be a very close approximation.
If you're looking for steady state response you should get exact results because once steady state is reached, the signal being fed back won't change over time and hence the time delay becomes irrelevant.
In even simpler terms, imagine you're baking cookies to sell in a store, you don't know how many customers you'll get on any given day so you don't know how many cookies to bake.  Rather than throwing your hands in the air and declaring "I quit" (which is Matlab's response!) you bake enough cookies to satisfy the number of customers you had yesterday, some days you'll bake too many, others not enough, but in general you'll be close to the right amount.  If you get the same customers coming back day after day (steady state) then baking the number you needed yesterday will give you exactly the right number of cookies.
```
 1