The error
The circle in the diagram is the comparison. The setpoint enters with a plus sign and the measurement enters with a minus sign. A positive error means the process variable is below the setpoint.
A cold room compressor that starts twelve times an hour can fail years before it should, and the stock inside is lost on the night it fails. A pump that runs at one fixed speed gives good pressure at dawn and poor pressure at noon, when every tap is open. In both cases the machine is sound and the way it is controlled is the fault. This lesson shows the difference between a machine that follows a fixed plan and a machine that measures its own result and corrects it. You will calculate how often an on-off controller starts a compressor, and how far a pump’s pressure falls with and without feedback. #ControlEngineering #Feedback #OnOffControl
By the end of this lesson, you will be able to:
A cold room for milk, vaccines or vegetables must stay near 4 °C. Heat enters all day through the walls, through the door each time it opens, and with every warm crate that is carried in. A compressor removes that heat. The compressor in a small cold room has only two states, running or stopped, so the only decision the controller makes is when to switch.
The simplest plan is a timer: run for 7 minutes, rest for 20 minutes. On the day the plan was made it holds 4 °C. On a hot afternoon with the door in use it does not, because the timer does not know the room is warmer. A thermostat does know, because it measures the air. That one measurement is the whole difference between the two methods.
The thermostat brings its own problem. If it switches the compressor the moment the air passes 4 °C in either direction, the compressor starts and stops every few seconds. Each start draws several times the running current and heats the motor windings, and oil that leaves the compressor at start needs running time to return. Makers therefore state a limit, often about 6 starts per hour. The designer must choose a switching band wide enough to respect that limit and narrow enough to protect the stock.
An open-loop controller sends a command to the machine and does not look at the result. A timer on a compressor, a pump set to one fixed speed, and a heater left at one fixed power are all open loop. The command depends only on the plan.
Open loop is cheap and can never become unstable. It is right when the process does not change and nothing disturbs it, as in a conveyor oven that always carries the same product. When the heat load, the demand or the machine changes, the output changes and nothing corrects it.
A closed-loop controller repeats three actions without stopping. It measures the output. It compares the measurement with the value that is wanted. It corrects the command to make the difference smaller. Because the measurement travels back from the output to the input, the method is called feedback. A car’s cruise control is a closed loop: it measures the speed and adds fuel when a hill slows the car.
Every control loop, on any machine, has the same four parts.
| Part | What it does | Cold room | Booster pump |
|---|---|---|---|
| Sensor | Measures the output | Air temperature probe | Pressure transmitter |
| Controller | Compares and decides | Thermostat | Controller inside the drive |
| Final element | Changes the energy or flow going in | Compressor and its contactor | Variable speed drive and motor |
| Process | The equipment that is being held | The room and its air | Pump, pipe and the water in it |
When a loop behaves badly, one of these four parts is the cause. A good technician checks them one at a time and does not start with the controller settings.
A block diagram draws each part as a box and each signal as an arrow. This course uses the same five letters in every lesson.
The error
The circle in the diagram is the comparison. The setpoint enters with a plus sign and the measurement enters with a minus sign. A positive error means the process variable is below the setpoint.
The minus sign at the comparison is the reason the loop works. When
If the sign is wrong, the correction pushes in the same direction as the error. The room gets warmer, so the controller stops the compressor, so the room gets warmer still. This is positive feedback, and the output runs to one of its limits and stays there. On a new installation, a loop that goes directly to 0 or 100 percent and stays there usually has the wrong action selected.
The controller cannot know by itself which direction of
The simplest feedback controller has an output with two values, 0 and 100 percent. For the cold room, which is direct acting, the rule could be “run the compressor when the air is above 4 °C, stop it when the air is below 4 °C”. With a real, slightly noisy sensor this rule switches many times a second near 4 °C, and no contactor or compressor survives that.
The cure is a band, also called hysteresis or a differential. The controller uses two switching temperatures in place of one:
The temperature never settles: it travels up and down inside the band for as long as the machine runs. This is called cycling, and in on-off control it is normal, not a fault.
Let
On-off cycle with a band
Two results surprise new learners. First, the duty does not depend on the band:
Second, the starts per hour are inversely proportional to the band: halve the band and the starts double. That is the designer’s trade. A narrow band holds the temperature closely and wears the compressor; a wide band protects the compressor and lets the temperature move further.
A loop is asked to do two different jobs. A setpoint change is a new value of
Most industrial loops run at one setpoint for months, so holding against disturbances is their main work. A tuning test that only steps the setpoint has tested the less common job.
Feedback corrects an error only while the final element has something left to give. A pump at 100 percent speed cannot go faster, and a compressor that already runs without stopping cannot cool more. When the output reaches 0 or 100 percent the loop is saturated: it then behaves as an open loop, and the error stays however good the controller is.
Feedback also cannot correct what it does not measure. If the sensor reads 1 °C low, the loop holds the room 1 °C warm with full confidence. And feedback always acts late, because an error must exist before the controller can respond to it.
On time. The air must fall through the whole band at the cooling rate.
The compressor runs for 6.67 minutes in each cycle. ✅
Off time. The air must rise through the whole band at the warming rate.
The compressor rests for 20.0 minutes in each cycle. ✅
Cycle time.
One full cycle lasts 26.7 minutes. ✅
Duty.
The compressor runs for 25 percent of the time, which is 6 hours in every 24. ✅
Starts per hour. There is one start in each cycle.
This is well below the limit of 6. ✅
New switching temperatures. The band stays centred on the setpoint: switch on at
New times. Both times halve because the band halved.
The cycle is half as long as before. ✅
Duty.
Starts per hour.
The starts have doubled, from 2.25 to 4.50 per hour. ✅
Smallest band at this load. Six starts per hour means a cycle of 10 minutes.
At this heat load, any band narrower than
The rates in the problem are for one heat load. On a hot day with the door in use, the room warms faster when the compressor is off and cools more slowly when it is on. The limit must hold on that day too.
Separate the machine from the load. With the compressor on, the net cooling rate is the capacity of the machine minus the heat load. With it off, the warming rate is the heat load alone. So the capacity, written as a rate, is
and for any load
Starts per hour for any load.
The product
Worst case value. Put
With
Check a second way. The Python script below steps the room through 4 hours in small time steps and counts the starts. It counts 9 starts with the
Nothing reacts. The speed command stays at 60 percent because nothing measures the pressure. ✅
Pressure after the demand rises.
The building receives 3.4 bar for as long as the demand lasts. The fall of 0.6 bar is called droop. ✅
Extra speed needed. The pump must add back the 0.6 bar that the demand removed.
The speed must rise by 6 percent. ✅
New speed.
Action. When the pressure rises, the speed must fall. The controller is set to reverse acting. ✅
A proportional controller makes the correction in proportion to the error:
Write the pressure at rest. The pressure is the setpoint, minus the fall from demand, plus what the extra speed adds.
The pressure now depends on the error. ✅
Solve for the error. Use
The error at rest is 0.30 bar. ✅
Pressure and speed.
Why an error remains. This controller raises the speed only while an error exists. With no error it returns to 60 percent, and 60 percent is not enough. So it rests at a compromise. The general result is
A larger gain leaves a smaller error but never zero. ✅
Speed in reserve. From 60 percent the drive can add
Largest fall it can cancel.
On the straight-line model, a demand that would cost more than 4.0 bar at fixed speed cannot be corrected. ✅
Check with the script. The Python script simulates the pump with its real delay. At fixed speed it ends at 3.400 bar. With the proportional controller it ends at 3.700 bar and 63.0 percent. With a controller that also has integral action it ends at 4.000 bar and 66.0 percent, the speed found in Step 2. All three agree with the hand values. ✅
The script calculates the cold room cycle from the formulas, then simulates the room in small time steps and counts the starts. It then simulates the booster pump three ways: at fixed speed, with the proportional controller, and with a proportional and integral controller. The pump model includes the short time the pressure takes to respond, which the hand calculation ignored.
"""On-off cold room (cycle, duty, starts) and a booster pump with and without feedback."""import numpy as npimport matplotlib.pyplot as plt
# ---------- Part 1: cold room, on-off control with a band ----------COOL = 0.30 # degC per minute, compressor onWARM = 0.10 # degC per minute, compressor offSETPOINT = 4.0 # degCLIMIT = 6.0 # maker's limit, starts per hour
def cycle_numbers(band, cool=COOL, warm=WARM): """Return on time, off time, cycle time (min), duty (%), starts per hour.""" t_on = band / cool t_off = band / warm t_cycle = t_on + t_off return t_on, t_off, t_cycle, 100.0 * t_on / t_cycle, 60.0 / t_cycle
def simulate_room(band, minutes=120.0, dt=0.01, cool=COOL, warm=WARM): """Step the room through time and count compressor starts.""" high = SETPOINT + band / 2.0 low = SETPOINT - band / 2.0 n = int(round(minutes / dt)) t = np.arange(n) * dt temp = np.empty(n) state = np.zeros(n) y, on, starts = high, False, 0 for i in range(n): if not on and y >= high - 1e-9: on, starts = True, starts + 1 elif on and y <= low + 1e-9: on = False temp[i], state[i] = y, 1.0 if on else 0.0 y += (-cool if on else warm) * dt return t, temp, state, starts
print("Cold room, on-off control")for band in (2.0, 1.0): t_on, t_off, t_cyc, duty, sph = cycle_numbers(band) _, _, state, starts = simulate_room(band, minutes=240.0) print(f" band {band:.1f} degC: on {t_on:.2f} min, off {t_off:.2f} min, " f"cycle {t_cyc:.2f} min, duty {duty:.1f} %, starts/h {sph:.2f}") print(f" simulated over 4 h: {starts} starts, " f"duty {100.0 * state.mean():.1f} %")
band_min = (60.0 / LIMIT) / (1.0 / COOL + 1.0 / WARM)print(f" smallest band for {LIMIT:.0f} starts/h at this load: {band_min:.2f} degC")
capacity = COOL + WARM # cooling the machine gives with no heat loadworst_warm = capacity / 2.0 # heat load that gives the most startsfor band in (2.0, 1.0): *_, sph = cycle_numbers(band, cool=capacity - worst_warm, warm=worst_warm) print(f" worst load (warming {worst_warm:.2f} degC/min), band {band:.1f} degC: " f"starts/h {sph:.2f}")
# ---------- Part 2: booster pump, fixed speed against feedback ----------K, TAU, THETA = 0.10, 3.0, 0.5 # bar per percent, s, sSP, U0 = 4.0, 60.0 # bar, percent speedDROOP = 0.6 # bar lost at fixed speed when demand risesKC = 10.0 # percent per bar, proportional gainTI = 3.0 # s, integral time for the PI case
def simulate_pump(mode, t_end=60.0, dt=0.01, t_dist=5.0): """mode: 'open', 'P' or 'PI'. Returns time, pressure, speed.""" n = int(round(t_end / dt)) delay = int(round(THETA / dt)) t = np.arange(n) * dt y = np.empty(n) u = np.full(n, U0) x = 0.0 # pressure change caused by the speed change, bar integral = 0.0 for i in range(n): d = -DROOP if t[i] >= t_dist else 0.0 y[i] = SP + x + d e = SP - y[i] if mode == "P": u[i] = U0 + KC * e elif mode == "PI": integral += e * dt u[i] = U0 + KC * (e + integral / TI) u[i] = min(100.0, max(0.0, u[i])) u_delayed = u[i - delay] if i >= delay else U0 x += dt * (K * (u_delayed - U0) - x) / TAU return t, y, u
print("Booster pump, demand rises at t = 5 s")results = {}for mode in ("open", "P", "PI"): t, y, u = simulate_pump(mode) results[mode] = (t, y, u) print(f" {mode:>4}: final pressure {y[-1]:.3f} bar, " f"final speed {u[-1]:.1f} %, lowest pressure {y.min():.3f} bar")
print(f" hand value, P only: droop {DROOP / (1.0 + K * KC):.3f} bar")print(f" speed needed to remove the droop: {U0 + DROOP / K:.1f} %")print(f" largest fall the pump can cancel: {(100.0 - U0) * K:.1f} bar")
# ---------- Plot ----------fig, ax = plt.subplots(2, 1, figsize=(8, 7))for band, style in ((2.0, "-"), (1.0, "--")): t, temp, _, _ = simulate_room(band, minutes=90.0) ax[0].plot(t, temp, style, label=f"band {band:.0f} degC")ax[0].axhline(SETPOINT, color="gray", linewidth=0.8)ax[0].set_xlabel("time (min)")ax[0].set_ylabel("room temperature (degC)")ax[0].set_title("Cold room under on-off control")ax[0].legend()labels = {"open": "fixed speed", "P": "P control", "PI": "PI control"}for mode in ("open", "P", "PI"): t, y, _ = results[mode] ax[1].plot(t, y, label=labels[mode])ax[1].axhline(SP, color="gray", linewidth=0.8)ax[1].set_xlabel("time (s)")ax[1].set_ylabel("discharge pressure (bar)")ax[1].set_title("Booster pump when demand rises")ax[1].legend()fig.tight_layout()fig.savefig("feedback_on_off_and_pump.png", dpi=120)print("Saved feedback_on_off_and_pump.png")Expected output
Cold room, on-off control band 2.0 degC: on 6.67 min, off 20.00 min, cycle 26.67 min, duty 25.0 %, starts/h 2.25 simulated over 4 h: 9 starts, duty 25.0 % band 1.0 degC: on 3.33 min, off 10.00 min, cycle 13.33 min, duty 25.0 %, starts/h 4.50 simulated over 4 h: 18 starts, duty 25.1 % smallest band for 6 starts/h at this load: 0.75 degC worst load (warming 0.20 degC/min), band 2.0 degC: starts/h 3.00 worst load (warming 0.20 degC/min), band 1.0 degC: starts/h 6.00Booster pump, demand rises at t = 5 s open: final pressure 3.400 bar, final speed 60.0 %, lowest pressure 3.400 bar P: final pressure 3.700 bar, final speed 63.0 %, lowest pressure 3.400 bar PI: final pressure 4.000 bar, final speed 66.0 %, lowest pressure 3.400 bar hand value, P only: droop 0.300 bar speed needed to remove the droop: 66.0 % largest fall the pump can cancel: 4.0 barSaved feedback_on_off_and_pump.pngThe simulated duty of 25.1 percent for the narrow band differs from 25.0 only because 4 hours is not a whole number of cycles. In the lower plot all three pressure curves fall to 3.4 bar at the same instant: the model applies the demand as a sudden step, and no controller can act before the error exists.
1. A cold room cools at
2. State the controller action, direct or reverse, for each loop: (a) an electric heater that holds a tank at 60 °C, (b) a fan that cools an electrical cabinet, with fan speed as the output, (c) a pump that fills a tank and holds its level, with pump speed as the output.
(a) Reverse: a higher temperature needs less heat. (b) Direct: a higher temperature needs more fan speed. (c) Reverse: a higher level needs less inflow. In each case ask what the output must do when the measurement rises.
3. An electric room heater with a thermostat warms the room at
4. The booster pump of Application 2 (
(a)
5. A pipe fails downstream of the same pump. At fixed speed the pressure would fall by 4.6 bar. The controller has integral action, so it raises the speed for as long as an error remains. Using the straight-line model, find the final speed and the final pressure.
The loop needs
6. A larger cold room has a compressor whose capacity, written as a rate, is
The worst case is a duty of 50 percent, at a warming rate of
A thermostat switches a cold room compressor on at 5 °C and off at 3 °C. You halve the band: on at 4.5 °C, off at 3.5 °C. What happens to the fraction of time the compressor runs?
The line is the air temperature. It is made of exact straight pieces, calculated from the two rates. The dashed lines are the two switching temperatures and the dotted line is the setpoint, 4 °C. The strip shows when the compressor runs. The numbers are for the steady cycle. The door opens at 40 minutes. While it is open, heat enters three times as fast, and the thermostat uses the same rule as before.
Three questions. Each wrong choice is a mistake people really make, so read the note after you answer.
1. A cold room cools at 0.30 °C per minute with the compressor on and warms at 0.10 °C per minute with it off. With a 2 °C band the compressor starts 2.25 times an hour. A technician sets the band to 0.5 °C "for better control". How many starts per hour are there now?
2. On a hot day the same room warms at 0.20 °C per minute with the compressor off. The machine is the same, so with the compressor on the air now cools at only 0.20 °C per minute. The band is 2 °C. What are the duty and the starts per hour?
3. A cold room is set to switch on at 5 °C and off at 3 °C. On a very hot afternoon the compressor runs without stopping and the air stays at 6 °C. What should the technician do?
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.