• 검색 결과가 없습니다.

Model Predictive Control Toolbox

N/A
N/A
Protected

Academic year: 2022

Share "Model Predictive Control Toolbox"

Copied!
250
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Computation Visualization Programming

For Use with M ATLAB

®

Model Predictive Control Toolbox

User’s Guide

Version 1

Manfred Morari N. Lawrence Ricker

(2)

How to Contact The MathWorks:

508-647-7000 Phone

508-647-7001 Fax

The MathWorks, Inc. Mail 3 Apple Hill Drive

Natick, MA 01760-2098

http://www.mathworks.com Web

ftp.mathworks.com Anonymous FTP server comp.soft-sys.matlab Newsgroup

support@mathworks.com Technical support

suggest@mathworks.com Product enhancement suggestions bugs@mathworks.com Bug reports

doc@mathworks.com Documentation error reports subscribe@mathworks.com Subscribing user registration

service@mathworks.com Order status, license renewals, passcodes info@mathworks.com Sales, pricing, and general information Model Predictive Control Toolbox User’s Guide

COPYRIGHT 1995 - 1998 by The MathWorks, Inc.

The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form without prior written consent from The MathWorks, Inc.

FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain to the government’s use and disclosure of the Program and Documentation, and shall supersede any conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks.

MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language Compiler is a trademark of The MathWorks, Inc.

Other product or brand names are trademarks or registered trademarks of their respective holders.

Printing History: January 1995 First printing October 1998 Revised (Online only)

(3)

i

Contents

Preface

1

Tutorial

Introduction . . . 1-2 Target Audience for the MPC Toolbox . . . 1-3 System Requirements . . . 1-3

2

MPC Based on Step Response Models

Step Response Models . . . 2-2

Model Identification . . . 2-6

Unconstrained Model Predictive Control . . . 2-11

Closed-Loop Analysis . . . 2-18

Constrained Model Predictive Control . . . 2-20

Application: Idle Speed Control . . . 2-22 Process Description . . . 2-22 Control Problem Formulation . . . 2-22 Simulations . . . 2-24 Application: Control of a Fluid Catalytic Cracking Unit . 2-31 Process Description . . . 2-31 Control Problem Formulation . . . 2-33

(4)

ii Contents

Simulations . . . 2-34 Step Response Model . . . 2-34 Associated Variables . . . 2-36 Unconstrained Control Law . . . 2-36 Constrained Control Law . . . 2-36

3

MPC Based on State-Space Models

State-Space Models . . . 3-2 Mod Format . . . 3-3 SISO Continuous-Time Transfer Function to Mod Format . . . . 3-3 SISO Discrete-Time Transfer Function to Mod Format . . . 3-6 MIMO Transfer Function Description to Mod Format . . . 3-7 Continuous or Discrete State-Space to Mod Format . . . 3-9 Identification Toolbox (“Theta”) Format to Mod Format . . . 3-9 Combination of Models in Mod Format . . . 3-10 Converting Mod Format to Other Model Formats . . . 3-10 Unconstrained MPC Using State-Space Models . . . 3-12

State-Space MPC with Constraints . . . 3-20

Application: Paper Machine Headbox Control . . . 3-26 MPC Design Based on Nominal Linear Model . . . 3-27 MPC of Nonlinear Plant . . . 3-38

4

Command Reference

Commands Grouped by Function . . . 4-2

Index

(5)

Preface

(6)

Preface

iv

Acknowledgments

The toolbox was developed in cooperation with: Douglas B. Raven and Alex Zheng

The contributions of the following people are acknowledged: Yaman Arkun, Nikolaos Bekiaris, Richard D. Braatz, Marc S. Gelormino, Evelio Hernandez, Tyler R. Holcomb, Iftikhar Huq, Sameer M. Jalnapurkar, Jay H. Lee, Yusha Liu, Simone L. Oliveira, Argimiro R. Secchi, and Shwu-Yien Yang

We would like to thank Liz Callanan, Jim Tung and Wes Wang from the MathWorks for assisting us with the project, and Patricia New who did such an excellent job putting the manuscript into LATEX.

(7)

About the Authors

v

About the Authors

Manfred Morari

Manfred Morari received his diploma from ETH Zurich in 1974 and his Ph.D.

from the University of Minnesota in 1977, both in chemical engineering.

Currently he is the McCollum-Corcoran Professor and Executive Officer for Control and Dynamical Systems at the California Institute of Technology.

Morari’s research interests are in the areas of process control and design. In recognition of his numerous contributions, he has received the Donald P.

Eckman Award of the Automatic Control Council, the Allan P. Colburn Award of the AIChE, the Curtis W. McGraw Research Award of the ASEE, was a Case Visiting Scholar, the Gulf Visiting Professor at Carnegie Mellon University and was recently elected to the National Academy of Engineering. Dr. Morari has held appointments with Exxon R&E and ICI and has consulted

internationally for a number of major corporations. He has coauthored one book on Robust Process Control with another on Model Predictive Control in preparation.

N. Lawrence Ricker

Larry Ricker received his B.S. degree from the University of Michigan in 1970, and his M.S. and Ph.D. degrees from the University of California, Berkeley, in 1972/78. All are in Chemical Engineering. He is currently Professor of

Chemical Engineering at the University of Washington, Seattle. Dr. Ricker has over 80 publications in the general area of chemical plant design and operation.

He has been active in Model Predictive Control research and teaching for more than a decade. For example, he published one of the first nonproprietary studies of the application of MPC to an industrial process, and is currently involved in a large-scale MPC application involving more than 40 decision variables.

(8)

Preface

vi

(9)

1

Tutorial

(10)

1

Tutorial

1-2

Introduction

The Model Predictive Control (MPC) Toolbox is a collection of functions (commands) developed for the analysis and design of model predictive control (MPC) systems. Model predictive control was conceived in the 1970s primarily by industry. Its popularity steadily increased throughout the 1980s. At present, there is little doubt that it is the most widely used multivariable control algorithm in the chemical process industries and in other areas. While MPC is suitable for almost any kind of problem, it displays its main strength when applied to problems with:

• A large number of manipulated and controlled variables

• Constraints imposed on both the manipulated and controlled variables

• Changing control objectives and/or equipment (sensor/actuator) failure

• Time delays

Some of the popular names associated with model predictive control are Dynamic Matrix Control (DMC), IDCOM, model algorithmic control, etc. While these algorithms differ in certain details, the main ideas behind them are very similar. Indeed, in its basic unconstrained form MPC is closely related to linear quadratic optimal control. In the constrained case, however, MPC leads to an optimization problem which is solved on-line in real time at each sampling interval. MPC takes full advantage of the power available in today’s control computer hardware.

This software and the accompanying manual are not intended to teach the user the basic ideas behind MPC. Background material is available in standard textbooks like those authored by Seborg, Edgar and Mellichamp (1989)1, Deshpande and Ash (1988)2and the monograph devoted solely to this topic authored by Morari and coworkers (Morari et al., 1994)3. This section provides a basic introduction to the main ideas behind MPC and the specific form of implementation chosen for this toolbox. The algorithms used here are

consistent with those described in the monograph by Morari et al. Indeed, the software is meant to accompany the monograph and vice versa. The routines included in the MPC Toolbox fall into two basic categories: routines which use

1. D.E. Seborg, T.F. Edgar, D.A. Mellichamp; Process Dynamics and Control; JohnWiley & Sons, 1989

2. P.B. Deshpande, R.H. Ash; Computer Process Control with Advanced Control Applications, 2nd ed., ISA, 1988

3. M. Morari, C.E. Garcia, J.H. Lee, D.M. Prett; Model Predictive Control; Prentice Hall, 1994 (In the process of being written.)

(11)

Introduction

1-3 a step response model description and routines which use a state-space model description. In addition, simple identification tools are provided for identifying step response models from plant data. Finally, there are also various

conversion routines which convert between different model formats and analysis routines which can aid in determining the stability of the

unconstrained system, etc. All MPC Toolbox commands have a built-in usage display. Any command called with no input arguments results in a brief description of the command line. For example, typingmpcconat the command line gives the following:

usage: Kmpc = mpccon(model,ywt,uwt,M,P)

The following sections include several examples. They are available in the tutorial programsmpctut.m,mpctutid.m,mpctutst.m, andmpctutss.m.You can copy these demo files from thempctools/mpcdemossource into a local directory and examine the effects of modifying some of the commands.

Target Audience for the MPC Toolbox

The package is intended for the classroom and for the practicing engineer. It can assist in communicating the concepts of MPC to a student in an

introductory control course. At the same time it is sophisticated enough to allow an engineer in industry to evaluate alternate control strategies in simulation studies.

System Requirements

The MPC Toolbox assumes the following operating system requirements:

• MATLAB®is running on your system.

• If nonlinear systems are to be simulated, Simulink®is required for the functionsnlcmpcandnlmpcsim.

• If the theta format from the System Identification Toolbox is to be used to create models in the MPC mod format (using the MPC Toolbox function, th2mod), then the System Identification Toolbox functionpolyformand the Control System Toolbox functionappendare required.

(12)

1

Tutorial

1-4

The MPC Toolbox analysis and simulation algorithms are numerically intensive and require approximately 1MB of memory, depending on the number of inputs and outputs. The available memory on your computer may limit the size of the systems handled by the MPC Toolbox.

Note: there is apackcommand in MATLAB that can help free memory space by compacting fragmented memory locations. For reasonable response times, a computer with power equivalent to an 80386 machine is recommended unless only simple tutorial example problems are of interest.

(13)

2

MPC Based on Step

Response Models

(14)

2

MPC Based on Step Response Models

2-2

Step Response Models

Step response models are based on the following idea. Assume that the system is at rest. For a linear time-invariant single-input single-output (SISO) system let the output change for a unit input change∆v be given by

{0, s1, s2, . . . , sn, sn, . . .}

Here we assume that the system settles exactly after n steps. The step response {s1, s2, . . . , sn} constitutes a complete model of the system, which allows us to compute the system output for any input sequence:

Step response models can be used for both stable and integrating processes. For an integrating process it is assumed that the slope of the response remains constant after n steps, i.e.,

sn– sn – 1= sn + 1– sn= sn + 2– sn + 1= . . .

For a multi-input multi-output (MIMO) process with nvinputs and nyoutputs, one obtains a series of step response coefficient matrices

where sl,m,iis the ithstep response coefficient relating the mthinput to the lth output.

y k( ) siv(ki)

i=1 n

å

+snv k( n1)

=

Si

s1 1 i, , s1 2 i, ,s1 n

v i , ,

s2 1 i, ,

sn

y, ,1 i sn

y, ,2 isn

y, ,nv i

= …

(15)

Step Response Models

2-3 The MPC Toolbox stores step response models in the following format:

wheredelt2is the sampling time and the vectornoutindicates if a particular output is integrating or not:

nout(i) = 0if outputiis integrating.

nout(i) = 1if outputiis stable.

The step response can be obtained directly from identification experiments, or generated from a continuous or discrete transfer function or state-space model.

For example, if the discrete system description (sampling time T = 0.1) is y(k) = –0.5y(k – 1) + v(k – 3)

then the transfer function is plant

S1 S2

Sn

nout(1) 0 … 0

nout(2) 0 … 0

nout n( )y 0 … 0

ny 0 … 0

delt2 0 … 0 (n n y+ny+2)×nv

=

……

… …

g z( ) z3 1+0.5z1 ---

=

(16)

2

MPC Based on Step Response Models

2-4

The following commands (seempctut.m) generate the step response model for this system and plot it:

num = 1;

den = [1 0.5];

delt1 = 0.1;

delay = 2;

g = poly2tfd(num,den,delt1,delay);

% Set up the model in tf format tfinal = 1.6;

delt2 = delt1;

nout = 1;

plant = tfd2step(tfinal,delt2,nout,g);

% Calculate the step response

plotstep(plant) % Plot the step response

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

u1 step response : y1

TIME

(17)

Step Response Models

2-5 Alternatively, we could first generate a state-space description applying the

commandtf2ssand then generate the step response withss2step. In this case, we need to pad the numerator and denominator polynomials to account for the time delay.

num = [0 0 0 num];

den = [den 0 0];

[phi,gam,c,d] = tf2ss(num,den); % Convert to state-space plant = ss2step(phi,gam,c,d,tfinal,delt1,delt2,nout);

% Calculate step response

We can get some information on the contents of a matrix in the MPC Toolbox via the commandmpcinfo. For our example,mpcinfo(plant)returns:

This is a matrix in MPC Step format.

sampling time = 0.1 number of inputs = 1 number of outputs = 1

number of step response coefficients = 16 All outputs are stable.

(18)

2

MPC Based on Step Response Models

2-6

Model Identification

The identification routines available in the MPC Toolbox are designed for multi-input single-output (MISO) systems. Based on a historical record of the output yl(k) and the inputs v1(k); v2(k), . . . , (k),

the step response coefficients

are estimated. For the estimation of the step response coefficients we write the SISO model in the form

where

∆y(k) = y(k) – y(k – 1) and

hi= si– si – 1

vn

v

yyl

yl( )1 yl( )2 yl( )3

=

v

v1( )1 v2( )1 … vn

v( )1 v1( )2 v2( )2 … vn

v( )2 v1( )3 v2( )3 … vn

v( )3

=

… …

sl, ,1 1 s

l, ,2 1s l, ,nv 1

sl, ,1 2 sl, ,2 2sl, ,nv 2

sl, ,1 i sl, ,2 isl, ,nv i

y k( ) hiv(ki)

i=1 n

å

=

(19)

Model Identification

2-7 hiare the impulse response coefficients. This model allows the designer to

present all the input (v) and output(yl) information in deviation form, which is often desirable. If the particular output is integrating, then the model

where

∆(∆y(k)) =∆y(k) –∆y(k – 1)

∆hi= hi– hi – 1

should be used to estimate∆hi, and thus hiand siare given by

For parameter estimation it is usually recommended to scale all the variables such that they are the same order of magnitude. This may be done via the MPC Toolbox functionsautoscorscal. Then the data has to be arranged into the form

Y = XΘ

where Y contains all the output information (∆y(k) for stable and∆(∆y(k)) for integrating outputs) and X all the input information (∆v(k)) appropriately arranged.Θis a vector including all the parameters to be estimated (hifor stable and∆hifor integrating outputs). This rearrangement of the input and output information is handled bywrtreg. The parametersΘcan be estimated via multivariable least squares regression (mlr) or partial least squares (plsr).

Finally, the step response model is generated from the impulse response coefficients viaimp2step. The following example (seempctutid) illustrates this procedure.

∆ ∆y k( ( )) ∆hiv(ki)

i=1 n

å

=

hi ∆hk

k=1 i

å

=

si hj

j=1 i

å

∆hk

k=1 j

å

j=1 i

å

= =

(20)

2

MPC Based on Step Response Models

2-8

Example:

% Load the input and output data. The input and output

% data are generated from the following transfer

% functions and random zero-mean noises.

% TF from input 1 to output 1: g11=5.72exp(-14s)/

% (60s+1)

% TF from input 2 to output 1: g12=1.52exp(-15s)/

% (25s+1)

% Sampling time of 7 minutes was used.

%

% load mlrdat

%

% Determine the standard deviations for input data using

% autosc.

[ax,mx,stdx]=autosc(x);

%

% Scale the input data by their standard deviations only.

mx=0*mx;

sx=scal(x,mx,stdx);

%

% Put the input and output data in a form such that they

% can be used to determine the impulse response

% coefficients. 35 coefficients (n) are used.

n=35;

[xreg,yreg]=wrtreg(sx,y,n);

%

% Determine the impulse response coefficients via mlr.

% By specifying plotopt=2, two plots—plot of predicted

% output and actual output, and plot of the output

% residual (or prediction error)—are produced.

ninput=2; plotopt=2;

[theta,yres]=mlr(xreg,yreg,ninput,plotopt);

(21)

Model Identification

2-9

% Scale theta based on the standard deviations used in

% scaling the input.

theta=scal(theta,mx,stdx);

%

% Convert the impulse model to a step model to be used

% in MPC design.

% Sampling time of 7 minutes was used in determining

% the impulse model.

% Number of outputs (1 in this case) must be specified.

nout=1;

delt=7;

model=imp2step(delt,nout,theta);

%

% Plot the step response.

plotstep(model)

0 20 40 60 80 100 120 140 160 180

−6

−4

−2 0 2 4

Actual value (o) versus Predicted Value (+)

Sample Number

Output

0 20 40 60 80 100 120 140 160 180

−0.4

−0.3

−0.2

−0.1 0 0.1 0.2 0.3

Output Residual or Prediction Error

Sample Number

Residual

(22)

2

MPC Based on Step Response Models

2-10

0 50 100 150 200 250

0 1 2 3 4 5 6

u1 step response : y1

TIME

0 50 100 150 200 250

−0.2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8

u2 step response : y1

TIME

(23)

Unconstrained Model Predictive Control

2-11

Unconstrained Model Predictive Control

The MPC control law can be most easily derived by referring to the following figure.

For any assumed set of present and future control moves∆u(k),∆u(k + 1), . . . ,∆u(k + m – 1) the future behavior of the process outputs y(k + 1|k), y(k + 2|k), . . . , y(k + p|k) can be predicted over a horizon p. The m present and future control moves (mp) are computed to minimize a quadratic objective of the form

Here and are weighting matrices to penalize particular components of y or u at certain future time intervals. r(k + l) is the (possibly time-varying) vector of future reference values (setpoints). Though m control moves are calculated, only the first one (∆u(k)) is implemented. At the next sampling interval, new values of the measured output are obtained, the control horizon is shifted forward by one step, and the same computations are repeated. The resulting control law is referred to as “moving horizon” or “receding horizon.”

future past

target

u(k)

k+p k k+1 k+2

horizon y(k+1|k)

^ y

Projected

Manipulated Variables Outputs

min∆u k( )…∆u k( +m1)

Γ

l

y([y k( +l|k) – r k( +l)]) 2

l=1

å

p

+

Γ

l

u[∆u k( +l–1)] 2

l=1

å

m

Γly Γlu

(24)

2

MPC Based on Step Response Models

2-12

The predicted process outputs y(k + 1|k), . . . ,y(k + p|k) depend on the current measurement and assumptions we make about the unmeasured

disturbances and measurement noise affecting the outputs. The MPC Toolbox assumes that the unmeasured disturbances for each output are steps passing through a first order lag with time constanttfilter(2,:).1For rejecting measurement noise, the time constant of an exponential filtertfilter(1,:) can be specified by the user. (It can be shown that this procedure is optimal for white noise disturbances passed through an integrator and a first order lag, and white measurement noise). For conventional Dynamic Matrix Control (DMC) the disturbance time constant is assumed to be zero

(tfilter(2,:) = zeros(1,ny)),i.e., the unmeasured disturbances have the form of steps, and the noise filter time constant is also set to zero

(tfilter(1,:) = zeros(1,ny)), i.e., there is no measurement noise filtering for doing the prediction.

Under the stated assumptions, it can be shown that a linear time-invariant feedback control law results

∆u(k) = KMP CEp(k + 1|k)

where Ep(k + 1|k) is the vector of predicted future errors over the horizon p which would result if all present and future manipulated variable moves were equal to zero∆u(k) =∆u(k + 1) = . . . = 0.

For open-loop stable plants, nominal stability of the closed-loop system depends only on KMP Cwhich in turn is affected by the horizon p, the number of moves m and the weighting matrices and . No precise conditions on m, p, and exist which guarantee closed-loop stability. In general,

decreasing m relative to p makes the control action less aggressive and tends to stabilize a system. For p = 1, nominal stability of the closed-loop system is guaranteed for any finite m, and time-invariant input and output weights.

More commonly, is used as a tuning parameter. Increasing always has the effect of making the control action less aggressive.

The noise filter time constanttfilter(1,:)and the disturbance time constant tfilter(2,:)do not affect closed-loop stability or the response of the system to setpoint changes or measured disturbances. They do, however, affect the robustness and the response to unmeasured disturbances.

1. See cmpc in the “Reference” section for details on how to specify tfilter.

yˆ k( )

Γly Γlu Γly Γlu

Γlu Γlu

(25)

Unconstrained Model Predictive Control

2-13 Increasing the noise filter time constant makes the system more robust and the unmeasured disturbance response more sluggish. Increasing the disturbance time constant increases the lead in the loop, making the control action somewhat more aggressive, and is recommended for disturbances which have a slow effect on the output.

All controllers designed with the MPC Toolbox track steps asymptotically error-free (Type 1). If the unmeasured disturbance model or the system itself is integrating, ramps are also tracked error-free (Type 2).

Example:(seempctutst.m)

% Plant transfer function: g=5.72exp(-14s)/(60s+1)

% Disturbance transfer function: gd=1.52exp(-15s)/

% (25s+1)

%

% Build the step response models for a sampling period

% of 7.

delt1=0;

delay1=14;

num1=5.72;

den1=[60 1];

g=poly2tfd(num1,den1,delt1,delay1);

tfinal=245;

delt2=7;

nout1=1;

plant=tfd2step(tfinal,delt2,nout1,g);

delay2=15;

num2=1.52;

den2=[25 1];

gd=poly2tfd(num2,den2,delt1,delay2);

delt2=7;

nout2=1;

dplant=tfd2step(tfinal,delt2,nout2,gd);

%

% Calculate the MPC controller gain matrix for

% No plant/model mismatch,

% Output Weight=1, Input Weight=0

% Input Horizon=5, Output Horizon=20 model=plant;

ywt=1; uwt=0;

(26)

2

MPC Based on Step Response Models

2-14

M=5; P=20;

Kmpc1=mpccon(model,ywt,uwt,M,P);

%

% Simulate and plot response for unmeasured and measured

% step disturbance through dplant.

tend=245;

r=[ ]; usat=[ ]; tfilter=[ ];

dmodel=[ ];

dstep=1;

[y1,u1]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

dmodel=dplant; % measured disturbance

[y2,u2]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

plotall([y1,y2],[u1,u2],delt2);

pause; % Perfect rejection for measured disturbance case.

%

% Calculate a new MPC controller gain matrix for

% No plant/model mismatch,

% Output Weight=1, Input Weight=10

0 50 100 150 200 250

0 0.2 0.4 0.6 0.8 1

Outputs

Time

0 50 100 150 200 250

−0.7

−0.6

−0.5

−0.4

−0.3

−0.2

−0.1 0

Manipulated Variables

Time

(27)

Unconstrained Model Predictive Control

2-15

% Input Horizon=5, Output Horizon=20 model=plant;

ywt=1; uwt=10;

M=5; P=20;

mpc2=mpccon(model,ywt,uwt,M,P);

%

% Simulate and plot response for unmeasured and measured

% step disturbance through dplant.

tend=245;

r=[ ]; usat=[ ]; tfilter=[ ];

dmodel=[ ];

dstep=1;

[y3,u3]=mpcsim(plant,model,Kmpc2,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

dmodel=dplant; % measured disturbance

[y4,u4]=mpcsim(plant,model,Kmpc2,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

plotall([y3,y4],[u3,u4],delt2);

pause;

0 50 100 150 200 250

−0.2 0 0.2 0.4 0.6 0.8 1 1.2

Outputs

Time

0 50 100 150 200 250

−0.35

−0.3

−0.25

−0.2

−0.15

−0.1

−0.05 0

Manipulated Variables

Time

(28)

2

MPC Based on Step Response Models

2-16

%

% Simulate and plot response for unmeasured

% step disturbance through dplant with uwt=0,

% with and without noise filtering.

tend=245;

r=[ ]; usat=[ ]; dmodel=[ ];

tfilter=[ ];

dstep=1;

[y5,u5]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

tfilter=20; % noise filtering time constant=20

[y6,u6]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

plotall([y5,y6],[u5,u6],delt2);

pause;

0 50 100 150 200 250

0 0.2 0.4 0.6 0.8 1

Outputs

Time

0 50 100 150 200 250

−0.7

−0.6

−0.5

−0.4

−0.3

−0.2

−0.1 0

Manipulated Variables

Time

(29)

Unconstrained Model Predictive Control

2-17

%

% Simulate and plot response for unmeasured

% step disturbance through dplant with uwt=0,

% with and without unmeasured disturbance time constant

% being specified.

tend=245;

r=[ ]; usat=[ ]; dmodel=[ ];

tfilter=[ ];

dstep=1;

[y7,u7]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

tfilter=[0;25]; % unmeasured disturbance time constant=25 [y8,u8]=mpcsim(plant,model,Kmpc1,tend,r,usat,tfilter,...

dplant,dmodel,dstep);

plotall([y7,y8],[u7,u8],delt2);

pause;

0 50 100 150 200 250

0 0.2 0.4 0.6 0.8 1

Outputs

Time

0 50 100 150 200 250

−1.5

−1

−0.5 0

Manipulated Variables

Time

(30)

2

MPC Based on Step Response Models

2-18

Closed-Loop Analysis

Apart from simulation, other tools are available in the MPC Toolbox to analyze the stability and performance of a closed-loop system. We can obtain the state-space description of the closed-loop system with the commandmpccland then determine the pole locations withsmpcpole.

Example:(mpctutst.m)

% Construct a closed-loop system for no disturbances

% and uwt = 0. Determine the poles of the system.

clmod = mpccl(plant,model,Kmpc1);

poles = smpcpole(clmod);

maxpole = max(poles) Result is: maxpole = 1.0

The closed-loop system is stable if all the poles are inside or on the unit-circle.

Furthermore we can examine the frequency response of the closed-loop system.

For multivariable systems, singular values as a function of frequency can be obtained usingsvdfrsp.

Example:(mpctutst.m)

% Calculate and plot the frequency response of the

% sensitivity and complementary sensitivity functions.

freq = [ -3,0,30];

ny = 1;

in = [1:ny]; % input is r for comp. sensitivity out = [1:ny]; % output is yp for comp. sensitivity [frsp,eyefrsp] = mod2frsp(clmod,freq,out,in);

plotfrsp(eyefrsp); % sensitivity pause;

plotfrsp(frsp); % complementary sensitivity pause; % Magnitude = 1 for all frequencies chosen.

(31)

Closed-Loop Analysis

2-19

10−3 10−2 10−1 100

10−2 10−1 100 101

Frequency (radians/time)

Log Magnitude

BODE PLOTS

10−3 10−2 10−1 100

−100

−50 0 50 100

Frequency (radians/time)

Phase (degrees)

10−3 10−2 10−1 100

100 101

Frequency (radians/time)

Log Magnitude

BODE PLOTS

10−3 10−2 10−1 100

−800

−600

−400

−200 0

Frequency (radians/time)

Phase (degrees)

(32)

2

MPC Based on Step Response Models

2-20

Constrained Model Predictive Control

The control action can also be computed subject to hard constraints on the manipulated variables and the outputs.

Manipulated variable constraints:

umin(l)u(k +l)umax(l)

Manipulated variable rate constraints:

|∆u(k + l)|≤ ∆umax(l) Output variable constraints:

ymin(l)y(k + l|k)ymax(l)

When hard constraints of this form are imposed, a quadratic program has to be solved at each time step to determine the control action and the resulting control law is generally nonlinear. The performance of such a control system has to be evaluated via simulation.

Example:(mpctutst.m)

% Simulate and plot response for unmeasured step

% disturbance through dplant with and without

% input constraints.

% No plant/model mismatch,

% Output Weight = 1, Input Weight = 0

% Input Horizon = 5, Output Horizon = 20

% Minimum Constraint on Input = -0.4

% Maximum Constraint on Input = inf

% Delta Constraint on Input = 0.1 model = plant;

ywt = 1; uwt = 0;

M = 5; P = 20;

tend = 245;

r = 0;

ulim = [ ];

ylim = [ ]; tfilter = [ ]; dmodel = [ ];

dstep = 1;

[y9,u9] = cmpc(plant,model,ywt,uwt,M,P,tend,r,...

ulim,ylim,tfilter,dplant,dmodel,dstep);

ulim = [ -0.4, inf, 0.1]; % impose constraints

(33)

Constrained Model Predictive Control

2-21 [y10,u10] = cmpc(plant,model,ywt,uwt,M,P,tend,r,...

ulim,ylim,tfilter,dplant,dmodel,dstep);

plotall([y9,y10],[u9,u10],delt2);

0 50 100 150 200 250

0 0.2 0.4 0.6 0.8 1

Outputs

Time

0 50 100 150 200 250

−0.6

−0.5

−0.4

−0.3

−0.2

−0.1 0 0.1

Manipulated Variables

Time

(34)

2

MPC Based on Step Response Models

2-22

Application: Idle Speed Control

Process Description

An idle speed control2system should maintain the desired engine rpm with automatic transmission in neutral or drive. Despite sudden load changes due to the actions of air conditioning, power steering, etc., the control system should maintain smooth stable operation. Because of varying operating conditions and engine-to-engine variability inevitable in mass production, the system dynamics may change. The controller must be designed to be robust with respect to these changes. Two control inputs, bypass valve (or throttle) opening and spark advance, are used to maintain the engine rpm at a desired idle speed level. For safe operation, spark advance should not change by more than 20 degrees. Also, spark advance should be at the design point at

steady-state for fuel economy. Thus, spark advance is viewed both as a manipulated input and a controlled output.

Control Problem Formulation

Here we consider two different operating conditions (transmission in neutral and drive positions) and the models for the two plants are taken from the paper by Hrovat and Bodenheimer.3The goal is to design a model predictive

controller such that the closed loop performance at both operating conditions is good in the presence of the input constraint specified above. There is no synthesis method available which systematically generates a controller design which guarantees robust performance (or even just robust stability) in the presence of constraints. Thus, we must rely on both design and simulation tools to determine achievable performance objectives when there are both

constraints and robustness requirements. The toolbox helps us toward this objective.

Consider the following system:

2. More detail on the problem formulation can be found in the paper by Williams et al., “Idle Speed Control Design Using an HApproach,” Proceedings of American Control Conference, 1989, pages 1950–1956.

3. D. Hrovat and B. Bodenheimer, “Robust Automotive Idle Speed Control Design Based on µ-Synthesis,” Proceedings of American Control Conference, 1993, pages 1778–1783.

y1 y2

G11 G21

0 1

u1 u2

Gd 0

w +

=

(35)

Application: Idle Speed Control

2-23 where y1is engine rpm, y2and u2are spark advance, u1is bypass valve, w is torque load (unmeasured disturbance), and G11, G21and Gd are the

corresponding transfer functions. After scaling, the constraints on spark advance become ±0.7, i.e., |u2|≤0.7.

Plant #1 corresponds to operation in drive at 800 rpm and a load of 30 Nm and the transfer functions are given by

Plant #2 corresponds to operation at 800 rpm in neutral with zero load and the transfer functions are given by

The goal is to design a model predictive controller such that the closed-loop performance is good for plants #1 and #2 when subjected to an unmeasured torque load disturbance.

G11 9.62e0.16s s2+2.4s+5.05 ---

=

G21 15.9 s( +3)e0.04 s s2+2.4s+5.05 ---

=

Gd –19.1(s+3) s2+2.4s+5.05 ---

=

G11 20.5e0.16s s2+2.2s+12.8 ---

=

G21 47.6 s( +3.5)e0.04s s2+2.2s+12.8 ---

=

Gd –19.1(s+3.5) s2+2.2s+12.8 ---

=

(36)

2

MPC Based on Step Response Models

2-24

Simulations

Since the toolbox handles only discrete-time systems, the models are

discretized using a sampling time of 0.1. We approximate each of the discrete transfer functions with 40 step response coefficients. The functioncmpcis used to generate the controller and to simulate the closed-loop response because it determines optimal changes of the manipulated variables subject to

constraints. For comparison (Simulation # 4), we also use the functionsmpccon for controller design andmpcsimfor simulating closed-loop responses. On-line computations are simpler, but the resulting controller is linear and the constraints are not handled in an optimal fashion. The following additional functions from the toolbox are also used:tfd2stepandplotall. The MATLAB code for the following simulations can be found in the fileidlectr.min the directorympcdemos.

Figure 2-1 Responses to a Unit Torque Disturbance for Plant #1 (no model/

plant mismatch)

Simulation #1. No model/plant mismatch. The following parameters are used:

M = 10, P = inf, ywt = [5 1], uwt = [0.5 0.5], tfilter = [ ]

The larger weight on the first output (engine rpm) is to emphasize that controlling engine rpm is more important than controlling spark advance.

Figure 2-1 and Figure 2-2 show the closed-loop response for a unit step torque

1 2 3 4 5 6 7 8 9 10

0 5 0 -5

1 2 3 4 5 6 7 8 9 10

0 5 0 -5 10

Outputs

Time

Manipulated Variables

Time y2

y1

u1

u2

(37)

Application: Idle Speed Control

2-25 load change. No model/plant mismatch is introduced, i.e., we use Plant #1 and Plant #2 as the nominal model for simulating the closed loop response for Plant

#1 and Plant #2, respectively.

As we can see, both controllers perform well for their respective plants.

Because of the infinite output horizon, i.e.,P = inf, nominal stability is guaranteed for both systems. In some sense, the performance observed in Figure 2-1 and Figure 2-2 is the best which can be expected, when the spark advance constraint is invoked and there is no model/plant mismatch.

Obviously, if we want to control Plant #1 and Plant #2 with the same controller the nominal performance for each plant will deteriorate.

Figure 2-2 Responses to a Unit Torque Disturbance for Plant #2 (no model/plant mismatch)

1 2 3 4 5 6 7 8 9 10

0

1 2 3 4 5 6 7 8 9 10

0 0 -2 -4

2 Outputs

Time

Manipulated Variables

Time 5

0

-5 y2

y1

u1 u2

(38)

2

MPC Based on Step Response Models

2-26

Figure 2-3 Responses to a Unit Torque Disturbance for Plant #1 (nominal model = Plant #2)

Simulation #2. Model/plant mismatch. All parameters are kept the same as in Simulation #1. Shown in Figure 2-3 is the response to a unit torque disturbance for Plant #1 using Plant #2 as the nominal model. Figure 2-4 depicts the response to a unit torque disturbance for Plant #2 using Plant #1 as the nominal model. As one can see, both systems are unstable. Therefore, the controllers must be detuned to improve robustness if one wants to control both plants with the same controller.

1 2 3 4 5 6 7 8 9 10

0

1 2 3 4 5 6 7 8 9 10

0 10

0 -10 20

Outputs

Time

Manipulated Variables

Time 20

0

-20 y2

y1

u1

u2

(39)

Application: Idle Speed Control

2-27 Figure 2-4 Responses to a Unit Torque Disturbance for Plant #2 (nominal

model = Plant #1)

Simulation #3. The input weight is increased to [10 20] to improve robustness.

All other parameters are kept the same as in Simulation #1. Plant #1 is used as the nominal model. The simulation results depicted in Figure 2-5 and Figure 2-6 seem to indicate that with an input weight of [10 20] the controller stabilizes both plants. However, we must point out that the design procedure guarantees global asymptotic stability only for the nominal system, i.e., Plant

# 1. Because of the input constraints, the system is nonlinear. The observed stability for Plant # 2 in Figure 2-6 should not be mistaken as an indication of global asymptotic stability.

1 2 3 4 5 6 7 8 9 10

0

1 2 3 4 5 6 7 8 9 10

0 2 0 -2 4

Outputs

Time

Manipulated Variables

Time 5

0

-5 y2

y1

u1

u2

(40)

2

MPC Based on Step Response Models

2-28

Figure 2-5 Responses to a Unit Torque Disturbance for Plant #1 (nominal model = Plant #1)

Figure 2-6 Responses to a Unit Torque Disturbance for Plant #2 (nominal model = Plant #1)

1 2 3 4 5 6 7 8 9 10

0

1 2 3 4 5 6 7 8 9 10

00 10

Outputs

Time

Manipulated Variables

Time 5

-5 -10

y2

y1

u1

u2 0

1 2 3 4 5 6 7 8 9 10

0

1 2 3 4 5 6 7 8 9 10

0 0 -2 -4

2 Outputs

Time

Manipulated Variables

Time 4

2

0 y2

y1

u1

u2

(41)

Application: Idle Speed Control

2-29 As expected, the nominal performance for both Plant #1 and Plant #2 has

deteriorated when compared to the simulations shown in Figure 2-1 and Figure 2-2. A similar effect would be observed if we had detuned the controller which uses Plant #2 as the nominal model.

Simulation #4. The parameter values are the same as in Simulation #3. Instead of usingcmpc, we usempcconandmpcsimfor simulating the closed loop responses. Figure 2-2 compares the responses for Plant #1 usingmpcconand mpcsim, andcmpc. As we can see, for this example and these tuning

parameters, the improvement obtained through the on-line optimization in cmpcis small. However, the difference could be large, especially for

ill-conditioned systems and other tuning parameters. For example, by reducing the output horizon to P = 80 while keeping the other parameters the same, the responses for Plant # 1 found withmpcconandmpcsimare significantly slower than those obtained withcmpc(Figure 2-8).

Figure 2-7 Comparison of Responses From cmpc, and mpccon and mpcsim for Plant #1 P = inf

2 4 6 8 10

0 -4 -5 -6 -3

Solid: cmpc

Time 0

-1 -2 1

Dashed: mpccon and mpcsim

Output

y1 y2

(42)

2

MPC Based on Step Response Models

2-30

Figure 2-8 Comparison of Responses From cmpc, and mpccon and mpcsim for Plant #1 (P = 80)

2 4 6 8 10

0 -4 -5 -6 -3

Solid: cmpc

Time 0

-1 -2 1

Dashed: mpccon and mpcsim

Output

y1 y2

-7

(43)

Application: Control of a Fluid Catalytic Cracking Unit

2-31

Application: Control of a Fluid Catalytic Cracking Unit

Process Description

Fluid Catalytic Cracking Units (FCCUs) are widely used in the petroleum refining industry to convert high boiling oil cuts (of low economic value) to lighter more valuable hydrocarbons including gasoline. Cracking refers to the catalyst enhanced thermal breakdown of high molecular weight hydrocarbons into lower molecular weight materials. A schematic of the FCCU studied4is given in Figure 2-9. Fresh feed is contacted with hot catalyst at the base of the riser and travels rapidly up the riser where the cracking reactions occur. The desirable products of reaction are gaseous (lighter) hydrocarbons which are passed to a fractionator and subsequently to separation units for recovery and purification. The undesirable byproduct of cracking is coke which is deposited on the catalyst particles, reducing their activity. Catalyst coated with coke is transported to the regenerator section where the coke is burned off thereby restoring catalytic activity and raising catalyst temperature. The regenerated catalyst is then transported to the riser base where it is contacted with more fresh feed. Regenerated catalyst at the elevated temperature provides the heat required to vaporize the fresh feed as well as the energy required for the endothermic cracking reaction.

4. A detailed problem description and the model used for this study can be found in the paper by McFarlane et al., “Dynamic Simulator for a Model IV Fluid Catalytic Cracking Unit,” Comp. &

Chem. Eng., 17(3), 1993, pages 275–300

(44)

2

MPC Based on Step Response Models

2-32

Figure 2-9 Fluid Catalytic Cracking Unit Schematic

Product composition, and therefore the economic viability of the process, is determined by the cracking temperature. The bulk of the combustion air in the regenerator section is provided by the main air compressor which is operated at full capacity. Additional combustion air is provided by the lift air

compressor, the throughput of which is adjustable by altering compressor speed. By maintaining excess flue gas oxygen concentration, it is possible to ensure essentially complete coke removal from the catalyst.

(45)

Application: Control of a Fluid Catalytic Cracking Unit

2-33

Control Problem Formulation

The open loop system is modeled as follows:

where

G is the plant model and Gdis the disturbance model. The variables are:

• Controlled variables

- Cracking temperature — (Tr)

- Flue gas oxygen concentration — ( )

• Associated variable

- Lift Air Compressor Surge Indicator — (∆Fla)

• Manipulated variables

- Lift air compressor speed — (Vlift) - Flue gas valve opening — (Vfg)

• Modeled disturbances

- Variations in ambient temperature affect compressor throughput — (d1) - Fluctuations in heavy oil feed composition to the FCCU — (d2)

- Pressure upset in down stream units propagating back to the FCCU — (d3) In addition to the controlled variables there are many process variables that need not be maintained at specific setpoints but which need to be within bounds for safety or economic reasons. These variables are called associated variables. For example, compressors must not surge during process upsets i.e., the suction flow rate must be greater than some minimum flow rate (surge flow rate).

The control objective is to maintain the controlled variables (cracking

temperature and flue gas oxygen concentration) at pre-determined setpoints in the presence of typical process disturbances while maintaining safe plant operation.

y = Gu+Gdd

u = [VfgVlift]T y CO

2 sg, Tr∆Fla

[ ]T

= d = [d1d2d3]T

CO

2 sg,

(46)

2

MPC Based on Step Response Models

2-34

Simulations

State-space realizations of the plant and disturbance models are available in the MATLAB filefcc_dat.matin the directorympcdemos. A MATLAB script detailing the simulations is also included (fcc_demo.m). The following table gives the parameters used for controller design and examination of the closed loop response:

Table 2-1 FCCU Simulation Parameters

Step Response Model

Figure 2-10A shows the plant open loop step response to a unit step in Vfg. Although the plant is stable the settling time is large (1 day). The time scale of interest for control purposes is on the order of one hour — which corresponds to the initial plant response, Figure 2-10B. For time scales of one hour, the process can be approximated by an integrating system. In deriving the step response model, the plant is therefore assumed to be an integrating process.

Simulation Time(s) tend = 2500

# Step Response Coefficients 60

Process Sampling Time delt2 = 100

Output Weights ywt = [3 3 0]

Input Weights uwt = [0 2]

Prediction Horizon (steps) P = 12

# manipulated variable moves M = 3

input constraints ui[ -1,1] , i = 1,2 output constraints yi[ -1,1] , i = 1,2

y3Š -1(hard constraint)

(47)

Application: Control of a Fluid Catalytic Cracking Unit

2-35 Figure 2-10 Open Loop Step Response to u = [1 0]

Figure 2-11 Unconstrained Closed Loop Response to d = [0 -0.5 -0.75]

0 2 4 6

x 104

−600

−500

−400

−300

−200

−100 0

time (s)

cO2sg

A

0 2000 4000 6000 8000 10000

−300

−250

−200

−150

−100

−50 0

time (s)

cO2sg

B

0 500 1000 1500 2000 2500

−2

−1 0 1 2

time (s)

output variables

cO2sg Tr surge indicator Disturbance Rejection, UNCONSTRAINED DESIGN

0 500 1000 1500 2000 2500

−1

−0.8

−0.6

−0.4

−0.2 0 0.2 0.4

time (s)

manipulated variables

Vfg

Vlift

(48)

2

MPC Based on Step Response Models

2-36

Associated Variables

As mentioned previously, associated variables need not be at any setpoint as long as they are within acceptable bounds. Deviations of associated variables from the nominal value do not appear in overall objective function to be minimized and the output weight corresponding to the associated variable is set to zero in Table 2-1.

Unconstrained Control Law

Figure 2-11 shows the closed loop response to a disturbance

d = [0 -0.5 -0.75] at t = 0. The controller gain matrix is derived using mpcconand the closed loop response is examined usingmpcsim. Note the following:

• At the first time step (t = 100s) the controlled variables are outside their allowed limits. The onset of the disturbance at t = 0 is unknown to the controller at t = 0 since there is no disturbance feedforward loop. Thus from t = 0 to t = 100s there is no control action and the process response is the open loop response with no control action. Only after t = 100s is corrective action implemented.

• At t = 200s (2ndtime step) riser temperature is outside the allowed limits.

• The lift air compressor surges during the interval 200st800s which is unacceptable. Compressor surging will result in undesirable vibrations in the compressor leading to rapid wear and tear.

Constrained Control Law

It is clear that the unconstrained control law generated usingmpcsimis physically unacceptable since hard output constraints are violated. Figure 2-12 shows the closed loop response of the nominal plant to the same disturbance taking process constraints explicitly into account. The closed loop response is determined using the commandcmpc.

(49)

Application: Control of a Fluid Catalytic Cracking Unit

2-37 Figure 2-12 Constrained Closed Loop Response to d = [0 -0.5 -0.75]

The output limit vector is:

0 500 1000 1500 2000 2500

−2

−1 0 1 2

time (s)

output variables

Disturbance Rejection, CONSTRAINED DESIGN

cO2sg Tr surge indicator

0 500 1000 1500 2000 2500

−1

−0.8

−0.6

−0.4

−0.2 0 0.2 0.4

time (s)

manipulated variables

Vfg

Vlift

ylim 1

– –1 –1 1 1 Inf 1

– –1 –1 1 1 Inf Inf

– –Inf–Inf Inf Inf Inf

=

참조

관련 문서

For Study B, the target market and the digital strategy variables are significant with positive directions, suggesting that the B2C or C2C and the

For patients treated for chin augmentation using either genioplasty with Medpor Ⓡ or osteotomy, the predictive value of the correlation of the hard and

Through the endogenous financial development variables and financial market factors are introduced to the model, this paper use panel data to make an

Just as we achieved good control with a joint-based controller that was based on a linearizing and decoupling model of the arm, we can do the same for the Cartesian case.

Because the functions of the step-up, step-down control operation and variable switching frequency using the linear congruential generator (LCG) are

ⅲ) Traffic characteristic variables selected were considerably correlated with the delay predictive modeling on the merge sections of urban freeway interchange

In this thesis, a method for obtaining model-based tuning rules for the PID controller are proposed incorporating with real-coded genetic algorithms.. First,

In this thesis, P controller for pitch controller of outer loop control system and PD controller for fin controller of inner loop control system are