1
votes

I have a system where simulink complains about algebraic loops, however in runtime algebraic loops will never occur. Is it possible to ignore the error?

The model have the same properties as below. There are two switches which will make an algebraic loop if both switched on, but this will never switch in runtime. Simulink cannot solve it since the value is complex. Example plant

The error message is: Cannot solve algebraic loop involving 'complexAlgebraicLoop/Sum' because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop. For example, add a delay or a memory block to the loop.

1
Does it work if you use two separate loops, one for real and one for complex?Navan
@Navan: Yes that will work, but that is not a clean solution when I have many signals. :-)Torstein I. Bø
Yes. That would not be clean for too many signals. Only other workaround I can think of is to use MATLAB Function block for the entire logic.Navan
Can you explain why if at run time algebraic loops will never occur why you need to model them?Phil Goddard
@PhilGoddard: The reason is that I simulate a system where nodes are connected in a ring. The connections can be open or closed. The system can look like: 1-2 | | 4-3 Each connection can be open or closed. An algebraic loop occur if all connections are closed, therefore one (arbitrary) connection is openes, which gives the same solution. Also sometimes, 1 and 2, and 3 and 4 are "groups" other times maybe 1, 2, and 3, while 4 is disconnected from the others.Torstein I. Bø

1 Answers

3
votes

The problem here is that the variable in the algebraic loop is complex and Simulink cannot solve algebraic loop for complex values. However, a workaround is to convert to real values (e.g., real and imaginary part or magnitude and angle) and then back to complex values. For this problem it means: enter image description here