


===============================================================================
Title: mpc_mip.m
Version: 2.0
Project: Control of MLD systems
Purpose: MPC of MLD systems
Authors: Tobias Geyer, Domenico Mignone, Mato Baotic
based on mipc1.m by Alberto Bemporad, 12/5/1998
(C) 2005 by Michal Kvasnica
History: date: subject: author:
----- -------- -------
2003.11.19 first public release Tobias Geyer
2003.03.17 time-varying models Tobias & George
2002.05.21 Added flag, removed output messages Tobias
2002.05.17 Added constraints on z variables Mato & Tobias
2002.04.19 Relaxation of MLD and terminal Mato Baotic
state constraints enabled via
Options.relaxind
2002.04.13 Included infinity norm case Mato Baotic
(Options.norm = inf)
2000.11.16 Initial version adapted from Domenico Mignone
mipc_main.m
Inputs: S: the MLD model in compact or valid format
If S is a cell array, every cell corresponds to a different
MLD model with corresponding prediction horizons given in the
vectors pr and co.
x: the current state
r: the reference value (see below for the possibilities)
Q: structure with the weight matrices (see below for details)
pr: vector of prediction horizons
co: vector of control horizons
Options: further inputs (see below for the possibilities)
All inputs, except Options are mandatory
Details on some inputs:
r: if r has dimension ny, it is understood as constant reference
for y
if r has dimension pr*ny, it is understood as a time varying
reference trajectory for y
if r is a structure, the following fields are accepted as
references for the involved variables:
r.x reference for the state
r.u reference for the input
r.d reference for delta
r.z reference for z
r.y reference for the output
each field is assumed to be a constant reference, if it is
of dimension nx, nu, nd, nz, ny and is assumed to be a
time varying reference if the dimension is pr*nx, pr*nu...
Q: the following fields can be specified
Q.Qx weights on x
Q.Qu weights on u
Q.Qd weights on d
Q.Qz weights on z
Q.Qy weights on y
Options accepts the following fields:
Options.bigB infinity for bounds on variables
(default = 1e6)
Options.epsil global softening of ax <= b
(default = 1e-7)
Options.solver MIQP solver for panmiqp
(default = 'miqp')
Options.solver.options specific solver options
(default = [])
Options.saveflag flag denoting, whether workspace is
saved before/after optimization
(default = 0)
Options.savestr name of files for saving
(default = 'data')
Options.eps2 tolerance on fulfillment of terminal
state constraints
(default = 0)
Options.umin lower bounds for inputs
(default = -bigB)
Options.umax upper bounds for inputs
(default = bigB)
Options.zmin lower bounds for aux variable
(default = -bigB)
Options.zmax upper bounds for aux variable
(default = bigB)
Options.flagihard if 1 hard constraints on Ax<=b
if 0 epsilon softening of Ax<=b
(default = 1)
Options.weps weight in cost function if flagihard=0
(default = 1)
Options.relaxind indices of constraints Ax<=b to be
relaxed if flagihard==0. Only MLD and
terminal state constraints can be relaxed.
(default = [1:ne*pr+2*nx], i.e., relax
*ALL* MLD and terminal state constraints
and use only *ONE* slack variable)
Note: if Options.relaxindex==[], relax
*ALL* MLD and terminal state
constraints and use *DIFFERENT*
slack variable for each constraint
Options.xopt initial guess for the optimization
(default = 0)
Options.norm norm used in MPC formulation
{2 | inf | 1}
(default = 2)
Options.verbose display additional information
(default = 0)
Options.removeInfBounds if true, removes constraints of the
form z <= Inf and replaces +/- Inf
bounds on variables by +/- Options.bigB.
(default = 0)
Options.bounds2ineq if true, converts bounds of variables
into inequality constraints
(default = 0)
Outputs: ut : current input to be applied to the system
dt : current value of the variable delta
zt : current value of the variable z
Eflag : structure for further output informations
Eflag.slkeps: slack variables of constraints if flagihard==0
Notes: Soft constraints on the whole set of inequalities (flagihard=0)
The problem becomes: min J + ||weps, epsil||
s.t. Ax-epsil*ones(nlin,1) <= B
epsil >= 0
constraint relaxations on u (flaguhard = 0)
are only effective, if all constraints on u are expressed via
umin and umax. If they are already included in the MLD matrices
Ei, this relaxation has no effect.
This is an extension to implement multiple sampling times within
the prediction horizon. Therefore, each model has the same dimensions
but different associated prediction horizons (and sampling times).
Requires: mpc_checkSysWeight
mpc_buildmatFAST
Contact: Mato Baotic, baotic@control.ee.ethz.ch
Tobias Geyer, geyer@control.ee.ethz.ch
Michal Kvasnica, kvasnica@control.ee.ethz.ch
Automatic Control Laboratory
ETH Zentrum,
Zurich, Switzerland
Comments and bug reports are highly appreciated