コード例 #1
0
 def test_DLQR_3args(self, matarrayin, matarrayout, method):
     if method == 'slycot' and not slycot_check():
         return
     dsys = ss(0., 1., 1., 0., .1)
     Q, R = (matarrayin([[X]]) for X in [10., 2.])
     K, S, poles = dlqr(dsys, Q, R, method=method)
     self.check_DLQR(K, S, poles, Q, R)
コード例 #2
0
    def testDLQR_warning(self):
        """Test dlqr()

        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) = dlqr(A, B, Q, R, N)
コード例 #3
0
 def test_DLQR_4args(self, matarrayin, matarrayout):
     A, B, Q, R = (matarrayin([[X]]) for X in [0., 1., 10., 2.])
     K, S, poles = dlqr(A, B, Q, R)
     self.check_DLQR(K, S, poles, Q, R)