lqr controller with saturation for closed loop system

조회 수: 7 (최근 30일)
Junhwi
Junhwi 2023년 12월 6일
댓글: Sam Chak 2024년 1월 9일
Hi, I want to add saturation to regulate the output of the lqr controller. I wonder how to add saturation and wanna check if the input to the plant is really regulated in between +-1. I also tried simulink but it shows not desired results.
I'll really appreciate if you can help. thanks!
the code for lqr is below:
% LQR
%%%%%%%%%%
s = tf('s');
Gs = 4000/(s*(s+10)*(s+20));
[A,B,C,D]=tf2ss(Gs.Numerator{1}, Gs.Denominator{1});
st = 0.06;
Gd=c2d(Gs,st);
[Ad,Bd,Cdl,Ddl]=tf2ss(Gd.Numerator{1}, Gd.Denominator{1});
Q = blkdiag(0.1,0.1,100);
R =0.001;
[K,P]=dlqr(Ad,Bd,Q*st,R/st);
sys12 = ss(Ad-Bd*K,Bd,Cdl,Ddl,st);
N12=1/dcgain(sys12);
sysfin = ss(Ad-Bd*K,Bd*N12,Cdl,Ddl,st);
figure;
step(sysfin)
  댓글 수: 3
Junhwi
Junhwi 2023년 12월 12일
I think I plotted the output :)
Paul
Paul 2023년 12월 13일
Hi Junhwi,
Can this statement be clarified: "I wonder how to add saturation and wanna check if the input to the plant is really regulated in between +-1."
I think I understand the second part, which is that for your code above you want to check if the input the plant is between -1 and +1 for a unit step input. Is that correct? And if the plant input is not between those bounds, you want to add a saturation function on the output of the controller to ensure the input to the plant stays within those bounds?

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

채택된 답변

Ayush Modi
Ayush Modi 2024년 1월 9일
Hi,
As per my understanding, you are trying to saturate the output of "lqr controller" and ensure that the input to the "plant" is regulated between -1 and +1. You can manually implement saturation in your code.
Here is an example to demonstrate how you can accomplish this:
u = max(min(u, 1), -1);
Alternatively, you can achieve this by using "Saturation" block in simulink.
Please refer to the following MathWorks documentation for more information:
  • "Saturation" - https://www.mathworks.com/help/simulink/slref/saturation.html
I hope this resolves the issue you were facing.
  댓글 수: 1
Sam Chak
Sam Chak 2024년 1월 9일
To enhance the value of your response, could you illustrate how to apply the saturation function to the 3rd-order system mentioned by the OP?
s = tf('s');
Gp = 4000/(s*(s + 10)*(s + 20))
Gp = 4000 -------------------- s^3 + 30 s^2 + 200 s Continuous-time transfer function.
[num, den] = tfdata(Gp, 'v');
A = [zeros(2, 1), eye(2); 0 -den(3) -den(2)];
B = [zeros(2, 1); num(4)];
C = [1 0 0];
D = 0;
K = lqr(A, B, eye(size(A)), 1) % LQR control gains
K = 1×3
1.0000 1.6830 0.9929

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

추가 답변 (0개)

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by