10000 commiting missing unit test with fix for ordering differences · MaxGaukler/python-control@62cc545 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62cc545

Browse files
committed
commiting missing unit test with fix for ordering differences
1 parent 28adf70 commit 62cc545

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2012-08-25 Richard Murray <murray@altura.local>
2+
3+
* tests/rlocus_test.py (TestRootLocus.testRootLocus): added sort()
4+
to test to get rid of problems in which ordering was generating an
5+
error.
6+
7+
* src/freqplot.py (nyquist_plot): added code from Kevin Davies to
8+
label frequency points in Nyquist plot
9+
10+
* src/__init__.py: import non-conflicting MATLAB functions by default
11+
12+
* src/freqplot.py (bode_plot, nyquist_plot): simplified code and
13+
removed unneeded options. To set color, linestyle, etc use keywords
14+
and pass to matplotlib.
15+
16+
2012-08-24 Richard Murray <murray@altura.local>
17+
18+
* src/freqplot.py: added in plot enhancements from Kevin Davies
19+
(bode_plot): pass optional arguments and keywords to matplotlib
20+
(get_pow1000): new function for determinine engineering exponent
21+
(gen_prefix): new function to get SI prefix for power of 1000
22+
23+
* src/freqplot.py (bode_plot): removed extraneous phase_deg calculation
24+
125
2012-01-07 Richard Murray <murray@malabar.local>
226

327
* doc/modules.rst: added new sections for analysis, synthesis,

tests/rlocus_test.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python
2+
#
3+
# rlocus_test.py - unit test for root locus diagrams
4+
# RMM, 1 Jul 2011
5+
6+
import unittest
7+
import numpy as np
8+
from control.rlocus import root_locus
9+
from control.xferfcn import TransferFunction
10+
from control.statesp import StateSpace
11+
from control.bdalg import feedback
12+
13+
class TestRootLocus(unittest.TestCase):
14+
"""These are tests for the feedback function in rlocus.py."""
15+
16+
def setUp(self):
17+
"""This contains some random LTI systems and scalars for testing."""
18+
19+
# Two random SISO systems.
20+
self.sys1 = TransferFunction([1, 2], [1, 2, 3])
21+
self.sys2 = StateSpace([[1., 4.], [3., 2.]], [[1.], [-4.]],
22+
[[1., 0.]], [[0.]])
23+
24+
def testRootLocus(self):
25+
"""Basic root locus plot"""
26+
klist = [-1, 0, 1];
27+
rlist = root_locus(self.sys1, [-1, 0, 1], Plot=False)
28+
29+
for k in klist:
30+
np.testing.assert_array_almost_equal(
31+
np.sort(rlist[k]),
32+
np.sort(feedback(self.sys1, klist[k]).pole()))
33+
34+
def suite():
35+
return unittest.TestLoader().loadTestsFromTestCase(TestRootLocus)
36+
37+
if __name__ == "__main__":
38+
unittest.main()

0 commit comments

Comments
 (0)
0