@@ -90,8 +90,10 @@ def test_named_ss():
9090 (lambda t , x , u , params : - x , None ),
9191 {'inputs' : 2 , 'outputs' :2 , 'states' :2 }],
9292 [ct .ss , ([[1 , 2 ], [3 , 4 ]], [[0 ], [1 ]], [[1 , 0 ]], 0 ), {}],
93+ [ct .ss , ([], [], [], 3 ), {}], # static system
9394 [ct .StateSpace , ([[1 , 2 ], [3 , 4 ]], [[0 ], [1 ]], [[1 , 0 ]], 0 ), {}],
9495 [ct .tf , ([1 , 2 ], [3 , 4 , 5 ]), {}],
96+ [ct .tf , (2 , 3 ), {}], # static system
9597 [ct .TransferFunction , ([1 , 2 ], [3 , 4 , 5 ]), {}],
9698])
9799def test_io_naming (fun , args , kwargs ):
@@ -112,7 +114,7 @@ def test_io_naming(fun, args, kwargs):
112114 assert sys_g .name == 'sys[0]'
113115 assert sys_g .input_labels == [f'u[{ i } ]' for i in range (sys_g .ninputs )]
114116 assert sys_g .output_labels == [f'y[{ i } ]' for i in range (sys_g .noutputs )]
115- if sys_g .nstates :
117+ if sys_g .nstates is not None :
116118 assert sys_g .state_labels == [f'x[{ i } ]' for i in range (sys_g .nstates )]
117119
118120 #
@@ -128,7 +130,7 @@ def test_io_naming(fun, args, kwargs):
128130 sys_r .set_outputs (output_labels )
129131 assert sys_r .output_labels == output_labels
130132
131- if sys_g .nstates :
133+ if sys_g .nstates is not None :
132134 state_labels = [f'x{ i } ' for i in range (sys_g .nstates )]
133135 sys_r .set_states (state_labels )
134136 assert sys_r .state_labels == state_labels
@@ -143,7 +145,7 @@ def test_io_naming(fun, args, kwargs):
143145 sys_k = fun (state_labels , output_labels , input_labels , name = 'mysys' )
144146
145147 elif sys_g .nstates is None :
146- # Don't pass state labels
148+ # Don't pass state labels if TransferFunction
147149 sys_k = fun (
148150 * args , inputs = input_labels , outputs = output_labels , name = 'mysys' )
149151
@@ -155,7 +157,7 @@ def test_io_naming(fun, args, kwargs):
155157 assert sys_k .name == 'mysys'
156158 assert sys_k .input_labels == input_labels
157159 assert sys_k .output_labels == output_labels
158- if sys_g .nstates :
160+ if sys_g .nstates is not None :
159161 assert sys_k .state_labels == state_labels
160162
161163 #
@@ -193,6 +195,24 @@ def test_io_naming(fun, args, kwargs):
193195 assert sys_tf .input_labels == input_labels
194196 assert sys_tf .output_labels == output_labels
195197
198+ #
199+ # Convert the system to a LinearIOSystem and make sure labels transfer
200+ #
201+ if not isinstance (
202+ sys_r , (ct .FrequencyResponseData , ct .NonlinearIOSystem )) and \
203+ ct .slycot_check ():
204+ sys_lio = ct .LinearIOSystem (sys_r )
205+ assert sys_lio != sys_r
206+ assert sys_lio .input_labels == input_labels
207+ assert sys_lio .output_labels == output_labels
208+
209+ # Reassign system and signal names
210+ sys_lio = ct .LinearIOSystem (
211+ sys_g , inputs = input_labels , outputs = output_labels , name = 'new' )
212+ assert sys_lio .name == 'new'
213+ assert sys_lio .input_labels == input_labels
214+ assert sys_lio .output_labels == output_labels
215+
196216
197217# Internal testing of StateSpace initialization
198218def test_init_namedif ():
0 commit comments