Live data from Hacker News

PID Controller Explainer (2022)

ben.bolte.cc

11–20 of 40 posts

Re: PID Controller Explainer (2022)

#11
I've always found it interesting how PID system theory and especially tuning seems so empirical, especially in how it's taught.

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!

Re: PID Controller Explainer (2022)

#12
post #2

The most succinct and intuitive explanation I’ve found on PID is this one: https://www.youtube.com/watch?v=4Y7zG48uHRo

I used to design PID process controllers in industry. In watching this vid I realized one reason that designing a self-driving car is so difficult. Toward the end, in the process control diagram, he has [Vehicle] as the controlled process. This reminds me of the old math joke about "assume a spherical cow". The difficulty with a self-driving car is that it isn't just the vehicle that has to be controlled but [Vehicle + Current Road] so the controlled process is not just difficult to model but that it is changing all the time and sometimes rapidly.

Re: PID Controller Explainer (2022)

#13
post #4
post #2

The most succinct and intuitive explanation I’ve found on PID is this one: https://www.youtube.com/watch?v=4Y7zG48uHRo

Just watched, and yes this is a very good explanation. My intro to PID controllers was when writing AI vehicle steering for video games. I wasn’t taught about PID controllers in my CS degrees, so I started naively with what I would later learn is a P controller, and then got really surprised when lowering the gain turned into larger error. Like trying to smooth out the steering makes the problem worse, it was surpris…

[deleted]

Re: PID Controller Explainer (2022)

#14
For me, PID is one of those “algorithms” that has cool abstract analogies with life in general. I see it as a simple mathematical expression to how we react to things. Do we act “in the moment” (P), or with more conservatism and restraint waiting for consensus (I) , or speculatively skating to the puck (D).

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.

Re: PID Controller Explainer (2022)

#15
post #3

In the ‘what is a PID controller’ section, it doesn’t mention time delay. PID controllers solve problems where there is a time delay in the system between inputs and corresponding outputs. If there is no time delay, then a PID controller won’t help. 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 (s…

I have tuned mountain bike suspension (recently) and took undergrad control systems theory class (ages ago). And I am struggling with the PID analogy here.

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.

Re: PID Controller Explainer (2022)

#16
post #3

In the ‘what is a PID controller’ section, it doesn’t mention time delay. PID controllers solve problems where there is a time delay in the system between inputs and corresponding outputs. If there is no time delay, then a PID controller won’t help. 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 (s…

PID success does not relate to time delay except the additional phase.

Re: PID Controller Explainer (2022)

#17
post #11

I've always found it interesting how PID system theory and especially tuning seems so empirical, especially in how it's taught. 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, wel…

Yeah, the ideal-ness of electronics is much better than other systems like mechanisms, chemical plants, etc. In systems with substantial unmodeled effects the principled methods for tuning don't work as well. But I agree that knowing the theory is still super important sometimes.

Re: PID Controller Explainer (2022)

#18
post #8
post #5

Any recommendations for an algorithm for safe online PID tuning? Maybe something involving pole placement or frequency response analysis?

I've used this successfully for some hardware projects: https://pidtuner.com/#/

That looks like it's using the step response, which is on for an offline tuner but it wouldn't work for online tuning. Think of an automotive cruise control--to measure the step response the controller would have to floor it, which wouldn't be safe. I'm looking for something that slowly, continuously optimizes the tuning parameters as the controller is running.

Re: PID Controller Explainer (2022)

#19
post #3

In the ‘what is a PID controller’ section, it doesn’t mention time delay. PID controllers solve problems where there is a time delay in the system between inputs and corresponding outputs. If there is no time delay, then a PID controller won’t help. 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 (s…

Are you saying that a PID controller would not work in a system without time delay? Or in a system without time delay, a PID controller would function identically to a simpler controller (A proportional-only controller perhaps)?

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.

Re: PID Controller Explainer (2022)

#20
post #5

Any recommendations for an algorithm for safe online PID tuning? Maybe something involving pole placement or frequency response analysis?

It really is mostly empirical, especially since any real system has limits on the amount of proportional, derivative, or integral control authority you can apply. Still, every controls student is taught Zeigler Nichols, and are simultaneously told by their professors that nobody uses it. https://en.m.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_meth...
Post reply on HN