3.4: PID Control and Its Gain Tuning Methods

Mechatronics: Fundamentals, Design, Integration, and Validation · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    3.4: PID Control and Its Gain Tuning Methods
    Learning Objectives

    After completing this section, you will be able to:

    1. Describe the structure of the PID (proportional-integral-derivative) controller.
    2. Understand the system performance variation as a function of individual PID gain (proportional, integral, and derivative).
    3. Tune these PID gains using the Ziegler-Nichols methods.
    4. Tune these PID gains using the direct-tuning method.

    This section presents PID (proportional-integral-derivative) control and its gain tuning approach. Closed-loop control strategies can be divided into two groups: model-free and model-based ones, where the PID control is model-free. As a result, its gains need to be tuned to optimize closed-loop system performance such as settling time and percentage overshoot. It is well-known that PID control gain tuning heavily relies on experience; however, only a few gain-tuning methods will be introduced in this section. PID controllers are widely used in many industries (such as chemical process, robotics, and automotives) due to their simplicity and relatively good closed-loop performance. We will introduce the structure of a PID controller first. See Figure 3.22 for its block diagram and equation \ref{3.67} for its mathematical representation in the time domain, where the proportional, integral, and derivative gains are denoted by \(K_p\), \(K_i\), and \(K_d\).

    \[u\left(t\right)=K_pe\left(t\right)+K_i\int^t_0{e\left(τ\right)dτ}+K_d\dfrac{de(t)}{dt}\ \ \label{3.67}\]

    A block diagram of a negative feedback control system with a PID controller marked with its proportional, integral, and derivative gains.
    Figure 3.22: Continuous-time PID controller structure.

    The associated PID controller transfer function is shown below.

    \[C\left(s\right)=\dfrac{U(s)}{E(s)}=K_p+\dfrac{K_i}{s}+K_ds=K_p\left(1+\dfrac{K_i}{K_ps}+\dfrac{K_ds}{K_p}\right)\ \ \label{3.68}\]

    Normally, for any PID controller, the proportional gain will not be set to zero. In practical applications, to avoid amplification of the high frequency noise in \(e\left(t\right)\) due to the differentiation operation, the derivative from equation \ref{3.68} is often implemented as low-pass filtered differentiation, as below.

    \[K_ds\approx \dfrac{K_ds}{τ_ds+1}\ \ \label{3.69}\]

    where \(τ_d\) is the time constant of the first order lowpass filter. Normally the value of \(τ_d\) can be selected below the system sensor high frequency noise corner frequency \(\left(1/τ_d<ω_{sensor}\right)\) and above the bandwidth of system plane dynamics \(\left(1/τ_d>ω_{system}\right)\). Industrial applications have two other forms of PID controllers, called PI and PD controllers. The PI control strategy is formed by setting derivative gain to zero as below.

    \[C\left(s\right)=K_p+\dfrac{K_i}{s}=K_p\left(1+\dfrac{K_i}{K_ps}\right)\ \ \label{3.70}\]

    Note that the PI controller is often used for certain systems not requiring fast response but with zero steady-state error. These systems are very popular for chemical reaction process applications, where eliminating steady-state error is important. The PD controller is shown below with integral gain set to zero.

    \[C\left(s\right)=K_p+K_ds=K_p\left(1+\dfrac{K_ds}{K_p}\right)\ \ \label{3.71}\]

    Note that a PD controller is often used for systems requiring fast response but without a steady-state error requirement. These systems are very important for many mechatronic and robotic systems, where fast response is extremely important. Example 3.12 shows the effect of proportional, integral, and derivative gains.

    Example 3.12

    Consider the system diagram shown in Figure 3.22 with its plant transfer function shown below.

    \[P\left(s\right)=\dfrac{1}{{\left(s+1\right)}^3}\ \ \label{3.72}\]

    Let’s start by considering a proportional controller, \(P\left(s\right)=K_p\), with reference signal \(r\left(t\right)=u(t)\), a unit step input. From the simulated responses shown in Figure 3.23, we can observe two main characteristics. First, there exists steady-state error with steady-state response \(y_{ss}\) below the reference \(r\left(t\right)=1\). The steady state error reduces as the proportional control gain increases. Second, high proportional gain leads to fast response with reduced stability (increased overshoot and oscillations).

    A step response plot of a proportional controller with its gain equal to 1, 2, and 5 for a third-order plant model.
    Figure 3.23: Step responses of proportional controllers.

    Next, we consider a proportional-integral controller, \(P\left(s\right)=K_p+K_i/s\), with unit step reference signal \(r\left(t\right)=u(t)\) and \(K_p=1\). From the simulated responses shown in Figure 3.24, we can make two observations. First, the steady-state error is eliminated by nonzero integral gain when the system is stable. Second, high integral gain reduces response time with increased oscillations and overshoot (or reduced relative stability). Therefore, it is a tradeoff relationship: integral gain increases with improved response time, but with reduced relative stability (increased overshoot).

    A step response plot of a proportional and integral controller with a fixed proportional gain of 1 and integral gains of 0, 0.2, 0.5, and 1 for a third-order plant model.
    Figure 3.24: Step responses of proportional-integral (PI) controllers.

    Lastly, we consider the proportional-integral-derivative (PID) controller, \(P\left(s\right)=K_p+K_i/s+K_ds\), with step reference signal \(r\left(t\right)=u(t)\), \(K_p=2.5\), and \(K_i=1.5\). From the simulated responses shown in Figure 3.25, we can make three observations. First, the steady state error is eliminated due to nonzero integral gain. Second, high derivative gain increases system damping. Third, however, extremely large derivative gain could make response performance worsen (or with reduced relative stability). As a result, increasing derivative gain improves response time, but large derivative gain could reduce relative stability (slow response).

    From the study above, we can see that when \(K_p=2.5\), \(K_i=1.5\), and \(K_d=2.0\), the system response performance is reasonably good with the settling time about 2 seconds and percentage overshoot (PO) about 15%.

    A step response plot of a proportional-integral-derivative controller with a fixed proportional gain of 2.5, fixed integral gain of 1.5, and derivative gains of 0, 1, 2, and 4 for a third-order plant model.
    Figure 3.25: Step responses of proportional-integral-derivative (PID) controllers.

    PID control gains can be tuned in two ways: model-based and model-free. One of the typical model-based tuning method is based on root locus analysis [1]. Note that a root locus plots the system’s closed-loop pole locations as a function of selected gain from zero to infinity. As a result, PID gains can be tuned one-by-one [1]. On the other hand, PID gains can also be designed by model-based approaches [17]. In this book, we will mainly address the model-free PID gain tuning methods.

    We start with the Ziegler-Nichols PID gain tuning method [3], introduced in 1942. In general, this method is suitable for stable systems with any level of complexity when trial-and-error gain tuning is allowed. There are two approaches for Ziegler-Nichols PID gain tuning. The first approach is called “step response method” based on parameters, \(τ\) and \(α\), defined in Figure 3.26, where the steepest tangent (red line) can be drawn based on the stable (converged) system step response. As a result, the “step response method” method is limited to stable systems because the step response will diverge for unstable systems.

    A step response plot graphically defining the two parameters used in Zeigler-Nichols' step response method.
    Figure 3.26: Zeigler-Nichols’ step response method.

    Reorganize the PID controller into the following form, where \(T_i=K_p/K_i\) and \(T_d=K_d/K_p\).

    \[C(s)=K_p\left(1+\dfrac{1}{T_is}+T_ds\right)\ \ \label{3.73}\]

    To tune the PID controller gains, find the open-loop system step response. Draw the steepest tangent line as shown in Figure 3.26, and find the two parameters, \(τ\) and \(α\), marked on Figure 3.26. The Ziegler-Nichols step response method defines gains for proportional (P), proportional-integral (PI), and proportional-integral-derivative (PID) controllers, as seen in Table 3.5. When the controller migrates from proportional (P) controller to proportional-integral (PI) controller, the proportional gain \(K_p\) is reduced from \(1/α\) down to \(0.9/α\). This change indicates that adding integral control will reduce system relative stability and that proportional gain needs to be reduced. Also, when the controller migrates from a proportional-integral (PI) controller to a proportional-integral-derivative (PID) controller, the proportional gain \(K_p\) is increased from \(0.9/α\) up to \(1.2/α\), indicating that adding derivative control increases system relative stability.

    Controller type \(K_p\) \(K_i\) \(K_d\)
    \(P\) \(1/α\)    
    \(PI\) \(0.9/α\) \(3τ\)  
    \(PID\) \(1.2/α\) \(2τ\) \(0.5τ\)
    Table 3.5: Ziegler-Nichols step response gain table.

    The second approach, called the “ultimate sensitivity method” is based on parameters, \(K_c\) and \(T_c\). It is defined in Figure 3.27. For the closed-loop system (shown in Figure 3.22) with a proportional controller, the ultimate sensitivity time response is obtained by gradually increasing the proportional gain until steady oscillation response is occurred. The two coefficients \(K_c\) and \(T_c\) are the proportional gain leading to steady oscillations and the oscillation period, respectively. This also means that applying the ultimate sensitivity method does not require the open-loop system to be stable. The only requirement is that the system can be stabilized by a proportional controller. Therefore, the ultimate sensitivity method has a broader application than the step response method.

    A step response with steady oscillations graphically defining the oscillation period parameter used in Zeigler-Nichols' ultimate sensitivity method.
    Figure 3.27: Ziegler-Nichols ultimate sensitivity method.

    After the two parameters, \(K_c\) and \(T_c\), are found, the Ziegler-Nichols ultimate sensitivity method defines gains for proportional (P), proportional-integral (PI), and proportional-integral-derivative (PID) controllers in Table 3.6. As with the step response method, when the controller migrates from proportional (P) controller to proportional-integral (PI) controller, the proportional gain \(K_p\) is reduced from \(0.5K_c\) down to\(\ 0.4K_c\); this indicates that adding integral control will reduce system relative stability and that proportional gain needs to be reduced. Also, when the controller migrates from proportional-integral (PI) controller to proportional-integral-derivative (PID) controller, the proportional gain \(K_p\) is increased from \(0.4K_c\) up to \(0.6K_c\); this indicates that adding derivative control increases system relative stability. In addition, the integral gain is reduced from \(0.8T_c\) down to \(0.5T_c\). Below, we will present an example of applying the Ziegler-Nichols methods.

    Controller type \(K_p\) \(K_i\) \(K_d\)
    \(P\) \(0.5K_c\)    
    \(PI\) \(0.4K_c\) \(0.8T_c\)  
    \(PID\) \(0.6K_c\) \(0.5T_c\) \(0.125T_c\)
    Table 3.6: Ziegler-Nichols ultimate sensitivity gain table.
    Example 3.13

    Next, we will use the same plant model as that in Example 3.12. Figure 3.28 plots the step response and the steepest tangent line. The corresponding parameters are obtained as \(τ=0.79\) and \(α=0.28\). As a result, proportional, proportional-integral, and proportional-integral-derivative gains can be calculated using Table 3.5; they are listed in Table 3.7 along with well-tuned PID gains.

    A step response for Example 3.13 showing the graphical calculation of the two parameters used in Zeigler-Nichols' step response method.
    Figure 3.28: Ziegler-Nichols step response method for Example 3.13.
    Controller type \(K_p\) \(K_i\) \(K_d\)
    \(P\) \(3.57\)    
    \(PI\) \(3.21\) \(2.37\)  
    \(PID\) \(4.29\) \(1.58\) \(0.395\)
    Well-tuned 2.5 1.5 2.0
    Table 3.7: Ziegler-Nichols step response gains for Example 3.13.

    With the proportional, proportional-integral, and proportional-integral-derivative control gains calculated, we can conduct simulation studies. The associated results, which can be found in Figure 3.29, indicate that the time responses for P, PI, and PID controllers have a lot of oscillations. To be more specific, the overshoot of PI control is about 60% and that of PID control is about 48%.

    Step responses with P, PI, and PID control gains from the Ziggler-Nicholes step response method for Example 3.13.
    Figure 3.29: Step responses with gains from Ziegler-Nichols step response method.

    Normally we would like to keep the percentage overshoot of closed-loop systems below 15%. Therefore, the relative stability of PI and PID controllers with gains from the step response method of Ziegler-Nichols is poor. We may need to use these gains as the initial gains and detune these gains to get satisfactory performance. The “well-tuned” gains in Table 3.7 are from Example 3.12, with its step response presented in Figure 3.25. Comparing these gains with the gains from the step response method, the proportional gain is reduced, and the derivative gain is increased.

    Four step response plots for Example 3.13 with proportional gain of 1, 2, 4, and 8 showing how to select proportional gain for the Ziggler-Nichols' ultimate sensitivity method to obtain oscillation period.
    Figure 3.30: Ziegler-Nichols ultimate sensitivity method for Example 3.13.

    Now let’s look into the ultimate sensitivity method. Figure 3.30 plots the ultimate sensitivity step response with proportional gain increased from \(K_p=1\) to \(K_p=8\). When \(K_p=8\), the step responses become marginally stable, oscillating with a constant magnitude and period. As a result, we can determine that \(K_c=8\) and \(T_c=3.7\). Proportional, proportional-integral, and proportional-integral-derivative gains can then be calculated. These gains are listed in Table 3.8 along with well-tuned PID gains.

    Controller type \(K_p\) \(K_i\) \(K_d\)
    \(P\) \(4.0\)    
    \(PI\) \(3.2\) \(2.96\)  
    \(PID\) \(4.8\) \(1.85\) \(0.463\)
    Well-tuned 2.5 1.5 2.0
    Table 3.8: Ziegler-Nichols ultimate sensitivity gains for Example 3.13.

    Simulation studies were conducted with the proportional (P), proportional-integral (PI), and proportional-integral-derivative (PID) control gains calculated in Table 3.8. Figure 3.31 shows the associated results. The time responses for P, PI, and PID have a lot of oscillations, but less than those from the step response method. To be more specific, the overshoot of PI control is about 52% whereas that of PID control is about 38%. Note that we would like to keep the percentage overshoot of closed-loop systems below 15%. Therefore, the relative stability of PI and PID controllers with gains from the ultimate sensitivity method of Ziegler-Nichols is poor. Again, we may use these gains as the initial gains, then decrease them to get satisfactory performance. In Table 3.8, the “well-tuned” gains are from Example 3.12 with its ultimate sensitivity presented in Figure 3.25. Comparing these gains with the gains from the ultimate sensitivity, the proportional gain is reduced, and the derivative gain is increased significantly.

    Three step responses with P, PI, and PID control gains from the Ziggler-Nicholes ultimate sensitivity method for example 3.13.
    Figure 3.31: Step responses with gains from the Ziegler-Nichols ultimate sensitivity method.

    Before finishing this section, let’s look at a direct-tuning method for PID controllers, based on the author’s industrial experience. The direct-tuning method is somewhat similar to the ultimate sensitivity method. It uses the following steps, and this method is suitable for those systems that can be stabilized by a proportional gain.

    • Step 1: Start with all two gains (\(K_i\) and \(K_d\)) equal to zero, with \(K_P\) stabilizing the system.
    • Step 2: Increase \(K_P\) graduately until the system is marginally stable (steady oscillations in output response observed). Then set \(K_P\) to 0.4 to 0.5 time of the corresponding valve. For simulation study, continuously increasing \(K_P\) could cause diverged oscillations; the \(K_P\) value making steady oscillation will be used to set \(K_p\) gain.
    • Step 3: With the selected \(K_P\), gradually increase gain \(K_i\) until the system is marginally stable (steady oscillations in output response observed). Then set \(K_i\) to 0.4 to 0.5 time of the corresponding valve. Similarly, for simulation study, continuously increasing \(K_i\) could cause diverged oscillations; the \(K_i\) value making steady oscillation will be used to set \(K_i\) gain.
    • Step 4: Gradually increase the derivative gain for \(K_d\) to achieve the desired performance (only if required transient response time is not satisfactory).
    • Step 5: As needed, repeat the process from Steps 2 to 4 with calibrated gains, or manually tune.

    After these gains are tuned from the process stated above, fine-tuned gains can be used to finalize the PID control gain tuning. Note that increasing proportional (or integral) gain would improve the system response time, but it would also reduce the system relative stability (increase overshoot)—a tradeoff relationship. Meanwhile, increasing the derivative gain could improve system relative stability (reduce overshoot), but it could increase the system sensitivity to noise. In general, continuously increasing system gains will lead to system instability. Example 3.14 looks at using the direct-tuning method for gain tuning.

    Example 3.14

    We will use the same plant model as that in Examples 3.12 and 3.13. In Example 3.13, when studying the ultimate sensitivity method, we found that when \(K_p=8\) with \(K_i=\ K_d=0\), the step response oscillates with a fixed magnitude (Figure 3.30). Based on Step 2 of the direct-tuning method, the gain \(K_p\) is fixed at \(0.4\times 8=3.2\). Then in Step 3 of the direct-tuning method, we vary gain \(K_i\) with \(K_p=3.2\) and \(\ K_d=0\).

    Figure 3.32 shows the system step response with \(K_i=1,\ 2,\ 2.25\), and \(2.5\). We can see that when \(K_i=2.25\), the step response (red line) oscillates with a constant magnitude. When \(K_i=2.5\), the step response (green line) oscillates with an increased magnitude. Therefore, integral gain \(K_i\) is selected as \(K_i=2.25\times 0.4=0.9\) in Step 3 of the direct-tuning method.

    Four step responses for Example 3.14 with P and D gains of 3.2 and 0, respectively, and I gain of 1, 2, 2.25, and 2.5 showing how to find steady oscillation integral gain of 2.25 for the direct-tuning method.
    Figure 3.32: Step responses with \(K_p=3.2\), varying \(K_i\), and \(K_d=0\) for the direct-tuning method.

    Now, we proceed to Step 4. We will gradually increase the derivative gain to have desired performance with target overshoot to be less than 15%. With proportional gain \(K_p\mathrm{=3.2}\) and integral gain \(K_i\mathrm{=0.9,}\) the derivative gain was set to \(K_d\mathrm{=0.5,\ 1.0,\ 1.5}\), and 2.0. Figure 3.33 shows the associated step responses.

    Four step responses for Example 3.14 with P and I gains of 3.2 and 0.9, respectively, and D gain of 0.5, 1.0, 1.5, and 2.0 showing how to find optimal derivative gain of 1.5 for the direct-tuning method.
    Figure 3.33: Step responses with \(K_p=3.2\), \(K_i=0.9,\) and varying \(K_d\) for the direct-tuning method.

    Table 3.9 presents calculated settling time and percentage overshoot. We can see that when \(K_d\mathrm{=1.5}\), we have a satisfactory response performance with 5% settling time of around 6 seconds and percentage overshoot (PO) of 12.7% (below the 15% target). Therefore, the derivative gain is selected as \(K_d\mathrm{=1.5}\).

    Derivative gain \(K_d\) \(0.5\) \(1.0\) \(1.5\) \(2.0\)
    5% settling time (s) \(8.65\) \(6.42\) \(5.97\) 5.39
    Overshoot (PO) \(30.8\%\) 20.7% \(12.7\%\) 6.7%
    Table 3.9: Direct-tuning settling time and percentage overshoot as a function of gain \(K_d.\)

    Table 3.10 compares the PID gains obtained earlier, where well-tuned gains are from Example 3.12, the step response and ultimate sensitivity gains are based on the Ziegler-Nichols method in Example 3.13, and the direct tuning gains are from this example (Example 3.14). From these examples, we found that both well-tuned and direct tuning gains provide good response performances. Although the Ziegler-Nichols methods provide relatively aggressive gains, they need to be detuned to get satisfactory performance. For the proportional gains, Ziegler-Nichols gains are large with direct tuning in the middle. The direct tuning integral gain is the smallest among all gains, and for the derivative gains, the Ziegler-Nichols method provides the lowest gains.

    Controller type \(K_p\) \(K_i\) \(K_d\)
    Well-tuned 2.5 1.5 2.0
    Step response \(4.29\) \(1.58\) \(0.395\)
    Ultimate sensitivity \(4.8\) \(1.85\) \(0.463\)
    Direct tuning 3.2 0.9 1.5
    Table 3.10: PID gain comparison.

    As a summery, PID control is the most popular control method used in industry since it is model-free with a simple control structure, easy to tune, and widely applicable. The Ziegler-Nichols method provides a starting-point for gain tuning, rather than final control gains in a single shot. The direct tuning method provides an easy way for PID gain tuning, but it may require certain control tuning experience. In addition, the gain set achieving desired performance target is not unique.

    Section Summary

    In practical applications, PID (proportional-integral-derivative) controllers are widely used due to their simplicity and easy gain tuning. A PID controller has only three control parameters (proportional, integral, and derivative gains), which makes controller gain tuning easy. We addressed the Ziegler-Nichols PID gain tuning rules in detail [3]. Normally the Ziegler-Nichols PID gains can be used as initial PID controller gains for gain tuning. We also presented an ad hoc (direct) PID control gain tuning method. In industrial applications, PID gains are often scheduled as a function of response error to improve closed-loop system performance. Section 3.6 will use examples to demonstrate how the gain scheduled PID control can improve system performance.

    Section Keywords

    Practice Problems

    1.  Tune PID control gains with Zeigler-Nichols methods (both step response and ultimate sensitivity methods) for the following plant model used in Examples 3.12, 3.13, and 3.14. \[P(s)=\frac{1}{(s+1)^3} \nonumber\]
    2. Tune PID control gains with the direct tuning method for the following plant model used in Examples 3.12, 3.13, and 3.14. \[P(s)=\frac{1}{(s+1)^3} \nonumber\]

    This page titled 3.4: PID Control and Its Gain Tuning Methods was last modified on Sun, 23 Aug 2026 00:40:16 GMT and is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Guoming Zhu (Co-DREAM OER) .