Fast Model Predictive Control (MPC)"!

Fast Model Predictive Control (MPC)" ! Manfred Morari! ! with thanks to ! Colin Jones, Paul Goulart, ! Alex Domahidi, Stefan Richter! and many other c...
Author: Lucy Reynolds
25 downloads 3 Views 6MB Size
Fast Model Predictive Control (MPC)" ! Manfred Morari! ! with thanks to ! Colin Jones, Paul Goulart, ! Alex Domahidi, Stefan Richter! and many other collaborators! ! Automatic Control Laboratory, ETH Zürich!

Fast Model Predictive Control (MPC)" ! Manfred Morari! ! with thanks to ! Colin Jones, Paul Goulart, ! Alex Domahidi, Stefan Richter! and many other collaborators! ! Automatic Control Laboratory, ETH Zürich!

4f,p2. +*,

problem: The servocompensator,” Auromruica, vol. 11, pp. 461471, 1975. E. J. Davison, “Multivariable tuning regulators: The feedforward and robust control of a general servomechanism problem,” ZEEE Trans. A m o m . Conrr., vol. AC-21, pp. 3547, Feb. 1976. B. Francis, private communication.

My first “encounter” with Keith….!

exactly the d. ity condia system’s compensa-

equired to 4)is signifirem 1 and nd (7), the the case of es as r3p3 p< max

s basically e operating

Characterizationof Structural Controllability K. GLOVER, MEMBER, IEEE, AND L. M. SILVERMAN, MEhFBER,IEEE

Abstract-A self-containedalgebraicderivation of the necessary and sufficient conditions for a multiinput system with a fiied zero structnre to be stroetorally controllable is given. In addition, a new recursive test for determining structural controllability which utilizes only Boolean operations is obtained. IEEE TRANMCTIONS ON AUTOMATIC CONTROL, I. INTRODUCTION

AUGUST

1976

Consider the time invariant system

REFERENCES

i(f)=Ax(t)+Bu(t)

(1.1)

E. J. Davison, “Tbe feedforward, feedback and robust control of a general servomechanism proble-Part I,” presented at the 11th Ann. Allenon Conf.

where A is n X n and B is n X r. In many modeling problems the matrices

Published: 20.09.13

Campus

Share Share More

Lino Guzzella appointed President of ETH Zurich The Swiss Federal Council has appointed Lino Guzzella, ETH Rector and Professor of Thermotronics, as the future ETH President. He will be taking over from Ralph Eichler who is retiring at the end of 2014. By taking this decision, the Swiss Government has endorsed the unanimous proposal made by the ETH Board.

Norbert Staub

ETH President Ralph Eichler (r) congratulates his successor on his election. "I am very happy and proud at the confidence which the Federal Council and ETH Board have placed in me", Lino Guzzella

The timetable for the election of the next President of ETH Zurich stipulated that the ETH Board was to submit a proposal to the Swiss Federal Council in winter 2013/14. In fact everything went ahead faster than anticipated. By midApril 2013, the closing date for submissions, a total of some 50 applications and third party nominations were received in response to the ETH Board’s announcement of the vacancy. The ETH Board went on to assess and short list the candidates with the participation of two consultative

Fast Model Predictive Control (MPC)" ! Manfred Morari! ! with thanks to ! Colin Jones, Paul Goulart, ! Alex Domahidi, Stefan Richter! and many other collaborators! ! Automatic Control Laboratory, ETH Zürich!

Synthesis of Optimal Control Laws! Infinite-Horizon Optimal Control J (x) = min

ui ⇤U



l(xi , ui )

i=0

s.t. xi+1 = f (xi , ui ) xi

Dynamic Programming J (x) = min l(x, u) + J (f (x, u)) u

s.t. (f (x, u), u) ⇥ X

U

X

• Challenge is computation!!

Synthesis of Optimal Control Laws! Infinite-Horizon Optimal Control J (x) = min

ui ⇤U



l(xi , ui )

i=0

s.t. xi+1 = f (xi , ui ) xi

Dynamic Programming J (x) = min l(x, u) + J (f (x, u)) u

s.t. (f (x, u), u) ⇥ X

U

X

• Challenge is computation!! • Closed-form solution for linear systems, no constraints only: " LQR,…!

Synthesis of Optimal Control Laws! Infinite-Horizon Optimal Control J (x) = min

ui ⇤U



l(xi , ui )

i=0

s.t. xi+1 = f (xi , ui ) xi

Dynamic Programming J (x) = min l(x, u) + J (f (x, u)) u

s.t. (f (x, u), u) ⇥ X

U

Explicit calculation of control law u (x) !offline!

X

Model Predictive Control J ⇤ (x0 ) = min ui

N X

l(xi , ui ) + Vf (xN )

i=0

s.t. (xi , ui ) 2 X ⇥ U, xN 2 Xf xi+1 = f (xi , ui )

Online optimization problem defines control action u0 (x)

Model Predictive Control : Properties! Theory is well-established! Mayne, Rawlings, Rao, Scokaert (2000), Automatica ! “MPC: Stability & Optimality (Survey Paper). “! ! •  Recursive feasibility: Input and state constraints are satisfied! •  Stability of the closed-loop system! –  J (x) is a convex Lyapunov function! •  Assuming the real-time optimization problem is solved to #-optimality!

Embedded Model Predictive Control! Traditional MPC!

Embedded MPC!

•  Successful in process industries! •  Sampling times of minutes! •  Powerful computing platforms!

•  Small, high performance plants! •  Sampling times of ms to ns! •  Limited embedded platform! 17

Embedded Systems by the Numbers! Worldwide unit shipments of embedded computing platforms:!

billions

12 10 8 6 4 2 0

others

32 bit, networked, OS

2010 2011 2012 2013 2014 2015

!

Source: Intelligent Systems: The Next Big Opportunity, IDC 2011!

ARM s 32-bit embedded systems growing at 20% p.a.! Source: Keith Clarke, ARM Vice President, Keynote at CDNLive, May 2013 !

New opportunity for automated decision making based on optimization! 18

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

Approx. Explicit MPC

Interior Point Opt.

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

Approx. Explicit MPC

Interior Point Opt.

Explicit MPC : Online => Offline Processing! •  Optimization problem is parameterized by state! •  Control law piecewise affine for linear systems/constraints! •  Pre-compute control law as function of state x" (parametric optimization)! u (x)

Result : Online computation " !dramatically reduced! N

u (x0 ) = argmin ui

l(xi , ui ) + Vf (xN ) i=0

s.t. (xi , ui ) ⇥ X U xi+1 = f (xi , ui ) xN ⇥ Xf [M.M. Seron, J.A. De Doná and G.C. Goodwin, 2000] [T.A. Johansen, I. Peterson and O. Slupphaug, 2000] [A. Bemporad, M. Morari, V. Dua and E.N. Pistokopoulos, 2000]

x1

x2

Explicit MPC : Fast online evaluation! •  Online evaluation reduced to:! 1.  1 Point location! 2.  2 Evaluation of affine function!

•  Online complexity is governed by point location! –  Function of number of regions in cell complex! –  Milli- to microseconds possible if small number of regions! 1

2

u (x) = xT

x

⇥ 0.47 + 0.98 1.37

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

•  Small problems •  Simple •  High speed Approx. Explicit MPC

Interior Point Opt.

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

•  Small problems •  Simple •  High speed Approx. Explicit MPC •  Medium size •  Specified complexity •  High speed

Interior Point Opt.

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

•  Small problems •  Simple •  High speed Approx. Explicit MPC •  Medium size •  Specified complexity •  High speed

Interior Point Opt.

Fast Gradient Method : Time bound to ε-optimality! •  ε-solution in imin steps!

imin •  κ condition number! •  δ measure of initial error!

•  Asdf



⇧ ⇥⇧ ⇧ ⇧

Cold start = LR2 /2

•  R : radius of feasible set •  Easy to compute

ln ln 1





⌃ ⌥ ⇥⌃ 1 ⌃ ⇤ ⌃

[Y. Nesterov, 1983] [S. Richter, C.N. Jones and M. Morari, CDC 2009]

•  asdf

Warm start

= 2 max JN (Uw ; x) x⇥X0

JN (x)

•  Uw : Warm start solution •  Worst distance measured in terms of initial cost •  Hard to compute

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

•  Small problems •  Simple •  High speed Approx. Explicit MPC •  Medium size •  Specified complexity •  High speed

•  Large problems •  Less simple •  Deterministic computation time Interior Point Opt.

Verifiable Control Synthesis! Offline

Online

Explicit MPC

1st Order–Fast Gradient

•  Small problems •  Simple •  High speed Approx. Explicit MPC •  Medium size •  Specified complexity •  High speed

•  Large problems •  Less simple •  Deterministic computation time Interior Point Opt.

Convex Multistage Problem! N

minimize i=1

subject to v i Ai vi

1 T vi Hi vi + fiT vi 2 vi

upper/lower bounds!

v¯i bi

T viT Qi,j vi + li,j vi

affine inequalities!

ri,j

Ci vi + Di+1 vi+1 = ci

where Hi , Qi,j

separable objective!

quadratic inequalities! affine equalities, each coupling only two consecutive variables!

0 and Ai has full row rank!

Captures MPC, MHE, portfolio optimization, spline optimization, etc.!

The FORCES Code Generator! Embedded Hardware!

Multistage QCQP! N 1 T i=1 2 vi Hi vi

min s.t.

zi Ai vi

vi

+ fiT vi

v¯i

Generated Code! Solver (ANSI-C)!

?

bi

T viT Qi,j vi + li,j vi

ri,j

Ci vi + Di+1 vi+1 = ci

Problem description! stage = MultiStageProblem(N+1); for i = 1:N+1 % dimensions stages(i).dims.n = 10; stages(i).dims.r = 5; stages(i).dims.lb = 3; % cost stages(i).cost.H = Hi; stages(i).cost.f = fi; % inequalities stages(i).ineq.b.lbidx = 3:5; stages(i).ineq.b.lb = zeros(3,1); % equalities stages(i).eq.C = Ci; stages(i).eq.c = ci; stages(i).eq.D = Di; end generateCode(stages);

•  C code generation of primal-dual Mehrotra interior point solvers! •  LPs, QPs, QCQPs!

solver.h! solver.c! solver.m! solvermex.c! makemex!

MATLAB MEX interface" for rapid prototyping!

•  Parametric problems! •  Multi-core platforms! •  Library-free! •  Available: forces.ethz.ch!

62

Speedups Compared to IBM s CPLEX! •  Standard MPC problem for oscillating" chain of masses (on Intel i5 @3.1 GHz)! •  CPLEX N/A on embedded systems! FORCES! Solve time: 90 $s Code size: 52 KB!

80x!

CPLEX! Solve time: 5470 $s Code size: 11700 KB!

10x!

2x!

63

Some Early Users of FORCES! Nonlinear MPC & MHE with ACADO! Milan Vukov, KU Leuven, 2012!

MPC for Wind Turbines! Marc Guadayol, ALSTOM, 2012!

Quadrotor Control! Marc Müller, IDSC, ETH Zurich, 2012!

Adaptive MPC for Belt Drives! Kim Listmann, ABB Ladenburg, 2012!

64

Micro-scale Race Cars! •  1:43 scale cars – 106mm! •  Top speed: 5 m/s " !(774 km/h scale speed)! •  Full differential steering! •  Position-sensing: External vision! •  50 Hz sampling rate!

Project goals: 1.  Plan optimal path online in dynamic race environment 2.  Demonstrate real-time control optimizing car performance 3.  Beat all human opponents! Challenges: Interaction with multiple unpredictable opponents Highly nonlinear dynamics High-speed planning and control

System Details! Camera System

Embedded Board

Tracks

•  Custom built high grip track •  •  •  • 

Infrared spotlight Reflectors on cars 3.36 mm accuracy 100 Hz update rate at 1024 x 1200 pixels

•  •  •  •  • 

Custom built electronics Bluetooth communication IMUs & Gyro H-bridges for DC Motors ARM Cortex M4

•  Standard RCPtracks track

h!p://orcaracer.ethz.ch

Car Model and Model Analysis! Model Analysis

Car Model Bicycle model with nonlinear lateral tire friction laws using a simplified Pacejka tire model:

Analysis of zero accelerations (for fixed velocities) yield bifurcation:

x˙ = vx cos

vx = const ˙ =0 v˙ y = 0

yaw rate [rad/s]

lateral speed vy [m/s]

= const

vy sin

y˙ = vx sin + vy cos ˙= 1 v˙ x = (Frx (D) Ff y sin + mvy ˙ ) m 1 v˙ y = (Fry ( r ) + Ff y cos mvx ˙ ) m 1 ˙ = ( Fry lr + Ff y cos lr ) Jz

steering angle δ [rad]

steering angle δ [rad]

Stationary velocities for vx = 1.5

Stationary trajectories are circles, where the radius is related to the forward velocity and the yaw rate

Path Planner and MPC! •  Trajectory tracking MPC formulation:! –  re-linearizing the dynamics around trajectory! –  linear constraints to stay on track / avoid obstacles! –  6 states, 2 inputs, horizon 16! N

1

min

(xi

T xref i ) Q(xi

xref i ) + (ui

T uref i ) R(ui

uref i ) + (xN

T xref N ) P (xN

xref N )

i=0

s.t. x0 = x xi+1 = Ai xi + Bi ui + gi G i x i hi (xi , ui ) X U

•  Computation times on Intel Core i7 CPU @2.5 GHz:! Reference trajectory generation!

4.13 ms!

Problem data generation!

1.19 ms!

Solving QP with CPLEX!

6.00 ms!

Solving QP with FORCES!

0.83 ms!

3.3 ms on ARM Cortex A9 @1.7 GHz

Autonomous RC Racing Using FORCES! • 

Reference tracking MPC solved in 3.3 ms on ARM Cortex A9 based chip!

[A. Liniger, 2013]!

Applications by the Automatic Control Lab! 18 ns 10 µs

!Multi-core thermal management (EPFL)" ! ![Zanini et al 2010] ! !Voltage source inverters !" !

20 µs !

25 µs

![Mariethoz et al 2008]!

!DC/DC converters (STM) !

!"

![Papafotiou 2007]!

50 µs

!AC / DC converters

5 ms

!Electronic throttle control (Ford) !!

!

20 ms

!

!

40 ms

![Vasak et al 2006]!

!"

![Borrelli et al 2001]! !!

!Autonomous vehicle steering (Ford)" !

500 ms

!"

!Micro-scale race cars " !

50 ms

![Richter et al 2010]!

!Traction control (Ford) !

!!

![Mariethoz et al 2008]!

!Direct torque control (ABB) !

!

![Besselmann et al 2008]!

!Energy efficient building control (Siemens) !" !

![Oldewurtel et al 2010]!

Online MPC at Megahertz Rates using FPGAs! Hardware architectures for fast-gradient and ADMM methods parameterized by:!

Fixed-point arithmetic analysis:! •  ensures reliable operation!

•  Degree of parallelism!

•  Solution accuracy specs

•  Fixed-point computing precision!

# bits!

! Convergence rate of ADMM

0

10

−1

10

−2

10

~250 variable optimization problem:! State-of-the-art:!

FPGAs:!

✦ 

~5 ms!

✦ 

~0.5 $s !

✦ 

Desktop @ 3GHz!

✦ 

Embedded @ 400MHz!

~70 Watts!

✦ 

✦ 

~5 Watts!

||z ∗ (ˆ x) − zˆi ||2

−3

10

−4

10

−5

10

−6

10

double b=18 b=24 b=32

−7

10

−8

10

10

20

30 40 50 60 70 Number of ADMM iterations i

80

90

100

77

Online MPC at Megahertz Rates using FPGAs! MPC of an Atomic Force Microscope, in collaboration with IBM!

y

cantilever

r

sample

d u

Piezo plate actuator

✓  Same tracking performance as double precision state-of-the-art solver!

✓  700 kilohertz on 1 Watt FPGA! ✓  >1 megahertz on high-performance FPGA !

Jerez, Goulart, Richter, Constantinides, Kerrigan, Morari Embedded Predictive Control on an FPGA using the Fast Gradient Method”, in ECC 2013 78

Conclusions! •  Computation technology is not limiting the application of MPC at any speed for any size problem! •  When and where to employ MPC in industry is still a matter of judgment (modeling, maintenance, robustness)!

!

Thank you, Keith!