Controller Types Experiments: Principles of Automatic Control Lab #2
Controller Types Experiments: Principles of Automatic Control Lab #2
Faculty of Engineering
Department Of Electrical And Computer Engineering
Mohannad Alghamdi
0516320
2/7/2014
EE331
Introduction:
Body:
Procedures:
I will do in this lab five experiments talk about controller types.
Each experiment I will follow these steps:
Write the question of the experiment.
Draw the block diagram of the experiment..
Write the code of the experiment by using Matlab program
(codes in appendices).
Simulate the experiment by graphical representation from
Matlab program.
Calculate the requirements in the question of the
experiment.
Discussion about experiment results.
Results:
Experiment(1): a) Open loop analysis for proportional
action control
Write a Matlab program to simulate the open loop unit
step response of the shown P controller. For a unit step of
0.6 volt and a duration of 5 seconds examine the controller
response given that R1=4.7 kilo-ohms and R2=2.2 kilo-ohms.
The open loop analysis for proportional action control
shown below in figure3:
Mohannad Alghamdi
0516320
2/7/2014
EE331
0516320
2/7/2014
EE331
i. When KP = 1
After I wrote program of the closed loop analysis for proportional
action control, I simulate it shown below in figure6:
0516320
2/7/2014
EE331
Solution:
T1= 0.498 s
Ksys= Vout/Vin = 0.5/1 = 0.5
eb= |(VinVout)/Vin| *100 = |(10.5)/1|*100 = 0.5*100 = 50%
ii. When KP = 10
After I wrote program of the closed loop analysis for proportional
action control, I simulate it shown below in figure7:
0516320
2/7/2014
EE331
Solution:
T1= 0.091 s
Ksys= Vout/Vin= 0.9091/1 = 0.9091
eb= |(VinVout)/Vin | *100 = |(10.9091)/1|*100 = 0.0909*100 =
9.09%
iii. When KP = 50
After I wrote program of the closed loop analysis for proportional
action control, I simulate it shown below in figure8:
0516320
2/7/2014
EE331
Discussion:
T1
KP = 1
0.498 s
P controller
KP = 10
0.091s
KP = 50
0s
Ksys
0.5
0.9091
0.9804
eb
50
9.09
1.96
Comparison
Mohannad Alghamdi
0516320
2/7/2014
EE331
Mohannad Alghamdi
0516320
2/7/2014
EE331
After I wrote program of the closed loop analysis for integral action control, I
simulate it shown below in figure12:
0516320
2/7/2014
EE331
0516320
2/7/2014
EE331
Solution:
Experimentally: Tn = 1 s
Experiment(3): b) Closed loop analysis for PI controller
Write a Matlab program to simulate the closed loop unit step response of the
PI controller * For a unit step of 1 volt and a duration of 10 seconds: a)
Determine the values of T1; Ksys and eb ( the error). b) Comment on the
differences found with respect to: * The open loop response of PT1. * The I
controller closed loop response.
The closed loop analysis for PI control with PT1 system shown below in
figure15:
After I wrote program of the closed loop analysis for PI controller, I simulate
it shown below in figure16:
Mohannad Alghamdi
0516320
2/7/2014
EE331
Givens:
Kp=1 ; Ki=1; Vin=1V; t= 10 s
Requirements: T1= ?; Ksys=?; eb=?
Solution:
Experimentally:
T1 = 0.998 s
Ksys= Vout/Vin = 1/1 = 1
eb= |(VinVout)/Vin| *100 = |(11)/1|*100 = 0*100 = 0%
Discussion:
By comparison between PT1 open loop and PI controller closed loop, I found
delay in PT1 less than PI controller , but the error conversely. By comparison
between I controller closed loop and PI controller closed loop, I found in delay
the PI controller less than I controller. So PI controller is better than I
controller because faster to reach steady state.
Experiment(4): a) Open loop analysis for PD controller
Write a Matlab program to simulate the open loop ramp response of the PD
controller. Given that: Kp=1, and Tv=1. The input is a unit step of 1 volt for a
duration of 2 seconds. From the response indicate and measure the value of
the rate time, Tv.
The open loop analysis for PD controller shown below in figure17:
Mohannad Alghamdi
0516320
2/7/2014
EE331
After I wrote program of the closed loop analysis for PD controller, I simulate
it shown below in figure20:
Mohannad Alghamdi
0516320
2/7/2014
EE331
Controllers
P controller ,KP
I
=1
controller
0.498 s
0.997 s
Ksys
0.5
eb
50
Mohannad Alghamdi
0516320
2/7/2014
EE331
Write a Matlab program to simulate the closed loop unit step response of the
shown control system for a unit step of 1 volt and a duration of 10 seconds.
Set the controller gains to: a) Kp=1; Ki=1 and Tv=1. b) Change the gain
values to: Kp=13; Ki=0.72 and Tv=0.0004. *Comment and compare between
the two responses.
The closed loop analysis for PID control with PT1 system shown below in
figure21:
0516320
2/7/2014
EE331
Discussion:
By comparison between PID controller in two cases a and b, I found the
delay case b much less than case b, but in the error is all cases is the same
and error equal zero.
Mohannad Alghamdi
0516320
2/7/2014
EE331
Conclusion:
In the end of this lab I studied and analyzed controller types (P,I,PI,PD,
and PID) . Also, I examine closed loop analysis for each controller by
using PT1 first order system. Finally, I discuses and compare each
controller and I know it the advantage for each type.
Appendices:
Code of Experiment(1): a) Open loop analysis for proportional action control
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start code
clc
clear
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% controller_p
kp=2.14;
nump=[0 kp];
denp=[0 1];
controller_p=tf(nump,denp);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% step response
t=0:0.0001:1;
duration=5;
time=t.*duration;
amp=0.6;
system=controller_p;
y=step(system*amp,time);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plotting
figure
plot(time,y,'linewidth',2)
hold on
plot(time,time.*0+amp,'r',time.*0,t*amp,'r')
xlim([-0.5 duration])
ylim([0 amp+5])
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end code
Mohannad Alghamdi
0516320
2/7/2014
start code
plant pt1
controller_p
step response
EE331
duration=10;
time=t.*duration;
amp=1;
fg=pt1*controller_p;
fb=feedback(fg,1);
system=fb;
y=step(system*amp,time);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plotting
figure
plot(time,y,'linewidth',2)
hold on
plot(time,time.*0+amp,'r',time.*0,t*amp,'r')
xlim([-0.5 duration])
ylim([0 amp+0.2])
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end code
Mohannad Alghamdi
0516320
2/7/2014
EE331
clear
close all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plant pt1
ksy=1;
t1=1;
num1=[0 ksy];
den1=[t1 1];
pt1=tf(num1,den1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% controller_p
kp=50;
nump=[0 kp];
denp=[0 1];
controller_p=tf(nump,denp);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% step response
t=0:0.0001:1;
duration=10;
time=t.*duration;
amp=1;
fg=pt1*controller_p;
fb=feedback(fg,1);
system=fb;
y=step(system*amp,time);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plotting
figure
plot(time,y,'linewidth',2)
hold on
plot(time,time.*0+amp,'r',time.*0,t*amp,'r')
xlim([-0.5 duration])
ylim([0 amp+0.2])
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end code
Mohannad Alghamdi
0516320
2/7/2014
EE331
Mohannad Alghamdi
0516320
2/7/2014
EE331
Mohannad Alghamdi
0516320
2/7/2014
start code
controller_P
controller_I
controller_D
step response
EE331
duration=2;
time=t.*duration;
amp=1;
controller_PD=((controller_P+
(controller_P*controller_D))*controller_I);
system=controller_PD;
y=step(system*amp,time);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plotting
figure
plot(time,y,'linewidth',2)
hold on
plot(time,time.*0+amp,'r',time.*0,t*amp,'r')
xlim([-2 duration])
ylim([0 amp+5])
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end code
Mohannad Alghamdi
0516320
2/7/2014
EE331
Mohannad Alghamdi
0516320
2/7/2014
EE331
ksy=1;
t1=1;
num1=[0 ksy];
den1=[t1 1];
pt1=tf(num1,den1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% controller_P
kp=13;
nump=[0 kp];
denp=[0 1];
controller_P=tf(nump,denp);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% controller_I
ki=0.72;
numi=[0 ki];
deni=[1 0];
controller_I=tf(numi,deni);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% controller_D
Tv=0.0004;
numd=[Tv 0];
dend=[0 1];
controller_D=tf(numd,dend);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% controller_PD
controller_PID=((controller_P+(controller_P*controller_D))+
(controller_P*controller_I));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% step response
t=0:0.0001:1;
duration=10;
time=t.*duration;
amp=1;
fg=pt1*controller_PID;
fb=feedback(fg,1);
system=fb;
y=step(system*amp,time);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% plotting
figure
plot(time,y,'linewidth',2)
hold on
plot(time,time.*0+amp,'r',time.*0,t*amp,'r')
xlim([-0.5 duration])
ylim([0 amp+0.2])
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end code
Mohannad Alghamdi
0516320
2/7/2014
EE331