Você está na página 1de 6

A RULE-BASED ADAPTIVE PID CONTROLLER

Kevin L. Anderson, Gilmer L. Blankenship, and Lawrence G. Lebow’

Electrical Engineering Department


a n d Systems Research Center
University of Maryland
College Park, Maryland 20742

ABSTRACT The expert controller knowledge base consists of experiential knowl-


edge about the process along with facts and rules that are used to
We describe a functioning “expert controller” implemented with infer which control algorithm to apply and what the current param-
Texas Instruments industrial programmable logic controller technol- eter settings for that algorithm should be. By periodically applying
ogy. In its present state the controller implements an adaptive PID identification routines and monitoring the results, the expert system
algorithm based on rulebased logical modules. The controller does could accumulate more and more information about a given process
not presume a model for the system. It detects several features of in order to find the best control law. Identification algorithms might
the current system response (to a step input change) and uses a pat- include methods for estimation of critical gain and periods and to
tern matching procedure to adjust the PID parameters to reshape Least-Squares algorithms for process parameter estimation [5].
the system output response.
3. Microcomputer Based Expert Controller
1. Introduction
The expert controller described here is based on hardware sup-
Expert control as defined by Astrom, Anton and Arzen [2,3,4,5,G] plied by Texas Instruments Inc. It is built about a Programmable
involves the construction of a composite control structure for a com- Logic Controller (TI5F5 PLC) and its supporting elements. The
plex process including supervisory functions, adaptive control algo- controller has an additional module, Expert Solutions Processor,
rithms, and low level control laws all managed by an expert system with personal computer capabilities, including a direct communica-
which monitors process parameters and control system performance. tion link with the programmable controller. The personal computer
In [2,3,4] a prototype expert controller was built using high level module allows the expert system to be programmed in high level
tools on a super-mini ~ o m p u t e r .This
~ work and the related work languages such as C, Lisp, Prolog etc. The hardware and software
of Moore and colleagues [11,7] and others [lo] has demonstrated the es of this system provide all the power necessary to build
potential value of expert systems in management of the full range and program an expert controller for certain industrial applications
on-line control functions from alarms to single loop PID feedback el- 3.1 Adaptive PID Control
ements. This paper reports on efforts to produce an implementation The objective of PID control is to constrain a process response
of an expert controller on microcomputer based systems, including to follow input setpoints. In general, the output is compared to
an industrial programmable controller. An adaptive PID controller the setpoint and the error signal e ( t ) is computed and fed back to
has been constructed as an initial step in the development of this a compensator that combines it with its integral and derivative to
implementation. produce the control signal u ( t ) as shown in equation (1)and Figure 1.

2. Expert Control

current and past information about the process under control. td&(t)
Many current industrial controllers include some heuristics for
safety net procedures [5].These heuristics may only handle extreme
“alarm” type situations, and a prescribed solution may be a plant y(t)
shutdqwn until human intervention can solve the problem. An expert 4output Process
controller should have the ability to udapt to changing situations and

An expert controller should have the capability of using several Figure 1: PID control loop.
different control algorithms as well as the ability to lune the param-
The key parameters in PID control are the proportional constant
eters of each algorithm to the process (loop) under control. Possible
control algorithms might include Proportional, Integral and Deriva- ICp, the integral constant t , and the derivative constant td. These
three “constants” can be manipulated to produce various response
tive (PID), pole-placement, linear observers or algorithms designed
curves from a given process. The whole concept for adaptive PID
for optimal control. Ultimately, the expert controller should have
control revolves around interactively changing these three values.
a library of relevant algorithms for process control and identifica-
The discrete time equivalent expression for PID control used in this
tion. The expert system would orchestrate the application of these
study is shown in equation (2). In equation (2), t is the sample period
algorithms depending on current conditions [5].
for the controller.
‘Now with Techno-Sciences, Inc., Suite 620, 7833 Walker Drive,
Greenbelt, MD 20770.
‘This research was supported in part by a grant of equipment and funds from
the Industrial Systems Division of Texas histruments, in part by the Engineering
Research Center of the College of Enginecring, University of hfaryland, and in
part by the Systems Research Center under NSF Grant CDR-85-00108.
3Specifically, the forward chaining production system YAPS and the object- The approach used in designiiig the Adaptive PID Controller
oriented Flavors system running on a \‘AX ll/T80. (APIDC) is based upon the methodology a human might use, given

88CH2531-2/88/0000-0564$1.00@ 1988 IEEE 564


the same task. That is: Given no previous knowledge about the on an IBM PC/AT equipped with analog interfaces. The simulator
process to be controlled, find a PID control law that yields a satis- utilizes the system timer interrupt to eliminate software delay loops.
factory response. It is first necessary to define “satisfactory.” It is Use of the timer interrupt allows the process simulation t o proceed
then necessary to prescribe some initial values for k p , ti and t d . Then uninterrupted in the “background,” while the user changes the pro-
task of (manually) tuning the response would begin. This procedure cess model or setpoint signal or runs other programs. The simulator,
would typically involve a repeated sequence of the following steps. when not responding to user requests, graphically displays the pro-
(i) Choose kp,ti and td. (ii) Monitor the process response t o a “typ- cess variable and control signal. This architecture for the expert sys-
ical” disturbance. (iii) Analyze the results and based on previous tem and process simulation is also suitable for offline simulations of
experience and knowledge, choose new values for ICp, ti and td. This the entire system. Since the 565 PLC is intended for use in industrial
sequence must be repeated for each tuning step. This is precisely the process applications, it uses 0.1 second sample rates. Simulations are
methodology employed by the APIDC. The details are discussed in much faster and are accordingly useful in design and testing.
the following sections. 3.3 Pre-tuning the Adaptive PID Controller
Initial values for the proportionality, integral error, and process
3.2 Configuration
Figure 2 illustrates the expert controller’s logical subsystems and derivative parameters are obtained in one of two ways determined by
a flag in the expert system’s configuration file. The first method is t o
their interactions. The Expert Solutions Processor (ESP) monitors
simply read the parameters from the 565 PLC which are assumed t o
the operation of the closed loop system looking for conditions that
have been set by the plant operator. The second option uses Ziegler-
require action. The physical seperation of tasks between the PID
Nichols auto-tuning to determine the initial PID parameters.
controller and the ESP ensures smooth operation of the control loop
while computations and decisions are being made by the ESP.
3.4 Rule-based Tuning for Adaptive PID Control
The expert controller’s tuning objective is t o determine PID con-
trol parameters such that a “satisfactory” response is obtained. Sat-
isfactory is defined parametricaly by the operator and specified t o
I the expert controller via a configuration file. A satisfactory response
4 ; User is defined by response features such as risetime, settletime and over-
I Expert Solutions Processor i shoot. A weight which specifies the importance of each characteristic
is included in the configuration file.
The concept of membership function has been borrowed from
Control ,: fuzzy logic and set theory to describe the functions used to aid in the

Setpjoint
u(t) : determination of a satisfactory response characteristic. The mem-
bership functions have a range of zero to one, where values near
T I 565 I Process one indicate “satisfactory” values. As the response characteristic

* Y(t) i move towards one “bandwidth” unit from the optimal value, “nor-
mal” membership functions return values closer to zero. This may
0

I not always be desirable so the configuration file requires an entry


;-----------------------------------. I to specify whether the parameter is “left-sided,” “right-sided,” or
“normal.” For left-sided parameters, all values less than the opti-
Figure 1: Current expert controller Configuration. mal value have memberships of one. For right-sided parameters, all
values greater than the optimal value have memberships of one. The
Texas Instruments supplied a model 565 industrial programmable weight of a response characteristic determines the proximity to opti-
logic controller (PLC) to implement the PID loop(s). The basic mal of the transition point between satisfactory and unsatisfactory.
configuration employs relay ladder logic, but it also provides PID Larger weig1it.s put the threshold closer to optimal. A weight of one
loops, allows special functions to be defined, and supports floating puts the threshold at half of the bandwidth from optimal.
point arithmetic. The PID loops provided by the 565 PLC can be of Six different features are currently monitored by the expert con-
either position or velocity form. They also provide numerous error troller to assess the quality of a controlled system’s step r e ~ p o n s e . ~
condition checks and handlers. Special functions are created with a The first three are classical overshoot, risetime, and settling time
high level language specific to the controller. This language provides parameters. A fourth is the peak height ratio which is defined to be
a number of unique statements to aid in the implementation of an the ratio of the second local maximum’s overshoot to the first’s. An-
algorithm. One such statement allows conversion between the A/D other characteristic is the average value of the first two local minima
interface data and engineering units. The programming language and maxima. The final parameter is the number of local maximums
also provides access to all the PID loop parameters. This is a key detected before the process settles.
feature which allows the expert system to monitor the process and 3.4.1 General Rules for Adaptive PID Control
change the PID loop. The expert controller functions by examining the system’s re-
Texas Instruments also provided the Expert Solutions Proces- sponse to set point changes. After each such change, the six key
sor (ESP). The ESP is an MS-DOS machine that is capable of com- features are computed and compared to the desired values using the
municating with the 565 PLC. The ESP can receive each sample of membership functions. The rule base is queried (sequentially), and
the process variable and the setpoint taken by the 565 PLC, as well rules which fire cause various changes t o be made in the PID con-
as the calculated output of the PID loop. This data is used by the ex- trol parameters. This is called the Membership Based Tuning Al-
pert system running on the ESP to change the PID loop parameters gorithm (MBTA). Small changes can be made to improve the per-
when necessary. formance; and large changes can be made in response t o emergency
An earlier version of the expert controller was developed [8,9] (instability) conditions. A weighted score ranging from 0 to 6.0 is
using P C Scheme (Texas Instrument’s MSDOS version of Lisp) to produced at the end of the tuning pass. Scores above 4.5 indicate a
carry out the analysis. It required disk files to communicate with good match between the ideal response and the actual response.
various support programs (written in C) executed from PC Scheme. The first rule tried on every pass is the alarm rule. Instability
The current implementation of the expert system is completely coded is identified during process monitoring by detecting that peaks are
in C. This has eliminated the need for disk files to pass information. growing in magnitude (top to bottom) as time progresses. Instability
It also permits large amounts of information to be stored in memory is decided when this condition holds for three peaks in a row. At this
for quick access. The result has been a great improvement in exe- point the monitoring procedure will set to zero in order to remove
cution speed. The new code also uses specialized data structures t o
help simplify further development of the controller. ‘We are also developing expert control rules for load following and other con-
The expert controller has been tested against processes simulated trol regimes. These will be described elsewhere [l].

565
the controller as a destab ng element from the feedback loop5 used in building a set of such rules for adaptive tuning.
The monitor procedure then terminates with the stability flag set Through simple, although extensive, trial and error analysis such
t o false (zero). The APIDC enters a waiting phase to give the process trends have been observed. This trial and error procedure consisted
time t o settle naturally before any other action is taken. When the of running tests with a significant cross-section of processes. The
process has settled, the rules are tested sequentially. The first rule testing procedure was as follows: Starting values for the parame-
is the alarm rule which fires. The pointer EOF (for End Of File) ters IC,, t, and t d were chosen arbitrarily and the process response
causes a transition to the end of the rule base, and no further rules to a setpoint change (or unit step disturbance) was monitored and
are tested. There is no need in trying any other rules if an alarm .noted. Then each of the twenty-seven possible choices for tuning
condition exists. The direct consequent of the alarm rule is t o halve the parameters was tried. The amount to adjust the parameters was
IC,, double t d , and leave t , alone. This has been found by experience varied between ten percent and twenty percent in different runs.
to be a good reaction to unstable responses; and it has the general By observing trends in the reactions of the six criteria of settle-
result of bringing the response back under control. time, overshoot, risetime etc. a rule could be derived. As the test-
One of the most important features of the APIDC is a history ing became more complete, the two typical process response types,
file which maintains a body of information for each tuning pass. At named type A and type B, became somewhat clearly defined, and
present the history file is used exclusively for information pertaining which direction t o tune the parameters for specific results became
t o adaptive PID control, but the concept and its usefulness holds more evident. In addition, an indication as to the amount to adjust
for expert control in general. The information saved on each pass each parameter relative to the others could also be ascertained. The
contains the following: the acronym for each rule that fired, the k,, information taken from all the testing for a Type A process response
ti and t d values used as result of the rules that fired, the results from is embodied in the structure Type A in Table 1.
the process response for each of the six criteria, the membership
ratings and direction off for each, and the score for this pass. (For
examples of history file see below.)
This information plays a significant role in the conditions tested
for by about half of the general rules in the system. (Sixteen rules
are currently implemented.) In addition to its internal role in the
system, the history Me, this feature provides a means for the user to
review the events that have taken place up to a given point in time.
The history file is stored internally in memory in a special matrix‘
data structure. It is also periodically written to disk for safe keeping
should the system crash. Table 1: Type A Tuning Rules
Several rules pertain to the situation where it is time to stop This table is used in the MBTA algorithm along with current
actively tuning the process response. One of three conditions may membership ratings to generate a tuning decision consisting of the
apply. These are: (i) when the score has been steady for five passes, percentage and direction each PID parameter should be adjusted.
(ii) when the score has been decreasing for five passes, and (iii) when The application of the information in Table 1 can be conceptually
the current score is higher than 5.5 ( a very high score) and has re- viewed as a body of twelve “if-then” type rules. However, the in-
mained in this approximate region for a t least two passes. The pur- ternal representation of the Algorithm is numerical in form with the
pose of each of these rules is t o have the controller recognize when it “if-then’’ portions buried in the code. Such a rule is (in psuedo-
is no longer making useful progress (perhaps the MBTA algorithm code):
has converged), or when it is actually headed in the wrong direction
after already finding a satisfactory PID control. The action taken as IF (settletime needs to be decreased) THEN <
a result of each of these rules firing is the same. A data structure Xkp-change = .7*(1 - membership(current-settletime))
called “bestpass” which holds an integer (or index) pointer to the %ti-change = . 6 * ( 1 - membership(current-settletime))
pass with the highest score on record is maintained by the APIDC. Xtd-change = .7*(1 - membership(current-settletime))
The APIDC accesses the values in the history file for IC,, t , and t d >
associated with this best score and assigns them as the values to be This rule uses two sources of information to compute the per-
used for subsequent passes. A best score is also saved and a dedi- centage changes for the PID parameters due to a need to decrease
cated monitoring stage is entered by the assignment of a flag called the settletime for a Type A curve. The values 0.7, 0.6 and 0.7 are
“monitor score.”
taken from Table 1, and are referenced by choosing the row for settle-
Rule number two for monitoring the score is then fired on every time and the subcolumn labelled “dec” (for decrease) under each of
subsequent pass of the process, until some significant change occurs
the respective columns for the three PID parameters. These values
in the process output. Should the score for a given pass drop more
are the experience factors learned from the trial and error testing.
than 0.5 below that with the best score, it is assumed the process The other key piece of information is the membership rating for the
has changed. Dedicated monitoring (via rule number two) is disabled
current value of the settletime. The rule for increasing settletime
and the entire tuning process, beginning with Zeigler-Nichols auto-
(usually undesirable as a goal) has the same format except that 0.7,
tuning, is started again.6 0.G and 0.7 are replaced respectively by -0.7, -0.3 and -0.7. Two
3.4.2 Membership Based Tuning Algorithm
companion rules like these can be defined for each of the six criteria,
General observations may be made about the behavior of a given
resulting in twelve rules in all. Twelve similar rules are implemented
process to adjustments in the PID parameters IC, t , and t d . Given
for Type B processes.
enough experience in tuning PID controlled processes, a plant control
For a typical tuning pass, six of the twelve possible rules will
engineer will often know which way t o turn each of the “knobs”
“fire” resulting in six indicated percentage adjustments for each of
to influence the process output. For instance, it may be possible
the three PID parameters. These values are added together to com-
to say that if one wishes to decrease the percentage of overshoot,
pute a total adjustment for each respective PID parameter. It is
then k, should be increased, ti should be decreased and t d should be
important to note that the experience factors in the table differ in
increased. As it turns out, there are some general trends that can be
sign. Thus some force a percentage increase in the parameter and
51n the present implementation we assume that all processes to be controlled some force a decrease. This corresponds to the coupled nature of dif-
have stable natural responses Shutdown or transition to a known stabilizing gain
ferent criteria. That is, action taken with the intention of decreasing
could also be used.
60f course, if auto-tuning has been disallowed by the nser, during controller
settletime is likely increase the percentage overshoot. Hence, the six
initialization, then the nser defined starting values are used Cor the three PID individual adjustments tend to counteract each other with the final
parameters. result representing a compromise.

566
The membership rating of each criteria for a given pass directly the most important criteria. The APIDC continued employing B
influences the final adjustments in the PID parameters. By includ- type tuning until iteration 19 before the steady score rule fired and
ing the arithmetic compliments for membership ratings in the com- PID parameters very close to those found on iteration 11 were settled
putation, the resulting decision or adjustment is reacting directly to upon.
the current process response. Those criteria with the lowest ratings It is important to note that although it took a significant number
dominate the percentage changes, yet they are tempered by the ad- of passes to settle upon the final PID parameters, the process was
justments indicated from all other criteria. The final adjustment for constantly under “good” PID control. That is, control was main-
each parameter is applied as a percentage change over the old value. tained while the controller tried small adjustments in an effort t o
The next pass implements PID control with these new parameters. find the optimal response curve. All coarse adjustments occurred in
This algorithm converges in a large number of cases. As member- the first four or five passes.
ships get higher, the resulting adjustments clearly get smaller and Although the system described here treats it in a very simple
more refined. way, the key to successful “expert control” is model identification.
Not all processes fit so neatly into type A or type B. In general, it . Many techniques exist for process identification but most involve
is likely that a major adjustment in the parameters might be needed repeated “offline” testing of the process. However, “off line” testing
to intialize the tuning procedure. The adjustments in the MBTA al- is not informative when the process is prone t o change. The answer
gorithm, while they reflect the membership ratings, are often rather is to build an expert controller that can learn about the process
small. Making the adjustments too coarse would effect the conver- “on line” while maintaining some level of control. From what it
gence of the algorithm. Also situations such as instability may arise learns, an internal model or configuration of the current process can
and must be dealt with directly. For these purposes a group of more be built. Based on this model and limited only by its completeness
general rules are included in the APIDC. It is also necessary t o have and accuracy, the best possible control can employed. The more
a means to choose which type of MBTA tuning is to be be attempted. the expert controller knows the better the control will be. An expert
The specific type of MBTA tuning is implemented as the result of controller requires the ability to learn about a process; and so, process
one of these general rules firing. One rule exists for each of the two identification is the key factor.
types.

4. Results and Conclusions


A variety of processes have been satisfactorily controlled by the
adaptive PID controller. Tests have been primarily with second,
third, and fourth order linear processes. Processes containing only
real poles are easiest to control. The controller can produce reason- Appendix
able results with a wide range of such processes with results only de- A session with the expert controller
teriorating significantly with some fourth order processes.’ Systems
with complex poles which are not too oscillatory can be controlled
successively by the system. The following paragraphs describe an
actual run with the APIDC.
Due to space limitations only one process tuning sequence will be
reviewed. The Appendix contains the six curves discussed and ex-
tracts from the history file. A process which presents a challenge for
the APIDC has poles at -.5, -.82+2.791 and -.82 -2.791. The Ap- Criteria Optimal Bandwidth Weight Curve
pendix contains plots and extracted history data from the APIDC’s Settling time 5.799 2.9 1.0 s
attempt to tune this process. Below each plot of the controlled pro- Overshoot 0.4 0.3 1.5 S
cess is a table of the criteria and their membership ratings. Risetime 1.393 1.393 0.5 S
The first table of the Appendix lists the values used to initialize Peakhtratio 0.25 0.5 0.2 Pi
the APIDC. The settletime and risetime are based on SS% and 33% Ave peak spread 1.075 0.2 0.5 Pi
percent of the natural response values respectively. As shown, op- Peakcount 2 3 0.2 s
timal percent overshoot was chosen t o be 40% or less, peak height
ratio 0.25 etc.
The first curve is the natural reponse of the process. In this exam-
2
, ple autotuning was allowed. The second curve show the response of
the system using the parameters from the Zeigler-Nicholsautotuning.
Those parameters were k, = 4.711, ti = 0.947 and, t d = 0.237. In
this case Zeigler-Nicholsauto-tuning has practically failed altogether.
’ By iteration 4 the “getting unstable” rule has fired and clearly suc- 1.5
ceeded in bringing the process back under control. However, this is
still not an ideal response and the APIDC must continue to search
for the “best” compromise in the PID parameters. By tuning pass
number 6 we see that the APIDC is actually headed in the wrong 1
direction. At least no significant improvement has been made using
type A tuning rules. On iteration number 8 the decision has been
made to switch to B type tuning. This response gets a higher score
largely because it is somewhat less oscillatory. The slightly awkward .5
looking curve in tuning pass number 11 has been reached by repeated
applications of type B tuning. This curve receives the higher score
mostly due to the reduction in settletime. This is logical based on
the original tuning criteria that weights settletime and overshoot as n
U

0 5 10 15 20
time (seconds)
‘“Reasonable” is as determined by the user, but scpres of 3.5 or higher are
generally accepted as reasonable.
Natural Response

567
2

1.5

I .5
U j
0
0
0 5 10 15 20 0 5 10 15 20
time (seconds) time (seconds)
Response After Auto-Tuning Tuning Pass No. 6

R u l e s t h a t fired: Z N l D Rules t h a t fired: 5-TYP 12-ATYPE


Resulting Parameters: k , = 4.711, t , = 0.947. t,, = 0.237 Resulting P a r a m e t e r s : k, = 3.25, t , = 1.546, t d = 0.529
Results
I Criteria I Value I MembershiD I Direction Off I
Settling time 8.599 0.002 High
Overshoot 0.106 1.0
Risetime 0.5 1.0

1.5

.5

0 5 10 15 20
time (seconds)
Tuning Pass No. 8

Criteria Value Membership Direction Off Criteria Value Membership Direction Off
Settling time 8.88 0.0 High Settling time 8.599 0.002 High
Overshoot 0.117 1.0 Overshoot 0.0 1.0
I

Risetime I 0.62 I 1.0 Risetime 0.56 1.0


Peakhtratio I 1.694 I 0.0 I High ' Peakhtratio 0.0 0.871 Low
Ave peak spread 0.897 0.159 Low
Peakcount 3 0.951 High
References
2 [l] K. L. Anderson. Expert Control and Adaptive PZD Control.
Master’s thesis, University of Maryland, College Park, May
1989. To appear.
[2] J.J. Anton, K.J. Astrom, and I<.-E. Arzen. Expert control. Au-
1.5
tomatica, 22, 1986. See also Proc. IFAC World Congress, Bu-
dapest, 1984).
[3] I<.-E. Arzen. Experiments with expert control. 1985. preprint.
1 [4] I(.-E. Arzen. Expert systems for process control. In D. Sriram
and R. Adey, editors, Applications of Artificial Intelligence in
Engineering Problems, pages 1127-1138, Springer-Verlag, New
York, April 1986.
.5
[5] L E . Arzen. Use of expert systems in closed loop feedback
control. In Proceedings of the American Control Conference,
pages 140-145, Seattle, 1986.
n [GI K.J. Astrom. Auto-tuning, adaptation, and expert control. In
0 5 10 15 20
time (seconds) Proceedings of the American Control Conference, pages 1514-
1519,1985.
Tuning Pass No. 11
[7] J. R. James and L. A. Rapisarda. An approach to implementing
Rules that fired: 5-TYP 13-BTYPE a knowledge-based controller. In Proceedings of the ZEEE CDC,
Resulting Parameters: k, = 2.181, ti = 0.845, t d = 0.971 1988.
Results
I Criteria 1 1
Value 1 Membership Direction Off 1 [SI L. Lebow. MiCTOCOmpUteT Based Expert Control and Adaptive
I Settling time I 6.1 I 0.977 I HiEh PID Control. Master’s thesis, University of Maryland, College
Overshoot Park, March 1988.
Risetime [9] L. Lebow. Proc. NATO Advanced Study Institute on CAD of
High Control Systems in Ciocco, Italy. Springer-Verlag, New York,
1987. To appear.
Peakcount Hinh
[lo] J. Litt. An expert system for adaptive pid tuning based on pat-
tern recognition techniques. In Proceedings of the Znstrumen-
’ tation in the Chemical and Petroleum Industries Conference,
pages 87-104, Secaucus, New Jersey, 1986.
[ l l ] R.L. Moore, et al. Expert control. In Proceedings of the Amer-
ican Control Conference, pages 885-887, 1985.

569

Você também pode gostar