Model Predictive Control Toolbox For Use with MATLAB ManfredMorari N. Lawrence Ricker Computation Visualization Programming The MATH WORKS User's Guide Inc. Version 1
Computation Visualization Programming For Use with MATLAB® Model Predictive Control Toolbox User’s Guide Version 1 Manfred Morari N. Lawrence Ricker
Contents Preface Tutorial Introduction 1-2 Target Audience for the MPC Toolbox System Requirements 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 Control Problem formulation 2-22 Simulations 2-24 Application: Control of a Fluid Catalytic Cracking Unit. 2-31 Process Description Control problem formulation 2-33
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
Step Response Model 2-34 sociated variable Unconstrained Control Law 2-36 MPC Based on State-Space Models 3 State-Space Models 3-2 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 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 State-Space MPC with Constraints 3-20 pplication: Paper Machine Headbox Control MPC Design Based on Nominal Linear Model MPC of Nonlinear plant Command Reference 4「 Commands grouped by Function 4-2 Index
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
Preface Acknowledgments The toolbox was developed in cooperation with: Douglas B. Raven and alex ng 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. JaInapurkar, 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
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
About the authors 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 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
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
1 Tutorial 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) Deshpande and Ash(1988)and the monograph devoted solely to this topic authored by Morari and coworkers(Morari et al, 1994 )3. This section provides 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 oftware 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 3.M. Morari C.E. Garcia. LH. Lee. D.M. Prett: Model predictive Control Prentice halL. 1994 process of being written 1-2
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)2 and 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.)
ntroduction 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, typing mpccon at the command line gives the following (model M P) The following sections include several examples. They are available in the tutorial programs mpctut. m, mpctutid. m, mpctutst. m, and mpctutss m. You an copy these demo files from the mpctool s/mpcdemos source 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 functions nl cmpc and nl mpcsi m 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 function pol yform and the Control System Toolbox function append are required
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, typing mpccon at 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 programs mpctut.m, mpctutid.m, mpctutst.m, and mpctutss.m. You can copy these demo files from the mpctools/mpcdemos source 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 functions nlcmpc and nlmpcsim. • 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 function polyform and the Control System Toolbox function append are required
1 Tutorial 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 a pack command 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
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 a pack command 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
MPC Based on Step Response models
2 MPC Based on Step Response Models
2 MPC Based on Step Response Models 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 Av be given by 0,S1,S2,……,SSm:} Here we assume that the system settles exactly after nsteps. The step response Sn) constitutes a complete model of the system, which allows us to compute the system output for any input sequence Kk) vk-1+s,wk-n-1 Step response models can be used for both stable and integrating processes. Fc an integrating process it is assumed that the slope of the response lcu nor 2 For a multi-input multi-output(MIMO)process with n, inputs and ny outputs one obtains a series of step response coefficient matrices where Smi is the ith step response coefficient relating the mh input to the th 2-2
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 nv inputs and ny outputs, one obtains a series of step response coefficient matrices where sl,m,i is the i th step response coefficient relating the mth input to the l th output. y k( ) si ∆v( ) k i – i = 1 n sn = + vk n ( ) – – 1 Si s1 1, , i s1 2, , i … s1 nv , , i s2 1, , i sny, , 1 i sny, , 2 i … sny nv , , i = …