The PID controller
4.2 The industrial PID algorithm
This section describes how to implement a simple continuous-time PID controller. We will start with the classical textbook algorithm, although for practical and implementation reasons indus-trially available PID controllers are never this simple for reasons which will soon become clear.
Further details on the subtlety of implementing a practical useful PID controller are described in [53] and the texts [13,15,98].
The purpose of the PID controller is to measure a process error ǫ and calculate a manipulated ac-tion u. Note that while u is referred to as aninputto the process, it is theoutputof the controller.
The “textbook” non-interacting continuous PID controller follows the equation
u = Kc
where the three tuning constants are the controller proportional gain, Kc, the integral time, τi
and the derivative time, τd, the latter two constants having units of time, often minutes for in-dustrial controllers. Personally, I find it more intuitive to use the reciprocal of the integral time, 1/τi, which is called reset and has units of repeats per unit time. This nomenclature scheme has the advantage that no integral action equates to zero reset, rather than the cumbersome infinite integral time. Just to confuse you further, for some industrial controllers to turn off the integral component, rather than type in something like 99999, you just type in zero. It is rare in engineer-ing where we get to approximate infinity with zero! Table4.1summarises these alternatives.
Table 4.1: Alternative PID tuning parameter conventions
Parameter symbol units alternative symbol units
Gain Kc input/output Proportional band P B %
integral time τi seconds reset 1/τi seconds−1
derivative time τd seconds
The Laplace transform of the ideal PID controller given in Eqn.4.1is U (s)
and the equivalent block diagram in parallel form is
1
where is is clear that the three terms are computed in parallel which is why this form of the PID controller is sometimes also known as the parallel PID form.
We could rearrange Eqn.4.2in a more familiar numerator/denominator transfer function format,
C(s) = Kc τiτds2+ τis + 1
τis (4.3)
where we can clearly see that the ideal PID controller is not proper, that is, the order of the numerator (2), is larger than the order of the denominator (1) and that we have a pole at s = 0.
We shall see in section4.2.1that when we come to fabricate these controllers we must physically have a proper transfer function, and so we will need to modify the ideal PID transfer function slightly.
4.2.1 Implementing the derivative component
The textbook PID algorithm of Eqn. 4.2includes a pure derivative term τds. Such a term is not physically realisable, and nor would we really want to implement it anyway, since abrupt changes in setpoint would cause extreme values in the manipulated variable.
There are several approximations that are used in commercial controllers to address this problem.
Most schemes simply add a small factory-set lag term to the derivative term. So instead of simply τds, we would use
derivative term = τds τd
Ns + 1 (4.4)
where N is a large value, typically set to a large number somewhere between 10 and 100. Using this derivative term modifies the textbook PID transfer function of Eqn.4.2or Eqn.4.3to
C(s) = Kc
1 + 1
τis+ τds
τd
Ns + 1
(4.5)
= Kc (τiτd+ τiτdN ) s2+ (τiN + τd)s + N τis (τds + N )
(4.6) which is now physically realisable. Note that as N → ∞, the practical PID controller of Eqn.4.6 converges to the textbook version of Eqn.4.3. The derivative-filtered PID controller of Eqn.4.6 collapses to a standard PI controller if τd= 0.
We can fabricate in MATLABthe transfer function of this D-filtered PID controller with thepidstd command which MATLABrefers to as a PID controller in standard form.
Listing 4.1: Constructing a transfer function of a PID controller
>> C = pidstd(1,2,3,100) %Construct a standard form PID controller Continuous-time PIDF controller in standard form:
3
%C(s) = Kp
1 +τ1
is+ τdτds Ns+1
with Kp = 1, Ti = 2, Td = 3, N = 100
The generated controller is of a special class known as apidstd, but we can convert that to the more familiar transfer function with the now overlayedtfcommand.
>> tf(C)
Transfer function:
4 101 sˆ2 + 33.83 s + 16.67
---sˆ2 + 33.33 s
A related MATLABfunction,pid, constructs a slight modification of the above PID controller in what MATLABrefers to as parallel form,
Cparallel(s) = P + I/s + D s τfs + 1
where in this case as the derivative filter time constant, τf, approaches zero, the derivative term approaches the pure differentiator.
4.2.2 Variations of the PID algorithm
The textbook algorithm of the PID controller given in Eqn.4.2is sometimes known as the par-allel or non-interacting form, however due to historical reasons there is another form of the PID controller that is sometimes used. This is known as the series, cascade or interacting form
G′c(s) =Kc′
where the three series PID controller tuning constants,Kc′,τi′ andτd′ are related to, but distinct from, the original PID tuning constants,Kc,τiandτd. A block diagram of the series PID controller is given below.
A series PID controller in the form of Eqn.4.7can always be represented in parallel form Kc=Kc′τi′+τd′
τi′ , τi=τi′+τd′, τd = τi′τd′
τi′+τd′ (4.8)
but not necessarily the reverse
Kc′ = Kc since a series form only exists ifτi > 4τd. For this reason, the series form of the PID controller is less commonly used, although some argue that it is easier to tune, [186]. Note that both controller forms are the same if the derivative component is not used. A more detailed discussion on the various industrial controllers and associated nomenclatures is given in [98, pp32-33].
0 20 40 60 80 100 120 140 160 180 200
(b) Integral-only control of a flapper.
Figure 4.1: Comparing PI and integral-only control for the real-time control of a noisy flapper plant with sampling time T = 0.08.
4.2.3 Integral only control
For some types of control, integral only action is desired. Fig.4.1(a)shows the controlled response of the laboratory flapper, (§1.4.1), controlled with a PI controller. The interesting characteristic of this plant’s behaviour is the significant disturbances. Such disturbances make it both difficult to control and demand excessive manipulated variable action.
If however we drop the proportional term, and use only integral control we obtain much the same response but with a far better behaved input signal as shown in Fig.4.1(b). This will decrease the wear on the actuator.
If you are using Eqn.4.1with the gain Kcset to zero, then no control at all will result irrespective of the integral time. For this reason, controllers either have four parameters as opposed to the three in Eqn.4.1, or we can follow the SIMULINKconvention shown in Fig.4.4.