You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sumblk doesnt exists for connection in matlab compatibility module #493
A less "stateful" version of @sawyerbfuller's subblk function would be sumblk = control.ss([], [], [], [[1, 0], [1, 1]]) which avoids the creation of any additional states. Note that this creates an "unnamed" system, since StateSpace systems do not have signal names associated with that.
For systems with named signals (InputOutputSystem's), this functionality is also available in the interconnect function "for free" by simply interconnecting multiple signals to the input of another block (they are automatically summed together and can also have optional gains assigned to them). For example, the following code will create a feedback loop (without creating an explicit summing block for creating of the error term):
P = ct.LinearIOSystem(ct.tf2ss(ct.tf([1], [1, 1])), name='P')
C = ct.LinearIOSystem(ct.tf2ss(ct.tf([2], [1, 0])), name='C')
S = ct.interconnect([P, C],
connections = [ ['P.u[0]', 'C.y[0]'], ['C.u[0]', '-P.y[0]'] ],
inplist=['C.u[0]'], outlist=['P.y[0]'])
It would be possible to create a function that looks more like the MATLAB sumblk function, but if the only usage is for InputOutputSystem's, then I am not sure whether it is needed (?).
It clarifies which systems shares input and which systems outputs is summed with what.
If it is possible to create a look alike sumblk with InputOutputSystems internal, that would work on provided named input formula then it would ease up the code a lot(?).
Or if there is some other alternative where a formula can be used to depict system IO would be great to know as well.
It's definitely possible to create a lookalike function for sumblk and would probably only take a few lines of code. If you'd like to take a crack at it and submit a PR, I would encourage you to do so. Rather than naming the function sumblk, we should probably call summing_junction to be more Pythonic about naming. Then in the matlab module, we could set up an alias for sumblk.
An additional requirement (and interesting idea) would be to add an option in interconnect that automatically connects all signals that have the same name. Combined with summing junction it could accomplish what you are describing.
Activity
sawyerbfuller commentedon Dec 31, 2020
Hi siddarth, that feature did not have an asterisk (*) next to it, indicating that it wasn’t yet implemented.
I agree it would be a very nice feature to have and have I have used it myself, created as follows:
sumblk = control.ss([[0,0.],[0,0]], [[0,0.],[0,0]], [[0,0.],[0,0]], [[1, 0],[1, 1]])
murrayrm commentedon Jan 9, 2021
A few comments on this:
A less "stateful" version of @sawyerbfuller's subblk function would be
sumblk = control.ss([], [], [], [[1, 0], [1, 1]])which avoids the creation of any additional states. Note that this creates an "unnamed" system, sinceStateSpacesystems do not have signal names associated with that.For systems with named signals (
InputOutputSystem's), this functionality is also available in theinterconnectfunction "for free" by simply interconnecting multiple signals to the input of another block (they are automatically summed together and can also have optional gains assigned to them). For example, the following code will create a feedback loop (without creating an explicit summing block for creating of the error term):It would be possible to create a function that looks more like the MATLAB
sumblkfunction, but if the only usage is forInputOutputSystem's, then I am not sure whether it is needed (?).k10blogger commentedon Jan 10, 2021
For named system, usage of sumblk as below is something that i feel is better readable:
It clarifies which systems shares input and which systems outputs is summed with what.
If it is possible to create a look alike
sumblkwith InputOutputSystems internal, that would work on provided named input formula then it would ease up the code a lot(?).Or if there is some other alternative where a formula can be used to depict system IO would be great to know as well.
murrayrm commentedon Jan 10, 2021
It's definitely possible to create a lookalike function for
sumblkand would probably only take a few lines of code. If you'd like to take a crack at it and submit a PR, I would encourage you to do so. Rather than naming the functionsumblk, we should probably callsumming_junctionto be more Pythonic about naming. Then in thematlabmodule, we could set up an alias forsumblk.An additional requirement (and interesting idea) would be to add an option in
interconnectthat automatically connects all signals that have the same name. Combined withsumming junctionit could accomplish what you are describing.