Home > mpt > mpt_ownmpc.m

mpt_ownmpc

PURPOSE ^

MPT_OWNMPC The "Design your own MPC" function

SYNOPSIS ^

function varargout = mpt_ownmpc(varargin)

DESCRIPTION ^

 MPT_OWNMPC The "Design your own MPC" function

 [CON, OBJ, VAR] = mpt_ownmpc(sysStruct, probStruct)
 ctrl = mpt_ownmpc(sysStruct, probStruct, CON, OBJ, VAR)

 ---------------------------------------------------------------------------
 DESCRIPTION
 ---------------------------------------------------------------------------
 "Design Your Own MPC problem". This function operates in two modes:
 
 1. Problem construction phase:
      In this step, matrices defining constraints and objective of a given MPC
      problem are formulated. The matrices, together with variables which
      define them, are stored to your workspace as CON (constraints), OBJ
      (objective) and VAR (variables) objects.

 2. Computation phase:
      In this step, a control law is calculated according to constraints and
      objective provided.

 Example:
   We would like to impose polytopic constraints on all predicted states, but
   not on the initial condition x0:

     [H, K] = double(unitbox(2, 2));   % polytopic constraints
     Double_Integrator
     [CON, OBJ, VAR] = mpt_ownmpc(sysStruct, probStruct);
     for k = 2:length(VAR.x)
       % k==1 corresponds to x0, k==2 to x1 etc.
       CON = CON + set(H*VAR.x{k} <= K);
     end
     ctrl = mpt_ownmpc(sysStruct, probStruct, CON, OBJ, VAR)

 Note!
   To design an on-line MPC controller, you must append an additional 'online'
   flag when calling this function, i.e.:

     [C, O, V] = mpt_ownmpc(sysStruct, probStruct, 'online')
     ctrl = mpt_ownmpc(sysStruct, probStruct, C, O, V, 'online')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Thu 30-Mar-2006 10:26:47 by m2html © 2003