Monday, November 13, 2017

An Introduction to Feedback Systems

I plan to talk more about technical topics in the coming weeks, and one of those topics that's worth covering is an introduction to Control Systems, commonly called Feedback and Control Systems. 

I know that some of you are already really familiar with these things, in great and gory details.  Take the night off (unless you care to look for mistakes to correct).  For my career in radio design, I principally designed feedback and control systems like Frequency Synthesizers (Phase Locked Loops - PLLs), Automatic Gain Control (AGC) systems in receivers, Automatic Level Controls (ALC) for transmitters, and Cartesian Transmitter Linearizers.  For those of you who haven't looked into the subject, electrical engineering students take a class in control systems that tends to be a very analytical and very mathematical.  I'm going to skip the math and try to explain things in words.  I'll also be the first to say that when you design your 10th or 15th PLL or AGC, there's not much theory involved.  It's pretty much you just solve a few equations (which you've probably stuck in a spreadsheet or other software) and you're done.

For starters, let's define a feedback system.  It's a system that corrects itself by comparing its state ("what we got") to its desired state ("what we want it to be").  This diagram is a simple type of feedback system.
For some folks, this is probably more confusing than helpful, so let's do a simple example of something that everyone knows: a thermostat in an air conditioner.  The thing we're controlling is the temperature at the thermostat, which we use as a proxy for the temperature everywhere under that air conditioning.  The feedback sampler is a thermocouple or something that measures the temperature - the equivalent of a thermometer.  The heart of the loop is that circle with an X in it, which acts to compare the "what we want it to be" (the thermostat setting) to "what we actually got".  It compares the two electrical signals and generates an error signal ("what we got" minus "what we wanted") that goes to something called the feedback controller here and that makes the feedback correction.  In a thermostat, this is an on/off switch.   

It's important to notice that if the output is bigger than we wanted, the control system turns it down, and if it's smaller, the system turns it up.  Since the correction is opposite the measurement, this is called negative feedback.  If you think of the audio screams and howls that happen when a microphone is in front of a loudspeaker, there is no correction and the output gets louder until it can't go up any more.  This is a type of positive feedback, not a control system.  Perhaps you've heard of the term vicious cycle, where something happens and its result is to contribute to causing it again: that's a positive feedback situation.

What I'm going to describe next is how my central air conditioner works.  I don't know how universal this is, but I've watched my thermostat and know that if I set some temperature, say to cool the house to 75 degrees, it won't turn the air conditioner on to reduce temperature until it measures 2 degrees above the desired temperature, 77.  The error has to be that big before it will turn on.  The air conditioner then comes on at full power until the temperature at the thermostat reaches the desired temperature, sometimes it overshoots and goes a degree lower than the thermostat is set.  There has to be some sort of difference (called hysteresis) in the temperature between when its' getting warmer and when it's getting cooler.  There's no way the system could know to both turn on and turn off when it's 75.

This is what's called a Bang-Bang controller.  It either turns on the cooling 100% or it turns it off (0%).  That's a pretty crude system, and lots of control systems you're familiar with don't work that way.  Consider cruise control in a car: if you had a Bang-Bang controller your accelerator would go full throttle or to idle.  A Bang-Bang controller works for a simple thermostat, but in a cruise control the demands for accuracy are higher, and we want something that doesn't continually speed you up and slow you down by a couple of MPH. 

There are much more elegant control systems available, and the smoothest response is generally the Proportional-Integral-Derivative or PID controller.   A PID controller calculates three quantities and then combines them to create the error correction needed.  Hopefully, this graph will help explain it while I add some words.
Proportional to error means that the bigger the error, the harder it tries to correct.  Integration of errors over time is an averaging process - it means that the result is incorporating both how big the error is and how long it lasted; its output gets bigger if some error has lasted longer, not just if the error is larger.  Finally, Proportional to the rate of change term is determining if the error has gotten larger quickly or slowly. 

The drawback of PID systems is that they're complex and can be hard to get running well; in many cases, an error signal that's proportional to the error is all that's needed.  I don't recall ever seeing an AGC, PLL, ALC or any other electronic control system that used a PID controller.  On the other hand, this is something that the continuing advancement of electronics has vastly improved, and for some control tasks, like the temperature of furnace, kiln or for some operation, you can buy a preprogrammed, ready-to-use PID controller for well under $100, and sometimes under $20. 

Proportional or PID systems are starting to make their way into air conditioners.  We have a Mini Split system in the workshop and it behaves that way.  Instead of the unit turning off when the temperature is cooler than the thermostat is set for, it cools at the lowest energy consumption it can. 

A Fun Fact is that PID controllers were first developed for automatic steering systems of ships at sea in the 1920s.  They make an obvious choice for automatic steering systems in an autonomous car or truck.  The details of how the car decides "what we want" and measures "what we got" are monstrously huge problem that have to be solved. 


  1. Thanks for the post, it brought back a lot of memories from my days as an Industrial Controls Engineer.

    Every system is different, and coming up with the right mix of gain, stability, and speed of response is an elusive thing. Settings that work fine in one place might be totally wrong for a place that "looks the same on paper".

    And then you can still have load drop/load pull to contend with.

    I found applying the principles I learned to all-electronic systems was a whole lot easier than applying it to a system used to control 400HP motor/pump combos!

    1. No electronics system that I worked on would do anything worse than not work. A 400 HP motor is capable of a lot more destructive than just "not working".

    2. Yep. I watched my Plant Manager blow a 10" water main clean out of the street when he caused a massive water hammer by bringing THREE unneeded 250HP motors and pumps online all at once, and then dropping them off all at once.

      I think he finally learned that day that liquids are not compressible.....

  2. Feedback and Control Systems was one of my favorite subjects in university. Though I didn't do design of systems, as a test engineer and metrology engineer, understanding feedback systems was very useful in trouble shooting complex systems; often I could "see" the complex systems as control loops.

    As I charge into retirement, I have some projects that may rely on such systems. One of those is controlling a wood burning BBQ pit/smoker to maintain a constant temperature in the cooking chamber.

    1. Are you thinking of a something that's electrically heated or burning big chunks of wood? I'd be interested in seeing how you do that.

      Masterbuilt electric smokers are essentially an electric oven in a weird form factor. They use the heating element to heat wood chips enough to give off smoke and eventually reduce the wood (chips only) to fine dust. They use a bang-bang controller like ovens do. There's tons of talk about them online.

    2. Burning actual wood. It is a stretch but I think it is doable. I even have thought through the loading of wood. This would not be an analog realization but rather a digital beast.

  3. So what you're saying is that, if cars had "Bang-Bang" controllers for their cruise control, they would drive pretty much the same as every snowbird already does???

  4. I take it we aren't going to get into Laplace transformations or multiple-dimension state vector models here ;)

    I applaud these efforts. No engineering graduate should be without a working knowledge of control loops. In fact, every science-related education would benefit from it (climate "change" cultists, I'm staring at you, here).

    1. In fact, every science-related education would benefit from it (climate "change" cultists, I'm staring at you, here). You got that right!

      Every field of science from the climate freaks to medical doctors need this stuff.

  5. Issuing fiat money creates an oscillator:

    Some airtight wood stoves control an air input damper with a bimetallic coil:

    1. Issuing fiat money creates an oscillator:

      As they used to say in school, "intuitively obvious to the most casual observer". All ya gotta do is take off the blinders and look. Which the central bankers are apparently incapable of doing. Their training says it can't be so they can't see it.

    2. Perfect example of the difference between "training" and "educating".

      Trained people only do what they're told to do.

      Educated people can adapt and make changes on-the-fly.

    3. If you point out something to an ignorant person which they are missing, they act surprised. They speak slowly, hesitatingly, as they work out how this new realization should change their viewpoint. But when you point out something to a liar which they are deliberately hiding, they immediately and confidently respond with another of the doublethink's half-truths. The observation you supplied was already present in their heads, as was the previously prepared distraction story. The first time you get a doublethink answer from a person, you know they are a liar about that subject. Greenspan wrote a pro-gold essay early in his life, that's how we know he's a liar and not mistrained.

  6. Thanks for the post.
    I don't think I understood terminating lines until I abruptly turned off a 700' water line while looking at the pressure gauge on the end.
    Your minisplit will probably run during daytime on a 24V inverter solar system. Probably only pulls 300 watts in power saving mode.

    I wish you could explain poles and zeros for old techs. John.

  7. Way Back When we were "troubleshooting" randomly oscillating chamber temp problems on a cure furnace (less actual troubleshooting, more "who wrote this code and what did they think it was going to actually do") when the tech we had "volunteered" to dive into the bowels of the beast to individually test each chamber's thermistors very quietly remarked from the depths that he didn't fully grasp feedback control systems until the second year of marriage.....