by dahart · 2y ago · 0 comments
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.