Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc90a399

Browse files
committed
added code to check for MIMO in statesp._convertToStateSpace + unit test; address issue#120
1 parentcab850a commitc90a399

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

‎control/statesp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,10 @@ def _convertToStateSpace(sys, **kw):
667667
ssout[3][:sys.outputs, :states],
668668
ssout[4],sys.dt)
669669
exceptImportError:
670+
# If slycot is not available, use signal.lti (SISO only)
671+
if (sys.inputs!=1orsys.outputs!=1):
672+
raiseTypeError("No support for MIMO without slycot")
673+
670674
# TODO: do we want to squeeze first and check dimenations?
671675
# I think this will fail if num and den aren't 1-D after
672676
# the squeeze

‎control/tests/convert_test.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,29 @@ def testConvert(self):
162162
np.testing.assert_array_almost_equal( \
163163
ssorig_imag,tfxfrm_imag)
164164

165+
deftestConvertMIMO(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+
importcontrol
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 (notslycot_check()):
185+
self.assertRaises(TypeError,control.tf2ss,tfcn)
186+
187+
165188
defsuite():
166189
returnunittest.TestLoader().loadTestsFromTestCase(TestConvert)
167190

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp