You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/TestSlycot.py
+48-35Lines changed: 48 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -8,19 +8,30 @@
8
8
9
9
10
10
classTestSlycot(unittest.TestCase):
11
+
"""TestSlycot compares transfer function and state space conversions for
12
+
various numbers of inputs,outputs and states.
13
+
1. Usually passes for SISO systems of any state dim, occasonally, there will be a dimension mismatch if the original randomly generated ss system is not minimal because td04ad returns a minimal system.
14
+
15
+
2. For small systems with many inputs, n<<m, the tests fail because td04ad returns a minimal ss system which has fewer states than the original system. It is typical for systems with many more inputs than states to have extraneous states.
16
+
17
+
3. For systems with larger dimensions, n~>5 and with 2 or more outputs the conversion to statespace (td04ad) intermittently results in an equivalent realization of higher order than the original tf order. We think this has to do with minimum realization tolerances in the Fortran. The algorithm doesn't recognize that two denominators are identical and so it creates a system with nearly duplicate eigenvalues and double the state dimension. This should not be a problem in the python-control usage because the common_den() method finds repeated roots within a tolerance that we specify.
18
+
19
+
Matlab: Matlab seems to force its statespace system output to have order less than or equal to the order of denominators provided, avoiding the problem of very large state dimension we describe in 3. It does however, still have similar problems with pole/zero cancellation such as we encounter in 2, where a statespace system may have fewer states than the original order of transfer function.
20
+
"""
11
21
defsetUp(self):
12
22
"""Define some test parameters."""
13
-
self.numTests=1
14
-
self.maxStates=10#seems to fail rarely with 4, sometimes with 5, frequently with 6. Could it be a problem with the subsystems?
15
-
self.maxIO=10
16
-
23
+
self.numTests=5
24
+
self.maxStates=10
25
+
self.maxI=1
26
+
self.maxO=1
27
+
17
28
deftestTF(self):
18
29
""" Directly tests the functions tb04ad and td04ad through direct comparison of transfer function coefficients.
19
30
Similar to TestConvert, but tests at a lower level.
0 commit comments