Adaptive Controllers as Virtual Instruments

Adaptive Controllers as Virtual Instruments

Copyright ~ IFAC System Identification, Copenhagen, Denmark, 1994 ADAPTIVE CONTROLLERS AS VIRTUAL INSTRUMENTS I. VAJK*, A. SOUMELIDIS**, cs. BANYAsz...

1MB Sizes 0 Downloads 67 Views

Copyright ~ IFAC System Identification, Copenhagen, Denmark, 1994

ADAPTIVE CONTROLLERS AS VIRTUAL INSTRUMENTS I. VAJK*, A. SOUMELIDIS**,

cs. BANYAsz" and L. KEVICZKY"

Department ofAutomation. Techmcal Umverslfy ofBudapest. H-I I I I. Budapest. Goldmann Gy. sq. 3. •• Computer and Automation Research Institute. Hungarian Academy ofSciences. H-I I I I. Budapest. Kende 11-13. AbslracL A virtual instrument environment is an ideal paradigm for building prototype data acquisition and control system. It offers several conventional components of instruments to acquire data from plug-in boards and programmable instruments and then analyze the data, control the process and present the results through graphical interfaces. One of the most advanced representation of this idea is the National Instruments' LabView". A new family of adaptive controllers were developed based on this system. This paper presents one of its elements. an adaptive PlO controller in detail. where the delay time of the system is estimated with a new algoritlun in the adaptation step.

Key Words. Realization of adaptive controller, virtual instruments. PlO regulator.

I. INTRODUCTION Several industrial products based on adaptive techniques were introduced in the last decade. Adaptive techniques now appear as standard elements of control systems. These controllers use different techniques for adjustment: e.g., model reference, parameter adaptive, auto tuning. There exist products in which tuning is initiated by the operator or can be done automatically. Different regulator and internal model structures can be found in commercial products. Adaptive methods have already been applied to provide automatic tuning of PID regulators.

parameter adaptive controller. The second part of the paper describes the principle of Virtual Instrumentation, the adaptive regulator as a virtual instrument and its operation technique.

2. CONCEPT OF TIlE ADAPTIVE STRATEGY It is assumed that the controlled process can be approximated by a second order, stable, linear lumped parameter system with additive offset and nOIse: .v(t) = w(t) * u (t) + offset + n(t) m

(I)

where A new family of adaptive controllers were developed applying the principle of Virtual Instrument in the LabViewllJ programming environment. LabView~ offers an innovative programming methodology. You can build the virtual instrument by a graphically assembled software. In this paper only one of the elements of the realized adaptive controllers is presented, namely an adaptive PID regulator. Most industrial processes are controlled by PID controllers. Many industrial control engineers (even technicians) select, install, and operate such regulators. The PID structure is close to current industrial practice. The operators would like to understand the operation of the used controller and to interpret the parameters. The first part of the paper presents the algorithm of the selected regulator. The presented adaptive PID regulator is an C<1sy to handle robust explicit

(2)

The following notation is used: L

s

* Yet) wet) um(t)

offset net) Ko, K 1, TI' T 2 Td

-

-

Laplace transformation, Laplace operator, convolution integral, measured process output, impulse response of the process, measured process input, offset, noise, parameters of the second order part of the model, the delay time of the process.

The drift is slowly varying. The spectrum of the noise is wider than that of the noiseless process 593

transfer function W(s). On the basis of the third condition if the process is a first order system, the sampling time is not less than the one tenth of the time constant to reduce the numerical problem. For the generation of the parameter estimation database the primary variables are averaged according to multiplicity between the sampling time for identification and for control.

output. The input signal, the output of the controller u(t) may be limited by the technology and the effective input can be measured. The parameter estimation and the control of the process are based on sampled data. The sampling time for control is fixed. It is chosen relatively small. Its value is determined by the load of the computers. The process is assumed to be controlled by the PID controller of an often used structure. Its parameters are updated at each identification step. The transfer function of the applied continuous PID controller is: P(l+sT; +sT;T ) Ye ( s) = - - - - : . - - - - ' - - = "D' sT;(I+saTD )

Thus the control descriptions: •

continuous time model - continuous time process model for communication between the operator and the virtual instrument and for the regulator design;



discrete time model based on identification sampling time - the discrete time process model obtained by the identification;



discrete time model based Oil control sampling time - this description is used to generate the manipulated variable.

(3)

where proportional gain of the controller, integral time constant, derivative time constant, constant for not ideal realization of the derivative action (default a.=02) For the identification of the continuous Iinearized process we determine the best fitting discrete time model from the input and output measurements The structure of the model used for identification is: B(q-I) YI

=

I

A(q- )

system uses three different

3. IDENTIFICATION OF A CONTINUOUS PROCESS

m

Uc

(4)

+offsel +n r

The identification of the continuous process is realized in two steps:

where m bIq -I +... +b mq-



Identification of the discrete system for sampled data, then



Calculation of an equivalent continuous-time description by a discrete-eontinuous transformation.

(5)

In several applications m= 10 and n=2 were selected. From the estimated parameters a" b, the continuous description can be determined. The continuous description is used for controller design, and can be displayed for the operator to verify the correct operation of the estimation process.

3. I. Identification of discrete system

The sampling time for identification is different to that of the control. It is the integer multiple of the sampling time for control (he)' It is chosen using the apriori information of the process parameters. (The apriori information can be overwritten by the aposteriori information. Thus the sampling time for identification can be automatically redesigned. The sampling time used for identification is not less than:

It is worthwhile to choose such a method that guaranties an unbiased estimation with relative small variance and at the same time the calculation complexity is relatively small. The calculation time of identification can be reduced by decreasing the number of the estimated parameters. So it is worth using an identification method that estimates only the dynamics of the system and does not estimate the parameters of the noise. For the estimation the instrumental variable method was chosen. On the basis of(4) the following model is used:



Ye

• •

hc (It is larger than or equal to the control sampling time.), 2Tdim (It depends on the delay time.),

00*

is

J2 *W'(jw)1 Ko

the

crossover

frequency

-Q2YC-2

+

u;:m + offset' +n'r bJu;:J +b2u;:2+· .. +bm

where and

0.1/00* (It depends on the time constants of the process.)

where

= -OIYC-J

(6)

offse I' = (I + 01 + 02 )offsel n; = n, + 0ln c_ 1 + 02nl_2

Equation (6) can be written in vector form:

of

Y r = £PcTO +n c'

. W'(s) is the delay free part of the

594

(7)

Here

order discrete model with non integer discrete delay. For the low frequency approximation it is enough to investigate the numerators of the polynomials.

1° 1 ,° 2 ,bl ,b2 , ... ,bm ,oj]\'et'f

()=

and 'Pt

m m m lIT = I -Yt _I'-Yt _2,u,_I,U,_2""'U t _ m,

B(Z-I)I w=O

As Sooerstrom, Stoica and Trulsson (1987) showed that a suitable instrument selection is

s, = K(Q)I-YH-n,-Yt-2-n' lIT U 1_ 1- n ~ U, _ 2 - n ' ... , U1- m- n ' m

m

m

= I.b, =Co = bi +bi ,=1

dB(Z-I)! =I.b;i= d w w=O ,=1 =c1 =(d+l)bi+(d+2)bi

(8) 2

in closed loop if the noise can be approximated by a moving average process of order n. Since it was assumed that the spectrum of the noise nt is wide. so the noise nOt is approximately a moving average process of order 2 in this application. The estimated paraf!leters can be used for filtering the variables to improve the estimation. In the adaptive controller the recursive version of the instrumental variable method is applied. To make the algorithm numerically less sensitive the UDL factorization is used. The algorithm of the UDL factorization can be found in Keviczky et al (1985).

d B(Z-I)I

_

----=2-

-

dw

w=O

L>i m

(10)

.2_ 1 =

1=1

=~ =(d+I) 2bi+(d+2) 2bi

In the above three equations we have three unknown parameters. In (10) co' Cl and c 2 • and auxiliary variables were introduced for simpler calculation. From (10) the parameters bi, bi and d can be determined without iteration d 2 +d(3-25.-)+(2-35.-+.:i) Co

Co

=0

Co

bi =cl-(d+l)co bi = Co -bi

Due to the poor excitation in the closed loop, little information enters in certain directions of the parameter space. The uniform forgetting eventually causes covariance blow up which can lead to unstable controller adaptation. The directional forgetting (Kulhavy. 1987) prevents the blow up effect. The directional forgetting combined with the UDL factorization was used for the identification. In the parameter estimation different forgetting factors were applied for the offset and the other parameters.

(11)

The positive root of the second order equation is used as the equivalent discrete delay time. From the parameters of the discrete system the continuous description can be easily obtained (Banyasz et ai, 1993).

4. CONTROLLER DESIGN

The design of the controller is based on the estimation of the continuous process. The process is assumed to be controlled by an often used PlO controller (3). The discrete form of PID is

3.2. Discrete-eontinuous transformation

The exact transformation between the different process descriptions is difficult to realize. It requires iteration since the delay time of the continuous process is not exact multiple of the sampling time used for identification.

(12)

The approximated relationships (not using exponential functions) between the parameters of the continuous and discrete controllers are:

From the overestimated model (6) we want to get an approximation of a second order system with delay. The used approximation is based on the model matching at zero frequency principle. The principle of equivalence requires the matching of the zero. first and second order derivatives of the original and the modified transfer functions. Schematically we can write

Too. / he

o~ = --"'--"--

I + Too. / he

aF = -(1+a~)

b~ = P(I- a~) To he

To bIe = - P ( i -e 02 )(1 + 2-) he

(9)

e P (I-a e )(I+-+-) he To b0= 2 T; he

where the delay time d is not integer, It IS a real value, i.e., we approximate the process by a second

595

(13)

In LabView~ the principle of Virtual Instruments means not only the method how to construct control panels of 'high fidelity', but offers a new way of building complicated software systems by applying reusable building blocks. The method is well fitted to the block-diagram view of system structure natural to most engineers, and does not use conventional programming techniques, instead offers interactive graphical tools for constructing hierarchical block-diagrams. LabView~ contains an extensive set of elementary functions, for example mathematical, logical, string processing, etc. functions, commonly used constants, as well as programming structures for realizing conditional branches and cycles, also offers extensive libraries covering several fields, e.g.. elementary mathematical functions, functions for matrix computation, signal processing, or statistics all of them realized as Virtual Instruments. Hardware elements produced by National Instruments (e.g., analog input and output cards, digital input and output cards, IEEE488 interface cards, etc.) can be handled by Virtual Instruments, elements of the Data Acquisition Library, which can easily be inserted in complicated schemes to realize connections with the real world (National, 1994)

To eliminate the windup effect and to use a jumpless switching the controller output is calculated by

The design of the controller is based on the closed loop behavior of the system. ,

0(s) =

P(l +sT; +s2T;To ) sT;()+saTo )

Ko +sK) -.s(T.+~) (15) e l+s1J +S2 T2

The delay time of the loop is increased by the sampling time. The integral and derivative parameters are chosen such a way that the poles of the system are cancelled. By the selection of the controller gain a given ehase margin (cD) is guarantied: a = fixed

(default 0.2)

T, = 7;

TD == T2 17;

-1r/2+(J)== arctg(wcK, IK o )-

(16)

arctg(wcaTo)-(Td +hc)w c P ==

wJ; I Ko

In order to eliminate the arctg calculation, the arctg(x) function is approximated by

Direct computer control of realworld processes can be implemented by applying the following steps (considering only the simplest case):

1r O~x~--I

x

2

I X ---+4 2 2 1r I I

~-I~x~1

1r

arctg(x)

::>:

-+--4

2

if

I

2

x

analog to digital conversion in measuring the process variable,

2 I



digital control algorithm.

x



digital to analog conversion to generate control signal.

I

1r

x

1r

2

(17)

I~-~--I

2x

1r



2

--I~-~O

during the solution of (16). Generally an iterative method can be used for the solution.

Digital control algorithm has parameters which can be set initially and changed during the operation. For example a simple PlO algorithm must have the following properties:

5. REALIZATION The robust adaptive controller family has been realized by applying the principle of 'Virtual Instrument' introduced by National Instruments in its advanced programming environment LabView~. Virtual Instrument (VI) essentially means a software which looks like a real instrument (e.g., a measuring instrument such as a digital voltmeter or an oscilloscope). The control panel of the instrument is realized on the computer screen by applying the interactive graphical representation of control and indicator elements common in real instruments, e.g., potmeters, switches, buttons, lights, pointers, etc. The user can operate on these elements by using any pointing device, typically mouse. The software environment offers methods, how to connect control panel elements with the different operations of the instrument software.



switching between automatic and manual mode of operation,



setting Setvalue for automatic and Manual Setvalue for manual mode,



indicating the value of the Process Variable and the Manipulated Variable,



setting the parameters of the controller.

The adaptive controllers can of course have additional parameters and operating modes to set. The conventional programs for direct computer control apply computer programming techniques to configure the system and set parameters of the controller. The first form of interactivity has been realized by using character oriented screens. Selling and modifying parameters have been done by entering numerical data, similarly the program can 596

display also numerical data to infonn the operator. Operators who have been accustomed in handling buttons, switches, potmeters, and observing pointers and lights are confused when they must work with numerical values. Numerical values are not so expressive than blinking red lights or a pointer entering in the red zone of the scale. Decision making upon numerical values is more difficult and time consuming process. Interactive graphical user interfaces (the operational system of the Apple's Macintosh was the pioneer among them) have given the possibility to realize easy-to handle user-friendly interfaces which facilitate fast decision making and interaction.

composed of a controller VI and analog input and output VI-s by providing serial periodic execution with a given frequency. A simplified scheme can be seen on Fig. 3.

ChannclO:

Channcfjl

'1'

T

AD ~ PID c-

Cha nnc~

AD r--

f------

DA

I Timer

.·.·.·.:.;:.·.·.·.:...:.·.:-~........·~.·...v ...·•·•·••••...:.·.·.·"'.:•.•:•••;.....:•.•••.•:-:

!illit€6=SEtw!'!!• Fig. 3. Realization of a control loop The controller and analog I/O VI-s are placed in an infinite While cycle which contains a timing element. Multiple independent controller loops can be placed in the same application which operate on different channels of the analog input and output card. For example if a multifunction I/O card is used (MlO-16 series of the National Instruments) containing 16 analog input and two analog output channels complemented with an analog output card (AO-6 at National Instruments) containing 6 analog output channels an eight-loop controller application can be realized. The number of the control loops of course depends also upon the relation between sample frequencies applied on several processes and the run-time of the controller algorithm.

Fig. 1. PID main and service panel The LabViewltJ realization of controllers offer the facilities described above. As a simple example let's see the front panels of a PID controller on Fig. 1. The layout of the controller is similar to that of compact industrial PID controllers. The user can easily set operating modes. change the setvalues, as well as supervise the operation. Setting and changing P, T"TD and hc are not the task of an operator, and it cannot be done frequently, hence numerical input is far enough on a separate socalled Service Panel, which can be viewed optionally.

PV _ _

MV'

[l;lii;iij,ii~Ui*!r:

"""'"'i~--MV

111~lli':::::I\II:llll

I

:::~::::::::::::::::~::::::::~::::::::::::::::~::~::::::~~::::::::::::::::: .

Fig. 4. Main panels of ZJN and adaptive PID

SampleTime

Fig. 2. The PID building block

Autotuners based on Ziegler-Nichols algorithm or adaptive PID controllers, as being more complicated than a simple PID, have been realized by applying the Code Interface Node facility of the LabVie~ system. The algorithms have been realized as Pascal procedures compiled and then linked into the Virtual Instrument. The front panels of the selftuning and adaptive controller can be seen on the

The controller is realized as a Virtual Instrument with two inputs and one output (Fig. 2): Process Variable (pV • Yt) input and Manipulated Variable as output (MV - u.) and as input (MY - u.m), and one additional input necessary for discretization. the Sample Time. A control application can be 597

Fig. 4. As it can be observed, the front panels are very similar to that of the simple Pill controller, only additional switches are available to set identification and adaptation on or off. However the Service Panels of these controllers are quite different (Fig. 5.), more parameters are required to handle, for example, autotuners or adaptive controllers. An example of an adaptation process can be seen on the Fig. 6. by using the Adaptive Pill Controller A series of transients can be seen as the response of jumps on the setvalue: an improvement can be observed on the performance of the control process

Fig. 5. Service panels of ZIN and adaptive PID

:,

;\ \~

..

1/

iV·-

:J

J I

t

PV Fig. 6. An adaptation example presented in S'lCJCA '94. June 8-10 1994 Budapest. Keviczky, L.. I. Vajk, 1. Hetthessy (1985) INTELLICON: An industrial multiloop adaptive regulator Proc. IFAC Identification and S:vstem Parameter Estimation 1985, York. pp 12671272 Kulhavy. R. (1987). Restricted exponential forgetting 10 real-time identification Automatica. 23, pp. 589-600. Ljung, L. (1987) System identification. theory for the user. Prentice Hall, Inc. National Instruments ( 1994). IEEE-488 and VXIbus Control, Data Acquisition, and Analysis Catalog, Nationallnstrumenrs, Austin, TX SOderstrom, T., P. Stoica and E.Trulsson (1987). Instrumental variable methods for closed loop system. Proc. 10th IFAC Congress, Munich, Vol. X., pp. 363-368

6. CONCLUSIONS It has been proved that the virtual instrument methodology is an easy and effective tool to implement adaptive regulators. This approach is very useful not only for first prototyping but for modular object oriented control software development.

7. REFERENCES Banyasz, Cs. and L. Keviczky (1993). Design of adaptive Pill regulators based on recursive estimation of the process parameters. Journal of Process Control, Vol. 3, I, pp. 53-59. Banyasz, Cs., I. Vajk and L. Keviczky (1994). Handling delay-time in low cost controllers.

598