## Online Self-Tuning PI Controller | |

## Introduction(View more Control information or download preliminary software modules.) This note describes an experimental PI controller augmented
with automatic self-test and self-tuning features. While not
a fully commercial implementation, this controller has some
interesting features that might make it useful in its present
form. This might be considered an With a PID
controller, or particularly with a PI controller, there aren't
many gain terms to adjust — how hard can it be? Plenty
hard, as it turns out. Controller gains always appear in
combination with unknown plant parameters, so the closed loop
performance defies conventional mathematical analysis. Usually,
the reason for PID control is that you really don't have a
system model, nor the time to derive one. Maybe all you have is a
general level of confidence that PID "should be good enough for
this kind of system." How do you put Lacking an accurate model, lacking even an approximate model, you might try to "get by" using historical loop tuning rules. That's fine, but the apparent simplicity hides some serious disadvantages. You are required to take the system offline for some tricky frequency response tests that relate only indirectly to the objectives you are trying to achieve. To tune the control loop after it goes online, you must either resort to "trial and error" or repeat the offline measurement process.[1] Rather than trying to specify system behaviors in terms of
various analytical artifacts such as critical frequencies and
phase margins, you might decide to concentrate on results.
This approach leads to a The - The terms in which interacting control and plant parameters appear together become measurement terms, substituting observations for theoretical analysis.
- Special input sequences are constructed as test signals, based on previous measurements, to remove dependence on unknown parameters.
- The method does not determine specific gains to apply, but it does produce incremental adjustments to improve the existing gains.
## Self-tuning PI controller This note describes a variation of the The dilemma of online tuning is that you don't want to disturb the system too much because that interferes with production. On the other hand, if nothing changes, tuning is impossible because you can't observe the dynamic loop response. The original The modified controller operates on an adjustable cycle. Each tuning test cycle is followed by a period of undisturbed operation using the adjusted controller gains. ## A demonstrationBefore getting into the technical details, here is a quick demonstration of what it can do. The self-tuning process was incorporated into the The red trace in Figure 1 - Before Tuning KGAIN = 4.000 TI = 0.350 TD = 0.00001 ZGAIN = 0.800 TSAMP = 0.05 Figure 2 shows the same simulated system, after 250 incremental gain adjustments. The response now settles in roughly 15 controller updates. The PI controller has "tuned itself." Figure 2 - After Self-Tuning KGAIN = 10.2224 TI = 0.2620 TD = 0.00001 ZGAIN = 0.9973 TSAMP = 0.05 ## Notations and equationsWe need a reference model to describe the control loop action, even if we don't know all of the model parameters. The controller action is organized into two control paths,
The transfer response to the command signal It is presumed that the plant is approximately linear, and
there exists a constant level on the command input that will
sustain a desired output level, so that a stable PI control loop
will eventually settle to hold the command level ## Performance measure The ## Performance measure gradientA controller based on the PIDZ command [3] has four adjustable parameters: loop gain, command path gain, integral gain, and derivative gain. The derivative gain term is ignored by the tuning process. The gradient of the performance measure describes how much performance changes in response to an incremental change in the gain parameters. Because the derivative gain is not adjusted, its sensitivity term is fixed at zero. Observing that changes in the plant output level appear directly as changes in the tracking error, we can differentiate the performance measure with respect to parameters to obtain the following gradient expression. To obtain the first term, we can run an injection experiment,
injecting disturbance sequence Some observations about this expression: - The
`1/C1`filter is the inverse of the PID gains on the input path. We can derive this discrete filter by inverting the equation of the discrete PI controller, producing a simple digital filter in the form`y` where K1 and K2 are directly determined from the current controller gains._{0}= y_{-1}K1 + (x_{0}-x_{-1}) K2 - The last term of the gradient expression is
the
`1/C1`filter applied to the predetermined input disturbance. Knowing the PID gain settings, we can analytically pre-compute this sequence. - The
`T`notation is the transfer function of the closed loop system. We do not know what this is because the plant P is unknown. But we can observe the response of the closed loop to a known injected disturbance`1/C1 d`to observe response`T 1/C1 d`in combination. - The expression in square brackets contains an additional
transfer function term
`T.`This presents the same kind of dilemma again. We don't know what`T`is, but we can observe its response to the disturbance`T 1/C1 d`we observed in the previous experiment. This process of taking the output of the previous experiment and feeding it back into the input as a new test signal motivates the name*Iterative Feedback*. - The gradient expression then consists of a combination of the known sensitivity vector terms with the observations from the direct injection experiment and the iterated injection experiment.
## Limitations of gradient tuningInitial gains must be specified. It is usually easy to guess safe and stable gains. For the systems where this command might be used, selecting gains that are a little low is sufficient to ensure stable operation. The gradient expression produces a direction, not a magnitude. To determine how much to change the gains in the direction indicated by the gradient, an appropriate (but somewhat ad-hoc) "learning rate" factor is applied. Gradient methods have a well-deserved reputation for starting
slow and getting slower. Near an optimum, the adjustments approach
zero. As a partial compensation for this inherent slowness, the
Disturbances can occur during tuning or during normal operation. If disturbances occur, they will influence the tuning results short term, and gain values will "wander" in the neighborhood of the optimum settings. For normal systems, small gain variations have no significant impact on loop stability. ## Configuring a self-tuning loop The self-tuning PID processing can be configured by
substituting the CONSTANT DISTSCALE FLOAT = 0.005 CONSTANT ADJSTEP FLOAT = 0.00025 CONSTANT UNDISTURBED WORD = 4000 PIZST( PSET, PIDIN, \ KGAIN, TI, TD, BGAIN, TSAMP, \ PIDOUT, LOWLIM, HIGHLIM, \ DISTSCALE, ADJSTEP, UNDISTURBED ) The gain parameters are the same as in the original PIDZ command, except they specify initial gain values only. The three new *the magnitude of the injection signal, as a fraction of full output range* (Careful, this is not the same as a fraction of the operating level.) A value of 0.005 to 0.02 is typical, depending on how much disturbance your process can stand.*a "learning factor" for converting the gradient into gain adjustments* It is typically around 0.0001 for a disturbance level of 0.01. You will have to experiment to find a level that produces reasonable, slow but steady improvement. If you decrease the injection signal, you might need to increase the learning factor to preserve the learning rate.*the number of samples of "normal undisturbed operation" between tuning experiments*
## Conclusions The There are helpful or mandatory ways this processing might be extended — let us know what you think. - Learning and scaling factors should be easier to use.
- Extend the analysis to tune the derivative term as well.
- Modify the performance measure to reduce transient overshoot.
- Near optimum, the disadvantages of the test disturbances outweigh any possible benefits from further performance gain. Reduce tuning activity until a need for it is apparent.
- Provide supervisory control. Allow tuning to be enabled or latched. Allow manual overrides of gain settings.
- Provide observability. Make it easy to obtain test results on demand. Make it easy to observe the current gain settings.
While there are plenty of technical questions related to
what should go into the package, making the package is not a
problem. The Self-tuning controls are not the perfect solution for every application, but they might be near-perfect for some. If you can trust a controller to maintain itself near optimal performance, that means productivity gains plus reduced maintenance effort. It would be great if you could trust it to work perfectly all the time, every time. As a practical matter, however, it needs to prove itself with each application. If it does work well, that means one less controller needing constant attention, leaving time for working on the more difficult problems. ## Footnotes and References:
Return to the Control page. |