Sei sulla pagina 1di 33

covariance matrix elements show the estimator is working well.

The p a ­

rameters are stable and only change if the operating point changes m a r k ­

edly or if the system changes (size disturbance). The transients in tne

first 80 minutes are due to unrealistic initial states for the grinding

circuit (appendix H) and sump settling time.

The mill is driven, in about an hour, to the desired operating point

giving a maximum power draft of 0.S5 MW and a mill filling of 50 percent.

After time 0 it takes about 9 input moves for the optimizer to find the

optimum feed rate of 3.')b tonnes/hour and the optimum mill water addition.

Figure 13 on page 80 shows how, after the increased coarseness at 400

minutes, the optimizer increases the feed rate to increase the fractional

filling to 63 percent at which maximum power of 0.9 MW is attained. The

coarseness is increased by increasing the percentage grinding media in

the feed by 20 percent. The mill water is decreased to increase the

fractional filling of the grinding media interstices and achieve the best

mill pulp loading. Note the transient ^...jrease in power.

Figure 14 on page 81 shows how, after the decreased coarseness at 400

minutes, the optimizer decreases the feed rate to decrease the fractional

filling to 44 percent at which a maximum power of 0.76 MW is attained.

The fraction of grinding media is dec:ea ed by 10 percent while m a i n ­

taining the same mass flow rate in order to simulate a decrease in

coarseness. The mill water addition is increased very slightly.

Autogenous Mill Adaptive Optimizer 79


4.M

*.73

t.mt

l.M

QJ>
CO mill
d water
o a. h g rad ie n t
mill f r a c t i o n a l filling
CL
CO
CD
Ckl

-e.»l
feed
g ra d ie n t

- 9 .7 7 illllltllinlnnllllllniillllllllilhi-iillllllinil miliiiiliiiiiiii.liiiiliiiili m li.il


ime Un its
Figure 13. Simulation result using aetup file: setup_6
Setup 7

CD
C/0
Cl
o
Q _
CO
CD
Ci£

F igur« 14. Simulation result using setup f l U : ««tup 7


Time Units
5.6 C O N C L U S I O N S A ND F U R T H E R WORK

The adaptive optimizer keeps the autogenous mill very close to its optimum

(defined as the operating point that causes maximum m 1'11 power draft).

Even if large disturbances are introduced, the on-lir.e estimator finds

new moael par .meters from which gradients are calculated that will drive

the mill to the r.ew optimum.

The optimizer can bo fino tuned by selecting the design parameters (

setup_6 and setup_7 in appendix J). For this general study the fine tuning

is not meaningful because it depends on specific disturbance dynamics and

disturbance magnitudes expected. The tiade-off seems to be between

robustness and how quickly the estimator finds a new optimum.

The majority of the ideas and algorithms for improvements to RLS esti­

mation are new and still n<*ed to be understood fully. A more systematic

way of choosing design parameters would great1> reduce the degrees of

freedom and make simulation testing and comparison easier.

The need to continuously apply a p*n;urbation or input excitation signal

to ensure good estimation may not bo e s s e n t i l on a real plant where the

signals are inherently noisy and have a richer spectral content.

As with the ball mill case study it was found that the covariance reset­

ting modification to the RLS estimator gave the best rosults. Its advan­

tage is that tho covariance matrix is at its smallest when the gradients

ar«> used.

Autogenous Mill Adaptive Optimizer


6.0 CONCLUSIONS

The concepts and theory underlying an adaptive optimizing regulator have

been presented. This adaptive optimizing regulator is intended to improve

the performance of a plant where slowly varying disturbances change the

desired plant operating point and it is possible to calculate « perform­

ance criterion from available measurements. Practical issues concerning

rhe implementation for a real plant are also addressed.

A simulation case study of the adaptive optimizing regulator applied to

a simplified ball mill uas performed to tost the fundamental operation

of the optimizer. The simulation results show that the optimizer performs

reliably and keeps the plant at its optimum in the face of economically

significant disturbances. This study helped identify the conditions and

requirements for correct optimizer operation.

Furthermore, it appears as though this kind of controller is directly

applicable to the control of autogenous run-of-mine milling circuits and

is suitable for implementation in a typical process control computer. It

should be seen as complementary to conventional single-variable or

multi-variable regulatory controllers in this application and provides a

way of integrating such controllers.

The simulations performed to test the optimizer in the autogenous ROM

application give very encouraging results, showing that the gradients

derived from a simple on-line line.ir dynamic model describing the mill

perform.nee, can be used to drive the mill towards and track a shifting

desired operating point. This part of the **esenrch has provided a

framework for a more detailed, completionsive and specific simulation

Conr. 1 ns ions 83
study that could then lead to implementation on an experimental autogenous

grinding circuit.

In summary, the significance of this research is to show that a new p r o ­

posal based on a combination of ideas from the field of modern digital

control does have a lot to offer and can address real needs in connection

with the control of grinding mills. The research has shown that further

practical development of the optimizer is certainly worthwhile.

Limitations of this study include the lack of an overcll stability an al ­

ysis on the theoretical side, and on the practical side, the need to i >t

the adaptive optimizer using real noisy signals.

Cone lus ions


7.0 REFERENCES

1. Bamberger, W. and Isermann, K. (197S) Adaptive on-line steady-state

optimization of slow dynamic processes Autom.it ica, vol. 14, 1978.

pp.223-230.

2. Blackman, P.F. (1962) Extremum-seeking Regulators An Exposition of

Adaptive Control, Westcott, A. Sou York, Porgamon, l(>t'2.

3. Brdys1, M. (1983) Hierarchical Optimising Control of Steady-State

Large Scale Systems under Model-Reality Differences of Hi\ed T y p e • A

Mutually Interacting Approach Proceedings of the 3rd IFAC Symposium,

Large Scale Systems: Theory and Application, Warsaw, Poland, 1983.

4. Brdys', M. and Roberts, P. D. (1984) Convergence and Optimality of a

Modified Two-step Algorithm for Integrated System Optimisation and

Parameter Estimation The City University, Research Memorandum,

CEC/MB-PDR/ 12

5. Bryson, A. E. and Ho, Y, C. (1975) Applied Optimal Control New York,

Hemisphere, 1975.

6. Duckworth, G. A. and Lynch, A. .J. (1982) The effect of some operat ing

variables on autogenous grinding circuits and their iripl icat ions for

control Preprints, 14th International Mineral Processing Congress,

C.I.M., 1982, 11 1 -1 - 1 1 1- 1 .2 1 .

7. Edler, J., Nlkifornk, P. and Tinker, E. B. (1970) /I comparison of

the performano of techniques for direct, on-line optimization Can.

J. of Clicm. Eng, vol. 48, 1970, p.432.

References 85
8. Ellis, J. E. and Roberts, P.D. (1985) On the Practical Viability of

Integrated System Opt imisation and Parameter Estimat ion IEE Control

85 Conference, Cambridge, June, 1085.

9. Flook, W.R. (1975) Automatic control of feed of autogenous grinding

media J. S. Afr. Inst. Min. Metall. vol 76, 1975.

10. Flook, W, R. (1977) The control of grinding loads in the autogenous

and semi-autogencus milling University of the Witwatersravd Vacation

School of Grinding, Johannesburg, Aug. 1977. pp, 126-145.

11. Flook, W.R. and Flasket, R.P. (1982) Design and control practice for

run-of-mine mills in Un.icn Corporat ion Proceedings, 12th CMM1 Con­

gress H.W. Glcntedito:) Johannesburg, S. Afr. Inst. Min. Metall. (or

G e o l . Soc. S. Afr.), 1982.

12. Gtrcia, C.F, and Morari, M. (1981) Optimal Operation of Integrated

Processing Systems - part 1. AIChE J. vol. 27, 1981. pp. 960-968.

13. Garcia, C.E. and Morari, M. (1984) Optimal Operation of Integrated

Processing Systems - part 2. AIChE J. vol. 30, 1984. pp. 226-234.

14. Goodwin,G.C . and Sir, Kwai Sang (1984) Adaptive Filtering Predicr.ion

and Contiol Sow Jersey: Prentice-Hal1, 1984

15. Goodwin, G, C., Lozano Leal, R., Mayne, D.Q. and Middleton, R.H.

(1986) Rapprochement between Cont inuous and Discrete Model Reference

Adaptive Control Automatic.i vol..2. no.2, pp 199-207, 198o.

16. Haber, R. and Kmic/.ky, L. (1‘


i’Si Ident it teat ion of Non! inear Dynamic

S y s t e m Idoi: • it.' ition and System Parameter Estimation, R.ijbmatiU'd . )

North-Hol land Publishing Company, l‘


i7h.

References 8ft
17. Haimes, V. Y. and W i s m e r , D. A. (1972) A computational approach to

the combined problem of optimization and parameter estimation

Automatica, vol. 8, 1972. pp. 337-347.

18. Herbst, J. A. and Rajamani, K. (1982) The applicat ion of modern c on­

trol theory to mineral-processing operations Proc. 12th CMMI Con­

gress, Johannesburg, 1982, pp.779-792.

19. Hinde, A.L. (1977) Control of milling circuits using simple feedback

loops. Vacation school "Grinding Theory arid Practi ce" - South African

institute of mining and metallurgy, 1977

20. Hulbert, D.G. and Barker, I.J. (1985) The control and optimization

of milling circuits MINTEK 50 International Conference on Mineral

Science and Technology Publication vol.l, 19G5, p p . 197-203

21. Jacobs, 0. L. K. and Langdon, S. M. (1969) An optimal extremal control

system Automatics, vol. ft, I9t)9. p. 29 7.

22. Keviczky, I.., Kolostori, J. and Hilger, M. (1976) On Simultaneous

Optimal Control of a Rav Material Blending and Ball Grinding Hill

Proceed. IFAC Symposium, Johannesburg, p p . 143-158, 1976.

23. Kramersh, I.L. (1987) Modular Modelling of an Autogenous Grinding

Circuit M.Sc. Project Report, Department of Electrical Engineering,

University of the Witwat'u srand, South Africa, 1987

24. Lynch, A.J. (1977) Mineral crushing and grinding circuits. Elsevier

Scientific Publishing Company, V-w York, 1977

'1~>. MdJtlevuld, A. jnd R ijnsdorp, J. E. ( 1970) Constraint control wt7

distillation columns Automatica, vol. ti, 1970, n, 51.

Re! eiences 87
26. MacLeod, I. M, (1987) Series of Private Discussions and Notes on

Adaptive Control - unpublished.

27. Magasarian, 0. L. (1969) Non!inear Programming R. Kriegcr Publ.,

Hunt inton, NY, 1969.

28. Mokkon, A. H. and Viol , F. W. (198t>) Improved automat ion rnd control

of a run-of-mine ore milling circuit for gold bearing rock at Kinross

mines Private communication, 1986.

29. Nachane, D. M. (1985) The Integrated Problem of Identification and

Optimization IF,E Control 85 Conference, Cambridge, June, 1985.

30. Narendra, K.S., Monopoli, R.V. (1980) Applicat ions of Adaptive C o n ­

trol Academic Press, pp. 345-509, 1980.

31. P auw , 0. C., King, P..P., Garner, K . and van Aswegcn, P. C. (I9ft5)

The control of pebble mills at th> Buffelsfontein Gold Mine by use

of a multivariable peak-seek in/; controller J. S. Atr. Inst. Min.

M e talI . vol. 85. Mar. 1985. pp. 89-96.

32. Plitt, L.R. (1976) A Mathematical Model of the Hydrocyclone

Classifier CIM Bulletin, Dec 1976

33. Polak, E. ( 10 7 l) Computational Methods m Jpt imizat i on : /) Unified

Approach Academic Press, Nfu York, l°7l.

34. Roberts, P. D. and Williams, T. C. ( ] 9 M ) On an algorithm for

combined optimization and parameter estimation Automatica, vol. 17,

1 9 M . pp. 190-209.

References 88
35. Saridis, G. N. (197^ Stochsstic methods for identification and con-

trul - <? surrey IEEE Trans. Automatic Control, vol. A C - 19, 1974.

p .7 9 E.

36. Savas , E.S. (196.5) Computer Control of Industrial Processes New York,

rtcGraw-Hill, 196 j.

37. SawaragL, Y., TakamHtsu, K , Fuk&naga, E., N.ikanishi, E. and Tamura,

H (1971) Dynamic version of steady-state optimizing control uf a

distillation column by trial method Automatic;., vol. 7, 1971. p. 509.

38. Seborg.D.E., Edgar,T.F. and Shah, S.L. (1986) Adaptive Control

Strategies For Process Co n t r o l : A Survey AlChe Journal. Vol. 32,

No.6, June 198o , pp.881-913.

39. Smith, C. L. (1972) Digital Computer Proccss Control Scranton, Intext

Educational Publishers, 1972

40. Stanley, G.C. (1974a) The autogenous m i l l , a mathematical model d e ­

rived from pilot and industrial scale experiment Ph.D. Thesis, U n i ­

versity of Queensland, 1974.

41. Stanley, G.G. (197**b) Mechanism:; in the autogenous mill and their

mathematical representation. Journal of the South African institute

of min.ng and metallurgy, November 19 74.

42. Stanley, G.G. (1977) The operat ion f autogenous and semi-autogenous

milting circuits. Vacation school "Grinding Theory and Practice" -

South African institute of mining ind metallurgy, 1977.

kefercncos 89
43. Sternby, J. (1980) Extremum control systems - an area for adaptive

control Proc. 1980 Joint Automatic Control Conference, San Francisco,

1980.

♦4. van der Morwe, S. ( 1987) The Implementation of a General Adaptive

Controller Module M.Sc. (Eng) Project Report, Department of F.lectricul

Engineering, University of the Witwatersrand, 1987.

45. Webb, P. V., Lutter, B. E. and Hair, K. L. (1976) Dynamic optimization

of fluid cat crackers Chemical Engineering Progress, vol. 74, 1978.

4b. Williamson, J.E. (1975) The automatic control of grinding medium in

pebble mills. J. S. Afr. Inst Min. Metall. Vol. 76, 1975.

47. Wong, K. Y. and Polak, E. (1967) Identification of Linear Discrete

Time Systems Using the Instrumental Variables Method IEEE Trans.

Autom. Contr., A C - 12, 707, I9b7.

References 90
A P P E N D I X A. AN EX AMP LE OF R O B U S T MODEL I D E N T I F I C A T I O N

An example of the implementation of the theory in section "Coping with

Deterministic Disturbances and Plant Noise" on page 24 follows:

Consider the SISO case with one measurable disturbance included in the

moH«>1 . We want to model the objective measurement f as a fuuctiun of the

plant input u ( remember ti'at this could bo a lower level regulator

setpoint or a direct plant input, in fact any input variable that can bi

used to control t ), and as a function of the measurable disturbance z.

Choose the model as second order with deadtime d as a multiple of the

model sampling time. The backward shift polynomial operators are:

i i -0
A(q 1) = ao + a ,q + a 2q ~

B(q'*) = q ^(b8 + b tq ' ‘)

C ( q " *) = q d tc0 + c,q~ *)

and the model is:

A ( q * 1)f (t ) = B(q-*)u(t) + C(q-')z(t)

Assume the only known deterministic disturbance is a constant offset.

This is often the case because the DARMA model is an incremental model.

A model of the deterministic disturbance is:

r ( t) = r(t-l) j

or in q " 1 operator notation:

n - q * s)r(t) = o

Appendix A. An example of Robust Model Identification 91


so in this case 0 ( q " ‘) = (1-q'1)

From 0(q”') choose.

Q(q~ *) = (1 - Eq"*)

a polynomial "close" to 0 ( q * 1) uiere e is ju^t less than 1.

Q C q ~ 1) in the model denominator should filter out the dc term from the

estimator inputs and the value the model predicts.

For the low pass filter ( 1/1'.(cj" ‘)) we choose a highest frequency o: in­

terest Wg = 2it rad/sec. or fg = 111?.. The minimum degree of E, 3E must

be equal to the degree of A, 3 A , which in this case is 2. Using the

rectangular rule to approximate a digital equivaler. of a continuous 2nd

order low pass filter the Laplace variable can be related to the backward

shift operator b^:

where A 5 filter sampling period

and the equivalent of the filter:

1
(st + l)2

where t
w,dB

is :

Ktq" 1) (e0 + *■,q ‘1 + 0aq “)

whoi-o h = and

Appendix A. An example of T iust Model Identification 92


e 0 = 1/h2

e, ■
* 2(h-l)/h2

e, = (hJ - 2h + 1)/h 2

Now we have the pre-filter and u^. and z ( cai. determined for

the robust model:

A(q* 1)yf = B(q~1)uf + C Cq ’' ) ^

Appei-v’.j ii example of Robust Model Identification


A P P E N D I X B. E X A M PL E OF A SIMPLE. O P T I M I Z A T I O N A L G O R I T H M

This appendix gives a simple example of how the steepest descent gradient

search algorithm is applied to a SISO static plant model.

From the dynamic model derived in appendix A, and extracting the steady

state model by setting q ' 1 = 1 we gf’


t:

(a 0 + a, + a 2)Y < “ (b, + b,)ut + (c0 + c,)z^-

If the dynamic model is constructed to predict Y'(t) rather than Y^(t)

(section entitled "Coping with Deterministic Disturbances and Plant

Noise" on page 2*) then the steady state model will include the iilter

coefficients e.. The only difference between Y^(t) and Y'(t) is that Y ^

has been filtered by 1 / E (q ~ 1). Since all the variables are assumed to

be in steady state it is valid that Y' equals Y^.

The gradient of the objective wi"h respect to the plant input u^. of this

SISO, single disturbance, linear, static mrdel is calculated analytically

using simple calculus, to give:

3Y, _ (be + b,)


Ou^. (a0 + a, + a2)

If a non-linear model ( section entitled "Choice of Model" on page lt> )

is used tl:>n the gradient would not be constant, as it is in the above

case, and tin derivative would have lo be evaluated at the operating point

u (t ).

Appendix B. Example of a Simple Optimization Algorithm


Note also that if a plant output is included in the objective function

calculation, and therefore also in the model, then the chain rule for

differentiation needs to be applied.

Applying the steepest descent gradient search algorithm the plant moves

are calculated from:

AH'
u f (t) = u f(t-l) + u ___f
3Uf

whore w is the step size to ensure convergence and the + sign finds a

maximum and the - sign a minimum. In terms of the model parameters the

above equation becomes:

u^(t) » u f(t-l) + u (b0 + b t )


(a0 + a, + a,)

Parameters a. and b^ are calculated using a modified RI.S estimator (

section entitled "Estimation of Model Parameters" on page 20 ) with a

relative deadzone < Lection entitled "Coping with Modelling Error within

the Bandwidth of Interest" on page 29 ).

Appendix B, Example of a Simple Optimization Algorithm OS


Steady state relationships for ball mill simulation
variables: mt ...solids mass flow rate out of mill
product ...solids mass flow rate of product
gt ...separator underflow mass flowrate
ft ...fractional filling of the mill
It ...total mass flow rate into the mill

constants: dd :* 0.05 constant to simulate a disturbance caused by


a change in ore characteristics or a change
in size controller set point or ball or liner
wear
0.5

df := 0.5 ~
dd - (dd (2 ♦ dd)) i df - 0.073

df is a variable to simulate a change in the


discharge rate caused by on* of the
abovemention'-d disturbances. It is coupled so
that an increase in discharge rate causes a
corresponding increase in product

c 4 constant for mill discharge calculation


a :■ l constant for product calculation

1 * dd
b c* constant for product calc*'lotion

* -1
’ 4 ' 2 normalize the maximum product
1 c
n n ■2
2 2 .■

Optimum operating point with no disturbance:

product :- 1
opt

ft 0.5
opt
2
mt :■ c • Tft 1 +0.4 mt *1.4
opt [ opt J opt

97
Optimum operating point if disturbance dd is not zero:
1 + dd
ft ft * 0.525
opt opt
-a 2 2
product :« n ft — c • ft ♦ b c product « 1 .216
opt opt 2 opt . opt
£
mt :» c 1 [ft + dfl ♦ 0.4 ®t » 1.83
opt L opt J opt

i :* 1 ..200 iteration variable

ft :« --- scaling of ft
i 200

Calculation of mill discharge:

4
mt c [ft ♦ dfl + 0.4 and in the steady state:
i L i J
It :» mt
i i
Calculation of mill product:

-a 2 2
product :» n — c • ft * b c ft
i 2 i

Derivative of product w.r.t ft:

2 3
dproduct :« n -a c •2 ft + 2 b e ft
i i i

Derivative of ft w.r.t It:

dft
i 2 c ft

98
G ra d ie n t o f product w . r . t r e g u la to r s e tp o in t I t :

line indicating zero


gradient :* dproduct dft
i i i z :* 0
i
Separator Underflow is calculated as folows:

gt :■ mt - product
i i i

Mill steady state relationships

Gradient w.r.t ft

99
Gradient v . r . t It

100
A P P E N D I X D. B A L L MI LL A D A P T I V E O P T I M I Z E R P A S C A L PR OG RA M

LISTING

Appendix D. iJ.ill Mill Adaptive Jptimizor PASCAL Program Listing


.................... - ............... - ............. >
program s i n u l a t i o n < i n p u t ,o u t p u t )i

const no_par«5i
p i * 3 . 1 4 1Bt

vai
< simulator va ri ab le s >
T :real s {Time)
TST A R T :r e a l i
T S T O P :r e al tS T O P :booleani
DELTsrealj ( Integration .step size for simulat i on >
S A M P L E : integeri < controller sampling rate >
< as a multiple of DELT >
OPT:integen < optimizer update time >
< as a multiple of SAMPLE'OELT )
1 0 6 : integeri < data logging time as a multiple >
{ of SftMPLE'OELT >
p r e v _ t i m e : r e a l j < variable to sto'i time >
< from previous iteration >

< plant variables >


x :array I I .. Z 1 of reali < x M l plant state >
{ xl?) regulator state >
d x :a r r s y ( I .. 1 1 of reali< derivative of states >

< inputs >


f eed_rat e : r e a l i
rt:reali < regu lator setpoint >
< in steady state rt-lt >
hlze:reali

{ intermediate vari ables >


It eal i < f l o w into mill >
mt:reali < f l o w out of mill >
ft:rr«li < m e a s ure of mill load >
gt:reali < separator underflow >
store :arrayl I . . 3 ,® . I(tfffli of reali < history to >
< implement pure del a y >
< outputs >
p r o d u c t i r e a l \ < quantity of product >
power:real i < mill pow<*r draft >

< plant c o n s t a n t s I
A:reali < integrator gain >
d t n : l n t e g e n ( mill transpo't delay >
< as a multiple of PELT >
d ts:integer) < separator tronsport delay >
< as a multiple of DELT >
Ki:reali < reg u lator integrator gain >

< variables to implement change* )


< in feed c h a r a c t e ristics >
dls t _ m _ p r o d : r e a l i < disturbancs >
d i s t _ t _ p r o d : r e « l i J start time for d i s turbance >
d i e t . s t _ p r o d : r e a l i{ stop time for disturbance >
disturbance, s tc 'e:reali
d d . d d f :reali
d i s t u r b _ r a t e :real| < constant rate of change of model )

< variables for noise generation )


n . b n : longreali
bnn:real I
nag. noisa:reali
t o r :r e a l i
bandwidth:real I

102
< cnnt.-oller variables >
rx_mag:real•
r t _ m a x :reali
init_rt:reels
s t a r t :i n t e g e r (
size._sp:real;
step_size:reals
cpt_st’ art :real i < optimization start tine >
gradient ,max_grad,mi' g>~nd:real i

< estimator variables >


e s t _ s t o p _ t i m e : reali
est_start_time:reali
dead_t ime:lnt e g e r i
s y :a r r a y t0 ..31 of real l
*u :a.'r ay (0. . 501 of real I
a v : a r r a y ! * . .501 of r e a l »
P e s t :real I
error:reali
P _ m a t :a r r a y M . .2 0 ,I..Z01 of r e a l ;
init_P_mat:real;
c o v a r i a n c e _ r e s e t t i n g : booieani
c o n s t a n t _ t r a c e :bool earn
p a r :a r r a y ! t ..Z01 of real i
r e Q : a r r a y ! I . .Z0) of real I
f o r o e t t i r o f a c t o r :reali
deadband_time_constant:real i
beta:reali < deadband scaling constant )
d z:a r r a y ! 0 . . 11 of reali
k0.kl:reali < constants for constant trace algorithm >
ep:reals < high pass filter constant >
s f u . a f y : a r r a y ! 0 . .21 of real! i storage for filter >
est_only:booleani < to check estimator without the controller >
d e b u g :boolean:

•include * p l o t _ v a r . p ’t

<........................ -..................................................
procedure read_setupi
var path:strpathi
f H a l :text i
begin
writeln! ’ O p t i m i z i n g regulator applied to Rail Mill * >i
u r i t e l n < ’Simula t i o n S t u d y ’)|
writeln!’ File to set up simulation: s e t u p ’ll
path:• ’ / u s e r s / b l e l o c h / s l m _ d i r / b a l l _ m i l l _ d i r / s e t _ p l a n t ’i
reset< filet.path)i
r e a d l n < f 1l e i ,T S T A R T )iu r 1teln( ’ Slmulat ion start time ’.TSTftRT:3"2 )I
readl n( f i 1 e 1 .TSTOPli
urlteln(’ Stop time ’,T S T O H :3 :2 >I
readln< f i1e 1 .DELTli
uriteln<’ Plant simulation campling interval ’,DELT:Z:Z>|
readln< f i1e I .dtm ) i
u r iteln < ’ Hi 11 pure delay ’,dtm)i
readln< f llel ,dts ) i w ' i -; eln(’ Separator pure delay ’,dts)i
readln! f i l e l ,A ) i u riteln<’Integrator g a i n ’,R:Z:Z)|
r e a d l n < f i1e 1 ,K i )i u r 1 teln < ’ Regulator integrator gain ’.Ki:2:Z)i
r eadln<flle d lst_m _prod'i
u r i t e l n ( ’X d i s t urbance ’,< r*i st_m_prod» 1 0 0 ): Z :Z ) i
readln< f i l e l ,dis t _t_prod)i
uriteln! ’ Disturbance start time ’,dist_t_prod: 3:Z ) I
r e a d l n f f i l e l ,dist_st_prod)i •
writeln!’ Disturbance stop time ’,d i s t _ s t _ p r o d : 3:Z )i
readln( f 11 e l ,d i s t u r b _ r a t e )I
u r l t e l n < ’T ime uhiie model is changing ’,disturb_rate:Z : 1 ) i

103
readln<filel ,i*ag_noise)iur iteln<’ wag_noise ’,*og_ n o i s e :Z :Z ) i
readln< f l l e l ,bunduidth)iurlteln< 'bandwidth ’,b a n d w i d t h : Z : 3 ) s
c l ose(filet ) s
end i
<.....................................................................
procedure r e a d _ c o n t r o l 1er_setupi
var path:strpatht
f l i e ! :t e x t ;
i ,J :i n t e g e r ,
beg i n
u r i t e l n ( 'F lie c o n t a i n ing controller settings: set_cont')»
p a t h : • '/ usera/ble l o c h / s i m _ d i r / b a l l _ m 11_ d i r / s e t _ c o n t ’s
reset< f 1 1e I ,path >i
readl n( f i 1 e I ,‘ JflMPLE > t
uriteln<’ C o n t r o l ler sampling period ',S A M P L E « O C L T :3:Z )i
readln< f l l e l ,OPT ) i
ur l tel n( 'Opt inizat ion update tine * .QPT»Sr1MPLF. *QEL T : J: Z ) i
r e e d l n(f 1 1e I ,106 ) I
u r i t e l n('Logging interval ’,L 0 6 « S A M P L E*DELT:3:Z )I
readln(flie I ,dead_tine)|
r eadl n< f 11 e I ,f o'^get t ing_factor ) I
readln< f i l e t ,ep>i
resdln( filet ,deadband_t i«e _ c o n s t a n t ) i
r e a d l n ( f i l e t ,beta)i
readln< f i l e t ,i n i t _ P _ « a t )i
readln< f 1 1 * I .covar i a n c e _ r e s e t t i n g )i
readln< f i l e t ,c o n s t a n t _ t r a c e )I
r e a d l n < f i l e t , » t e p _ s i r e >i
readln< filet wan orad?I
readln(filet,*tn_Qrad)t
readln< f i l e t , r t _ « a x )i
reidln( f i l e t ,i n l t _ r t )i
readln( f i let,rt_«ag >I
readln( f i l e t ,siie_sp)i
readln< f i l e t , k 0 > i
readl n< f i l e t ,k I )i
readln< f i l e t ,e»t_onlv)i
r e a d l n ( f i l e t ,est_start_t i w e )i
r e a d l n ( f i l e t ,e s t _ s top_ti«e )i
readln< f i l e t ,o p t _ s t a r t ) i
r e a d l n < f i l e t ,d e b u g )i
close(fllel)i
< initialize storage variables >
for t:-0 to S0 do beg in
s u ( 11:
sv( i1 : > 0 1
endi
syt 0 1 : > 0 i s y l 11:>0isy( Z i :>01
end i
{......................................................................
procedure read_initial_para«etersi
var path:strpaths
filet:tex 1 1
i *i n t e g e r »
begin
pa t h : “’/users/bleloch/si /bal l _ m 11 _dir/init lal_ p a r ^ e t e r s ’i
reset< f i l e t ,path)t
for i: > I to n^_par do r e a d l n<f l l e l . p a r t l l )i
close< f 11e 1>i
endi
{.....................................................................
function sa«ple_tiwe:booleani
begin
if round<T*t0> nod r o u n d < S A H P L E * O E L T * 10 )>0 then sampl e_t -.*e:"true
else sanple^time:> f alsei
endi

104
<........................................................................... >
function o p t _ t l « e :bool earn
beg 1 n
If round'T»10> nod round<OPT»SflW’
L E »OElT»10>-0 then opt_t m e :-true
else opt_tt*e:-false;
end!
{-................................................... ...................... >
function 1o g _ t m e :boolean;
begin
if roun\J< T* 10) nod round< LOG*SflMPtE»OELT» I0 )*0 then log_tine:-true
else 1o g _ t Ine:-false;
end)
<...................................................................... ..... >
f unci Ion dul ay( store_no: integer ; v a n a b l e : r e a l i t l n c : l nteger >: real «
var l:I n t e g e r i
begin
riel a y :" s t o r e I s t o r e _ n o .t m e ] t
for i:-tine downto I do storel s t o r e _ n o ,11:* s t o r e ! s t o r e _ n o ,i - I 1 i
s t o r e I » t o r e _ n o ,0):• var tab l e i
end i
{— ......................................................................... >
f unct ion 1 init< v a r l a b 1e ,w a x , n m : r eal): real;
begin
if ( v a r i a b l e > n a x ) or < varlable<nln) then begin
if variable>nax then linit:-naxi
If v a r l a b l e < n i n then ! l n l t : - n l m
end
else 1 l n l t :-v a r l a b l e ;
end t
<.......... -.............. ................................................ >
function s r a n d 4 8 : l ongreal(external I < Bandllulled bausslan Noise >
function d r a n d 4 8 : l o n g r e a l «external i
f unct ion nolne< n a Q _ n o i s e ,c u t o f f :r e a l ): r e a l i
const signa-0.li
var i:integer;
a c c u n : 1o n g r e a l i
begin
accun: ■0;
t o r : « 1 / ( 2 « p i ‘c u t o f f )i
< convert fron linear distribution to Gaus s i a n d i s t r ibution >
for U " l to 12 do a c cun:-accun ♦ 2»< drand<8-0. S > i
n:-accun/12 1
< llnit b a n d w i d t h >
b n : - b n * e x p < - S f W L E « O E L T / t o r )♦»igna « n « s q r t < I-e x p < -2 » S A M P L E * O E L T / t o r ) )i
n o t s e :- w a p noise*bn;
endi
{........................................................................... >
funct ion disturbance* di sturb_t m e .disturb_stop:reali
d l sturb. lag:r e a l t d i s t u r b _ r a t e : r e a l ): r eal;
begin
if T < d i s t u r b _ t lne then d i s t u r b a n c e _ s t o r e :-0
else if T < d i s t u r b _ s t op then
d i s t u r b a n c e _ s t o r e :-di sturbance_store
♦d i sturb_nag/(round< 2 * d i s t u r b _ r a t e / 0 E L T ))i
if T > < d i s t u r b _ t l n e + d l s t u r b _ r a t e )
then If T<disturb_stop then d i s t u r b a n c e _ s t o r e :-disturb_Mag;
if T>-d i s t u r b _ s t o p then
d i s t u r b a n c e _ s t o r e :-d:sturbance_store
- d isturb_nag/( round< ? * d i s turb_rate/OELT >)t
if T>< d l s t u r b _ s t o p * d i s t u r b _ r a t e I then d i s t u r b a n c e _ s t o r e : «0i
If d i s t u r b a n c e _ s t o r e <0 then d i s t u r b a n c e _ s t o r e :*0;
disturbance:-rilsturbance_store;
end i
<........................... -.............................................. )
procedure r a s e t_P<valu e :real );
var 1,J :Integeri

105
uegin
Vor i:« 1 to no_par do
for j:- I to no_par do
if i m j then P m at 1 i , 1 ):■value
else P_*atl i ,J 1 :•?>(
endi

procedure nodelI
begin
if T > p r ev_ti«e then
dd: -disturbance* dlst_t _prod .di st_st_pr orl,di st_n_prod ,disturb_rat e > i
if T > p r ev_tl»e then f t :-delay< I ,x [ I 1 ,dtw) < nill pure delay >
else f t :“x I 1 1 1
{ d i s c h a r g e c o u p l e d to product d i s t u r b a n c e >
ddf: S - s q r t< 14 d d ~ s q r t < d d « ( Z + d d ) ) i l l •
*t:-4»sqr<ft+ddf)*0.4| { dls .iiarQe function >
< product function >
p r o d u c t : “Z«((-1/Z)*16»ft»ft+16» sqr( ( l + d d ) / Z ‘)»ft*fti
{ classifier und e r f l ow }
g t :“« t - p r o d u c t i
if gt<® thc.t gt:-®!
if T>p r e v _ t i « e then g t :“delay( Z , g t ,d t s )t { separator pure delay >
f e e d _ r a t e : I Z 1»
< nett flow into Mill >
11 :«f e e d _ r a t e + g t i
< Mill d y n amics >
d»I 11:-ft«<lt-nt)i
< solids feedrate regulator dynamics >
Jxl 2 1 :-Kl*(rt-lt >i
prev_tl«e:"T«
end i
<...........................................................................

PROCEDURE Runge_Kutta<
CONST NSTATE-Zi
Vttfl
l: INTEGER'
X s t a r t . K t . KZ, K 3:a r r a y ! 1 ..NSTATE1 of reali
Begin
FOR i s - I to NSTHTE do begin
X s t a r t l 1):■ XIili
K U l l J - dX! i 1 • OEL Ti
XI 11:- XstartI 11 4 Kll ll/Zi
end i
Ts- T 4 O E L T/Z i
Modeli
F O R i:»1 to N S T A T E do begin
KZlll:- dXm»OELTi
XI 1.1 :■ Xstar .111 4 K Z ( t l / Z i
•r.ii
•*iodo I |
FOR i:- I to NUTATE do begin
K 3 1 1 1 d X l 1 1* D E l Ti
X I 1) :• X s t a r t l i 1 4 K 31 1 J i
endi
T: - T 4 D E L T/Zi
m del i
FOR i:• I to NSTATE do
XI 1 1 :« Xstartltl 4 (Xllll ♦ K ZI i 1 • Z 4 K 31 i 1 • ? ♦ dX( 11 »DEL T >/ G .0i
T :«round( T« 1V b >/ 100i
Endi < procedure Runge_Kutta >

<44444444444444444444-
PROCEDURE integrator!
var l:integert
Begin

106
Runge_Kuttai
IF (T >* TSTOP » D£LT) then STOP:- T R U E i
Endi { procedure integrator >
{♦*♦♦♦ +♦♦ +•)♦+♦♦+ +♦♦♦♦♦+ ♦♦♦♦++♦<♦♦♦♦+♦♦♦♦+♦+♦♦♦♦♦♦♦+♦♦♦♦+♦ +♦♦♦+*<♦*•
procedure initialize*
var i ,j :Integer;
begin
S T O P :“FALSEi
atep_no:-lt
for i:-® to ti®0 do
for j •■I to 2 do s t o r e ! j ,i 1:«0i
< lnltiai states >
x ( I ):-«t
x (21:*0i
r t :“init_rti
p r o d u c t :*<9i
bnn:■srand48i { seed random number generator >
r e s e t _ P ( i n i t _ P _ m a t )i < reset c o v a n a n c e matri* >
raad.initial _parametersi { road initial Model parameters >
endi
{........................................................... ........
function stept s t a r t :integer >:integeri
begin
if T>*start then step:*! else steo:-0i
and i
{...................................................................
procedure regression_v®ctor( y ,u, v r e a l >i
var i:integeri
b»gln
r e g l I ]:-sfy( 11 i
rt»g(21:-.fyl21i
r e g l 3 ] :-sfu(1)i
regl 41 .‘ "sful 2 1 1
r « m l S l :-li

< shift sample storage >


s y ( 3):*sy(2 1 1
s y ( 2):* s y t 11 i
sy( 11:-sy(01I
sy 101: **y i
for 1:* 0 to 49 do b a g in
su(5 0 - 1 ) : - s u l S 0 - 1 - 11 1
svl S 0 - 11:* * v l 5 0 - 1 - 1 1 1
end i
aui 0 1 :*ui
svl0 1 :-vi

< filter high pass)


s f y ( 2 ) : - s f y ( I) i
sf yl 11:*sf y( 01 i
sfy(01 1- SAMPLE*DELT*ep)»sf y( « 1 + sy[ 01 -syl 11«

sf'ul 21: *sf ut 11 1


sfu( 11:-sf u l 0 1 1
sf u(0):■<1-SAMPLE*DEL T *ep)*sfu ( 0 1 + s u l d e a d _ t ime1-sul dead_t m e t l l i
endi
<.................... ..............................................
procedure tracei < constant trace algorithm >
const eps*0.005t
var traceireali
1 . 1 : integeri
begin
t r ace : - 0 1
for t:-l to no _par do trace !■ trace*P._mat I 1,11 1
for 1: • I to no_par do
for j:« I to no_par do begin

107
If i"J then P_mat [ i ,i 1: ■< k ® / t r a c e )»P_mat I 1, 1 1 -*k I
eioe begin
P_met I i ,J ]:■■< k ® / t r a c e > » P _ m a t ( i ,J 1;
If ir1_«f t( 1 ,J J <epa then P_mat I i ,j ):«<9|
tndi
end;
endi
< ..............................................................- ....................................................................................................................... - ..........................................................................

funct i o n m u l t l p l y _ v e c ;r e a l i
var l . j : I n t e g e r »
d u m m y :reali
begin
d u m m y :>0i
for i:- 1 to no_par do d u m m y : " d u m m y t r e g C 11*oar( il i
m u I t 1piy_v e c :"dummyi
endi
{.........................................................................
procedure ettlmaxori
var denom:reali
K ,L:a r r a y M ..n o _ p a r 1 of rea)i
1 ,J : Integerj
................................... >
function norm:reali
var K :arrayt I.. no__parl of real i
i ,J :Integer)
d u m m y '.real i
b e gin
for i:« I to no_par do Kt il:*®i
for J :■ ! to no_par do
for 11*1 to no_par do
K( J ) :aK( J 1+regt il»P_matl 1 .J 1 1
dummy:-®t
for i:» I to no_par do d u m m y :“dummy
+ K I 11* r e g t 1 1 i
norm:"dummyi
endi
<........................................ >
begin
P e a t :- m u ltlply_vect
error:-of y l ® 1 - P o s t i
denom:"forgett ing_f actor + normi
for is- I to no_par do begin
Kill: -P..mat 1 1 , 1 1 *reg( II +P_mat [ 1 , 2 1 «*regt Z1
♦P_matf i 3 1 » r e g l 3 H P _ m a t t i , 4 1 * r e g i 4 )
♦P _ m a t [ i ,51» r eg[5 1 1 (+P_matI 1 ,61*regl61
♦ P _ m « t l 1,71»reg(71+P_mat ( i ,81»reg( 81
+ P _ m a t I 1 .91» reg[9 1 ♦P_mat I i ,1®1»reg( I®) I >
•nc .
for 1:• I to no_par do
L t 1 1:" r e g l 11» P _ m a t [ ) , 1 1♦ regt i 1« P _ m a t ( ? . i 1
♦ r e g t 31» P _ m a t I 3,11*reg(41» P _ m a t [4 , 1 1
♦ r e g t 5 1 «P_matIS,ili<+reg(6)»P_matl6,il
♦regt 7 1 * P_mat17,1 H r eg!8 1 »P_mat t 8 , 1 1
♦regt 9 1 »P_mat t 9 , 1 1 + r egtI#1«P_matt t ® ,i1 1 >
for i:» 1 to no_par do
part 1 1 :-par I i1♦« 1 11•error/denomi
for 1!" 1 to no_par do
for j:* I to no_per do
P_’«at I i ,j 1: •( 1/ forget t ing_f actor )i P_ mat t i ,j 1- K I 1 1»Ll J 1 / denom > |
end,
{ ..................................................... - .................................................................................................. .......................... ...................................................................- .......................................

procedure optimizer'
begl n
rt :"rt +step_.si*e»gradient t
rt :" li m i t < r t , r t _ * a x ,®)t
end!

108
{....................................................... ..............
funct io n dead_band:booleanj
contt cdz0-0.000C1i
cdz I i
c d zZ - 0. 00001 i
c d z 3-0.00001 i
( c dz 4- 0 .2 i
alpha*®.&6i>
begin
If T > SAMPLE•OELT then d z ( 11:»dzt01 else dzll):*0i
<if T<*SAMPLE then b e t a : *sqrt<cdz4 + I/< I - a l p h a ))i >

dz( 0 1 :« de ad b a n d _ t ima_constant*dzl 11
+c d z 0t c d z I*abs( product >
♦cdzZ*abs< feid_rate)
+ cdz3»abs( s i z e )i
e r r o r :-pro du ct - P e o t i
If abs*beta*dzl0 ' >>abs(e r r o r ) then dead_ba->d:-true
else dead_band:-falset
endt
<......................................................................
procedure dumpi
var I S integeri
begln >
wrltelfrt'Tme * ,T:3:Z>|
wrltelnl' R e g r ession vector: ’)|
wr 1 tel ' • >|
for ls»t to no_par do urite(reg( 1(2:3.' 'Jiwritelm
writeln<’ Parameters:
for i s« I to r o u n d ! n o _ p a r / 2 ) do
writelni ' ' ,part2*\ 11 s3:3,par(2*li13 > 3)(
wr 11 e 1n ( ’ P_matl * hwrltc. ' ’>|
for t:«l to no.par do wr i te< P_mat f 1 .11 :fcs 2 , * ' l i w r i t e l m
writelni' Product ' . p r o d u c t 3 1 i
wrtielM ' Mill Power ' .p o w e r :3:3)I
wrlteln<• Estima t i o n error *,e r r o r :2:4 ) i
writelni’ 6 r ad lent ' . g r a d i e n t :I :3)i
endi
{......................................................................
proc e d u r e controlleri
beg i n
If e s t _ o n l y then tf opt time then rt:«rt ♦ rt„magi
rt:-rt+no:se<«ag_nolse,bandwidth)i < add noise >
regresston_rf»otor( product,rt.slim)i
< call estimation procedure >
If T< e s t _ s t o p _ t m e then
if T>est_start_tlme then
If not tiead__band then e s t i m a t o r i
< c a lculate gradient >
If T > e s t _ s t o p _ t )me then P e s t : am u l t l p l y_veci
g r a d i e n t :■<pari 4)fpar I 4 ) )/< 1-Ip a r [ t I+ pa~I 21 )> i
(if absl pari 31 ♦pari 41 K 0 . 0 I then
if at>s( 1 -par ( 11 -par ( 21 )>abs( par I 33 ♦par I 41 > then
g r a d i e n t :*0t >
g r a d i e n t : *1 lmi t igradient ,max_gr ad ,min_grar! 11
If o p t _ t Ime then If debug then dumpi < dump variables t
< call optimization procedure >
if not est_only then
if T>*opt_start then
if opt_tlme then
If ft>0.3 then optimizeri
If c o v a r i a n c e _ r e s e t t i ng then if opt_time then r e s e t _ P < l n l t _ P _ m a t ) i
if constant_trace then tracei
endi
<......................................................................
p r ocedure log_points< curve_no,step_no: integerivalce.Tireal)i

109
begin
datanatr ix_xl c u r ve.no ,a t e p _ n o l :• f i
d a t a « a t r i * _ y [ c u r v a _ n o ,a t e p . n o ) :‘valuei
and)

procedure log_datai
var i : I n t e g e r i
begin
log._prlnta< 1 ,at e p _ n o ,a 1*e ,T ) i
log. o l n t a ( 2 ,a t e p . n o . p r o d u c t ,T )i
loo o o i n t a ( 3,a t e p _ n o , f t ,T )i
l o g _ pointe(4 , a t e p _ n o ,f e e d _ r a t e ,T )i
log_pointa< 5 , atep_.no .gr a d i e n t .T ) s
log_pointa(6 , a t e p . n o . P e a t ,T >i
log_polnta< 7 . a t e p _ n o . r t .T )I
l o g _ p c i n t a < 1®,a t e p . n o ,b n .T )i
log_polnta< 8 , a t e p _ n o , g t .T >i
log.poIntel 9 ,etep_.no , * t .T ) i
log pointa( 1 t,atep_no. I t ,I ) i
at e p . n o : - a t e p _ n o + 1t
endi
(..................................................................
procedure urite.datai
var
p a t h , p a t h i :atrpathi
1 .dummy:integer|
procedure u r t te_f 11 e( n a m e :etrname ic u r v e _ n o .no_of _ p o l n t s : i n t e g e r >i
vflkr d i r e c t o r y :atrpathi
t:Integeri
be g i n
directory:-pathi
strappend(directory,n a m e )i
reurlte<flle_var.directory)i
u r lteln< f 11e v a r ,name >|
urlteln( f 11e _ v a r .no of polnta >i
for 1 i■1 to n o _ o f .polnta do
writeln(f ile_var.riatamatrtx_x[curve_no,1),
datamatrlx_ytcurve_no.1 1) i
cl oae< f 11 e_v«r .'SAVE ’>i
endi
begin
path:■ '/uaera/bleloch/alM_dir/ball_Mlll_dir/’i
urite_f ile< ’f oed.rata' ,4 ,atep.no-1 > i
urit*_file<’aize’.1.atep_no-I)i
urite_f11e('nroduct' ,2 .atep_no-I)i
urlte_flle( ’ V t ’,3,«tep_no-I)|
urite_f ile<’ P e a t ', fi.atep.no-I )i
urit»_fllo( 'mi ’.9.atep.no-I)i
urlte_f lle('gt ’.0.atep_no-1)i
urlte_flle('gradient' ,S.atep_no-1 )i
ur 11«_ f lle< 'noiae' . I®.etep ">o- 1 )i
u r lt e _ f 11e < ’
poner’.7.atep.ru 1 )I
u r 1 1e_f11e( '11 ' ,I 1,atep.no-1 ) i
endi
.......................................* ........ ..................................................... .............

begin < main program >


read.aetupi
r e a d . c o n t r o l 1e r . e e tupi
initlalize i
ur ltel n< ’Running e m u l a t i o n ’) i
log_datai
REPEAT
integratori
If aample_time then begin
control 1eri
if log.time then log.da.

110
Author Bleloch Mark John
Name o f thesis An Adaptive Optimizing Regulator For An Autogenous Mill. 1987

PUBLISHER:
University of the Witwatersrand, Johannesburg
©2013

LEGAL NOTICES:
Copyright Notice: All materials on the U n i v e r s i t y o f t h e W i t w a t e r s r a n d , J o h a n n e s b u r g L i b r a r y website
are protected by South African copyright law and may not be distributed, transmitted, displayed, or otherwise
published in any format, without the prior written permission of the copyright owner.

Disclaimer and Term s o f Use: Provided that you maintain all copyright and other notices contained therein, you
may download material (one machine readable copy and one print copy per page) for your personal and/or
educational non-commercial use only.

The University o f th e W itw a te rs ra n d , J o h a n n e s b u rg , is not responsible for any errors or omissions and excludes any
and all liability for any errors in or omissions from the information on the Lib rary website.

Potrebbero piacerti anche