|
8 | 8 | import numpy as np |
9 | 9 | import pytest |
10 | 10 |
|
11 | | -from control import pole, rss, ss, tf |
| 11 | +from control import lqe, pole, rss, ss, tf |
12 | 12 | from control.exception import ControlDimension |
13 | 13 | from control.mateqn import care, dare |
14 | 14 | from control.statefbk import ctrb, obsv, place, place_varga, lqr, gram, acker |
@@ -324,6 +324,20 @@ def test_LQR_3args(self): |
324 | 324 | K, S, poles = lqr(sys, Q, R) |
325 | 325 | self.check_LQR(K, S, poles, Q, R) |
326 | 326 |
|
| 327 | + def check_LQE(self, L, P, poles, G, QN, RN): |
| 328 | + P_expected = np.array(np.sqrt(G*QN*G * RN)) |
| 329 | + L_expected = P_expected / RN |
| 330 | + poles_expected = np.array([-L_expected], ndmin=2) |
| 331 | + np.testing.assert_array_almost_equal(P, P_expected) |
| 332 | + np.testing.assert_array_almost_equal(L, L_expected) |
| 333 | + np.testing.assert_array_almost_equal(poles, poles_expected) |
| 334 | + |
| 335 | + @slycotonly |
| 336 | + def test_LQE(self): |
| 337 | + A, G, C, QN, RN = 0., .1, 1., 10., 2. |
| 338 | + L, P, poles = lqe(A, G, C, QN, RN) |
| 339 | + self.check_LQE(L, P, poles, G, QN, RN) |
| 340 | + |
327 | 341 | @slycotonly |
328 | 342 | def test_care(self): |
329 | 343 | #unit test for stabilizing and anti-stabilizing feedbacks |
|
0 commit comments