0% found this document useful (0 votes)
399 views

Lab Experiment # 10: Demonstration of Ziegler-Nichols Method For Tuning of PID Controller in Matlab Objective

The document describes tuning a PID controller using the Ziegler-Nichols method in MATLAB. It involves setting the integral and derivative gains to zero and increasing the proportional gain from zero until sustained oscillations occur, defining the ultimate gain (Kpo) and period (To). These values are used with the Ziegler-Nichols rules to calculate initial P, PI, and PID gain parameters. The lab experiment involves designing PID controllers for two plant transfer functions using MATLAB code to implement this method.

Uploaded by

Asad saeed
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
399 views

Lab Experiment # 10: Demonstration of Ziegler-Nichols Method For Tuning of PID Controller in Matlab Objective

The document describes tuning a PID controller using the Ziegler-Nichols method in MATLAB. It involves setting the integral and derivative gains to zero and increasing the proportional gain from zero until sustained oscillations occur, defining the ultimate gain (Kpo) and period (To). These values are used with the Ziegler-Nichols rules to calculate initial P, PI, and PID gain parameters. The lab experiment involves designing PID controllers for two plant transfer functions using MATLAB code to implement this method.

Uploaded by

Asad saeed
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Lab Experiment # 10

Demonstration of Ziegler-Nichols method for tuning of PID controller in


MATLAB
Objective:
The objective of the experiment is to tune the PID controller using Ziegler–Nichols method.
In this lab we find the suitable value of constant of Proportional, derivative integral controller.
 Study the tuning of PID controller using Zeigler Nichols method.
 Learn how to implement it on Matlab.

Apparatus:
 Computer having Matlab software
Theory:
Background:
 PID controllers are used more than 95% of the closed loop industrial processes.
 PID controller is widely used due to its simplicity and robustness.
 Frequently faced the task of adjusting the controlling parameters to obtain desired
behavior.
The Ziegler–Nichols tuning method is a heuristic method of tuning a PID controller. It was
developed by John G. Ziegler and Nathaniel B. Nichols. It is performed by setting the I (integral)
and D(derivative) gains to zero. The "P" (proportional) gain, Kp is then increased (from zero)
until it reaches the ultimate gain Kpo, at which the output of the control loop oscillates with a
constant amplitude. Kpo and the oscillation period To are used to set the P, I, and D gains
depending on the type of controller used:
Z–N tuning creates “quarter wave decay". This is an acceptable result for some purposes, but not
optimal for all applications.
 "The Ziegler-Nichols tuning rule is meant to give PID loops best disturbance rejection.
Z–N yields an aggressive gain and overshoot – some applications wish to instead minimize or
eliminate overshoot, and for these Z–N is inappropriate.
For the tune of PID controller first of all find Kpo by applying Routh’s Hurwitz method on the
characteristic equation then put this value of Kpo in the auxiliary equation to find the “ώo”.
Using “ώo” find the time of oscillation by applying following formula: To = 2π/ώo
Ziegler-Nichols (ZN) method:
 The Ziegler-Nichols rule is a heuristic PID tuning rule that attempts to produce good values
for the three PID gain parameters:
Kp - the controller path gain
Ti - the controller's integrator time constant
Td - the controller's derivative time constant
Given two measured feedback loop parameters derived from measurements:
Period Tu of the oscillation frequency at the stability limit
Gain margin Ku for loop stability
Goal is to achieve good regulation (disturbance rejection).
ZN Tuning Method:
Integral and derivative gains are set to zero and proportional gain is increased until the
system starts to oscillate.

Tuning Steps of ZN method:


Start with the closed loop system with a proportional controller.
 Begin with the low value of Kp gain.
 Reduce Ki and Kd to zero.
 Increase Kp from 0 to critical value (Kcr=the ultimate gain) at which sustained
oscillations occur.
 Measure period of oscillation, referred to as the ultimate period.
Evaluation of ZN method
 The Ziegler–Nichols tuning creates a "quarter wave decay". This is an acceptable result
for some purposes, but not optimal for all applications.

 This tuning rule is meant to give PID loops best disturbance rejection.
 Give the good set of initial parameters easily and quickly.
Gain Estimator Chart:
 Controller parameters for the ZN frequency response method which gives controller
parameters in terms of critical gain ‘KcrKpo’ and critical period ‘Pcr To’ will further
help to compute the starting parameters of PID controller.

Then tune the PID controller using following table 10.1:


Table 10.1: PID controller tuning

Controller Kp Ti Ki Td Kd

P 0.5Kpo - - - -

PI 0.4Kpo 0.83To Kp/Ti - -

PID 0.6Kpo 0.5To Kp/Ti 0.125To KpTd


Procedure:
 Open matlab in Computer
 Press ctrl +N to open editor window
 Write desired code for the given tasks in editor window
 Use for loop, if, if else, nested if, and while loop to get required result
 Press Ctrl+S to save the code
 Press ‘Run’ to execute the program
 Observe the output as shown in the figures given above:
 Output as shown in below figures

 Begin with the low value of Kp gain.


 Reduce Ki and Kd to zero.
 Increase Kp from 0 to critical value (Kcr=the ultimate gain) at which
sustained oscillations occur.
 Measure period of oscillation, referred to as the ultimate period.

Task Code

Lab Tasks
Q1:
Design PID Controller using Ziegler Nichols closed loop method using MATLAB?
Plant: G(s) = 64/ [ s3 + 14s2 + 56s + 64 ]

Code:
clc;
close all;
clear all;
sys = tf([64],[1 14 56 64])
for kp0=1:0.01:30
g = 784 - 64*(1 + kp0);
if g==0
break;
end
end
g1=[1 14 56 64+64*kp0];
d=roots(g1);
d1 = imag(d);
d2 = length(d1);
g1=[1 14 56 64+64*kp0];
d=roots(g1);
d1 = imag(d);
d2 = length(d1);
for i=1:d2
w0 =d1(i);
if w0>0
break;
end
end
T0 = 2*pi/w0;
fprintf(' kp0 w0 T0\n')
fprintf('%3f %16.5f %16.5f\n\n',kp0,w0,T0);
disp('Proportional Controller kp')
kp = kp0*0.5;
fprintf('%3f \n\n',kp);
sys1=tf([kp],[1]);
sys2 = series(sys,sys1);
sys3=feedback(sys2,[1])
disp('Proportional_Integral Controller')
fprintf(' kp1 Ti ki\n')
kp1 = 0.4*kp0;Ti = 0.83*T0;ki = kp1/Ti;
fprintf('%3f %16.5f %16.5f\n\n',kp1,ki,Ti);
sys4=tf([kp1 ki],[1 0]);
sys5 = series(sys,sys4);
sys6=feedback(sys5,[1])
disp('Proportional_Integral_Derivative (PID)
Controller')
fprintf(' kp2 Ti1 Td kd ki1\n')
kp2 = 0.6*kp0;Ti1 = 0.5*T0;Td = 0.125*T0;kd
= kp2*Td;
fprintf('%3f %16.5f %16.5f %16.5f
%16.5f\n\n',kp2,Ti1,Td,kd,ki);
sys7=tf([kd kp2 ki],[1 0]);
sys8 = series(sys,sys7);
sys9=feedback(sys8,[1])
step(sys)
hold on
step(sys3)
hold on
step(sys6)
hold on
step(sys9)
Output:
Q2: Design PID Controller using Ziegler Nichols closed loop method using MATLAB?
Plant:
G(s) = 1/ (s + 1)3
Output:
Comments:
PID controllers are used more than 95% of the closed loop industrial processes.
PID controller is widely used due to its simplicity and robustness.
Frequently faced the task of adjusting the controlling parameters to obtain desired behavior.
The Ziegler–Nichols tuning creates a "quarter wave decay". This is an acceptable result for
some purposes, but not optimal for all applications.
This tuning rule is meant to give PID loops best disturbance rejection.
Give the good set of initial parameters easily and quickly.

Conclusion:
The Ziegler-Nichols rule is a heuristic PID tuning rule that attempts to produce good values for
the three PID gain parameters: Kp - the controller path gain. Ti - the controller's integrator time
constant. Td - the controller's derivative time constant. In this paper, PID controller is designed
using Traditional
The Ziegler-Nichols tuning rule is meant to give PID loops best disturbance rejection.
Z–N yields an aggressive gain and overshoot – some applications wish to instead minimize or
eliminate overshoot, and for these Z–N is inappropriate.
It is performed by setting the I (integral) and D(derivative) gains to zero. The "P" (proportional)
gain, Kp is then increased (from zero) until it reaches the ultimate gain Kpo, at which the output
of the control loop oscillates with a constant amplitude. Kpo and the oscillation period To are
used to set the P, I, and D gains depending on the type of controller used:

You might also like