In this control engineering tutorial, we
- Briefly explain the Ziegler-Nichols PID control tuning method. More precisely, we explain the second method based on increasing the proportional gain until stable and persistent oscillations occur in the response.
- Explain how the model of the open-loop system can be combined with the Ziegler-Nichols method to quickly design preliminary PID control parameters.
The YouTube video accompanying this post is given below.
Summary of the Ziegler-Nichols PID Control Tuning Method (Second Method) with Example
The goal is to experimentally determine the parameters of the PID controller:
(1)
where
The first step is to set
(2)
Let the plant be denoted by
where
Assuming that the applied reference input
The Ziegler-Nichols method determines the parameters of the PID controller as follows
(3)
On the other hand, if the controller is the PI controller, then the parameters are
(4)
Let us now illustrate the tuning method. To illustrate the tuning method, we assume that the plant is exactly
(5)
This model is used to simulate the response (to generate the output). However, during the tuning process, we assume that we do not know this plant model. We only use the measured output of this model to obtain the response data. Only on the basis of the observed response data, we perform the PID controller tuning.
We use MATLAB to simulate the response of such a system. MATLAB codes are given later in the text.
The (impulse) response of (5) for
We see that the impulse response “dies out” after some time. This is due to the fact that the closed-loop dynamics is asymptotically stable. The response for
The situation in Fig. 3 is little bit better. However, oscillations are still dying out. Finally, we show the response for
We can see that for approximately
From this graph, we observe the period of the oscillation. The period of the oscillation
We observe the period of oscillation of
By using the Ziegler-Nichols method, we obtain the following parameters:
(6)
We can write the PID controller (1), as follows
(7)
By substituting (6) in (7), we obtain
(8)
We simulate the step response of the closed loop system obtained by using (8). The results are shown in the figure below.
We can observe that the closed-loop system has a zero steady-state error. However, it has a very large overshoot. We can reduce the overshoot by fine-tuning of the PID controller. We can decrease the overshoot by increasing the derivative action. This will decrease the overshoot, and at the same time decrease the speed of the response. To increase the speed of the response we increase the integral gain. The new coefficients are
(9)
The modified controller is
(10)
The figure below compares the closed loop response of the original PID controller (Ziegler-Nichols PID controller) with the modified PID controller (Refined PID controller).
From Fig. 7, we can observe that the overshoot is decreased and that the rise time is improved compared to the initial Ziegler-Nichols PID controller. The MATLAB codes used to generate the graphs are given below.
% open-loop plant
% specify zeros, poles, and gain
close all, clear, clc
zeros=[]
poles=[0,-2,-3]
gain=1
P=zpk(zeros,poles,gain)
% proportional controller
propController=30
% create a closed-loop system
Wcl=feedback(propController*P,1)
% compute an impulse response
figure(1)
impulse(Wcl)
% computed parameters
Kp=0.6*30
Ti=0.5*2.75
Td=0.125*2.75
C_PID=tf([Kp*Td*Ti Kp*Ti Kp],[Ti 0])
zpk(C_PID)
bode(C_PID)
% create a closed-loop system
Wcl2=feedback(C_PID*P,1)
figure(2)
hold on
step(Wcl2)
% increase the integral gain
% increase the derivative gain
Ti2=0.6*Ti
Td2=2.5*Td
C_PID2=tf([Kp*Td2*Ti2 Kp*Ti2 Kp],[Ti2 0])
zpk(C_PID2)
Wcl3=feedback(C_PID2*P,1)
step(Wcl3)
Model-assisted Ziegler-Nichols PID Controller Tuning
Let us now explain how we can speed up the Ziegler-Nichols PID Controller Tuning if we have the model of the system. Let us assume that the model of the system (plant model) given by Eq. (5) is known. Here, for clarity, we rewrite the model.
(11)
In the sequel, we explain how to determine the critical period
Let us assume that the controller is
(12)
Then, the closed-loop characteristic polynomial is determined by the zeros of
(13)
From this equation, we have
(14)
This polynomial can be written as follows
(15)
Self-sustained oscillations occur when the zeros (poles of the transfer function) of the characteristic polynomial are purely imaginary. That is, the zeros have the following form
(16)
The complex polynomial is equal to zero when both its real and imaginary parts are zero. By using this fact, from (16), we see that the following two equations need to be satisfied (one for the real part and another for the imaginary part)
(17)
Since
(18)
On the other hand, we have
(19)
where
(20)
This value is very close to the value of
(21)
and that is precisely the value of the critical gain that we have experimentally determined! Since we have determined the critical period and the critical gain from the plant model, from here, we can use the Ziegler-Nichols equations (6) to design the parameters of the PID controller.
To summarize, we learned how to use the model of the plant to quickly determine the critical period and the critical gain that can be used to design the Ziegler Nichols PID controller.