5.8. Ziegler-Nichols PID controller design#

Ziegler and Nichols proposed rules for determining values of the proportional gain \(K_p\), integral time \(T_i\), and derivative time \(T_d\) based on the transient-response characteristics of a given plant. Such determination of the parameters of PID controllers or tuning of PID controllers can be made by engineers on-site by experimenting on the plant. (Numerous tuning rules for PID controllers have been proposed since Ziegler and Nichols offered their rules. Here, however, we introduce only the Ziegler-Nichols tuning rules.) The two methods called Ziegler-Nichols tuning rules are aimed at obtaining 25% maximum overshoot in the step response.

step4

Fig.11 - Unit-step response of a plant.

5.8.1. First method#

In the first Ziegler-Nichols method, we obtain the response of the plant to a unit-step input experimentally, as shown in Figure 11. If the plant involves neither integrators nor dominant complex-conjugate poles, then such a unit-step response curve may look like an S-shaped curve, as shown in Figure 12. (If the response does not exhibit an S-shaped curve, this method does not apply.) Step-response curves of this nature may be generated experimentally or from a dynamic simulation of the plant. The S-shaped curve may be characterized by two constants-the delay lime L and a time constant T determined by drawing a line tangent to the S-shaped curve at the inflection point. These constants are determined by the intersections of the tangent line with the time axis and the line C(t) = K, as shown in Figure 12. The transfer function C(s)/U(s) may then be approximated by a first-order system with a transport lag as follows:

\[\begin{align*} \frac{C(s)}{U(s)} &= \frac{ke^{-Ls}}{Ts+1} \nonumber \end{align*}\]

Ziegler and Nichols suggested setting the values of \(K_p,T_i\), and \(T_d\), according to the formula shown in the table below:

Type of controller

\(K_p\)

\(T_i\)

\(T_d\)

P

\(\frac{T}{L}\)

\(\infty\)

\(0\)

PI

\(0.9\frac{T}{L}\)

\(\frac{L}{0.3}\)

\(0\)

PID

\(1.2\frac{T}{L}\)

\(2L\)

\(0.5L\)

S-shaped

Fig.12 - S-shaped response curve.

5.8.2. Second method#

In the second Ziegler-Nichols method, we first set \(T_i=\infty\) and \(T_d=O\). Using the proportional control action only (see Figure 13), we increase \(K_p\) from 0 to a critical value \(K_{cr}\) at which the output first exhibits sustained oscillations. (If the output does not exhibit sustained oscillations for whatever value \(K_p\) may take, then this method does not apply.) Thus the critical gain \(K_{cr}\) and the corresponding period \(P_{cr}\) are determined experimentally. (See Figure 13.) Ziegler and Nichols suggested that we set the values of the parameters \(K_p\), \(T_i\) and \(T_d\), according to the formula shown in the table below.

Period

Fig.13 - Sustained oscillation with per Period \(P_{cr}\)

Type of controller

\(K_p\)

\(T_i\)

\(T_d\)

P

\(0.5K_{cr}\)

\(\infty\)

\(0\)

PI

\(0.45K_{cr}\)

\(\frac{1}{1.2}P_{cr}\)

\(0\)

PID

\(0.6K_{cr}\)

\(0.5P_{cr}\)

\(0.125P_{cr}\)

5.8.3. Comments#

Ziegler-Nichols tuning rules have been widely used to tune PID controllers in process control systems for which the plant dynamics are not precisely known. Over many years, such tuning rules have proved to be highly useful. Ziegler-Nichols luning rules can, of course, be applied to plants whose dynamics are known. (If plant dynamics are known, many analytical and graphical approaches to the design of PID controllers are available in addition to Ziegler-Nichols tuning rules.)

If the transfer function of the plant is known, a unit-step response may be calculated or the critical gain \(K_{cr}\) and critical period \(P_{cr}\) may be calculated. Then, with those calculated values, it is possible to determine the parameters \(K_p\), \(T_i\), and \(T_d\) from both tables above. However, the real usefulness of Ziegler-Nichols tuning rules (and other tuning rules) becomes apparent when the plant dynamics are not known, so that no analytical or graphical approaches to the design of controllers are available.

Generally, for plants with complicated dynamics, but no integrators, Ziegler-Nichols tuning rules can be applied. If, however, the plant has an integrator, the rules may not be applicable in some cases, either because the plant does not exhibit the S-shaped response or because the plant does not exhibit sustained oscillations no matter what gain K is chosen. If the plant is such that Ziegler-Nichols rules can be applied, then the plant with a PID controller tuned by such rules will exhibit approximately 10% to 60% maximum overshoot in step response. On the average (obtained by experimenting on many different plants), the maximum overshoot is approximately 25%. (This is quite understandable, because the values suggested in the tables above are based on the average.) In a given case, if the maximum overshoot is excessive, it is always possible (experimentally or otherwise) to fine-tune the closed-loop system so that it will exhibit satisfactory transient responses. In fact, Ziegler-Nichols tuning rules give an educated guess for the parameter values and provide a starting point for fine-tuning.

5.8.4. Ziegler-Nichols using software#

Example: Use the second Ziegler-Nichols method to design a PI controller for following system:

\[\begin{align*} H(s) = \frac{4}{(s+3)(s+1)(s+8)} \end{align*}\]
from control.matlab import *
import numpy as np 
import matplotlib.pyplot as plt # Load the pyplot object fromthe matplotlib library 
from Mycode import response


plt.close('all') 

[num,den]=zpk2tf([],[-3,-1, -8],4)
sys = TransferFunction(num,den)

r,k = rlocus(sys)

## find the marginally stable gain K

Pcr = 6/(2*np.pi) 
Kcr = 99  

yout,T = step(feedback(Kcr*sys,1))

fig= plt.figure()
plt.plot(T,yout)
plt.grid()
plt.show()

Kp = 0.45*Kcr 
Ti = 1/(1/1.2*Pcr)

C =TransferFunction([Kp,Kp/Ti],[1,0])

T = np.linspace(0.0, 20,num=100)
yout,T = step(feedback(C*sys,1),T)
wn,d,p= damp(feedback(C*sys,1))
fig= plt.figure()
plt.plot(T,yout)
plt.grid()
plt.show()

Ov,Tr,Ts = response(yout,T)

print("Percentage overshoot:%1.f"%Ov,'%')
print("Rise time:%2.2f"%Tr,'seconds')
print("Settling time:%2.2f"%Ts,'seconds')
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from control.matlab import *
      2 import numpy as np 
      3 import matplotlib.pyplot as plt # Load the pyplot object fromthe matplotlib library 

ModuleNotFoundError: No module named 'control'