Skip to content

Commit df60d2a

Browse files
committed
Adding sensitivity circle tests
1 parent ba9dbf0 commit df60d2a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

control/tests/nyquist_test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,22 @@ def test_nyquist_arrows(arrows):
214214
assert _Z(sys) == response.count + _P(sys)
215215

216216

217+
def test_sensitivity_circles():
218+
A = np.array([
219+
[-3.56355873, -1.22980795, -1.5626527 , -0.4626829],
220+
[-8.52361371, -3.60331459, -3.71574266, -0.43839201],
221+
[-2.50458726, -0.72361335, -1.77795489, -0.4038419],
222+
[-0.281183 , 0.23391825, 0.19096003, -0.9771515]])
223+
B = np.array([[-0.], [-1.42827213], [ 0.76806551], [-1.07987454]])
224+
C = np.array([[-0., 0.35557249, 0.35941791, -0.]])
225+
D = np.array([[0]])
226+
sys1 = ct.ss(A, B, C, D)
227+
sys2 = ct.ss(A, B, C, D, dt=0.1)
228+
plt.figure()
229+
ct.nyquist_plot(sys1, unit_circle=True, mt_circles=[0.9,1,1.1,1.2], ms_circles=[0.9,1,1.1,1.2])
230+
ct.nyquist_plot(sys2, unit_circle=True, mt_circles=[0.9,1,1.1,1.2], ms_circles=[0.9,1,1.1,1.2])
231+
232+
217233
def test_nyquist_encirclements():
218234
# Example 14.14: effect of friction in a cart-pendulum system
219235
s = ct.tf('s')
@@ -452,6 +468,9 @@ def test_discrete_nyquist():
452468
test_nyquist_arrows(3)
453469
test_nyquist_arrows([0.1, 0.5, 0.9])
454470

471+
print("Test sensitivity circles")
472+
test_sensitivity_circles()
473+
455474
print("Stability checks")
456475
test_nyquist_encirclements()
457476

0 commit comments

Comments
 (0)