adaptive control of wheat mill roller pair · the modern wheat milling plant is normally a huge...

46
Adaptive control of wheat mill roller pair Master of Science Thesis in the Master Degree Programme Automation and Mechatronics MATTIAS OLAUSSON Department of Signals and Systems Division of Automatic control, Automation and Mechatronics CHALMERS UNIVERSITY OF TECHNOLOGY Göteborg, Sweden, 2007 Report No. EX064/2007

Upload: others

Post on 12-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

Adaptive control of wheat mill roller pair Master of Science Thesis in the Master Degree Programme Automation and Mechatronics

MATTIAS OLAUSSON Department of Signals and Systems Division of Automatic control, Automation and Mechatronics CHALMERS UNIVERSITY OF TECHNOLOGY Göteborg, Sweden, 2007 Report No. EX064/2007

Page 2: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

Adaptive control of wheat mill roller pair

MATTIAS OLAUSSON

Superviser: Andreas Kuhn Examiner: Jonas Sjöberg © Bühler AG, Switzerland All photos and illustrations of this work are under copyright laws Department of Signals and Systems Division of Automatic control, Automation and Mechatronics CHALMERS UNIVERSITY OF TECHNOLOGY Göteborg, Sweden, 2007 Report No. EX064/2007

Page 3: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

i

Abstract The task at hand is to develop a controller algorithm that can replace the manual tuning of grinding rollers of a wheat milling plant. The focus of this thesis work has been to investigate the Adaptive gradient algorithm as a possible candidate for controller algorithm. The relationship between the roller parameters (system input) and the qualities of the grinded wheat (system output) can be modeled with non-linear functions. Since the time constants are small with respect to sampling time, the functions can be considered static. The properties of the plant make the algorithm Adaptive gradient control a promising alternative for the controller. With this approach, the controller continuously estimates the function gradients – in other words, estimating the system Jacobian – and applies a control law to find the optimal change in the roller pair input parameters to reach reference values in output. In the preceding thesis work the algorithm was tested and some problems were indicated. Most importantly, unstable behavior (large deviation from the target point) arises when the Jacobian becomes singular. The controller also shows a remaining error after convergence at times. In this work, two subtasks have been in focus; the first, to implement the algorithm from the previous thesis work, the second to solve the problems that remained from it. It has been specified that the algorithms must be documented in a clear, lucid way since the development will be taken over by others in the future. The result is two algorithms: one clear and structured “bare-bones” algorithm that allows modifications to be made in a modular manner, a second where algorithm components have been replaced, making the algorithm less sensitive to numerical problems. An alternative control law has been proposed, in this work called the independent gradient method (IGM). The method has some advantages to the original control law: it can extract information from ill-conditioned Jacobians and (in some specific situations) find solutions with smaller remaining than the original control law. Another contribution is a simulation framework in Matlab in which different controllers, functions and sensor models can be tested. The most important conclusions are that problems due to singular Jacobians can be overcome with a simple variation of the algorithm. The problem with remaining error is more complex. It can be due to non-monotonicity in output functions, but also due to the relationship between reference points (set points). With monotonic outputs, the Adaptive gradient control algorithm converges to a point with minimal error as long as the optimal solution does not require any input to saturate, and as long as the outputs aren’t perfectly correlated.

Page 4: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

ii

Acknowledgements This thesis work was conducted in the Corporate Technology department of Bühler AG in Uzwil, Switzerland, during the winter of 2006-2007. The CT department had a supporting and friendly atmosphere, and literally everyone there contributed to making my stay enjoyable and interesting. I would like to thank my supervisor Andreas Kuhn for his time, support and sharing of knowledge. The initial support from Dr. Mukul Agarwal was extremely helpful and I would like to thank him for all the great discussions. I also direct my sincere appreciation to Ramona Bischof for the fantastic reception and all the help throughout the stay. Finally I would like to thank my examiner Prof. Jonas Sjöberg for giving me the opportunity to go to Switzerland. That event gave a new, unexpected and exciting direction to my life.

Page 5: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge
Page 6: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge
Page 7: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

1

1 Introduction The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge of the operation of the mill is the head miller, who needs years of training and experience to correctly handle the various processing machines into producing high-quality flour with highest possible yield. Wheat grains arrive at the plant mixed with foreign matter: straw, wood, stones and so forth; and passes about 40 processing stages during its transformation into flour. After the undesired matter is sorted out the and after cleaning and preconditioning the wheat (soaking in water in order to increase moisture content) it is ready for grinding, the central operation of milling. Grinding is normally done with roller pairs, large steel cylinders rotating in parallel with a small separating gap. Their purpose is to, by means of pressure force and shearing forces, break and separate the incoming particles. Each roller pair has a certain role in the wheat transformation process from kernel to flour. The first sets of roller pairs are corrugated and has primarily a separating role (ripping the enveloping starch layer from the germ and protein core, and separating the germ from the protein core) while the subsequential rollers are smooth, and reduce particles into smaller sizes. A normal milling facility consists of dozens of roller pairs, not working in parallel but rather in a branching system where particles are grinded, then sorted (mainly by size, an operation carried out by huge sieves) and then channelled further on to new roller pairs until desired properties of the wheat have been reached. All of these and many other machines must be tuned and supervised in order to make the milling plant yield as much flour as possible, with highest possible quality. The rollers have a number of parameters to set, for example their gap width, rotational speed and difference in speed, these are together called roller machine input. Today, normally only gap width is tuned while running the process. The tuning is done roughly as follows: the head miller reaches under the rollers and grabs a handful of the grinded product, evaluates the quality of the product in terms of particle sizes, colour, or any other information that his intuition takes into account, and changes the gap width manually if the product isn’t satisfactory. It has been visioned for the future that this tuning is done automatically by a controller, receiving numerical information from a sensor about various qualities of the grinded product, called the system output. It is also imagined that the controller will have more input parameters than just gap width to adjust. Needless to say, replacing manual tuning with a reliable controller would release the head miller from a time-consuming work load and thus contribute to higher productivity. This thesis work is a step toward that aim, and will deal with the development of the controller algorithm, i.e. the controller software that based on the sensor information tunes the roller pair into yielding an output at given reference values, so-called set points.

1.1 Problem statement Develop a controller that can tune the input parameters of a roller pair with multiple input parameters and multiple output qualities. Assume that a controller exists that can deliver numerical information about the quality of the grinded wheat. The controller must not be model based but make tuning based on available information.

Page 8: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

2

1.2 Previous work There have already been efforts to design a controller in a preceding thesis work. The main contribution was to recognize and test a possible candidate for the controller algorithm. The algorithm, called Adaptive gradient control, was evaluated on rough models of the system based on data collected earlier from an actual milling plant. The experience from that thesis work has been transferred through discussion and demonstrations in simulations in Matlab’s Simulink. The conclusion was that the algorithm is a promising candidate for solving the problem, but some general problems were identified: numerical issues when performing a matrix inversion, making the controller highly noise sensitive; tumultuous behaviour after convergence (possibly caused by the numerical difficulties); and lastly the occasional convergence to suboptimal solutions.

1.3 Goal with this thesis The main objective of this thesis is to continue the evaluation of the algorithm Adaptive gradient control, and to find the optimal algorithm structure and components. The intention is not to optimize the performance of the controller by means of fine tuning variables. Two goals have been set: implement the Adaptive gradient control algorithm in clear, comprehensible Matlab code, and secondly improve it to handle the problems experienced in the preceding thesis work. It has been specified that the resulting algorithms should be documented thoroughly and clearly in order to allow others to continue the work of developing a controller. The implementations must themselves be clearly written and must not contain complex Matlab commands.

1.4 Contributions The present assumptions about the system have been listed and discussed, giving an overview of the problem. Through an analysis, inherent problems of the Adaptive gradient control algorithm have been recognized and some possible solutions suggested, including a survey of methods found in literature. An idea for a new control law has been presented, with the advantage that it is less sensitive to the numerical problems observed in the preceding thesis work, and also finds solutions with smaller global error than the established methods in some situations. However, the method needs improvements before being reliable. In addition to the robustification of the algorithm, a simulation framework has been developed that allows for testing controllers and sensor/system models.

1.5 Report outline As a foundation for the algorithm, the assumptions about the system and the given controller specification is presented in chapter 2. In the following chapter, the Adaptive gradient algorithm is explained in detail and a first bare-bones realization of the algorithm is implemented. In chapter 4 problems are analysed and structured to show their different sources. The different alternatives for algorithm components are listed, discussed and the experimentally tested. In chapter 5 the implementation based on that experience is presented, with some experiments from chapter 4 repeated to compare performance. In chapter 6, the experience gained from the work is summarized and suggestions for future work are given.

Page 9: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

3

2 System modelling and controller specification In order to design a controller, it is necessary to understand what properties the system a wheat roller pair has. The questions to answer to understand the process are: what type of influence do the roller parameters have on the qualities of the grinded product? What is the character of the disturbances in the system? How much measurement noise does the sensor have? It has until recently never been attempted to model the grinding process - two thesis works at Bühler AG ([1] and [2]) have been dedicated to answering the problem, giving some insights in how parameters influence the qualities of the grinded product. But making models that could predict exactly what quality a certain wheat would have depending on the roller parameters is generally considered an impossible task, especially due to the enormous complexity that wheat shows - about 1500 sorts of wheat are used for consumption around the world, all having their own size, hardness, moisture content, chemical composition and so forth. (More information on the biology of wheat and the trade of milling is found in for example [Wheat_flour_milling].) The approach to overcome this is to state the properties of the system and translate them into a certain class of functions, and then use a controller that can deal with the properties of these functions. When the system can be described mathematically, it will also be possible to evaluate controller algorithms through simulation. The following section is used for a formalization of the problem. New terminology will show up through the chapter, the basics will be presented already. First of all, the term system will refer to any roller pair. The input parameters to the roller pair, such as the gap width, will simply be called input of the system, and denoted u. The qualities of the grinded product to be controlled are called the output of the system, and denoted with y. If there are several input parameters and several outputs to consider, the system is called a called a MIMO system (for multiple inputs and multiple outputs). The system will be called an mn ! -system if it has n outputs and m inputs. The controller algorithm will receive a set point and the information from the sensor and make a decision how to alter the input in order to reach the given set point. So far, the concept of output has been very fuzzy. What are the desired qualities of the finished product? The answer is complicated and not fully known, or at least not possible to make explicit - the head miller builds up an intuitive understanding of the process. For smooth rollers, particle size is of prime importance, but in general it cannot be excluded that local (individual roller pair) control is based on global (the entire milling process) properties. The way the sensor will deliver data about the grinded wheat particles deserves a minute of attention. First of all, it is important to know that grinded particles are fractioned into particles of sizes continuously distributed, a typical range for wheat would be between 5 and 500 µm. In the same way that sieves sort particles according to size, the sensor will deliver information about groups or bins of particle sizes. Data could hypothetically include how many percent of the total mass flow each bin houses and how many percent of the mass each bin is constituted of minerals or proteins. Outputs have not yet been defined but they will most likely be some type of combination of the data mentioned above.

Page 10: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

4

2.1 The grinding process properties

2.1.1 Input-output relationship

Basic assumptions In this work, it will be assumed that the relationship between input and output is static with respect to sampling time of the sensor (specified to 2 minutes), meaning that any change made will have an immediate response followed by “equilibrium” or stability in the product properties. Another important assumption is that the output varies without “discrete changes” as inputs change. This is true only within a certain range of the parameters. For example, as the gap between smooth rollers is reduced to a certain limit, a phenomenon known as floating may suddenly occur. The roller gap becomes so narrow that fine particles refuse to enter it - meaning there will be a discrete change in particle mass percentage in the bins. But these behaviours are never exploited by the head miller – a more narrow range of operation is used, and so it must be assured that the controller does as well. This is further discussed later in this section under constraints. The assumptions above allow the relationships to be modelled with smooth, continuous (differentiable) functions:

)(ufy = (1)

Please refer to appendix C for a brief repetition of necessary elements from calculus. System dimension In the previous section it was said that several parameters and several product qualities will be considered in the process, meaning that y and u very well may be vectors and f a vector of functions. The equation above is then a compact notation of

),...,(

),...,(

1

111

mnn

m

uufy

uufy

=

=

M

where n denotes the number of outputs and m the number of inputs. The system is called an

mn ! system. It has been assumed since the preceding thesis work that a realistic system dimension is 22 ! . Constraints

Due to mechanical and operational limits, each input iu has an upper and lower bound which

will be called max,iu and min,iu , respectively. There is also a mechanical limit to how small the

changes in respective output can be; call the limit in the i:th input min,idu . These constraints

will of course be respected in the controller development, but as already stated the controller will operate on normalized values. The complexity of the functions

Page 11: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

5

The topology of the function “landscapes” is today not fully known. Informal discussions with experts indicate that the surfaces can’t be very complex - but whether they are always monotonic (as defined in appendix C) or not is not agreed upon. What makes the question difficult to answer is not only the large difference in jargon between milling and control theory, but also the fact that in milling today mostly only one parameter, the gap width, is changed during the process. The approach in this thesis is to assume a worst case scenario, which is agreed to be that maximally one extreme point exists in each output function. As already mentioned, two thesis works have been dedicated to modelling some of the relationships between various wheat qualities and roller parameter settings. The modelling has been made with 2k factorial design experiments, where each independent variable is tried for three different values. For three points, maximally a second-degree polynomial model can be fitted; meaning that for the discussion about surface complexity, the best information that can be gained from these experiments is whether there are extreme points or not. The data gained from the experiments indicate that extreme points do exist. However, the experiments dealt with individual qualities from individual particle size bins - while practical outputs rather would be taken accumulatively, and perhaps as a weighing of qualities as suggested previously.

2.2 Set points The set point is a list of reference values for each output. It is given as a vector of size 1!m and denoted r . As described in appendix C, functions may be represented with their surfaces above the input domain or as a set of contour lines on the input domain. Set points will in the same representation appear as planes, or as one single contour line. Please refer to figure 2-1. The set point contours appear as thick, coloured lines on the input domain. This illustrates the fact that for a system of two inputs, there is not a specific point but infinitely many pairs of input values that brings the particular output to the respective set point. Now, with two outputs (see figure 2-1), merge the set point contours to lie on the u-domain together. Since it is desired to bring each output to its corresponding set point, the controller will hopefully strive to find an input parameter pair where the contour lines intersect. The point on the input domain on which the controller ends up is called the convergence point.

Page 12: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

6

Figure 2-1: Set point contours generated and plotted together on the u-domain. The intersections of the contour

lines of the set points graphically marks the pair of input values where both outputs are at their respective reference values.

2.3 Measurement error The sensor measurement is buried in white noise, specified to have a standard deviation of 1% of the output range. The number was given by Dario Pierri at the CT department of Bühler AG.

2.4 Disturbances If the system was left running without tuning the gap width or other input parameters, the output would ideally be constant. In reality, the output will fluctuate due for example changes made earlier in the process chain or variations in the wheat batch. These fluctuations are called called disturbances. The nature of the disturbances have not been investigated yet, the assumptions that have been made are that disturbances occur in scarce, discrete steps rather than continuously. They will therefore be modelled as sudden changes of the output functions.

2.5 Controller specification A number of desired properties of the controller has been given (by Andreas Kuhn at the CT department of Bühler AG) and are listed below. A discussion will follow to clarify the terms and the approach in this thesis work.

Page 13: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

7

1. It should operate as the head miller would do 2. It mustn’t be model based 3. It is as generic as possible, i.e. applicable to any mill passage 4. It is autonomous/user independent: Requires a minimum of user input 5. It handles various types of commands (set points, minimize/maximize) 6. It handles 22 ! , possibly 33! systems 7. It handles both monotonous and non-monotonous functions 8. It respects upper and lower limits of the parameters and in the magnitude of change of

the parameters 9. It handles sensor noise, disturbances and unknown influences 10. It is robust 11. It is fast 12. It shows little oscillation around, and divergence from the convergence point

2.5.1 Comments on the specifications

Specification 1 means that the operator of the milling plant should feel that the tuning is made in an “intuitive way”, with logical changes in parameter settings. Number 3 is taken care of since the assumptions in this chapter have been made without making a difference between mill passages. About specification 5 and 6, in this thesis work only set point commands will be dealt with, and systems of dimension 22 ! (although the final controller is designed for arbitrary dimensions). The difficulty with non-monotonic functions is not solved but discussed in section 4.1 and chapter Fehler! Verweisquelle konnte nicht gefunden werden.. The last three specifications require some type of metrics in order to be objectively evaluated. The ones used in this thesis work are presented in the following subsection. In specification 12, the term divergence refers to a behaviour observed in the simulations from the preceding thesis work, where the controller was observed to suddenly diverge from its convergence point during some samples.

2.5.2 Metrics

In this thesis work, the central quality of performance will be the global error:

( )∑∑==

"==n

i

ii

n

i

i tyrn

ten

tE1

2

1

2 )(1

)(1

)( (2)

n is the number of outputs. Since all functions are normalized, E can maximally be 1.

The convergence time ct will be measured as illustrated in figure 2-2, it is the sample time

where E is below a threshold (0.05). This will fail in the case that the controller finds a suboptimal solution and will be used carefully. Robustness is the most difficult quality to measure. The crudest metric in this work deals with failures. After large disturbances the algorithm may fail to recover the set point, which results in a permanent saturation in all inputs. Reliability in the event of disturbances is measured as

Page 14: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

8

percentage of failed runs (repeated simulations), repeated in one simulation setup (same initial value, set point and function model but different seeds for the random number generator).

Other robustness qualities is mean value and standard deviation of E after ct , and shows how

well the controller finds the set point and maintains its convergence point. The latter quality is connected to specification 12 in section 2.5.

10 20 30 40 50 60 700

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

time (number of samples)

E

Convergence event

Figure 2-2: Global error E and the event of convergence

Page 15: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

9

3 Adaptive gradient control. A bare-bones implementation Adaptive gradient control will here be explained in detail, followed by the description of an implementation using the same core procedures as in the preceding thesis work. In the last section some simulation examples with the implementation are given. As specified, the algorithm is implemented in the simplest and most lucid manner possible. It will be referred to as the bare-bones implementation, since it has been stripped of anything that makes it more complex than necessary. The implementation is written in Matlab code, but excluded due to secrecy requirements. The details of the bare-bones implementation are found in appendix A and the simulation framework is described in appendix B.

3.1 Adaptive gradient control Adaptive gradient control is a model-independent, intuitively appealing and highly generic algorithm, which is a promising first observation in the aim of satisfying the controller specification. It requires in turn that the functions to be controlled be continuous and smooth, which in our case is a basic assumption. The algorithm is in fact a realization of the Broyden method, a generalization of the secant method. The secant method is in turn a variant of Newton-Raphson algorithm for finding function roots, but with estimated instead of analytical gradients. The three methods are found in the area of numerical methods in mathematics, see e.g. [10]. In control theory literature, Adaptive gradient control is found under several names, the most established is probably run-to-run control ([6] and [7]). The basic principle of the algorithm is to minimize or “find the root of” the output error r-y. It is done by estimating the gradients (or equivalently the tangent planes) of the output functions and use them as linear approximations of the functions. Please refer to appendix C for a brief repetition of these concepts. Based on this linear approximation, the controller calculates the optimal change in input to minimize the output error. As for the specification “operate as the miller would”, this is really an intuitive way of reaching the desired operating point1.

3.1.1 The mathematical groundwork

Regard equation 1 on page 6. For a certain neighbourhood around the current point

( ) ( )( )tytu , , approximate the function with its tangent plane through this point:

⇒#+=#+$+=+ duJtyduJtufdutufty )())(())(()1(

( ) ( )tudJtdy #= (3)

1 Making a step based on our approximate knowledge of the system is a typical way of controlling systems in everyday life. Imagine making scrambled eggs in a frying pan on a stove where the power knob is graded from zero to ten. We know that increasing the power will increase the heat. We also know that turning the knob one notch won’t be enough - seven would be a better guess. A while after making the change, we will realize if we set too much or too little power and can make gradual adjustment. In controlling terms, we have rough knowledge of the gradient of the function “power knob to frying pan temperature”, and make a gradient search in order to find the optimal temperature.

Page 16: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

10

where

)()1(

)()1(

tutudu

tytydy

"+=

"+=

and J is the matrix of partial derivatives (called the Jacobian) of the output functions in the current point, where each row contains the gradient of the corresponding output function. Please refer to appendix C for more details concerning the Jacobian.

For a mn ! system the vectors ( )tdy and ( )tud are as ( )tu and ( )ty column vectors of size

1!m and 1!n , respectively. The set of equations will in matrix notation have the form:

rowsmduJdyrowsn

columnsm

#

=

444 3444 21

J is the true Jacobian of the output functions. The controller algorithm will record past and

present points to make an estimation J of the Jacobian. The method with which it estimates the Jacobian is called the adaptation law, since it makes an adaptation to the current point. The method with which the controller calculates the optimal step to minimize the error is called the control law. In conclusion, the algorithm will consist of two principal procedures:

1. Adaptation law – estimating the function gradients 2. Control law – finding the optimal step towards the solution

These two central steps are closer described in the following subsections.

3.1.2 The adaptation law

For the bare-bones algorithm implementation, the control law will be the same as in the preceding thesis work, where the Jacobian was calculated as a least squares estimator. With this method, the controller performs linear fitting on a set of recorded points. The controller records previous points and transforms them into a list of differences with the current one. Name these lists y% and u% :

[ ][ ]...)()2()()1(

...)()2()()1(

tutututuu

tytytytyy

""""=%

""""=%

With 1+L recorded points including the present one, the lists of differences above will have the dimension Ln ! and Lm ! , respectively. Even if the material flow through the system is completely free from disturbances, the relationship between the points will still not be

Page 17: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

11

perfectly linear due to noise and non-linearity in the functions - it is necessary to perform linear fitting. The method below is well explained in [9]. Formulate the problem as a set of linear equations:

( ) ( ) errortuJty +%#=%

Now the matrix J will be chosen that solves the equations optimally in the sense that it minimizes the sum of the squared errors.

( ) 1ˆ "%#%#%#%= TT uuuyJ (4)

Where the superscript T denotes matrix transpose. The term ( ) 1"%#%#% TT uuu is the

pseudoinverse of u% , see details in e.g. [10]. If u% were square, so that mL = , the equation would simplify into:

( ) 111ˆ """%#%=%#%#%#%= uyuuuyJ TT

In other words, normal matrix inversion is used.

J calculated this way is called the least squares estimator. L must be at least as great as m in order to compute this, meaning the controller needs to collect at least 1+m points before it

can calculate the first J . By gathering more points than 1+m , the contribution from the sensor can be reduced to improve the quality of the estimation - this is in other words a place where noise filtering is done.

3.1.3 The control law

In figure 3-1 the idea of the control law is illustrated for the 1x1-case. J corresponds to the

estimated slant of the curve. The error e is defined as yre "= and so duJe #= ˆ ,

corresponding to the triangle in the middle graph of figure 3-1.

u(t)

r

y(t)

u

y

u(t)

r

y(t)

u

y

u(t) u(t+1)

r

y(t)

y(t+1)

u

y

estimatedgradient

true gradient

f(u)

error

du

Figure 3-1: The control law principle

The optimal change in input is given by the control law:

Page 18: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

12

eJdu #= "1ˆ (5)

If J isn’t square, the pseudoinverse of J must be calculated.

3.2 The controller The two algorithm parts described in the last section are the main constituents of the control loop, but there are a few more details that must be considered before implementation. At initiation, not enough points exist to construct a Jacobian, so a random matrix will be used to take initial steps. Also, the step du must go through a procedure that makes sure that du respects the constraints described in section 2.1.1. Please refer to Appendix A for details concerning this procedure. Another critical procedure is normalization. In the real system implementation it is of course crucial that a normalization procedure keeps all variables in respective ranges in order to keep a fair weighing of outputs. The simulation framework produced during this work will assume that all inputs vary between -1 and 1, and that all output functions are normalized so that all outputs range between 0 and 1 on the limited u-domain.

3.2.1 Implementation approach

The goal with realizing the controller is to keep the code as clear and simple as possible, and also keep it modular so that elements easily can be replaced. Modularity is obtained in the following manner: the logical steps of calculation are isolated from one another between “checkpoints”. Any type of code is allowed between them, as long as it guarantees to deliver what is needed at the following checkpoint. The idea is illustrated in fig. A-1 in appendix A. The checkpoint skeleton makes it easy to evaluate the various methods presented in the sub sequential chapter where improvements are suggested.

At this point, no consideration is given the adjustable parameters, step length maxdu and the

maximal length L of the lists u% and y% .

3.2.2 Demonstration of the bare-bones implementation

For demonstrating how the algorithm does, some functions and set points are picked that

shows typical runs. maxdu is set to 0.2.

Example 1: Set point change with simple solutions Setup: see figure 3-2. The functions as almost linear, as the contours indicate, and almost uncorrelated (perfectly correlated outputs would have perpendicular contour curves). The action of the simulation is: at t = 1 the system is initiated and the controller converges to the first set point (figure 3-2 a). At t = 75 the set point is changed and the controller converges in a straight path (figure 3-2 b).

Page 19: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

13

-1 1-1

1

u1

u2

time from init. to 75 samples

-1 1-1

1

u1

u2

time past 75 samples

50 100 1500

0.2

0.4

0.6

0.8

1

time (nr of samples)

EEEE

controller path

Figure 3-2: Convergence path in simple situation.

Example 2: Set point change with complicated situation Setup: see figure 3-3. The outputs have a high degree of correlation, especially at the second set point (t > 75). The convergence path is far from straight and the controller initially settles for a suboptimal solution (time between 2 and 10 samples). Note that the set point contours intersect each other with a small angle at the first set point, and not at all for the second set point.

Figure 3-3: Poor convergence due to complicated set point relationships

3.2.3 Conclusions

Example 1 is meant to show that that the controller can make the output converge to the set point in “simple” situations, as demonstrated in the preceding thesis work. In example 2, however, the situation is more complex with more correlated outputs and even conflicting set points at the solution, and the controller initially settles to suboptimal solutions. In example 1 something interesting can be noted: the convergence time depends on the distance on the u-domain between the starting and ending point at a set point change. In dynamical systems convergence time is related to the system time constants. In the static case,

the maximal step maxdu sets an upper pace (parameter units per sample) by which the

controller can progress over the parameter space.

Page 20: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

14

4 Improvements of the bare-bones implementation As seen in the previous chapter, the bare-bones implementation of the adaptive gradient control algorithm consists of several components (subprocedures) independent of each other. In this chapter, the goals are to:

• Find the underlying reasons of the problems seen in the preceding thesis work • Find alternatives for algorithm components that may enhance the performance of the

controller

• Evaluate the chosen components experimentally The following section contains a lot of detail, the important points are summarized in subsection 4.1.5.

4.1 Identifying problem sources The two problems that are faced are singularity in the Jacobian estimate, and remaining global error after convergence. It will turn out that the problems partly have their root in the relationship between set points, so there’s a good place to start.

4.1.1 Set point relationships

In the preceding chapters set points have been viewed by plotting their contour levels on the u-domain. Assuming that set points are chosen so that they can be reached on the limited u-domain, there are two important scenarios: Either they intersect each other or they don’t. Some possible situations are shown in figure 4-1.

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

a b

c d

optimal solution locus

Figure 4-1: Different types of set point relationships on the u-domain for a 2x2-system, and the corresponding

optimal solution (values of u1 and u2 that minimizes the global error E)

Page 21: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

15

So depending on set point value, there are situations1 where the controller needs to compromise. They are in the latter case said to be in conflict, otherwise in agreement. For set points in conflict, the situation has two types of compromising solutions: either an output is saturated or not (graphically, the optimal solution is either on or off the limit of u), as seen in figure 4-1 c and d.

4.1.2 Remaining global error

Global error was defined with equation 2, page 9. The first reason for remaining global error is in other words: for some set points there is no point within the boundaries of u where E = 0. But there is always one or several points where E is minimized. The question is: does the Adaptive gradient algorithm always find such a point? Simulation results from the preceding thesis work show that it doesn’t. With non-monotonic outputs as in figure 4-2, the controller gets stuck on suboptimal solutions for some initial values.

-1 1-1

1

u1

u2

optimal solution

deadlock

Figure 4-2: A suboptimal solution found due to non-monotonic output. The circle marks the convergence point

and the coloured arrows the respective function gradient at that point.

The last reason for remaining global error is illustrated in figure 4-3.

1 It seems reasonable that solutions often will be in conflict. Even if the upper and lower limits of the respective outputs are known, without any system model it is in fact completely random whether the set points chosen lead to an optimal solution with zero error or not.

Page 22: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

16

-1 1-1

1

u1

u2

Controllaw du

Controllaw du after projection

Figure 4-3: The convergence point of the original control law is in this case the projection of the contour

intersection onto the saturated input, leading the controller to convergence point with a global error larger than the optimal.

This is an effect of the method of limiting the step du - all steps directed outside the u-boundary are projected onto the saturated output.

4.1.3 Singular Jacobians

First of all, remember from linear algebra that singularity in a matrix implies linearly dependent rows and columns, meaning that the rank of the matrix is lower than its vector dimension. Another important fact is that multiplying a linearly dependent matrix with any other matrix yields another linearly dependent matrix. With this in mind, regard the central equation 3 and the adaptation law in equation 4. Now, if

y% or u% aren’t of full rank, neither will J be. u% must span the entire input space,

otherwise full information about the gradients have not been gained.

y% is constructed from the records of output samples as described in section The adaptation

law3.1.2. If y% is singular, it is because of the function surfaces. The most obvious one is

when an entire row in J is the null vector - an extreme point is found in the output corresponding to the row index.

It could also be the case that the rows of J are linearly dependent, meaning that the functions are correlated. There are two reasons for this to happen. First of all, the wheat qualities can have a large degree of interdependence. The second reason is less obvious, but can be

Page 23: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

17

understood after a closer look on the situation in figure 4-4. Here, the set points are in conflict and the smallest global error is found where the distance between them is minimized. Unfortunately, this point is by definition also where the respective function gradients are parallel. This means that with conflicting set points where the smallest E is between all input boundaries (as in figure 4-1 c), the Jacobian is by definition singular at the optimal solution.

-1 1-1

1

u1

u2

respectivefunctiongradient

Figure 4-4: The gradients at the optimal solution locus are by definition parallel, causing the Jacobian to be

singular

4.1.4 Higher dimensions in inputs and outputs

If the number of inputs are larger than 2, it is difficult to discuss the problems in the same geometrical fashion as above. It will here simply be stated that the total number of possible set point relationships increase, but the most important results from the discussions above still hold. The problem with singularity at the optimal solution between conflicting set points shows only up when there are two outputs, independent of the number of inputs. For higher dimensions than 2, the gradients will not necessarily be parallel where E is minimized.

4.1.5 Section summary and conclusions

The problems with singular Jacobian estimates and remaining global error was shown to have three different sources. The situation is mapped in figure 4-5.

Page 24: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

18

Figure 4-5: Flow chart summarizing causes of the problems noted with the Adaptive gradient algorithm

The three reasons have very different sources themselves:

• It is up to the controller to pick a step du that isn’t linearly dependent with the previous list of du ’s.

• The output functions must be defined by the operator or plant designer • The set point relationship isn’t possible to control without a model of the system.

4.2 Alternative algorithm components In the following two subsections alternatives to the adaptation law and the control law found in the litterature are reviewed. More details on each method can be found in respective reference. In this section they are merely listed and in the sub sequent section the candidates are compared in experiments.

4.2.1 Adaptation laws in literature

The least squares estimator, where all points are used in one calculation, is presented in section 3.1.2, equation 4. The more general variant of this is the Weighted least-squares estimation:

( ) 1ˆ "%##%#%##%= TT uWuuWyJ

J singular Remaining global error

dy singular du singular

Poorly chosen du’s

Correlated output

Non-monotonic output

Poorly chosen outputs

Set points in conflict

Suboptimal solution

(Locus with lower E exists)

Set point relationship

Lowest E on u

boundary

Problem:

Underlying reason:

Page 25: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

19

W is a diagonal matrix with individual weights for the points. The weights are related to the “value” of the points: statistical variance of the samples, the degree of non-linearity in the functions, the amount of change of the functions (disturbances or time dependence because of mechanical drift or similar reasons). The weighted least squares estimation was tested in the preceding thesis work but rejected, which makes sense: the type of knowledge that is meant to be incorporated by applying weights simply isn’t available. More about regression analysis can for example be found in [9]. In the preceding chapter it was pointed out that the control algorithm is an implementation of the Broyden method. In mathematical applications, the “adaptation law” or Jacobian estimation is normally iterative:

dudu

dudukJdykJkJ

T

T

#

##"+=+

))(ˆ()(ˆ)1(ˆ

Observe that du is the column vector of the last step taken, as opposed to the entire list of du 's ( u% ) in the least squares estimation. In control and other practical applications, points are sampled one at a time and therefore iterative methods are more commonly used (in fact, in the reviewed literature [4 - 7] the least squares estimator is never used). The adaptation law usually comes with a positive constant added that can influence the step size. In for example neural networks it is known as the Widrow-Hoff rule (or delta rule), and in signal processing the least mean squares (LMS) algorithm:

( )dudu

dudutJdytJtJ

T

T

#

##"#+=+

)(ˆ)(ˆ)1(ˆ & (6)

& is termed step size or learning rate and is in [4] recommended to be between 0 and 2. Lastly, recursive methods are often used in linear fitting (an example is from signal processing, for adjusting coefficients of adaptive filters). The recursive method found in static control (from [4] and [5]) is a modified version of Kalman filtering. It is an elaborate scheme, giving much freedom in terms of parameters to tune, but is here ruled out as demanding too much tuning and prior system knowledge.

4.2.2 Control laws in literature

In general there is not much said about the control law in the litterature - but one method is practically standard, namely regularization. It is a simple method for avoiding numerical difficulties at the matrix inversion. The idea is to distort the information contents by adding a matrix I' , where ' is a small positive constant and I is the identity matrix of compatible

form:

( ) eIJJJdu T ##+="1ˆˆˆ ' if nm ( and

( ) eJIJJdu T ###+=" ˆˆˆ 1

' if nm < . (7)

In optimization this method is known as the Levenberg-Marquardt method, see for example [numerical methods]. It will through this work be referred to by this name.

Page 26: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

20

In [4] a stability analysis is made of the Adaptive gradient algorithm, with the conclusion that the algorithm in fact can show oscillating or unstable behaviour. Therefore, a gain term g is

added to the equation above:

eIJJJgdu TT #+#= "1)ˆˆ(ˆ ' and correspondingly to the second equation. g is recommended to be slightly less than 1.

4.2.3 An alternative control law

A control law algorithm will here be proposed that most illustratively can be called the

independent gradient method (IGM). It exploits the fact that as long as the list u% is of full rank, the Jacobian has full information about the local gradients even if it the Jacobian is singular. The idea is as follows: Instead of calculating the inverse of the entire matrix, calculate the pseudoinverse of each function gradient and find the du suggested by them by multiplication with the respective output error. Then let the final step du be the average of these individual contributions.

( )∑∑=

"

=

###==n

i

i

T

i

T

i

n

i

i eJJJn

dun

du1

1

1

ˆˆˆ11

Where iJ denotes the i:th row of the Jacobian estimate (the gradient of the i:th output) and ie

the corresponding error. iJ must not be precisely the null vector.

For details concerning the mathematical difference between IGM and the “original” control law (equation 5), please refer to appendix D.

4.3 Evaluating the component alternatives The candidates for the adaptation law are the Widrow-Hoff rule (equation 6) and the Least squares estimator (equation 4), and for control law the modified Levenberg-Marquardt method (equation 7), the Independent gradient method as given above, and the original control law (equation 5). The alternatives will be compared with each other in simulation, with the intention to build an understanding for how the respective methods perform. The

intention is not to trim parameters such as maxdu or the length of the list u% to make the

controller perform optimally.

4.3.1 Method

For evaluation, the central properties to regard are how the controller acts after initiation (or reset), after a change in set point, and at the event of a disturbance. The action of the controller after any of these three events can be divided into two parts: the convergence phase before reaching the solution (convergence point), and the time afterwards. For convergence, it is required to reach the convergence point as fast as possible without numerical difficulties (which would cause random steps), and after convergence it is required to maintain the found point with minimal movement. The metrics that will be used are described in section 2.5.2.

Page 27: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

21

4.3.2 Simulation

As a basis for evaluation, seven benchmark simulation setups of 22 ! systems are selected that reflect the various types of set point relationships that can exist. The individual setups are further described in appendix E. In the experiments, they are referred to as simulation #1, #2 etc. The output functions are modelled with full second-degree polynomials with weak cross- and square terms, giving them nonlinear but strictly non-monotonic character. The polynomials

are normalized to range between 0 and 1 between the limits of u ( [ ]1,1" for all u ’s). Second-

degree polynomials are chosen because it captures the essence of what was discussed in section 2.1.1, concluding that if there are any extreme points, there are certainly no more than one per output.

4.3.3 The adaptation laws

In the following sets of experiments, the performance of the adaptation laws is compared. The Widrow-Hoff method is tested for several alphas in order to gain insight in what this parameter does. In the Levenberg-Marquard method, ' = 0.03 and g = 0.95.

Experiment 1: Initiation Using simulation #1, the adaptation laws are tested 100 times each and the convergence time after initiation (t = 1) is recorded. The control law from the bare-bones algorithm is used, and

maxdu is set to 0.2. The results are presented in table 4-1 as mean convergence time and

standard deviation of ct .

Table 4-1

A.Law WH, 4.0=& WH, 7.0=& WH, 0.1=& WH, 3.1=& WH, 6.1=& LS

T_m 6.1 6.1 6.1 6.7 7.35 6.5 Std_dev 0.32 0.34 0.43 0.87 1.1 0.79 The results indicate that there is a set of alphas for which the Widrow-Hoff method works faster than the least squares estimator, and with higher reliability since the times are less scattered. Observe that if the degree of non-linearity changed in the functions, that set of alphas would probably be different. The results may be an effect of the fact that Widrow-Hoff uses the samples from the first call, while the least squares estimator doesn’t make use of the m-1 first points (in this case m-1 = 1). Experiment 2: Set point change The same setup is used as in experiment 1, but this time observing the convergence after the

set point change at t = 75. The resulting mean ct and standard deviation are found in table

4-2. Table 4-2

A.Law WH, α = 0.4 WH, 7.0=& WH, 0.1=& WH, 3.1=& WH, 6.1=& LS

T_m 11.5 11.03 12.25 13.9 16.4 11.05 Std_dev 6.51 2.31 2.95 4.4 5.53 1.14

Page 28: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

22

Notice that ct of the least squares estimator was both lower and less scattered than the ct of

the Widrow-Hoff rule (mean ct for 7.0=& is practically identical). This confirms that & has

no clear optimal value. Experiment 3: disturbance Benchmark simulation #7 is used. The percentage of failed recoveries after the disturbance is

counted for 1000 runs. In this experiment, two different maxdu are used, 0.2 and 0.4. The

respective results are found in table 4-3 and table 4-4, and illustrated in figure 4-6.

Table 4-3. maxdu = 0.2

A.Law WH, 4.0=& WH, 7.0=& WH, 0.1=& WH, 3.1=& WH, 6.1=& LS Est.

Nr of failures, % of runs

30.6 16.7 10.5 8.7 10.8 0.5

Table 4-4. maxdu = 0.4

A.Law WH, 4.0=& WH, 7.0=& WH, 0.1=& WH, 3.1=& WH, 6.1=& LS Est.

Nr of failures, % of runs

54.1 28.2 9.1 3.7 9.2 0.2

30,6

54,1

16,7

28,2

10,59,1 8,7

3,7

10,89,2

0,50,2

0

10

20

30

40

50

60

α = 0.4 α = 0.7 α = 1.0 α = 1.3 α = 1.6 LSE

dumax = 0.2

dumax = 0.4

Figure 4-6: Percentage failed recoveries after disturbance. Widrow-Hoff with various alphas and least-squares

estimation

This result was surprising: a step disturbance is so similar to the initiation procedure (random Jacobian estimate, random initial point) that the Widrow-Hoff rule could be expected to perform better that the LS estimator, as in experiment 1. But the Widrow-Hoff rule fails relatively often, while the least squares estimator shows much higher degree of robustness.

Page 29: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

23

4.3.4 The control laws

In the control law experiments, the least-squares estimator is used for adaptation law. Experiment 4: Convergence after set point change

Benchmark simulation #1 is used. For two different maxdu , 0.2 and 0.4, let each control law be

tested 50 times and record ct after the set point change. It is also recorded how many times E

never reached below the threshold. The results are seen in the following two tables.

Table 4-5: maxdu = 0.2

Control law Original LM IGM

ct 10.86 10.80 12.51

Std( ct ) 1.6 1.4 2.4

E > 0.05 0 0 1

Table 4-6. maxdu = 0.4

Control law Original LM IGM

ct 6.4 7 8.5

Std 1.3 1.31 1.9 E > 0.05 0 0 1 As could be expected, the original control law and the Levenberg-Marquardt method are rather similar. IGM has apparently problems with convergence. Experiment 5: Convergence and convergence point for fully correlated output near solution

Using simulation # 3 and #4, maxdu = 0.4, it is attempted to demonstrate how the control laws

behave when the set point contours are perfectly parallel. The resulting convergence path and global error for typical runs in simulation #3 are plotted in figure 4-7 for the three control laws. The large output activity after convergence for the original control law is apparent in the top left figure. The Levenberg-Marquardt method has better convergence than IGM and appears to have no problem keeping the convergence point as well, although IGM does a better job. Notice the odd convergence path of IGM and the corresponding global error: the convergence is so slow that IGM is not suitable for “initial search” behaviour. The standard deviation after convergence was 0.17 for the original control law, 0.13 for the Levenberg-Marquardt method, and 0.08 for IGM.

Page 30: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

24

-1 1-1

1

u1

u2

20 40 600

1

time

EEEE

-1 1-1

1

u1

u2

20 40 600

1

time

EEEE

-1 1-1

1

u1

u2

20 40 600

1

time

EEEE

Figure 4-7: Columns from left:Original, Levenberg -M., and IGM control law convergence path and global

error for extremely correlated output at optimal solution.

The situation in benchmark simulation #4 is very difficult. An entire line could be said to be the optimal locus (not necessarily their average!). Figure 4-8 shows how the three control laws act in the simulation setup.

Page 31: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

25

-1 1-1

1

u1

u2

20 40 600

1

time

EEEE

-1 1-1

1

u1

u2

20 40 600

1

time

EEEE

-1 1-1

1

u1

u2

20 40 600

1

time

EEEE

Figure 4-8: Columns from left: Original, L.-M., and IGM control law convergence paths and global error. The

convergence points have been circled.

Original control law fails to obtain a Jacobian and saturates in inputs. The Levenberg-Marquardt method performs surprisingly well, although the convergence path was much better for IGM. The experiment above had very different outcome from run to run. The control laws didn’t get one specific convergence point, nor a consistent convergence time from one run to another. But these outputs have been picked to be perfectly correlated. In a real application, this would be unfortunate since degree of freedom would have been lost, not just locally at the optimal solution but over the entire u-domain. Experiment 6: Convergence point when solution lies on u-boundary

The setup of the final experiment uses simulation 5, maxdu = 0.3.

Page 32: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

26

-1 1-1

1

u1

u2

20 40 60

0.1235

1

time

EEEE

-1 1-1

1

u1

u2

20 40 60

0.0938

1

time

EEEE

Figure 4-9: Convergence path and global error for L.-M. (left column) and IGM (right column). IGM has a fast

convergence, which could be due to the fact that it by coincidence travels along a set point contour.

It is confirmed that IGM settles for a different convergence point (and one with smaller global error) than Levenberg-Marquardt.

4.3.5 Analysis and experiment conclusions

Regularization works far better than expected, and it should completely replace the original control law. IGM handles highly correlated functions with high reliability and small global error, and finds a better optimum when the solution is located on a u-boundary. However, IGM is apparently not a suitable algorithm for the convergence phase. Notice that LS works fine although nothing has been made to make the list u% less ill-conditioned. In general, the Jacobian estimate had a high condition number both before and after convergence, but this had a smaller impact than expected (see section 4.1.5 above).

Page 33: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

27

5 An improved implementation In this chapter, the conclusions from the last chapter will be discussed in order to motivate the composition of a controller optimal from current knowledge. The conclusion from the last chapter is that even though the iterative Widrow-Hoff method sometimes outperforms the least squares estimator, and even though the former is more frequently used in literature, the latter has much more reliable behaviour and is mostly equally fast, initiation/reset being an exception. For control law, the Levenberg-Marquardt method has a much more reliable performance than expected, and even handles the situations with perfectly parallel gradients (with an extremely ill-conditioned Jacobian estimate) fairly well. IGM was more consequent and stable in those situations but not by orders of magnitude – actually, the Levenberg-Marquardt method is better than IGM even in one of those situations (benchmark simulation number 3). The new controller algorithm will work as follows. For adaptation law, Widrow-Hoff will be used if not enough points are collected to perform least-squares estimation (the 1"m first steps after initiation), and in case it does have enough points (the absolute majority of the time) it will use the least-squares estimator. For control law, only the Levenberg-Marquardt algorithm will be used. In the next chapter, possible future development routes are discussed. In this chapter, it remains to test the performance of the new controller.

5.1 Performance of the improved version Experiments 1 through 3 are repeated with the new algorithm. The results are:

Experiment 1: ct = 6.41, standard deviation 0.77.

Experiment 2: mean = 10.6, standard deviation 1.45

Experiment 3: 0.4% for maxdu = 0.2, 0.2% for maxdu = 0.4

These results hold no surprises. The initiation performance is inherited from the performance of the Widrow-Hoff adaptation law. After initiation only the least-squares estimator works as adaptation law so all properties connected to estimation are inherited from that. So what will the performance of the controller be when implemented in a real system? The algorithm can maintain even the more complex convergence points, and handles strong disturbances very well – it only fails in about 4 out of 1000 times according to the results of experiment 3 above. How will the convergence time be? Actually, there is no way to say without a system model. For a certain distance over the parameter space, an upper pace

( maxdu ) is ensured, but due to non-linearities the controller might take smaller steps so no

lowest pace can be guaranteed.

Page 34: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

28

A Documentation of the controller algorithm The bare-bones implementation and the improved version of the algorithm Adaptive gradient control are here described in detail. The algorithm has some very inefficient steps, but the ambition has been to keep them clear and simple to understand rather than slimmed in computation. The algorithm loop looks as in figure A-1. It relies on receiving normalized values. The controller is implemented as a Matlab function where the initial call is directed to block 0, and sub sequent calls to block 1. The blocks are pointed out in the code with the same enumeration as in figure A-1. In the following sections, each block is described in detail.

Figure A-1: Bare-bones algorithm flowchart

A.1 Initiation The algorithm keeps records of u and y, the lists of records are called us and ys . It also saves

u itself, y and its last estimation of the Jacobian, in the code called J. At initiation, these are

initiated and u is initiated to the middle of the input space (the zero vector). The Jacobian estimate J is initiated to a random matrix with dimensions n x m.

A.2 Merge point How u and the sensor measurement of y are recorded is described in section 3.1.2. The length

of the records us and ys is L and their maximal length maxL . The construction of the lists of

differences, u% and y% , are made my subtracting the current )(tu and )(ty from each

element in the records, but the construction can of course be made in many different ways - most important is to use the same procedure for both lists.

Page 35: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

29

A.3 Adapt The adaptation in the bare-bones implementation is described in detail in section 3.1.2.

A.4 Apply control law The original control law is implemented as described in section 3.1.3. The inversion of J is done in customized_inverse, that performs a pseudoinverse in case the matrix isn’t squared.

A.5 Impose constraints on step As described in section , there are three constraints to fulfil. The resulting procedure is:

1. Cut off du to maxdu if longer (maximal radius)

2. For each element of du: Project onto the i:th limit of u if u+du outside limits 3. For each element of du:

• if smaller than min,idu , “round off” to a minimal step length min,idu or zero

• if rounding off caused du to be outside u-limit, set to zero The step size limitations (constraint 1 and 3) cause the allowed “target” regions to look as in fig. A-2.

Figure A-2: Resulting area of movement after constraints 1 and 3.

Constraint 2 is imposed as in figure A-3.

Allowed areas to move to

Current position

Page 36: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

30

Figure A-3: The projection due to attempted step outside u-boundary (constraint 2)

A.6 Update the input Finally, the new u is set: u(t+1) = u(t) + du. For records, the controller returns the set du and the estimation of J as well. These values are intended to aid analysis.

A.7 The improved version of the Adaptive gradient algorithm The controller has precisely the same structure as the bare-bones version. For control law it uses the Levenberg-Marquardt method. For adaptation law the Widrow-Hoff method replaces least-square estimation if the list of du’s is too short to calculate the latter.

projection

u-boundary

du

Page 37: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

31

B The simulation framework In this document, the framework for simulating the controller is documented in a top-down fashion. The goals are that the reader easily can figure out:

• how to set up a simulation, run it and access the resulting data

• how information flows and calls are made during simulation

• where simulation settings are found and changed It will again be emphasized that the simulation deals with normalized values. When trying out components in this framework, everything must be consistently normalized! Most importantly, input u is expected to always lie between -1 and 1.

B.1 Overview The framework is found in the file ‘Simulation framework.zip’ and consists of a number of files. These are scripts, functions and saved data. In the core are the controller (controller.m), the simulation of the roller and sensor (mill.m), and the script for looping the simulation and recording data (run_current.m). The file ‘simulation.mat’ is a file that the system creates during a run to store away simulation settings and results on the hard disk. Data is stored in arrays which in turn are grouped together in Matlab structures. The main top structures are sim and res, for simulation and result respectively. Sim contains all information necessary for performing a simulation, and res data collected during simulation. In the following paragraphs, it is briefly described how to perform simulation with the framework. Details about the structures are found later in the chapter.

B.2 Getting started This section is intended to describe different modes of usage of the simulation framework. In the file system that comes with the work, there are example files which can be toyed around with to get a feeling for how it works.

B.2.1 Running an existing simulation setup

In order to run an existing simulation setup, it is necessary to load the corresponding sim structure into the workspace. If the structure is saved on hard disk, it is done with the command

>> load [filename]

If it is the first time, one also has to add the necessary folder paths by for example running startup.m in the root catalog. One final action is to make sure that if the file simulation.mat exists and contains something to keep, the contents should be stored away elsewhere since it is the default file that the simulation data is stored into after each simulation.

Page 38: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

32

Now the script run_current.m can be called and the simulation is executed. If no error occurs, the structure res is created (or overwritten if already existing in the workspace). Now simulation data can be found by accessing the various fields of the res structure.

B.2.2 Modify an existing simulation setup

If an existing simulation setup should be modified, the sim structure must first be loaded into the workspace as described above. In this structure all the desired changes can be made, from increasing the number of samples or the standard deviation of noise, to adding set points changes or changing function surfaces.

B.2.3 Making a simulation

There are short scripts called skeletons where the essential fields of the sim structure are explicitly listed. Using these to fill out the necessary data, it is then up to the user to find functions and set points for simulation.

B.3 The simulation and result structures The sim structure contains the following fields: noise

nr_of_samples

dim

r_time

f_time

r

f

user_settings

The first two are scalars, giving the number of simulation iterations (typically a few hundred) and noise level in %/100, respectively. dim is a 1x2 vector containing the dimensions of the system: [n m] for a n x m system. The last four fields deals with set points and functions. They are closely related, and are described separately in the following section. user_settings is a structure itself, containing all user input that the controller requires: du_min

du_max

du_min is a mx1 vector with the smallest allowed step in each input. du_max is a scalar, setting the largest step the controller is allowed to make in normalized values. r is a matrix of scalar set points, with one row for each output. The first column contains the initial set point, and to simulate set point changes the user appends them columnwise and set the time of change in the vector r_time. For a system with two outputs, it might look like this: r = [0.34 0.26]

[0.10 0.18]

r_time = [1 50 ]

Page 39: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

33

So at initiation, the set points are the column vector [0.34 0.10]T, and at sample 50 it

switches to the second column of r.

f and f_time are related in the same way as r and r_time, although f is a matrix of function structures rather than scalars as in r. Each column is the set of functions from u to y. Appending new column vectors of functions is a way of simulating sudden disturbances. An

example of f and f_time is: f = [f11 f12]

[f21 f22]

f_time = [1 25 ]

Here, the column vector [f11 f21]T describes the initial system, and the following column simulates a disturbance after 25 samples. The function structure is made up of the following fields: fHandle

input

y_lim

fHandle is a Matlab function handle to the surface to simulate the system, and input a

vector with parameters that is sent to the function. y_lim is a 1x2 vector with the minimal and maximal respective output value on the input space. It is up to the user to make sure that these values are the true minimum and maximum values on the u-domain!

B.4 The simulation procedure After setting up a sim structure, the run_current.m script can be called. It will extract necessary information from the sim structure, set up a res structure, and loop through the given number of samples as illustrated below.

1

Figure B-1: The simulation loop in run_current.m

Call controller receive u, du, and J

Call system_and_sensor receive y with and without noise

Record data in res

Page 40: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

34

C Repetition of some details from calculus A system of one input and one output (called a SISO or single input, single output system) can be visualized with a one-dimensional graph as in the figure below:

Figure C-1: Example of 1-dimensional function graph

If several outputs are observed in a system with only one input, each output would be represented with its own graph. For an nx2 system, each output is represented by a surface over the parameter space of u (called the u-domain). In the following figure, this is exemplified for a 2x2-system.

Figure C-2: Output function surfaces for 2x2-system

These types of graphs illustrate function topology quite well but in this work it will be more practical to illustrate functions with contour or level curves than surfaces. The idea is to

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80

0.2

0.4

0.6

0.8

1

u

y

Page 41: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

35

project the surface onto the u-domain in the same manner as with topological maps. For 1y in

the preceding figure, it will look as in the next figure:

Figure C-3: Surface and corresponding contour map. The grading of the axes is of secondary importance, it will

be assumed that all dimensions are normalized.

Along each contour curve the output quality has the same value, just as isolines marks lines of equal height over a base line on topological maps. Notice that the grading of the axes have been changed: in all practical work of this thesis, normalized values have been used, with each input belonging to the range [-1, 1] and each output to [0, 1]. The gradient of a function is the row vector of partial derivatives of the function:

)

)

)

)=

mu

f

u

ffgrad ,,

1

K

The Jacobian of a nxm system is a nxm matrix with the gradients of each output function in the corresponding rows:

)

)

)

)

)

)

)

)

=

m

nn

m

u

f

u

f

u

f

u

f

J

,,

,,

1

1

1

1

K

M

K

The tangent plane through a point and the corresponding contour curve have the same information content. While the gradient gives the slant in the plane, it is also a vector perpendicular to the corresponding contour curve.

C.1 Monotonicity, a customized definition For a one-dimensional graph, monotonicity simply means that the curve is constantly rising or constantly falling, see fig. C-4 a. Fig C-4 b shows a non-monotonic function. For a general number of inputs and outputs, monotonicity will in this work be viewed in the following way. If a function is monotonic for any linear parametrization of u

Page 42: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

36

mmm ctku

ctku

+#=

+#=

M

111

Then the function will be called monotonic. This can be imagined in the following way: imagine picking two random points on the u-domain and taking a straight path between them, and at the same time plotting each output as a function of time. If a path can be found that yields a non-monotonic graph, then the corresponding surface is non-monotonic. Examples of two-dimensional monotonic and non-monotonic surfaces are given in figure C-4 c and d below. The peak or valley of a non-monotonous function is called the extreme point.

Figure C-4: a) Monotonic 1-d function graph b) Non-monotonic 1-d function graph c) Monotonic 2-d function

surface d) Non-monotonic 2-d function surface

Page 43: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

37

D Comparing the control laws

D.1 Difference in calculation To understand the difference between the original control law as in equation X and IGM, it helps to plot the Jacobian information on the u-domain. Remember that the Jacobian estimate is a list of estimated tangent planes; now, generate the set point contours from these planes and plot them together on the u-domain as in the figure below. These contour curves appear as red and blue lines. The original control law finds the step that takes the algorithm to the intersection between the contour lines. With IGM, the individual gradient contribution (the vector resulting from the multiplication inside the summation) gives the shortest vector from the current controller position to the respective contour line – a vector perpendicular to the contour line. IGM simply makes an average of these vectors.

-1 1-1

1

u1

u2

set point y1

set point y2

du1

du2

IGM du

traditional control law du

Figure D-1: The angular difference in step between the control laws can be at most 90 degrees.

With this illustration, it can be understood that it is the degree of correlation – that is, the angle between set point contours – that decides how close the IGM solution is to the solution of the original control law. With functions perfectly uncorrelated, both laws yield the same step du, and with increasingly correlated functions, IGM gives an increasingly different solution from the original control law.

D.2 The convergence point IGM will strive for the average of the contour lines. If the set points are in agreement (intersecting) and the outputs are monotonic, then IGM will reach E = 0.

Page 44: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

38

For the case with optimal solution locus at an input saturation (as discussed in section 4.1.2), this means that IGM has the potential to reach a convergence point with lower global error that the original control law, see the illustration below.

-1 1-1

1

u1

u2

theoretical convergence point for IGM

theoretical convergence point fortraditional control law

Figure D-2: The control laws will in the special case of set point relationship above have different theoretical

convergence points.

Page 45: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

39

E The benchmark simulations The simulations are shown in the figure below. As they always come in two events (initiation + set point change or initiation + disturbance) they are always represented with two u-domain plots. The benchmark simulations are framed and numbered in the figure. For each pair, the first plot is the situation that the controller meets after initiation, the second how the situation changes at the 75:th sample. The six first simulations are set point changes, the seventh keeps the set point value and has a large change in the function surfaces, simulating a large disturbance. All simulations are buried in white noise with standard deviation 0.01. Of the six set point change simulations, the three first have clearly defined solutions, the fourth has perfectly correlated output making the solution a line rather than a point, and the following two have the solution on an input limit. The simulations are found in the file allSits.mat in the compressed file that comes with this report. The loaded array of sim structures is called sims. To load a certain benchmark simulation, first type >> load allSits.mat

And then choose simulation, e.g. number 2, with the command >> sim = sims(2)

Page 46: Adaptive control of wheat mill roller pair · The modern wheat milling plant is normally a huge complex - the production rate can supersede 30 tonnes of flour per hour. In charge

40

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

-1 1-1

1

u1

u2

1

7

2

3 4

5 6

Figure E-1: The seven benchmark simulations.