pid controller simplified
TRANSCRIPT
-
7/28/2019 PID Controller Simplified
1/8
PID Controller SimplifiedPosted May 11, 2008
Filed under:Control Systems,Technology| Tags:Control Systems,Controller,
Matlab,PID Controller,Step response|
This is an attempt to explain PID controller with minimum use of maths.
A simple closed loop control system consisting of a controller and a process (or
plant) is shown below.
The input to the system is the setpoint, ie the desired output. The input to the
controller is the error.
Error = Present Output Setpoint.
The two steps in the design of a control system are -
1. Mathematically model the plant to be controlled.
2. Design the Controller.
The block diagram of a PID controller is shown below
http://radhesh.wordpress.com/category/control-systems/http://radhesh.wordpress.com/category/control-systems/http://radhesh.wordpress.com/category/control-systems/http://radhesh.wordpress.com/category/technology/http://radhesh.wordpress.com/category/technology/http://radhesh.wordpress.com/category/technology/http://radhesh.wordpress.com/tag/control-systems/http://radhesh.wordpress.com/tag/control-systems/http://radhesh.wordpress.com/tag/control-systems/http://radhesh.wordpress.com/tag/controller/http://radhesh.wordpress.com/tag/controller/http://radhesh.wordpress.com/tag/controller/http://radhesh.wordpress.com/tag/matlab/http://radhesh.wordpress.com/tag/matlab/http://radhesh.wordpress.com/tag/pid-controller/http://radhesh.wordpress.com/tag/pid-controller/http://radhesh.wordpress.com/tag/pid-controller/http://radhesh.wordpress.com/tag/step-response/http://radhesh.wordpress.com/tag/step-response/http://radhesh.wordpress.com/tag/step-response/http://radhesh.files.wordpress.com/2008/05/pid.jpghttp://radhesh.files.wordpress.com/2008/05/cl_system.jpghttp://radhesh.files.wordpress.com/2008/05/pid.jpghttp://radhesh.files.wordpress.com/2008/05/cl_system.jpghttp://radhesh.wordpress.com/tag/step-response/http://radhesh.wordpress.com/tag/pid-controller/http://radhesh.wordpress.com/tag/matlab/http://radhesh.wordpress.com/tag/controller/http://radhesh.wordpress.com/tag/control-systems/http://radhesh.wordpress.com/category/technology/http://radhesh.wordpress.com/category/control-systems/ -
7/28/2019 PID Controller Simplified
2/8
A PID controller consists of a Proportional element, an Integral element and a
Derivative element, all three connected in parallel. All of them take the error as
input. Kp, Ki, Kd are the gains of P, I and D elements respectively.
The best way to understand something is by simulating it. So I simulated a PID
controller in matlab. The matlab code is provided at the end of this article.
Let me assume a suitable mathematical model for the plant and then go ahead
with designing the controller.
Let the transfer function of the plant be 1 / ( s^2 + 20s + 30 ).
The step response of a system is the output of the system when the input to thesystem is a unit step. The open loop step response of the above plant is
(Click on the image to get an enlarged picture)
It can be seen that the step response output is close to 0.035. The steady state
error = 1-0.035 = 0.965. Thats quite high! Also observe that the settling time is
around 3 sec.
Now lets see what is the effect of PID controller on the system response.
Lets see the effect of proportional element on the system output.
Keeping Kp = 10, Ki = 0, Kd = 0 the step response of the system is
http://radhesh.files.wordpress.com/2008/05/step_system.jpg -
7/28/2019 PID Controller Simplified
3/8
-
7/28/2019 PID Controller Simplified
4/8
The output is around 0.87. Also observe that the ripples have started appearing in
the output. If Kp is increased further it will only lead to increase in ripples or
overshoot. The rise time also has decreased. Also observe that there is a small
steady state error (1 0.87 = 0.13).
Conclusion
Increasing Kp will reduce the steady state error.After certain limit, increasing Kp will only increase overshoot.
Kp reduces rise time.
Now lets keep Kp fixed. Lets start varying Ki.
Keeping Kp = 200, Ki = 10, Kd = 0 the step response of the system is
http://radhesh.files.wordpress.com/2008/05/kp_3.jpg -
7/28/2019 PID Controller Simplified
5/8
The output is now close to 0.99. Thats very close to the setpoint. But observe that
settling time has increased.
Keeping Kp = 200, Ki = 200, Kd = 0 the step response of the system is
Observe that rise time has now reduced and steady state error is very small.
Keeping Kp = 200, Ki = 300, Kd = 0 the step response of the system is
http://radhesh.files.wordpress.com/2008/05/ki_2.jpghttp://radhesh.files.wordpress.com/2008/05/ki_1.jpghttp://radhesh.files.wordpress.com/2008/05/ki_2.jpghttp://radhesh.files.wordpress.com/2008/05/ki_1.jpg -
7/28/2019 PID Controller Simplified
6/8
Observe that steady state error is close to 0 now. But increasing Ki has resulted in
overshoot.
Further increasing Ki will only increase overshoot.
Conclusion
Ki eliminates the steady state error.
After certain limit, increasing Ki will only increase overshoot.
Ki reduces rise time.
Now lets Keep Ki fixed and start varying Kd.
Keeping Kp = 200, Ki = 300 and Kd = 10.
http://radhesh.files.wordpress.com/2008/05/ki_3.jpg -
7/28/2019 PID Controller Simplified
7/8
Wow! What a response! Where is the overshoot? It has disappeared. There is a
reduction in settling time as well.
Increasing Kd further will only result in response getting worsened.
Conclusion
Kd decreases the overshoot.
Kd reduces settling time.
So the ideal PID values for our plant is Kp = 200, Ki = 300 and Kd = 10.
The above process is known as manual tuning of PID.
Here is the matlab code used to simulate PID
(The below code is written by me. So please let me know if you find any bugs!)
num=1;
den=[1 20 30];
Plant = tf(num,den);
step(Plant,r');
hold on;
Kp=200;
P_Sys = tf(Kp,1);
http://radhesh.files.wordpress.com/2008/05/kd_1.jpg -
7/28/2019 PID Controller Simplified
8/8
Ki=300;
den2=[1 0];
I_Sys=tf(Ki,den2);
Kd=10;
num3=[Kd 0];
D_Sys=tf(num3,1);
PI=parallel(P_Sys,I_Sys);
PID=parallel(PI,D_Sys);
OpenLoop=series(PID,Plant);
ClsdLoop = feedback(OpenLoop,[1]);
step(ClsdLoop,b');