Model predictive control -...

47
Model predictive control - Introduction M. Farina [email protected] Dipartimento di Elettronica e Informazione Politecnico di Milano 7 June 2016

Transcript of Model predictive control -...

Page 1: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Model predictive control -

Introduction

M. Farina

[email protected]

Dipartimento di Elettronica e Informazione

Politecnico di Milano

7 June 2016

Page 2: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Outline

Motivations and main ideas

Ingredients and features of MPC regulators

Model predictive control for tracking

Model predictive control for linear systems and solution

Remarks

Marcello Farina Introduction to MPC 2

Page 3: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Outline

Motivations and main ideas

Ingredients and features of MPC regulators

Model predictive control for tracking

Model predictive control for linear systems

Remarks

Marcello Farina Introduction to MPC 3

Page 4: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 4

Some data from

A survey of industrial model predictive control technology

J. Qin, T. BadgwellControl Engineering Practice, 11 (2003), pp. 733-764

Introduction to MPC

Page 5: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 5Introduction to MPC

Page 6: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 6

Some data from

Economic assessment of advanced processcontrol โ€“ a survey and framework

M. Bauer, I. K. CraigJournal of process control, 18 (2008), pp. 2-18

Introduction to MPC

Page 7: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 7

A key objective of industrial advanced process control (APC)projects is to stabilize the process operation. In order to justify thecost associated with the introduction of new APC technologies to aprocess, the benefits have to be quantified in economic terms.In the past, economic assessment methods have been developed,that link the variation of key controlled process variables toeconomic performance quantities.This paper reviews these methods and incorporates them in aframework for the economic evaluation of APC projects.A web-based survey on the economic assessment of processcontrol has been completed by over 60 industrial APC experts.The results give information about the state-of-the-art assessmentof economic benefits of advanced process control

Introduction to MPC

Page 8: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 8

66 APC experts (38 APC users and 28 APC suppliers)

Introduction to MPC

Page 9: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 9Introduction to MPC

Page 10: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 10Introduction to MPC

Page 11: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 11Introduction to MPC

Plant

Plant:โ€ข Complexโ€ข Large scaleโ€ข Non linearโ€ข Continuous/discrete

timeโ€ข Perturbed

MPCregulator

Model:โ€ข Physical (state-space)โ€ข Identified

Predictive:โ€ข Actions are taken

based on predictions

โ€ข Forecasts of disturbances and references are used

Control:โ€ข Recursive solution

to a finite horizonoptimizationproblem

โ€ข State/input constraints are enforced

๐‘ข(๐‘ก) ๐‘ฆ(๐‘ก)๐‘ฆ0 (๐‘ก)

๐‘‘(๐‘ก)

Page 12: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 12Introduction to MPC

PlantMPC

regulator

๐‘ข(๐‘ก) ๐‘ฆ(๐‘ก)๐‘ฆ0 (๐‘ก)

๐‘‘(๐‘ก)

At time tโ€ข Compute optimal future

input sequence๐‘ข ๐‘ก , ๐‘ข ๐‘ก + 1 ,โ€ฆ , ๐‘ข ๐‘ก + ๐‘ โˆ’ 1

based on the current model, and on the predictions of references and disturbances.

โ€ข Apply u(t)

At time t+1โ€ข Compute optimal future

input sequence๐‘ข ๐‘ก + 1 , ๐‘ข ๐‘ก + 2 ,โ€ฆ , ๐‘ข ๐‘ก + ๐‘

based on the current model, and on the predictions of references and disturbances.

โ€ข Apply u(t+1)

Receding horizon principle

Page 13: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Motivations and main ideas

Marcello Farina 13Introduction to MPC

Model predictive control is a family of algorithmsthat enables to:

โ€ข Include explicitly in the problem formulationcontraints on input/state/output variables, and also logic relations

โ€ข Consider MIMO systems of relevant dimensionsโ€ข Optimize the system operationโ€ข Use simple models for control (obtained, e.g.,

by identification tests) or very detailednonlinear ones

Page 14: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Outline

Motivations and main ideas

Ingredients and features of MPC regulators

Model predictive control for tracking

Model predictive control for linear systems

Remarks

Marcello Farina Introduction to MPC 14

Page 15: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐‘ข(๐‘ก))

Constraints are imposed on input and state variables

1) The system model (discrete time):

2) The constraints

Marcello Farina 15

๐‘ฅ(๐‘ก) โˆˆ ๐•

๐‘ข(๐‘ก) โˆˆ ๐•Œ

Introduction to MPC

Suitable sets

โ€ข f is continuousโ€ข f(0,0)=0 (i.e., 0 is an

equilibrium point)

โ€ข ๐• closed

โ€ข ๐•Œ compact

โ€ข They contain the origin (atleast for regulation)

โ€ข Better if convex

Page 16: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

For practical (e.g., computational) reasons the cost is defined over a finite โ€“ prediction โ€“ horizon of length N steps.

3) Cost function (regulation):

Marcello Farina 16Introduction to MPC

At time t the following is minimized:

๐ฝ =

๐‘˜=๐‘ก

๐‘ก+๐‘โˆ’1

๐‘™ ๐‘ฅ ๐‘˜ , ๐‘ข ๐‘˜ + ๐‘‰๐‘“(๐‘ฅ(๐‘ก + ๐‘))

Stage cost:โ€ข Continuousโ€ข l(0,0)=0โ€ข Definite positive

Terminal cost:โ€ข Continuousโ€ข ๐‘‰๐‘“(0)=0

โ€ข Definite positive

Page 17: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 17Introduction to MPC

The optimization problem (MPC)

At time t solve

min๐‘ข ๐‘ก ,โ€ฆ,๐‘ข(๐‘ก+๐‘โˆ’1)

๐ฝ

Subject to

๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐‘ข(๐‘ก))

๐‘ฅ(๐‘ก) โˆˆ ๐•

๐‘ข(๐‘ก) โˆˆ ๐•Œ

System dynamic model

State constraints

Input constraints

๐‘ฅ(๐‘ก + ๐‘) โˆˆ ๐•๐‘“ Terminal state constraints

Page 18: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 18Introduction to MPC

The two ingredients that still need to be defined (terminal cost๐‘‰๐‘“(๐‘ฅ(๐‘ก + ๐‘)) and terminal constraint ๐‘ฅ(๐‘ก + ๐‘) โˆˆ ๐•๐‘“) are necessary to guarantee two fundamental properties:โ€ข Recursive feasibilityโ€ข Convergence/stability

What are these properties?

Recursive feasibility

If the MPC optimization problem has a solution at the initial time step 0, then a solution of MPC exists at each time step ๐‘ก โ‰ฅ 0.

Necessary for preventing from having no solution at a given time -> no control input would be defined!

Page 19: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 19Introduction to MPC

Convergence

If a solution of the MPC optimization problem exists at each time instant t, then.

๐‘ฅ(๐‘ก) โ†’ 0 as ๐‘ก โ†’ +โˆž

To ensure recursive feasibility and convergence/stability we needto define the 4th main ingredient.

4) Auxiliary control law

It is defined as a control law ๐‘ข ๐‘ก = ๐œ…(๐‘ฅ(๐‘ก)) such that the origin isan asymptotically stable equilibrium for the controlled system

๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐œ…(๐‘ฅ(๐‘ก)))

Page 20: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 20Introduction to MPC

5) Terminal constraint set ๐•๐‘“

It is defined in such a way that, if ๐‘ฅ(๐‘ก) โˆˆ ๐•๐‘“, then

๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐œ…(๐‘ฅ(๐‘ก))) โˆˆ ๐•๐‘“ It is a positivelyinvariant set!

๐‘ฅ(๐‘ก) โˆˆ ๐• i.e., ๐• โŠ‡ ๐•๐‘“๐‘ข ๐‘ก = ๐œ…(๐‘ฅ(๐‘ก)) โˆˆ ๐•Œ

For instance, if ๐‘ฅ(๐‘ก) โˆˆ ๐•๐‘“, then we could apply the auxilary control law for all future time instants, and we obtain that,

๐‘ฅ(๐‘ก) โ†’ 0 as ๐‘ก โ†’ +โˆž

the state and input constraints are always verified.

Page 21: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 21Introduction to MPC

6) Terminal cost ๐‘‰๐‘“

It is defined in such a way that ยซit decreasesยป if the auxiliarycontrol law is applied.

It is needed to establish formal convergence results

๐‘‰๐‘“ ๐‘“ ๐‘ฅ, ๐œ… ๐‘ฅ โ‰ค ๐‘‰๐‘“ ๐‘ฅ โˆ’ ๐‘™(๐‘ฅ, ๐œ… ๐‘ฅ )

Page 22: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 22Introduction to MPC

Basically, the latter ingredients are required for the following reason:

In N steps the terminal region must be reachable

๐•๐‘“

๐•๐‘

๐‘ฅ(0)๐‘ฅ(1)

๐‘ฅ(๐‘)

๐‘ฅ(0)๐‘ฅ(1)

๐‘ฅ(๐‘)

This implicitly defines the set of all initial conditionssuch that the MPC optimization problem is feasible, ๐•๐‘

HIC SUNT LEONES

Page 23: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Ingredients

Marcello Farina 23Introduction to MPC

๐•๐‘“

๐•๐‘

๐‘ฅ(0)๐‘ฅ(1)

๐‘ฅ(๐‘)

๐‘ฅ(0)๐‘ฅ(1)

๐‘ฅ(๐‘)

How to enlarge the terminal set?โ€ข Increase the number of steps N (greater

computational burden)โ€ข In some applications (like autonomous vehicles)

the MPC for tracking can be extremely beneficial

HIC SUNT LEONES

Page 24: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Outline

Motivations and main ideas

Ingredients and features of MPC regulators

Model predictive control for tracking

Model predictive control for linear systems

Remarks

Marcello Farina Introduction to MPC 24

Page 25: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking โ€“ main idea

Marcello Farina 25Introduction to MPC

๐•๐‘“

๐•๐‘

๐‘ฅ(0)

๐‘ฅ(๐‘)

But I can reach the intermediate point๐‘ฅ๐บ(0) in N steps!

I cannot reach the terminal region in Nsteps!

๐‘ฅ๐บ(0)

๐‘ฅ(1)

OKโ€ฆ now I can reach the terminal region in N steps!

Page 26: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking โ€“ main idea

Marcello Farina 26Introduction to MPC

๐‘ฅ(0)๐‘ฅ(๐‘)

๐‘ฅ๐บ(0)

๐‘ฅ(1)

The solution lies in defining (in the optimization problem) intermediate goals ๐‘ฅ๐บ(๐‘ก), that can be reached in N steps, whicheventually satisfy the property

๐‘ฅ๐บ ๐‘ก โ†’ าง๐‘ฅ๐บ (final goal) as ๐‘ก โ†’ +โˆž

๐‘ฅ๐บ(1)

๐‘ฅ(๐‘ + 1)

๐‘ฅ๐บ(2)

๐‘ฅ(๐‘ + 2)๐‘ฅ(๐‘˜ + ๐‘)

๐‘ฅ(2)

๐‘ฅ๐บ(๐‘˜)

Page 27: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking - ingredients

๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐‘ข(๐‘ก))

Constraints are imposed on input and state variables

1) The system model (discrete time):

2) The constraints

Marcello Farina 27

๐‘ฅ(๐‘ก) โˆˆ ๐•

๐‘ข(๐‘ก) โˆˆ ๐•Œ

Introduction to MPC

Suitable sets

โ€ข f is continuousโ€ข เดค๐‘ฆ๐บ is our output goalโ€ข f( าง๐‘ฅ๐บ , เดค๐‘ข๐บ)= าง๐‘ฅ๐บ , i.e., ( าง๐‘ฅ๐บ , เดค๐‘ข๐บ)

is an equilibrium pointand corresponds to the output เดค๐‘ฆ๐บ = โ„Ž( าง๐‘ฅ๐บ , เดค๐‘ข๐บ)

โ€ข ๐• closed

โ€ข ๐•Œ compact

โ€ข They contain าง๐‘ฅ๐บ and เดค๐‘ข๐บโ€ข Convex

๐‘ฆ(๐‘ก) = โ„Ž(๐‘ฅ(๐‘ก), ๐‘ข(๐‘ก))

Page 28: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking โ€“ ingredients

3) Cost function:

Marcello Farina 28Introduction to MPC

At time t the following is minimized:

๐ฝ =

๐‘˜=๐‘ก

๐‘ก+๐‘โˆ’1

๐‘™ ๐‘ฅ ๐‘˜ โˆ’ ๐‘ฅ๐บ ๐‘ก , ๐‘ข ๐‘˜ โˆ’ ๐‘ข๐บ(๐‘ก)

+๐‘‰๐‘“ ๐‘ฅ ๐‘ก + ๐‘ โˆ’ ๐‘ฅ๐บ ๐‘ก

+๐›พ ๐‘ฆ๐บ ๐‘ก โˆ’ เดค๐‘ฆ๐บ2

Stage cost:โ€ข Continuousโ€ข l(0,0)=0โ€ข Definite positive

Terminal cost:โ€ข Continuousโ€ข ๐‘‰๐‘“(0)=0

โ€ข Definite positive

Cost on the temporarygoal ๐‘ฆ๐บ ๐‘ก (its deviationwith respect to the finalgoal เดค๐‘ฆ๐บ is penalized)

f(๐‘ฅ๐บ ๐‘ก ,๐‘ข๐บ ๐‘ก )=๐‘ฅ๐บ ๐‘ก๐‘ฆ๐บ ๐‘ก = โ„Ž(๐‘ฅ๐บ ๐‘ก , ๐‘ข๐บ ๐‘ก )

Page 29: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking - ingredients

Marcello Farina 29Introduction to MPC

The optimization problem (MPC)

At time t solve

min๐‘ข ๐‘ก ,โ€ฆ,๐‘ข ๐‘ก+๐‘โˆ’1 ,๐‘ฆ๐บ(๐‘ก)

๐ฝ

Subject to

๐‘ฅ(๐‘ก) โˆˆ ๐•

๐‘ข(๐‘ก) โˆˆ ๐•Œ

System dynamic model

State constraints

Input constraints

(๐‘ฅ ๐‘ก + ๐‘ , ๐‘ฆ๐บ ๐‘ก ) โˆˆ โ„ค๐‘“ Terminal constraint

๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐‘ข(๐‘ก))

๐‘ฆ(๐‘ก) = โ„Ž(๐‘ฅ(๐‘ก), ๐‘ข(๐‘ก))

Page 30: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking - ingredients

Marcello Farina 30Introduction to MPC

The terminal cost ๐‘‰๐‘“ (same definition as before) and terminal constraint (๐‘ฅ ๐‘ก + ๐‘ , ๐‘ฆ๐บ ๐‘ก ) โˆˆ โ„ค๐‘“) are necessary to guarantee:โ€ข Recursive feasibility (same as before)โ€ข Convergence/stability

Convergence

If a solution of the MPC optimization problem exists at each time instant t, then.

๐‘ฆ(๐‘ก) โ†’ เดค๐‘ฆ๐บ as ๐‘ก โ†’ +โˆž

4) Auxiliary control law

It is defined as a control law ๐‘ข ๐‘ก = ๐œ…(๐‘ฅ ๐‘ก , ๐‘ฆ๐‘’๐‘ž) such that the equilibrium point (๐‘ฅ๐‘’๐‘ž , ๐‘ข๐‘’๐‘ž) is asymptotically stable for the controlled system ๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐œ…(๐‘ฅ ๐‘ก , ๐‘ฆ๐‘’๐‘ž)) and where

๐‘ฆ๐‘’๐‘ž = โ„Ž(๐‘ฅ๐‘’๐‘ž , ๐‘ข๐‘’๐‘ž)

Page 31: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking - ingredients

Marcello Farina 31Introduction to MPC

5) Terminal constraint

It is defined in such a way that, if (๐‘ฅ ๐‘ก , ๐‘ฆ๐‘’๐‘ž) โˆˆ โ„ค๐‘“, then

if ๐‘ฅ(๐‘ก + 1) = ๐‘“(๐‘ฅ(๐‘ก), ๐œ…(๐‘ฅ ๐‘ก , ๐‘ฆ๐‘’๐‘ž))

It is a positivelyinvariant set!

๐‘ฅ(๐‘ก) โˆˆ ๐•

๐‘ข ๐‘ก = ๐œ…(๐‘ฅ ๐‘ก , ๐‘ฆ๐‘’๐‘ž) โˆˆ ๐•Œ

For instance, if(๐‘ฅ ๐‘ก , ๐‘ฆ๐‘’๐‘ž) โˆˆ โ„ค๐‘“, then we could apply the auxilarycontrol law for all future time instants, and we obtain that,

๐‘ฆ(๐‘ก) โ†’ ๐‘ฆ๐‘’๐‘ž as ๐‘ก โ†’ +โˆž

the state and input constraints are always verified.

(๐‘ฅ ๐‘ก + 1 , ๐‘ฆ๐‘’๐‘ž) โˆˆ โ„ค๐‘“

Page 32: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

MPC for tracking - ingredients

Marcello Farina 32Introduction to MPC

Terminal constraint - remark

The following solution can be applied: terminal point as the terminal constraint set.

In this case we donโ€™t need to define the auxiliary control law and the terminal set, which are rather complex to obtain, especially for non linear and/or large-scale systems.

(๐‘ฅ ๐‘ก + ๐‘ , ๐‘ฆ๐บ ๐‘ก ) โˆˆ โ„ค๐‘“ Terminal set

๐‘ฅ ๐‘ก + ๐‘ = ๐‘ฅ๐บ ๐‘ก Terminal point

Page 33: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Outline

Motivations and main ideas

Ingredients and features of MPC regulators

Model predictive control for tracking

Model predictive control for linear systems

Remarks

Marcello Farina Introduction to MPC 33

Page 34: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems - Ingredients

๐‘ฅ ๐‘ก + 1 = ๐ด๐‘ฅ ๐‘ก + ๐ต๐‘ข(๐‘ก)

Linear inequality constraints

1) The system model:

2) The constraints

Marcello Farina 34

๐‘ฅ(๐‘ก) โˆˆ ๐•

๐‘ข(๐‘ก) โˆˆ ๐•Œ

Introduction to MPC

For simplicity we go back to the regulation case

The pair (๐ด, ๐ต) must be controllable (at leaststabilizable)

๐ด๐‘ฅ๐‘ฅ(๐‘ก) โ‰ค ๐‘๐‘ฅ๐ด๐‘ข๐‘ข(๐‘ก) โ‰ค ๐‘๐‘ข

For example, the saturation constraint ๐‘ข โ‰ค 1 can be written as โˆ’1

1๐‘ข โ‰ค

11 0 -1-1

Page 35: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems - Ingredients

3) Cost function โ€“ common choice:

Marcello Farina 35Introduction to MPC

At time t the following is minimized:

๐ฝ =

๐‘˜=๐‘ก

๐‘ก+๐‘โˆ’1

๐‘ฅ(๐‘˜) ๐‘„2 + ๐‘ข(๐‘˜) ๐‘…

2 + ๐‘ฅ(๐‘ก + ๐‘) ๐‘ƒ2

Quadratic stage cost:

๐‘™ ๐‘ฅ ๐‘˜ , ๐‘ข ๐‘˜

= ๐‘ฅ(๐‘˜) ๐‘„2 + ๐‘ข(๐‘˜) ๐‘…

2

= ๐‘ฅ ๐‘˜ ๐‘‡๐‘„๐‘ฅ ๐‘˜ + ๐‘ข ๐‘˜ ๐‘‡๐‘…๐‘ข(๐‘˜)

Where the symmetric matricesQโ‰ฅ0 and R>0 are arbitrary.

Quadratic terminal cost:

๐‘‰๐‘“ ๐‘ฅ ๐‘ก + ๐‘ = ๐‘ฅ(๐‘ก + ๐‘) ๐‘ƒ2

= ๐‘ฅ ๐‘ก + ๐‘ ๐‘‡๐‘ƒ๐‘ฅ ๐‘ก + ๐‘

Where the symmetric matrixP>0 is not arbitrary (see later).

Page 36: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems - Ingredients

Marcello Farina 36Introduction to MPC

4) Auxiliary control law

It is defined as a linear control law ๐‘ข ๐‘ก = ๐พ๐‘ฅ(๐‘ก) such that the matrix F=A+BK is asymptotically stable, i.e., such that the system

๐‘ฅ ๐‘ก + 1 = ๐ด๐‘ฅ ๐‘ก + ๐ต๐พ๐‘ฅ(๐‘ก)

enjoys stability properties.

5) Terminal constraint set ๐•๐‘“

In the linear case the terminal constraint can be enforcedusing linear inequalities

๐ด๐‘“๐‘ฅ(๐‘ก + ๐‘) โ‰ค ๐‘๐‘“6) Terminal cost ๐‘‰๐‘“

We can define ๐‘‰๐‘“ ๐‘ฅ ๐‘ก + ๐‘ = ๐‘ฅ(๐‘ก + ๐‘) ๐‘ƒ2 , where P is the

solution to the Lyapunov inequality:

(๐ด + ๐ต๐พ)๐‘‡๐‘ƒ ๐ด + ๐ต๐พ โˆ’ ๐‘ƒ โ‰ค โˆ’(๐‘„ + ๐พ๐‘‡๐‘…๐พ)

Page 37: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems โ€“ MPC problem

Marcello Farina 37Introduction to MPC

The resulting MPC optimization problem can be cast as a QP problem (quadratic program)

Easy to be solved by available solvers (Matlabquadprog, IBM C-Plex cplexqp)

To see how, we define

๐‘‹๐‘ก =๐‘ฅ(๐‘ก)โ‹ฎ

๐‘ฅ(๐‘ก + ๐‘), ๐‘ˆ๐‘ก =

๐‘ข(๐‘ก)โ‹ฎ

๐‘ข(๐‘ก + ๐‘ โˆ’ 1)

๐‘‹๐‘ก =๐ผโ‹ฎ๐ด๐‘

๐‘ฅ ๐‘ก +0 โ‹ฏ 0โ‹ฎ โ‹ฑ โ‹ฎ

๐ด๐‘โˆ’1๐ต โ‹ฏ ๐ต๐‘ˆ๐‘ก

And we compute that

๐’œ โ„ฌ

Page 38: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems โ€“ MPC problem

Marcello Farina 38Introduction to MPC

where

At time t the cost function is:

๐ฝ =

๐‘˜=๐‘ก

๐‘ก+๐‘โˆ’1

๐‘ฅ(๐‘˜) ๐‘„2 + ๐‘ข(๐‘˜) ๐‘…

2 + ๐‘ฅ(๐‘ก + ๐‘) ๐‘ƒ2

= ๐‘‹๐‘ก ๐’ฌ2 + ๐‘ˆ๐‘ก โ„›

2

๐’ฌ =๐‘„ โ‹ฏ 0โ‹ฎ โ‹ฑ โ‹ฎ0 โ‹ฏ ๐‘ƒ

, โ„› =๐‘… โ‹ฏ 0โ‹ฎ โ‹ฑ โ‹ฎ0 โ‹ฏ ๐‘…

We compute:

๐ฝ = ๐’œ๐‘ฅ ๐‘ก + โ„ฌ๐‘ˆ๐‘ก ๐’ฌ2 + ๐‘ˆ๐‘ก โ„›

2

= ๐‘ˆ๐‘ก๐‘‡ โ„› + โ„ฌ๐‘‡๐’ฌโ„ฌ ๐‘ˆ๐‘ก + 2๐‘ฅ(๐‘ก)๐‘‡๐’œ๐‘‡๐’ฌโ„ฌ๐‘ˆ๐‘ก + ๐‘ฅ(๐‘ก)๐‘‡๐’œ๐‘‡๐’ฌ๐’œ๐‘ฅ(๐‘ก)

datum Optimizationvariable

Independent of the optimizationvariable: it can be neglected

Page 39: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems โ€“ MPC problem

Marcello Farina 39Introduction to MPC

At time t the constraints are:

๐ด๐‘ฅ โ‹ฏ 0โ‹ฎ โ‹ฑ โ‹ฎ0 โ‹ฏ ๐ด๐‘“

๐‘ฅ(๐‘ก)โ‹ฎ

๐‘ฅ(๐‘ก + ๐‘)= ๐’œ๐‘ฅ(๐’œ๐‘ฅ ๐‘ก + โ„ฌ๐‘ˆ๐‘ก) โ‰ค

๐‘๐‘ฅโ‹ฎ๐‘๐‘“

= ๐’ท๐‘ฅ

๐ด๐‘ข โ‹ฏ 0โ‹ฎ โ‹ฑ โ‹ฎ0 โ‹ฏ ๐ด๐‘ข

๐‘ข(๐‘ก)โ‹ฎ

๐‘ข(๐‘ก + ๐‘ โˆ’ 1)= ๐’œ๐‘ข๐‘ˆ๐‘ก โ‰ค

๐‘๐‘ขโ‹ฎ๐‘๐‘ข

= ๐’ท๐‘ข

Overall:

๐’œ๐‘ข

๐’œ๐‘ฅโ„ฌ๐‘ˆ๐‘ก โ‰ค

๐’ท๐‘ข๐’ท๐‘ฅ โˆ’๐’œ๐‘ฅ๐’œ๐‘ฅ ๐‘ก

๐’œ๐‘–๐‘› ๐’ท๐‘–๐‘›(๐‘ก)

Page 40: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Linear systems โ€“ MPC problem

Marcello Farina 40Introduction to MPC

The resulting quadratic program is

min๐‘ˆ๐‘ก

๐‘ˆ๐‘ก๐‘‡ โ„› + โ„ฌ๐‘‡๐’ฌโ„ฌ ๐‘ˆ๐‘ก + 2๐‘ฅ(๐‘ก)๐‘‡๐’œ๐‘‡๐’ฌโ„ฌ๐‘ˆ๐‘ก

Subject to ๐’œ๐‘–๐‘›๐‘ˆ๐‘ก โ‰ค ๐’ท๐‘–๐‘›(๐‘ก)

To solve it we can use, e.g., the Matlab function quadprog:

X = QUADPROG(H,f,A,b)

๐‘ˆ๐‘ก

Page 41: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Outline

Motivations and main ideas

Ingredients and features of MPC regulators

Model predictive control for tracking

Model predictive control for linear systems and solution

Remarks

Marcello Farina Introduction to MPC 41

Page 42: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Remarks - advantages

Marcello Farina 42Introduction to MPC

โ€ข Possibility to account for future consequences of presentactions:โ€ข Actions are taken based on predictionsโ€ข Forecasts of disturbances and references are used

โ€ข We can naturally account for constraints:โ€ข On input variables, e.g., saturationsโ€ข On ยซinternalยป state variables, e.g., velocities, accelerationsโ€ข On ยซexternalยป state variables, e.g., position, orientation, โ€ฆ

โ€ข We can chose the optimal strategy (in some sense) in eachsituation

Page 43: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Remarks - disadvantages

Marcello Farina 43Introduction to MPC

โ€ข Especially in the non linear case, MPC optimization problemsare computationally burdensome!

โ€ข Solutions must be computed in a very short time interval(short sampling time)

โ€ข Vehicle models are frequently non linear, e.g., the (simple) unicycle model (differential drive)

แ‰

แˆถ๐‘ฅ = ๐‘ฃ cos ๐œƒแˆถ๐‘ฆ = ๐‘ฃ sin ๐œƒแˆถ๐œƒ = ๐œ”

Do we have to use a non linear MPC implementation?The MPC-based controller may be not applicable in practiceโ€ฆ

inputs

Page 44: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Remarks โ€“ linearization for vehicle applications

Marcello Farina 44Introduction to MPC

We may resort to linearization techniques.There are different possibilities:

1. Linearization around a fixed โ€“ equilibrium โ€“ point with ๐œƒ = าง๐œƒ, ๐‘ฃ = 0,๐œ” = 0.

แ‰แˆถ๐‘ฅ = ๐‘ฃ cos ๐œƒแˆถ๐‘ฆ = ๐‘ฃ sin ๐œƒแˆถ๐œƒ = ๐œ”

Not stabilizable!Besides, the linearization error would be huge!

๐›ฟ แˆถ๐‘ฅ๐›ฟ แˆถ๐‘ฆ

๐›ฟ แˆถ๐œƒ

=cos าง๐œƒ 0sin าง๐œƒ 00 1

๐›ฟ๐‘ฃ๐›ฟ๐œ”

Page 45: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Remarks โ€“ linearization for vehicle applications

Marcello Farina 45Introduction to MPC

2. Linearization around a trajectory.

In the MPC framework, at time t the trajectory, predicted N stepsforward at the previous time step (i.e., t-1) is available. We havethe sequences

๐‘ข ๐‘ก โˆ’ 1|๐‘ก โˆ’ 1 , ๐‘ข ๐‘ก|๐‘ก โˆ’ 1 ,โ€ฆ , ๐‘ข(๐‘ก + ๐‘ โˆ’ 2|๐‘ก โˆ’ 1)๐‘ฅ ๐‘ก|๐‘ก โˆ’ 1 ,โ€ฆ , ๐‘ฅ(๐‘ก + ๐‘ โˆ’ 1|๐‘ก โˆ’ 1)

The linearized (affine) model, used for computing predictions attime t, is obtained linearizing the model in each point of the available predicted trajectory, i.e., for ๐‘˜ = ๐‘ก,โ€ฆ , ๐‘ก + ๐‘ โˆ’ 1

๐‘ฅ ๐‘˜ + 1 = ๐ด ๐‘˜ ๐‘ก โˆ’ 1 ๐‘ฅ ๐‘˜ โˆ’ ๐‘ฅ ๐‘˜ ๐‘ก โˆ’ 1 +

๐ต ๐‘˜ ๐‘ก โˆ’ 1 ๐‘ข ๐‘˜ โˆ’ ๐‘ข ๐‘˜ ๐‘ก โˆ’ 1 + ๐‘ฅ(๐‘˜ + 1|๐‘ก โˆ’ 1)

๐ด ๐‘˜ ๐‘ก โˆ’ 1 = แ‰•๐œ•๐‘“

๐œ•๐‘ฅ ,๐‘ข ๐‘˜|๐‘กโˆ’1 ,๐‘ฅ ๐‘˜|๐‘กโˆ’1, ๐ต ๐‘˜ ๐‘ก โˆ’ 1 = แ‰•

๐œ•๐‘“

๐œ•๐‘ข ๐‘ข ๐‘˜|๐‘กโˆ’1 ,๐‘ฅ ๐‘˜|๐‘กโˆ’1

Page 46: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

Remarks โ€“ linearization for vehicle applications

Marcello Farina 46Introduction to MPC

3. Feedback linearization

Using a suitable internal control loop, we can make the systemโ€™s dynamic evolve as a linear system.This approach is better analyzed in the following lecture.

This approach may turn out to be prone to modellingerrors.

Page 47: Model predictive control - Introductionchrome.ws.dei.polimi.it/images/8/86/UAV_2016_Farina_Intro.pdfReceding horizon principle. Motivations and main ideas Marcello Farina Introduction

1. Model predictive control: theory and design. J. B. Rawings andD. Q. Mayne, 2009 Nob Hill Publishing.

2. Constrained model predictive control: Stability andoptimality. D. Q. Mayne, J. B. Rawlings, C. V. Rao, P. O. M.Scokaert, Automatica 36 (6), 789-814.

3. Predictive control with constraints. J. M. Maciejowski, 2001,Pearson education.

4. Advanced and multivariable control. L. Magni, R. Scattolini.Pitagora Editrice Bologna.

5. MPC for tracking piecewise constant references forconstrained linear systems. D. Limรณn, I. Alvarado, T. Alamo, E.F. Camacho, Automatica 44 (9), 2382-2387

Marcello Farina Introduction to MPC 47

References