Optimization of a control algorithm using a simulation package

Optimization of a control algorithm using a simulation package

Optimization of a control algorithm using a simulation package A S White and C Kelly The classic PID controller has a number of advantages over mor...

406KB Sizes 0 Downloads 53 Views

Optimization of a control algorithm using a simulation

package

A S White and C Kelly

The classic PID controller has a number of advantages over more sophisticated controllers in that it is simple and well understood by engineers in industry. It does however send conflicting signals from the three separate functions to the controller. Phelan has shown that a better controller (pseudo differential feedback, PDF) can be produced using the principle of one master, which gives significantly better results for some applications. This paper outlines a simulation program which is used to derive optimal gains for this and other SlSO linear and non-linear controllers for any physical system which can be modelled in ACSL, the simulation language used. The system description and the type of optimal criterion can be changed easily by editing the program file. Validation of the program was made by comparing the computer solution with several analytical solutions. The best response for a simple integral process and a PDF controller, for example, was given by an integral of time squared times error squared criterion. The controller gains do not vary greatly for the various criteria for the same process, so that near optimal performance can be achieved by using any criterion to derive the gains. Keywords: optimization, control system, simulation

A large number of controllers in current use operate on single loops. These controllers almost invariably use the PID algorithm, which has been popular since its introduction in the 1940s. This is true even in commercial microprocessor implemented controllers. In classical control design, optimization was often used to obtain the best parameters for the controller; in fact the use of a value of 0.7 for the damping coefficient of a second-order system originates from this method. Westcott 1 was probably the first to use the complex differentiation School of Mechanical and Manufacturing Engineering,Middlesex University, BoundsGreen Road, LondonN1 1 2NQ, UK Paper received: I 0 June 1993. Revised: 30 July 1993

theorem and contour integration to obtain these results. The method is outlined by Gibson 2, Naslin 3 and Jacobs 4 and more recently has been used by Nishikawa et al. s, who used it for auto-tuning, and also by Zhuang and Atherton 6 to investigate optimal performance of systems with a time delay. The analytical method can be used with deterministic or randomly excited systems, as indicated by Thompson 7. Analytical methods fail when the system has too many variables to be evaluated and other solutions have been attempted. The principal other method is to use computer simulation. In the 1960s this was executed using analogue computers a while more recently digital computers have been used 9. The use of a PID controller produces good responses in most applications, but when disturbances are important it is claimed that it is not as effective as the controller designed by Phelan I°. This controller, pseudo differential feedback (Figure I), obtains the effect of differentiation without a rate measuring sensor. No approximation is used to obtain the error rate term unlike the PID controller; the effect of differentiation is obtained by the circuit connections behaving as if a rate device was placed in the feedback path. Integration is used in the forward path and only two constants are required to specify the system as opposed to the three in the PID controller. This is a weakness since the order of the system which can be stabilized satisfactorily is limited, which Phelan overcame by using subvariable control. One of its advantages over the PID controller is the reduction of overshoot to a command step input. A simple time series expansion in terms of the sampling time for the PDF algorithm is given below: m ( k T ) = KI * T * [ e(O) 4- e( T ) 4- e(2T) 4- e(3T).., e(kT)] -K2*c(kT)

0141-9331/94/020089-06 © 1994 Butterworth-Heinemann Ltd Microprocessors and Microsystems Volume 18 Number 2 March 1994

(1)

89

Optimization of a control algorithm: A S Whir..- and C Kelly

SIMULATION ======~,

Figure 1 PDF control system where m(kT) is the controller output and c(kT) the system output at time t, and e(#) is the error. As can be seen from Equation (1) there are fewer computations than for a PID algorithm, since the differential term is not present, so that the PDF is faster to execute on a microprocessor. This paper describes a simulation program which was used on a PC to obtain optimum coefficients for PID, PDF and other controllers for various systems. The method is outlined and then some examples of the resulting control systems are given.

PERFORMANCE

INDICES

It was suggested by James et al. ~ that for a series of inputs, both deterministic and random, it should be possible to formulate a convenient function of error or index of performance in terms of some system parameters which could be adjusted to minimize this error criterion. This has generally proved possible for linear systems but is input dependent for non-linear systems. Newton et al. 12 first evaluated the integral square error (ISE) criterion. The main indices of performance are: •

The analytical techniques listed above are restricted t~ simple systems, small numbers of parameters and linear systems. To enable non-linear systems with a large number of parameters to be dealt with, a program was written in ACSL (a continuous simulation package) to derive the values of the optimized parameters. As in all models in ACSL the model file is altered to change the model description and the program is compiled and run, in this case on a PC. During interactive running, the search start values, the choice of which depends on experience as with all optimization programs, can be varied and the results plotted out for step or other responses of the system. Obviously a practical controller cannot have a very large gain so that this fact, together with the likely input ranges of the analogue to digital converters and a knowledge of the output voltages required by the actuator, place limits on the usable range of the controller. Initially, the author used gain ranges of 0-100, but some PDF controllers require larger values. So to initialize the program, ALPHA (#) are the start values of the parameters and ALMIN and ALMAX are the lower and upper limit respectively for the parameters. The program produces an optimum value of ALPHA. This is re-entered with narrower limits and progressively better values are obtained until the minimum value of the integral criterion Q is reached in the parameter space. The routine for optimization is a variant of the binary search methods of Mitchell 13. For a single parameter :~, the maximum and minimum values and the initial value of :~ and its increment A:z are established. The algorithm obtains two values of Qi and Qi-1 from the continuous part of the ACSL program using two values :~i and ~i- 1 and then determines whether the difference ( Q i - Q i - ~ ) is positive, zero or negative. If the difference is positive, a new :q and new 3~max are obtained: 2

Integral square error (ISE) ~max

Q = •

e2(t) dt

(2)

:

When the difference is negative:

Integral absolute error (IAE)

Q =

f

oo

I e(t) [ dt

(3)

--OO

Q=

I

OG

t l e(t) l dt

(4)

• Integral of time multiplied by square error (ITSE) Q =

i

¢=3

te2(t) dt

(5)

Integral of time squared square error (ITSSE)

Q=

I

3C

t2e2(t)dt --~O

C~min =

I

(8)

~i-1

Should the difference be zero, the optimum value has been obtained and the search is terminated. When the difference is not zero two values of Qi and Qi+~ are obtained from the new =i and czi+1. The process is repeated until:

• Integral of time multiplied by absolute error (ITAE)

90

(7)

0[i-1

2



/

(6)

]qi+l - qil < A Q

(9)

where A Q is specified by the user. This process was extended to multiple parameter searches (Figure 2). The multiple parameter space is described by a number of parameters :zii of which the first routine will find an approximation to :qi" A second parameter is optimized keeping the first parameter at the optimized value with the others at their start values, and another approximation to the optimum value for this parameter is obtained; only one loop at a time is optimized. All the optimal estimates are computed in this manner. These values are then re-entered

Microprocessors and Microsystems Volume 18 Number 2 March 1994

Optimization of a control algorithm: A S White and C Kelly Start

=2 2

=

I

[ Q .=0

I IALP

i=tl,

k

=.,. =

0.I

I

I

, (

=.,=5

1'

_~ =,*+.=1

]

I I

I

I Q for

=" l - -

I Q.,. =Q., k~k+l

/

L=I

Figure 2 Flow chartfor multipleparameteroptimumsearch as the start values to obtain better approximations until the operator is satisfied with the result. Manual control is kept at all stages because of the possible divergence of all optimal searches. A single parameter optimization was shown in Chu TM implemented in the DSL/90 language, which is similar to the ACSL program, as are all continuous simulation languages, but the ACSL routine is more accurate and simpler. ACSL coding for the program is shown in Figure 3. ACSL programs are divided into three basic sections, with the initial section providing values of parameters which are set only once. In the dynamic/derivative section the differential equations are set up for solution. As with most continuous system solvers the computation routines are dealt with by the package; in this case a Runge-Kutta order 4 method is the default routine for integration of the differential equations. The computation starts at t = 0, a default value, and the continuous part of the simulation is stopped by the TERMT statement. The final section is the TERMINAL section, which is where the optimization routine is executed.

The operator sets initial parameters, starts off the simulation and obtains a report of the optimum trial parameters. The time responses can be plotted, as shown, to observe the optimized responses. This method can cater for any input or system for a particular controller, unlike purely analytical methods; non-linear systems can be easily treated. Problems exist with all optimizing routines; they have difficulty obtaining the correct global optimum values when several local optima occur, although with this procedure it is easy to see which optimum value the system is moving towards and it can be examined by plotting the time response. The operator can rerun the program with a different set of initial conditions. VALIDATION To validate the simulation the ACSL program was compared to several analytical solutions, two of which are shown here. The first used the PDF controller on a simple

Microprocessors and Microsystems Volume 18 Number 2 March 1994

91

Optimization of a control algorithm: A S White and C Kelly PROGRAM OPTI.\IlSER INITIAL "set initial conditions" INTEGER I,L,INDEX ARRAY ALPHA(30),INDEX(30),QA(30) CONSTANT ALPHA(t) =0.5,DAL = I.E-4,DQ = 1.E-7,ALMIN =0,ALMAX = 1,K2 =4. CONSTANT K 12 = 8. ,TSTP = I0. CINTERVAL CINT=0.1 MAXTERVAL MAXT=0.05 L=I I=1 ALP = ALPHA( 1) "Loop control" L1..CONTINUE END DYNAMIC DERIVATIVE "Control equations" CDOT=INTEG(K 12*E-K2*ALP*CDOT,0,0) C =INTEG(CDOT,0.0) E=I.-C "Define performance index" Q=INTEG(E*E,0.0) TERMT(T.GE.TSTP) END END TERMINAL "Initiate loop test" INDEX(1) = I GO TO (9,3),L 9..QA(1)=Q IF(I.EQ. I)GO TO 7 IF(ABS(Q-QA(I-I)).LT.DQ)GOTO 6 7.. ALP = ALPHA(1),+ DAL L=2 I=I+l INDEX(1)=I IF(I.EQ.30)GO TO l0 GO TO Ll 3..IF(Q-QA(I-1 ))4,5,2 "Compute new parameters"

4..ALPHA(1)=O.5 *( ALPHA(I- I ) + ALMAX) ALMIN=ALPHA(I-I) GO TO 8 2.. ALPHA(P)=0.5 *(ALPHA(P- 1) + ALMIN) ALMAX =ALPHA(I-I) 8..ALP=ALPHA(I) L=I GO TO LI "Print command" 5..PRINT 100 GO TO 6 10..PRINT 101 6..PRINT 102 PRINT 103,(INDEX(J),ALPHA(J),QA(J),J = I,I-1) "Produce results in correct format" 100..FORMAT(' THERE IS NO CHANGE IN Q FOR ALPHA+DELA') 101..FORMAT(' THE ITERATION HAS REACHED 30') 102..FORMAT(4X,'IMN',4X,' ALP',8X,' QMIN'/) 103.. FORM AT( 1H,15,2F 12.8) END END

integral process TM. The feedback coefficient is found by analysis to be: 1

-~

92

Figure 3 ACSLOPTIMISERprogram

and by simulation to be 0.70708. A second example system with multiple parameters is given by:

G(s) =

53 + a2 s 2 -F al s + 1

Microprocessors and Microsystems Volume 18 Number 2 March 1994

(1 O)

Optimization of a control algorithm: A S White and C Kelly Analysis yields a2 = 1.0 and a~ = 2.0 using the ISE criterion while the ACSL programs yield a best value of 1.01 and 1.998 respectively after 50 trials. The program was therefore considered to be validated.

INTEGRAL OF ERROR 50UAREO * TIME 5~UAREO

OPTIMIZATION RESULTS The case of the single parameter optimization with the PDF controller for a simple integral system is shown in Figure 4. Table 1 shows the values obtained for other weighting criteria. Clearly the minimum weighting is given by ITSSE. The best result is shown in Figure 5. For the test cubic system (Equation (10)) with two variable parameters the results are given in Table 2, with the best time response for weighting type shown in Figure 6. The interesting point is that the values of a2 and a~ do not vary by more than 50% from the lowest values. This would imply that for a control system the absolute form of the weighting is not so important.

~"'--"-

6~ I

I

t~

8

,5[

O.O0

2. O0

4. O0

T

6. O0

8.CO

I0.0

Figure 5 Time responseof PDF + integral systemcriterion (ITSSE)

CONCLUSIONS A control system parameter optimization program has been developed using the ACSL simulation language.

A

0

(-Jo

Table 2 Optimizationof a multi-variable system. Resultsfor 30 trials

Method of control Value of parameter Value of weighting P. Index

INTEGRRL OF ERROR 50URREO

P 1.94033 1.05977 2.09105 1.47949 2.12598 1.72879 1.98185 1.26006 2.04106 1.47163

~e2dt ~leldt ~t]eldt ~2dt

~t2e2dt Z=

Q 1,55808 1,50487 2.16297 2.16275 3.32223 3.16026 1.44487 1.40443 2.11591

2.11417

L/% ' xt-

8

C',,l 03

INTEGRF~L OF ERROR 50UQREO * TIME

I

I

8

CM

O. O0

2'.00

4.00

" 6.00

T

8.00

I0.0 .E

Figure 4 Time responseof PDF + integral systemcriterion (ISE) u

Table 1 Optimization of a single parameter using a PDF controller.

{',,I

,g

=0

Resultsfor 30 trials

~g

Method of control Value of parameter Value of weighting

C",.I 03 i

)..

P. Index

[e2dt

P 0.70703

Q 0.35355

~[eldt

0.93814

0.56750

~tle[dt ~te2dt ~tZe2dt

0.99999

0.24752

0.84180 0.94434

0.08839 0.03839

c5, I C~

=0 ,5

:00

I0.0

20.0

30.0

40.3

50.0

T

Figure 6 Time response of fourth-order system two-parameter search criterion (ITSE)

Microprocessors and Microsystems Volume 18 Number 2 March 1994

93

O p t i m i z a t i o n of a control a l g o r i t h m : A S White and C K e l l y

The single degree of freedom program used in this work produced a result of 0.70708 using ACSL simulation, 0.707107 analytically and 0.70703 using the DSL/90 language. The best PDF controller values were obtained with integral of" time squared times error squared. The multi-degree of freedom program for the third-order system also had its optimum parameters derived analytically, producing values of 2.0 and 1.0. The results using the multi-degree of freedom system program were correspondingly 1.998 and 1.01. The best optimal variables using this system were found to be with the integral of error squared multiplied by time. Different controllers, systems and input waveforms can be applied with ease. REFERENCES 1 Westcott, J H 'The minimum moment of error squared criterion: A new performance criterion for servomechanisms' Trans. lEE Vol 101 (1954) pp 471 ~.80 2 Gibson, J E Non-Linear Automatic Control McGraw-Hill (1963) 3 Naslin, P Essentials of Optimal Control Iliffe, London (1968) 4 Jacobs, O L R Introduction to Control Theory Clarendon Press, Oxford (1974) 5 Nishikawa Y, Sannomiya, N, Ohta, T and Tanaka, H 'A method for auto-tuning of PID control parameters' Automatica Vot 20 No 3 (1984) 6 Zhuang, M and Atherton, D P 'Tuning PID controllers with integral performance criteria' lEE Conference Control ~)1 (1991) pp 4 8 ] - t 86 7 Thompson, A G 'Optimum damping in a randomly excited non-linear suspension process' I Mech E Vol 184 Part 2A No 8 (1969-1970) pp 169-183 8 Harvey, R A, Taylor, G R and Benham, R D Analog Computer Methods for Parameter Optimisation EAI Applications Library, 2.3.t a/h (March 1970)

90nwukiko, C Foundations of Computer Aided Design West PC, St Paul, MN (! 989) 10 Phelan, R M Automatic Control Systems Cornell University Press, London (1977)

94

! } )ames, H M, Nichols, N B and Phillips, R S Theory of Ser~.omechanisms ,McGra',,,.-Hill, Ne~'. York (1947) 12 Nev4on, G C, Gould, L A and Kaiser, J F Analytical Desiqn of Linear Feedback Controls Wiley, London (1957) 13 Mitchell, B A 'A hybrid/analog-digital one-parameter optimiser' ACL memo No 69, Dept or" Electrical Engineering. L niversity of Arizona (April 1963) ]4 Chu, Y Digital Simulation of Continuous Systems McGraw-Hill, New York (! 969) 15 Kelly, C 'Optimisation or" a Control Algorithm" 8Eng Mechanical Eng. Final project report, Middlesex University (1992)

A 5 White was educated at King Ed~-ard VI Grammar School in Birmingham and graduated from Queen Mary College, London in 1966 with an honours degree in aeronautical engineering. His industrial experience includes Rolls-Royce and Hawker Siddeley Dynamics. He has also acted as a consultant to a number of small and medium size companies. Mr White has conducted research into the gust response of aircraft, sensors, vibration response of robots and control systems. His extensive use of simulation of continuous systems prompted him to found the ACSL user group in the UK.

.......

Column Kelly' was educated in Tarbert, County Kerry, at the Regional Technical College in Tralee, where he obtained a National Certificate in Mechanical Engineering with Distinction, and from Bishopstown in County Cork he gained a National Diploma. He joined Middlesex University in 1990 and graduated with an upper second class honours degree in mechanical engineering in 1992. He has industrial experience in maintenance engineering and has just completed an MSc in electronic product innovation and production management at Middlesex- Universi~,.

M i c r o p r o c e s s o r s and M i c r o s y s t e m s V o l u m e 18 N u m b e r 2 M a r c h 1994