> What's interesting is that a lot of controllers leave out the derivative term
This is because a PD controller controlling system X is equivalent to a PI controller for the system (dX/dt). For example, a PI controller adjusting force to control velocity is equivalent to a PD controller adjusting force to control position.
If your system has a strong "momentum-like" term (larger than its damping), you need a derivative term to stabilize it. So a force-position controller needs D, but a room heater does not, because when you stop heating the room, the temperature doesn't keep coasting upwards (usually - there can be some phase lag if your sensor is far from your heater, or if your room is on fire).
A force-velocity controller (cruise control) also does not have "momentum", as you can see from the fact that if you stop applying force, velocity stops increasing immediately.
Speaking of room heater, I remembered when I was studying on control theory in university and learned PID, I was thinking "this thing is so simple and yet so effective, it gotta be everywhere!".
It's a little bit disappointing when I later realized that most of heater/air conditioner basically just use on/off control with a deadband. I guess the limiting factor here isn't the controller but the actuator part, but still a let-down to see them being so primitive.
On-off or "bang-bang" control actually makes a lot of sense for home thermostats. For example consider:
- With a home thermostat you probably want it to reach the desired temperature as quickly as possible. PID will never reach the setpoint as fast as bang-bang control since bang-bang control will always use the maximum possible power.
- PID might help you avoid overshooting the desired temperature but that's not really an important issue for a home furnace. In fact it might be better if it overshoots the desired temperature a bit on very cold days.
- The air in the home acts like a big thermal battery that helps negate the need for a sophisticated controller.
PID works very good for a wide variety of situations but it's important to remember it is not always the best tool for every job. In that way it is kind of like "quicksort".
Well.. that and your heater / ac state is binary. The heater is either on or off, and the ac is either on or off. PID loops require a continuous variable to set.
If the only thing you can do is turn something on and off, a bang-bang controller is the only thing that works.
Although overkill for a heater, you can often pulse-modulate a binary output to simulate a continuous output variable. This can be used together with a PID controller.
You can often run into equipment reliability issues with this approach because you are constantly short-cycling your systems. I know on HN we’re generally focused on the software aspect but in the real world it’s important to consider the overall system
My point is about how "binary" signals are controlled via modulation to emulate an analog variable for use with a continuous controller, not a recommendation to run your gas furnace this way. (That might have been lost because of the line the conversation followed).
In a real system this is exactly how MOSFETS are used to control a voltage; you would almost never use an analog amplifier for high power because of the losses, so voltage control is binary on/off, but that doesn't restrict you to just bang-bang control despite the GP's statement.
In fact, an electric heater can and often will be controlled via a PWM method with a continuous controller rather than via hysteresis.
Yeah, hysteresis control aka "bang bang" control can also be unreasonably effective.
It's a natural choice when your furnace can't throttle, or can but operates most efficiently at one output level anyway.
Since the system always pushes as hard as it can, it automatically reaches the setpoint in the minimum possible time. It's almost like a PID controller with infinite gain. But the tradeoff is jitter -- all the error gets pushed up to the highest frequency bands. As long as you don't care about that in your system, it's a great choice and effortless to tune.
It can also be a bad choice if there's any cost to changing or toggling the output, like if your furnace wears out from switching on and off a lot.
Many hot water circulating heating systems use bang-bang for the call-for-heat actuation but vary the circulating water temperatures in response to the outdoor temperature (via an “outdoor reset” input to the system).
Properly set, this dampens the swings of temperature in the rooms as the heat gain is more closely matched to the heat loss, increasing comfort and economy of the system.
On larger hydronic systems, you’ll occasionally see a PI controller on the mixing valve. The burner is kept near constant and the mixing valve is used to maintain water temp setpoint by tempering boiler water temp
This is because a PD controller controlling system X is equivalent to a PI controller for the system (dX/dt). For example, a PI controller adjusting force to control velocity is equivalent to a PD controller adjusting force to control position.
If your system has a strong "momentum-like" term (larger than its damping), you need a derivative term to stabilize it. So a force-position controller needs D, but a room heater does not, because when you stop heating the room, the temperature doesn't keep coasting upwards (usually - there can be some phase lag if your sensor is far from your heater, or if your room is on fire).
A force-velocity controller (cruise control) also does not have "momentum", as you can see from the fact that if you stop applying force, velocity stops increasing immediately.