The University of Sheffield
ACS6101 Foundations of Control Systems
Week 5 Assignment
Paulo Roberto Loma Marconi
prlomarconi1@sheffield.ac.uk
November 4, 2018
1 Question 1
The aim of this task is to design a digital controlled system with some requirements, small
steady state error, small settling time, minimum input action, and minimum overshoot.
The plant to be studied is,
G
p
(s) =
0.04(s + 1)
s
2
+ 0.2s + 0.04
(1)
and the digital controller should have the form,
D(z) = K
z A
z B
(2)
Fig.1 shows that the plant is very slow with a big overshoot. A phase margin (P M) of 60
°
can be the unique requirement. As long as the compensated phase margin is around that value,
the settling time and overshoot should be minimized as much as possible.
(a) Bode plot (b) Step response.
Figure 1: Evaluation of the plant Gp
1.1 Phase-Lead compensator
The selected compensator can be written as follows,
G
c
= K
c
s + z
s + p
, |z| |p| (3)
1
Registration Number: 180123717
Step 1. Calculate a gain K that satisfies the desired phase margin P M
d
= 60
°
. Applying
the angle condition for a P M
d
over G
p
,
]G
p
(jω
0
c
) = P M
d
180
°
(4)
]G
p
(jω
0
c
) = 60
°
180
°
]G
p
(jω
0
c
) = 120
°
where ω
0
c
is the new crossover frequency for the desired phase margin P M
d
= 60
°
.
Using the bode plot of G
p
, Fig. 2a, the logarithm gain at 120
°
is 8.02 dB, so the gain K
can be calculated as follows,
20 log
10
K = | 8.02| (5)
K = 2.52
Therefore, the uncompensated G
p
that satisfies the desired phase margin is,
G
p1
= K G
p
G
p1
= 2.52
0.04(s + 1)
s
2
+ 0.2s + 0.04
(6)
and Fig. 2b shows that the new uncompensated plant G
p1
satisfies the desired phase margin.
(a) Bode plot of Gp (b) Bode plot of Gp1
Figure 2: Evaluation of the plant Gp and Gp1
The following Matlab scripts simulates the previous results.
%% ================ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ===================
% ---- ACS6101 A ssig nmen t week 5
% ---- Reg i stra t ion number : 1801 2371 7
% ---- Name : Paulo Roberto Loma Marconi
% ---- 03/ 11/2 018
%% === Quest ion 1 ======================== = = = = = = = = = = = = = = = = = = = ==============
clear ; clc ; close all ; % clean pre vio us data in order to avoid erros .
%% plant Gp
s = tf ( s );
Gp = 0.04*( s +1) /( s ^2+0.2* s +0.04) ; % unco m pens a ted p lant
fig = fi gure (1) ;
marg in ( Gp ) ; % cal cula tes the phase margin and gain margi n at their fre quen cies
[Gm ,Pm , Wcg , Wcp ] = m argin ( Gp ) ;
Gcl = fee dba ck ( Gp ,1) ; % closed - loop of the un c ompen sated plant
2
Registration Number: 180123717
save as ( fig , Q1_G p_mar gin . png );
fig = fi gure (2) ;
step ( Gcl ) ; % step re spo nse to the closed - loop system
st epi nfo ( Gcl ) % system per form ance values
save as ( fig , Q1_ Gp_s tep . png );
%% Design req uirem ents
PO = 10; % per cent age o vers hoot
zeta = log (100/ PO ) / sqrt ( pi ^2+ ( log (100/ PO ) ) ^2 ); % d amping ratio
PM_d = round (100* zeta ) +1; % d esi red PM
%% Obta inin g the gain K that meets the desired PM_d
K = 1 0 ^(8. 0 3/20 ) ; % the gain 8.03 obtain ed from the bode plot
Gp1 = K* Gp ; % new u ncomp ensat e d plant
fig = fi gure (11) ;
marg in ( Gp1 ) ;
save as ( fig , Q1_Gp 1_K_ma r gin . png );
Step 2. The digital uncompensated plant G
z1
of G
p1
can be calculated using a zero-order
holder with a sampling time T
s
= 0.01.
G
z1
= 1.01 · 10
3
z 0.99
z
2
1.99z + 0.99
(7)
In Fig. 3 it can be seen that the continuous and discrete plant are almost similar. Also, the
settling time has been reduced but the steady state error is too big.
Figure 3: Step response of Gz1 and Gp1
The following Matlab scripts simulates the previous results.
%% Dig ita l unc o mpens ated s ystem with the new gain K
Ts = 0.01; % sampli ng time
Gz1 = c2d ( Gp1 , Ts , zoh ); % co nve rt the con tinu os time plant Gp2 to the
% discret e time domain with the zero order holder
Gp1_ cl = fe edback ( Gp1 ,1) ; % closed - loop system in conti nuos time
Gz1_ cl = fe edback ( Gz1 ,1) ; % closed - loop system in discrete time
fig = fi gure (3) ;
step ( Gp1_cl , Gz1_cl ) ; % step respo nse of both cont inu os and d isc ret e sy ste ms
save as ( fig , Q1_G pz_K_ s tep . png );
st epi nfo ( Gz1_cl ) % system per forma nce v alues
Step 3. With the desired phase margin, the value of β can be calculated as follows,
P M
act
P M
d
+ θ = arctan
β 1
2
β
(8)
3
Registration Number: 180123717
where P M
act
is the actual phase margin of the uncompensated plant G
p1
, and θ is a factor of
correction.
After some operations,
β
2
β [2 + 4 (tan(P M
d
P M
act
+ θ))] + 1 = 0
if θ = 6
°
, P M
d
= 60
°
, and P M
act
= 61.25
°
obtained from Fig. 4. The β will be,
β = 1.18
Figure 4: Bode plot of Gp2
Step 4. Now, the crossover over frequency ω
c
needs to be calculated using the following
gain condition formula,
|G
p1
(jω
c
)| =
1
β
(9)
if we use the peak magnitude M
pc
relation,
M
pc
=
1
β
(10)
and using getGainCrossover(Gp2,Mpc) command on Matlab,
ω
c
= 1.37 rad/sec
Step 5. Determining the zero of the controller,
ω
c
=
p
βz
2
(11)
z = 1.26
therefore, the compensator in continuous time can be written as follows,
G
c
= β
s + z
s + βz
(12)
G
c
= 1.18
s + 1.26
s + 1.49
4
Registration Number: 180123717
and in discrete time,
G
c
z = 1.18
z 0.99
z 0.98
The open-loop compensated in continuous and discrete time are,
G
ol
= G
c
G
p1
(13)
G
ol
= 1.18
s + 1.26
s + 1.49
2.52
0.04(s + 1)
s
2
+ 0.2s + 0.04
(14)
G
olz
= 0.01
z 0.99
z 0.98
z 0.98
z
2
1.99 + 0.99
(15)
Fig. 5 shows that the compensated system using a Phase-Lead controller achieves with
success the desired phase margin of 60
°
, and has a small settling time t
s
= 4.84 sec.
(a) Bode plot (b) Step response.
Figure 5: Evaluation of Phase-Lead compensated system in continuous and discrete time.
The following Matlab script simulates and evaluates the previous design.
%% Desi gnin g the Phase - lead digi tal cont roll er
% i ntro ducin g a new gain 10 times faste r in order to obtain a fast
% respons e to the step input
Gp2 = K *10* Gp ;
fig = fi gure (4) ;
marg in ( Gp2 ) ; % chec kin g the desired phase margin PM_d
[Gm1 , PM_act , Wcg1 , Wcp1 ] = margin ( Gp2 );
save as ( fig , Q1_G p2_ma r gin . png );
% step 1) obta inin g beta with the actual PM and the d esired PM
theta = 6; % c orre ctio n factor
beta = roots ( [1 -(2+4*( tand ( PM_d - PM_act + theta ) ) ^2) 1] ) ;
% beta = (1+ sind ( PM_d - PM_act + theta ) ) /(1 - sind ( PM_d - PM_act + theta ));
% step 2) c alcu latin g the new cro ssover frequ ency
Mpc = 1/ sqrt ( beta (1) ); % find c ompe nsat o r peak m agni tud e .
omega_c = getG a inCros s over ( Gp2 , Mpc ); % The new gain cros sove r freque ncy wc
% step 3) d eter minin g the zero and the pole of the cont roll er
zc = omega_c / sqrt ( beta (1) ) ; % zero of the co ntro ller
pc = beta (1) * zc ; % pole of the cont roll er
% step 4) c ontr olle r in conti nuou s and d iscrete time
Gc = beta (1) *( s + zc ) /( s + pc ) ; % phase - lead co ntro ller in conti nuous time
Gcz = c2d (Gc , Ts , zoh ); % phase - lead con trol ler in dis cre te time
5
Registration Number: 180123717
%% E valu atin g the phase - lead contr olle r
Gol = Gc * Gp2 ; % open - loop c ompe nsate d in conti nuou s time
Gcl = fee dba ck ( Gol ,1) ; % closed - loop in conti nuou s time
Gp2z = c2d ( Gp2 , Ts , zoh ); % plant in di scr ete time
Golz = Gcz * Gp2z ; % open - loop c ompe nsat e d in d iscrete time
Gclz = feedback ( Golz ,1) ; % closed - loop in d isc rete time
fig = fi gure (5) ;
marg in ( Gol ) ;
save as ( fig , Q1_l e ad_ma r gin . png );
fig = fi gure (6) ;
step ( Gcl , Gclz );
save as ( fig , Q1_l ead_s tep . png );
2 Question 2
The deadbeat controller approach finds an input signal in order to bring the output to the
steady-state in the smallest number of time steps [1]. It has some characteristics:
Zero steady-state error.
Minimum rise time.
Minimum settling time
Less than 2% overshoot/undershoot.
Very high control signal output.
Can not be used in continuous time.
As long as the plant G(z) has all zeros and poles inside the unit circle (minimum phase), the
plant can be written as,
G(z) =
z
d
B(z)
A(z)
=
z
d
(b
o
+ b
1
z
1
+ ... + b
m
z
m
)
1 + a
1
z
1
+ ... + a
n
z
n
, d = n m > 0
with an step input r(k), the deadbeat response requirement implies,
M(z) = z
d
The digital deadbeat will have the following transfer function,
D(z) =
A(z)
z
d
B(z)
z
d
1 z
d
(16)
and the closed-loop system is,
Y (z) = z
d
U(z)
which means,
y(k) = u(k d)
So when u(k) is a step input, the output will be d-step delay of the same signal.
The aim of this question is to design a digital deadbeat controller for the plant,
G
p
(s) =
0.04(s + 1)
s
2
+ 0.2s + 0.04
G
p
(z) =
5.47 × 10
2
(z 0.34)
z
2
1.78z + 0.82
with sampling time T
s
= 1.
After using the following code in Matlab.
6
Registration Number: 180123717
%% ============== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =====================
% ---- ACS 6101 A ssignment week 5
% ---- Reg i stra t ion number : 1801 2371 7
% ---- Name : Paulo Roberto Loma Marconi
% ---- 03/ 11/2 018
%% === Quest ion 2 ======================== = = = = = = = = = = = = = = = = = = = ==============
clear ; clc ; close all ;
s = tf ( s ) ;
Gp = 0.04*( s +1) /( s ^2+0.2* s +0.04) ; % unco m pens a ted p lant
Ts = 1; % sa mpling time
Gz = c2d(Gp , Ts , zoh ) ; % Sy stem transfer fun cti on in discrete time
% Min imu m phase case
z= zpk ( z , Ts );
Mz = 1/ z; % closed - loop be cau se the rel ati ve order d = 1
Dz = Mz /( Gz *(1 - Mz ) ) ; % dea dbe at co ntro ller
Dz = minreal ( Dz ) ; % can cel common f act ors
fig = fi gure (1) ;
step ( Dz * Gz /(1+ Dz * Gz ) ) % step re spo nse of closed - loop
save as ( fig , Q 2_ deadbe at _ step . png ) ;
fig = fi gure (2) ;
step ( Dz /(1+ Dz * Gz ) ) % con trol signal
save as ( fig , Q 2_ deadbe at _ c ont rol . png ) ;
The closed-loop discrete system is,
G
clz
=
(z 1)(z 0.3392)
2
(z
2
1.783z + 0.8187)
2
z(z 0.3392)
2
(z 1)(z
2
1.783z + 0.8187)
2
where the controller is,
G
cz
=
18.288(z 1)(z 0.3392)(z
2
1.783z + 0.8187)
2
z(z 0.3392)
2
(z 1)(z
2
1.783z + 0.8187)
Fig. 6 shows the output of the deadbeat controller and the closed-loop system response to
a unit step input. It shows clearly that the steady-state error reaches zero value at the first
sampled time.
In addition, the control signal is very high when the sampling time is increased, Fig. 7.
(a) Step response of the closed-loop (b) Control signal
Figure 6: Performance of the deadbeat controller system for T
s
= 1
7
Registration Number: 180123717
(a) Step response of the closed-loop (b) Control signal
Figure 7: Performance of the deadbeat controller system for T
s
= 0.01
References
[1] Louis C. Westphal. Handbook of Control Systems Engineering. Springer Us, Dec. 6, 2012.
url: https://www.ebook.de/de/product/25178612/louis c westphal handbook of control
systems engineering.html (cit. on p. 6).
8