Offset free tracking for a nonlinear model predictive system.

I'm trying to write a matlab script for an offset free tracking problem for a nonlinear model predictive control. The system I have chosen for the task is the three tank system. My observer design is as follows:
A =[-0.01562 -0.01562 0; -0.01562 -0.01562 -0.01562;0 -0.01562 -0.01562];
B = [704.9; 0;0];
C =[0 0 1];
D = 0;
L=place(A',C',[-10 -15 -20])';
eig(A-L*C)
eig(A)
x=[0.01;0.01;0.01]; % initial state
xhat=[0.002;0.002;0.002]; % initial estimate
XX=x;
XXhat=xhat;
T=15;
UU=3e-5*ones(1,T); % input signal
for k=1:T,
u=UU(k);
y(k)=C*x+D*u;
yhat(k)=C*xhat+D*u;
x=A*x+B*u;
error(k+1)=(y(k)-yhat(k));
XX=[XX,x];
XXhat=[XXhat,xhat];
end
The objective function that I want to minimise is as follows:
[Q,R,P]=getQR();
J = 0;
xk=x;
for ct=1:N-1
uk = u(ct);
ex_dot=obs();
J = J + uk'*R*uk + (xk(1)-h1(ct))'*Q*(xk(1)-h1(ct))+(xk(2)-h2(ct))'*Q*(xk(2)-h2(ct))+(xk(3)-h3(ct))'*Q*(xk(3)-h3(ct))+(h1(N)-ex_dot(1))'*Q*(h1(N)-ex_dot(1))+(h2(N)-ex_dot(5))'*Q*(h2(N)-ex_dot(5))+(h3(N)-ex_dot(9))'*Q*h3(N)-(ex_dot(9));
xk1=rungeKutta(0,xk,uk,Ts);
xk=xk1;
There is steady state error when I compile my entire script. I mainly need help with figuring out what is wrong with the observer design and if there is any example that I can go through to get a better idea. As matlab doesn't provide any exaple for any disturbance observer or such for nonlinear model predictive control.
I would really appreciate you help with the code that I have posted or if you could point me towards some resources.

类别

帮助中心File Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by