Skip to content

new iosys.interconnect is great, but... #530

@sawyerbfuller

Description

@sawyerbfuller

The new naming functionality in iosys.interconnect function [1] has allowed me to create some very sophisticated systems much more easily than with append and connect. So far, no bugs that I have found. Very nice!

a few remarks on usage:

  • the inplist and outlist arguments are confusing and tricky. When you are writing code, its easy to forget shortened argument names like this: was it outplist or outlist? Also, they seem to exist to serve as a means to provide new names to the overall inputs and outputs. Is that a necessary feature? (might have to do with how system was set up for explicit interconnection) Possible to remove them and force the overall system to have the same input names and output names as constituent systems, and instead just provide inputs and outputs kwargs for interconnect? (edit: this is what matlab seems to do: https://www.mathworks.com/help/control/ref/connect.html)
  • auto-summing and auto-splitting, as suggested here: https://github.com/python-control/python-control/blob/master/doc/iosys.rst#automatic-connections-using-signal-names doesn't seem to work. For example, when I try to send the same signal u to both sys1 and sys2 in the following code a ValueError: signal u is not unique is raised:
sys1 = ct.tf(1, [10, 1])
sys2 = ct.tf(1, [2, 1])
summer = ct.iosys.summing_junction(['y1', 'y2'], 'y')
sys1 = ct.iosys.tf2io(sys1, inputs='u', outputs='y1')
sys2 = ct.iosys.tf2io(sys2, inputs='u', outputs='y2')
parallel = ct.interconnect((summer, sys1, sys2), inplist='u', outlist='y')
  • similarly for auto-summing. the following raises ValueError: signal y is not unique:
splitter = ct.ss2io(ct.ss([], [], [], [[1],[1]]), inputs='u', outputs=('u1', 'u2'))
sys1 = ct.iosys.tf2io(sys1, inputs='u1', outputs='y')
sys2 = ct.iosys.tf2io(sys2, inputs='u2', outputs='y')
parallel = ct.interconnect((splitter, sys1, sys2), inplist='u', outlist='y')

I don't know how hard these are to fix, it depends on how the underlying interconnection code works. One option would be to just modify the docs to remove mention of auto splitting and summing and add a helper splitter functoin:

def splitter(inputs, outputs):
    D = np.ones((len(outputs),1))
    C = np.zeros_like(D)
    return io.ss2io(ct.ss(0, 0, C, D), inputs=inputs, outputs=outputs)

[1]

def interconnect(syslist, connections=None, inplist=[], outlist=[],

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy