An adaptive linear controller for a coupled tanks apparatus

An adaptive linear controller for a coupled tanks apparatus

Journal of Microcomputer Applications (1987) 10,237-243 COMMUNICATION An adaptive apparatus linear controller for a coupled tanks C. M. Lim Elec...

482KB Sizes 3 Downloads 40 Views

Journal of Microcomputer Applications (1987) 10,237-243 COMMUNICATION

An adaptive apparatus

linear

controller

for a coupled

tanks

C. M. Lim Electronic Engineering Department, Ngee Ann Polytechnic, Singapore, 2159 A student project on the utilization of an Apple II microcomputer system for real-time application of a self-tuning adaptive controller to a coupled tanks apparatus has been successfully completed. This microcomputer-based system is supported by a software package with graphics capabilities and consequently experimental studies or demonstrations can be readily performed without additional recording instrument. Within the frame of this project, the coupled tanks apparatus is represented by a first-order model whose parameters are identified on-line based on measured input-output data and then used to determine the parameters of a controller such that a preselected performance index is minimized. Samples of results obtained, with the apparatus under different control actions and coupling conditions between water levels in its two tanks, are presented. The educational value of this project and the usefulness of the system for educational purposes are also highlighted.

1.

Introduction

Much attention has been directed towards the application of adaptive control to a wide range of systems. Systems that have been examined include, for example, a multimachine power system (Cheng, Malik & Hope, 1986), a multivariable thermal mixing process (Zhang & Tomizuka, 1985) a robotic arm manipulator (Kovio, 1985) and diabetic subjects (Sano, Kondo, Kikuchi & Sakurai, 1983). Motivated by the importance of adaptive control, a low-cost micromputer-based system was developed with the primary objective to provide students in the Control Option in the Electronic Engineering Department, Ngee Ann Polytechnic, a means to study adaptive control applied in real-time to a process. On the outset, it was decided upon to utilize equipment available in the Control Laboratory to cut cost. For the above reason, an existing coupled tanks apparatus (Wellstead, 198 1) for teaching systems dynamics and control engineering, and an Apple II microcomputer were chosen. The development of the overall system was offered as a project to a group of third year (Diploma Level) students in the Control Option; the motivation being that such a project should challenge students to relate and apply basic concepts from several engineering disciplines to achieve an objective. The objectives of this paper are to present some experimental results which are obtained using the microcomputer based system, to highlight the educational value of this project and the usefulness of the system as a teaching tool. 237 0745-7138/87/030237 + 07 $03.00/O

0 1987 Academic Press Limited

238

C. M. Lim

2.

System

2. I

Hardware

description

The overall setup consists of an Apple II microcomputer with 64k of RAM, a disc drive and a dot matrix printer, D/A and g-channel A/D converters and a coupled tanks apparatus. Both the g-bit converters were fabricated based on circuits from Uffenbeck (1983). The apparatus consists of a container which is divided into two tanks by a centre partition which has four holes, each with a different diameter, near its base. Hence, the degree of interaction between the two water levels can be controlled by plugging and unplugging these holes. Each tank is equipped with a level sensor and a filter. The second tank is also equipped with an adjustable tap to simulate a load demand. Water from a reservoir is pumped by means of a motor to the first tank and flows to the second tank and then back to the reservoir through the tap. Further details can be found from Wellstead (198 1). Here the control objective is to regulate the water level in the second tank. To this end, the microcomputer is interfaced to the apparatus through a D/A converter and the filtered output of the second tank level sensor is fed back to the microcomputer through an A/D converter in order to form a closed-loop configuration, as shown in Figure 1. -l

I

I I

Performance

index-

Controller parameter c0lculotion

_-+

I I

I

Parometer estimation

V Controller

I



;F I I I

Coupled tanks apporatus

ZY

I

I

I L__________________-1 Microcomputer

Figure 1.

2.2

Block diagram

of the overall

system.

Software

The microcomputer system is supported by a software package specifically developed for studying direct digital control techniques. This software package is written in Applesoft BASIC and possesses a structure similar to that described in Lim et al. (1985). It is menu driven and user-friendly, and can be readily modified to implement any user defined control algorithm. A salient feature of the software is that several user defined variables of the system under study can be graphically displayed in real time. Consequently, users are able to observe on the monitor screen the time response of preselected variables during the control process and no additional recording instrument is required. Moreover, undisplayed variables can be viewed after study/demonstration. Provisions

Adaptive linear controller for coupled tanks apparatus

239

are made available for storing results into user defined files, retrieving and plotting stored results for comparison purposes and for generating a hard copy of the graphics page.

3.

Control strategy

3.1

Model

of

the coupled tanks apparatus

For adaptive control application, a model of the coupled tank apparatus is required and is assumed to have the form

y(k+l)=

-Sly(k)+S2u(k)

(1)

where y(k) is the water level in the second tank and u(k) is the control signal applied to the motor at the kth sampling instant, and (Sl,S2) are the model parameters which remain to be estimated. To estimate these parameters, two vectors 0 and I,Vare first defined

P(k)

=

[Sl S2]

(2)

vT(k+ 1)= I- AV 491 Then the following recursive least-squares algorithm estimate (Sl, S2) e^
(3)

(Sano et al., 1983) is used to

1) = 6(k) + h(k+ l)b(k + 1) - yT(k + l)&(k)]

h(k+ l)=P(k) P(k+

cy(k+ l)/[A+tyT(k+

l)Z’(k)

y(k+

1) = [I- h(k + 1) tyT(k + l)]P(k)/L

I)]

(4) (5)

(6)

where the caret refers to estimated values, 0 < i < 1 is a prespecified forgetting factor and P(k) is the symmetrical covariance matrix. The initial value of parameter estimates 8(O) and the covariance matrix P(0) should be given. Also, P(k) can be reset to a positive definite matrix after a desired number of sampling instants (Zhang et al., 1985). 3.2

Adaptive controller

The control objective is to regulate the water level in the second tank of the apparatus at prespecified values y,(k). To this end, the following performance index is defined (Koivo, 1985): Z(k) = fy(k +

1) - y,(k + l)]‘+ r[u(k) - B*u(k - I)]’

(7)

240

C. M. Lim

where r 2 0 expresses the importance of the control signal relative to the deviation in level and B* is a binary valued function which can be used to include, if B* = 1, or exclude, if B* = 0, the past control signal. Minimization of the performance index with respect to u(k) yields the following optimal controller which can be used to achieve the control objective

u(k) = [l/(r+ S~‘)][S~(J.#+

1) + Sly(k)) + rB*u(k-

l)]

(8)

The above optimal controller is expected to minimize the average deviations in level from the desired values and to take into consideration the amount of control effort required if r > 0 (Kiovo, 1985). The adaptive control algorithm with self-tuning can now be summarized as follows: (a) Sample the apparatus output y(k). (b) Obtain updated model parameter estimates by means of (4), (5) and (6). (c) Compute and output the control signal in accordance to (8). (d) Delay until the next sampling instant and then go to step a.

4.

Experimental

results

The control algorithm given by (8) was implemented using the microcomputer based system described above and several case studies were performed. Throughout these studies, P(0) was chosen to be 501 and P(k) reset to P(0) after every 15 sampling instants. The forgetting factor was set to O-99 and a sampling period of 3 s was chosen. These values were selected based on the results of numerous test runs. Also, the model parameters were identified using incremental values of y and u from a preselected operating point, and the control signal was modified to satisfy physical limits, i.e., o
Adaptive linear controller for coupled tanks apparatus

241

Time x 120 s

Time x 120 s

Figure 2.

Experimental

responses interaction

of the apparatus equipped with an optimal controller condition. (a) r = 0.001 and B* = 1; (b), (c) r = 0.

and under

strong

It can be seen from the above results that for enhanced performance, it is not necessary to take into consideration the past control effort. Similar observation has been reported by Koivo (1985). Also, a first-order model is adequate for controller design purposes. Similar observation has been reported by Owens & Chotai (1985). The estimated model parameters for the above three cases, viz., (i) r=O*OOl and B* = 1, (ii) R = 0,001 and B*= 0 and (iii) Y= 0 were found to exhibit similar convergence 1.

5 r(b) 41 3:

y- L--_ /.___d’

v, p--A 1

2f

,y----

----,

0 Timex120s

1

2

3

4

5

c 1 -Cc)

0

Figure 3.

1

2 3 Time x 120 s

4

5

Experimental responses of the apparatus equipped with an optimal controller and under interaction condition. (a) r=O.OOl and B*= I; (b), (c) r=O.OOl and B*=O.

weak

242

C. M. Lim

characteristics under both weak and strong interaction conditions. Figures 2(c) and 3(c) show the estimated model parameters for cases (iii) and (ii) respectively. It can be seen that the estimated model parameters settle to the new values smoothly and rapidly. 4.2

Adaptive

controller based on pole assignment

In order to further demonstrate the usefulness of the software, a proportional plus integral (PI) controller, which is tuned using a pole assignment technique, has also been tested. The controller transfer function, Gc, is preselected to be

Gc(z)=a(l

+bz-I)/(1 -z-‘)

(9)

where Gc=y/u and its parameters (a, b) remain to be determined. To this end, first set b= 5’1 so that the resultant closed-loop system behaves like a first-order system and possesses a transfer function given by y/y,(z) = aS2.2-‘/( 1 -z-I

+ aS2z-‘)

(10)

Then the remaining parameter (b) can be readily chosen such that the closed-loop pole is assigned to a desired value z& Therefore, set a = (1 - zJ/S!. The controller given by (9) was implemented using the software described earlier. In this real-time application, for every sampling interval the controller parameters (a, b) are first obtained using the latest estimated model parameters (Sl, S2) after which the control signal is then calculated using (9). Figure 4 shows the responses of the system equipped with the above controller with z,=O.5 and z,=O.2 under weak interaction condition. It can be seen that the system output response is quite satisfactory.

5.

Discussion

This project has generated much interest and enthusiasm in the students. In fact, the students on their own initiative have built a chassis, completed with Iabelled

0

Figure

4.

1

Experimental

2

responses

3

4

5 0 Timex 120s

1

2

3

of the apparatus equipped with a PI controller condition. (a) z,=O.5; (b) z,=O.2.

4

under

5

weak interaction

Adaptive linear controller for coupled tanks apparatus

243

terminations and a mimic diagram, to house the hardware. The main reason being that this project has provided them an opportunity to relate and apply basic concepts from several disciplines to a process. The system has been utilized many times to supplement lectures on the basic concepts of direct digital control techniques to the third year students in the Control Option. It has also been used by several groups of students to study PID controllers and adaptive controllers. In general, students’ response has been most encouraging. With slight modifications to the software, the microcomputer based system can be readily tailored to become a computer-assisted-teaching system on adaptive control or on PID control (Lim et al., 1985). This will further enhance the usefulness of the system as an educational tool. In fact, work in this direction is currently in progress. The foregoing discussion clearly shows the educational value of this project and the usefulness of the micromputer based system for educational purposes.

6.

Conclusion

A student project on the development of a low-cost micromputer-based system for real-time application of an adaptive control scheme to a process has been described. Some experimental results obtained from the system have been presented and discussed upon. The educational value of the whole exercise and the usefulness of the system as an educational tool have also been highlighted.

Acknowledgement The author gratefully acknowledges the participation and assistance received throughout the course of this project from all the students in Group 3D03, Electronic Engineering Department, Ngee Ann Polytechnic.

References Cheng, S. J., Malik, 0. P. & Hope, G. S. 1986. Self-tuning stabiliser for a multimachine power system. IEE Proceedings, 133, Pt. C, 176-185. Kiovo, A. J. 1985. Self-tuning manipulator control in Cartesian base coordinate system. ASME Journal of Dynamic Systems, Measurement and Control, 107, 316-323. Lim, C. M., Tan, W. C., Lim, J. C., Koh, H. B., Lim, H. B. & Chew, W. W. 1985. A CAT package on the fundamentals of control engineering. Computers and Education, 9,235-240. Owens, D. H. & Chotai, A. 1985. Simple Models for robust control of unknown or badly defined multivariable systems. IEE Control Engineering Series, 15, 231-248. Sano, A., Kondo, K., Kikuchi, M. & Sakurai, Y. 1983. Adaptive control system for blood glucose regulation. Transactions Institute M C, 5, 207-216. Wellstead, P. E. 1981. CE5. Tecquipment, England. Zhang, Q. & Tomizuka, M. 1985. Multivariable direct adaptive control of thermal mixing processes. ASME Journal of Dynamic Systems, Measurement and Control, 107, 278-283. Dr C. M. Lim is at present a lecturer in the Electronic Engineering Department, Ngee Ann Polytechnic, Singapore. He is currently responsible for the introduction of microcomputers as an engineering problem solving tool to all final year students in the Department and the development of computer-assisted-teaching software packages for reinforcing basic engineering concepts taught in the classroom.