34
Chemical and Biological Engineering MPC Introduction B. Wayne Bequette • Overview Basic Concept of MPC History • Optimization Formulation Models Analytical Solution to Unconstrained Problem • Summary Limitations & a Look Ahead

MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

  • Upload
    votu

  • View
    224

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

Chemical and Biological Engineering

MPC Introduction

B. Wayne Bequette

•  Overview •  Basic Concept of MPC •  History

•  Optimization Formulation •  Models •  Analytical Solution to Unconstrained Problem

•  Summary •  Limitations & a Look Ahead

Page 2: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Motivation: Complex Processes

LC

PC

PC PC PC

LC LC

LC

cooling water

Toluene

Hydrogen

purge Hydrogen, Methane

fuel gas

steam

steamsteam

Diphenyl

Benzene product

CH4

Recycle Toluene

CC

TC

TC

Reactor

Rec

ycle

Col

um

n

Ben

zene

Col

umn

Sta

bili

zer

Fla

sh

Recycle Compressor

cooling water

CW

CW

quenchTC

LC LC

LCTC

open

FC

FC

FC

FC

TC

CC

TC

Page 3: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Important Issues in Petroleum Refining

l  Multivariable, Large Scale Ø  Challenge to tune individual SISO controllers

l  Operation at Constraints Ø  Anti-reset windup and other strategies for PID

l  Economic Payout for Advanced Control Ø  Economic return justifies capital and on-going maintenance costs

l  Model Predictive Control Ø  Evolved independently in the US and France refining industry

Page 4: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

How is MPC used? Unit 1 - PID Structure

Global Steady-State Optimization (every day)

Local Steady-State Optimization (every hour)

Dynamic Constraint Control (every minute)

Supervisory Dynamic Control (every minute)

Basic Dynamic Control (every second)

Plant-Wide Optimization

Unit 1 Local Optimization Unit 2 Local Optimization

High/Low Select Logic

PID Lead/Lag PID

SUM SUM

Model Predictive Control (MPC)

Unit 1 Distributed Control System (PID)

Unit 2 Distributed Control System (PID)

FC PC

TC LC

FC PC

TC LC

Unit 2 - MPC Structure

From Tom Badgwell, 2003 Spring AIChE Meeting, New Orleans

Page 5: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Model Predictive Control (MPC)

t kcurrent step

setpoint

yactual outputs (past)

PPrediction Horizon

past control moves

u

max

min

MControl Horizon

past future

model prediction

t k+1current step

setpoint

yactual outputs (past)

PPrediction Horizon

past control moves

u

max

min

MControl Horizon

model prediction from k

new model prediction

Find current and future manipulated inputs that best meet a desired future output trajectory. Implement first “control move”.

l  Type of model for predictions? l  Information needed at step k for predictions? l  Objective function and optimization technique? l  Correction for model error?

Chapter 16

Page 6: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Model Predictive Control (MPC)

t kcurrent step

setpoint

yactual outputs (past)

PPrediction Horizon

past control moves

u

max

min

MControl Horizon

past future

model prediction

t k+1current step

setpoint

yactual outputs (past)

PPrediction Horizon

past control moves

u

max

min

MControl Horizon

model prediction from k

new model prediction

At next sample time:

Correct for model mismatch, then perform new optimization.

This is a major issue – “disturbances” vs. model uncertainty

Find current and future manipulated inputs that best meet a desired future output trajectory. Implement first “control move”.

Page 7: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

MPC History l  Intuitive

Ø  Basically arose in two different “camps”

l  Dynamic Matrix Control (DMC) Ø  1960’s and 1970’s – Shell Oil - US

Ø  Related to techniques developed in France (IDCOM)

Ø  Large-scale MIMO

Ø  Formulation for constraints important

l  Generalized Predictive Control (GPC) Ø  Evolved from adaptive control

Ø  Focus on SISO, awkward for MIMO

Charlie Cutler

(1976)

Page 8: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Objective Functions

( ) ∑∑−

=+

=++ Δ+−=

1

0

2

1

2ˆM

iik

P

iikik uwyrJ

Quadratic Objective Function, Prediction Horizon (P) = 3, Control Horizon (M) = 2

With linear models, results in analytical solution (w/o constraints)

General Representation of a Quadratic Objective Function

( ) ( ) ( )21

2

233

222

211 ˆˆˆ

+

++++++

Δ+Δ+

−+−+−=

kk

kkkkkk

uwuwyryryrJ

Weight 2 control moves

3 steps into future

Page 9: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Alternative Objective Functions

( ) ∑∑−

=+

=++ +−=

1

0

2

1

2ˆM

iik

P

iikik uwyrJ

∑∑−

=+

=++ Δ+−=

1

01

ˆM

iik

P

iikik uwyrJ

Penalize u rather than Δu

Sum of absolute values (results in LP)

Will usually result in “offset”

Existing LP methods are efficient, but solutions hop from one constraint to another

Page 10: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Models

l  State Space l  ARX (auto-regressive, exogenous input) l  Step Response l  Impulse (Pulse) Response

l  Nonlinear, Fundamental (First-Principles) l  ANN (Artificial Neural Networks) l  Hammerstein (static NL with linear dynamics) l  Volterra l  Multiple Model

Page 11: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Discrete Linear Models used in MPC

∞−∞+−−+−−

=−

+++++=

=∑

kNNkNNkNk

iikik

uhuhuhuh

uhy

1111

1

kk

kkk

Cxyuxx

=

Γ+Φ=+1 State Space

Input-Output (ARX) mkmkkk

nknkkk

ububububyayayay

−−−

−−−

++++

+−−−−=

22110

2211

Step Response

usually b0 = 0

Some texts/papers have different sign conventions

Impulse Response

∞−∞+−−+−−

=−

Δ++Δ+Δ++Δ=

Δ=∑

kNNkNNkNk

iikik

usususus

usy

1111

1

Page 12: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

-2 0 2 4 6 8

0

0.5

1

1.5

2

temp, deg C

discrete-time step

-2 0 2 4 6 8

0

0.2

0.4

0.6

0.8

1

discrete-time step

psig

s 1

ss

s

s

2

45

3Etc.

S = s1 s2 s3 s4 s5 L sN[ ]T

Example Step Response Model

Used in DMC

Page 13: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

-2 0 2 4 6 8 10

0

0.2

0.4

0.6

0.8

1

discrete-time step

psig

-2 0 2 4 6 8 10-0.2

0

0.2

0.4

0.6

0.8

1

discrete-time step

temp, deg Ch

hh

1

23

hi = si − si−1

si = hjj=1

i

Example Impulse Response Model

Impulse and step response coefficients are related

Used in IDCOM

Page 14: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Step & Impulse Models from State Space Models

ΓΦ= −1ii CH

∑∑==

− =ΓΦ=k

ii

k

i

ik HCS

11

1

kk

kkk

Cxyuxx

=

Γ+Φ=+1

Page 15: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

MPC based on State Space Models

kk

kkk

xCyuxx

1

=

Γ+Φ=+

with known current state, easy to propagate estimates

kkkk

kkk

uCxCCxyuxx

Γ+Φ==

Γ+Φ=

++

+

11

1

and, using control changes

kkkk

kkk

uCuCxCyuuu

ΓΔ+Γ+Φ=

Δ+=

−+

11

1

Page 16: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Use ^ notation for model states

kkkkkk uCuCxCy ΓΔ+Γ+Φ= −+ 1||1 ˆˆ

Measurements through k

Estimate at k+1 Estimate at k

Measurements through k

Predicted output

State estimate

Previous input

Current Input change

Now, propagate the prediction for P steps into the future

Page 17: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Output Predictions

response "forced"

1

1

1

1

1

1

1

made) are moves control more no (if response" unforced"or "free"

1

1

1

|

2

|

|2

|1

0000

ˆ

ˆ

ˆˆ

⎥⎥⎥⎥

⎢⎢⎢⎢

Δ

Δ

Δ

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

ΓΦΓΦ

ΓΓ+ΦΓ

Γ

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

ΓΦ

Γ+ΦΓ

Γ

+

⎥⎥⎥⎥

⎢⎢⎢⎢

Φ

Φ

Φ

=

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

−+

+

=

=

=

+

+

+

∑∑

Mk

k

k

P

i

iP

i

i

kP

i

i

kk

PkPk

kk

kk

u

uu

CC

CCCC

u

C

CCC

x

C

CC

y

yy

fSfuΔ

fY

Page 18: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Output Predictions

response "forced"

1

1

11

12

1

made) are moves control more no (if response" unforced"or "free"

12

1

|

2

|

|2

|1

0000

ˆ

ˆ

ˆˆ

⎥⎥⎥⎥

⎢⎢⎢⎢

Δ

Δ

Δ

⎥⎥⎥⎥

⎢⎢⎢⎢

⎥⎥⎥⎥

⎢⎢⎢⎢

+

⎥⎥⎥⎥

⎢⎢⎢⎢

Φ

Φ

Φ

=

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

−+

+

+−−

+

+

+

Mk

k

k

MPPP

k

P

kk

PkPk

kk

kk

u

uu

SSS

SSS

u

S

SS

x

C

CC

y

yy

fSfuΔ

fY

Step response coefficients

Page 19: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Optimization Problem

( ) ( ) Tik

M

i

uTik

P

ikikkik

yTkikkiku

uWuyrWyrJf

+

=+

=++++

ΔΔΔ+−−= ∑∑

1

01|||| ˆˆmin

⎥⎥⎥

⎢⎢⎢

=y

y

Y

W

WW

000000

⎥⎥⎥

⎢⎢⎢

=u

u

U

W

WW

000000

EWE YT ˆˆf

UTf uWu ΔΔ

Where

ff uSfrYrE Δ−−=−= ˆˆE

ff uSEE Δ−=ˆ

and

so

“unforced” (free response) error

future setpoints

Page 20: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Optimization Problem

( ) ( )ff

YTf

Tf

YTf

Tf

YT

ffYT

ffYT

uSWSuEWSuEWE

uSEWuSEEWE

ΔΔ+Δ−=

Δ−Δ−=

2

ˆˆ

fUT

f uWu ΔΔ+=Δ

Jfu

min EWE YT ˆˆ

( ) EWSuuWSWSu YTf

Tff

Uf

YTf

Tf Δ−Δ+Δ 2=

ΔJ

fumin

so

can be written

0=Δ∂∂ fuJ

and the unconstrained solution is found from

Page 21: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Unconstrained Solution

In practice, do not actually invert a matrix. Solve as set of simultaneous equations (or use \ in MATLAB)

( ) EWSWSWSu YTf

Uf

YTff \+=Δ

Analytical Solution for Unconstrained System

( ) EWSWSWSu YTf

Uf

YTff

1−+=Δ

“unforced” error

Page 22: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Vector of Control Moves

moves future andcurrent

1

1

⎥⎥⎥⎥

⎢⎢⎢⎢

Δ

Δ

Δ

−+

+

Mk

k

k

f

u

uu

u

Although a set of control moves is computed, only the first move is implemented The next output at k+1 is obtained, then a new optimization problem is solved

kuΔ

Page 23: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

MPC Tuning Parameters

l  Prediction Horizon, P

l  Control Horizon, M

l  Manipulated Input Weighting, Wu

Usually, P >> M for robustness (less aggressive action). Sometimes M = 1, with P varied for desired performance. Sometimes larger input weights for robustness

Page 24: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Pre-Summary

l  Concise overview of MPC l  State space model, unconstrained solution l  Have not discussed

Ø  State estimation and “corrected outputs”

n  The additive disturbance assumption of DMC is covered in the slides that follow (this is identical to the plant-model mismatch term in IMC)

Ø  Disturbances

Ø  Constraints

Ø  Other model forms

Page 25: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Original DMC Approach to Plant-Model Mismatch

kkkkkk

kkkkk

pyyyyp

|1||

1||

ˆˆˆˆˆ

+=

−=

1|1|

11|11|

ˆˆˆˆ

−−

−−−−

=

Γ+Φ=

kkkk

kkkkk

xCyuxx

Notice that Model States are Not “Corrected”

1|| ˆˆ −= kkkk xx

Prediction at step k, based on information at k-1

Model output predicted from k-1

Measured output “additive output”

disturbance assumption (previously dk)

Forces the model “corrected output” equal to measured output

Page 26: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Model Prediction to k+1

kkkkkk

kkkkk

kkkkkk

kkkk

kkkkk

puCuCxCpuCxC

pxCypp

uxx

|11|

|1|

|1|1|1

||1

||1

ˆˆˆˆ

ˆˆˆˆˆˆˆ

+−

+

+++

+

+

+ΓΔ+Γ+Φ=

+Γ+Φ=

=+=

=

Γ+Φ=Assumes future corrections equal to current correction

Page 27: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Continue Output Predictions

response "forced"

1

1

1

1

1

1

1

made) are moves control more no (if response" unforced"or "free"

1

1

1

||

2

|

|2

|1

0000

ˆˆ

ˆ

ˆˆ

⎥⎥⎥⎥

⎢⎢⎢⎢

Δ

Δ

Δ

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

ΓΦΓΦ

ΓΓ+ΦΓ

Γ

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

ΓΦ

Γ+ΦΓ

Γ

+

⎥⎥⎥⎥

⎢⎢⎢⎢

+

⎥⎥⎥⎥

⎢⎢⎢⎢

Φ

Φ

Φ

=

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

−+

+

=

=

=

+

+

+

∑∑

Mk

k

k

P

i

iP

i

i

kP

i

i

kkkk

PkPk

kk

kk

u

uu

CC

CCCC

u

C

CCC

p

I

II

x

C

CC

y

yy

fSfuΔ

fY

Page 28: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Output Predictions

response "forced"

1

1

11

12

1

made) are moves control more no (if response" unforced"or "free"

12

1

||

2

|

|2

|1

0000

ˆˆ

ˆ

ˆˆ

⎥⎥⎥⎥

⎢⎢⎢⎢

Δ

Δ

Δ

⎥⎥⎥⎥

⎢⎢⎢⎢

⎥⎥⎥⎥

⎢⎢⎢⎢

+

⎥⎥⎥⎥

⎢⎢⎢⎢

+

⎥⎥⎥⎥

⎢⎢⎢⎢

Φ

Φ

Φ

=

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

−+

+

+−−

+

+

+

Mk

k

k

MPPP

k

P

kkkk

PkPk

kk

kk

u

uu

SSS

SSS

u

S

SS

p

I

II

x

C

CC

y

yy

fSfuΔ

fY

Page 29: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Cain F

Cb F

Example Inverse Response Process: Van de Vusse

Constant V,T, ρ

A B C k1 k2

A+A D k3

dCa dt = -k1Ca - k3Ca2 + (Cain - Ca)u

dCb dt = k1Ca - k2Cb - Cbu where u = F/V

Page 30: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Example: Inverse Response Process

0 10 20 30 40 50-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

discrete time index, i

s(i)

step response coefficients

First four coefficients are negative

Sum of first eight coefficients is positive

Page 31: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Closed-Loop: Compare P=10, M=1 with P=25, M=1

0 1 2 3 4 5 6-0.5

0

0.5

1

1.5

y, m

ol/l

time, min

0 1 2 3 4 5 6

0

1

2

3

u, m

in- 1

time, min

P = 10, M = 3P = 25, M = 1

P = 10, M = 3P = 25, M = 1

Short prediction horizons & long control horizons lead to more aggressive action

Page 32: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Results

0 1 2 3 4 5 6-1.5

-1

-0.5

0

0.5

1

1.5

y, m

ol/l

time, min

P = 8P = 7

0 1 2 3 4 5 6-6

-4

-2

0

2

u, m

in- 1

time, min

P = 8P = 7

Control Horizon: M = 1, Weighting: W = 0

P=7: Unstable

Page 33: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Stability of Inverse Response Systems with DMC

l  For a control horizon, M = 1, closed-loop MPC will be stable for a prediction horizon where the sum of the impulse response coefficients has the same sign as the process gain

0min

1>∑

=

P

iis

For the example, Pmin = 8, so P = 7 = unstable

Page 34: MPC Introduction - NTNU€¦ · MPC Introduction B. Wayne Bequette ... " Anti-reset windup and other strategies for PID ! ... covered in the slides that follow

B. Wayne Bequette

Summary

l  Concise overview of MPC l  State space model, unconstrained solution l  The additive disturbance assumption of DMC is

used for plant-model mismatch l  Upcoming topics

Ø  Disturbances and state estimation (Kalman filtering framework)

Ø  Constraints

Ø  Other model forms