Offset of P-only control
For a self-regulating process with process gain
The offset
A controller shows three settings, and the water in the tank still sits one degree below the setpoint all day. Someone doubles the first number and the temperature begins to swing. Someone else copies the settings from another controller, which uses a different form of the same equation, and the loop becomes slow. Most loops that run badly have nothing wrong with the equipment: the three settings were changed without knowing what each one does. This lesson gives each term one clear job, shows its cost, and proves both on a simulated tank. #PIDControl #IntegralAction #ControllerSettings
By the end of this lesson, you will be able to:
A wash line needs water at a steady temperature. An electric heater warms a tank, a sensor in the outlet pipe measures the temperature
With a simple proportional controller the operator sets 49 °C and the tank settles at 48.2 °C. The controller is not broken: to hold the extra temperature the heater needs extra power, and a proportional controller gives extra power only while an error remains.
The operator could accept the offset, raise the setpoint to cheat it, or raise the gain until the offset is small and the loop nearly hunts. None is right. The right answer is a second term whose only job is to remove the offset, used with knowledge of its cost, and a third term that gives back some speed. Those three terms are the PID controller.
The controller works on the error
where
A short way to hold the three in mind: the P term acts on the error now, the I term acts on the error that has added up in the past, and the D term acts on where the error is going.
With the P term alone,
where
The P term has one weakness. On a self-regulating process such as the tank, a new setpoint needs a new steady output. But the P term gives an output different from
Offset of P-only control
For a self-regulating process with process gain
The offset
A steady disturbance leaves an offset in the same way. An integrating process, such as a tank level, is different: it has no offset for a setpoint step under P-only control.
Many controllers do not show the gain. They show the proportional band, PB, in percent:
The proportional band is the change in the process variable, as a percentage of the transmitter span, that moves the output through its full range. A narrow band is a high gain. The common mistake is to treat the two as the same direction: raising PB lowers the gain.
To use the formula, first make the gain dimensionless. If the tank transmitter has a span of 0 to 100 °C, a gain of 8 percent per °C is 8 percent of output per 1 percent of span, so
The I term adds up the error over time. While any error remains it keeps moving the output; it stops only when the error is exactly zero, and then holds the output it has reached. That removes the offset: at rest, the I term alone supplies the output the process needs, and the P term supplies nothing. Think of a leaking tank: while the level is below the mark you open the tap a little more, and at the mark you stop turning and leave the tap open.
The integral time
The cost is stability. The integral responds late: it is still pushing because of old error when the process variable has already reached the setpoint. In frequency terms it adds phase lag to the loop. Integral action that is too strong (a short
The D term gives an output in proportion to how fast the error is changing. When the process variable moves quickly toward the setpoint, the D term reduces the output before it arrives, like a driver who brakes on the approach to a stop line. This damping lets the gain be higher than it could be without it.
The derivative time
The cost is noise. Measurement noise is small but fast, and the D term multiplies fast changes: a pressure ripple that the P term barely passes can make the output shake. So every real controller filters the derivative, and many loops run with
A setpoint step changes the error instantly. The rate of change of a step is very large, so a D term that acts on the error sends a sharp spike to the final element at every setpoint change. This is called derivative kick.
Since
The response to a disturbance is the same as before, because a disturbance moves
The same controller can be written with three independent gains. This is the parallel form, common in drives and in software libraries:
Settings:
Settings:
Conversion between the two forms
Example: the ISA settings
The common mistake is to copy numbers from one form into the other. Typing
The sign of the controller must match the process. On the tank, more heater power raises the temperature, so when the temperature rises above the setpoint the output must fall. This is reverse action, and with
With the wrong action the feedback is positive: the output does not oscillate but runs to 0 or 100 percent and stays there. Confirm the action before a loop is first put in automatic.
In manual the operator sets the output directly. At the moment of the change to automatic, the controller output should begin from the value the operator left, with no jump. A controller does this by setting its integral term at the moment of the change:
The output then starts at
Most loops in industry are PI. Pump, flow and pressure loops are fast, their signals carry ripple, and their response is already quick enough, so a D term adds wear at the final element and little else. Derivative earns its place on slow processes with a clean measurement, where a lag of minutes makes the loop sluggish. Slow temperature loops are the usual case. Even there, derivative helps less as the dead time becomes large against the time constant, because no prediction from the present rate can see through a long dead time.
At rest the process gives
Combine the three:
The loop gain
The tank settles at
Check with the heater: the output at rest is
With derivative on measurement there is no kick, so at the instant of the step the output moves by the P term only:
P:
The integral term continues to raise the output during the 40 s of dead time, while the error is still the full 4 °C. The simulation gives the true peaks: 72.0, 67.2 and 84.5 percent. ✅
All three stay inside 0 to 100 percent, so the linear behaviour of each controller is what the test shows. A step of 6 °C with the PID settings would begin at
Choose the time step. It must be small against the dead time: 0.5 s is 80 steps inside
Model the dead time as a delay buffer: a list of 80 past output values. At each step the newest output goes in at one end, and the value that left the controller 40 s ago comes out at the other end and acts on the process. ✅
Advance the first-order lag by one step with its exact solution: the temperature moves a fraction
Compute the controller each step: add
Start the integral term at 40 percent so that the output begins at the operating point (bumpless start). ✅
Results from the script in the next section:
| Controller | Final value (°C) | Offset (°C) | Overshoot (percent) | Settling time (s) | Peak output (percent) |
|---|---|---|---|---|---|
| P | 48.20 | 0.80 | 8.4 | 213.5 | 72.0 |
| PI | 49.00 | 0.00 | 0.1 | 216.5 | 67.2 |
| PID | 49.00 | 0.00 | 0.5 | 125.0 | 84.5 |
All three loops are stable and the three responses are clearly different. ✅
P: the simulated offset is 0.80 °C, equal to the hand value. The response is quick but ends in the wrong place. ✅
PI: the offset is gone. The gain had to come down from 8 to 6 to keep the response smooth, and the loop needs about the same time as P to settle. ✅
PID: no offset, almost no overshoot, and a settling time of 125 s against 216.5 s for PI. The first heater move is 40 percent against 24 percent. ✅
Run the PID settings again with
Result: overshoot 14.7 percent and settling time 327.5 s. Without the D term the higher gain makes the loop ring. ✅
So the speed of the PID response has two parts: the higher gain gives the speed, and the D term supplies the damping that makes the higher gain usable. ✅
Check the final heater output. To hold 49 °C the tank needs
Gain:
Integral time:
This equals the process time constant, a sensible value for a PI controller. ✅
Derivative time:
This is small against the dead time of 0.5 s. ✅
Proportional band: 1 bar is 10 percent of the 10 bar span, so the dimensionless gain is
P alone. The loop gain is
The pressure would settle at 4.27 bar, not 4.5 bar. ✅
P and I. The integral removes the offset. The simulation gives no overshoot and a settling time of 8.1 s (band of
P, I and D. The simulation gives a settling time of 7.8 s, a gain of 0.3 s. The D term changes almost nothing in the response. ✅
D and the ripple. A ripple of
Conclusion: set
The exact ultimate gain of this pump under proportional control is 100.7 percent per bar. ✅
The gain in use is 12 percent per bar, a factor of about 8 below that limit for the P term alone. The integral term reduces the margin somewhat, but the smooth simulated response with no overshoot confirms that the loop is far from hunting. ✅
The script simulates both loops with a delay buffer for the dead time and prints every number used above. It saves a plot of the temperature and the heater output for the four tank runs.
import numpy as npimport matplotlib.pyplot as plt
def simulate(plant, r_new, Kc, Ti, Td, dt, t_end): """Closed loop of an FOPDT process with an ISA form PID controller. Reverse acting, derivative on measurement, output limited 0 to 100. Ti = None switches the integral off. Returns t, y, u.""" K, tau, theta, y0, u0 = plant n = int(round(t_end / dt)) n_delay = int(round(theta / dt)) pipe = [u0] * n_delay # delay buffer: output still on its way a = np.exp(-dt / tau) # exact step of the first-order lag y, y_prev = y0, y0 integral = u0 # bumpless start: output begins at u0 t_log, y_log, u_log = [], [], [] for k in range(n): e = r_new - y if Ti is not None: integral += Kc * e * dt / Ti d_term = -Kc * Td * (y - y_prev) / dt u = Kc * e + integral + d_term u = min(100.0, max(0.0, u)) # output limits y_prev = y t_log.append(k * dt); y_log.append(y); u_log.append(u) pipe.append(u) u_delayed = pipe.pop(0) # output that acts on the process now y = y0 + a * (y - y0) + (1 - a) * K * (u_delayed - u0) return np.array(t_log), np.array(y_log), np.array(u_log)
def measures(t, y, u, y0, r_new): step = r_new - y0 y_final = y[-200:].mean() offset = round(r_new - y_final, 3) + 0.0 overshoot = 100 * max(0.0, y.max() - y_final) / (y_final - y0) outside = np.where(np.abs(y - y_final) > 0.02 * step)[0] t_settle = t[outside[-1] + 1] return y_final, offset, overshoot, t_settle, u.max(), u.min()
def report(title, unit, plant, r_new, cases, dt, t_end): print(title) print(f"case final offset overshoot settle u max u min") print(f" {unit:<7} {unit:<7} percent s percent") runs = [] for name, Kc, Ti, Td in cases: t, y, u = simulate(plant, r_new, Kc, Ti, Td, dt, t_end) yf, off, os_, ts, umax, umin = measures(t, y, u, plant[3], r_new) print(f"{name:<11} {yf:6.3f} {off:6.3f} {os_:7.1f} {ts:7.2f} " f"{umax:5.1f} {umin:5.1f}") runs.append((name, t, y, u)) return runs
# Plant A: hot water tank. K (degC per percent), tau (s), theta (s),# then the operating point: 40 percent holds 45 degC.tank = (0.5, 300.0, 40.0, 45.0, 40.0)print(f"Tank, P-only offset by hand: {4.0 / (1 + 0.5 * 8.0):.3f} degC")tank_runs = report("Application 1: tank, setpoint 45 to 49 degC", "degC", tank, 49.0, [("P", 8.0, None, 0.0), ("PI", 6.0, 300.0, 0.0), ("PID", 10.0, 360.0, 12.0), ("PI gain 10", 10.0, 360.0, 0.0)], dt=0.5, t_end=3000.0)
# Plant B: booster pump. K (bar per percent), tau (s), theta (s),# then the operating point: 60 percent speed holds 4.0 bar.pump = (0.10, 3.0, 0.5, 4.0, 60.0)Kp, Ki, Kd = 12.0, 4.0, 1.2 # parallel form gains from the driveKc, Ti, Td = Kp, Kp / Ki, Kd / Kp # the same controller in ISA formprint(f"\nDrive in ISA form: Kc = {Kc:.1f} %/bar, Ti = {Ti:.2f} s, " f"Td = {Td:.2f} s")print(f"Pump, P-only offset by hand: {0.5 / (1 + 0.10 * Kc):.3f} bar")report("Application 2: pump, setpoint 4.0 to 4.5 bar", "bar", pump, 4.5, [("P", Kc, None, 0.0), ("PI", Kc, Ti, 0.0), ("PID", Kc, Ti, Td)], dt=0.01, t_end=40.0)ripple, f = 0.02, 5.0 # bar, Hz: pressure ripple at the sensorprint(f"Output ripple from P: {Kp * ripple:.2f} percent, " f"from D: {Kd * 2 * np.pi * f * ripple:.2f} percent")
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(8, 7), sharex=True)for name, t, y, u in tank_runs: style = "--" if name == "PI gain 10" else "-" ax1.plot(t, y, style, label=name) ax2.plot(t, u, style, label=name)ax1.axhline(49.0, color="gray", linewidth=0.8)ax1.set_ylabel("Temperature (degC)")ax1.set_title("Hot water tank: setpoint step from 45 to 49 degC")ax1.legend(); ax1.grid(True, alpha=0.3)ax2.set_ylabel("Heater output (percent)")ax2.set_xlabel("Time (s)")ax2.set_xlim(0, 1200); ax2.grid(True, alpha=0.3)fig.tight_layout()fig.savefig("pid_terms_compare.png", dpi=120)print("\nSaved pid_terms_compare.png")Expected output
Tank, P-only offset by hand: 0.800 degCApplication 1: tank, setpoint 45 to 49 degCcase final offset overshoot settle u max u min degC degC percent s percentP 48.200 0.800 8.4 213.50 72.0 44.3PI 49.000 0.000 0.1 216.50 67.2 48.0PID 49.000 0.000 0.5 125.00 84.5 47.8PI gain 10 49.000 0.000 14.7 327.50 84.5 41.6
Drive in ISA form: Kc = 12.0 %/bar, Ti = 3.00 s, Td = 0.10 sPump, P-only offset by hand: 0.227 barApplication 2: pump, setpoint 4.0 to 4.5 barcase final offset overshoot settle u max u min bar bar percent s percentP 4.273 0.227 0.0 3.93 66.0 62.7PI 4.500 0.000 0.0 8.12 67.0 65.0PID 4.500 0.000 0.1 7.77 67.0 65.0Output ripple from P: 0.24 percent, from D: 0.75 percent
Saved pid_terms_compare.pngThe u min column is the lowest output after the first move. The simulation uses an unfiltered derivative on a noise-free signal. A real controller filters the derivative, which changes these numbers slightly.
1. The booster pump (
2. A tank controller has ISA settings
3. A temperature transmitter has a span of 0 to 100 °C. (a) What proportional band equals a gain of 8 percent per °C? (b) What gain in percent per °C equals a proportional band of 50 percent?
(a) The gain is already 8 percent of output per percent of span, so
4. A PI controller with
P term:
5. A tank loop is in manual at 55 percent output. The temperature is 47 °C and the setpoint is 49 °C. The controller is PI with
The P term will be
6. A PID controller has
(a)
The tank has a proportional controller with a gain of 8 percent per °C. After a setpoint step of 4 °C the water rests 0.8 °C below the setpoint. The operator doubles the gain to 16. What happens to the gap?
Three questions. Each wrong choice is a mistake people really make, so read the note after you answer.
1. The tank is at rest at its new setpoint of 49 °C under PI control. The heater output is steady at 48 percent. Which term of the controller supplies that output?
2. The PID settings Kc = 10 percent per °C, Ti = 360 s, Td = 12 s settle the tank in 125 s with 0.5 percent overshoot. The derivative time is now set to 0 and nothing else is changed. What happens?
3. The tank is under P-only control with a gain of 8 percent per °C and rests at 48.2 °C. A cold draw now removes heat equal to 10 percent of heater power, and it continues. Process gain: 0.5 °C per percent. Where does the temperature rest?
No comments yet. Questions, results from your own build, a better way to explain it: all welcome.
Kept on this device only. Nothing is sent anywhere.
Tip: select words in the lesson, or tap a figure or an equation, to put a note right there.
The lesson has changed and these words are no longer in it. Your notes are kept, with the words you chose.