示例#1
0
 def test_LQR_3args(self, matarrayin, matarrayout, method):
     if method == 'slycot' and not slycot_check():
         return
     sys = ss(0., 1., 1., 0.)
     Q, R = (matarrayin([[X]]) for X in [10., 2.])
     K, S, poles = lqr(sys, Q, R, method=method)
     self.check_LQR(K, S, poles, Q, R)
示例#2
0
    def testLQR_warning(self):
        """Test lqr()

        Make sure we get a warning if [Q N;N' R] is not positive semi-definite
        """
        # from matlab_test siso.ss2 (testLQR); probably not referenced before
        # not yet implemented check
        A = np.array([[-2, 3, 1], [-1, 0, 0], [0, 1, 0]])
        B = np.array([[-1, 0, 0]]).T
        Q = np.eye(3)
        R = np.eye(1)
        N = np.array([[1, 1, 2]]).T
        # assert any(np.linalg.eigvals(np.block([[Q, N], [N.T, R]])) < 0)
        with pytest.warns(UserWarning):
            (K, S, E) = lqr(A, B, Q, R, N)
示例#3
0
 def test_LQR_integrator(self, matarrayin, matarrayout, method):
     if method == 'slycot' and not slycot_check():
         return
     A, B, Q, R = (matarrayin([[X]]) for X in [0., 1., 10., 2.])
     K, S, poles = lqr(A, B, Q, R, method=method)
     self.check_LQR(K, S, poles, Q, R)
 def test_LQR_integrator(self):
     A, B, Q, R = 0., 1., 10., 2.
     K, S, poles = lqr(A, B, Q, R)
     self.check_LQR(K, S, poles, Q, R)
 def test_LQR_3args(self):
     sys = ss(0., 1., 1., 0.)
     Q, R = 10., 2.
     K, S, poles = lqr(sys, Q, R)
     self.check_LQR(K, S, poles, Q, R)
示例#6
0
 def test_LQR_3args(self):
     sys = ss(0., 1., 1., 0.)
     Q, R = 10., 2.
     K, S, poles = lqr(sys, Q, R)
     self.check_LQR(K, S, poles, Q, R)
示例#7
0
 def test_LQR_integrator(self):
     A, B, Q, R = 0., 1., 10., 2.
     K, S, poles = lqr(A, B, Q, R)
     self.check_LQR(K, S, poles, Q, R)
示例#8
0
 def test_LQR_3args(self, matarrayin, matarrayout):
     sys = ss(0., 1., 1., 0.)
     Q, R = (matarrayin([[X]]) for X in [10., 2.])
     K, S, poles = lqr(sys, Q, R)
     self.check_LQR(K, S, poles, Q, R)
示例#9
0
 def test_LQR_integrator(self, matarrayin, matarrayout):
     A, B, Q, R = (matarrayin([[X]]) for X in [0., 1., 10., 2.])
     K, S, poles = lqr(A, B, Q, R)
     self.check_LQR(K, S, poles, Q, R)
示例#10
0
 def test_LQR_3args(self):
     sys = ss(0.0, 1.0, 1.0, 0.0)
     Q, R = 10.0, 2.0
     K, S, poles = lqr(sys, Q, R)
     self.check_LQR(K, S, poles, Q, R)