Assignment4 - CEP - Fahad
Assignment4 - CEP - Fahad
F17 B
TALHA RASHID
285-FET/BSEE/F17
SUBMITTED TO
DR. NAVEED ISHTIAQ
Problem:
We have to design a PID controller for a DC motor in order to control its rotor’s angular
position θ(t) through a dc set point v(t) at input. This controller controls the transient response
parameters as well as the steady-state specifications of a given system.
In the problem under consideration we have to meet following specifications of the desired
response of the system.
▪ Settling time less than 2 seconds
▪ Overshoot less than 5%
▪ Steady-state error less than 1%
We have a controller and a DC motor in the system as shown:
1
2
Design:
Let us try to design PID controller through MATLAB software.
1- Using PID Tuner
% Matlab Code
clc;clear all;close all;
s=tf('s');
t=0:0.01:100;
P=2/(s*(s^2+12*s+20.02));
pidtool(P);
After sliding the tuners named Response Time and Transient Behavior in the Tuner window,
We found the parameters as shown in figure above.
Thus, we have achieved our goal through PID tuner tool in MATLAB. Let us confirm it from
a code
% Matlab code
clc;clear all;close all;
J= 0.01;
b= 0.1;
Ke= 0.01;
Kt= 0.01;
R= 1;
L= 0.5;
s= tf('s');
t= 0:0.01:5;
P= Kt/((J*s^2+b*s)*(L*s+R)+Kt*Ke*s);
Kp= 34.74; Ki= 1.74; Kd= 14.307;
C = pid(Kp,Ki,Kd);
G = C*P;
T = feedback(G,1);
step(T,t);
3
As of steady state error, we have
4
We see that as we increase value of proportional gain from 1 to 9,
i- Rise time decreases
ii- Settling time decreases
iii- % Overshoot increase
iv- Steady state error decreases
2) Effect of Integral gain:
5
3) Effect of Derivative gain: