GeezerVison is showing github.com — Fix false positive algebraic loop in interconnect for MIMO feedthrough (#1257) by paneendrakumar0 · Pull Request #1258 · python-control/python-control
Conversation
Fixes #1257.
Summary of Changes
In InterconnectedSystem._compute_static_io, the maximum number of iterations allowed for fixed-point signal propagation was previously bounded by len(self.syslist) + 1.
While an acyclic feedthrough path visits each subsystem block at most once in SISO interconnections, in MIMO systems with direct feedthrough, an acyclic path can traverse through different input/output channels of the same block multiple times (for example, decentralized PI control coupled to a 2x2 plant with direct feedthrough). Because len(self.syslist) + 1 was exceeded before reaching the convergence check, ct.interconnect raised RuntimeError: algebraic loop detected even when the interconnection was well-posed and strictly free of algebraic loops.
This PR updates the iteration bound:
cycle_count = max(len(self.syslist), ninputs) + 1
where ninputs is the total number of internal subsystem inputs across self.syslist.
Testing
- Added
test_interconnect_mimo_feedthrough_no_algebraic_loop: verifies the 2x2 MIMO plant with decentralized PI control interconnects without error and matches the analytical closed-loop poles from ct.feedback.
- Added
test_interconnect_algebraic_loop_detection: verifies that true algebraic loops (such as static positive feedback around feedthrough blocks) continue to be correctly detected and raise RuntimeError("algebraic loop detected").
- All tests in
control/tests/interconnect_test.py, control/tests/iosys_test.py, control/tests/statesp_test.py, and control/tests/nlsys_test.py pass cleanly (1045 passed).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
python-control#1257)
In InterconnectedSystem._compute_static_io, the iteration bound
cycle_count was previously capped at len(self.syslist) + 1. For
MIMO systems with direct feedthrough, an acyclic feedthrough path can
traverse multiple channels of the same subsystem block more than once,
requiring more propagation passes than the number of subsystems.
Update cycle_count bound to max(len(self.syslist), ninputs) + 1,
where ninputs is the total number of internal subsystem inputs.
Add unit regression tests covering MIMO feedthrough without algebraic loops
and true algebraic loop detection.
Fixes python-control#1257.
Signed-off-by: paneendrakumar0 <[email protected]>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hi @slivingston,
Thanks for pointing me to the policy! Yes, I used an AI assistant (Google Antigravity / Gemini) during the development of this PR to assist with searching the repository, analyzing the iteration loop bound in InterconnectedSystem._compute_static_io, and formatting the regression test case.
In accordance with the NumPy AI Policy:
Understanding and verification: I have fully read, reviewed, and verified the mathematical logic and implementation myself. The root cause is that for MIMO interconnected systems with direct feedthrough (such as decentralized control of multi-channel plants), acyclic signal propagation paths can visit multiple distinct input/output channels of the same block sequentially, requiring up to ninputs + 1 iterations (or topological signal ordering) rather than len(self.syslist) + 1 (which assumed SISO blocks).
Correctness & testing: I verified the fix locally against the full test suite (pytest control/tests/, 1,045/1,045 tests passing), including the newly added regression test in interconnect_test.py that confirms closed-loop poles match standard feedback connections while true algebraic loops continue to be correctly detected.
Ownership & responsibility: I take full responsibility for the code and will address any feedback or follow-up changes requested during review.
Please let me know if you would like any adjustments to the approach or additional test coverage!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@paneendrakumar0 Are you using an AI agent that automatically opened this PR and produced the above comment?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hi @slivingston,
No, it was not automatically opened by any bot. I(Paneendra) is doing all the tests and posting here manually.
Since you asked me for disclosure about NumPy policy, I have used some AI to help me draft the disclosure statement in such a way that it adheres to the policy checklist, hence sounding like a template. But, Iam the who is investigating the problem, writing and testing the code, and handling this PR.
Just so you know, I use the AI only for checking and doing changes in the code after me. And I am not even at the stage where I can use Agentic AI or something like AGent or Bot that auto repiles or comments in a PR:).
I am here just to handle this PR discussion, so please let me know your thoughts on this!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
slivingston
commented
Oct 18, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

coverage: 94.747% (-0.01%) from 94.757% — paneendrakumar0:fix-interconnect-mimo-algebraic-loop-1257 into python-control:main
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|