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 is the proportional gain, is the parameter of the integral action, and is the parameter of the proportional action.
The first step is to set and to set (in practice, this is a very large value). That is, we only leave the proportional action. In that case, the controller is
(2)
Let the plant be denoted by . Then, we have the following block diagram of the closed-loop system
where is the reference input (signal) and is the output of the closed-loop system.
Assuming that the applied reference input is an impulse (in practice, this can be a short pulse), our goal is to find the gain that produces stable and persistent oscillations of the output signal . Starting from zero, we keep on increasing until stable oscillation is observed. We read the period of such a stable oscillation. The period of stable oscillations is called the critical period or the ultimate period. The period is the input parameter for designing the PID controller. Let be the proportional gain that produces the stable oscillation. The proportional gain that produces the stable oscillation is called the critical gain or the ultimate gain.
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 is given below.
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 is given below.
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 , the impulse response becomes completely oscillatory and the oscillations are stable and persistent. On the other hand, if we increase the gain more, we will observe unable oscillations.
From this graph, we observe the period of the oscillation. The period of the oscillation is shown in the figure below.
We observe the period of oscillation of seconds. This is the main input parameter for designing the PID controller.
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 and the critical gain without using the experimental data, that is, by only using the model of the system. In this way, we can decrease the experimental time duration, and obtain sufficiently accurate estimate of the critical gain . We can then test this gain and see if this gain produces the stable oscillations. If it does not, this means that our model is not accurate. However, even if the model is not accurate, the computed value of that is based on the inaccurate model can be a starting point for searching more appropriate value of the critical gain.
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 , where is the angular frequency. By substituting in (15), we obtain
(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 cannot be the solution, from the second equation, we obtain
(18)
On the other hand, we have
(19)
where is the previously introduced critical period. By substituting (18) in (19), we obtain
(20)
This value is very close to the value of that we found from Fig. 5. On the other hand, from the first equation in (17) and from (18), we find that
(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.