Advanced Control using MATLAB

550
Advanced Control using M ATLAB or Stabilising the unstabilisable David I. Wilson Auckland University of Technology New Zealand April 12, 2013

description

Stabilising the unstabilisable by Prof. David L. Wilson of Auckland University of Technology.

Transcript of Advanced Control using MATLAB

  • Advanced Control usingMATLAB

    or Stabilising theunstabilisable

    David I. WilsonAuckland University of Technology

    New Zealand

    April 12, 2013

  • Copyright 2013 David I. WilsonAuckland University of TechnologyNew Zealand

    Creation date: April, 2013.

    All rights reserved. No part of this work may be reproduced, stored in a retrieval system, or

    transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or

    otherwise, without prior permission.

  • Contents

    1 Introduction 11.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Matlab for computer aided control design . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.2.1 Alternative computer design aids . . . . . . . . . . . . . . . . . . . . . . . . 31.3 Economics of control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 Laboratory equipment for control tests . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    1.4.1 Plants with one input and one output . . . . . . . . . . . . . . . . . . . . . . 61.4.2 Multi-input and multi-output plants . . . . . . . . . . . . . . . . . . . . . . . 8

    1.5 Slowing down Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    2 From differential to difference equations 132.1 Computer in the loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    2.1.1 Sampling an analogue signal . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.1.2 Selecting a sample rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.1.3 The sampling theorem and aliases . . . . . . . . . . . . . . . . . . . . . . . . 162.1.4 Discrete frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    2.2 Finite difference models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.2.1 Difference equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    2.3 The z transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.3.1 z-transforms of common functions . . . . . . . . . . . . . . . . . . . . . . . . 23

    2.4 Inversion of z-transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.4.1 Inverting z-transforms with symbolically . . . . . . . . . . . . . . . . . . . . 252.4.2 The partial fraction method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.4.3 Long division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.4.4 Computational approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.4.5 Numerically inverting the Laplace transform . . . . . . . . . . . . . . . . . . 31

    2.5 Discretising with a sample and hold . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.5.1 Converting Laplace transforms to z-transforms . . . . . . . . . . . . . . . . 372.5.2 The bilinear transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    2.6 Discrete root locus diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422.7 Multivariable control and state space analysis . . . . . . . . . . . . . . . . . . . . . . 43

    2.7.1 States and state space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462.7.2 Converting differential equations to state-space form . . . . . . . . . . . . . 472.7.3 Interconverting between state space and transfer functions . . . . . . . . . . 502.7.4 Similarity transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542.7.5 Interconverting between transfer functions forms . . . . . . . . . . . . . . . 552.7.6 The steady state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    2.8 Solving the vector differential equation . . . . . . . . . . . . . . . . . . . . . . . . . 582.8.1 Numerically computing the discrete transformation . . . . . . . . . . . . . . 612.8.2 Using MATLAB to discretise systems . . . . . . . . . . . . . . . . . . . . . . . 632.8.3 Time delay in state space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    2.9 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    iii

  • iv CONTENTS

    2.9.1 Stability in the continuous domain . . . . . . . . . . . . . . . . . . . . . . . . 702.9.2 Stability of the closed loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722.9.3 Stability of discrete time systems . . . . . . . . . . . . . . . . . . . . . . . . . 732.9.4 Stability of nonlinear differential equations . . . . . . . . . . . . . . . . . . . 742.9.5 Expressing matrix equations succinctly using Kronecker products . . . . . . 802.9.6 Summary of stability analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

    2.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

    3 Modelling dynamic systems with differential equations 853.1 Dynamic system models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    3.1.1 Steady state and dynamic models . . . . . . . . . . . . . . . . . . . . . . . . 863.2 A collection of illustrative models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    3.2.1 Simple models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863.3 Chemical process models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    3.3.1 A continuously-stirred tank reactor . . . . . . . . . . . . . . . . . . . . . . . 923.3.2 A forced circulation evaporator . . . . . . . . . . . . . . . . . . . . . . . . . . 943.3.3 A binary distillation column model . . . . . . . . . . . . . . . . . . . . . . . 953.3.4 Interaction and the Relative Gain Array . . . . . . . . . . . . . . . . . . . . . 103

    3.4 Regressing experimental data by curve fitting . . . . . . . . . . . . . . . . . . . . . . 1073.4.1 Polynomial regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1073.4.2 Nonlinear least-squares model identification . . . . . . . . . . . . . . . . . . 1123.4.3 Parameter confidence intervals . . . . . . . . . . . . . . . . . . . . . . . . . . 116

    3.5 Numerical tools for modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1203.5.1 Differential/Algebraic equation systems and algebraic loops . . . . . . . . . 123

    3.6 Linearisation of nonlinear dynamic equations . . . . . . . . . . . . . . . . . . . . . . 1253.6.1 Linearising a nonlinear tank model . . . . . . . . . . . . . . . . . . . . . . . 127

    3.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    4 The PID controller 1314.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

    4.1.1 P, PI or PID control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1314.2 The industrial PID algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

    4.2.1 Implementing the derivative component . . . . . . . . . . . . . . . . . . . . 1334.2.2 Variations of the PID algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 1344.2.3 Integral only control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

    4.3 Simulating a PID process in SIMULINK . . . . . . . . . . . . . . . . . . . . . . . . . . 1354.4 Extensions to the PID algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

    4.4.1 Avoiding derivative kick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1384.4.2 Input saturation and integral windup . . . . . . . . . . . . . . . . . . . . . . 140

    4.5 Discrete PID controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1434.5.1 Discretising continuous PID controllers . . . . . . . . . . . . . . . . . . . . . 1444.5.2 Simulating a PID controlled response in Matlab . . . . . . . . . . . . . . . . 1464.5.3 Controller performance as a function of sample time . . . . . . . . . . . . . 148

    4.6 PID tuning methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1484.6.1 Open loop tuning methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1504.6.2 Closed loop tuning methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 1554.6.3 Closed loop single-test tuning methods . . . . . . . . . . . . . . . . . . . . . 1594.6.4 Summary on closed loop tuning schemes . . . . . . . . . . . . . . . . . . . . 166

    4.7 Automated tuning by relay feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . 1664.7.1 Describing functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1684.7.2 An example of relay tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1704.7.3 Self-tuning with noise disturbances . . . . . . . . . . . . . . . . . . . . . . . 1734.7.4 Modifications to the relay feedback estimation algorithm . . . . . . . . . . . 176

    4.8 Drawbacks with PID controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

  • CONTENTS v

    4.8.1 Inverse response processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1814.8.2 Approximating inverse-response systems with additional deadtime . . . . 183

    4.9 Dead time compensation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1854.10 Tuning and sensitivity of control loops . . . . . . . . . . . . . . . . . . . . . . . . . . 1874.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

    5 Digital filtering and smoothing 1935.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    5.1.1 The nature of industrial noise . . . . . . . . . . . . . . . . . . . . . . . . . . . 1945.1.2 Differentiating without smoothing . . . . . . . . . . . . . . . . . . . . . . . . 196

    5.2 Smoothing measured data using analogue filters . . . . . . . . . . . . . . . . . . . . 1975.2.1 A smoothing application to find the peaks and troughs . . . . . . . . . . . . 1975.2.2 Filter types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1975.2.3 Classical analogue filter families . . . . . . . . . . . . . . . . . . . . . . . . . 201

    5.3 Discrete filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2095.3.1 A low-pass filtering application . . . . . . . . . . . . . . . . . . . . . . . . . . 2095.3.2 Digital filter approximations . . . . . . . . . . . . . . . . . . . . . . . . . . . 2125.3.3 Efficient hardware implementation of discrete filters . . . . . . . . . . . . . 2145.3.4 Numerical and quantisation effects for high-order filters . . . . . . . . . . . 217

    5.4 The Fourier transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2195.4.1 Fourier transform definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 2215.4.2 Orthogonality and frequency spotting . . . . . . . . . . . . . . . . . . . . . . 2245.4.3 Using MATLABs FFT function . . . . . . . . . . . . . . . . . . . . . . . . . . 2255.4.4 Periodogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2275.4.5 Fourier smoothing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

    5.5 Numerically differentiating industrial data . . . . . . . . . . . . . . . . . . . . . . . 2305.5.1 Establishing feedrates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    5.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    6 Identification of process models 2356.1 The importance of system identification . . . . . . . . . . . . . . . . . . . . . . . . . 235

    6.1.1 Basic definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2366.1.2 Black, white and grey box models . . . . . . . . . . . . . . . . . . . . . . . . 2376.1.3 Techniques for identification . . . . . . . . . . . . . . . . . . . . . . . . . . . 238

    6.2 Graphical and non-parametric model identification . . . . . . . . . . . . . . . . . . 2396.2.1 Time domain identification using graphical techniques . . . . . . . . . . . . 2396.2.2 Experimental frequency response analysis . . . . . . . . . . . . . . . . . . . 2466.2.3 An alternative empirical transfer function estimate . . . . . . . . . . . . . . 253

    6.3 Continuous model identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2546.3.1 Fitting transfer functions using nonlinear least-squares . . . . . . . . . . . . 2546.3.2 Identification using derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . 2566.3.3 Practical continuous model identification . . . . . . . . . . . . . . . . . . . . 258

    6.4 Popular discrete-time linear models . . . . . . . . . . . . . . . . . . . . . . . . . . . 2606.4.1 Extending the linear model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2626.4.2 Output error model structures . . . . . . . . . . . . . . . . . . . . . . . . . . 2646.4.3 General input/output models . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

    6.5 Regressing discrete model parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 2666.5.1 Simple offline system identification routines . . . . . . . . . . . . . . . . . . 2686.5.2 Bias in the parameter estimates . . . . . . . . . . . . . . . . . . . . . . . . . . 2696.5.3 Using the System Identification toolbox . . . . . . . . . . . . . . . . . . . . . 2706.5.4 Fitting parameters to state space models . . . . . . . . . . . . . . . . . . . . 274

    6.6 Model structure determination and validation . . . . . . . . . . . . . . . . . . . . . 2766.6.1 Estimating model order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2776.6.2 Robust model fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

  • vi CONTENTS

    6.6.3 Common nonlinear model structures . . . . . . . . . . . . . . . . . . . . . . 2806.7 Online model identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

    6.7.1 Recursive least squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2816.7.2 Recursive least-squares in MATLAB . . . . . . . . . . . . . . . . . . . . . . . 2866.7.3 Tracking the precision of the estimates . . . . . . . . . . . . . . . . . . . . . . 290

    6.8 The forgetting factor and covariance windup . . . . . . . . . . . . . . . . . . . . . . 2926.8.1 The influence of the forgetting factor . . . . . . . . . . . . . . . . . . . . . . . 2946.8.2 Covariance wind-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

    6.9 Identification by parameter optimisation . . . . . . . . . . . . . . . . . . . . . . . . . 2966.10 Online estimating of noise models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

    6.10.1 A recursive extended least-squares example . . . . . . . . . . . . . . . . . . 3026.10.2 Recursive identification using the SI toolbox . . . . . . . . . . . . . . . . . . 3056.10.3 Simplified RLS algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

    6.11 Closed loop identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3076.11.1 Closed loop RLS in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

    6.12 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

    7 Adaptive Control 3177.1 Why adapt? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

    7.1.1 The adaption scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3187.1.2 Classification of adaptive controllers . . . . . . . . . . . . . . . . . . . . . . . 319

    7.2 Gain scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3197.3 The importance of identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

    7.3.1 Polynomial manipulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3217.4 Self tuning regulators (STRs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

    7.4.1 Simple minimum variance control . . . . . . . . . . . . . . . . . . . . . . . . 3237.5 Adaptive pole-placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

    7.5.1 The Diophantine equation and the closed loop . . . . . . . . . . . . . . . . . 3267.5.2 Solving the Diophantine equation in Matlab . . . . . . . . . . . . . . . . . . 3277.5.3 Adaptive pole-placement with identification . . . . . . . . . . . . . . . . . . 330

    7.6 Practical adaptive pole-placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3347.6.1 Dealing with non-minimum phase systems . . . . . . . . . . . . . . . . . . . 3357.6.2 Separating stable and unstable factors . . . . . . . . . . . . . . . . . . . . . . 3387.6.3 Experimental adaptive pole-placement . . . . . . . . . . . . . . . . . . . . . 3407.6.4 Minimum variance control with dead time . . . . . . . . . . . . . . . . . . . 341

    7.7 Summary of adaptive control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

    8 Multivariable controller design 3518.1 Controllability and observability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352

    8.1.1 Controllability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3528.1.2 Observability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3548.1.3 Computing controllability and observability . . . . . . . . . . . . . . . . . . 3558.1.4 State reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356

    8.2 State space pole-placement controller design . . . . . . . . . . . . . . . . . . . . . . 3598.2.1 Poles and where to place them . . . . . . . . . . . . . . . . . . . . . . . . . . 3628.2.2 Deadbeat control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364

    8.3 Estimating the unmeasured states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3668.4 Combining estimation and state feedback . . . . . . . . . . . . . . . . . . . . . . . . 3678.5 Generic model control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

    8.5.1 The tuning parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3718.5.2 GMC control of a linear model . . . . . . . . . . . . . . . . . . . . . . . . . . 3738.5.3 GMC applied to a nonlinear plant . . . . . . . . . . . . . . . . . . . . . . . . 375

    8.6 Exact feedback linearisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3808.6.1 The nonlinear system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380

  • CONTENTS vii

    8.6.2 The input/output feedback linearisation control law . . . . . . . . . . . . . 380

    8.6.3 Exact feedback example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382

    8.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386

    9 Classical optimal control 387

    9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387

    9.2 Parametric optimisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388

    9.2.1 Choosing a performance indicator . . . . . . . . . . . . . . . . . . . . . . . . 388

    9.2.2 Optimal tuning of a PID regulator . . . . . . . . . . . . . . . . . . . . . . . . 389

    9.2.3 Using SIMULINK inside an optimiser . . . . . . . . . . . . . . . . . . . . . . . 395

    9.2.4 An optimal batch reactor temperature policy . . . . . . . . . . . . . . . . . . 396

    9.3 The general optimal control problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 397

    9.3.1 The optimal control formulation . . . . . . . . . . . . . . . . . . . . . . . . . 399

    9.3.2 The two-point boundary problem . . . . . . . . . . . . . . . . . . . . . . . . 401

    9.3.3 Optimal control examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402

    9.3.4 Problems with a specified target set . . . . . . . . . . . . . . . . . . . . . . . 406

    9.4 Linear quadratic control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409

    9.4.1 Continuous linear quadratic regulators . . . . . . . . . . . . . . . . . . . . . 409

    9.4.2 Analytical solution to the LQR problem . . . . . . . . . . . . . . . . . . . . . 411

    9.4.3 The steady-state solution to the matrix Riccati equation . . . . . . . . . . . . 415

    9.4.4 The discrete LQR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418

    9.4.5 A numerical validation of the optimality of LQR . . . . . . . . . . . . . . . . 423

    9.4.6 An LQR with integral states . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

    9.5 Estimation of state variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431

    9.5.1 Random processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431

    9.5.2 Combining deterministic and stochastic processes . . . . . . . . . . . . . . . 437

    9.5.3 The Kalman filter estimation scheme . . . . . . . . . . . . . . . . . . . . . . . 438

    9.5.4 The steady-state form of the Kalman filter . . . . . . . . . . . . . . . . . . . . 442

    9.5.5 Current and future prediction forms . . . . . . . . . . . . . . . . . . . . . . . 443

    9.5.6 An application of the Kalman filter . . . . . . . . . . . . . . . . . . . . . . . . 447

    9.5.7 The role of the Q and R noise covariance matrices in the state estimator . . 448

    9.5.8 Extensions to the basic Kalman filter algorithm . . . . . . . . . . . . . . . . . 452

    9.5.9 The Extended Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454

    9.5.10 Combining state estimation and state feedback . . . . . . . . . . . . . . . . . 457

    9.5.11 Optimal control using only measured outputs . . . . . . . . . . . . . . . . . 457

    9.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459

    10 Predictive control 461

    10.1 Model predictive control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461

    10.1.1 Constrained predictive control . . . . . . . . . . . . . . . . . . . . . . . . . . 464

    10.1.2 Dynamic matrix control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468

    10.2 A Model Predictive Control Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

    10.2.1 A model predictive control GUI . . . . . . . . . . . . . . . . . . . . . . . . . 474

    10.2.2 MPC toolbox in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

    10.2.3 Using the MPC toolbox in SIMULINK . . . . . . . . . . . . . . . . . . . . . . 476

    10.2.4 Further readings on MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477

    10.3 Optimal control using linear programming . . . . . . . . . . . . . . . . . . . . . . . 478

    10.3.1 Development of the LP problem . . . . . . . . . . . . . . . . . . . . . . . . . 479

  • viii CONTENTS

    11 Expert systems and neural networks 48711.1 Expert systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

    11.1.1 Where are they used? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48811.1.2 Features of an expert system . . . . . . . . . . . . . . . . . . . . . . . . . . . 48811.1.3 The user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49011.1.4 Expert systems used in process control . . . . . . . . . . . . . . . . . . . . . 490

    11.2 Neural networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49311.2.1 The architecture of the neural network . . . . . . . . . . . . . . . . . . . . . . 49511.2.2 Curve fitting using neural networks . . . . . . . . . . . . . . . . . . . . . . . 499

    11.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503

    A List of symbols 505

    B Useful utility functions in Matlab 507

    C Transform pairs 509

    D A comparison of Maple andMuPad 511D.1 Partial fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511D.2 Integral transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511D.3 Differential equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512D.4 Vectors and matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513

    E Useful test models 515E.1 A forced circulation evaporator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515E.2 Aircraft model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516

  • List of Figures

    1.1 Traditional vs. Advanced control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Economic improvements of better control . . . . . . . . . . . . . . . . . . . . . . . . 61.3 Blackbox configuration. The manual switch marked will toggle between either 7

    or 9 low-pass filters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.4 The Black-box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.5 Balance arm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.6 The flapper wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.7 Flapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.8 Helicopter plant with 2 degrees of freedom. See also Fig. 1.9(a). . . . . . . . . . . . 101.9 Helicopter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.10 Helicopter flying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.11 Real-time Simulink simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    2.1 The computer in the control loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.2 3 bit sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.3 A time series with unknown frequency components . . . . . . . . . . . . . . . . . . 182.4 The frequency component of a sampled signal . . . . . . . . . . . . . . . . . . . . . 182.5 Frequency aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.6 The Scarlet Letter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.7 Henons attractor in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.8 Henons attractor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.9 Inverting z-transforms using dimpulse . . . . . . . . . . . . . . . . . . . . . . . . . . 292.10 Numerically inverting the Laplace transform using the Bromwich integral . . . . . 332.11 Numerically inverting the Laplace transform . . . . . . . . . . . . . . . . . . . . . . 332.12 Numerically inverting Laplace transforms . . . . . . . . . . . . . . . . . . . . . . . . 342.13 Ideal sampler and zeroth-order hold . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.14 Zeroth-order hold effects on the discrete Bode diagram . . . . . . . . . . . . . . . . 412.15 Bode plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422.16 The discrete root locus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442.17 Various discrete closed loop responses . . . . . . . . . . . . . . . . . . . . . . . . . . 442.18 A binary distillation column with multiple inputs and multiple outputs . . . . . . 452.19 A block diagram of a state-space dynamic system, (a) continuous system: x =

    Ax+Bu, and (b) discrete system: xk+1 = xk +uk. (See also Fig. 2.20.) . . . . 472.20 A complete block diagram of a state-space dynamic system with output and direct

    measurement feed-through, Eqn. 2.41. . . . . . . . . . . . . . . . . . . . . . . . . . . 482.21 Unsteady and steady states for level systems . . . . . . . . . . . . . . . . . . . . . . 572.22 Submarine step response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662.23 Issues in assessing system stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692.24 Nyquist diagram of Eqn. 2.94 in (a) three dimensions and (b) as typically presented

    in two dimensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732.25 Liapunov (18571918) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752.26 Regions of stability for the poles of continuous (left) and discrete (right) systems . 82

    ix

  • x LIST OF FIGURES

    3.1 A stable and unstable pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873.2 Simple buffer tank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893.3 The UK growth based on the GDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913.4 A CSTR reactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933.5 A forced circulation evaporator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943.6 Schematic of a distillation column . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963.7 Wood-Berry step response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973.8 Wood-Berry column in SIMULINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983.9 Distillation tower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993.10 Sparsity of the distillation column model . . . . . . . . . . . . . . . . . . . . . . . . 1013.11 Open loop distillation column control . . . . . . . . . . . . . . . . . . . . . . . . . . 1023.12 Distillation column control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033.13 Distillation column control (in detail) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033.14 Distillation interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1043.15 Dynamic RGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063.16 Dynamic RGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063.17 Density of Air . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093.18 Fitting a high-order polynomial to some physical data . . . . . . . . . . . . . . . . . 1113.19 A bio-chemical reaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1143.20 Model of compressed water . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1153.21 Experimental pressure-rate data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1193.22 Parameter confidence regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1193.23 Linear and nonlinear trajectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1213.24 Linearising a nonlinear tank model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    4.1 Comparing PI and integral-only control for the real-time control of a noisy flapperplant with sampling time T = 0.08. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

    4.2 PID simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1354.3 PID internals in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1364.4 Block diagram of PID controllers as implemented in SIMULINK (left) and classical

    text books (right). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1364.5 Realisable PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1374.6 PID controller in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1374.7 PID controller with anti-derivative kick. . . . . . . . . . . . . . . . . . . . . . . . . . 1394.8 Avoiding derivative kick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1394.9 Illustrating the improvement of anti-derivative kick schemes for PID controllers

    when applied to the experimental electromagnetic balance. . . . . . . . . . . . . . . 1404.10 Derivative control and noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1414.11 Anti-windup comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1424.12 Discrete PID controller in SIMULINK . . . . . . . . . . . . . . . . . . . . . . . . . . . 1454.13 Headbox control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1464.14 Headbox controlled response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1474.15 A PID controlled process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1484.16 Sample time and discrete PID control . . . . . . . . . . . . . . . . . . . . . . . . . . 1494.17 The parameters T andL to be graphically estimated for the openloop tuningmethod

    relations given in Table 4.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1514.18 Cohen-Coon model fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1524.19 Cohen-Coon tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1534.20 PID tuning using a GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1544.21 Solving for the ultimate frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1574.22 Ziegler-Nichols tuned responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1584.23 Typical response of a stable system to a P-controller. . . . . . . . . . . . . . . . . . . 1604.24 A Yuwana-Seborg closed loop step test . . . . . . . . . . . . . . . . . . . . . . . . . . 1634.25 Closed loop responses using the YS scheme . . . . . . . . . . . . . . . . . . . . . . . 164

  • LIST OF FIGURES xi

    4.26 A self-tuning PID controlled process . . . . . . . . . . . . . . . . . . . . . . . . . . . 1674.27 A process under relay tuning with the PID regulator disabled. . . . . . . . . . . . . 1674.28 An unknown plant under relay feedback exhibits an oscillation . . . . . . . . . . . 1694.29 Nyquist & Bode diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1714.30 PID Relay tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1724.31 Relay tuning with noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1744.32 Relay tuning of the blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1754.33 Relay tuning results of the blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . 1764.34 A relay with hysteresis width h and output amplitude d. . . . . . . . . . . . . . . . 1774.35 Relay feedback with hysteresis width h. . . . . . . . . . . . . . . . . . . . . . . . . . 1784.36 Relay feedback with hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1784.37 Relay feedback with an integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1784.38 2-point Relay identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1804.39 The J curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1814.40 An inverse response process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1824.41 A NMP plant controlled with a PI controller . . . . . . . . . . . . . . . . . . . . . . 1834.42 Approximating inverse-response systems with additional deadtime . . . . . . . . . 1844.43 The Smith predictor structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1854.44 The Smith predictor structure from Fig. 4.43 assuming no model/plant mis-match. 1864.45 Smith predictor in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1864.46 Dead time compensation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1874.47 Deadtime compensation applied to the blackbox . . . . . . . . . . . . . . . . . . . . 1884.48 Closed loop with plant G(s) and controller C(s) subjected to disturbances and

    measurement noise. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1894.49 Sensitivity transfer functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1904.50 Sensitivity robustness measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

    5.1 A filter as a transfer function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1935.2 A noisy measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1945.3 Noise added to a true, but unknown, signal . . . . . . . . . . . . . . . . . . . . . . . 1955.4 Derivative action given noisy data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1965.5 Smoothing industrial data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1985.6 Low-pass filter specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1995.7 Three single low-pass filters cascaded together to make a third-order filter. . . . . . 1995.8 Amplitude response for ideal, low-pass, high pass and band-pass filters. . . . . . . 2005.9 Analogue Butterworth filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2025.10 Analogue Chebyshev filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2075.11 Butterworth and Chebyshev filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2085.12 Using a Butterworth filter to smooth noisy data . . . . . . . . . . . . . . . . . . . . . 2115.13 The frequency response for Butterworth filters . . . . . . . . . . . . . . . . . . . . . 2125.14 Various Butterworth filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2135.15 Advantages of frequency pre-warping . . . . . . . . . . . . . . . . . . . . . . . . . . 2145.16 Hardware difference equation in Direct Form I . . . . . . . . . . . . . . . . . . . . . 2155.17 An IIR filter with a minimal number of delays, Direct Form II . . . . . . . . . . . . 2165.18 Cascaded second-order sections to realise a high-order filter. See also Fig. 5.19. . . 2175.19 A second-order section (SOS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2185.20 Comparing single precision second-order sections with filters in direct form II

    transposed form. Note that the direct form II filter is actually unstable when runin single precision. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

    5.21 Approximating square waves with sine waves . . . . . . . . . . . . . . . . . . . . . 2235.22 The Fourier approximation to a square wave . . . . . . . . . . . . . . . . . . . . . . 2235.23 Two signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2245.24 Critical radio frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2285.25 Power spectrum for a signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

  • xii LIST OF FIGURES

    5.26 Smoothing by Fourier transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2305.27 Differentiating and smoothing noisy measurement . . . . . . . . . . . . . . . . . . . 2325.28 Filtering industrial data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    6.1 The prediction problem: Given a model and the input, u, can we predict the out-put, y? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

    6.2 A good model,M, duplicates the behaviour of the true plant, S. . . . . . . . . . . . 2376.3 An experimental setup for input/output identification. We log both the input and

    the response data to a computer for further processing. . . . . . . . . . . . . . . . . 2386.4 Typical open loop step tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2406.5 Areas method for model identification . . . . . . . . . . . . . . . . . . . . . . . . . . 2416.6 Examples of the Areas method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2426.7 Identification of the Blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2426.8 Balance arm step test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2436.9 Random signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2446.10 A 5-element binary shift register to generate a pseudo-random binary sequence. . 2456.11 Pseudo-random binary sequence generator in SIMULINK . . . . . . . . . . . . . . . 2456.12 Black box experimental setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2476.13 Black box response analysis using a series of sine waves . . . . . . . . . . . . . . . . 2476.14 Black box response using an input chirp signal. . . . . . . . . . . . . . . . . . . . . . 2496.15 Black box frequency response analysis using a chirp signal. . . . . . . . . . . . . . . 2496.16 Flapper response to a chirp signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2506.17 Experimental setup to subject a random input into an unknown plant. The in-

    put/output data was collected, processed through Listing 6.2 to give the frequencyresponse shown in Fig. 6.18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    6.18 The experimental frequency response compared to the true analytical Bode dia-gram. See the routine in Listing 6.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

    6.19 Black box response given a pseudo-random input sequence. . . . . . . . . . . . . . 2526.20 Black box frequency response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2526.21 Empirical transfer function estimate . . . . . . . . . . . . . . . . . . . . . . . . . . . 2536.22 Experimental data from a continuous plant . . . . . . . . . . . . . . . . . . . . . . . 2556.23 A continuous-time model fitted to input/output data . . . . . . . . . . . . . . . . . 2566.24 Continuous model identification strategy . . . . . . . . . . . . . . . . . . . . . . . . 2576.25 Continuous model identification simulation . . . . . . . . . . . . . . . . . . . . . . . 2596.26 Continuous model identification of the blackbox . . . . . . . . . . . . . . . . . . . . 2606.27 Identification using Laguerre functions . . . . . . . . . . . . . . . . . . . . . . . . . 2616.28 A signal flow diagram of an auto-regressive model with exogenous input or ARX

    model. Compare this structure with the similar output-error model in Fig. 6.30. . . 2626.29 A signal flow diagram of a ARMAXmodel. Note that the only difference between

    this, and the ARX model in Fig. 6.28, is the inclusion of the C polynomial filteringthe noise term. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

    6.30 A signal flow diagram of an output-error model. Compare this structure with thesimilar ARX model in Fig. 6.28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

    6.31 A general input/output model structure . . . . . . . . . . . . . . . . . . . . . . . . . 2656.32 ARX estimation exhibiting bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2706.33 Offline system identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2716.34 Identification of deadtime from the step response . . . . . . . . . . . . . . . . . . . 2786.35 Deadtime estimation at fast sampling . . . . . . . . . . . . . . . . . . . . . . . . . . 2786.36 Deadtime estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2796.37 Blackbox step model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2796.38 Hammerstein and Wiener model structures . . . . . . . . . . . . . . . . . . . . . . . 2816.39 Ideal RLS parameter estimation. (See also Fig. 6.41(a).) . . . . . . . . . . . . . . . . 2866.40 Recursive least squares estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2876.41 RLS under SIMULINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

  • LIST OF FIGURES xiii

    6.42 RLS under SIMULINK (version 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2896.43 Estimation of a two parameter plant . . . . . . . . . . . . . . . . . . . . . . . . . . . 2916.44 Confidence limits for estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2916.45 RLS and an abrupt plant change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2926.46 The memory when using a forgetting factor . . . . . . . . . . . . . . . . . . . . . . . 2936.47 Identification using various forgetting factors . . . . . . . . . . . . . . . . . . . . . . 2946.48 Covariance wind-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2966.49 The MIT rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2996.50 Optimising the adaptation gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3006.51 Addition of coloured noise to a dynamic process. See also Fig. 6.31. . . . . . . . . . 3016.52 RLS with coloured noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3036.53 Nonlinear parameter estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3046.54 Recursive extended least-squares estimation . . . . . . . . . . . . . . . . . . . . . . 3056.55 A simplified recursive least squares algorithm . . . . . . . . . . . . . . . . . . . . . 3076.56 Furnace input/output data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3086.57 Closed loop estimation using Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . 3096.58 RLS in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

    7.1 The structure of an indirect adaptive controller . . . . . . . . . . . . . . . . . . . . . 3197.2 Varying process gain of a spherical tank . . . . . . . . . . . . . . . . . . . . . . . . . 3207.3 Simple minimum variance control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3247.4 Simple minimum variance control (zoomed) . . . . . . . . . . . . . . . . . . . . . . 3257.5 Adaptive pole-placement control structure . . . . . . . . . . . . . . . . . . . . . . . 3257.6 Adaptive pole-placement control structure with RLS identification . . . . . . . . . 3317.7 Control of multiple plants with an adapting controller. We desire the same closed

    loop response irrespective of the choice of plant. . . . . . . . . . . . . . . . . . . . . 3327.8 Three open loop plants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3327.9 Desired closed loop response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3327.10 Adaptive pole-placement with identification . . . . . . . . . . . . . . . . . . . . . . 3347.11 Comparing the adaptive pole-placement with the reference trajectory . . . . . . . . 3357.12 Bursting in adaptive control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3367.13 A plant with poorly damped zeros . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3367.14 Adaptive pole-placement with an unstable B . . . . . . . . . . . . . . . . . . . . . . 3397.15 Pole-zero map of an adaptive pole-placement . . . . . . . . . . . . . . . . . . . . . . 3407.16 Areas of well-damped poles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3407.17 Adaptive pole-placement of the black-box . . . . . . . . . . . . . . . . . . . . . . . . 3427.18 Adaptive pole-placement of the black-box . . . . . . . . . . . . . . . . . . . . . . . . 3437.19 A non-minimum phase plant with an unstable zero which causes an inverse step

    response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3457.20 Moving average control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

    8.1 Reconstructing states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3608.2 Pole-placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3638.3 Deadbeat control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3658.4 Simultaneous control and state estimation . . . . . . . . . . . . . . . . . . . . . . . . 3688.5 Control and estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3708.6 GMC tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3728.7 GMC tuning characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3728.8 Linear GMC response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3748.9 Linear GMC comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3758.10 GMC CSTR control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3788.11 A CSTR phase plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3798.12 The configuration of an input/output feedback linearisation control law . . . . . . 3818.13 Exact feedback linearisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385

  • xiv LIST OF FIGURES

    9.1 IAE areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3899.2 ITAE breakdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3909.3 Optimal responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3909.4 Optimal PID tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3939.5 Optimum PI tuning of the blackbox plant . . . . . . . . . . . . . . . . . . . . . . . . 3949.6 SIMULINK model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3959.7 Production of a valuable chemical in a batch reactor. . . . . . . . . . . . . . . . . . . 3969.8 Temperature profile optimisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3979.9 Temperature profile optimisation using 3 temperatures . . . . . . . . . . . . . . . . 3989.10 Optimum temperature profile comparison for different number of temperatures . 3989.11 Optimal control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4049.12 Optimal control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4069.13 Optimal control with targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4089.14 Steady-state and time-varying LQR control . . . . . . . . . . . . . . . . . . . . . . . 4149.15 Steady-state continuous LQR controller . . . . . . . . . . . . . . . . . . . . . . . . . 4179.16 Comparing discrete and continuous LQR controllers . . . . . . . . . . . . . . . . . . 4209.17 LQR control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4239.18 Pole-placement and LQR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4249.19 Pole-placement and LQR showing the input . . . . . . . . . . . . . . . . . . . . . . 4259.20 Trial pole locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4259.21 Trial pole-placement performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4269.22 State feedback control system with an integral output state . . . . . . . . . . . . . . 4289.23 State feedback with integral states . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4299.24 Black box servo control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4309.25 A state-based estimation and control scheme . . . . . . . . . . . . . . . . . . . . . . 4319.26 PDF of a random variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4329.27 Correlated noisy x, y data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4359.28 2D ellipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4369.29 Kalman filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4429.30 A block diagram of a steady-state prediction-type Kalman filter applied to a linear

    discrete plant. Compare with the alternative form in Fig. 9.31. . . . . . . . . . . . . 4449.31 A block diagram of a steady-state current estimator-type Kalman filter applied to

    a linear discrete plant. Compare with the alternative prediction form in Fig. 9.30. . 4459.32 Kalman filter demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4489.33 The performance of a Kalman filter for different q/r ratios . . . . . . . . . . . . . . 4519.34 A random walk process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4569.35 LQG in SIMULINK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458

    10.1 Horizons used in model predictive control . . . . . . . . . . . . . . . . . . . . . . . 46210.2 Predictions of the Reserve Bank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46210.3 Inverse plant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46510.4 Predictive control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46610.5 Acausal response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46710.6 Varying the horizons of predictive control . . . . . . . . . . . . . . . . . . . . . . . . 46810.7 MPC on the blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46810.8 Step response coefficients, gi, for a stable system. . . . . . . . . . . . . . . . . . . . . 46910.9 DMC control details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47110.10DMC control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47210.11Adaptive DMC of the blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47310.12An MPC graphical user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47410.13Multivariable MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47610.14SIMULINK and MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47610.15MPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47710.16LP constraint matrix dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481

  • LIST OF FIGURES xv

    10.17LP optimal control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48410.18LP optimal control with active constraints . . . . . . . . . . . . . . . . . . . . . . . . 48510.19Non-square LP optimal control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48510.20LP optimal control showing acausal behaviour . . . . . . . . . . . . . . . . . . . . . 486

    11.1 Possible neuron activation functions. . . . . . . . . . . . . . . . . . . . . . . . . . . 49511.2 A single neural processing unit with multiple inputs . . . . . . . . . . . . . . . . . . 49611.3 Single layer feedforward neural network . . . . . . . . . . . . . . . . . . . . . . . . 49711.4 A 3 layer fully interconnected feedforward neural network . . . . . . . . . . . . . . 49711.5 Single layer network with feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49811.6 An unknown input/output function . . . . . . . . . . . . . . . . . . . . . . . . . . . 49911.7 Fitting a Neural-Network to an unknown input/output function . . . . . . . . . . 50111.8 Tide predictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502

  • xvi LIST OF FIGURES

  • List of Tables

    1.1 Computer aids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    2.1 Final and initial value theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.2 Inverting a z transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.3 Laplace transform pairs used for testing . . . . . . . . . . . . . . . . . . . . . . . . . 34

    3.1 Standard nomenclature used in modelling dynamic systems . . . . . . . . . . . . . 903.2 Parameters of the CSTR model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933.3 The important variables in the forced circulation evaporator . . . . . . . . . . . . . 943.4 Compressed water . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1143.5 The parameter values for the CSTR model . . . . . . . . . . . . . . . . . . . . . . . . 1223.6 The initial state and manipulated variables for the CSTR simulation . . . . . . . . . 123

    4.1 Alternative PID tuning parameter conventions . . . . . . . . . . . . . . . . . . . . . 1324.2 Ziegler-Nichols open-loop PID tuning rules . . . . . . . . . . . . . . . . . . . . . . . 1524.3 PID controller settings based on IMC for a small selection of common plants where

    the control engineer gets to chose a desired closed loop time constant, c. . . . . . . 1544.4 Various alternative Ziegler-Nichols type PID tuning rules as a function of the

    ultimate gain, Ku, and ultimate period, Pu. . . . . . . . . . . . . . . . . . . . . . . . 1554.5 Closed-loop single-test PID design rules . . . . . . . . . . . . . . . . . . . . . . . . . 1614.6 Relay based PID tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

    5.1 Filter transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

    6.1 Experimentally determined frequency response of the blackbox . . . . . . . . . . . 2486.2 Identification in state-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

    8.1 The relationship between regulation and estimation . . . . . . . . . . . . . . . . . . 3678.2 Litchfield nonlinear CSTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376

    9.1 Common integral performance indices . . . . . . . . . . . . . . . . . . . . . . . . . . 391

    11.1 Comparing expert systems and neural networks . . . . . . . . . . . . . . . . . . . . 494

    xvii

  • xviii LIST OF TABLES

  • Listings

    2.1 Symbolic Laplace to z-transform conversion . . . . . . . . . . . . . . . . . . . . . . 372.2 Symbolic Laplace to z-transform conversion with ZOH . . . . . . . . . . . . . . . . 372.3 Extracting the gain, time constants and numerator time constants from an arbitrary

    transfer function format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562.4 Submarine simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652.5 Example of the Routh array using the symbolic toolbox . . . . . . . . . . . . . . . . 712.6 Solve the continuous matrix Lyapunov equation using Kronecker products . . . . 772.7 Solve the matrix Lyapunov equation using the lyap routine . . . . . . . . . . . . . 782.8 Solve the discrete matrix Lyapunov equation using Kronecker products . . . . . . 793.1 Computing the dynamic relative gain array analytically . . . . . . . . . . . . . . . . 1053.2 Computing the dynamic relative gain array numerically as a function of . See

    also Listing 3.1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053.3 Curve fitting using polynomial least-squares . . . . . . . . . . . . . . . . . . . . . . 1093.4 Polynomial least-squares using singular value decomposition. This routine fol-

    lows from, and provides an alternative to Listing 3.3. . . . . . . . . . . . . . . . . . 1113.5 Curve fitting using a generic nonlinear optimiser . . . . . . . . . . . . . . . . . . . . 1133.6 Curve fitting using the OPTI optimisation toolbox. (Compare with Listing 3.5.) . . 1133.7 Fitting water density as a function of temperature and pressure . . . . . . . . . . . 1153.8 Parameter confidence limits for a nonlinear reaction rate model . . . . . . . . . . . 1183.9 Comparing the dynamic response of a pendulum to the linear approximation . . . 1213.10 Using linmod to linearise an arbitrary SIMULINK module. . . . . . . . . . . . . . . 1274.1 Constructing a transfer function of a PID controller . . . . . . . . . . . . . . . . . . 1334.2 Constructing a discrete (filtered) PID controller . . . . . . . . . . . . . . . . . . . . . 1454.3 A simple PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1574.4 Ziegler-Nichols PID tuning rules for an arbitrary transfer function . . . . . . . . . . 1594.5 Identifies the characteristic points for the Yuwana-Seborg PID tuner from a trial

    closed loop response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1644.6 Compute the closed loop model from peak and trough data . . . . . . . . . . . . . 1654.7 Compute the ultimate gain and frequency from the closed loop model parameters. 1654.8 Compute the open loop model, Gm, Eqn. 4.31. . . . . . . . . . . . . . . . . . . . . . 1654.9 Compute appropriate PI or PID tuning constants based on a plant model, Gm,

    using the IMC schemes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1654.10 Calculates the period and amplitude of a sinusoidal time series using least-squares. 1745.1 Designing Butterworth Filters using Eqn. 5.4. . . . . . . . . . . . . . . . . . . . . . . 2035.2 Designing a low-pass Butterworth filter with a cut-off frequency of fc = 800Hz. . 2035.3 Designing a high-pass Butterworth filter with a cut-off frequency of fc = 800Hz. . 2035.4 Designing Chebyshev Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2065.5 Computing a Chebyshev Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2075.6 Converting a 7th-order Butterworth filter to 4 second-order sections . . . . . . . . . 2185.7 Comparing DFII and SOS digital filters in single precision. . . . . . . . . . . . . . . 2195.8 Routine to compute the power spectral density plot of a time series . . . . . . . . . 226

    xix

  • xx LISTINGS

    5.9 Smoothing and differentiating a noisy signal . . . . . . . . . . . . . . . . . . . . . . 2326.1 Identification of a first-order plant with deadtime from an openloop step response

    using the Areas method from Algorithm 6.1. . . . . . . . . . . . . . . . . . . . . . . 2416.2 Frequency response identification of an unknown plant directly from input/out-

    put data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2506.3 Non-parametric frequency response identification using etfe. . . . . . . . . . . . . 2536.4 Function to generate output predictions given a trial model and input data. . . . . 2556.5 Optimising the model parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2556.6 Validating the fitted model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2566.7 Continuous model identification of a non-minimum phase system . . . . . . . . . . 2586.8 Generate some input/output data for model identification . . . . . . . . . . . . . . 2686.9 Estimate an ARX model from an input/output data series using least-squares . . . 2696.10 An alternative way to construct the data matrix for ARX estimation using Toeplitz

    matrices. See also Listing 6.9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2696.11 Offline system identification using arx from the System Identification Toolbox . . 2716.12 Offline system identification with no model/plant mismatch . . . . . . . . . . . . . 2716.13 Demonstrate the fitting of an AR model. . . . . . . . . . . . . . . . . . . . . . . . . . 2726.14 Create an input/output sequence from an output-error plant. . . . . . . . . . . . . 2736.15 Parameter identification of an output error process using oe and arx. . . . . . . . 2736.16 A basic recursive least-squares (RLS) update (without forgetting factor) . . . . . . . 2846.17 Tests the RLS identification scheme using Listing 6.16. . . . . . . . . . . . . . . . . . 2866.18 A recursive least-squares (RLS) update with a forgetting factor. (See also List-

    ing 6.16.) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2936.19 Adaption of the plant gain using steepest descent . . . . . . . . . . . . . . . . . . . 2996.20 Create an ARMAX process and generate some input/output data suitable for sub-

    sequent identification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3026.21 Identify an ARMAX process from the data generated in Listing 6.20. . . . . . . . . 3036.22 Recursively identify an ARMAX process. . . . . . . . . . . . . . . . . . . . . . . . . 3036.23 Kaczmarzs algorithm for identification . . . . . . . . . . . . . . . . . . . . . . . . . 3067.1 Simple minimum variance control where the plant has no time delay . . . . . . . . 3237.2 A Diophantine routine to solve FA+BG = T for the polynomials F and G. . . . . 3287.3 Alternative Diophantine routine to solve FA+BG = T for the polynomials F and

    G. Compare with Listing 7.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3287.4 Constructing polynomials for the Diophantine equation example . . . . . . . . . . 3297.5 Solving the Diophantine equation using polynomials generated from Listing 7.4. . 3307.6 Adaptive pole-placement control with 3 different plants . . . . . . . . . . . . . . . . 3337.7 The pole-placement control law when H = 1/B . . . . . . . . . . . . . . . . . . . . 3377.8 Factorising a polynomialB(q) into stable,B+(q) and unstable and poorly damped,

    B(q) factors such that B = B+B and B+ is defined as monic. . . . . . . . . . . . 3387.9 Minimum variance control design . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3438.1 A simple state reconstructor following Algorithm 8.1. . . . . . . . . . . . . . . . . . 3598.2 Pole-placement control of a well-behaved system . . . . . . . . . . . . . . . . . . . . 3628.3 A deadbeat controller simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3658.4 Pole placement for controllers and estimators . . . . . . . . . . . . . . . . . . . . . . 3698.5 GMC on a Linear Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3738.6 GMC for a batch reactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3778.7 The dynamic equations of a batch reactor . . . . . . . . . . . . . . . . . . . . . . . . 3778.8 Find the Lie derivative for a symbolic system . . . . . . . . . . . . . . . . . . . . . . 3838.9 Establish relative degree, r (ignore degree 0 possibility) . . . . . . . . . . . . . . . . 3848.10 Design Butterworth filter of order r. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3848.11 Symbolically create the closed loop expression . . . . . . . . . . . . . . . . . . . . . 3849.1 Returns the IAE performance for a given tuning. . . . . . . . . . . . . . . . . . . . . 3929.2 Optimal tuning of a PID controller for a non-minimum phase plant. This script file

    uses the objective function given in Listing 9.1. . . . . . . . . . . . . . . . . . . . . . 392

  • LISTINGS xxi

    9.3 Returns the ITSE using a SIMULINK model. . . . . . . . . . . . . . . . . . . . . . . . 395

    9.4 Analytically computing the co-state dynamics and optimum input trajectory as afunction of states and co-states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

    9.5 Solving the reaction profile boundary value problem using the boundary valueproblem solver, bvp4c.m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405

    9.6 Computes the full time-evolving LQR solution . . . . . . . . . . . . . . . . . . . . . 413

    9.7 The continuous time differential Riccati equation. This routine is called from List-ing 9.8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

    9.8 Solves the continuous time differential Riccati equation using a numerical ODEintegrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

    9.9 Calculate the continuous optimal steady-state controller gain. . . . . . . . . . . . . 416

    9.10 Closed loop simulation using an optimal steady-state controller gain. . . . . . . . . 416

    9.11 Solving the algebraic Riccati equation for P using Kronecker products and vec-torisation given matricesA,B,Q andR. . . . . . . . . . . . . . . . . . . . . . . . . 417

    9.12 Calculate the discrete optimal steady-state gain by iterating until exhaustion.Note it is preferable for numerical reasons to use lqr for this computation. . . . . 419

    9.13 Comparing the continuous and discrete LQR controllers. . . . . . . . . . . . . . . . 419

    9.14 An LQR controller for the blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423

    9.15 Comparing an LQR controller from Listing 9.14 with a pole-placement controller . 424

    9.16 Computing the closed loop poles from the optimal LQR controller from Listing 9.14.426

    9.17 Comparing the actual normally distributed random numbers with the theoreticalprobability density function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432

    9.18 Probability and inverse probability distributions for the F -distribution. . . . . . . . 434

    9.19 Generate some correlated random data. . . . . . . . . . . . . . . . . . . . . . . . . . 434

    9.20 Plot a 3D histogram of the random data from Listing 9.19. . . . . . . . . . . . . . . 435

    9.21 Compute the uncertainty regions from the random data from Listing 9.20. . . . . . 436

    9.22 Validating the uncertainty regions computed theoretically from Listing 9.21. . . . . 436

    9.23 Solving the discrete time Riccati equation using exhaustive iteration around Eqn. 9.98or alternatively using the dare routine. . . . . . . . . . . . . . . . . . . . . . . . . . 443

    9.24 Alternative ways to compute the Kalman gain . . . . . . . . . . . . . . . . . . . . . 445

    9.25 State estimation of a randomly generated discrete model using a Kalman filter. . . 447

    9.26 Computing the Kalman gain using dlqe. . . . . . . . . . . . . . . . . . . . . . . . . 4499.27 Demonstrating the optimality of the Kalman filter. . . . . . . . . . . . . . . . . . . . 450

    9.28 Potters algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453

    10.1 Predictive control with input saturation constraints using a generic nonlinear op-timiser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465

    10.2 Objective function to be minimised for the predictive control algorithm with inputsaturation constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

    10.3 Dynamic Matric Control (DMC) control . . . . . . . . . . . . . . . . . . . . . . . . . 471

    10.4 Setting up an MPC controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

    10.5 Optimal control using linear programming . . . . . . . . . . . . . . . . . . . . . . . 482

    11.1 Generate some arbitrary data to be used for subsequent fitting . . . . . . . . . . . . 500

    B.1 Polynomial addition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

    B.2 Multiple convolution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

    B.3 Strip leading zeros from a polynomial. . . . . . . . . . . . . . . . . . . . . . . . . . . 508

  • xxii LISTINGS

  • Chapter 1

    Introduction

    Mathematicians may flatter themselves that they posses new ideas which mere human language is as yetunable to express. Let them make the effort to express those ideas in appropriate words without the aid ofsymbols, and if they succeed, they will not only lay us laymen under a lasting obligation but, we venture to

    say, they will find themselves very much enlightened during the process, and will even be doubtfulwhether the ideas expressed as symbols had ever quite found their way out of the equations into their

    minds.James Clerk Maxwell, 1890

    Control, in an engineering sense, is where actions are taken to ensure that a particular physi-cal process responds in some desired manner. Automatic control is where we have relieved thehuman operator from the tedium of consistently monitoring the process and supplying the nec-essary corrections. Control as a technical discipline is therefore important not only in the fieldsof engineering, but also in economics, sociology and indeed in most aspects of our life. Whenstudying control, we naturally assume that we do conceivably have some chance of influencingthings. For example, it is worthwhile to study the operation of a coal fired power plant in orderto minimise possibly polluting emissions, but it is not worth our time to save the world from thenext ice age, or as the results of a special study group who investigated methods designed to pro-tect the world from a stray comet (such as the one postulated to have wiped out the dinosaurs 80million years ago) concluded, there was nothing feasible we could do, such as change the earthsorbit, or blast the asteroid, to avoid the collision. In these latter examples, the problem exists, butour influence is negligible.

    The teaching of control has changed in emphasis over the last decade from that of linear single-input/single-output systems elegantly described in the Laplace domain, to general nonlinearmultiple-input/multiple-output systems best analysed in the state space domain. This changehas been motivated by the increasing demands by industry and public to produce more, faster orcleaner and is nowmuch more attractive due to the impressive improvements in computer aidedtools, such as MATLAB used in these notes. This new emphasis is called advanced (or modern)control as opposed to the traditional or classical control. This set of notes is intended for studentswho have previously attended a first course in automatic control covering the usual continuouscontrol concepts like Laplace transforms, Bode diagrams, stability of linear differential equations,PID controllers, and perhaps some exposure to discrete time control topics like z transforms andstate space.

    This book attempts to describe what advanced control is, and how it is applied in engineeringapplications with emphasis on the construction of controllers using computer aided design toolssuch as the numerical programming environment MATLAB from the MathWorks, [134]. With

    1

  • 2 CHAPTER 1. INTRODUCTION

    this tool, we can concentrate on the intentions behind the design procedures, rather than themechanics to follow them.

    1.1 Scope

    Part one contains some revision material in z-transforms, modelling and PID controller tuning.The discrete domain, z-transforms, and stability concepts with a brief discussion of appropriatenumerical methods are introduced in chapter 2. A brief potpourri of modelling is summarisedin chapter 3. Chapter 4 is devoted to the most common industrial controller, the three term PIDcontroller with emphasis on tuning, implementation and limitations. Some basic concepts fromsignal processing such as filtering and smoothing are introduced in chapter 5. Identification andthe closely related adaptive control are together in chapters 6 and 7. State space analysis andoptimal control design are given in the larger chapters 8 and 9.

    Notation conventions

    Throughout these notes I have used some typographical conventions. In mathematical expres-sions, scalar variables are written in italic such as a, b, c, or if Greek, , while vectors x,y areupright bold lower case and matrices,A, are bold upper case. More notation is introduced asrequired.

    Computer commands and output and listings are given in a fixed-width font as A=chol(B*B).In some cases where you are to type an interactive command, the MATLAB prompt >> is given,and the computed solution returned. If no ambiguity exists such as in the case for functions, theprompt is omitted.

    1.2 Matlab for computer aided control design

    Modern control design has heavy computing requirements. In particular one needs to:

    1. manipulate symbolic algebraic expressions, and

    2. perform intensive numerical calculations and simulations for proto-typing and testing quicklyand reliably, and finally

    3. to implement the controller at high speed in special hardware such as an embedded con-troller or a digital signal processing (DSP) chip perhaps using assembler.

    To use this new theory, it is essential to use computer aided design (CAD) tools efficiently asreal-world problems can rarely be solved manually. But as [170] point out, the use of computersin the design of control systems has a long and fairly distinguished history. This book usesMATLAB for the design, simulation and prototyping of controllers.

    MATLAB, (which is short for MATrix LABoratory), is a programming environment that grew outof an effort to create an easy user-interface to the very popular and well regarded public domainFORTRAN linear algebra collection of programmes, LINPACK and EISPACK. With this direct inter-pretive interface, one can write quite sophisticated algorithms in a very high level language, thatare consequently easy to read and maintain. Today MATLAB is a commercial package, (although

  • 1.2. MATLAB FOR COMPUTER AIDED CONTROL DESIGN 3

    some public domain lookalikes exist), that is supported with a variety of toolboxes comprisingof collections of source code subroutines organised in areas of specific interest. The toolboxes weare most interested in, and used in this book are:

    Control toolbox containing functions for controller design, frequency domain analysis, conver-sions between various models forms, pole placement, optimal control etc. (Used through-out)

    Symbolic toolbox which contains a gateway to the symbolic capabilities of MAPLE.

    Signal processing toolbox containing filters, wave form generation and spectral analysis. (Usedprincipally in chapter 5.)

    System identification toolbox for identifying the parameters of various dynamic model types.(Used in chapter 6.) You may also find the following free statistics toolbox useful availableat: www.maths.lth.se/matstat/stixbox/.

    Real-time toolbox can be used to interface MATLAB to various analogue to digital converters.

    The student version of MATLAB (at time of writing) has a special SIGNALS & SYSTEMS TOOLBOXthat has a subset of routines from the control and signal processing toolboxes. Other toolboxesused for some sections of the notes are the OPTIMISATION TOOLBOX, used in chapter 9 and theNEURAL NETWORK toolbox.

    Additional documentation to that supplied with MATLAB is the concise and free summary notes[183] or the more recent [68]. Recently there has been exponential growth of other texts that heav-ily use MATLAB (such as this one), and a current list is available from theMathworks anonymousftp server at www.mathworks.com. This server also contains many user contributed codes, aswell as updates, bug fixes etc.

    If MATLAB, or even programming a high level language is new to you, then [201] is a cheaprecommended compendium, similar in form to this, covering topics in numerical analysis, againwith many MATLAB examples.

    1.2.1 Alternative computer design aids

    Table 1.1 lists a number of alternatives computer-aided design and modelling environments sim-ilar and complimentary to MATLAB.

    Product WWW site commentSCILAB www.scilab.org Free Matlab/Simulink cloneOCTAVE www.octave.org Free Matlab clone, inactiveRLAB rlabplus.sourceforge.net Matlab clone, LinuxVISUALMODELQ www.qxdesign.com shareware Simulink cloneMATHVIEWS www.mathwizards.com sharewareMUPAD www.mupad.de Interfaces with SCILABMAPLE www.maplesoft.com commercial CASMATHEMATICA www.mathematica.com commercial CAS

    Table 1.1: Shareware or freeware Matlab lookalikes and computer algebra systems

    Unlike MATLAB, symbolic manipulators are computer programs that by manipulating symbolscan perform algebra. Such programs are alternatively known as computer algebra systems or

  • 4 CHAPTER 1. INTRODUCTION

    CAS. The most well known examples are MATHEMATICA, MAPLE, MUPAD, and MACSYMA,(see Table 1.1). These programs can find analytical solutions to many mathematical problemsinvolving integrals, limits, special functions and so forth. They are particularly useful in thecontroller design stage.

    The Numerics in Control1 group in Europe have collect together a freeware FORTRAN subroutinelibrary SLICOT for routines relevant in systems and control.

    Problem 1.1 1. Familiarise yourself with the fundamentals of MATLAB. Run the MATLABdemo by typing demo once inside MATLAB.

    2. Try the MATLAB tutorial (part 1).3. Read through the MATLAB primer, [183] or [68], and you should get acquainted with the

    MATLAB users manual.

    1.3 Economics of control

    Most people would agree that Engineers apply technology, but what do these two words reallymean? Technology is derived from two Greek words, techne which means skill or art, and logiawhich means science or study. The interesting point here is that the art component is included.The English language unfortunately confuses the word enginewith engineering so that many peo-ple have the mistaken view that engineers drive engines (mostly). Actually engineer is derivedfrom the Latin ingeniatorium which means one who is ingenious at devising. A far cry from therelatively simple act of piloting jumbos. An interesting American perspective of the professionalengineer and modern technology is given as light reading in [2] and Flormans The ExistentialPleasures of Engineering, [66].

    Chemical engineering is, succinctly put, chemistry constrained by cost. The chemist wants thereaction to proceed, the chemical engineer takes that for granted, but is interested in increasingthe rate, or pushing the equilibrium, or in most cases both at the same time. As the incentive toproduce better products increases, accompanied by an awareness of potent global competitiondriving one to reduce costs, process control becomes an important aspect of engineering.

    Obviously modern computerised process control systems are expensive. They are especially ex-pensive compared with other computers such as office or financial computers because the marketis smaller, the environment harsher, the graphical requirementsmore critical, the duties more var-ied, and the potential payoffs larger. Process control has at least two main duties to perform; firstto ensure that the plant is operated safely (that is protect the plant, environment and people), andsecond that the product quality is consistent with some customer or regulatory body demandedspecifications. There is always a trade off between how much control you apply and the bene-fits that result. An automobile manufacturer could produce an almost totally indestructible car(ie, tank), but the expense of raw materials required, and the high running costs would certainlydeem the project an economic failure.

    On the other hand, in 1965 Ralph Nader complained in the aptly named Unsafe at Any Speedabout the poor quality of American automotive engineering, the lack of controls and the unsaferesult. This influential book challenged the balance from between commercial profits and morequality control. A product with less variation in quality may be worth more than a product thathas a higher average quality, but more variation. A potentially dangerous production facility thatregularly destroys equipment, people or surroundings is not usually tolerated by the licensingauthorities.

    1The home page is located at http://www.win.tue.nl/niconet/niconet.html

  • 1.3. ECONOMICS OF CONTROL 5

    Safety concerns motivatebetter control.

    Fig. 1.1, adapted from [6], gives an industrial perspective of the status of process control in 1994.The techniques are divided into those considered classical or traditional, which demand onlymodest digital online computing power, (if any), little in the way of explicit process models orunderstanding, and those termed loosely advanced.

    compensation

    Valves Onstream analysers

    Process computer

    multivariable

    feedforward control

    smart transmitters

    DCS

    single variable

    Online simulation

    Deadtime

    Transmitters

    Advanced control

    PLCs

    PID algorithm

    dynamic methods

    Rule definitionDirect search

    Regulatory

    Constraint

    Optimisation

    Basic

    Field

    Signal condition

    Steady state

    analogue control

    Traditional control

    Figure 1.1: A comparison of traditional vs. advanced process control techniques. Adapted from[6].

    One of the major concerns for the process control engineer is to reduce the output variance. Ifthe variation about the setpoint is small, then the setpoint can be shifted closer to the operatingconstraint, without increasing the frequency of alarms. Fig. 1.2 demonstrates the ideal case thatwhile popular in the advertising literature, is harder to achieve unambiguously in practice.

    Many text books in the control field are very vague about the actual configuration of real pro-cess control systems used today. Other books that take a more trade oriented approach, arevague about the academic side of the control performance. There are a number of reasons forthis. First many texts try hard to describe only the theoretical aspects of digital control, and any-thing remotely applied is not considered worthy of their attention. Secondly, the control systemsare rapidly changing as the cost of micro-processors drop in price, and different programmingmethods come into flavour. Thirdly many industries are deliberately vague about publishingthe details of their control system since they perceive that this information could help their com-petitors. However some information of this type is given in [63, pp131-149] and [17]. One good

  • 6 CHAPTER 1. INTRODUCTION

    spt #3

    manual control

    advanced control

    upper quality constraint

    process output

    regulatory

    loss ($)

    violations

    time

    setpoint #1

    spt #2

    Figure 1.2: Economic improvements owing to better control. If the control scheme can reducethe variance, the setpoint can be shifted closer to the operating or quality constraint, therebydecreasing operating costs.

    balance for the practitioner is [143].

    1.4 Laboratory equipment for control tests

    Obviously if we are to study automatic control with the aim to control eventually chemical plants,manufacturing processes, robots, undertake filtering to do active noise cancellation and so forth,we should practice, preferably on simpler, more well understood, and potentially less hazardousequipment.

    In the Automatic Control Laboratory in the Department of Electrical Engineering at the KarlstadUniversity, Sweden we have a number of simple bench-scale plants to test identification andcontrol algorithms on.

    1.4.1 Plants with one input and one output

    The blackbox

    Fig. 1.3 and Fig. 1.4(a) shows what we perhaps unimaginatively refer to as a black-box. It is abox, and it is coloured black. Subjecting the box to an input voltage from 0 to 5 volts delivers anoutput voltage also spanning from around 0 to 5 volts, but lagging behind the input voltage sincethe internals of the blackbox are simply either 7 or 9 (depending on the switch position) low-passpassive filters cascaded together.

    The blackbox is a relatively well behaved underdamped stable system with dominant time con-stants of around 5 to 10 seconds. Fig. 1.4(b) shows the response of the blackbox to two inputsteps. The chief disadvantage of using this device for control studies is that the output response

  • 1.4. LABORATORY EQUIPMENT FOR CONTROL TESTS 7

    - -

    --D/A A/D

    Earthinput indicator blueblue

    GND

    Input Output

    (connector #1)(connector #10)

    (connector #11)

    BLACK-BOX

    -

    Sluggish

    Fast

    To computerFrom computer

    Figure 1.3: Blackbox configuration. The manual switch marked will toggle between either 7 or 9low-pass filters.

    (a) Black-box wiring to the National InstrumentsLabPC terminator.

    input output

    15 20 25 30 35 40 45 500.05

    0

    0.05

    0.1

    0.15

    0.2

    0.25

    0.3

    0.35

    0.4

    0.45

    ipnu

    t/out

    put

    time (s)

    Blackbox step response

    (b) The response of the blackbox to 2 step inputs

    Figure 1.4: The Black-box

    is not visible to the naked eye, and that we cannot manually introduce disturbances. One com-plication you can do is to cascade two blackboxes