4 ms·
Agree 100% The hardest part of PID for folks to get a handle on is how to tune it, ideally automatically. People often just twiddle with numbers and get frust
by DannyBee 3y ago
Agree 100%
The hardest part of PID for folks to get a handle on is how to tune it, ideally automatically.
People often just twiddle with numbers and get frustrated
For hobbyists, the availability of correct automated tuning algorithms is sparse, even though the algorithms are well known and actually not that hard once you translate "control theory speak" into "computer science speak". Most folks would be better off autotuning for their systems.
I actually wrote and published some auto pid tuning code years ago that uses the relay method here: https://github.com/dberlin/PLC-PID-Autotuner https://github.com/dberlin/PLC-PID-Autotuner
(It's in PLCopen, but i can give you codesys versions/etc if you want, and converting to something like arduino would take no time, but someone finally made a working arduino library i think)
Nowadays you can find a few more working libraries, but still.
One example: I use a PID to control a vacuum motor on my CNC machine being used to hold down parts, set to achieve a certain amount of PSI in clamping pressure. The system is basically undisturbed for long periods of times, but a hole gets cut in the part and the amount of vacuum needed to maintain hold-down goes up.
This is a very simple system - it needs fast response, but the response is very straightforward - there is a very direct relationship between speed of vacuum motor and hold down pressure. It can also be safely overshot, but not undershot.
(IE if it goes wild and moves the motor too fast nothing bad happens, but if it wildly undershoots it the parts move and get ruined :P)
Simple autotuning methods work great on this kind of system. I watch people twiddle with values, you name it. It takes about 2 minutes to auto-tune a pid here (mostly swapping a part with no hole and a part with a hole) and the result will be better than anything you come up with manually.
There are more complex methods, as GP mentioned, but they won't drive much better results than you are already geting for this kind of system.
The place where PIDs fall down (in systems hobbyists might use) tends to be something like controlling the temperature on a big green egg. They can maintain a steady state to within 0.1degrees or whatever once warmed up, but they get super-confused by the warm-up time. They can also oscillate into chaos very easily because of the lag time between "blowing on fire" and "temperature probe notices result" (which is highly dependent on accuracy and response tme of the probe). Overshoot is also bad because the only way to make temperature go down is to stop blowing on the fire, etc.
The result is that most smoker controllers have a warmup time/phase before they engage a PID, and then carefully adjust to avoid overshoot.
While more advanced methods might control this completely without the need to do the initial warmup phase, it's not obvious to me the complexity is worth it for that sort of thing. You are talking about going from simple loop that you can plot and reason about to often much more complex mathematical formalisms.
It can quickly become an even more magic box that you can't touch.
There are of course, places it is worth it, i just doubt most hobbyists will run into them.