@@ -43,6 +43,48 @@ def setUp(self):
43
43
self .stability_margins4 = \
44
44
[2.2716 , 97.5941 , 0.5591 , 10.0053 , 0.0850 , 9.9918 ]
45
45
46
+ # from "A note on the Gain and Phase Margin Concepts
47
+ # Journal of Control and Systems Engineering, Yazdan Bavafi-Toosi,
48
+ # Dec 205, vol 3 iss 1, pp 51-59
49
+ #
50
+ # A cornucopia of tricky systems for phase / gain margin
51
+ # Still have to convert this to tests + fix margin to handle
52
+ # also these torture cases
53
+ self .yazdan = {
54
+ 'example21' :
55
+ 0.002 * (s + 0.02 )* (s + 0.05 )* (s + 5 )* (s + 10 )/ (
56
+ (s - 0.0005 )* (s + 0.0001 )* (s + 0.01 )* (s + 0.2 )* (s + 1 )* (s + 100 )** 2 ),
57
+
58
+ 'example23' :
59
+ ((s + 0.1 )** 2 + 1 )* (s - 0.1 )/ (
60
+ ((s + 0.1 )** 2 + 4 )* (s + 1 ) ),
61
+
62
+ 'example25a' :
63
+ s / (s ** 2 + 2 * s + 2 )** 4 ,
64
+
65
+ 'example26a' :
66
+ ((s - 0.1 )** 2 + 1 )/ (
67
+ (s + 0.1 )* ((s - 0.2 )** 2 + 4 ) ),
68
+
69
+ 'example26b' : ((s - 0.1 )** 2 + 1 )/ (
70
+ (s - 0.3 )* ((s - 0.2 )** 2 + 4 ) )
71
+ }
72
+ self .yazdan ['example24' ] = self .yazdan ['example21' ]* 20000
73
+ self .yazdan ['example25b' ] = self .yazdan ['example25a' ]* 100
74
+ self .yazdan ['example22' ] = self .yazdan ['example21' ]* (s ** 2 - 2 * s + 401 )
75
+ self .ymargin = (
76
+ dict (sys = 'example21' , K = 1.0 , result = (
77
+ 0.01 , 345.43 , 0. , 0 , 0 , 0.01 )))
78
+
7
7948
9
+ self .yallmargin = (
80
+ dict (sys = 'example21' , K = 1.0 , result = (
81
+ [0.01 , 179.2931 , 2.2798e+4 , 1.5946e+07 , 7.2477e+08 ],
82
+ [0 , 0.0243 , 0.4385 , 6.8640 , 84.9323 ],
83
+ [- 14.5640 ],
84
+ [0.0022 ]))
85
+ )
86
+
87
+
46
88
def test_stability_margins (self ):
47
89
omega = np .logspace (- 2 , 2 , 2000 )
48
90
for sys ,rgm ,rwgm ,rpm ,rwpm in self .tsys :
0 commit comments