• Non ci sono risultati.

4 Optimization tools

N/A
N/A
Protected

Academic year: 2021

Condividi "4 Optimization tools"

Copied!
8
0
0

Testo completo

(1)

29

4 Optimization tools

4.1 Choice of tools

Many Optimal Control solvers are nowadays available, both as freeware and under commercial license, and for all operating systems; they come as independent software or as tools for other softwares (in this case for MATLAB®). Most of these solvers make use of a Direct Method such as the Direct Collocation Method, with minor differences in the NLP solver behaviour.

For this thesis two solvers have been chosen: GPOPS and ICLOCS. Both are freeware program written to work in MATLAB® workspace, thus requiring no licence acquisition and no low-level programming. Working in MATLAB® also means that Simulink® may be used.

The two solvers have been used to cross-validate the results of the optimization because they use two different NLP solvers.

4.1.1 GPOPS

Short for General Pseudospectral Optimum Control Software, it’s a MATLAB® software package that makes use of a method of the family of Direct Collocation, called Radau Pseudospectral

method. This particular method makes use of the Legendre-Gauss-Radau points as collocation

points with various advantages; more information about the method can be found in ref. [8], [9] and [15].

The tool allows the user to solve optimization problems with equality and inequality constraints, path constraints, free time-to-go, and either fixed or free initial and terminal conditions.

A restricted version of SNOPT, a third party NLP solver, is included along with GPOPS in the software package.

4.1.2 ICLOCS with NLP solver Ipopt

ICLOCS is also a MATLAB® software package developed for optimization of trajectories. As with GPOPS, this software solves problem with unknown time-to-go, and boundary, equality and inequality constraints.

With ICLOCS is possible to solve the problem with two different methods. If solver CVODES is installed, direct multiple-shooting method may be used. Otherwise, if third party NLP solver Ipopt

(2)

30

is available, a Direct Collocation method can be used. For this thesis, Direct Collocation method was used.

4.2 Tools application

A detailed description of how these two powerful tools work would exceed the intention of the author. Anyway, since the logic behind the two tools is almost identical, it can be useful to briefly explain it in 5 simple passages.

 Define states and controls: the first, obvious step is to summarize the problem that must be solved. Since a Direct Collocation Method is to be used, the tools request that, in a specified structure, the user declares how many states and controls there are in the problem, along with their minimum and maximum values at initial, intermediate and final time. Also path, event and boundary constraints can be specified by the user.

 Guess the optimal solution: the tool needs a starting point for its optimization procedure: the user must create a matrix containing the guessed values of the parameters at the corresponding values of time. Then the tools will proceed to elaborate a first-try trajectory based on the points given by the user. The more accurate the solution guessed, the faster and the more robust the numerical procedure.

 Write the motion laws: now that the tool has understood how many controls and states it must adjust to find optimality, the user has to declare how states vary with time, providing the tool with information on the derivatives of the states. Luckily both tools don’t strictly require the analytical expression of the law of motion, but only the derivatives’ values at specified instants of time, given the controls and states. In this thesis the derivatives has been computed thanks to a Simulink® dynamic model.

 Performance index adoption: the last step is to fill in a performance index, which both tools will try to minimize over the entire trajectory.

 Launch: the tool is now ready for running the optimization.

The 3rd passage in the above list prescribes the user to provide the tool with the derivatives of the states. For the problem in exam, an analytical expression of the derivatives would have been too complex. This obstacle was circumvented with a Simulink® dynamic model of the aircraft and the model MATLAB® function. This function computes the derivatives of the states of a Simulink® model, given the controls, the states and the time values. Instead of the analytical expression of

(3)

31

the derivatives, the tool were provided with the outputs of the model function anytime it was needed (see MATLAB® help for more information about this function).

The M346 “Master” dynamic model will be thoroughly discussed in Ch.6.

4.3 Examples

Two examples of trajectory optimization problems will now be presented. They have been solved with both optimization tools, to illustrate that the two are almost equivalent.

4.3.1 The Boat problem

Problem definition

This is a very famous problem that belongs to the family of the Zermelo’s problems. Imagine being ashore of a very large, straight river, and onto a boat. The river current’s speed is in the zero on the shore, but it grows linearly with a gradient F [s-1] in the distance y from the shore. Assume that the boat proceeds at a constant speed V and that x is the distance rowed in the direction of the current. The problem is to find the optimum heading of the boat to maximize x, with y(tf) zero

and fixed final time tf. The performance index to minimize is simply J = -xf .

Problem setting

The problem can be transposed quite easily. Given X = [x y] the state vector and u = γ the control, the equations are the following:

( )

( )

( )

            ≤ ≤ −       + ⋅       ° u ° = ) ( X u V X F u V = X = X f 180 180 0 2 sin 2 cos 0 0 0 & Eq. 4. 1

with tf fixed. Solution is showed for V=1, F=10, tf =1;

Solution with GPOPS

The performance index found by GPOPS is -xf = -2.7808 m. It’s easy to understand that for the

boat to take profit from the current speed it needs to get away from the shore. The more it gets distant from the shore, the faster it goes. However, since it must get back ashore in a fixed time,

(4)

32

this cannot be done indefinitely, and sooner or later the boat heads back to the shore. The results are shown in fig. 4.1 and 4.2.

Solution with ICLOCS

ICLOCS yields xf=2.7807 m, almost identical to the previous result. Optimal trajectories and

command histories are the same, too.

(5)

33

Fig. 4.2 - Optimal control of the boat

4.3.2 The Missile problem

This is a little more complex problem, dealing with inequality constraints on the states and leaving unspecified states in the boundaries.

Problem definition

A missile must be fired to land behind a wall tall yw=10m positioned at a fixed distance xf=3000m.

Suppose for the sake of simplicity that the missile flies at constant speed V0 =100 m/s (assume that

an active control provides the necessary thrust and drag to keep the speed constant during flight). Also, suppose that there are moving surfaces on the missile.

The moving surfaces can generate an angular rate up to:

| |

ω ≤4°s Eq. 4.2

The flight path angle θ at the obstacle must satisfy the following boundary constraints:

f t = t ° θ ° = t ° = θ 50 80 0 50 − ≤ ≤ − Eq. 4.3

(6)

34

Problem setting

This problem has a 3-length state vector, X=[x y θ] and 1 control variable, u=ω. The constraints and the dynamic equations are as in eq. 4.4.

( )

( )

( )

                                            − ° ≤ ≤ ° −           ° ∞ ∞ ≤ ≤           ° −           ° − ≤ ≤           ° −           ° ≤ ≤           °

θ

ω

θ

θ

cos sin cos 4 4 90 90 0 0 50 10 3000 80 10 3000 50 0 0 50 0 0 0 0 0 0 V g V V = X s u s X Xf X & Eq. 4.4

Solution with GPOPS

The GPOPS software finds a solution with time-to-go tf =31.43 s. Figures 4.3, 4.4 and 4.5 show

the trajectory, the path angle and the command history for the problem. As can be seen in fig. 4.4, the control is of the “bang-bang” type.

Solution with ICLOCS

The time-to-go of the solution obtained with ICLOCS is 31.44 s. The two solutions are again almost identical in trajectory and control history.

(7)

35

Fig. 4.3 - Optimal trajectory of the missile

(8)

36

Figura

Fig. 4.1 - Optimal trajectory of the boat
Fig. 4.2 - Optimal control of the boat
Fig. 4.3 - Optimal trajectory of the missile
Fig. 4.5 - Optimal angle of path of the missile

Riferimenti

Documenti correlati

Sommario – La bonifica elettrocinetica viene proposta come tecnica di rimozione di vari contaminanti, in par- ticolare metalli pesanti, da matrici come terreni o sedi-

leggere in maniera efficace la fine dell’attività si- derurgica, di cui sono state individuate le ultime fasi relative ad una fornace, e la trasformazione in area legata alla

In some cases, data refer to the annual average proportion of the total number of apprentices enrolled in apprenticeships in a country in a specific year – regardless of the scheme

Non ci vuole molto a capire che la lingua conta nelle scienze umane più che in altri campi, e questo non per un elemento estrinseco, ma proprio per la definizione degli

The stars are analysed by means of stellar evolution models that account for different mixing efficiencies, caused by different values of the core overshooting parameter (λ ov ;

Keywords: object detection, subtraction techniques, image sequence analysis, feature detection, feature extraction, high-performance computing, vector processor, microscopy,

The space of conormal distributions was designed to contain the Schwartz kernels of pseudo- differential operators with H¨ ormander symbols, see [6, Chapter 18.2]..