File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -667,6 +667,10 @@ def _convertToStateSpace(sys, **kw):
667
667
ssout [3 ][:sys .outputs , :states ],
668
668
ssout [4 ], sys .dt )
669
669
except ImportError :
670
+ # If slycot is not available, use signal.lti (SISO only)
671
+ if (sys .inputs != 1 or sys .outputs != 1 ):
672
+ raise TypeError ("No support for MIMO without slycot" )
673
+
670
674
# TODO: do we want to squeeze first and check dimenations?
671
675
# I think this will fail if num and den aren't 1-D after
672
676
# the squeeze
Original file line number Diff line number Diff line change @@ -162,6 +162,29 @@ def testConvert(self):
162
162
np .testing .assert_array_almost_equal ( \
163
163
ssorig_imag , tfxfrm_imag )
164
164
165
+ def testConvertMIMO (self ):
166
+ """Test state space to transfer function conversion."""
167
+ verbose = self .debug
168
+
169
+ # Do a MIMO conversation and make sure that it is processed
170
+ # correctly both with and without slycot
171
+ #
172
+ # Example from issue #120, jgoppert
173
+ import control
174
+
175
+ # Set up a transfer function (should always work)
176
+ tfcn = control .tf ([[[- 235 , 1.146e4 ],
177
+ [- 235 , 1.146E4 ],
178
+ [- 235 , 1.146E4 , 0 ]]],
179
+ [[[1 , 48.78 , 0 ],
180
+ [1 , 48.78 , 0 , 0 ],
181
+ [0.008 , 1.39 , 48.78 ]]])
182
+
183
+ # Convert to state space and look for an error
184
+ if (not slycot_check ()):
185
+ self .assertRaises (TypeError , control .tf2ss , tfcn )
186
+
187
+
165
188
def suite ():
166
189
return unittest .TestLoader ().loadTestsFromTestCase (TestConvert )
167
190
You can’t perform that action at this time.
0 commit comments