CW Digital Control-2
CW Digital Control-2
Digital Control CW
Coursework: Report
Module : 7307ELEM
In this course work we design digital controlled system by using a direct design method. To investigate
the effect of ringing poles in digital controller design and to compensate for them and to learn use of
CACSD package. The first section we select values of process constants in G(s) a and b in the range of 1
to 10.After that we choose sampling time regarding requirement. Then we move to the Matlab software
to evaluate pulse transfer function for the sampling time T a zero order hold at the process input. After
that we compare the open loop step responses of G(s) and G(z). The second section is direct design
controller to obtain 5% settling time to step input of half the open loop process and zero steady state
error. Third section consist of redesigning T(z) to compensate for any ringing poles in the design , after
we plot step response of T(z) and find the appropriate controller Gc(z).
2
OBJECTIVES:
In this coursework we had a G(s) as given, and the objectives are to design digital controllers to given
specifications using a direct design method. Then investigate the effect of ringing poles in digital controller
design and to reimburse for them.
INTRODUCTION:
The process to be controlled is given by the continues input-output transfer function as given following
𝑎
(𝑠) =
(𝑎𝑠 + 1)(𝑏𝑠 + 1)
Where a and b are constants, and we can choose any of its values from in between 1 to 10. This
transfer function is typical in the process industries and could represent, for liquid level process. The
controller design and simulations are done in MATLAB and the control system toolbox.
DISCUSSION:
In discussion part I will do the discussion of each step from start till the conclusion and I will explain concisely
First of all, I am choosing the parameters for a = 3 and b = 5. So, the G(s) equation will become as following
3
(𝑠) =
(3𝑠 + 1)(5𝑠 + 1)
clc; clf;
clear all;
%Paramaters of a and b
a=3; b=5;
%process development
%section 1
3
gt=tf(a,[a*b a+b 1]); %TF G(s)
Stime=0.1*max(a,b); %Sampling Time
Gz=c2d(gt,Stime,'zoh'); %Pulse TF G(z)
gpzstyle=zpk(Gz);
%section 2
%Direct Design
zta=0.5; % Mp=16percent
S=stepinfo(gt,'SettlingTimeThreshold',0.05);
Tsgt=S.SettlingTime; %Settling Time Open Loop
Ts=Tsgt/2;
lr=-3*Stime/Ts;
r=exp(lr);
Q=-lr*sqrt(1-zta^2)/zta; %Q is theeta
4
%z1=r*exp(j*Q), z2=r*exp(-j*Q) , z^2-2rcos(Q)z+r^2
m=-2*r*cos(Q);
n=r^2;
c=sum([1 m n]);
tz=tf([c 0],[1 m n],Stime); %Closed Loop PTF
figure(3)
step(tz); grid on;
Stz=stepinfo(tz,'SettlingTimeThreshold',0.05);
dz=tz/(Gz*(1-tz)); %Controller Gc(z)
dzpz=zpk(dz)
u=dz/(1+dz*Gz);
ge=(dz*Gz)/(1+dz*Gz); %Closed Loop PTF
figure(4)
step(ge); grid on;
figure(5)
step(u); grid on;
%Section #3
% Direct Controller Design for Ringing Poles
zr=zero(gpzstyle);
cnew=sum([1 m n])/sum([1 -zr]);
tznew=tf(cnew*[1 -zr],[1 m n],Stime);
Tzn=zpk(tznew)
Tz=zpk(tz)
figure(6);
step(tznew); grid on;
dznew=tznew/(Gz*(1-tznew));
dznpz=zpk(dznew)
un=dznew/(1+dznew*Gz);
gnew=(dznew*Gz)/(1+dznew*Gz);
figure(7);
subplot(211); step(gnew); grid on;
subplot(212); step(un); grid on;
END
5
1. The Process development:
Select 3 for a and 5 for b, here we will choose in the range between 1-10. Then sampling time
T=0.1 x dominant process time constant. In the first step Calculate the G(z) for sampling time T
with a ZOH at process input.
M code :
RESULTS:
gt =
3
---------------- (step(gt)-> figure1)
15 s^2 + 8 s + 1
Gz =
0.02289 z + 0.02094
---------------------- (step(Gz)-> figure2)
z^2 - 1.751 z + 0.7659
6
Fig 1:TF in continuous time
In Fig 1 has a continuous time domain G(s) and in Fig 2 has discrete time domain G(z) with ZOH.
These are the requirement of part 1 as a comparison of open loop step responses of G(s) and G(z).
7
2. Direct Controller designing Compensating for Ringing Poles:
This section we make a Transfer function T(z) for ts= 5% settling time to a step input of
approximately half the open loop process and Zero Steady-state error.
Checking the system design by plotting the step response of T(z) as Figure 3. The normalized second
order transfer function is below
2
𝐶(𝑠) 𝑤𝑛
𝑇(𝑠) = = 2
𝑅(𝑠) 𝑠 + 2𝜉𝑤𝑛𝑠 + 𝑤2
As given the overshoot must be in between 10-20% and we had 16% by selecting the 𝜉 = 0.5 value as
discussed in our lecture. Now after this we can calculate r and 𝜃 with below equations
−𝜃𝜉
𝐿𝑛(𝑟) =
√1 − 𝜉2
By rearranging we can get 𝜃 as
𝐿(𝑟)√1 − 𝜉 2
𝜃=
𝜉
8
So, now we are able to find the poles and close loop Transfer Functions. The Typical equations are as
following ( From the lecture notes )
9
(𝑧 − 𝑟𝑒 𝑗𝜃 )(𝑧 − 𝑟𝑒 −𝑗𝜃 ) = 0
𝑧 2 − 2(𝑐𝑜𝑠𝜃)𝑧 + 𝑟 2 = 0
𝑚 = −2𝑟𝑐𝑜(𝜃) 𝑎𝑛𝑑 𝑛 = 𝑟 2
[T(z)]z=1 =1
𝑐𝑧
(𝑧) =
𝑧 − 2𝑟𝑐𝑜𝑠𝜃𝑧 + 𝑟 2
2
1 (𝑧)
𝐺𝑐 (𝑧) = [ ]
(𝑧) 1 − 𝑇(𝑧)
RESULTS
tz =
0.08219 z
---------------------- (step(tz)-> above figure3)
z^2 - 1.651 z + 0.7331
10
Now we can draw figures and compare both Transfer Functions in Figure 4 and Figure 5
As we see that there is a ringing pole effect in the Fig 5. Now with ‘zpk’ function we make D(z) in zero and
pole style.We remove (z+0.9149) from G(z) to avoid ringing pole effects.
11
3. DIRECT CONTROLLER DESIGN COMPENSATING FOR RINGING POLES:
This section consists of redesigning T(z) to eliminate the ringing pole effect (z+0.9149). After this I am
going to plot the step response of T(z) and determine the appropriate controller Gc(z). New T(z) as
Tnew(z) and c as Cnew will be design and also new controller in this step.
M code:
Here it can be clearly notice there is no any ringing poles effect in above figure 6. T(z) and Tn(z) will be
like below and we can compare those.
RESULTS
Tzn =
0.04292 (z+0.9149)
12
Sample time: 0.5 seconds
13
Discrete-time zero/pole/gain model.
Tz =
0.08219 z
dznpz =
Fig 7: Step response of the process output and input in close loop to step input
14
Conclusion:
In the result of this course work we design digital controllers to given specifications using a direct design
method. We also investigated the effects of ringing poles in digital controller designs. The learning of
digital Controllers are very essential part of the course because it is widely used. They are very useful
because in closed loop controllers we have a feedback signal as well, which measures the error in real
time and then feed it back to the system and then use the main value to eliminate the errors and to run
the system smoothly on our desired form.
15
16