@@ -142,8 +142,7 @@ def __init__(self, params=None, **kwargs):
142
142
143
143
"""
144
144
# Store the system name, inputs, outputs, and states
145
- name , inputs , outputs , states , dt = _process_namedio_keywords (
146
- kwargs )
145
+ name , inputs , outputs , states , dt = _process_namedio_keywords (kwargs )
147
146
148
147
# Initialize the data structure
149
148
# Note: don't use super() to override LinearIOSystem/StateSpace MRO
@@ -910,8 +909,7 @@ def __init__(self, syslist, connections=None, inplist=None, outlist=None,
910
909
dt = kwargs .pop ('dt' , None )
911
910
912
911
# Process keyword arguments (except dt)
913
- name , inputs , outputs , states , _ = _process_namedio_keywords (
914
- kwargs , end = True )
912
+ name , inputs , outputs , states , _ = _process_namedio_keywords (kwargs )
915
913
916
914
# Initialize the system list and index
917
915
self .syslist = list (syslist ) # insure modifications can be made
@@ -1012,7 +1010,7 @@ def __init__(self, syslist, connections=None, inplist=None, outlist=None,
1012
1010
# Note: don't use super() to override LinearICSystem/StateSpace MRO
1013
1011
InputOutputSystem .__init__ (
1014
1012
self , inputs = inputs , outputs = outputs ,
1015
- states = states , params = params , dt = dt , name = name )
1013
+ states = states , params = params , dt = dt , name = name , ** kwargs )
1016
1014
1017
1015
# Convert the list of interconnections to a connection map (matrix)
1018
1016
self .connect_map = np .zeros ((ninputs , noutputs ))
@@ -1241,7 +1239,9 @@ def set_output_map(self, output_map):
1241
1239
----------
1242
1240
output_map : 2D array
1243
1241
Specify the matrix that will be used to multiply the vector of
1244
- subsystem outputs to obtain the vector of system outputs.
1242
+ subsystem outputs concatenated with subsystem inputs to obtain
1243
+ the vector of system outputs.
1244
+
1245
1245
"""
1246
1246
# Figure out the number of internal inputs and outputs
1247
1247
ninputs = sum (sys .ninputs for sys in self .syslist )
@@ -2552,7 +2552,7 @@ def interconnect(
2552
2552
signals are given names, then the forms 'sys.sig' or ('sys', 'sig')
2553
2553
are also recognized. Finally, for multivariable systems the signal
2554
2554
index can be given as a list, for example '(subsys_i, [inp_j1, ...,
2555
- inp_jn])', as as a slice, for example, 'sys.sig[i:j]', or as a base
2555
+ inp_jn])'; as a slice, for example, 'sys.sig[i:j]'; or as a base
2556
2556
name `sys.sig` (which matches `sys.sig[i]`).
2557
2557
2558
2558
Similarly, each output-spec should describe an output signal from
@@ -2715,7 +2715,7 @@ def interconnect(
2715
2715
... [P, C], connections=[['P', 'C'], ['C', '-P']],
2716
2716
... inplist=['C'], outlist=['P'])
2717
2717
2718
- This feedback system can also be constructed using the
2718
+ A feedback system can also be constructed using the
2719
2719
:func:`~control.summing_block` function and the ability to
2720
2720
automatically interconnect signals with the same names:
2721
2721
@@ -2734,7 +2734,7 @@ def interconnect(
2734
2734
default being to add the suffix '$copy' to the system name.
2735
2735
2736
2736
In addition to explicit lists of system signals, it is possible to
2737
- lists vectors of signals, using one of the following forms:
2737
+ lists vectors of signals, using one of the following forms::
2738
2738
2739
2739
(subsys, [i1, ..., iN], gain) signals with indices i1, ..., in
2740
2740
'sysname.signal[i:j]' range of signal names, i through j-1
@@ -2760,8 +2760,7 @@ def interconnect(
2760
2760
2761
2761
"""
2762
2762
dt = kwargs .pop ('dt' , None ) # by pass normal 'dt' processing
2763
- name , inputs , outputs , states , _ = _process_namedio_keywords (
2764
- kwargs , end = True )
2763
+ name , inputs , outputs , states , _ = _process_namedio_keywords (kwargs )
2765
2764
2766
2765
if not check_unused and (ignore_inputs or ignore_outputs ):
2767
2766
raise ValueError ('check_unused is False, but either '
@@ -3017,10 +3016,21 @@ def interconnect(
3017
3016
outlist , outputs = new_outlist , new_outputs
3018
3017
dprint (f" { outlist = } \n { outputs = } " )
3019
3018
3019
+ # Make sure inputs and outputs match inplist outlist, if specified
3020
+ if inputs and (
3021
+ isinstance (inputs , (list , tuple )) and len (inputs ) != len (inplist )
3022
+ or isinstance (inputs , int ) and inputs != len (inplist )):
3023
+ raise ValueError ("`inputs` incompatible with `inplist`" )
3024
+ if outputs and (
3025
+ isinstance (outputs , (list , tuple )) and len (outputs ) != len (outlist )
3026
+ or isinstance (outputs , int ) and outputs != len (outlist )):
3027
+ raise ValueError ("`outputs` incompatible with `outlist`" )
3028
+
3020
3029
newsys = InterconnectedSystem (
3021
3030
syslist , connections = connections , inplist = inplist ,
3022
3031
outlist = outlist , inputs = inputs , outputs = outputs , states = states ,
3023
- params = params , dt = dt , name = name , warn_duplicate = warn_duplicate )
3032
+ params = params , dt = dt , name = name , warn_duplicate = warn_duplicate ,
3033
+ ** kwargs )
3024
3034
3025
3035
# See if we should add any signals
3026
3036
if add_unused :
@@ -3040,7 +3050,8 @@ def interconnect(
3040
3050
newsys = InterconnectedSystem (
3041
3051
syslist , connections = connections , inplist = inplist ,
3042
3052
outlist = outlist , inputs = inputs , outputs = outputs , states = states ,
3043
- params = params , dt = dt , name = name , warn_duplicate = warn_duplicate )
3053
+ params = params , dt = dt , name = name , warn_duplicate = warn_duplicate ,
3054
+ ** kwargs )
3044
3055
3045
3056
# check for implicitly dropped signals
3046
3057
if check_unused :
0 commit comments