The problem was adapted from the supersonic aircraft minimum time-to-climb problem originally presented by , formulated by  and implemented by  in matric units.
Consider following problem aimming at finding a fuel efficient climbing flight path of a supersonic aircraft
the objective is to maximize the weight of the aircraft at the target altitude
Subject to dynamics constraints
simple bounds on variables
and boundary conditions
Details about the aerodynamic modelling as well as parameter values of all relevant variables are available in various references, thus will not be reproduced here.
We require the numerical solution to fulfill the following accuracy criteria
We can specify the system dynamics in function MinEnergyClimbBryson_Dynamics_Internal with
For this example problem, we do not have any path constraints, so function MinEnergyClimbBryson_Dynamics_Internal only need to return the value of variable dx .
Similarly, the (optional) simulation dynamics can be specifed in function MinEnergyClimbBryson_Dynamics_Sim.m .
First we need to pre-process the look-up tables of atmosphere data, aerodynamic data and propulsion data for use in ICLOCS2,
and declear the variables for later use.
Next, we provide the function handles for system dynamics with
The optional files providing analytic derivatives can be left empty as we use finite difference this time
and finally the function handle for the settings file is given as.
Next we define the time variables with
For state variables, we need to provide the initial conditions
bounds on intial conditions
bounds on the absolute local and global (integrated) discretization error of state variables
tolerance for state variable box constraint violation
terminal state bounds
and an initial guess of the state trajectory (optional but recommended)
Lastly for control variables, we need to define simple bounds
bounds on the first control action
tolerance for control variable box constraint violation
as well as an initial guess of the input trajectory (optional but recommended)
We store the necessary problem parameters used in the functions
Since this problem only has a Mayer (boundary) cost , and no Lagrange (stage) cost ,we simply have
for sub-function E_unscaled and L_unscaled respectively.
For this example problem, we do not have additional boundary constraints. Thus we can leave sub-routines b_unscaled as they are.
Now we can fetch the problem and options, solve the resultant NLP, and generate some plots for the solution.
Note the last line of code will generate an open-loop simulation, applying the obtained input trajectory to the dynamics defined in MinEnergyClimbBryson_Dynamics_Sim.m , using the Matlab builtin ode113 ODE solver with a step size of 0.01.
Using the Hermite-Simpson discretization scheme of ICLOCS2, the following state and input trajectories are obtained under a mesh refinement scheme starting with 20 mesh points. The computation time with IPOPT (NLP convergence tol set to 1e-09) is about 9 seconds for 2 mesh refinement iterations together, using finite difference derivative calculations on an Intel i7-6700 desktop computer. Subsequent recomputation using the same mesh and warm starting will take on average 1 seconds and about 10 iterations.
The solution to the origial minimum time-to-climb can be obtained by simply changing the objective to
with the obtained solution as follows
The followings are the results obtained from various closed-loop simuations of the minimum time-to-climb problem, with and without the perturbations from some atmospheric turbulence. With the shrinking horizon strategy, special attentions was paid to recursive feasiblity of the optimal control problem under uncertainties. For this example, the terminal conditions are implemented as soft constraints, and a lower bound on the terminal time was introduced to avoid numerical issuses with very small time duration (tf-t0 ≈ 0s).
You may use the Link to download the example directly and feel free to use it as a starting point to formulate your own closed-loop simulations.
We first demonstrate the results for a fixed-step update strategy. The simulation time step will be 0.1s and the re-optimization time step will be 1s.
Next, we demonstrate the results for a ASAP update strategy. ASAP stands for 'as soon as possible', meaning each re-optimization solution will become available as soon as the required compuation time has been elapsed.
Lastly, we present the results for a event-based update strategy. Recomputations will only happy if the previous solution has passed is period of validity (selected to be 20s), or certain variables are close to their upper or lower constraint limits
 A. E. Bryson, M. N. Desai, and W. C. Hoffman, Energy-State Approximation in Performance Optimization of Supersonic Aircraft, Journal of Aircraft, Vol. 6, No. 6, November-December, 1969, pp. 481-488.
 J. Betts, Practical Methods for Optimal Control and Estimation Using Nonlinear Programming: Second Edition, Advances in Design and Control, Society for Industrial and Applied Mathematics, 2010.
 M.A. Patterson and A.V. Rao, GPOPS-II: A General Purpose MATLAB Software for Solving Multiple-Phase Optimal Control Problems, User's Manual, 2.3 edition, 2016.