Online Self-Tuning PID Controller
A previously posted note on this site describes an experimental PI controller augmented with automatic self-tuning features . Why not a PID controller? This article explains why. It also shows how a classic tuning strategy, unsatisfactory in itself, makes a useful complement to the self-tuning strategy, extending the method to full PID control.
Why Not Just Extend the Original Method?
We did that. We were not happy with the results.
In theory, the iterative feedback technique  used for the self-tuning PI controller  is equally valid for PID controllers or any kind of
low order controller. Whatever the tuning parameters are, you
have to expand the math and derive the filters to estimate
the required gradient terms, but this is basically an
algebraic exercise. Adding an additional new gradient term for
Problem of Estimation and Noise
The transfer function for a derivative operator in the
Laplace frequency domain is
In the iterative feedback scheme, the filters for estimating
the gradient of the D-term gain have an
Problem of Cross-Purposes
If you are familiar with the effects of PID gains (see for example the tutorial article  on this site), you know that when a system is operating too close to its stability limit, it tends to oscillate. Some reasonable tuning strategies to correct this are
Similarly, if the system response is too heavily damped and sluggish, try the opposite.
The integral feedback and derivative feedback adjustments tend to adjust in the same manner except opposite in sign. Maybe one should be adjusted more than the other, but the gradient will have difficulty discovering this. It tends to follow the patterns above, ratcheting the integral gain up and the derivative gain down, then ratcheting the integral gains down and the derivative gains up, responding to slight variations in the data. Maybe none of the results are particularly bad, but there is little progress toward stable gain settings. The wandering is easily driven by the noise from the estimator filters.
Raising The Dead
Can we substitute a more productive behavior than the "wandering" driven up and down by noise? Strangely enough, we can draw motivation from a very old source: PID tuning rules.
Another technology article on this site treats the historical Z-N Tuning Rule  rather rudely. The underlying idea isn't bad, it is just that the assumptions under which the rule is valid usually lie so far from reality that it is hard to take the results seriously. However, we can observe that, in the end, the tuning rules select integral and derivative time constant parameters using formulas of the form
Ti = C1 * Tc Td = C2 * Tc
Td = C2/C1 * Ti
The value of the
A heuristic observation based on the tuning rules:
Provided that the fundamental nature of your system does not change drastically over time, the ratio of integral to derivative gains will be about the same in any good PID loop tuning for your system.
What is the best ratio? You will have to make that determination, depending on your system. It seems reasonable to start with something roughly in the middle of the range that works for Ziegler-Nichols-style tuning rules — 0.4 for example. If you are not satisfied with the results, try values of 0.2 and 0.6 and compare.
Integration Into the Self-Tuning Controller
To include the tuning ratio heuristic in the self-tuning PI
controller, start with the
Without formal proof of convergence for this approach, testing has shown that it converges very much like the original P-I controller tuning. There appears to be no particular reason to use both command forms. If you don't want to use the derivative gain term, just set the gain ratio parameter value to zero.
For a baseline case, the gain ratio parameter is set to 0 in a simulation of a sluggish, noisy low order system under closed loop control. This disables the derivative term, yielding the same tuning result as the original P-I configuration. The self-tuning process is allowed to run to convergence. At this point, its response to small online step disturbances is shown in Figure 1.
Figure 1 - Self-tuned PI Control
Now the tuning ratio parameter is set to the value 0.35, enabling the derivative control action according to the tuning heuristic. The experiment is repeated. After tuning, the step disturbance responses are as shown in Figure 2
Figure 2 - Self-tuned PID Control
You can see that there are some subtle differences.
That the results are not dramatically different is no surprise. The differences are basically between using or not using derivative gain in PID loops. Sometimes the benefits are significant, sometimes not.
The self-tuning PID controls can be well suited for systems in which
The implementation is an interesting example of the flexibility of a DAPL processing command for implementing a control strategy. A theoretically appealing feature doesn't want to work out? With the implementation available in the form of a maintainable DAPL processing command, you can fix the problem. You don't have to throw away everything and start over.
Adaptive and self-tuning methods seem inherently risky. They
change — into what? Can you trust them to change in a
beneficial way? To give the
Footnotes and References:
Return to the Control page.