Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Weldon
Abstract—This report summarizes Digital Controls Final For this project, our assigned plant transfer function
Project: comparison of stat-variable and classical system design (including ZOH) was
approaches. In this project, a continuous-time plant function was
(1−𝑒 −𝑠𝑇0 ) (104 )(1−𝑒 −𝑠𝑇0 )
assigned to the group, with design goals for unity feedback and 100 𝐺𝐶 (𝑠) = 𝐺𝑝 (𝑠) = (1)
𝑠 𝑠(𝑠+0.15−𝑗9)(𝑠+0.15+𝑗9)(𝑠+1)
Hz sampling being steady-state error < 5% and settling time to
within 10% of less than 0.1 second. The first task was to design a with corresponding G(z)
classical digital PID/Lag-Lead controller D(z) to meet the goals.
The second task was to design a digital state-variable observer and 129𝑧 2 +21𝑧+0.000182
controller with pole placement to meet the goals. It was not 𝐺(𝑧) = (2)
30𝑧 3 −30𝑧 2 +0.00136𝑧−1.89∗10−14
possible to meet the design goals using a classical D(z) controller,
and the best result was steady-state error 1.89% and settling time where Ts=0.01 s for the sampler. And since H(s)=1, the open-
of 17 seconds. However, a successful digital state-variable loop gain is GOL(z)=G(z).
observer and controller design achieved steady-state error 4.5%
and settling time of 0.13 seconds. Theory and simulation results
are provided for the two designs.
I. INTRODUCTION
The team was provided a plant function through two
complex poles and one pole located at negative one. Through a
classical PID controller and state-variable observer and
controller compensator, the goal was to design two different
controllers to follow certain design requirements. State space
Fig. 1. System block diagram with T0=0.01 s digital phase-
variable controllers have multiple applications such as controller
lag controller D(z), with plant function Gc(s)=(1-
voltage source converters and optimization for a DC motor for
esTo)/[s(s+1)], feedback H(s)=1, and a ZOH.
an FPGA [2][3].The design requirements were to have a settling
time with ten percent of 0.1 seconds for a step input, a steady
state error of less than five percent, a peak overshoot of less than
five percent, and a closed-loop bandwidth of greater than 2 Hz. The digital PID controller used in the classical system design
approach is [1]
The classical PID controller was designed using [1]. The
problem provided was graphed using MATLAB. After the phase
margin was chosen to be 45°, the w1 was found. Using this 𝑇0 𝑧+1 𝑧−1
information, the phase of the digital filter was calculated and 𝐷(𝑧) = 𝐾𝑝 + 𝐾𝑖 + 𝐾𝐷 (3)
2 𝑧−1 𝑧𝑇0
used to find the KI, KP, and KD values. These gain values were 𝑧+1 𝑧−1
used for making the digital controller. = 0.1647 + 0.0000095 − 0.36 (4)
𝑧−1 𝑧
𝐷 = [0] (10)
REFERENCES
Appendix 1
Mattlab Script
close all
clear all
close all force
%***********************************************
% enter your PID design coefficients here
kp=0.1647; ki=0.0019; kd=-0.0036;
pidCtrl=pid(kp,ki,kd,0,Ts,'IFormula','Trapezoidal','DFormula','BackwardEuler');
pid.z=tf(pidCtrl);
D.z=pid.z
D.s = d2c(D.z,'Tustin');
Gfwd.z = series(D.z,Gp.z);
Gfwd.s = series(D.s,Gp.s);
Gol.z = series(Gfwd.z,H.z);%compensated open loop response
GolUncomp.z=series(Gp.z,H.z);%uncompensated open loop response
Gol.s = series(Gfwd.s,H.s);
Gcl.z = feedback(Gfwd.z, H.z); %closed loop pulse trans func
Gcl.s = feedback(Gfwd.s, H.s);
figure(1);
set(gca,'linewidth',3.0);
aa=gca
aa.XGrid='on';aa.YGrid='on';aa.LineWidth=3;aa.FontWeight='bold';
aa.XLabel.FontSize=20;aa.YLim=[-225 0];
set(findall(gcf,'Type','line'),'LineWidth',3);
set(findall(gca,'Type','line'),'LineWidth',3);
set(findall(gcf,'Type','text'),'FontSize',14);
set(findall(gcf,'Type','text'),'FontWeight','bold');
bplt=bodeplot(Gol.z)
setoptions(bplt,'FreqUnits','Hz','grid','on','YLim',[-20 60],'XLim',[fmin fmax]);
title('e4112 compensated open loop response')
%legend('C(z)/R(z)','Location','northwest')
aa=gca
aa.XGrid='on';aa.YGrid='on';aa.LineWidth=3;aa.FontWeight='bold';
aa.XLabel.FontSize=20;aa.YLim=[-225 0];
set(findall(gcf,'Type','line'),'LineWidth',3);
set(findall(gca,'Type','line'),'LineWidth',3);
set(findall(gcf,'Type','text'),'FontSize',14);
set(findall(gcf,'Type','text'),'FontWeight','bold');
figure(2);
set(gca,'linewidth',3.0);
bplt=bodeplot(Gcl.z)
setoptions(bplt,'FreqUnits','Hz','grid','on','YLim',[-20 30],'XLim',[fmin fmax]);
title('e4112 closed loop response C(z)/R(z)')
%legend('C(z)/R(z)','Location','northwest')
aa=gca
aa.XGrid='on';aa.YGrid='on';aa.LineWidth=3;aa.FontWeight='bold';
aa.XLabel.FontSize=20;aa.YLim=[-90 90];
set(findall(gcf,'Type','line'),'LineWidth',3);
set(findall(gca,'Type','line'),'LineWidth',3);
set(findall(gcf,'Type','text'),'FontSize',14);
set(findall(gcf,'Type','text'),'FontWeight','bold');
figure(3);
set(gca,'linewidth',3.0);
%zplane(Z,P) plots the zeroes Z and poles P (in column vectors) with the
pzmap(Gcl.z);
title('Closed loop response C(z)/R(z) poles and zeroes')
axis([-1.5 1.5 -1.5 1.5]);
%zeta = [ 0.25 0.5 0.75];
Wn = [0.25 0.5 0.75]*3;
aa=gca
aa.XGrid='on';aa.YGrid='on';aa.LineWidth=3;aa.FontWeight='bold';
aa.XLabel.FontSize=20;aa.FontSize=12;
set(findall(gcf,'Type','line'),'LineWidth',3);
set(findall(gcf,'Type','text'),'FontSize',14);
set(findall(gcf,'Type','text'),'FontWeight','bold');
figure(4);
set(gca,'linewidth',3.0);
step(Gcl.s, '-', Gcl.z, '-r', 1);
legend('Continous-Time', 'Discrete-Time')
title('e4112 closed-loop step response ')
aa=gca
aa.XGrid='on';aa.YGrid='on';aa.LineWidth=3;aa.FontWeight='bold';
aa.XLabel.FontSize=20;aa.FontSize=12;
set(findall(gcf,'Type','line'),'LineWidth',3);
set(findall(gcf,'Type','text'),'FontSize',14);
set(findall(gcf,'Type','text'),'FontWeight','bold');
figure(5);
set(gca,'linewidth',3.0);
bplt=bodeplot(D.z)
setoptions(bplt,'FreqUnits','Hz','grid','on','YLim',[-20 60],'XLim',[fmin fmax]);
title('e4112 compensator response D(z)')
%legend('D(z)','Location','northwest')
aa=gca
aa.XGrid='on';aa.YGrid='on';aa.LineWidth=3;aa.FontWeight='bold';
aa.XLabel.FontSize=20;aa.YLim=[-90 90];
set(findall(gcf,'Type','line'),'LineWidth',3);
set(findall(gca,'Type','line'),'LineWidth',3);
set(findall(gcf,'Type','text'),'FontSize',14);
set(findall(gcf,'Type','text'),'FontWeight','bold');
[zcl,pcl,kcl] = zpkdata(Gcl.z,'v')
%################Convert Gc to Z-Domain#################
System.Gc.z = c2d(System.Gc.Gp.s,Ts,'zoh'); %Gc to z-domain
%display(System.Gc.z); %Display the Gc.z
%################Define Feedback########################
System.H.s = tf([1],[1]); %Feedback in S-Domain
%display(System.H.s); %Display Feedback in S-Domain
System.H.z = c2d(System.H.s,Ts,'zoh'); %Feedback in z-domain
%display(System.H.z); %Display Feedback in Z-domain
%##############Define G##################################
System.G.z = System.D.z*System.Gc.z; %G(z)=Gc(z)*D(z)
%display(System.G.z);
A = System.sys1.A;
B = System.sys1.B;
C = System.sys1.C;
D = System.sys1.D;
System.new.G.num = [System.alpha*(System.Wn^2)];
System.new.G.den = [1, ((2*System.Wn*System.DR)+System.alpha),
((System.Wn^2)+(2*System.Wn*System.DR*System.alpha)),(System.alpha*System.Wn^2) ];
System.new.G.s = tf(System.new.G.num,System.new.G.den); %H(s)=Y(s)/U(s)
System.new.G.z = c2d(System.new.G.s,Ts);
%display(System.new.G.s);
%display(System.new.G.z);
%##############Create K Matrixs###############################
System.new.pd =
[System.new.G.z.Denominator{1,1}(1),System.new.G.z.Denominator{1,1}(2),System.new.G.z.
Denominator{1,1}(3),System.new.G.z.Denominator{1,1}(4)];
pd = roots(System.new.pd); %Find the Roots of the Denominator
%#############Create L Matrix################################
%Observer Poles are 2-4 times faster
%than the Controller Poles
System.new.pd1 = 4*System.new.pd; %Redefine Denominator as 4 times the controller
denominator
pd1 = roots(System.new.pd1); %Find the Roots of the Denominator
L = place(A',C',pd1);
%############Define Regulator################################
rsys = reg(sys,K,L'); %Define Regulator
I = eye(3); %3 by 3 Identity Matrix
%###########Define ##########################
comp = (K*(I-(A-B*K-L'*C))^(-1)*L'); %Gain
newsys = feedback(sys,rsys,1); %Closed-Loop TF ??
display(newsys);
newsys1 = comp*newsys;
System.stepinfo = stepinfo(newsys1);
%display(System.stepinfo);
step(newsys1) %Graph time response for unit-function input