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 advanced topic but don't worry, you don't need the mathematical details to use it. 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 that into an equation to predict good controller gains? 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 performance measure function, but what is the relationship between the performance measure and the adjustable gains? In a way, this is the same problem, but pushed to a different place and still difficult. The Iterative Feedback Technique [2] offers a new approach for adjusting the gain parameters for low order linear controllers such as PID. Rather than trying to estimate unknown plant parameters, it circumvents the problems in three ways.
Self-tuning PI controllerThis note describes a variation of the Iterative Feedback technique, reduced for the special case of a PI controller regulating a fixed level, but extended for online operation. 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 Iterative Feedback method requires large disturbances inconsistent with online operation. The modified controller uses a superimposition principle, with small injected test signals that ride on top of a fixed setpoint level signal. In fact, any setpoint adjustment will abort tuning activity, so you cannot use this method while continuously tracking a changing setpoint level. 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 below shows the response of a plant to a step disturbance using the initial gains, before automatic tuning. The plant has a dominant and secondary lag plus pure time delay response (but of course the controller does not know anything about this). You can observe that the magnitude of the test disturbance is about 200 converter counts, which is less than 1% of the full scale level of about 32000 counts. You can also observe that the response is sluggish, taking about 40 controller updates to settle. 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, C1 describing the gains applied to the command input signal, and C2 describing the gains applied to the feedback signal. Controller gains are adjusted but always known precisely. The combined effect of these two "filters" equals PID control. The plant model P is unknown and includes any derivative feedback effects if present. The transfer response to the command signal r and to the disturbance d is described by the following familiar command-to-output transfer function T. 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 r on the plant output. We make use of this fact for the superimposition principle. Performance measureThe Iterative Feedback approach uses a performance measure for describing a "good" PID loop tuning. We use an average of the command tracking error squared, for a performance evaluation with minimal complexity. The tunings tend to cancel disturbances efficiently, but at the expense of some overshoot. 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:
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 PIZST command uses a variable step method in an attempt to accelerate convergence. 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 loopThe self-tuning PID processing can be configured by substituting the PIZST command for the PIDZ command[3]. 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 PIZST parameters are:
Conclusions The There are helpful or mandatory ways this processing might be extended — let us know what you think.
While there are plenty of technical questions related to what should go into the package, making the package is not a problem. The channel architecture of Data Acquisition Processor systems provides all the basic features: fast, accurate signal conversion, configurable data processing, task independence, and CPU power for reliable real-time response. 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. |