@@ -90,8 +90,10 @@ def test_named_ss():
90
90
(lambda t ,x ,u ,params :- x ,None ),
91
91
{'inputs' :2 ,'outputs' :2 ,'states' :2 }],
92
92
[ct .ss , ([[1 ,2 ], [3 ,4 ]], [[0 ], [1 ]], [[1 ,0 ]],0 ), {}],
93
+ [ct .ss , ([], [], [],3 ), {}],# static system
93
94
[ct .StateSpace , ([[1 ,2 ], [3 ,4 ]], [[0 ], [1 ]], [[1 ,0 ]],0 ), {}],
94
95
[ct .tf , ([1 ,2 ], [3 ,4 ,5 ]), {}],
96
+ [ct .tf , (2 ,3 ), {}],# static system
95
97
[ct .TransferFunction , ([1 ,2 ], [3 ,4 ,5 ]), {}],
96
98
])
97
99
def test_io_naming (fun ,args ,kwargs ):
@@ -112,7 +114,7 @@ def test_io_naming(fun, args, kwargs):
112
114
assert sys_g .name == 'sys[0]'
113
115
assert sys_g .input_labels == [f'u[{ i } ]' for i in range (sys_g .ninputs )]
114
116
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 :
116
118
assert sys_g .state_labels == [f'x[{ i } ]' for i in range (sys_g .nstates )]
117
119
118
120
#
@@ -128,7 +130,7 @@ def test_io_naming(fun, args, kwargs):
128
130
sys_r .set_outputs (output_labels )
129
131
assert sys_r .output_labels == output_labels
130
132
131
- if sys_g .nstates :
133
+ if sys_g .nstates is not None :
132
134
state_labels = [f'x{ i } ' for i in range (sys_g .nstates )]
133
135
sys_r .set_states (state_labels )
134
136
assert sys_r .state_labels == state_labels
@@ -143,7 +145,7 @@ def test_io_naming(fun, args, kwargs):
143
145
sys_k = fun (state_labels ,output_labels ,input_labels ,name = 'mysys' )
144
146
145
147
elif sys_g .nstates is None :
146
- # Don't pass state labels
148
+ # Don't pass state labels if TransferFunction
147
149
sys_k = fun (
148
150
* args ,inputs = input_labels ,outputs = output_labels ,name = 'mysys' )
149
151
@@ -155,7 +157,7 @@ def test_io_naming(fun, args, kwargs):
155
157
assert sys_k .name == 'mysys'
156
158
assert sys_k .input_labels == input_labels
157
159
assert sys_k .output_labels == output_labels
158
- if sys_g .nstates :
160
+ if sys_g .nstates is not None :
159
161
assert sys_k .state_labels == state_labels
160
162
161
163
#
@@ -193,6 +195,24 @@ def test_io_naming(fun, args, kwargs):
193
195
assert sys_tf .input_labels == input_labels
194
196
assert sys_tf .output_labels == output_labels
195
197
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
+
196
216
197
217
# Internal testing of StateSpace initialization
198
218
def test_init_namedif ():