Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Name Jaweria Zafar

Roll No. 2018-EE-430


Marks
Lab Manual # 10: PID Controller Tuning
Objectives:
The objective of this lab is to get understanding of a PID (Proportional, Integral and Derivative)
controller and to design a controller according to the required specifications.

Introduction:
The PID controller is widely employed because it is very understandable, easily
realizable and because it is quite effective. PID controller contains a proportional, an integral,
and a derivative term represented by 𝐾 , 𝐾 and 𝐾 respectively. It is quite sophisticated in that
it captures the history of the system (through integration) and anticipates the future behavior
of the system (through differentiation). Consider the following unity-feedback system:

Plant: A system to be controlled.


Controller: Provides excitation for the plant; Designed to control the overall system behavior.
The output of a PID controller, which is equal to the control input to the plant, is
calculated in the time domain from the feedback error as follows:

 Proportional Term:
The proportional term produces an output value that is proportional to the current error value.
The proportional response can be adjusted by multiplying the error by a constant 𝐾 , called the
proportional gain constant. The proportional term is given by: 𝑷𝒐𝒖𝒕 = 𝑲𝑷 𝒆(𝒕)
 Integral Term:
The contribution from the integral term is proportional to both the magnitude of the error and
the duration of the error. The integral in a PID controller is the sum of the instantaneous error
over time and gives the accumulated offset that should have been corrected previously. The
accumulated error is then multiplied by the integral gain 𝑲𝒊 and added to the controller output.
𝑰𝒐𝒖𝒕 = 𝑲𝒊 𝒆(𝛕)𝒅𝛕
The integral term accelerates the movement of the process towards set-point and eliminates the
residual steady-state error that occurs with a pure proportional controller. However, since the
integral term responds to accumulated errors from the past, it can cause the present value to
overshoot the set-point value.
 Derivative Term:
The derivative of the process error is calculated by determining the slope of the error over time
and multiplying this rate of change by the derivative gain 𝑲𝒅 . The magnitude of the
contribution of the derivative term to the overall control action is termed the derivative gain 𝑲𝒅 .
Derivative action predicts system behavior and thus improves settling time and stability of the
system.
𝒅𝒆(𝒕)
The derivative term is given by:𝑫𝒐𝒖𝒕 = 𝑲𝒅
𝒅𝒕
𝑲𝑰
PID controller has a transfer function in s-domain: 𝑮𝒄 (𝒔) = 𝑲𝑷 + + 𝑲𝑫 𝒔
𝒔
𝑲𝑰
If we set 𝑲𝒅 = 𝟎, we will have proportional plus integral (PI) controller:𝑮𝒄 (𝒔) = 𝑲𝑷 +
𝒔
If we set 𝑲𝒊 = 𝟎, we will have proportional plus derivative (PD) controller:
𝑮𝒄 (𝒔) = 𝑲𝑷 + 𝑲𝑫 𝒔
𝑲𝑰
PID controller transfer function is: 𝑮𝒄 (𝒔) = 𝑲𝑷 + + 𝑲𝑫 𝒔
𝒔
𝑲𝑫 𝒔𝟐
+ 𝑲𝑰 + 𝑲𝑷 𝒔 𝑲𝑫 (𝒔𝟐 + 𝒂𝒔 + 𝒃) 𝑲𝑫 (𝒔 + 𝒛𝟏 )(𝒔 + 𝒛𝟐 )
𝑮𝒄 (𝒔) = = =
𝒔 𝒔 𝒔
Where 𝑎 = 𝐾𝑃 /𝐾𝐷 and 𝑏 = 𝐾𝐼 /𝐾𝐷 . Therefore, a PID controller introduces a transfer function
with one pole at the origin and two zeros that can be located anywhere in the s-plane. The
closed-loop transfer function is,
𝑮(𝒔)𝑮𝒄 (𝒔)
𝑻(𝒔) =
𝟏 + 𝑮(𝒔)𝑮𝒄 (𝒔)

There are many methods available to determine acceptable values of the PID gains. Two
common methods are Manual PID tuning and Ziegler-Nichols tuning.
Ziegler-Nichols PID Tuning:
The goal of Ziegler Nichols PID tuning method is to find the gains 𝐾 , 𝐾 and 𝐾 appropriately.
This method helps in finding the starting values for the 3 parameters which can then be changed
according to the required design specifications.
The controller output 𝑢(𝑡) is given as:

Where 𝐾 = 𝐾 /𝑇 and 𝐾𝐷 = 𝐾𝑃 𝑇𝑑 .
 Derivative Term:
1) Start with a smaller value of 𝐾𝑃 and set 𝐾 = 𝐾 = 0.
2) Increase the value of 𝐾 until neutral stability (marginal stability) is achieved.
3) Record critical/ultimate gain 𝐾 = 𝐾𝑢 at marginal stability. The best method to find a
precise value of critical/ultimate gain 𝐾𝑢 is to use the Routh-Hurwitz criterion. (If you
use Routh-Hurwitz criterion, then skip step 1 & 2).
4) Store the value of a critical gain in a variable 𝐾𝑢 in MATLAB.
5) Now define the controller variable as
C = pid(Ku);
6) Plot the step response of the overall feedback system. (The step response should be
oscillatory in such a way that step response should neither decay nor grow).
7) Find critical period of oscillation 𝑇𝑢 in seconds and store the variable 𝑇𝑢 in MATLAB.
(You may use data cursors to find the period).
8) Using the values of Ku and 𝑇𝑢, define the variables 𝐾 , 𝑇 and 𝑇 in MATLAB from
the given table below for the desired control type.

9) Define the variable 𝐾 and 𝐾 .


10) Define the pid controller, feedback system and plot the step response.
Routh-Hurwitz Criterion:
𝑭(𝒔) = 𝒔𝟒 + 𝟏𝟎𝒔𝟑 + 𝟑𝟓𝒔𝟐 + 𝟓𝟎𝒔 + 𝟐𝟒
𝒔𝟒 1 35 10𝐾 + 24
𝒔𝟑 10 50 0
𝒔𝟐 30 10𝐾 + 24 0
𝒔𝟏 1260 − 100𝐾 /30 0 0
𝒔𝟎 10𝐾 + 24 0 0
Stability Conditions:
1260 − 100𝐾
> 0 𝑎𝑛𝑑 10𝐾 + 24 > 0 → 1260 − 100𝐾 > 0 𝑎𝑛𝑑 10𝐾 > −24
30
−100𝐾 > −1260 𝑎𝑛𝑑 𝐾 > −2.4 → 𝐾 < 12.6 𝑎𝑛𝑑 𝐾 > −2.4
Range: −𝟐. 𝟒 < 𝑲𝒖 < 𝟏𝟐. 𝟔
FOR marginally stable we use Ku=12.6. Control type is PID (Classic).
PID Classic Controller:
Constant Parameters:
𝐾 = 12.6
𝐾 = 0.6𝐾 = 0.6(12.6) = 7.56
𝑇 = 3.84𝑠 − 1.03𝑠 = 2.81𝑠
𝑇 2.81𝑠
𝑇 = = = 1.405𝑠
2 2
𝑇 2.81𝑠
𝑇 = = = 0.35125𝑠
8 8
𝐾 = 𝐾 𝑇 = 7.56(0.35125) = 2.65545
𝐾 = 𝐾 /𝑇 = 7.56/(1.405) = 5.380782918
 Some control type can be used to reduce the percentage overshoot to less than5% as
shown below:
1) Some Overshoot Response:
Constant Parameters:
𝐾 = 12.6
𝐾 = 𝐾 /3 = 12.6/3 = 4.2
𝑇 = 3.84𝑠 − 1.03𝑠 = 2.81𝑠
𝑇 2.81𝑠
𝑇 = = = 1.405𝑠
2 2
𝑇 2.81𝑠
𝑇 = = = 0.9366666667𝑠
3 3
𝐾 = 𝐾 𝑇 = 4.2(0.9366666667) = 3.934
𝐾 = 𝐾 /𝑇 = 4.2/(1.405) = 2.989323843
2) No Overshoot Response:
Constant Parameters:
𝐾 = 12.6
𝐾 = 0.2𝐾 = 0.2(12.6) = 2.52
. .
𝑇 = 3.84𝑠 − 1.03𝑠 = 2.81𝑠;𝑇 = = = 1.405𝑠; 𝑇 = = = 0.9366666667𝑠
𝐾 = 𝐾 𝑇 = 2.52(0.9366666667) = 2.3604
𝐾 = 𝐾 /𝑇 = 2.52/(1.405) = 1.793594306
Using Different Values of Ku for PID Classic Controller:
1) Ku=8

Constant Parameters:
𝐾 =8
𝐾 = 0.6𝐾 = 0.6(8) = 4.8
𝑇 = 4.42𝑠 − 1.22𝑠 = 3.2𝑠
𝑇 3.2𝑠
𝑇 = = = 1.6𝑠
2 2
𝑇 3.2𝑠
𝑇 = = = 0.4𝑠
8 8
𝐾 = 𝐾 𝑇 = 4.8(0.4) = 1.92
𝐾 = 𝐾 /𝑇 = 4.8/(1.6) = 3
2) Ku=10
Constant Parameters:
𝐾 = 10
𝐾 = 0.6𝐾 = 0.6(10) = 6
𝑇 = 4.12𝑠 − 1.12𝑠 = 3𝑠;𝑇 = = = 1.5𝑠;𝑇 = = = 0.375𝑠
𝐾 = 𝐾 𝑇 = 6(0.375) = 2.25
𝐾 = 𝐾 /𝑇 = 6/(1.5) = 4
3) Ku=18.5

Constant Parameters:
𝐾 = 18.5
𝐾 = 0.6𝐾 = 0.6(18.5) = 11.1
𝑇 = 5.29𝑠 − 2.64𝑠 = 2.65𝑠
𝑇 2.65𝑠
𝑇 = = = 1.325𝑠
2 2
𝑇 2.65𝑠
𝑇 = = = 0.33125𝑠
8 8
𝐾 = 𝐾 𝑇 = 11.1(0.33125) = 3.676875
𝐾 = 𝐾 /𝑇 = 11.1/(1.325) = 8.377358491
Comments:
The general effects of each controller parameter (𝐾 , 𝐾 and 𝐾 ) on a closed-loop system are
summarized as:
Constant Rise Time % Overshoot Settling Time Steady-State
(Increases) Error
𝑲𝑷 Decrease Increases Small Change Decrease
𝑲𝑰 Decrease Increases Increase Zero
𝑲𝑫 Small Change Decreases Decrease No Change
Routh-Hurwitz Criterion:
𝑭(𝒔) = 𝒔𝟑 + 𝟔𝒔𝟐 + 𝟏𝟏𝒔 + 𝟔
𝒔𝟑 1 11 0
𝒔𝟐 6 6+𝐾 0
𝒔𝟏 60 − 𝐾 /6 0 0
𝒔𝟎 6+𝐾 0 0
Stability Conditions:
60 − 𝐾 /6 > 0 𝑎𝑛𝑑 6 + 𝐾 > 0 → 60 − 𝐾 > 0 𝑎𝑛𝑑 𝐾 > −6
−𝐾 > −60 𝑎𝑛𝑑 𝐾 > −6 → 𝐾 < 60 𝑎𝑛𝑑 𝐾 > −6
Range: −𝟔 < 𝑲𝒖 < 𝟔𝟎
FOR marginally stable we use Ku=60.
PI Controller:
Constant Parameters:
𝐾 = 60
𝐾 = 0.45𝐾 = 0.45(60) = 27
𝑇 = 2.52𝑠 − 0.627𝑠 = 1.893𝑠
𝑇 1.893𝑠
𝑇 = = = 1.5775𝑠
1.2 1.2
𝑇 = 0s
𝐾 = 𝐾 𝑇 = 27(0) = 0
𝐾 = 𝐾 /𝑇 = 27/(1.5775) = 17.11568938

PID Controller:
Constant Parameters:
𝐾 = 60
𝐾 = 0.6𝐾 = 0.6(60) = 36
𝑇 = 2.52𝑠 − 0.627𝑠 = 1.893𝑠
𝑇 1.893𝑠
𝑇 = = = 0.9465𝑠
2 2
𝑇 1.893𝑠
𝑇 = = = 0.236625𝑠
8 8
𝐾 = 𝐾 𝑇 = 36(0.236625) = 8.5185
𝐾 = 𝐾 /𝑇 = 36/(0.9465) = 38.03486529
PID Controller (% Overshoot<15 & Ts<5):
Constant Parameters:
𝐾 = 20
𝐾 = 0.6𝐾 = 0.6(20) = 12
𝑇 = 3.83𝑠 − 1.03𝑠 = 2.8𝑠
𝑇 2.8𝑠
𝑇 = = = 1.4𝑠
2 2
𝑇 2.8𝑠
𝑇 = = = 0.35𝑠
8 8
𝐾 = 𝐾 𝑇 = 12(0.35) = 4.2
𝐾 = 𝐾 /𝑇 = 12/(1.4) = 8.571428571

Comments:
When overshoot decreases, settling time also decreases.

Conclusion:
In this lab, I have learnt that how to tune PID Controller and PI Controller to attain desired
response. It captures the history of the system (through integration) and anticipates the future
behavior of the system (through differentiation).

You might also like