|
From: <mur...@us...> - 2012-08-25 17:46:02
|
Revision: 184
http://python-control.svn.sourceforge.net/python-control/?rev=184&view=rev
Author: murrayrm
Date: 2012-08-25 17:45:56 +0000 (Sat, 25 Aug 2012)
Log Message:
-----------
commiting missing unit test with fix for ordering differences
Modified Paths:
--------------
trunk/ChangeLog
Added Paths:
-----------
trunk/tests/rlocus_test.py
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2012-08-25 16:11:20 UTC (rev 183)
+++ trunk/ChangeLog 2012-08-25 17:45:56 UTC (rev 184)
@@ -1,3 +1,27 @@
+2012-08-25 Richard Murray <mu...@al...>
+
+ * tests/rlocus_test.py (TestRootLocus.testRootLocus): added sort()
+ to test to get rid of problems in which ordering was generating an
+ error.
+
+ * src/freqplot.py (nyquist_plot): added code from Kevin Davies to
+ label frequency points in Nyquist plot
+
+ * src/__init__.py: import non-conflicting MATLAB functions by default
+
+ * src/freqplot.py (bode_plot, nyquist_plot): simplified code and
+ removed unneeded options. To set color, linestyle, etc use keywords
+ and pass to matplotlib.
+
+2012-08-24 Richard Murray <mu...@al...>
+
+ * src/freqplot.py: added in plot enhancements from Kevin Davies
+ (bode_plot): pass optional arguments and keywords to matplotlib
+ (get_pow1000): new function for determinine engineering exponent
+ (gen_prefix): new function to get SI prefix for power of 1000
+
+ * src/freqplot.py (bode_plot): removed extraneous phase_deg calculation
+
2012-01-07 Richard Murray <mu...@ma...>
* doc/modules.rst: added new sections for analysis, synthesis,
Added: trunk/tests/rlocus_test.py
===================================================================
--- trunk/tests/rlocus_test.py (rev 0)
+++ trunk/tests/rlocus_test.py 2012-08-25 17:45:56 UTC (rev 184)
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+#
+# rlocus_test.py - unit test for root locus diagrams
+# RMM, 1 Jul 2011
+
+import unittest
+import numpy as np
+from control.rlocus import root_locus
+from control.xferfcn import TransferFunction
+from control.statesp import StateSpace
+from control.bdalg import feedback
+
+class TestRootLocus(unittest.TestCase):
+ """These are tests for the feedback function in rlocus.py."""
+
+ def setUp(self):
+ """This contains some random LTI systems and scalars for testing."""
+
+ # Two random SISO systems.
+ self.sys1 = TransferFunction([1, 2], [1, 2, 3])
+ self.sys2 = StateSpace([[1., 4.], [3., 2.]], [[1.], [-4.]],
+ [[1., 0.]], [[0.]])
+
+ def testRootLocus(self):
+ """Basic root locus plot"""
+ klist = [-1, 0, 1];
+ rlist = root_locus(self.sys1, [-1, 0, 1], Plot=False)
+
+ for k in klist:
+ np.testing.assert_array_almost_equal(
+ np.sort(rlist[k]),
+ np.sort(feedback(self.sys1, klist[k]).pole()))
+
+def suite():
+ return unittest.TestLoader().loadTestsFromTestCase(TestRootLocus)
+
+if __name__ == "__main__":
+ unittest.main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|