Clear Filters
Clear Filters

Find a controller for a feedback-loop

5 views (last 30 days)
We are working on an automation project to stabilize the altitude of an airplane. However, we've encountered an issue that seems unsolvable for us, at least for the moment, in the final phase of this project. After identifying the transfer function G shown below,
G(s) =
1.5284e-05 (s+4.288) (s-4.286)
--------------------------------
s (s+4.142) (s-4.14) (s+0.00053)
%% Plant, G
s = tf('s');
G = zpk((1.5284e-05*(s + 4.288)*(s - 4.286))/(s*(s + 4.142)*(s - 4.14)*(s + 0.00053)))
G = 1.5284e-05 (s+4.288) (s-4.286) -------------------------------- s (s+4.142) (s-4.14) (s+0.00053) Continuous-time zero/pole/gain model.
which has a positive pole, we attempted to create a feedback loop to achieve stability. We used the Sisotool's auto-tuning method LGQ and obtained a controller C_i to multiply with G, resulting in the function G_i.
C_i =
-9.4134e08 (s+4.142) (s+0.02969) (s^2 - 0.02844s + 0.001059)
------------------------------------------------------------
s (s+28.99) (s+4.288) (s^2 - 14.21s + 513.2)
%% LQG controller
Ci = zpk((-9.4134e08*(s + 4.142)*(s + 0.02969)*(s^2 - 0.02844*s + 0.001059))/(s*(s + 28.99)*(s + 4.288)*(s^2 - 14.21*s + 513.2)))
Ci = -9.4134e08 (s+4.142) (s+0.02969) (s^2 - 0.02844s + 0.001059) ------------------------------------------------------------ s (s+28.99) (s+4.288) (s^2 - 14.21s + 513.2) Continuous-time zero/pole/gain model.
Gc =
-14387 (s-4.286) (s+4.288) (s+4.142) (s+0.02969) (s^2 - 0.02844s + 0.001059)
-------------------------------------------------------------------------------------------
(s+0.7861) (s+4.088) (s+4.193) (s^2 + 8.283s + 17.15) (s^2 + 0.5465s + 0.1494) (s^2 + 1.171s + 0.9972)
%% Closed-loop system
Gcl = feedback(Ci*G, 1)
Gcl = -14387 (s-4.286) (s+4.288) (s+4.142) (s+0.02969) (s^2 - 0.02844s + 0.001059) ------------------------------------------------------------------------------------------------------ (s+4.142) (s+4.288) (s+5.152) (s^2 + 0.4575s + 0.09035) (s^2 + 0.4008s + 0.5998) (s^2 + 4.63s + 6.944) Continuous-time zero/pole/gain model.
step(Gcl, 60), grid on
Now, our current challenge is to find a controller C to apply within our closed-loop system, ensuring that we meet the project's requirements without compromising the stability achieved in the previous steps. Below are the requirements.
Requirements: Perfect tracking of constant references for output variation, with a response time not exceeding 15 seconds and any oscillations within 10% of the steady-state value.
After several attempts, it seems that there isn't any value capable of keeping the system stable while having a pole at zero. Is there any suggestion to overcome this problem? We can send the MATLAB code or the PDF with all the steps taken until the derivation of the G(s) function.

Accepted Answer

Sam Chak
Sam Chak on 5 Mar 2024
Edited: Sam Chak on 5 Mar 2024
Sometimes, it can be time-consuming to find a suitable controller that stabilizes unstable non-minimum phase systems while also meeting the performance requirements. In the case of a 4th-order plant, using a compensator of the same order is often the first line of defense against instability, as a higher-order controller can sometimes overkill. With that in mind, could you please evaluate whether the following step response performance is satisfactory?
s = tf('s');
%% Plant, Gp
Gp = zpk((1.5284e-05*(s + 4.288)*(s - 4.286))/(s*(s + 4.142)*(s - 4.14)*(s + 0.00053)))
Gp = 1.5284e-05 (s+4.288) (s-4.286) -------------------------------- s (s+4.142) (s-4.14) (s+0.00053) Continuous-time zero/pole/gain model.
%% Compensator, Gc
cz = [-4.30348002560136;
-0.000283361299755098 + 0.00216280953262624i;
-0.000283361299755098 - 0.00216280953262624i];
cp = [ 5.56024649650068 + 12.7047387632996i;
5.56024649650068 - 12.7047387632996i;
-14.6428725917671;
-4.51120949748476];
ck = -180243364.417473;
Gc = zpk(cz, cp, ck)
Gc = -1.8024e08 (s+4.303) (s^2 + 0.0005667s + 4.758e-06) --------------------------------------------------- (s+14.64) (s+4.511) (s^2 - 11.12s + 192.3) Continuous-time zero/pole/gain model.
%% Closed-loop system, Gcl
Gcl = feedback(Gc*Gp, 1);
%% Pre-filter, Gf
fz = [];
fp = [-0.000283361299755046 + 0.00216280953262625i;
-0.000283361299755046 - 0.00216280953262625i;
-4.30348002560136;
-4.28800000000001];
fk = 8.78016218952211e-05;
Gf = zpk(fz, fp, fk)
Gf = 8.7802e-05 -------------------------------------------------- (s+4.288) (s+4.303) (s^2 + 0.0005667s + 4.758e-06) Continuous-time zero/pole/gain model.
%% Filtered Closed-loop system
Gfc = tf(minreal(series(Gf, Gcl)))
Gfc = -0.2419 s + 1.037 --------------------------------------------------------------------------------------------- s^8 + 8.036 s^7 + 28.25 s^6 + 56.76 s^5 + 71.27 s^4 + 57.28 s^3 + 28.77 s^2 + 8.256 s + 1.037 Continuous-time transfer function.
S = stepinfo(Gfc);
step(Gfc, 60), grid on
xline(S.SettlingTime, '--', sprintf('Settling Time: %.3f sec', S.SettlingTime), 'color', '#7F7F7F', 'LabelVerticalAlignment', 'bottom')
  2 Comments
Davide
Davide on 6 Mar 2024
Thanks a lot for this answer, at the end we have benn able to found a controller but the one showed by you is way better, thanks again for the help.
Davide
Davide on 6 Mar 2024
Especially for the tip to use a compensator of the same order.

Sign in to comment.

More Answers (1)

Mathieu NOE
Mathieu NOE on 5 Mar 2024
hello
engineering is a mix of knowledge and art. The art of the engineer is to split a complex problem into smaller , simpler tasks. Or check if the complex model can be simplified before we jump into controller design tasks...
here you see that some zeroes and poles are numerically very close (we say "zero poles cancellation - or almost")
If you make the Bode plot you would immediately see that what seemed a complex TF can be viewed as a simple integrator + first order low pass filter. I have no doubt that you can easily design a PID (even just a P) controller in that case
here the two Bode plots overlay perfectly
%% Plant, G
s = tf('s');
G = zpk((1.5284e-05*(s + 4.288)*(s - 4.286))/(s*(s + 4.142)*(s - 4.14)*(s + 0.00053)));
% Bode plot
freq = logspace(-9,3,100);
[g,p] = bode(G,2*pi*freq);
g = squeeze(g);
p = squeeze(p);
% Simplifed TF = 1.5284e-05/(s*(s + 2*pi*fc))
fc = interp1(p,freq,-135); % second pole of simplified TF
G1 = zpk(1.5284e-05/(s*(s + 2*pi*fc)));
[g1,p1] = bode(G1,2*pi*freq);
g1 = squeeze(g1);
p1 = squeeze(p1);
figure(1)
subplot(2,1,1),semilogx(freq,20*log10(g),'b',freq,20*log10(g1),'*r');
subplot(2,1,2),semilogx(freq,p,'b',freq,p1,'*r');
  1 Comment
Davide
Davide on 6 Mar 2024
Thanks a lot, for both, fixed my message and the answer. We easily found a stable controller on the first try as you expected.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!