Sunteți pe pagina 1din 5

Implementing a Real-Time Knowledge-Based Controller in a Velocity Controlled, Servo Motor Control System.

Robert J. Finocchio, Andrew J. Blauch, Terry S. Lorincz Reuven Meth and Brian P. Butz
Department of Electrical Engineering and Intelligent Systems Application Center Temple University Philadelphia, PA 19122
ABSTRACT

components:
1) IBM PC/AT - Used as a processor for the CLIPS Expert System Shell, for running intermediate and interprocessor communication software, and as a host for the DSP peripheral.

Systems whose parameters vary with time present a challenge to a control systems design engineer. These parameter variations might occur due to system overloading physical changes in components due to wear, or the inherent nonlinearities of elements. One method that may be used to compensate for these variations is to incorporate human knowledge, in the form of an expert system into the control system. This paper describes a real-time, knowledge-based controller that has been developed and implemented successfully in a servo motor control system.
Introduction The system described herein maintains a constant velocity at the output of a dc servo motor in the presence of unknown parameter variations occurring within the motor. The constant velocity is maintained using a expert system which modifies the compensator in real-time. Most expert systems require a relatively long period of time to execute in relation to the process being controlled. An architecture which overcomes this problem has been proposed by James and Rapisardia [ l ] which uses a Digital Signal Processor for real-time control and an IBM AT for the inference engine. The Knowledge-based controller described in this paper uses the hardware setup of James and Rapisardia. The software executing on the dsp board has been programmed as a tunable PID controller as opposed to a FIR or IIR with adjustable coefficients. In addition to real-time control, the real-time processor executes a program module that calculates the standard deviation of the output of the system in real-time. By using this module and similar modules to obtain system information, the time the expert system can react to system change is reduced. System Configuration Hardware The hardware for the system consists of three major

2) Atlanta Sianal Processor Inc. (ASPI) 320/PC-10 Mother Board - DSP board programmed as a PID filter that is used for controlling the system. The board contains a TMS320/10 processor that runs independently from the host and dual port memory that is accessible to the TMS processor and the host. 3) Feedback Modulo Servo System MS150 - Individual modules including a DC servo motor, servo amplifier, tachometer, power supply and op amps that are used as the basic components of the control system. For a more detailed description of the architecture of the knowledge-base refer to James [ l ] . Software The following software systems and packages were used: 1) CLIPS 4.2 - Expert System Shell used for implementing the rules of the knowledge base. 2) TMS320 Assembly Tools - Used to assemble, link, and download the TMS320 program. 3) Turbo Basic - Used for the intermediate and interprocessor communication software. System Overview The complete knowledge-basedcontroller exists in an IBM AT. A digital signal processing peripheral (the ASPI 320/PC-10 mother board) has been installed on the IBM AT host which implements a programmable Proportional plus Integral plus Derivative (PID) compensator. The

TH0333-5/90/0000/081l$Ol .OO 0 1990 IEEE


_ _
-

811

peripheral has an analog output supplying a dc servo motor actuating signal and an analog input receiving the sensor velocity feedback signal. To set the motor at a desired speed, a user types the necessary voltage at a screen prompt on the IBM. The expert system shell (CLIPS) supplies this voltage to the peripheral as a reference signal and begins to monitor the output of the motor. If the velocity drifts from the desired output, CLIPS will adjust the proportional gain constant of the PID to maintain the proper steady-state velocity. At this time, rules do not exist to adjust the derivative and integral gains of the PID.

G(s) =

K
S(TS+I)

The time constant ( 5 ) for the motor used was calculated by observing the transient response of the motor due to a step input and was found to be 1.34.

Tachometer Model
The tachometer model was found to be a linear gain between rpm input and voltage output. This gain (4)was found to be 1/390.

System Requirements WtviOTORt


Three assumptions have been made which must be satisfied for the system to properly compensate for unknown disturbances. First, the system must be stable for all reasonable system disturbances. Second, the steady-state response of the system must be a constant velocity, i.e. it can not be a time varying signal. Third, the compensator must not need modification while the system is in a transient state.

+TACH

PEPEREHCE UOLIIIGE
Figure 1: Closed Loop Control System

System Operation
The DSP board is loaded with a program written in TMS320 assemblers. This software implements a PID comDensator in real-time. The program is written so that the gains of the PID can be adjusted at any time during system operation. These gains are changed via the host, by writing to shared memory locations between the host and the peripheral board (dual port memory). In addition to implementing the PID and the summer in real-time, the DSP peripheral also performs other calculations in real-time. The purpose is to supply CLIPS with system information. The information supplied is the standard deviation of the error signal and the average error signal over the most recent 512 samples. The standard deviation of the error signal is used to determine when the system has reached a constant steady-state value. The standard deviation was used to determine when steady-state has occurred for three reasons. First, the algorithm is simple and easy to calculate on the peripheral board in real-time. Second, the standard deviation filters out noise spikes which occasionally corrupt digital data sampled from the peripheral's analog input. If not tended to, this noise would cause the system to appear in its transient state. Third, the average error signal is the steady-state error signal if the standard deviation is below a specified amount. This average is readily available from the standard deviation calculation.

System outlined in bold box is implemented in TMS320ClO software. The ReferenceVoltage, Gain Adjustment,and Error Signal are accessible to the expert system.

Figure 1 shows the closed loop, velocity feedback, PID compensator control system. There are three important characteristics of this configuration. First, the summer and the PID compensator (shown in the box of Figure 1) are not physical components in the system; they serve as models implemented in TMS320 software. This software implementation allows the gains of the PID compensator to be changed by the IBM AT during system operation. Second, the analog input to the DSP board is the sensor feedback signal from the motor and the output of the DSP board is the output of the PID compensator. Third, a step reference signal is supplied via the IBM AT allowing the user to change the reference signal, hence the velocity of the motor, from the keyboard of the IBM AT.

Component Modeling Plant Model


The DC Servo Motor was configured to be armature controlled. The form of the transfer function for such a motor is given by the following equation:

812

supplies the expert system the current standard deviation

900

Expert System CLIPS Rule Construction A first set of rules was designed to set up the initial values for the system and to read in the desired reference signal (U) from the keyboard. This second rule is fired every time the user strikes a key on the keyboard. This allows the user to change the reference signal while the system is running instead of having to restart the system. A second set of rules was constructed to evaluate the error signal to determine if a correction is necessary. By knowing the input to the system (U), the feedback constant (K,), and the error signal (E), the actual output of the motor in rpm (Wa) is calculated using the equation: W a = u .

- Unmodified closed loop response


The third set of rules modifies the proportional gain of the filter based on the gain error determined. A simple heuristic was used to modify the proportional constant (Kp). An increment of O.l*GE is added to the old proportional constant. Note that a positive GE corresponds to an output lower than desired and a negative GE corresponds to a higher output than desired. Therefore the signs agree (a positive error means Kp must be increased and visa versa). Intermediate Software All communication was accomplished by writing individual BASIC programs which read, wrote, or polled the memory of the real-time processor or the IBM AT keyboard. These programs were then executed by the expert system running them in a Disk Operating System (DOS) shell. New filter gains are written to a data file by the CLIPS software and are then converted to the appropriate format and placed into the dual port memory of the DSP board by an intermediate program. This method was chosen because of problems encountered by integrating program modules into CLIPS. The result of using this means of communication is a slower reaction time of the system. The latest version of CLIPS has been obtained which includes the source code necessary to integrate program modules written in C language into the expert system. This is expected to reduce the reaction time of the system dramatically. At present, the time between reading system information and writing a new gain to the filter is slightly less than two seconds. To provide the CLIPS software with the error signal's mean and standard variation over the last 512 samples, an intermediate program was written to read preset memory locations in the dual port memory of the DSP peripheral. These values are then converted to decimal form and written to a data file that can be accessed by the CLIPS software. To allow CLIPS to set the system input, an intermediate

---- Desired closed loop response

4
Figure 2 shows the steady state output of the closed loop system versus the reference voltage. A non-linearity can be seen due to a dead band region and a sloping curve. The system was linearized around the end of the dead band region. The desired relative gain was set to 280 rpm/volt. The actual relative gain (Ga) of the system is calculated by linearizing the input around the end of the dead-band region Wa (U - 3) The error (GE) between this value and the theoretical value for the system (Gd) is then calculated using GE = Gd - Ga Gd A tolerance of five percent was set. An error outside the allowed tolerance activates another set of rules which determine a new proportional gain for the filter. It should be noted that the non-linearity between input and output at steady-state could have been made linear by adjusting the reference command signal before epplying it to the system. This non-linear relationship was not changed so the operation of the knowledge-base could be tested. Ga=

813

program was written to read a data file written by the CLIPS software and write that data to the dual port memory of the DSP peripheral. This value is used by the board as the reference signal to the system. An interrupt program was written to allow a user to change the system input or stop the system. This program monitors the keyboard to check for an interrupt command. Upon interrupt, a command is written to a data file which the CLIPS software checks periodically. All intermediate software is executed upon the CLIPS software's command. Test Results Non-linear Input verses Output steady-state Relationship Figure 3 and 4 show how the gain is modified by CLIPS as the reference signal is increased in increments from 3.2 to 5 volts. The solid line in Figure 4 is the desired velocity and the dotted line is the actual velocity. The x-axis labeled "CLIPS Sample Number'' is the nthtime CLIPS has analyzed the error signal and/or modified the gains of the filter. The time interval between each unit is approximately 2 seconds. As the velocity increases, Figure 4 shows a larger absolute difference between the actual and desired velocity than at lower velocities. This is due to the 5% tolerance allowed in the output velocity. Notice in Figure 3 that CLIPS increases the gain more for lower motor velocities. This is a result of the non-linear characteristics shown in Figure 2 and the reduction of the absolute error allowed between the actual and desired output for low output velocities.
o,64
F
Figure

while the desired velocity is shown by a solid line. Figure 5 shows the increase in gain made by the expert system when the excessive load was applied to the motor. The expert system causes the system to eventually recover from this load disturbance at CLIPS sample number 25. At CLIPS sample number 33 the load was released. This caused a sharp rise in the motor velocity output as shown in Figure 6. Figure 5 shows the decrease in gain made by the expert system in response to the velocity increase.The expert system causes the system to eventually recover from this load disturbance at CLIPS sample number 37.

o,8
L F

Figure

51

F i l t e r G a i n Response

t o

Load V a r i a t i o n s

L1 0 7 5 E

O.?r

Conclusions An environment has been established which allows a user to write heuristics in a knowledge based system, and have the results govern the operation of a physical-system.This environment can serve as a learning tool in research applications or in college laboratory courses. This environment is also convenient to use because it is selfcontained in an IBM AT where all operation can be controlled through keyboard input. In addition to its convenience, the knowledge-based controller is very flexible and can be expanded in various ways to improve the tuning technique. The method of adaptation might be improved by allowing CLIPS to collect facts on its performance, and based on these facts, change its method of gain adjustment. This would result in the creation of a primitive "learning" process. Presently, the method CLIPS uses to calculate the gain modification does not change. Another way the tuning process can be improved is to write rules which adjust the derivative and integral gains (Kd and Ki respectively). One proposed continuation of this study could be to adjust all three gains of the PID using classically known heuristics. The requirement that the system must be at steady-state can be removed to allow the transient analysis necessary to adjust Kd and Ki.

1 7 '

3 1

F i l t e r G a i n Response t n I n p u t

Change:;

r 0.63

Io,
0.6 2 0: 625
P R

C1 i p s

S a m p l e Humber

-,-/-2

400

300 200
10
20 30 40 50 c i i p s sdlilpi e Number 00 >O

Excessive Load Variations To introduce a variation in the system, a magnetic friction brake was applied to and then removed from the output shaft of the motor. At CLIPS sample number 15, the brake was applied so that the velocity was reduced by 60% within 1 second. The system response to the load (decreased velocity) is shown by a dotted line in Figure 6,

814

At the present time, the Knowledge-Based Tuning Controller is capable of correcting the steady-state response due to any unknown disturbances if the following three conditions are satisfied. First, the disturbance must not cause the output velocity to change faster than a rate of .1'6 volts/sec. Second, the steady-state response of the system must be a constant velocity (slew rate under .16 volts/sec). Third, the system must be stable for all reasonable system disturbances. If these conditions are met, then the controller will guarantee a steady-state velocity within 5% * of its desired value.

REFERENCES
[I]
John R. James and Lawrence A. Rapisarda, "An Approach to Implementing a Knowledge-Based 3rd lnternational Symposium on Controller," Intelligent Control, August, 1988. Hany K. Eldeib, "Evaluation of MicrocomputerBased Implementations of Knowledge Based Control Systems," Proceedings o the 27th f Conference on Decision and Control, December, 1988. Brian P. Butz, "Expert Systems," Abacus, Vol. 5, No. 1, 1987.

[2]

This tolerance level may be adjusted if necessary.

[3]

815

S-ar putea să vă placă și