CS Cep Masood082 Faizan086 Alishba 027
CS Cep Masood082 Faizan086 Alishba 027
Question Statement
Aircraft Model for Pitch Control: For the aircraft model diagram, design a feedback controller that
will achieve the desired objectives.
Submitted By:
Masood Jalal FA21-BEE-082
M Faizan Irfan FA21-BEE-086
ALISHBA AMIR FA21-BEE-027
Section:
BEE-5B
Submitted To:
Omer Azam
Date: 20/12/2023
2
Question:
Aircraft Model for Pitch Control: Figure 1 shows an aircraft model diagram. Your
aim is to design a feedback controller that will achieve the desired objectives given
below.
The open loop transfer function for this aircraft model, from the input δ (deflection
at the elevators) to the output θ (pitch angle of the aircraft) is given by:
3
System analysis: Considering the open loop system 𝐺𝐺(𝑠𝑠) given above:
a. Determine poles and zeros of the open loop transfer function. By looking at the poles and
zeros, what can you say about stability of the system?
Now Consider the system connected in a unity feedback configuration as shown in Figure 2:
b. Plot the root locus for L(s) by hand and by using MATLAB.
c. Find range of K for the stability. Also mention value of 𝐾0 where system becomes
marginally stable. Verify your results using MATLAB results.
A: By inspection we can determine the roots of the open loop transfer function
(𝒔 + 𝟑)
𝑳(𝒔) = 𝑮(𝒔) =
𝒔(𝒔 + 𝟏)(𝒔 + 𝟐)(𝒔 + 𝟒)
which are located on the left half of the plane. The poles are located at 0, -1, -2 and -3.
By looking at the system we can determine the system to be stable as all the roots, especially the
poles of the system lie on the left side of the imaginary axis. This indicates that all the transients
of the system will eventually die out and the system response will settle about a particular value.
Since the equation is of type 1, for step response the system will perfectly follow it with zero errors
(after the transients die down, it will settle at 1), but for ramp response, the system will track it
with some constant error.
4
figure(1);
rlocus(sys_ol);
title('Open Loop Root Locus');
axis([-4.5 1 -3 3])
set(findall(gca,'type','line'), 'markersize', 15, 'linewidth', 4);
grid on;
MATLAB Plot
Note: The Hand Drawn Root Locus of the system is attached at the end of the report.
C: The range for K where the system is stable can be found using Routh Hurwitz criterion,
which is used for finding the range.
For this we start by finding the characteristic equation of the closed loop transfer function for unity
feedback system.
∆(𝑠) = 1 + 𝐾(𝑠)𝐺(𝑠)
𝐾(𝑠 + 3)
∆(𝑠) = 1 +
𝑠(𝑠 + 1)(𝑠 + 2)(𝑠 + 4)
5
S4 1 14 3K
3
S 7 8+K 0
1 1 14 −𝐾 + 90 1 1 3𝐾
S2 𝛼= − | |= 𝛽= | | = 3𝐾 0
7 7 8+𝐾 7 7 7 0
1 7 8+𝐾 −𝐾 2 − 65𝐾 + 720
S1 𝛾= | |= 0 0
7 𝛼 𝛽 −𝐾 + 90
S0 K 0 0
The sign of inequality changes when divided by a negative number on both sides, in our case we
are dividing both sides by -1.
𝐾 < 90
Equating β > 0 we get
MATLAB Code
6
s = tf('s');
sys_ol = (s+3)/(s*(s+1)*(s+2)*(s+4));
figure(1);
rlocus(sys_ol);
% sgrid(0.6901067305, 0.6665635614);
title('Open Loop Root Locus');
axis([-4.5 1 -3 3])
set(findall(gca,'type','line'), 'markersize', 15, 'linewidth', 4);
grid on;
% K = 9.6455815
gain = 9.6455815;
lead = 1;
HS = gain * lead * sys_ol;
figure(2)
sys_cl = feedback(HS, 1);
rlocus(sys_cl)
set(findall(gca,'type','line'), 'markersize', 15, 'linewidth', 3);
grid on;
title('Root Locus of the Closed Loop Transfer Function');
axis([-4.5 1 -3 3]);
% K = 0.001
gain = 0.01;
HS = gain * lead * sys_ol;
figure(6)
sys_cl = feedback(HS, 1);
[step_val, t] = step(sys_cl);
plot(t, step_val, 'linewidth', 3);
label('Time (s)', 'Amplitude (v)', 'Step Response of the Closed Loop Transfer
Function at K = 1');
% axis([0 40 0 2]);
stepinfo(sys_cl)
MATLAB Plot
From the root locus of closed loop transfer function for the controller gain value of K = 9.6455815,
we can see observe that the poles have moved to the imaginary axis. At that point, the system
becomes marginally stable. The step response of the closed loop system shows a never-ending
oscillation which never settles down; however, the system oscillates around our desired value of
1 (for step response). The oscillation of the system is bounded around our required value, that is
why it is considered marginally stable, since it is stable around the value, but the oscillation does
not die out.
8
Figure 3: Step Response of the Transfer Function for K = 9.6455815 (img: q1_part_c_step_jw_axis)
Since the range is bounded by 0 at the lower end, we can verify this by plotting the root locus of
the closed loop system, which shows that the pole moves towards the Origin on the real axis. As
the gain value becomes negative, the pole crosses into the Right Half Plane, which makes the
system unstable. As can be observed in the plot below.
The step response of the system tracks the step, but it is overdamped and has a large settling
time.
9
Figure 5: Step Response of the Transfer Function for K = 9.6455815 (img: q1_part_c_step_jw_axis_2)
To visualize the behavior of the system within the stability range for K, we simulated the system
for K = 1
Using stepinfo() function we found the overshoot and settling values of the closed loop system
10
Which shows
Settling Time: Ts = 10.68s
Percentage Overshoot: PO = 5.6854
Which is the best value we obtained using a simple proportional controller. Increasing the value
of K causes the overshoot of the system to increase, while using K value in range 0 < K < 1, controls
the overshoot, but the settling time increases for the system.
Closed loop system: Consider the closed loop system shown in Figure 3. If the controller
gain is taken unity, then:
a. Determine the %𝑂, 𝑇𝑝 and 𝑇𝑠 of the closed loop response for 𝑅(𝑠) = 1/𝑠 and 𝐷(𝑠) = 0.
b. Compute the following closed loop transfer functions.
i. U(S)/R(S), where U(𝑠) is the output of the controller.
ii. E(S)/D(S), where D(s) is the input disturbance.
c. Compute the steady state error value for a step, ramp, and parabola reference inputs,
consider D(s) = 0.
d. Compute the steady state error for a step disturbance input when R(s) = 0.
𝐸(𝑠) = −𝐶(𝑠)
C: For the closed loop transfer function, we first need to find the steady state error.
From inspection we can immediately tell that the system will track step response perfectly
since the system is type I system, it will also follow ramp input, but it will track it with
some error, and it will not track parabola.
MATLAB Code
t = 0:0.01:30;
s = tf('s');
Gs = (s+3)/(s*(s+1)*(s+2)*(s+4));
Esst = 1/(1 + Gs);
% Step Response
figure(1);
step_res (t>0) = 1;
lsim(sys, step_res, t);
set(findall(gcf, 'Type', 'Line'), 'linewidth', 3);
title('Step Response of The The Closed Loop Transfer Function')
grid on;
% Ramp Response
kv = dcgain(s*Gs)
Esst_final_val_ramp = 1/(kv)
Esst = 1/(1+Gs) * 20/(s^2);
sys = feedback(Esst , 1);
ramp = t.*step_res;
figure(2)
lsim(sys, ramp, t);
set(findall(gcf, 'Type', 'Line'), 'linewidth', 3);
13
figure(3)
lsim(sys, parabola, t);
set(findall(gcf, 'Type', 'Line'), 'linewidth', 3);
title('Parabola Response of The Closed Loop Transfer Function')
grid on;
Which give us perfect track for step input.
Figure 7: Step Response of the Closed Loop Transfer Function (img: q2_part_c_step)
Figure 8: Ramp Response of the Closed Loop Transfer Function (img: q2_part_c_ramp)
The ramp response has a constant error of 2.667 and induces some oscillations in the
response, but it tracks the ramp.
The Parabolic response doesn’t track the system, as it is obvious from the closed loop
transfer function of the system. Parabolic response tracks perfectly for Type III systems or
above, but our system is only Type I as such the error reaches infinity very quickly.
15
Figure 9: Parabolic Response of the Closed Loop Transfer Function (img: q2_part_c_parabola)
c. If the above task is not achievable with 𝐾0, then, design a lead compensator:
d. Find steady state error 𝑒𝑠s for step reference and disturbance inputs respectively,
with 𝐾(𝑠) = 𝐾lead(𝑠) in Figure 3. If any of the steady state errors is greater than 10%.
then design a lag compensator: K𝑙ag(𝑠) = (𝑠+alag)/(s+blag) to make|𝑒𝑠𝑠| = 10%.
16
e. Present all the necessary plots (e.g., steady state errors, control input, output, and
root locus) and explain your result in detail.
A: For R(s) = 1/s and D(s) = 0, the transient response must match Ts < 10s and PO <
5%
For finding the settling time, peak time, and Percentage Overshoot we first need to find the values
of Zeta (ζ) and wn.
Since the requirements for the percentage overshoot is 5%
−𝛇𝛑
𝑃𝑂 = 100 ∗ 𝑒 √1− 𝛇2
−𝛇𝛑
5 2
= 𝑒 √1− 𝛇
100
Taking natural log on both sides
−𝛇𝛑
5 2
𝑙𝑛 = ln (𝑒 √1− 𝛇 )
100
−ζπ
2.9957322 =
√1 − ζ2
2.9957322 ∗ √1 − ζ2 = −ζπ
ζ2 = 0.4762472995
𝛇 = 𝟎. 𝟔𝟗𝟎𝟏𝟎𝟔𝟕𝟑𝟎𝟓
The settling time restriction is 10s, we find the value of wn using this.
4.6
𝑇𝑠 =
ζwn
4.6
10 =
0.6901067305 ∗ wn
17
4.6
𝑤𝑛 =
0.6901067305 ∗ 10
𝒘𝒏 = 𝟎. 𝟔𝟔𝟔𝟓𝟔𝟑𝟓𝟔𝟏𝟒
To find the value of Peak Time we first need to find the value of wd.
𝜋
𝑇𝑝 =
𝑤𝑑
𝑤𝑑 = 0.6665635614 ∗ √1 − 0.69010673052
𝒘𝒅 = 𝟎. 𝟒𝟖𝟐𝟑𝟗𝟕𝟏𝟐
Settling time is given by
𝜋
𝑇𝑝 =
𝑤𝑑
𝜋
𝑇𝑝 =
0.48239712
𝑻𝒑 = 𝟔. 𝟓𝟏𝟐𝟒𝟔𝟏𝟒𝟔𝟑𝒔
B: The objective cannot be achieved using K0, which can be observed on Figure 6 where
the system with unity gain exceeds the set parameters,
C: Which means that we need to use lead compensator to correct the deviation.
Using the values of ζ and wn to find the desired pole location by comparing it with the general
𝑠 2 + 0.92s + 0.4443 = 0
s = -0.46 ∓ 0.48239711991263
𝑄𝑧 − 𝑄𝑝 = 12.5345679
𝑄𝑝 = 72.72535369
19
It gives us the distance of the pole from the real part of our desired pole, to find the distance
from the origin, add the distance of the desired pole from the origin to it.
𝑝𝑜𝑙𝑒 = 0.6100158321
Lead Controller
𝑠 + 0.5
𝐾𝐿𝑒𝑎𝑑 (𝑠) = 𝐾0
𝑠 + 0.6100158321
After adding the controller, the open loop transfer function of the system becomes
(𝒔+𝟑) (𝒔+𝟎.𝟓)
𝑮(𝒔) = 𝒔(𝒔+𝟏)(𝒔+𝟐)(𝒔+𝟒) ∗ (𝒔+𝟎.𝟔𝟏𝟎𝟎𝟏𝟓𝟖𝟑𝟐𝟏) ∗ 𝑲𝟎 Where K0 = 1
MATLAB Code
s = tf('s');
sys_ol = (s+3)/(s*(s+1)*(s+2)*(s+4));
figure(1);
rlocus(sys_ol);
sgrid(0.6901067305, 0.6665635614);
title('Open Loop Root Locus');
axis([-4.5 1 -3 3])
set(findall(gca,'type','line'), 'markersize', 15, 'linewidth', 4);
% Lead Compensator
gain = 1;
lead = (s + 0.5)/(s + 0.6100158321);
HS = gain * lead * sys_ol;
figure(2)
sys_cl = feedback(HS, 1);
rlocus(sys_cl)
sgrid(0.6901067305, 0.6665635614);
set(findall(gca,'type','line'), 'markersize', 15, 'linewidth', 3);
title('Root Locus of the Closed Loop Transfer Function');
axis([-4.5 1 -3 3])
20
figure(3);
[step_val, t] = step(sys_cl);
plot(t, step_val, 'linewidth', 3);
label('Time (s)', 'Amplitude (v)', 'Step Response of the Closed Loop Transfer
Function at K = 1');
stepinfo(sys_cl)
From the open loop transfer function, we can plot the root locus of the open loop. From that we
can find out the value of gain for the specific value of ζ at which our requirements are satisfied.
From the figure below we can notice that the gain of the system is unity (K = 1)
Figure 10: Root Locus of the Open Loop Transfer Function (img: q3_part_c)
After applying the Lead compensator to the transfer function and applying unity feedback to the
system, we achieve the required parameters.
21
Figure 11: Root Locus of the Closed Loop Transfer Function with lead compensator (img: q3_part_c_closed_loop)
We can verify that by applying step input to the closed loop system.
Figure 12: Step Response of the Closed Loop Transfer Function with lead compensator (img: q3_part_c_step)
We can see visually verify that the system has no overshot and has a settling time under 10
seconds, which verify our requirements. We can also verify this using stepinfo() function which
gives us numeric values.
22
We can verify that there is no overshot and the settling time is at 7.637 seconds. Which are well
within our requirements.
D: As we observed earlier, the system is already type I which means it will track the step
input perfectly after the transients settle down. Adding controller has no effect on the type of
the system, which means it will still track the step input perfectly. We can verify that using
MATLAB.
MATLAB Code
t = 0:0.01:30;
s = tf('s');
lead = (s + 0.5)/(s + 0.6100158321);
Gs = lead * (s+3)/(s*(s+1)*(s+2)*(s+4));
Esst = 1/(1 + Gs);
% Step Response
figure(1);
step_res (t>0) = 1;
lsim(sys, step_res, t);
set(findall(gcf, 'Type', 'Line'), 'linewidth', 3);
title('Step Response of The The Closed Loop Transfer Function')
grid on;
Figure 13: Step Response of the Closed Loop Transfer Function with lead compensator (img: q3_part_d_step)
Which can be further validated using final value theorem which tells us that the final value of
error for the system is 0 which means the system achieves perfect track before reaching infinity,
since there is a peak at 26.7s and no overshoot in the system, we can safely conclude that the
error becomes zero and a perfect track is achieved at peak time, which is 26.7s.
The system achieved stability and the requirements were satisfied by using a lead controller,
hence mitigating the need for using a lag controller for the system.