9
9
import control as ctrl
10
10
from control .xferfcn import TransferFunction
11
11
from control .statesp import StateSpace
12
- from control .bdalg import feedback
12
+ from control .bdalg import feedback , append , connect
13
13
from control .lti import zero , pole
14
14
15
15
class TestFeedback (unittest .TestCase ):
@@ -23,7 +23,9 @@ def setUp(self):
23
23
# Two random SISO systems.
24
24
self .sys1 = TransferFunction ([1 , 2 ], [1 , 2 , 3 ])
25
25
self .sys2 = StateSpace ([[1. , 4. ], [3. , 2. ]], [[1. ], [- 4. ]],
26
- [[1. , 0. ]], [[0. ]])
26
+ [[1. , 0. ]], [[0. ]]) # 2 states, SISO
27
+ self .sys3 = StateSpace ([[- 1. ]], [[1. ]], [[1. ]], [[0. ]]) # 1 state, SISO
28
+
27
29
# Two random scalars.
28
30
self .x1 = 2.5
29
31
self .x2 = - 3.
@@ -270,6 +272,13 @@ def test_feedback_args(self):
270
272
sys = ctrl .feedback (1 , frd )
271
273
self .assertTrue (isinstance (sys , ctrl .FRD ))
272
274
275
+ def testConnect (self ):
276
+ sys = append (self .sys2 , self .sys3 ) # two siso systems
277
+
278
+ # feedback interconnection -3 is out of bounds
279
+ Q1 = [[1 , 2 ], [2 , - 3 ]]
280
+ self .assertRaises (IndexError , connect (sys , Q1 , [2 ], [1 , 2 ]))
281
+
273
282
274
283
if __name__ == "__main__" :
275
284
unittest .main ()
0 commit comments