Question
PID controller MATLAB

5. Apply a PID controller on the closed loop system and write a MatLab scrip that will allow you to change the values of P, I
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Root locus method will be an appropriate method to see the effect of P, I ad D gains on step response of closed loop system. Consider a second-order system:

G)216+5)

So the unity feedback closed-loop response of this uncontrolled system is shown below.

Step Response 0.08 2).06 0.02 0.5 1.5 2 2.53 Time (seconds) 0

We can see here, the system has slow response and has a steady state error too, it can be mitigated using a properly tuned controller.

We start with a Proportional controller, first see the root locus of the system G.

Root Locus 3 -6-5-4-3-2-1 Real Axis (seconds 0

By cascading a P controller the root locus will move faster. as we increase the gain of the system the close loop poles will start to travel from the initial position (open loop pole location) and it will go on the path of locus. If gain is less then it will remain on real axis and far from original position i.e. away from origin that implies the value of time constant will decrease that means speed of response will increase. As we further increase the gain the poles will enter in complex plane then oscillations will be started. Step response for K_p =1 , 5 and 10 is shown below.

Step Response ). 05 2.5 Time (seconds) Step Response 0.4 0.2 0.5 Time (seconds) Step Response K p-10 0.5 Time (seconds)

Figure shown below is for K_p=20 and K_p=25 in these plots the oscillation increases as K_p increase but the speed won't change much because the real part of close loop poles remain same.

Step Response 30.5 0.5 Time (seconds) Step Response .5 0 0 0.2 0.4 0.6 0.8 11.2 Time (seconds)

Now, we introduce the proportional-derivative controller:

G_c(s)=K_p+K_d.s

Ad

Now, there wil be three cases:

1) K, 2 A,

2)  Kp s 2 5

3)  K, Ap > 5 A,

In all these three case the pole loacation will vary, take case-1.K, 2 A,

see the root locus first, below in figure as we increase the k_d the location of controller pole moves near to origin that means the speed of the system will increase. the conclusion is that the derivative controller makes system faster.

Root Locuswithout controller -0 -6-5-4-3-2-1 0 Real RecHsds -10 -15 21 -10 Real Axis (seconds 15

As we discussed above the rise time of the response reduces as we increase the value of k_p. and the disadvantage of the derivative is that it increases the overshoot.

Step Response _without controller .05 0 0.5 2.5 Time (seconds) Step Response 0.4 50.2 0 0.5 2.5 Time (seconds) Step Response

The MATLAB script for PD controller is given below.

%%%%%%%%%%%%%%%%%%PD Controller design%%%%%%%%%

close all;
clear all;
s= tf('s')
a=2;b=5;
G=1/((s+a)*(s+b));
T = feedback(G,1);
figure(1)
subplot(3,1,1)
rlocus(G);
figure(2)
subplot(3,1,1)
step(T);
k_p=4;
k_d=3;
G_c=k_d*((k_p/k_d)+s);
G1=G*G_c;
T1=feedback(G1,1);
figure(1)
subplot(3,1,2)
rlocus(G1)
figure(2)
subplot(3,1,2)
step(T1)
k_pp=4;
k_dd=5;
G_c1=k_dd*((k_pp/k_dd)+s);
G2=G*G_c1;
T2=feedback(G2,1);
figure(1)
subplot(3,1,3)
rlocus(G2)
figure(2)
subplot(3,1,3)
step(T2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MATLAB script for case-2 if and case-3 is

close all;
clear all;
s= tf('s')
a=2;b=5;
G=1/((s+a)*(s+b));
T = feedback(G,1);
figure(1)
subplot(3,1,1)
rlocus(G);
figure(2)
subplot(3,1,1)
step(T);
k_p=4;
k_d=1;
G_c=k_d*((k_p/k_d)+s);
G1=G*G_c;
T1=feedback(G1,1);
figure(1)
subplot(3,1,2)
rlocus(G1)
figure(2)
subplot(3,1,2)
step(T1)
k_pp=4;
k_dd=0.5;
G_c1=k_dd*((k_pp/k_dd)+s);
G2=G*G_c1;
T2=feedback(G2,1);
figure(1)
subplot(3,1,3)
rlocus(G2)
figure(2)
subplot(3,1,3)
step(T2)

and the plots are shown below:

Root Locus -without controller 6 Real Axis (seconds oot Locus k d-l 14 -10 Rcal Axis (seconds 16 -12 2 2 oot Locus 5 50-25 10Step Response -without controller .05 0 0.5 2.5 Time (seconds) Step Response 0.4 k d-l 0.8 1.2 Time (seconds) Step Response 0Now, PID controller:

Gc = kp + kd-S +

The integral controller controller makes the steady state error zero but the response becomes slow, proper tuning of D and I gives the good response. the script for PID tuning is given below:

%%%%%%%%%%%PID %%%%%%%%%%%%%%

close all;
clear all;
s= tf('s')
a=2;b=5;
G=1/((s+a)*(s+b));
T = feedback(G,1);
figure(1)
subplot(3,1,1)
rlocus(G);
figure(2)
subplot(3,1,1)
step(T);
k_p=4;
k_d=1;
k_i=1;
G_c=k_p+k_d*s+k_i/s;
G1=G*G_c;
T1=feedback(G1,1);
figure(1)
subplot(3,1,2)
rlocus(G1)
figure(2)
subplot(3,1,2)
step(T1)
k_pp=4;
k_dd=1;
k_ii=0.1;
G_c1=k_pp+k_dd*s+k_ii/s;
G2=G*G_c1;
T2=feedback(G2,1);
figure(1)
subplot(3,1,3)
rlocus(G2)
figure(2)
subplot(3,1,3)
step(T2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%

Initially we put  k_p=4;
k_d=1;
k_i=1;

then putting the P and D same reduce the

k_pp=4;
k_dd=1;
k_ii=0.1;

Root Locus -without controller 6 Real Axis (seconds oot Locus -10 -12 -14 2 2 Rcal Axis (seconds oot Locus 50-16 -14 12 2 ReaStep Response -without controller .05 0 0.5 2.5 Time (seconds) Step Response 0.5 0 10 20 30 60 70 80 90 100 Time (seconds) St

here we can see the root locus and step response, it becomes slower as we change the integral action.

Now we will increase the Derivative action to make the system faster.

k_p=4;
k_d=1;
k_i=2

the third improved graph has a faster response and zero steady state error. We can tune the gains to get a better response.

Step Response 0.5 2.5 Step Response) 0.5 200 400 Step Resp 800 0.5 10 20 Time (seconds) 30 40

Thank you, pls comment for further help.

Add a comment
Know the answer?
Add Answer to:
PID controller MATLAB 5. Apply a PID controller on the closed loop system and write a MatLab scrip that will allow you to change the values of P, I, and D coefficients and plot the effects of this...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT