How to apply the reference target for LQR or LQG controller

Hello,
I designed the LQG regulator for the system I want.
The LQG I designed leads to a state that converges to 0.
I would like to change the result so that the controller converges to a separate reference target, but this is where the problem arises.
It is very complicated to explain my system, so in the question I would like to learn how to do it through a simple example.
I wonder how to reflect the reference target through the example provided by the MATLAB site.
The code below is the initialization & setting code of the above UFO controller example.
The system is designed to converge the states with radian and rad/s information to 0, respectively.
I want to change this system so that it finally converges to a non-zero reference state.
How can I design the controller with reference state in this example?
close all
% Initial Conditions
x0 = [3; % 3 radians
0]; % 0 rad/s
% System Dynamics
A = [0 1;
0.01 0];
B = [0;
1];
C = [1 0];
D = 0;
% Control Law
Q = [1 0; % Penalize angular error
0 1]; % Penalize angular rate
R = 1; % Penalize thruster effort
K = lqr(A,B,Q,R);
% Closed loop system
sys = ss((A - B*K), B, C, D);
% Run response to initial condition
t = 0:0.005:30;
[y,t,x] = initial(sys, x0, t);

 Respuesta aceptada

Paul
Paul el 31 de Oct. de 2022
Editada: Paul el 31 de Oct. de 2022
Hi JS,
One common way to track a reference input with a Type 1 system is to use integral control by augmenting the plant with an integrator and applying LQR to the augmented plant.
This function lqi may be of interest, as might this example

4 comentarios

Thanks for the reply. I have two additional questions.
First, in the case of reference tracking that does not change with time, I wonder if it is possible to convert x of LQR into an error term and use it.
Second, I want to make that input u is always positive signed. In this case, I want to know whether it is enough to simply change the cost function J=xQx+uRu to u=(u'-u_offset) by applying an offset to the u term.
For the first question, is x the full 2 x 1 state vector? And you'd like to have a 2 x 1 reference signal and form a 2 x 1 error signal e = r - x, and use the error signal e as the input to the feedback gain K?
I'm not sure I understand the second question. The input will be whatever it needs to be to drive the state from its initial condition to whatever the final value needs to be, whether that is 0 for regulation or some non-zero reference. I don't see how the design could guarantee the control input is always positive for all possible initial states and references. Perhaps I need further clarification?
An additional answer to the first question is:
Currently I am using an N x 1 state vector (not upper case, that is just easy example) and I am accessing the state vector with a kalman filter. That is, since the main purpose is to control y by measuring y, we want to set e = r - y instead of e = r - x.
Additional answers to the second question are:
I admit that the case I'm trying to apply is a very unique situation. My goal is to keep y at a certain level (positive value).
However, in my system, there is a u value necessary to maintain the minimum y level.
In addition, although it cannot be explained in depth, it is a very unique situation and cannot accept a negative value for input u.
If u comes out with a negative value, it has no choice but to process off through clip. The ideal situation is to add an offset term to u so that a negative value does not appear.
So, if I compare and summarize the existing control situation and my situation, it is as follows.
Existing case) When a specific y value is maintained, input u adjusts input u to maintain the value while going back and forth between +/- signs.
My expected case) When a specific y value is maintained, the input u adjusts the input by sending the input u in the range around that value while maintaining the offset u.
As to the first part, it sounds like you're trying to do something like this:
% Initial Conditions
x0 = [3; % 3 radians
0]; % 0 rad/s
% System Dynamics
A = [0 1;
0.01 0];
B = [0;
1];
% C = [1 0];
C = eye(2); % output both states, the first state is the output to control
D = 0;
sysp = ss(A,B,C,D,'InputName','u','OutputName',{'y' 'x2'});
% Control Law
Q = [1 0; % Penalize angular error
0 1]; % Penalize angular rate
R = 1; % Penalize thruster effort
K = lqr(A,B,Q,R);
% negate the second element of K for negative feedback of x2
% negative feedback on the first state will be achieved via the error signal
K(2) = -K(2);
sysc = ss(K,'OutputName','u','InputName',{'e' 'x2'});
% error signal
s = sumblk('e = r - y');
syscl = connect(sysp,sysc,s,'r','y');
step(syscl)
As to the second part, I'm afraid I can't offer any inputs.

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

GUS
el 31 de Oct. de 2022

Comentada:

el 20 de Nov. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by