PID Controller Explainer (2022)
ben.bolte.cc
ben.bolte.cc
My favorite analogy is a suspension, like a car or mountain bike shock absorber. A PID controller is basically a unitless suspension system. P is like the spring, I is (sort of) like the compression damping and D is like the rebound damping, again, sort-of. Tune those 3 values and you’ll have a smooth ride and be able to respond to big bumps. The analogy to a physical suspension isn’t precisely perfect, but to a first approximation, a PID really is just a digital shock absorber.
PID systems are basically a differential equation and optimal coefficients are just solutions to that system which maximize responsiveness and minimize ringing, so I would think the effect of decreasing time delay just adjusts the Ki and Kd to account for the smaller Tc value.
Is this true? I mean the delay may be inconsiderable but there is a delay, right?
It seems to me that a suspension system has two separate PD controllers which share the same P factor (spring rate), but have the sign reversed in one direction. Then independent control rates on the velocity, as all suspension systems with which I am familiar allow separate rebound and compression damping control. That is, the compression side would be something like P + CD * dp/dt and rebound of -P + CR * dp/dt. (little "p" is position).
Maybe I just need to stew on this one a little longer though.
Here’s how I think about it: the P term is the spring. In a physical spring the force is quadratic in position or “error”, while a PID controller’s P term is linear. No reason you can’t make a P controller quadratic or anything you want, but the analogy between P and the spring seems clear enough to me.
Now compression damping is trying to slow down or resist fast compression and prevent overshooting, prevent having too much spring force from accumulating on the rebound. Sometimes there are even separate high and low speed compression damping mechanisms (I’m sure you know that). In a PID controller, the D term is also designed to resist proportional changes from happening too fast, it resists change in proportion to how fast things are changing.
And back to physical suspension again, rebound damping is designed to prevent rebound force from accumulating. You want to return to neutral position as fast as possible without a rebound force. The idea is to balance 2 different goals: 1- don’t buck you off the bike, and 2- don’t let the suspension pack down and stop working. The PID controller’s I term does this, in a way, it prevents the pack-down by monitoring the average position and if it stays too far away from neutral for too long, it pushes things back to neutral.
If you’re paying attention, you might notice I swapped I & D in my analogy here compared to above. It can (sort-of) be argued either way, which maybe goes to your point that the analogy ain’t perfect, and you could maybe look at it as 2 PD terms. I think it’s best not to try to fix the analogy, but just to see it as a very blunt instrument for understanding - a suspension and a thermostat and a robot steering a car all have a common type of problem to understand and at least conceptually, a solution that looks similar from a distance.
Maybe it’s valuable to think of suspension pack-down and controller drift as the same problem, or maybe not. They have similarities, but they’re not the same problem. My thinking of the I term as preventing pack-down is perhaps the main justification for saying a PID controller is like a suspension. But, on a real bike, packdown is being solved by the spring (P) and tuning the rebound (D), and drift isn’t something that happens.
My understanding and experience has been that large time delays force less aggressive tuning of the controller. I've been meaning to experiment with model based controllers to try and improve the responsiveness of the system.
On the other hand, even if you have known forces that take a known amount of time, a PID controller might be the right solution if the integrals you have to solve are unsolveable and/or just difficult. One problem with that idea is that it’s easy to get slightly wrong when complex physics is involved, and slightly wrong output can have unbounded catastrophically wrong consequences. You’d still want to monitor the inputs and responses, and so you’d end up with a PID controller even if you did try to pre-compute the solution.
However, vehicle steering does not take a known amount of time to complete, it takes an unknown amount of time, and there are many dimensions and variables. So, yes implicitly in PID controller land, you have a good point in the sense that part of the idea is that the inputs and response times are unknown. If the inputs were known and the solution was exactly computable and the exact answer was reliable, then you could use some kind of pre-integrator instead of a PID controller. But, I think it’s still fair to say that time delay is the main cause of the problem that PID controllers are designed to solve, because unknown inputs without time delays are not PID controller problems.
Given a certain desired value of the solution they can be used to force the dynamics to converge towards that value.
For certain types mostly linear equations they are the optimal way to achieve this.
I have no idea why, but the topic is almost never presented that way. Instead people talk about valves and pistons and whatsoever, but in the end it’s just that:
You have an ODE and some desired value for the solution ; you have some control over the inhomogeneous part. PID control is just a tried and well understood way of excepting this control.
We deal with similar kinds of feedback systems all the time in integrated circuit design (see: Phase Locked Loops), but they're evaluated theoretically, and by extension, I think, more rigorously. I'm sure this is largely due to the fact that what we're controlling has very well-defined, well-understood, and simple behavior, where "PID" controllers are often used in far more complex, multi-part systems like motor/speed control, temperature, etc.
And while I think there's a lot of value in developing that kind of intuition, I've run into a handful of junior engineers at my company who don't deeply understand what's happening in the system and draw incorrect conclusions or make dangerous decisions.
As one example, I saw a presentation showing an oscillation at the output of a tuning system when the sensing element was moved further away from the controller. with changing amplitude based on what the sampling rate was. The engineer had no idea why this was the case - moving the sensor away was introducing a distributed, continuous-time pole into the system, whose location in the discrete time, sampled system was moving with sample rate, and changing the feedback systems phase margin based on its proximity to the other discrete poles/zeros from the PID. Even worse, he didn't realize that in the extreme, the system could go completely unstable with in bounded oscillation!
Sometimes when I look at why different individuals react differently to the same observations, it’s interesting to speculate how their P, I, and D weights are resulting in different conclusions.
*or Z transform if the system is discrete
Furthermore, the equations will tell you whether you even need the "I" and "D" parts of PID.
The higher level system (surgery robot) also had a closed loop so we didnt have to be perfect, but cleaning up gave higher bandwidth.
https://fbswiki.org/wiki/index.php/Feedback_Systems:_An_Intr...
(In full disclosure, this is a resource that I put together)