Why does algebraic loop not solve?

2 views (last 30 days)
Ben
Ben on 8 Jan 2013
I have what I thought was a pretty simple model that intentionally includes algebraic loops which I wanted to use to explore how Simulink deals with circular dependencies. But, Simulink 2011a can't seem to solve it and I'm not sure why or what to do to fix the problem. Here's what the model looks like in Simulink (mdl file link here):
The model is supposed to represent two poles (physical, rigid objects), each of which have one of their ends pinned to the X axis, and their other ends are pinned together. The components to the left of the XY Graph represent the behavior of the left pole. It accepts the X coordinate of its end not pinned to the X axis and computes the Y coordinate of that end based on the X coordinate of the end pinned to the X axis (-3 in this case) and the length of the pole (5 in this case). The components to the right of the XY Graph represent the behavior of the right pole. It accepts the Y coordinate of its non-X-axis end and computes the X coordinate of that end, which is fed back into the input of the left pole. Here's what the situation looks like physically -- black indicates given information and green is what Simulink should compute as the unique solution:
So, I expect the XY Graph to display a point at (0,4) which is time-invariant. Instead, I get this error message:
I'm new to Simulink and don't know how to go about resolving that error. What step size? There seem to be multiple step parameters, but all of them that I see seem to be related to time rather than algebraic loops, and almost all are set at 'auto' -- how can I figure out what a reasonable order of magnitude would be? Likewise, where can I set the error tolerance?

Accepted Answer

Ben
Ben on 8 Jan 2013
Edited: Ben on 8 Jan 2013
The answer to this question appears to be "The Simulink XY Graph Source does something that makes no sense". The model works fine if one:
  • Deletes the XY Graph component
  • Right clicks on one of the signals -> Create & Connect to Viewer -> Simulink -> Scope [little blue glasses appear on signal]
  • Right clicks on the other signal -> Connect to Existing Viewer -> Scope -> Axis1
So, the actual model has not changed at all; only the XY Graph has been replaced by a two-channel scope. That fixes the problem, and two constant lines at 0 and 4 are observed on the scope (as expected). What in the world is going on here Simulink??
Here is the original version, and here is a working version.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 8 Jan 2013
Edited: Azzi Abdelmalek on 8 Jan 2013
If you have to simulate this equation:
y(n+1)=y(n)+1
you can't do it just by using one sum block, which causes an algebraic loop, you should use a memory block or unit delay block to do it. Your model don't contain any memory block
  9 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 8 Jan 2013
You are right. I've never noticed that! Then what if the algebraic has multiple solutions, maybe it will cause an error?
Ben
Ben on 8 Jan 2013
Empirically with N=3, it seems that Simulink chooses the root closest to 0. For instance:

Sign in to comment.

Categories

Find more on General Applications in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!