How can i solve Algebraic Ricatti Equation for SDRE controller?

조회 수: 7 (최근 30일)
burak ergocmen
burak ergocmen 2017년 9월 3일
댓글: Victory Friday 2022년 1월 31일
I have a model in simulink. I use SDRE controller for that model . I can obtain SDC matrices(A(x) and B(x)) by matlab function in simulink . One of the example in simulink matlab function is :
function P = fcn(u,w)
%#codegen
B = [ 0 2 2 0 ;
1 0 0 3 ;
0 4 5 0 ;
0 0 3 0 ;
0 4 0 0 ] ;
A = [2 0 4 u 0 ;
0 5 0 0 0 ;
6 0 7 w 0 ; 1 0 0 0 0 ; 0 1 0 0 0 ] ;
Q= diag([0.6 0.6 0.6 2.6 0.5]);
R= diag([0.00001 1000 1000 1000]);
n = size(A,1);
P = zeros(n,n);
H = [A -(B/R)*B'; -Q -A'];
[T,L] = eig(H);
lambda = diag(L);
ord_lambda = zeros(1,2*n);
for k = 1 : 2*n;
if real(lambda(k)) < 0
ord_lambda(k) = -1;
elseif real(lambda(k)) > 0
ord_lambda(k) = 1;
else
%disp('!!!');
end
end
[~, ord_index] = sort(ord_lambda, 'descend');
T_ord = T(:,ord_index);
T22 = T_ord(n+1:2*n,n+1:2*n);
T12 = T_ord(1:n,n+1:2*n);
P = real(T22/T12);
  댓글 수: 2
burak ergocmen
burak ergocmen 2017년 11월 26일
편집: burak ergocmen 2017년 12월 8일
1. The ARE can be solved by some methods .These are iterative and numerical ways. Iterative is the best but numerical is also work well. Some numerical example : Schur decomposition of Hamiltonian matrix , Spectral Factorization Some Iterative example : Matrix sign function 2. For real time application of solving algebraic ricatti equation for SDRE controller there are some ways one of that is using S-function (write codes in C programming and use it in the simulink block). There is a really good thesis about that, also there is C codes in thesis : "ANALYSIS AND REAL-TIME IMPLEMENTATION OF STATE-DEPENDENT RICCATI EQUATION CONTROLLED SYSTEMS-EVRIN BILGE ERDEM " another way is using matlab function in Simulink environment . Some functions does not work but i found one of that which is working but some calculation problems which about re ordering schur decomposition (all eigenvalues have to be in the upper triangle of the schur matrix). I post it in here because "[U_ordered,S_ordered] = ordschur(U,S,'lhp')" code does not work in script.So if anybody have an idea pls post it in here These matlab codes are about schur decomposition of hamiltonian matrix . A and B can easily convertible to SDC matrices which shows the system dynamics
function y = fcn(x1,x2)
A = [x1 x2; x1 x2];
B = [2; 1];
C = eye(2);
D = [0; 0];
Q = [1 1; 3 0];
R = [3];
H = [A -(B*inv(R)*B'); -Q -A'];
[U, S] = schur(H);
[m,n] = size(U);
U11 = U(1:(m/2), 1:(n/2));
U21 = U((m/2+1):m, 1:(n/2));
P = U21*inv(U11) ;
y = P;
Victory Friday
Victory Friday 2022년 1월 31일

Please sir, is there a way out in ordering the eigenvalues for script?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Computations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by