Part of our system involves a feedback loop with a PID controller. We log every call to the PID controller, and include in the log information about the Kp, Ki, Kd, the set point, the input, output, timestamp, etc.

Surely we can use this historical information to improve our PID controller's Kp, Ki, Kd parameters. Any advice on how? And keywords I should be searching for?

(This seems like a very common problem, as the efficiency of parts wears down over time, it's desirable to have the PID parameters update automatically, either online or offline).

  • $\begingroup$ Is there a particular problem or symptom you are trying to address? $\endgroup$
    – Pete W
    Sep 24, 2021 at 14:05
  • $\begingroup$ Simply that I'll be collecting data on our PIDs, and I feel like it's information we can use to improve the PIDs. We will also be deploying "stock" parameters to our fleet of machines, and it would be nice for each machine to be able to tune itself online from it's own performance. $\endgroup$ Sep 24, 2021 at 15:00
  • $\begingroup$ I think self tuning can be potentially hazardous. A safer approach might be to collect the data and monitor for any deviations based on the inputs and outputs to detect wear or other problematic behavior. $\endgroup$
    – NMech
    Sep 24, 2021 at 15:20
  • $\begingroup$ If you want to share more details about the system, it might be possible to say something $\endgroup$
    – Pete W
    Sep 24, 2021 at 21:33

1 Answer 1


Self learning controllers are a dangerous topic. This is mostly because a large bit of the data you collect is noise. Separating noise from the actual important signal is never feasible. This means that if you would alter your PID parameters automatically based on data, you will most likely reduce performance and in the worst case even lose stability.

However, that does not mean this data is useless. Aside from determining when the controller must be redesigned or components need replacement, you can use the data to tune feedforward parameters. Feedforward allows you to improve tracking performance by reducing classical non-linear attributes from a system. Think of static friction, coulomb friction etc. Tuning feedforward can be done by hand, and thanks to its internal structure, stability and bandwidth are still regulated by the PID, therefore you cannot lose stability (that does not mean you cannot break the system, be careful).

If you are to lazy to tune feedforward parameters by hand, you can use your data to automatically learn the optimal feedforward parameters. This can be done using something known as Iterative Learning Control (ILC). ILC is known to optimize Feedforward such that it can perfectly track one reference sequence. This is useful if the controller has to track the same reference all the time. However, when it must track something else, tracking performance drops significantly. This behaviour is much less present when the Feedforward parameters are tuned by hand.

  • $\begingroup$ noise- the big reason most pid controllers don't use much d $\endgroup$
    – Tiger Guy
    Sep 24, 2021 at 16:33
  • $\begingroup$ Similar to tuning a feedforward, if the control scheme contains blocks that "linearize" parts of the system, like the opening point of a valve, this is a good candidate for auto-calibration. Another thing that is good to target is changing mass/volume/pressure etc as a bottle or tank is emptied, although this is maybe better done with gain-programming. $\endgroup$
    – Pete W
    Sep 24, 2021 at 21:28
  • $\begingroup$ The iterative feedback is great for machines that cycle with a steady rhythm, so if we're looking at manufacturing-automation stuff that's a good idea $\endgroup$
    – Pete W
    Sep 24, 2021 at 21:35
  • $\begingroup$ I'm naive, but I'm not convinced that I shouldn't adjust the PID parameters. During tuning of the PID, I'm fine-tuning parameters to make things look good, based on observed data. Is it really that dangerous to fine-tune automagically? $\endgroup$ Sep 25, 2021 at 17:19
  • $\begingroup$ Also, thank you for the reference on feedforward - that is new to me and something that definitely can be developed with this dataset. $\endgroup$ Sep 25, 2021 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.