**TOMLAB /PROPT Manual**- Contents
- 1 PROPT Guide Overview
- 2 Introduction to PROPT
- 3 Modeling optimal control problems
- 4 Multi-phase optimal control
- 5 Scaling of optimal control problems
- 6 Setting solver and options
- 7 Solving optimal control problems
- 8 | | OPTIMAL CONTROL EXAMPLES | |
- 9 Acrobot
- 10 A Linear Problem with Bang Bang Control
- 11 Batch Fermentor
- 12 Batch Production
- 13 Batch Reactor Problem
- 14 The Brachistochrone Problem
- 15 The Brachistochrone Problem (DAE formulation)
- 16 Bridge Crane System
- 17 Bryson-Denham Problem
- 18 Bryson-Denham Problem (Detailed)
- 19 Bryson-Denham Problem (Short version)
- 20 Bryson-Denham Two Phase Problem
- 21 Bryson Maxrange
- 22 Catalyst Mixing
- 23 Catalytic Cracking of Gas Oil
- 24 Flow in a Channel
- 25 Coloumb Friction 1
- 26 Coloumb Friction 2
- 27 Continuous State Constraint Problem
- 28 Curve Area Maximization
- 29 Denbigh’s System of Reactions
- 30 Dielectrophoresis Particle Control
- 31 Disturbance Control
- 32 Drug Displacement Problem
- 33 Optimal Drug Scheduling for Cancer Chemotherapy
- 34 Euler Buckling Problem
- 35 MK2 5-Link robot
- 36 Flight Path Tracking
- 37 Food Sterilization
- 38 Free Floating Robot
- 39 Fuller Phenomenon
- 40 Genetic 1
- 41 Genetic 2
- 42 Global Dynamic System
- 43 Goddard Rocket, Maximum Ascent
- 44 Goddard Rocket, Maximum Ascent, Final time free, Singular solution
- 45 Goddard Rocket, Maximum Ascent, Final time fixed, Singular solution
- 46 Greenhouse Climate Control
- 47 Grusins Metric
- 48 Hang Glider Control
- 49 Hanging Chain
- 50 High Dimensional Control
- 51 Hyper Sensitive Optimal Control
- 52 Initial Value Problem
- 53 Isometrization of alpha pinene
- 54 Isoperimetric Constraint Problem
- 55 Jumbo Crane Container Control
- 56 Lee-Ramirez Bioreactor
- 57 Linear Tangent Steering Problem
- 58 Linear Gas Absorber
- 59 Linear Pendulum
- 60 Linear Problem with Bang Bang Control
- 61 LQR Problem
- 62 Marine Population Dynamics
- 63 Max Radius Orbit Transfer
- 64 Sequential Activation of Metabolic Pathways
- 65 Methanol to Hydrocarbons
- 66 Min Energy Orbit Transfer
- 67 Minimum Climb Time (English Units)
- 68 Missile Intercept
- 69 Moonlander Example
- 70 Nagurka Problem
- 71 Nishida problem
- 72 Nondifferentiable system
- 73 Nonlinear CSTR
- 74 Obstacle Avoidance
- 75 Oil Shale Pyrolysis
- 76 One Dimensional Rocket Ascent
- 77 Parametric Sensitivity Control
- 78 Orbit Raising Maximum Radius
- 79 Orbit Raising Minimum Time
- 80 Parallel Reactions in Tubular Reactor
- 81 Parameter Estimation Problem
- 82 Park-Ramirez bioreactor
- 83 Path Tracking Robot
- 84 Path Tracking Robot (Two-Phase)
- 85 Pendulum Gravity Estimation
- 86 Penicillin Plant
- 87 Plug-Flow Tubular Reactor
- 88 Quadratic constraint problem
- 89 Quadruple Integral
- 90 Radio telescope
- 91 Rayleigh Unconstrained
- 92 Rigid Body Rotation
- 93 Robot Arm Movement
- 94 Time-optimal Trajectories for Robot Manipulators
- 95 Satellite Control
- 96 Second Order System
- 97 Space Shuttle Reentry
- 98 Simple Bang Bang Problem
- 99 Singular Arc Problem
- 100 Singular CSTR
- 101 Singular Control 1
- 102 Singular Control 2
- 103 Singular Control 3
- 104 Singular Control 4
- 105 Singular Control 5
- 106 Singular Control 6
- 107 Spring Mass Damper (2 Degree Freedom)
- 108 Stirred Tank
- 109 Temperature Control
- 110 A Simple Terminal Constraint Problem
- 111 Third order system
- 112 Time Delay 1
- 113 Time Delay 1 (Approximate)
- 114 Time Delay 2
- 115 Time Delay 2 (Approximate)
- 116 Transfer Min Swing
- 117 Tubular Reactor
- 118 Turbo Generator
- 119 Two-Link Robot
- 120 Two-Link Robotic Arm
- 121 Two-Phase Schwartz
- 122 Two Stage CSTR
- 123 Van der Pol Oscillator
- 124 Zermelos problem (version 1)
- 125 Zermelos problem (version 2)
- References
- Notes

The preceding sections show how to setup and define an optimal control problem using PROPT. Many additional features have been implemented, such as advanced input error identification, to facilitate fast modeling and debugging.

In the preceding sections several different Matlab functions and operators were used. This section lists the ones that are useful for the end user.

`y = collocate(phase, x)` for a m-by-n tomSym object x, on a phase with p
collocation points, returns an p-by-m*n tomSym with values of x for each
collocation point.

If x is a cell array of tomSym objects, then collocate is applied recursively to each element in the array.

See also: atPoints

Shortcut to overdot (alternatively dot product).

`dot(p,x)` gives the time derivative of x in the phase p.

`dot(x)` can be used to the same effect, if `setPhase(p)` has been called
previously.

`y = final(phase, x)` for tomSym object x, returns an object of the same
size as x, where the independent variable (usually t) has been replaced by
its final value on the phase.

See also: initial, subs, collocate, atPoints

`y = icollocate(phase, x)` is the same as `y = collocate(phase, x)`, except
that the interpolation points are used instead of the collocation points.
This is typically useful when constructing an initial guess.

See also: collocate, atPoints

`y = initial(phase, x)` for tomSym object x, returns an object of the same
size as x, where the independent variable (usually t) has been replaced by
its initial value on the phase (often 0).

If x is a cell array of tomSym objects, then initial is applied recursively to each element in the array.

See also: final, subs, collocate, atPoints

`y = integrate(phase, x)` for tomSym object x, returns an object which has
the same size as x and is the integral of x in the given phase.

See also: atPoints

`y = mcollocate(phase, x)` for a m-by-n tomSym object x, on a phase with p
collocation points, returns an (2p+1)-by-m*n tomSym with values of x for
each collocation point, the endpoints and all points that lie halfway
inbetween these points.

The mcollocate function is useful in setting up inequalities that involve state variables. Because twice as many points are used, compared to collocate, the resulting problem is slightly slower to solve, but the obtained solution is often more correct, because overshoots in between collocation points are smaller.

Because it uses many more points than there are degrees of freedom, mcollocate should only be used for inequalities. Applying mcollocate to equalities will generally result in an optimization problem that has no solution. Care should also be taken to ensure that the mcollocated condition is not in conflict with any initial or final condition.

If x is a cell array of tomSym objects, then mcollocate is applied recursively to each element in the array.

If a finite element method is used, then mcollocate uses all points that are used in computing the numeric quadrature over elements.

See also: collocate, icollocate, atPoints

`setPhase(p)` sets the active phase to p.

It is not strictly necessary to use this command, but when doing so, it is possible to omit the phase argument to the commands tomState, tomControl, initial, final, integrate, etc.

x = tomControl creates a scalar PROPT control with an automatic name. x = tomControl(phase,label) creates a scalar control with the provided name. x = tomControl(phase,label,m,n) creates a m-by-n matrix of controls. x = tomControl(phase,[],m,n) creates a matrix control with an automatic name. x = tomControl(phase,label,m,n,'int') creates an integer matrix symbol. x = tomControl(phase,label,m,n,'symmetric') creates a symmetric matrix symbol.

The tomControl symbols are different from tomState symbols in that the states are assumed to be continuous, but not the controls. This means that derivatives of tomControls should typically not be used in the differential equations, and no initial or final condition should be imposed on a tomControl.

If setPhase has been used previously, then the phase is stored in a global variable, and the phase argument can be omitted.

Constructs like "`x = tomControl(’x’)`" are very common. There is the
shorthand notation "tomControls x".

See also: tomControls, tomState, tom

Examples:

tomControls x y z

is equivalent to

x = tomControl('x'); y = tomControl('y'); z = tomControl('z');

tomControls 2x3 Q 3x3 -integer R -symmetric S

is equivalent to

Q = tomControl('Q', 2, 3); R = tomControl('R', 3, 3, 'integer'); S = tomControl('S', 3, 3, 'integer', 'symmetric');

Note: While the "tomControls" shorthand is very convenient to use prototyping code, it is recommended to only use the longhand "tomControl" notation for production code. (See toms for the reason why.)

It is necessary to call setPhase before calling tomStates.

See also tomControl, setPhase, tomState tomStates, tom, toms

`phase = tomPhase(label, t, tstart, tdelta, ipoints, cpoints)`
The ipoints (interpolation points) and cpoints (collocation points) input
arguments must be vectors of unique sorted points on the interval 0 to 1.

`phase = tomPhase(label, t, tstart, tdelta, n)` automatically creates
cpoints and ipoints using n Gauss points. (If n > 128 then Chebyshev
points are used instead.)

`phase = tomPhase(label, t, tstart, tdelta, n, [], ’cheb’)` uses Chebyshev
points instead of Gauss points. This yields better convergence for some
problems, and worse for others, as compared to Gauss points.

See also: collocate

x = tomState creates a scalar PROPT state with an automatic name. x = tomState(phase,label) creates a scalar state with the provided name. x = tomState(phase,label,m,n) creates a m-by-n matrix state. x = tomState(phase,[],m,n) creates a matrix state with an automatic name. x = tomState(phase,label,m,n,'int') creates an integer matrix symbol. x = tomState(phase,label,m,n,'symmetric') creates a symmetric matrix symbol.

The tomState symbols are different from tomControl symbols in that the
states are assumed to be continuous. This means that they have time
derivatives, accessible via the `dot()` function, and that tomStates cannot
be integers.

If setPhase has been used previously, then the phase is stored in a global variable, and the phase argument can be omitted.

Constructs like "`x = tomState(’x’)`" are very common. There is the
shorthand notation "tomStates x".

See also: tomStates, tom, tomControl, setPhase

Examples:

tomStates x y z

is equivalent to

x = tomState('x'); y = tomState('y'); z = tomState('z');

tomStates 2x3 Q 3x3 R -symmetric S is equivalent to Q = tomState('Q', 2, 3); R = tomState('R', 3, 3); S = tomState('S', 3, 3, 'symmetric')

tomStates 3x1! v is equivalent to v1 = tomState('v1'); v2 = tomState('v2'); v3 = tomState('v3'); v = [v1;v2;v3];

See the help for "toms" for more info on how to use the different flags.

Note: While the "tomStates" shorthand is very convenient to use prototyping code, it is recommended to only use the longhand "tomState" notation for production code. (See toms for the reason why.)

It is necessary to call setPhase before calling tomStates.

See also tomState, tomControl, setPhase, tomControls, toms, tom

Some user may wish to use more advanced function of PROPT as well. The following function can be useful in many situations.

`y = atPoints(phase, t, x)` for a m-by-n tomSym object x, and a vector t
of length p, returns an p-by-m*n tomSym with values of x for each
value of t (this is done via substitution).

If x is a cell array of tomSym objects, then atPoints is applied recursively to each element in the array.

If x is an equality or inequality, and the left-hand-side is divided by a symbolic phase.tdelta, then both sides are multiplied by phase.tdelta

See also: tomPhase

Overloaded methods: tomSym/atPoints tomSym/atPoints

`yi = interp1p(x,y,xi)` fits a polynomial to the points (x,y) and evaluates
that polynomial at xi to compute yi.

The behavior of interp1p is different from that of interp1 in that the same high-degree polynomial is fitted to all points. This is usually not a good idea, and for general interpolation interp1 is to be preferred. However, it works well in some cases, such as when the points x are the roots of a Legendre polynomial.

Overloaded methods: tomSym/interp1p tomSym/interp1p

`[r, w] = gausspoints(nquad)` = `proptGausspoints(n)`

Input: n - The number of points requested

Output r - The Gauss points (roots of a Legendre polynomial of order n.) w - The weights for Gaussian quadrature.

`M = proptDiffMatrix(X,XI,N)` creates a matrix M of the values of the
N:th derivatives of the interpolating polynomials defined by the roots
X, at the points XI.
Each column of M corresponds to a specific root, and each row corresponds
to a component of XI.

The screen output depends on the functionality of the nonlinear programming solver. In most cases screen output can be generated with the following command:

options.PriLevOpt = 1; % or higher for more output

A print level of 3 is recommended when using the global NLP solver *multiMin*.

The solution structure from PROPT contains the relevant results.

It is possible to use the solution information to evaluate any custom expressions. For example:

subs(x1.*x2,solution);

The best way to plot the data is to directly use the data fields as
needed. There are also some automated plotting routines included, see
for example *help tomSym/ezplot*.