Repository navigation
new iosys.interconnect is great, but... #530
Description
Activity
The lack of autosumming is a bug and I can fix that one pretty quickly. Adding a splitter function might also be useful, so I'll probably do that at the same time.
For
inplist/inputsandoutlist/outputs: as @sawyerbfuller points out, there are two things that a user might want to do:- Choose which signals are inputs and outputs (from the set of signals inside the system, including possible sums of those signals)
- Name the signals
The idea is that
inplist/outlistspecifies the signals (including allowing summation and splitting) andinputs/outputsnames them. Note that if you aren't using the autoconnect functionality then signal names are not unique without the system name prepended (so there might be multiple 'u[0]' signals, but only one 'sys[0].u[0]' signal) => not sure we want to just use the underlying signal name (it could get ugly if you have a couple of levels of nesting, so that your overall system output becomes 'sys[0].sys[1].y[0]' for example). It could also get ugly with implicit summing (an output could become 'sys[0].y[0]+sys[1].y[1]' for example).The lack of autosumming is a bug and I can fix that one pretty quickly. Adding a splitter function might also be useful, so I'll probably do that at the same time.
🤙
For
inplist/inputsandoutlist/outputs: as @sawyerbfuller points out, there are two things that a user might want to do:* Choose which signals are inputs and outputs (from the set of signals inside the system, including possible sums of those signals) * Name the signalsMakes sense.
The idea is that
inplist/outlistspecifies the signals (including allowing summation and splitting) andinputs/outputsnames them. Note that if you aren't using the autoconnect functionality then signal names are not unique without the system name prepended (so there might be multiple 'u[0]' signals, but only one 'sys[0].u[0]' signal) => not sure we want to just use the underlying signal name (it could get ugly if you have a couple of levels of nesting, so that your overall system output becomes 'sys[0].sys[1].y[0]' for example). It could also get ugly with implicit summing (an output could become 'sys[0].y[0]+sys[1].y[1]' for example).For the output of an autosumming version of the summing-parallel-systems example above, it makes sense that you would not want the output name be
'y'if it is actuallysys1.y + sys2.y(looks like in that case Matlab forces you to create a summing block with a new name).I think I understand now. I am curious to see how it will work in practice with autosumming.
- changed the title
[-]new iosys.interconnect is great[/-][+]new iosys.interconnect is great, but...[/+]on Feb 6, 2021 I’ve reread the text of this issue, and I think the name change is fair enough : )
The new naming functionality in
iosys.interconnectfunction [1] has allowed me to create some very sophisticated systems much more easily than withappendandconnect. So far, no bugs that I have found. Very nice!a few remarks on usage:
inplistandoutlistarguments are confusing and tricky. When you are writing code, its easy to forget shortened argument names like this: was itoutplistoroutlist? 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 provideinputsandoutputskwargs forinterconnect? (edit: this is what matlab seems to do: https://www.mathworks.com/help/control/ref/connect.html)uto bothsys1andsys2in the following code aValueError: signal u is not uniqueis raised:ValueError: signal y is not unique: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:
[1]
python-control/control/iosys.py
Line 1850 in 73f65df