@@ -68,8 +68,13 @@ def test_interconnect_implicit():
6868 ki = ct .tf (random .uniform (1 , 10 ), [1 , 0 ])
6969 C = ct .tf2io (kp + ki , inputs = 'e' , outputs = 'u' , name = 'C' )
7070
71+ # same but static C2
72+ C2 = ct .tf (random .uniform (1 , 10 ), 1 ,
73+ inputs = 'e' , outputs = 'u' , name = 'C2' )
74+
7175 # Block diagram computation
7276 Tss = ct .feedback (P * C , 1 )
77+ Tss2 = ct .feedback (P * C2 , 1 )
7378
7479 # Construct the interconnection explicitly
7580 Tio_exp = ct .interconnect (
@@ -93,6 +98,15 @@ def test_interconnect_implicit():
9398 np .testing .assert_almost_equal (Tio_sum .C , Tss .C )
9499 np .testing .assert_almost_equal (Tio_sum .D , Tss .D )
95100
101+ # test whether signal names work for static system C2
102+ Tio_sum2 = ct .interconnect (
103+ [C2 , P , sumblk ], inputs = 'r' , outputs = 'y' )
104+
105+ np .testing .assert_almost_equal (Tio_sum2 .A , Tss2 .A )
106+ np .testing .assert_almost_equal (Tio_sum2 .B , Tss2 .B )
107+ np .testing .assert_almost_equal (Tio_sum2 .C , Tss2 .C )
108+ np .testing .assert_almost_equal (Tio_sum2 .D , Tss2 .D )
109+
96110 # Setting connections to False should lead to an empty connection map
97111 empty = ct .interconnect (
98112 (C , P , sumblk ), connections = False , inplist = ['r' ], outlist = ['y' ])
@@ -237,17 +251,17 @@ def test_linear_interconnect():
237251 ss_ctrl = ct .ss (1 , 2 , 1 , 2 , inputs = 'e' , outputs = 'u' )
238252 ss_plant = ct .ss (1 , 2 , 1 , 2 , inputs = 'u' , outputs = 'y' )
239253 nl_ctrl = ct .NonlinearIOSystem (
240- lambda t , x , u , params : x * x ,
254+ lambda t , x , u , params : x * x ,
241255 lambda t , x , u , params : u * x , states = 1 , inputs = 'e' , outputs = 'u' )
242256 nl_plant = ct .NonlinearIOSystem (
243- lambda t , x , u , params : x * x ,
257+ lambda t , x , u , params : x * x ,
244258 lambda t , x , u , params : u * x , states = 1 , inputs = 'u' , outputs = 'y' )
245259
246260 assert isinstance (ct .interconnect ((tf_ctrl , tf_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
247261 assert isinstance (ct .interconnect ((ss_ctrl , ss_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
248262 assert isinstance (ct .interconnect ((tf_ctrl , ss_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
249263 assert isinstance (ct .interconnect ((ss_ctrl , tf_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
250-
264+
251265 assert ~ isinstance (ct .interconnect ((nl_ctrl , ss_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
252266 assert ~ isinstance (ct .interconnect ((nl_ctrl , tf_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
253267 assert ~ isinstance (ct .interconnect ((ss_ctrl , nl_plant ), inputs = 'e' , outputs = 'y' ), ct .LinearIOSystem )
0 commit comments