How to apply the reference target for LQR or LQG controller

43 views (last 30 days)
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);

Accepted Answer

Paul
Paul on 31 Oct 2022
Edited: Paul on 31 Oct 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 Comments
GUS
GUS on 20 Nov 2022
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.
Paul
Paul on 20 Nov 2022
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!