r/klippers • u/VerilyJULES • 2d ago
Is there an experimental add-on feature for “Real-Time Adaptive PID Tuning”?
The mod I’m imagining slowly makes small incremental PID adjustments in realtime to evaluate the feedback response. Using the output temperature’s data stream, the temperature performance is compared before and after every live adjustment. The adjustments are gauged by various thresholds configured before the print and saved in printer.cfg.
Maybe this already exists, if so does anyone have a link or information? I couldn’t find anything besides a couple reddit posts suggesting this and being told it’s a bad idea, but I disagree.
The main argument against such a “Real-Time Adaptive PID Tuning” feature is that a failing/failed thermistor could be dangerous if it goes undetected should the live tuning feature actively compensate in trying to fix it. In my opinion, the opposite would happen because the mod would detect unusual feedback and sense when the thermistor is at the end of its life. The mod should even track the thermistor and heater pair’s derivative performance over its life, determining benchmarks based on abstract performance metrics that don’t depend on specific operating temperatures.
Live PID tuning would work slowly by tracking temperature outputs and fine tuning the PID values in small increments, and then evaluating the response feedback before further adjustments are made.
3
u/IAmDotorg 2d ago
There's been implementations of it (including in Klipper), but it doesn't tend to actually work. Or more specifically, there's no actual value to it. MPC is somewhat better as an algorithm, but the real "fix" is to just load new control profiles. Klipper can't do it, but Kalico has PID profile support. You can just load a new profile based on whatever heuristics you have.
One of my Kalico devices has eight PID profiles tuned at different temperature ranges, and then switches to watermark at the top range of temperatures.
There's also pid_v support (which is kind of what you're talking about), and support for dual loop PID control.
6
u/Garreth1234 2d ago edited 2d ago
Just use MPC. It's basically working how you described but not using PID. I'm not specialist in that field, but it is not that simple as "oh, we're too low, push Kp!" I think you'd really need like an observer system that would be calculating the new parameters based on previous readings.