mpt_demo_lti5

Purpose

Demostration of problem formulation using additional properties.

Syntax

mpt_demo_lti5

Description

Formulation of MPC problem using terminal cost, terminal set constraints, and move blocking constraint.

Example(s)

Example 1

Define an LTI prediction model
 lti = LTISystem('A', [1 1; 0 1], 'B', [1; 0.5]); 
 Define the MPC controller 
 horizon = 5; 

 ctrl = MPCController(lti, horizon); 
 Define quadratic penalties 
 ctrl.model.x.penalty = QuadFunction(eye(2)); 

 ctrl.model.u.penalty = QuadFunction(1); 

 onl_ctrl.model.x.terminalPenalty = QuadFunction(10*eye(2)); 
 Add a terminal set constraint (see help SystemSignal/filter_terminalSet) 
ctrl.model.x.with('terminalSet');

ctrl.model.x.terminalSet = Polyhedron('lb', [-1; -1], 'ub', [1; 1]);
 Add an LQR terminal penalty (see help SystemSignal/filter_terminalPenalty) 
lqr_penalty = ctrl.model.LQRPenalty(); 

ctrl.model.x.with('terminalPenalty');

ctrl.model.x.terminalPenalty = lqr_penalty;
 Add a move-blocking constraint (the last 3 moves are to be constant) 
ctrl.model.u.with('block');

ctrl.model.u.block.from = ctrl.N-2;

ctrl.model.u.block.to = ctrl.N; 
 Obtain the optimal control input 
x0 = [-4; 0];

[Uonl, feasible] = ctrl.evaluate(x0)
Uonl =

          2.07136913674103


feasible =

     1

We can also ask for full open-loop predictions:
[~, ~, openloop] = ctrl.evaluate(x0) 
openloop = 

    cost: 28.9534609997889
       U: [2.07136913674103 0.00571336432319767 -0.503441481063561 -0.503441481063562 -0.503441481063562]
       X: [2x6 double]
       Y: [0x5 double]

Plot the open-loop predictions
 ctrl.model.plot 

../../../fig/mpt/demos/mpt_demo_lti5_img_1.png

See Also

mpt_demo_lti1, mpt_demo_lti2, mpt_demo_lti3, mpt_demo_lti4


© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk