# Offset in PID control

What to do in case of offset while you did use PI or PID control?

by Jan Schuurmans, written at 16-1-2020

#### Offset in PID control

In this post I am writing about PID control that suffers from offset. Offset means that the controlled Process Variable (PV) deviates from Set-Point (SP). If you are using P-control or PD control, without integral action, this problem should not surprise you. However, if you use PI or PID with Integral action, you would not expect this issue. Right? Wrong: we had this issue in several cases, among others in a laminator (see our post Temperature Control of a Laminator )
As an example, have a look at Figure 1, showing the temperature and setpoint of a process that was regularly perturbed. The PID controller, containing integral action, was tuned well and did not show an offset after a single perturbation. However, in this case it was perturbed regularly again and again.

Figure 1   PID controlled process showing offset.
On average, the temperature shows an offset from setpoint. Note that the PID output (refered to as MV in this post) is limited below to 0%. Rightfully so, because the MV cannot go below 0%. Nevertheless, one would not expect this from a PI or PID controller, since it has Integral action that is supposed to remove offset!

The problem is related to the anti-windup part of the PID algorithm. This part avoids MV to continue to grow to huge negative or positive numbers when the MV hits a limit. Anti-windup is a useful part of the algorithm, but in this case, it creates a problem. In standard PID algorithms, the anti-windup algorithm is simple. One of the most common methods is that the PID algorithm first computes a change in MV (DMV). Subsequently, this DMV enters the anti-windup scheme according to:
MV := MV + DMV
if MV < 0, then MV = 0

There have been many developments on alternative anti-windup schemes. Just google on "PID anti-windup" and you will find over 10000 papers on this subject. Such developments are of no use when you are stuck with fixed PID code, like Siemens, Allen Bradley, or Honeywell. In those cases, there may be a simple solution though. Just shift the MV limit(s) in the PID algorithm so that they are not hit during normal production. In our example, we had to move the lower MV limit to -10%. The PID algorithm continues to integrate as longs as MV is above -10, so its 'memory' is not perturbed. We cut-off the actual MV output for values below 0 though, using a simple limiter outside the PID block. Figure 2 shows the effect of this change. Clearly, the MV is still limited, but the PID control algorithm does not know about this and thinks it can steer MV below 0% (this "internal" MV is not shown in figure 2).

Figure 2   PID controlled process without offset.