Linear Feedback Control. Analysis and Design with MATLAB


345 70 2MB

English Pages 220

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Linear Feedback Control. Analysis and Design with MATLAB

  • Author / Uploaded
  • Xue
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

Dingy¨u Xue, YangQuan Chen, Derek P. Atherton

Linear Feedback Control Analysis and Design with MATLAB July 3, 2002

Springer-Verlag Berlin Heidelberg NewYork London Paris Tokyo Hong Kong Barcelona Budapest

copyright page

Preface

It is well known that the benefits from control engineering are numerous including the improved product/life quality, minimized waste materials, reduced pollution, increased safety and reduced energy consumption etc. One can observe that the notion of feedback and control plays an important role in most socio-technological aspects. A slogan, “Control Will Be the Physics of the 21st Century”, appeared in a plenary session of the 40th IEEE International Conference on Decision and Control (Dec. 2001, Orlando, FL., USA), suggests that at least all engineering students should take a first course on systems control. It is also widely accepted that the “control” subject is more “engineering” than “science” although the trend in the “control” subject seems to evolve along the reversal way of more “science” than “engineering”. This dilemma caused the “Theory/Practice Gap” which has recently been discussed in the Special Section on Theory/Practice Gap, IEEE Control Systems (vol. 19, no. 6, 1999). Using a computer to apply the control theory in control practice is now unavoidable. MATLAB/SimulinkTM is considered as the dominant software platform for control system analysis and design with numerous off-the-shelf toolboxes dedicated for control systems related topics. From what Confucius said that “The craftsman who wishes to work well has first to sharpen his implements”1) , it is clear that MATLAB is the right, already sharpened “implement”. However, the gap between a beginner and the existing rich resources or “implements” available for control systems is also obvious. Therefore, between the “Theory/Practice Gap”, for beginners, there exists another party - CACSD (computer-aided control systems design) or MATLAB. That is, the gap “Theory-MATLAB-Practice” should be minimized in the first control course for all engineering students. For example, one may not even know how to enter the system model into the form understandable by MATLAB. This textbook aims at minimizing the “Theory-MATLAB” gap via reduced mathematics and increased MATLAB illustrations glued within the texts as smoothly as possible. With a broad coverage of the contents essential for the analysis and design of feedback control systems in control engineering practice, this book can also be used as a handy desk top reference during control 1)

http://www.confucius.org/lunyu/ed1509.htm

ii

Preface

applications. Therefore, in general, this book will positively contribute to reducing the gap mentioned above. The most distinguished feature of the current textbook lies in its course material organization and presentation. Based on our teaching, research and industrial experience, we choose to present the course materials following the sequence of system models, time and frequency domain analysis with introduction to various model reduction techniques, model-based control design methods, PID techniques, robust control. Especially, from practical point of view, we put more emphasis on various techniques on PID control and model-based controller/compensator designs using MATLAB. In addition, we include a chapter on fractional-order control as an alternative for practical robustness tradeoffs. Extensively used in this textbook are MATLAB scripts and plots to deliver the basic concepts and examples. A dedicated toolbox CtrlLAB developed by the authors can be served as an effective teaching and learning aid. CtrlLAB is freely downloadable from the ftp site of The MathWorks Inc. It should be noted that CtrlLAB is the most downloaded package in the Control Systems category in the File Exchange of MATLAB Central (http://www.mathworks.com/matlabcentral/index.shtml). We hope that the readers could enjoy playing with the scripts and changing them as they wish for a better understanding and deeper exploration with reduced efforts. In doing so, additionally, each chapter comes with a set of problems to strengthen the understanding of the chapter contents. This book can be used as the first control course textbook for undergraduates in all engineering schools. The coverage of topics in feedback control subject is practically broad yet with balanced depth, which provides a solid foundation for the subsequent control engineering practice in both industry and research institutes. For graduates and researchers not majoring in systems control, this textbook is good for self-learning purpose. The authors also believe that this book will be a good desktop reference for systems control engineers. The writing of this book started in the mid-90s. In its evolving to the current form, many researchers, professors and students have provided useful feedback comments and inputs. Among them, in particular, taking this chance, the first author would like to thank: Professors Xinhe Xu and Xingquan Ren of Northeastern University, China; Dr. Minxia Zhuang of Northern Telecom, Canada; Professor Xiaohua Xia of Pretoria University, South Africa; Professor Shuzhi Sam Ge of National University of Singapore; Drs. Yongyao Yang, Zhanyuan Wu, Ziqiang Lang and Professor Ziqiang Zhu of Sheffield University, U.K.; Dr. Li Xie of University College, Academy of National Defense, Australia, Professor Changyou Liu of Shenyang Polytechnic University; Professor Wook-Hyun Kwon of Seoul National University, Korea; Professor Yongil Youm of Pohang University of Science and Technology, Korea; Professor Jujang Lee of Korea Advanced Institute of Science

Preface

iii

and Technology (KAIST). Thanks from the second author go to: Kiankeong Ooi, Mingzhong Ding, Tao Zhang, Qiang Bi and Jianbo He of Singapore Science Park Design Center of Seagate Technology International; Dr. Adam L. Schwartz of LGC Wireless, USA; Professor Max Meng of University of Alberta, Canada; Professor Istv´ an Koll´ ar of Budapest University of Technology and Economics; Professors Alain Ostaloup and Jocelyn Sabatier of CRONELAP-ENSERB, Universit´e Bordeaux I, France; Professors Ivo Petras and Igor Podlubny of Technical University of Kosice, Slovak Republic; Professor Blas M. Vinagre of University of Extramadura, Spain, and Professor Kevin L. Moore of Utah State University. In particular, we are grateful to Professor M. A. Johnson, the Series Editor, for his constructive comments and Oliver Jackson, Editor Assistant of Springer-Verlag London, for his professional help. Without their critique and help, this book will not be possible in its current shape. In addition, the first author wishes to acknowledge the support by the Foundation of University Key Teachers by the Ministry of Education, People’s Republic of China, and also to “The Book Program” from The MathWorks Inc., in particular to Noami Fernandez, for providing the latest MATLAB software and documentations for the related products. Last but not least, Dingy¨ u Xue would like to thank his wife Jun Yang and his daughter Yang Xue, YangQuan Chen would like to thank his wife and son, Huifang Dou and Duyun Chen, for their patience, understanding and complete support throughout this work.

Dingy¨ u Xue Northeastern University, Shengyang, China. YangQuan Chen Utah State University, Logan, USA. Derek P. Atherton University of Sussex, East Sussex, U.K.

iv

Preface

Contents

1.

Introduction to Feedback Control . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Historical Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 Structure of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 A Survival Introduction to MATLAB . . . . . . . . . . . . . . . . . . . . . 6 1.4.1 A Brief Overview of MATLAB . . . . . . . . . . . . . . . . . . . . 6 1.4.2 Standard MATLAB Statements and Functions . . . . . . . 7 1.4.3 Graphics Facilities in MATLAB . . . . . . . . . . . . . . . . . . . . 8 1.4.4 On-line Help Facilities in MATLAB . . . . . . . . . . . . . . . . . 8 1.4.5 MATLAB Toolboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.

Mathematical Models of Feedback Control Systems . . . . . . . 2.1 A Physical Modeling Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 The Laplace Transform and Transfer Function Models . . . . . . 2.3 Other Mathematical Model Representations . . . . . . . . . . . . . . . 2.3.1 State Space Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Zero-pole-gain Description . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Modeling of Interconnected Block Diagrams . . . . . . . . . . . . . . . 2.4.1 Series Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.2 Parallel Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.3 Feedback Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.4 More Complicated Connections . . . . . . . . . . . . . . . . . . . . 2.5 Conversion Among Different Model Objects . . . . . . . . . . . . . . . . 2.5.1 Conversion of LTI Objects to Transfer Functions . . . . . 2.5.2 Conversion of LTI Objects to Zero-pole-gain Models . . 2.5.3 State Space Realization . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Modeling of More Complicated Systems . . . . . . . . . . . . . . . . . . . 2.6.1 Simulink Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.2 Linearization of Nonlinear Models . . . . . . . . . . . . . . . . . . Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11 11 12 18 18 22 24 24 25 26 27 29 30 31 33 41 41 44 47

vi

3.

4.

Contents

Properties of Linear Control Systems . . . . . . . . . . . . . . . . . . . . . 3.1 Stability Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Direct Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 Indirect Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.3 Well-posedness and Internal Stability . . . . . . . . . . . . . . . 3.2 Controllability and Observability Analysis . . . . . . . . . . . . . . . . . 3.2.1 System Controllability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 System Observability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.3 Controllability and Observability Gramians . . . . . . . . . . 3.2.4 Stabilizability and Detectability . . . . . . . . . . . . . . . . . . . . 3.3 Kalman Decomposition of Linear Systems . . . . . . . . . . . . . . . . . 3.3.1 Kalman Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.2 Minimum Realization Problems Revisited . . . . . . . . . . . 3.4 Time Moments and Markov Parameters . . . . . . . . . . . . . . . . . . . 3.4.1 Expansion Around s = 0 — Time Moments . . . . . . . . . . 3.4.2 Expansion around s = ∞ — Markov Parameters . . . . . 3.5 Robustness Analysis of Feedback Control Systems . . . . . . . . . . 3.5.1 Norm Measures of Signals and Systems . . . . . . . . . . . . . 3.5.2 H2 -norm Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.3 H∞ -norm Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.4 Sensitivity and Complementary Sensitivity Functions . 3.5.5 Stability Margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6 Introduction to Model Reduction Techniques . . . . . . . . . . . . . . . 3.6.1 Pad´e Approximations and Routh Approximations . . . . 3.6.2 Pad´e Approximations to Delay Terms . . . . . . . . . . . . . . . 3.6.3 Sub-optimal Reduction Techniques for Systems with Delays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.4 State Space Model Reductions . . . . . . . . . . . . . . . . . . . . . Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

51 51 51 53 60 62 62 65 66 67 70 70 72 74 74 76 77 77 78 80 81 83 85 86 90

Time Domain Analysis of Linear Systems . . . . . . . . . . . . . . . . . 4.1 Analytical Solutions of Linear System Responses . . . . . . . . . . . 4.1.1 Partial Fraction Expansion Approach . . . . . . . . . . . . . . . 4.1.2 State Space Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Second-order Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Step Response Comparisons for Different Parameters . 4.2.2 Quantitative Specifications in Step Responses . . . . . . . . 4.2.3 Impulse Response Comparisons . . . . . . . . . . . . . . . . . . . . 4.3 Step Response Analysis of Linear Systems . . . . . . . . . . . . . . . . . 4.4 Impulse Response Analysis of Linear Systems . . . . . . . . . . . . . . 4.5 Time Responses to Arbitrary Input Signals . . . . . . . . . . . . . . . . 4.5.1 Linear System Analysis with MATLAB . . . . . . . . . . . . . 4.5.2 Nonlinear System Analysis with MATLAB . . . . . . . . . . 4.5.3 System Response by Using Simulink . . . . . . . . . . . . . . . . 4.6 Time Response of Systems with Time Delays . . . . . . . . . . . . . .

99 100 100 105 109 110 112 113 115 126 129 129 131 133 136

92 94 97

Contents

vii

4.6.1 Approximate Analysis of Closed-loop System with Time Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 5.

Complex Plane and Frequency Domain Analysis of Linear Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 5.1 Root Locus Analysis of Linear Systems . . . . . . . . . . . . . . . . . . . . 141 5.1.1 Root Locus of a Second-order System . . . . . . . . . . . . . . . 142 5.1.2 Principles of Root Locus Sketching . . . . . . . . . . . . . . . . . 145 5.1.3 MATLAB Tools for Root Locus Drawing . . . . . . . . . . . . 146 5.1.4 The Dominant Poles and Constant ζ and ωn Contours 153 5.2 Frequency Domain Analysis and Nyquist Plots . . . . . . . . . . . . . 155 5.2.1 Introduction to Frequency Domain Analysis . . . . . . . . . 155 5.2.2 A General Description of Nyquist Plots . . . . . . . . . . . . . 158 5.2.3 Nyquist Plots for Second-order Systems . . . . . . . . . . . . . 159 5.2.4 Nyquist Stability Theorem . . . . . . . . . . . . . . . . . . . . . . . . 160 5.2.5 A Nonlinear Transformation of The Ordinary Nyquist Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 5.3 Closed-loop Frequency Responses of Linear Systems . . . . . . . . 168 5.3.1 Constant M and N Circles . . . . . . . . . . . . . . . . . . . . . . . . 168 5.3.2 Specifications of Closed-loop Frequency Responses . . . . 169 5.4 Bode Diagrams Analysis of Linear Systems . . . . . . . . . . . . . . . . 172 5.4.1 Bode Diagrams of Linear Systems . . . . . . . . . . . . . . . . . . 172 5.4.2 Bode Diagrams of a Second-order System . . . . . . . . . . . . 172 5.4.3 Asymptotes of Bode Diagrams . . . . . . . . . . . . . . . . . . . . . 173 5.4.4 Stability Test from Bode Diagrams . . . . . . . . . . . . . . . . . 174 5.4.5 Plotting Bode Diagrams Using MATLAB . . . . . . . . . . . . 174 5.5 Nichols Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 5.5.1 Constant M (ω) Contour and Constant α(ω) Contour . 178 5.5.2 System Analysis Using the Nichols Charts . . . . . . . . . . . 178 5.6 More on Frequency Domain Analysis . . . . . . . . . . . . . . . . . . . . . . 180 5.6.1 Gain and Phase Margins . . . . . . . . . . . . . . . . . . . . . . . . . . 180 5.6.2 Frequency Response of Non-Minimum Phase Systems . 185 5.6.3 Frequency Response of Time-delay Systems . . . . . . . . . . 187 5.6.4 Frequency Domain Representations of Sensitivity Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

6.

Model Based Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 Cascade Lead-lag Compensator Design . . . . . . . . . . . . . . . . . . . . 6.1.1 Introduction to Lead-lag Synthesis . . . . . . . . . . . . . . . . . . 6.1.2 Lead-lag Synthesis by Phase Margin Assignment . . . . . 6.2 Linear Quadratic Optimal Control . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 Linear Quadratic Optimal Control Strategies . . . . . . . . 6.2.2 Linear Quadratic Regulator Problems . . . . . . . . . . . . . . . 6.2.3 Weighting Matrices Selections . . . . . . . . . . . . . . . . . . . . . .

193 193 193 201 207 207 208 211

viii

Contents

6.2.4 Observers and Observer Design . . . . . . . . . . . . . . . . . . . . 214 6.2.5 State Feedback and Observer-based Controllers . . . . . . 219 6.3 Pole Placement Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 6.3.1 Pole Placement Algorithms . . . . . . . . . . . . . . . . . . . . . . . . 222 6.3.2 Partial Pole Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 6.3.3 Observer Design using Pole Placement Technique . . . . . 226 6.3.4 Observer-based Controller Design Using Pole Placement227 6.4 Model Following Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 6.4.1 Standard Model Formats with Different Criteria . . . . . . 229 6.4.2 Model Following Controller Design . . . . . . . . . . . . . . . . . 231 6.5 SISOTool — An Interactive Controller Design Tool . . . . . . . . . 235 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 7.

PID Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1 The PID Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.2 PID Control with Derivative in Feedback Loop . . . . . . . 7.2 Ziegler-Nichols Tuning Formula . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.1 Empirical Ziegler-Nichols Tuning Formula . . . . . . . . . . . 7.2.2 Derivative Action in Feedback Path . . . . . . . . . . . . . . . . . 7.2.3 Methods for First-order Plus Delay Model Fitting . . . . 7.2.4 A Modified Ziegler-Nichols Formula . . . . . . . . . . . . . . . . . 7.3 Other PID Controller Tuning Formulae . . . . . . . . . . . . . . . . . . . . 7.3.1 Chien-Hrones-Reswick PID Tuning Algorithm . . . . . . . . 7.3.2 Cohen-Coon Tuning Algorithm . . . . . . . . . . . . . . . . . . . . . 7.3.3 Refined Ziegler-Nichols Tuning . . . . . . . . . . . . . . . . . . . . . 7.3.4 Predictive PI Tuning Algorithm . . . . . . . . . . . . . . . . . . . . 7.4 Advanced PID Tuning Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.1 Gain and Phase Margin Assignment Algorithm . . . . . . . 7.4.2 Internal Model Controller . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.3 Pole Placement Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5 Optimum PID Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.1 Set-point Optimum PID Tuning . . . . . . . . . . . . . . . . . . . . 7.5.2 Disturbance Rejection PID Tuning . . . . . . . . . . . . . . . . . 7.5.3 Gain and Phase Margins Assignment for PID Design . . 7.5.4 Improved Gain-phase Approach . . . . . . . . . . . . . . . . . . . . 7.6 A Pseudo Derivative Feedback Control Strategy . . . . . . . . . . . . 7.7 Control Design for Time-Delay System . . . . . . . . . . . . . . . . . . . . 7.7.1 Smith-Predictor Control . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7.2 Design Smith-Predictor by Optimal Model Fitting . . . . 7.8 More Topics on PID Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.8.1 Integral Windup and Anti-windup PID Controllers . . . 7.8.2 Automatic Tuning of PID Controllers . . . . . . . . . . . . . . . 7.8.3 Control Strategy Selections . . . . . . . . . . . . . . . . . . . . . . . . Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

241 242 242 245 246 246 250 251 255 258 258 260 261 264 266 266 267 270 271 272 273 275 276 278 282 283 284 288 288 289 293 293

Contents

8.

9.

Robust Control Systems Design . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1 Linear Quadratic Gaussian Control . . . . . . . . . . . . . . . . . . . . . . . 8.1.1 Linear Quadratic Gaussian Problem . . . . . . . . . . . . . . . . 8.1.2 LQG Problem Solutions Using MATLAB . . . . . . . . . . . . 8.1.3 LQG with Loop Transfer Recovery (LTR) . . . . . . . . . . . 8.2 General Descriptions to the Robust Control Problems . . . . . . . 8.2.1 Small Gain Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2.2 Unstructured Uncertainties . . . . . . . . . . . . . . . . . . . . . . . . 8.2.3 Robust Control Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2.4 Model Representation under MATLAB . . . . . . . . . . . . . . 8.2.5 Dealing with Poles on Imaginary Axis . . . . . . . . . . . . . . . 8.3 H∞ Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.1 Augmentations of Model with Weighting Functions . . . 8.3.2 Model Augmentation with Weighting Function Under MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.3 Weighted Sensitivity Problems — A Simple Case . . . . . 8.3.4 H∞ Controller Design — The General Case . . . . . . . . . 8.3.5 Optimal H∞ Controller Design . . . . . . . . . . . . . . . . . . . . . 8.4 Optimal H2 Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5 More on H∞ Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.5.1 Special H∞ Control Structures . . . . . . . . . . . . . . . . . . . . . 8.5.2 The Effects of Weighting Functions in H∞ Control . . . 8.5.3 Weighting Function Selections in Sensitivity Problems Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ix

295 296 296 297 301 308 308 309 310 311 313 315 315 317 319 324 332 334 338 338 339 344 347

Fractional-order Controller - An Introduction . . . . . . . . . . . . 349 9.1 Fractional-order Differential Equations and Their Laplace Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 9.1.1 Definitions of Fractional-order Differentiator . . . . . . . . . 350 9.1.2 Some Properties of Fractional-order Differentiator . . . . 351 9.1.3 Linear Fractional-order Differential Equations (FODEs)351 9.1.4 Laplace Transformation Method . . . . . . . . . . . . . . . . . . . . 352 9.2 Fractional Order Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 9.2.1 TID Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 9.2.2 CRONE Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 9.2.3 PIλ Dµ Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 9.2.4 Fractional Lead-Lag Compensator . . . . . . . . . . . . . . . . . . 362 9.3 Digital Implementation Techniques for Fractional-order Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 9.3.1 Finite Memory Length Expansion from Gr¨ unwaldLetnikov Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 9.3.2 Direct Discretization by Recursive Tustin Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 9.3.3 Direct Discretization by Continued Fraction Expansion of Tustin Transformation . . . . . . . . . . . . . . . . . . . . . 369 9.3.4 Stable Minimum-Phase Frequency-Domain Fitting . . . . 370

10

Contents

9.3.5 Oustaloup Recursive Approximation . . . . . . . . . . . . . . . . 374 9.4 An Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 A. More on Laplace Transformation . . . . . . . . . . . . . . . . . . . . . . . . . A.1 A Table of Basic Laplace Transformations . . . . . . . . . . . . . . . . . A.2 Deriving Transformations for Other Functions . . . . . . . . . . . . . . A.3 Laplace Transformation using Symbolic Toolbox . . . . . . . . . . . . Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

379 379 379 381 384

B. CtrlLAB — A Feedback Control System Analysis and Design Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 B.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 B.1.1 What is CtrlLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 B.1.2 Installation and Requirements . . . . . . . . . . . . . . . . . . . . . 386 B.1.3 Execution of CtrlLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 B.1.4 Copyright and Declaration of CtrlLAB . . . . . . . . . . . . . . 387 B.2 Model Entry and Model Conversion . . . . . . . . . . . . . . . . . . . . . . . 387 B.2.1 Transfer Function Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 B.2.2 Entering Other Model Representations . . . . . . . . . . . . . . 388 B.2.3 More Complicated Model Entry . . . . . . . . . . . . . . . . . . . . 388 B.3 Model Transformation and Reduction . . . . . . . . . . . . . . . . . . . . . 390 B.3.1 Model Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 B.3.2 State Space Realizations . . . . . . . . . . . . . . . . . . . . . . . . . . 392 B.3.3 Model Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 B.4 Feedback Control System Analysis . . . . . . . . . . . . . . . . . . . . . . . . 395 B.4.1 Frequency Domain Analysis . . . . . . . . . . . . . . . . . . . . . . . 395 B.4.2 Time Domain Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 B.4.3 System Properties Analysis . . . . . . . . . . . . . . . . . . . . . . . . 400 B.5 Controller Design Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 B.5.1 Model-Based Controller Designs . . . . . . . . . . . . . . . . . . . . 400 B.5.2 Design of PID Controllers . . . . . . . . . . . . . . . . . . . . . . . . . 402 B.5.3 Robust Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . 404 B.6 Graphical Interface Based Tools . . . . . . . . . . . . . . . . . . . . . . . . . . 406 B.6.1 A Matrix Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 B.6.2 A Graphical Curve Processor . . . . . . . . . . . . . . . . . . . . . . 411 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 C. MATLAB Functions Developed by the Authors . . . . . . . . . . . 415 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433

1. Introduction to Feedback Control

1.1 Introduction

Feedback and control are almost everywhere. Virtually, we can link the powerful word “control” to almost anything such as “diet control”, “financial control”, “pest control”, “motor control”, “robot control” etc. One can also say that “power is nothing without control” which is believed to be correct in both social and technological contexts. Feedback is an intuitive means for control. For example, when you feel cold (sensing), add one more layer of cloth (decision and then control action) to keep yourself warm and comfortable (objective). This is the biological feedback due to the environment change. In technological systems, the loop “sensing-feedback-decision-control” is meant to change the system behavior to the desirable one. In this book, we shall focus on the “feedback control” for a given system described by ordinary differential equations (ODE) with single input single output (SISO) in most cases. More specifically, we will mainly concentrate on the linear feedback control systems. For multiple input multiple output (MIMO) linear systems, good references are e.g. [15, 31, 48, 84, 89, 96, 99]. Figure 1.1 shows a typical feedback control structure with three blocks, namely, the plant block, the controller block and the feedback block. In this typical control system structure, the plant and the controller blocks form the forward path and the feedback path includes the feedback block alone mainly for the scaling and filtering of the sensor signals. This system structure is quite commonly seen in process control and other control applications.

input

✲ - ✻

✲ controller model



plant model

feedback model



Fig. 1.1. Typical feedback structure

output ✲

2

1. Introduction to Feedback Control

In control systems, the concept of “feedback” is very important. If we assume that there is no feedback path, the system will be driven solely by the input signal and after the effect of the control block, the output signal of the system will be generated. This kind of system structure is usually referred to as an open-loop control structure. Under the ideal circumstances, the open-loop control strategy sometimes works. For instance, in the control of some washing machines and heating systems, open-loop strategies are often used. However when there exists disturbances and modeling errors or model uncertainties, open-loop control strategy may fail. The closed-loop system structures must be used instead. Closed-loop systems are often referred to as feedback control systems. In this book, we shall discuss the analysis and design of feedback control systems. The interactive language MATLABTM and the Control Systems ToolboxTM will be extensively used in this book as a useful platform for solving problems in feedback control systems. c , for solving feedback A graphical user interface (GUI), named CtrlLAB control system problems will also be used in this book to provide easy solutions of the feedback control problems. The details of CtrlLAB are provided in Appendix B. For simplicity, only the paths with negative actions will be labeled in the block diagram, and the ones with positive actions will have the plus sign omitted by default as in Fig. 1.1. In practical controller system design, the general feedback control structures shown in Fig. 1.2 are frequently used with the feedback block simplified to 1. For linear systems, the feedback structure with non-unity feedback block can be equivalently represented by the structure shown in Fig. 1.2 (a). In Fig. 1.2 (a), two sub-models, i.e., the pre-filter and controller, can be r✲

pre-filter ✲ ✲



y

controller

✲ plant model ✲

(a). two degree-of-freedom control r✲ ✲



y

controller

✲ plant model ✲

(b). one degree-of-freedom control Fig. 1.2. Feedback control structures

adjusted in control system design. This is often referred to as two degreesof-freedom control. In actual controller design, assuming the unity pre-filter block reduces the system to the structure in Fig. 1.2 (b). This is referred to

1.2 Historical Background

3

as the one degree-of-freedom controller. In this book, we will focused on the one degree-of-freedom controller.

1.2 Historical Background Earlier development of automatic control devices can be traced back to the ancient water clock in Alexandria, Egypt, or the ancient compass vehicle in Han Dynasty in China, about two thousand years ago. According to [55], the fly ball governor invented by James Watt (1788) is regarded as the first widely used automatic feedback control system. Theoretical research on control systems was initiated by the studies of stability problems involving differential equations pioneered by the work of Maxwell (1868), Routh (1874) and Hurwitz (1895). Control strategy design problems were first proposed by Minorsky in 1922 where the three-term controller, or the PID (proportional integral derivative) controller, was first formulated. Practical algorithms for PID controller adjustment presented by Ziegler and Nichols in 1942 still have influence till today on the practicing control engineers. Frequency-domain analysis of linear feedback control systems were based on the earlier work of Nyquist (1932) [60] which was extended by Bode (1945) [13].The root locus analysis proposed by Evans (1946) [28] is another milestone in the study of linear feedback systems. The introduction of the maximum principle (Pontryagin 1956) [83], dynamic programming (Bellman 1957) [10], and state space representation (Kalman 1961) [39] opened a new era of systems control which was latter known as the so-called “modern control theory”. Some of the significant achievements include the linear quadratic optimal regulator (Kalman 1959), optimal state observers (Kalman 1960), and the linear quadratic Gaussian (LQG) optimal controller [40, 41]. It was later found by Doyle (1979) [27] that the LQG controller may reduce the stability margins of the system which initiated the interests in the loop transfer recovery (LTR) design, e.g., [112]. Robust control is a very attractive new area in control systems design. Modern robust control investigation was started by Zames (1981) [110] where the optimal control problems were formulated as the minimization of norms in Hardy spaces. The state space solution to such problems by Doyle et al is a significant computational contribution [26]. As it will be demonstrated in this book, most of the feedback system analysis and design tasks can be solved easily with the use of a computer. Therefore, a suitable computer software is essential in control system investigations. The first generation of the computer-aided analysis and design software includes the programs by Jones and Melsa [57] in 1970, where a significant amount of Fortran subroutines were provided. However, the main

4

1. Introduction to Feedback Control

program for any specific problem must be prepared by the user which makes solution procedure tedious and complicated. The main feature of the second generation of the CACSD (computer aided control system design) software is its man-machine interactive environment. Good examples of these software platforms are MATLAB by Moler (1980) and INTRAC by ˚ Astr¨om (1984). Presently, after generations of evolution, among various CACSD software packages, MATLAB has become the dominant environment widely used in engineering and non-engineering applications. In particular, for systems control, MATLAB has been the most popular tool in research, development and education. Furthermore, the objectoriented programming techniques have been satisfactorily implemented in MATLAB and SimulinkTM environment on which this book is based.

1.3 Structure of the Book For systems control, broadly speaking, there are three major steps, i.e., modeling, analyis and design, also known as “mad” process. If one is given a system to control, one probably has to go through this “mad” process or loop to achieve a satisfactory control performance. The structure of this book follows exactly the similar “mad” process. For a systematic system analysis and design, mathematical models of the systems are very important and very essential. For linear continuoustime system models, which will be the central theme of this book, there are usually four kinds of mathematical models, namely, the transfer function model, the state space model, the zero-pole-gain model, and in general, the block diagram model (as in Simulink). The transfer function model is based on the theoretical results of Laplace transformation, a clever way to map the linear system models described by ordinary differential equations into the corresponding algebraic equations. Many useful analysis and design tools, both analytical and graphical, are available. The state space model, on the other hand, describes the internal characteristics of the system. When performing the analysis and design of control systems described by the state space models, matrix algebra will be extensively used. The other two types of models can be used to either describe some of the characteristics of the system, or describe more complicated systems. All the model types, although they are different in appearance, can be converted into each other. The details of models and their conversions are covered in Chapter 2. In Chapter 2, we shall focus more on various model forms and their conversions rather than on how to build a model from experimental results which is a big subject known as “system identification” not covered in this book.

1.3 Structure of the Book

5

The mathematical model obtained in Chapter 2 may be too complicated to be practically useful. The model is often with too high an order. It is desirable to perform some sort of model reduction in various phases of system analysis and controller design. The model reduction is briefly introduced in the last section of Chapter 3. For control system analysis, there are basically two types: time-domain analysis (Chapter 4) and frequency-domain analysis (Chapter 5). System analysis methods for linear time-invariant feedback systems covered in this book are briefly listed as follows: • Parametric analysis: The characteristics of the system can be described by some parameters. For instance, the robustness can normally be measured by certain norm parameters of the system. The related topics will be given in Chapter 3. • Time domain analysis: Typically, the system response to a step input signal is one of the direct system analysis results in control systems. The system responses to other signals are also useful in system analysis tasks. The time domain analysis will be fully covered in Chapter 4. • Frequency domain analysis: The frequency-domain response based tools are very useful in feedback control systems analysis and design in practical applications. Based on the transfer function model, the frequency responses can be evaluated easily with different graphical representations of the behavior of the system available in MATLAB. The dynamic performance of the system can be examined based on the graphical interpretations. The frequency domain analysis is presented in Chapter 5. Equipped with the techniques from Chapters 4 and 5, given a plant model and a designed controller, we can tell in details what the time-domain and frequency-domain properties are. For controller designs, the problem is that given a plant model, how to design or synthesize a controller to meet certain desired specifications of the controlled system. If the controller design is largely dependent on the given model, we call the controller design “model-based.” Of course, it is more welcome to have some controller design methods that are less model-based. Although there are many matured system design algorithms, in this book, however, only some of the system design algorithms which are of practical interests will be introduced and discussed. These controller design methods include • Model-based approaches: Model-based controller design approaches include the classical lead/lag cascaded compensators, the linear quadratic optimal controller, the pole placement controller and model-following controller. These model-based design methods are presented in Chapter 6. • PID controllers: PID controllers with different structures and tuning algorithms will be studied in Chapter 7. Comparisons between various al-

6

1. Introduction to Feedback Control

gorithms will also be presented. For time-delay systems, Smith-Predictor control and its optimal design will be introduced. Since PID controllers are very heavily used in industry, we added a dedicated section on the practical techniques for integrator anti-windup, relay automatic tuning and control strategy selection. Details of PID controllers are given in Chapter 7. • Robust controllers: Robust controller design techniques, starting from the LQG/LTR (linear quadratic Gaussian/loop transfer recovery) controller, are covered in Chapter 8 with a focus on the Hardy space based control (H2 and H∞ ). • Fractional-order controllers: In practice, the robustness requirement is actually embodied in a compromised controller design. Fractional-order differentiator and fractional-order integrator are introduced as additional tuning knobs to achieve a better robust control design. Details will be given in Chapter 9. This will be the first time to include the fractional order control in a control textbook. Several appendices are given in this book which are valuable for the sake of completeness of this book. In Appendix A, a brief Laplace transformation table is given, and the Symbolic Toolbox of MATLAB is introduced with some applications in Laplace and inverse Laplace transformation. The GUI tool, CtrlLAB, will be discussed in Appendix B with some detailed materials on how to apply CtrlLAB in feedback system analysis and design. Finally, Appendix C lists the MATLAB functions developed by the authors which are dedicated to this book. Since this book is tightly coupled with MATLAB, a widely used computational software platform, a survival introduction useful for beginners follows.

1.4 A Survival Introduction to MATLAB 1.4.1 A Brief Overview of MATLAB The MATLAB environment, also known as the MATLAB “language”, was pioneered by Cleve Moler of the University of New Mexico in the early 1980’s. A commercial version of MATLAB was first released in 1984 by a company named The MathWorks Inc. This language is very easy to use and powerful in dealing with matrices. The graphical visualization utilities are impressive and flexible. MATLAB has outstanding merits in scientific computation and graphical visualization, compared with other software packages. MATLAB has now become the most used software in the field of control systems analysis and design, among other engineering and non-engineering areas. Numerous toolboxes have been written by well-known professionals. The Control Systems Toolbox and the Simulink program developed by The MathWorks will

1.4 A Survival Introduction to MATLAB

7

be extensively used in this book. The examples used in this book are all compatible with the most recent version of MATLAB, the Version 6.5 (Release 13). CtrlLAB developed by the authors is a graphical user interface which can be used to solve the typical problems of feedback control systems modeling, analysis and design. CtrlLAB has been modified to work in both Version 5 and Version 6. It can be used as a companion for this book. For a detailed description of MATLAB, please refer to [52, 101]. For Simulink, it will be briefly introduced in Sec. 2.6. More comprehensive coverage of Simulink related topics is in the recent textbook [107]. 1.4.2 Standard MATLAB Statements and Functions Unlike many other programming languages, the basic element in MATLAB is a complex valued matrix and powerful facilities have been provided for matrix manipulation and graphical visualization. To enter a matrix   1 2 3 A = 4 5 6 7 8 0

one can simply issue the statement >> A=[1,2,3; 4 5,6; 7,8 0]; where >> is the MATLAB prompt, and the semicolon within the square brackets is used to separate the matrix rows and a comma or a space is used to separate the elements in the same row. Vectors and scalars can also be accepted by MATLAB with even simpler statements. More data structures, such as the multi-dimensional matrices, structural data, object classes and cell structures, are supported in MATLAB which make the application of MATLAB easy and convenient. MATLAB functions can be called in a special way compared to other programming languages. The syntax for a typical function call is >> [list_of_return_variables]=func_name(input_list)

where the left hand side arguments in square brackets are the list of returned variables and the right hand side arguments are the input list used in the function. For instance, the function bode() can be called with the syntax >> [mag,phase]=bode(num,den,w) where the function bode() is used to draw the Bode diagram of the system given in variables (num, den) and the input variable w is used to pass the frequency vector to the function. The (mag, phase) variables are then returned after the function call, which are the magnitude and phase vectors of the frequency response data. One special feature of the MATLAB function is that different syntax definitions can be used in the same function to perform different manipulations. For instance, if the state space model (A, B, C, D) is used, the bode() function can be called in the following format:

8

1. Introduction to Feedback Control

>> [mag,phase]=bode(A,B,C,D,w) where the state space model is used and the MATLAB function can automatically detect which kind of input is provided. 1.4.3 Graphics Facilities in MATLAB Two-dimensional curves can easily be drawn by calling the function plot() with the syntax >> plot(x1,y1,x2,y2,x3,y3,· · ·) where (x1, y1) is a pair of vectors (or matrices) holding the x- and y-axis data for the plots, (x2, y2) is another pair, and so on. One may call other functions to decorate the plot, such as 1). grid to add or remove grids on the plot; 2). xlabel() and ylabel() to add labels for the axes; 3). title() to add a title to the plot; 4). legend, text() and gtext() to add one or more legends to plots. We can also decorate the graphs in a visual way using the graphics processor in CtrlLAB, which will be explained in Appendix B. Three-dimensional plots can also be obtained by calling mesh() and surf() functions. Once correct variables are provided, the three-dimensional plot will be generated directly. 1.4.4 On-line Help Facilities in MATLAB In this book, MATLAB and its Control Systems Toolbox will be extensively used and it is not possible or suitable to have all the functions fully described. This is also the case in other MATLAB related books such as [101]. The readers are advised to make full use of the on-line help facilities for all the functions relevant to their specific work. For instance, the user can start the help process by issuing the help command in the MATLAB environment or by clicking the Help menu in the MATLAB interface, and all the contents in the related directories will be displayed. A typical help information provided by the on-line help system is given below >> help lyap LYAP Lyapunov equation. X = LYAP(A,C) solves the special form of the Lyapunov matrix equation: A*X + X*A’ = -C X = LYAP(A,B,C) solves the general form of the Lyapunov matrix equation: A*X + X*B = -C See also DLYAP.

1.4 A Survival Introduction to MATLAB

9

By using the help utility, an explanation will be displayed for the function lyap with a calling syntax. In addition, the lookfor command can be used to search a key word in the functions. For instance, if one wants to find a function which can be used to perform ’Hankel’ related manipulations, one can try >> lookfor hankel HANKEL Hankel matrix. BHRDEMO Demo of model reduction techniques (Hankel, ... HKSV Hankel singular values and Gramians P, Q. OHKAPP Optimal Hankel norm approximation (stable plant). OHKDEMO Demo of optimal Hankel model reduction technique. OHKLMR Optimal Hankel norm approximation (unstable plant). and from the above displayed results, one can decide which function may be suitable for the intended task. 1.4.5 MATLAB Toolboxes The Control Systems Toolbox is extensively used in this book to deal with the problems in the area of feedback control system analysis and design. Most parts of the Control Systems Toolbox are covered in this textbook together with CtrlLAB. There are many toolboxes applicable to problems in control. Some of the names of the toolboxes are listed in alphabetical order below: • Chemometrics Toolbox, by Richard Kramer; • Control Kit, by Ole Sorensen (originally by Dingy¨ u Xue, Derek Atherton); • Control Systems Toolbox, by John Little and Alan Laub et al.; • CtrlLAB ToolKit, by Dingy¨ u Xue (see Appendix B); • Frequency Domain Identification Toolbox, by I. Koll´ ar, and J. Schoukens; • Fuzzy Logic Toolbox, by Ned Gulley, and Roger Jang et al.; • LMI Control Toolbox, by Pascal Gahinet, and Arkadi Nemirovski; • Model Predictive Control Toolbox, by Manfred Morari, and L. Ricker; • Modified Maximum Likelihood Estimator Toolbox, by Wes Wang; • Mu-Analysis and Synthesis Toolbox, by G. Balas, A. Packard and J. Doyle; • Multivariable Frequency Domain Toolbox by Jan Meciejowski et al.; • Neural Network Based Control Toolkit, by Magnus Nøgaard; • Neural Network Based Identification Toolkit, by Magnus Nøgaard; • Neural Network Toolbox, by Howard Demuth and Mark Beale; • Nonlinear Control Design Blockset, by M. Yeddanapudi and A. Potvin; • Polynomial Toolbox, by D. Henrion, F. Kraffer and H. Kwakernaak; • QFT Control Design Toolbox, by Craig Borghesani, Yossi Chait, et al.; • RIOTS 95, by Adam L. Schwartz, YangQuan Chen and Elya Polak; • Robotics Toolbox, by Peter Corke; • Robust Control Toolbox, by Richard Chiang and Michael Sofanov;

10

1. Introduction to Feedback Control

• Signal Processing Toolbox, John Little and Loren Shure; • System Identification Toolbox, by Lennart Ljung. Moreover, there are other toolboxes which may be useful for mathematical solutions to some problems in control systems, such as the Communications Toolbox, the Genetic Algorithm Optimization Toolbox, the Image Processing Toolbox, the Optimization Toolbox, the Partial Differential Equation Toolbox, the NAG (National Algorithm Group) Foundation Toolbox, the Spline Toolbox, the Statistics Toolbox, the Symbolic Toolbox, the Wavelet Toolbox and etc. Detailed information of the above mentioned MATLAB toolboxes, commercial or free, can be found from the world-wide-web or ftp sites. The readers can consult the following two web sites to explore further for more information: http://www.mathworks.com/matlabcentral/index.shtml http://www.mathtools.net/index.html In addition, the “MATLAB Paradise” maintained by the authors contains many useful information on MATLAB. The CtrlLAB and the functions in Appendix C can also be downloaded from the web-site: http://www.matlab-world.com/index e.htm Problems 1. Execute the MATLAB demonstration program by typing the demo command under the MATLAB prompt and see the attractive aspects provided by MATLAB and its toolboxes. 2. Find out what MATLAB toolboxes have been installed on your own computer by typing the help or ver command. Try to install other toolboxes such as the CtrlLAB and modify your own MATLAB search path. 3. Prepare a MATLAB script to rotate 90◦ of the following matrices and then compute their norms, traces, eigenvalues, pseudo inverses, and characteristic polynomials:     1 2 3 3 1 4 3 6 7 8 2 3 5 7  2 3 3 5 5 4  . (a) A =  1 3 5 7  , (b) B =  2 6 5 3 4 2 3 2 3 9 1 8 9 5 4 3 1 8 9 4

4. Solve for the matrix X in the  1 A= 4 7 2

Lyapunov equation AX + X AT = C with    2 3 1 5 4 5 6 , C= 5 6 7 . 8 0 4 7 9

5. Draw the function e−t /2 sin(5t) for t ∈ (0, 2π) using different functions such as plot(), stairs(), ezplot(), and stem(). 6. Call the demonstration function peaks() by the command [x,y,z]=peaks; and use the resulting (x,y,z) to show different three-dimensional graphs through the functions mesh(), surf(), and waterfall().

2. Mathematical Models of Feedback Control Systems

The mathematical model of a feedback system is a very important part in the analysis and design of feedback control systems. Based on the mathematical model, the system can be analyzed in a systematic way and the properties of the system can be obtained directly from the model. Most of the existing analysis and design algorithms and procedures are model-dependent or model-based, which makes the modeling problems even more important. If the system model is not known, two methods can be used to build the mathematical model of the system for the analysis and design tasks. The first method is to derive the system model using the existing physical laws and principles. The second method is more often used to find an approximate mathematical model based on the observed response data of the system. The former method is referred to as the physical modeling and the latter the system identification. How to obtain a model of the system to be controlled is a big subject and will not be fully pursued in this book. Instead, we will focus on how to manipulate the models. In this chapter, the physical modeling problem is illustrated through an example in Sec. 2.1. In Sec. 2.2, the concept of the Laplace transformation and then the transfer function representation of linear systems are described. Various descriptions of the standard transfer functions within MATLAB are presented. Other commonly used system descriptions, such as the state space representation and the zero-pole-gain representation, are presented in Sec. 2.3. The modeling principles for finding an overall system model from a given complicated inter-connected sub-models are given in Sec. 2.4. In Sec. 2.5, the equivalent conversion among different model types for a given system are described. For instance, a given transfer function model can be converted into an equivalent state space model or a given state space model can be converted to a transfer function format or a zero-pole-gain format. The modeling problems of an even more complicated model representation are discussed in Sec. 2.6, with the aid of the well established Simulink environment where the linearization techniques for nonlinear system models are also briefly presented.

2.1 A Physical Modeling Example Consider the electric circuit shown in Fig. 2.1, where a resistor R, an inductor L and a capacitor C are connected in series.

12

2. Mathematical Models of Feedback Control Systems

i(t) = C

L

R

The current i(t) satisfies





duc (t) dt

(2.1)

and the voltage equation can be written as u(t) = Ri(t) + L

u(t)



i(t) ✠C

uc (t)



Fig. 2.1. An RLC series circuit

di(t) + uc (t) dt

(2.2)

from which it is found that LC

duc (t) d2 uc (t) + RC + uc (t) = u(t). dt2 dt

(2.3)

The second-order ordinary differential equation given in (2.3) is called the mathematical model of the electric circuit. In general, the mathematical model of a continuous dynamic system can be represented in a mathematical formula such as an ordinary differential equation.

2.2 The Laplace Transform and Transfer Function Models From the voltage equation (2.3), it can be seen that the voltage uc (t) across the capacitor C can be represented by a second-order linear ordinary differential equation. For higher-order differential equations, it is usually very difficult to analyze. An alternative method known as the Laplace transformation can be adopted. Definition 2.2.1. The Laplace transformation of a time function f (t) is defined by ∞ f (t)e−st dt = F (s) (2.4) L[f (t)] = 0

where L[f (t)] is a shorthand notation of the Laplace integral. The result of the Laplace transformation is a function of s, often denoted by F (s). It should be noted that s has a unit of second−1 . For a given function f (t), it is usually possible to find its Laplace transformation via a Laplace transformation table. A brief Laplace transformation table and some computer-aided tools are further described in Appendix A. Theorem 2.2.1. Some of the important properties of the Laplace transformation are listed below without proofs.

2.2 The Laplace Transform and Transfer Function Models

1. 2. 3. 4.

13

Linearity: If a and b are scalars, then L[af (t)±bg(t)] = aL[f (t)]±bL[g(t)]. Translation in time: L[f (t − a)] = e−as F (s). Translation in s: L[e−at f (t)] = F (s + a). Differentiation: L[df (t)/dt] = sF (s) − f (0+ ). The n-th order derivative can be evaluated from

n d df (0+ ) dn−1 f (0+ ) −· · ·− f (t) = sn F (s)−sn−1 f (0+ )−sn−2 . (2.5) L n dt dt dtn−1

When all the initial values of f (t) and its derivatives are zero, equation (2.5) can be further simplified to L[dn f (t)/dtn ] = sn F (s). t 5. Integration: If zero initial conditions are assumed, L[ 0 f (τ )dτ ] = F (s)/s. The n-th order integration of a given function f (t) can be evaluated from L



t

0

···



0

t

F (s) f (τ )(dτ )n = n . s

(2.6)

6. Initial time: lim f (t) = lim sF (s) and final time: lim f (t) = lim sF (s). s→∞

t→0

t→∞

s→0

7. Convolution: L[f (t) ∗ g(t)] = L[f (t)]L[g(t)], where the convolution operator ∗ is defined as t t f (t − τ )g(τ )dτ. (2.7) f (τ )g(t − τ )dτ = f (t) ∗ g(t) = 0

0

8. Others: L[tn f (t)] = (−1)n

∞ ∞ f (t) dn F (s) F (s)dsn . · · · , L = dsn tn s s

(2.8) ✷

Definition 2.2.2. The inverse Laplace transformation of a given function F (s) is defined by −1

f (t) = L

1 [F (s)] = 2πj



σ+j∞

F (s)est ds,

(2.9)

σ−j∞

where σ is greater than the real part of singularities of F (s). Given F (s), its inverse Laplace transformation can be performed using a table or other relevant tools. Again, one can consult Appendix A for further details. It is obvious that, applying the differentiation law of Laplace transformation to the voltage equation, the differential equation (2.3) can be transformed into an “algebraic” equation as follows: LCUc (s)s2 + RCUc (s)s + Uc (s) = U (s)

(2.10)

14

2. Mathematical Models of Feedback Control Systems

where Uc (s) = L[uc (t)], U (s) = L[u(t)], and zero initial conditions for uc (t) and its derivatives are assumed. Dividing both sides by Uc (s) and taking the reciprocal yield Uc (s) 1 = (2.11) U (s) LCs2 + RCs + 1 and Uc (s)/U (s) is referred to as the transfer function from the input signal u(t) to the output signal uc (t). The transfer function of a linear system can be generally defined by a rational function of the variable s in the form G(s) =

b1 sm + b2 sm−1 + · · · + bm s + bm+1 . sn + a1 sn−1 + a2 sn−2 + · · · + an−1 s + an

(2.12)

If the coefficients bi , (i = 1, · · · , m+1) and ai , (i = 1, · · · , n) are constants, the system is referred to as a linear time invariant (LTI) system. The denominator is referred to as the characteristic polynomial of the system. The highest order n of the denominator is referred to as the order of the system. For a physically realizable system, it is often true that m ≤ n. In this case, the system is called proper. If m < n, the system is called strictly proper. The value n − m is sometimes called the relative degree/order or pole-zero excess of the system. A transfer function model can be easily entered into the MATLAB environment using the following MATLAB statements: >> num=[b1 ,b2 ,· · ·,bm ,bm+1 ]; den=[1,a1 ,a2 ,· · ·,an−1 , an ]; i.e., it is required to enter the numerator and denominator polynomial coefficients separately into two vector variables num and den in the descending order of s. Under the current version of MATLAB, due to the availability of object data structure, some object variable types have been defined in Control Systems Toolbox for LTI models. The function tf() is one of them. The function tf() can be used to construct a transfer function object using the given numerator and denominator variables such that the model entering and processing under MATLAB is made much easier than before. The syntax of the function is >> G=tf(num,den); where num and den are the coefficient vectors of the numerator and denominator, respectively. The variable G returned is the transfer function object. Example 2.2.1. The simple transfer function G(s) =

s+5 s4 + 2s3 + 3s2 + 4s + 5

can be represented in MATLAB as >> num=[1,5]; den=[1,2,3,4,5]; G=tf(num,den) Transfer function:

2.2 The Laplace Transform and Transfer Function Models

15

s + 5 ----------------------------s^4 + 2 s^3 + 3 s^2 + 4 s + 5 and G object can then be used to uniquely describe the given transfer function. The display format above is the same as the one obtained using the printsys() function in earlier versions of MATLAB.

Example 2.2.2. An even more complicated transfer function model G(s) =

6(s + 5) (s2 + 3s + 1)2 (s + 6)(s3 + 6s2 + 5s + 3)

can be entered into MATLAB using the following statements >> den=conv(conv(conv([1,3,1],[1,3,1]),[1,6]),[1,6,5,3]); num=6*[1,5]; G=tf(num,den) Transfer function: 6 s + 30 ----------------------------------------------------------s^8+18 s^7+124 s^6+417 s^5+740 s^4+729 s^3+437 s^2+141 s+18 where conv() is a standard MATLAB function used to evaluate the convolution of two vectors. Note that the multiplication of polynomials can equivalently be performed by calling conv(). The conv() function can be nested arbitrarily. However, one should make sure that the brackets are matched properly to avoid any possible error message.

A function convs(), listed in Appendix C, is prepared to perform polynomial multiplications. More than two polynomials are allowed to be multiplied together at the same time. The syntax of the function is >> a=convs(a1,a2,a3,a4,a5,a6,...) where a1, a2, · · · are vectors and the convolution of all the vectors can be performed to return the final vector in a. For instance, the denominator of the above transfer function can be entered in the following MATLAB statement: >> den=convs([1,3,1],[1,3,1],[1,6],[1,6,5,3]); Apart from the essential numerator and denominator variables, other fields are also defined in the transfer function object. One can list all the possible fields using the set() command1) : >> set(tf) num: den: Variable: Ts: ioDelay: 1)

Ny-by-Nu cell of row vectors (Nu = no. of inputs) Ny-by-Nu cell of row vectors (Ny = no. of outputs) [ ’s’ | ’p’ | ’z’ | ’z^-1’ | ’q’ ] Scalar (sample time in seconds) Ny-by-Nu array (I/O delays)

Some of the names of the members in the object may be different in different versions of MATLAB. For instance, the ioDelay variable was named as Td in earlier versions. The display format may also be different.

16

2. Mathematical Models of Feedback Control Systems InputDelay: OutputDelay: InputName: OutputName: InputGroup: OutputGroup: Notes: UserData:

Nu-by-1 vector Ny-by-1 vector Nu-by-1 cell array of strings Ny-by-1 cell array of strings M-by-2 cell array for M input groups P-by-2 cell array for P output groups Array or cell array of strings Arbitrary

where Ny is the number of outputs, Nu is the number of inputs. Variable is defined as the operator symbol used in the transfer function with s and p for continuous-time system, and z, z −1 and q for discrete-time system, where q is z −1 for short. The field Ts is the sampling period, which is only used in discrete-time systems. For continuous-time systems, the value of Ts is assigned to 0. InputName and OutputName are name strings of the input and output signals, and these are used only as labels. The variable Notes is used as a description of the model in string data type. UserData is the additional data attached to the object. If one wants to change the operator symbol in the transfer function representation to p, and assign a transport delay of 0.5 sec., either of the following two sets of MATLAB commands can be used: >> G.Variable=’p’; G.ioDelay=0.5; or >> set(G,’Variable’,’p’,’ioDelay’,0.5); To display G, simply type >> G Transfer function: 6 p + 30 exp(-0.5*p)*---------------------------------------------------p^8+18p^7+124p^6+417p^5+740p^4+729p^3+437p^2+141p+18

Systems with one input and one output are referred to as single-input single-output (SISO) systems, while systems with more than one input and more than one output, are referred to as multi-input, multi-output (MIMO) systems. For an MIMO system, the transfer function representation is in fact denoted by a matrix of transfer functions which is called the transfer function matrix. The transfer function object tf() can also be used to represent MIMO transfer function matrices. The details of MIMO systems will not be fully covered in this book. Here, only an example of the MIMO representation in MATLAB is given. Example 2.2.3. Assume that the transfer function matrix of an MIMO system is given by G(s) =



1/(s + 1) −1/(s − 1)

0 1/(s + 2)

(s − 1)/[(s + 1)(s + 2)] 1/(s + 2)



2.2 The Laplace Transform and Transfer Function Models

17

This model can be entered into the MATLAB workspace using the following commands: >> h11=tf(1,[1,1]); h12=0; h13=tf([1,-1],conv([1,1],[1,2])); h21=tf(-1,[1,-1]); h22=tf(1,[1,2]); h23=tf(1,[1,2]); H=[h11,h12,h13; h21,h22,h23]; In the above example, the individual transfer function element of the transfer function matrix is entered first and then these elements are grouped together to establish the whole transfer function matrix object for the MIMO system. This format is different from the acceptable ones in the earlier version of MATLAB. A new data type called “cell” is used in the Control System Toolbox objects.

The numerator and denominator of the system respectively can be retrieved using the simple commands G.num and G.den. For instance, in the above example, the following MATLAB statements can be issued: >> H.num ans = [1x2 double] [1x2 double]

[ 0] [1x2 double]

[1x2 double] [1x2 double]

and it can be seen that, the results are given in cells, even for SISO systems. If one wants to retrieve the numerator and denominator of the sub transfer function H23 (s), the following MATLAB statements has to be used: >> H.num{2,3} ans = 0 1

>> H.den{2,3} ans = 1 2

Even for SISO models, one cannot retrieve directly the numerator array by using the G.num command, since the structure used in the object function tf() is a cell. In order to get the coefficient array of the numerator one has to use G.num{1}. The other field elements, such as the delay constant, of a transfer function object can be retrieved using the command G.ioDelay. It should be noted that when retrieving the field elements, the original name in the object definition has to be used. For instance, the command G.den cannot be used to retrieve the numerator of a given transfer function object. Using the idea of a transfer function representation, the typical linear feedback control structure shown in Fig. 1.1 can be represented as in Fig. 2.2. In the linear feedback system structure, it is noted that all the three elements in the system are represented by linear transfer functions.

18

2. Mathematical Models of Feedback Control Systems R(s)

✲ -✻

✲ Gc (s)

✲ G(s)

Y (s)



H(s) ✛ Fig. 2.2. Linear feedback control structure

2.3 Other Mathematical Model Representations 2.3.1 State Space Modeling State space representations of control system models have been widely used in control theory since the late 1960’s when the well-established, socalled “modern control theory”, was introduced. The state space is another way of describing a dynamic model of the system, and it can be used to represent not only linear systems but also nonlinear systems. The state space representation of a system is always referred to as the internal model description since the internal variables such as the states are fully described in such a model representation. In contrast, the transfer function representation is often called the external model or the input/output model since only the input-output relationship of the system is described. Consider again the RLC circuit model given in (2.3). If one assumes that x1 = uc and x2 = duc /dt, a second-order ordinary differential equation can be rewritten into the following form:    dx1 = x2 dt (2.13)   dx2 = − 1 x1 − R x2 + 1 u. dt LC L LC In control theory, dxi /dt is often denoted by x˙ i and the matrix form of the above equations is written as





0 1 0 x˙ 1 x1 = + u (2.14) −1/(LC) −R/L 1/(LC) x˙ 2 x2

where x1 and x2 are referred to as the state variables, u is referred to as the input signal, and (2.14) is called the state equation of the system. Note that the state variable selection is not unique. Thus, the state equation is also not unique. For instance, if one selects the voltage uc and the current i as the state variables, denoted by x1 and x2 , respectively, the state equation can then be written as





x1 0 1/C 0 x˙ 1 u. (2.15) = + x˙ 2 −1/L −R/L x2 1/L It is readily seen that there are differences in the above two state equations.

2.3 Other Mathematical Model Representations

19

Suppose that there are p inputs ui (t), (i = 1, · · · , p) and q outputs yi (t), (i = 1, · · · , q), and there are n states which compose a state variable vector x = [x1 , x2 , · · · , xn ]T . The state space expression of the general dynamic system can be written as  x˙ i = fi (x1 , x2 , · · · , xn , u1 , · · · , up ), i = 1, · · · , n (2.16) yi = gi (x1 , x2 , · · · , xn , u1 , · · · , up ), i = 1, · · · , q where fi (·) and gi (·) can be any nonlinear functions. For linear systems, the state space expression of the system can be simplified as  ˙ x(t) = A(t)x(t) + B(t)U (t) (2.17) Y (t) = C(t)x(t) + D(t)U (t) where U = [u1 , · · · , up ]T and Y = [y1 , · · · , yq ]T are the input and output vectors, respectively. The matrices A(t), B(t), C(t), and D(t) are compatible matrices. The term “compatible” means that the related matrices have the correct dimensions. To be more specific, A is an n × n matrix, B is an n × p matrix, C is a q × n matrix and D is a q × p matrix, respectively. The dimensions under such conditions are called compatible dimensions. In particular, the single-input, single-output linear time invariant (LTI) state space representation of the system can be written as  x˙ = Ax + Bu (2.18) y = Cx + Du where B and C are column and row vectors respectively, D is a scalar, and u and y are scalar signals. As a side note, in robust control theory, the state space expression is often denoted by

A B G(s) = (2.19) C D as a shorthand notation. The representation of a state space expression in MATLAB is simple and straightforward. One can simply enter the coefficient matrices into the MATLAB environment as >> A=[a11 , a12 , · · · , a1n ; a21 , a22 , · · · , a2n ; · · ·; an1 , an2 , · · · , ann ]; B=[b1 ; b2 ; · · ·; bn ]; C=[c1 , c2 , · · ·, cn ]; D=d; The matrices (A, B, C, D) in MATLAB workspace can be used to describe the given state space model in (2.18). Note that the MATLAB representation (A, B, C, D) can be used to model multi-input, multi-output linear state space systems as well. Similar to the transfer function object, one can also describe the state space model using the state space object ss() provided in the current version of the Control Systems Toolbox as follows: >> G=ss(A,B,C,D)

20

2. Mathematical Models of Feedback Control Systems

If the dimension in the state space model is incompatible, an error message will be generated in the ss() function call. Example 2.3.1. A two-input two-output system in state space form given by 

2.25  2.25 x˙ =  0.25 1.25

−5 −4.25 −0.5 −1.75

−1.25 −1.25 −1.25 −0.25

  −0.5 4 −0.25  2 x+ −1  2 0 −0.75

 6

0 4 u, y =  0 2 2

0 2

0 0

1 x 2

can be entered into the MATLAB workspace using the following MATLAB statements: >> A=[2.25, -5, -1.25, -0.5; 2.25, -4.25, -1.25, -0.25; 0.25, -0.5, -1.25,-1; 1.25, -1.75, -0.25, -0.75]; B=[4, 6; 2, 4; 2, 2; 0, 2]; C=[0, 0, 0, 1; 0, 2, 0, 2]; D=zeros(2,2); G=ss(A,B,C,D) a = x1 x2 x3 x4 x1 2.25 -5 -1.25 -0.5 x2 2.25 -4.25 -1.25 -0.25 x3 0.25 -0.5 -1.25 -1 x4 1.25 -1.75 -0.25 -0.75 b = u1 u2 x1 4 6 x2 2 4 x3 2 2 x4 0 2 c = x1 x2 x3 x4 y1 0 0 0 1 y2 0 2 0 2 d = u1 u2 y1 0 0 y2 0 0 Continuous-time system. If the system matrices entered are not compatible, the error messages will be given automatically by the function.

One can obtain the details of the fields of a state space object using the following command with the results displayed: >> set(ss) a: Nx-by-Nx matrix (Nx = no. of states) b: Nx-by-Nu matrix (Nu = no. of inputs)

2.3 Other Mathematical Model Representations c: d: e: StateName: Ts: InputDelay: OutputDelay: ioDelay: InputName: OutputName: InputGroup: OutputGroup: Notes: UserData:

21

Ny-by-Nx matrix (Ny = no. of outputs) Ny-by-Nu matrix Nx-by-Nx matrix (or []) Nx-by-1 cell array of strings scalar Nu-by-1 vector Ny-by-1 vector Ny-by-Nu array (I/O delays) Nu-by-1 cell array of strings Ny-by-1 cell array of strings M-by-2 cell array if M input groups P-by-2 cell array if P output groups array or cell array of strings arbitrary

where the fields (a, b, c, d) correspond to the (A, B, C, D) matrices in the state space model, while the e field is the E matrix in the descriptor system given by  ˙ E x(t) = A(t)x(t) + B(t)U (t) (2.20) Y (t) = C(t)x(t) + D(t)U (t).

The default value of e is e=[], which is a simple notation for E = I. In this case, the system model in (2.20) reduces to the usual LTI state space model. The definition of other fields are similar to those in the transfer function object and it will not be explained here again. One can retrieve the field in a state space object using the command A=G.a. It is worth mentioning that the A matrix retrieved in this command is the matrix itself, not the one in the cell format. The characteristic polynomial of the system can be obtained using the MATLAB function poly(), which can be called as follows: >> P=poly(G.a) P = 1.0000 4.0000

6.2500

5.2500

2.2500

and the above output display can be interpreted as P (s) = s4 +4s3 +6.25s2 + 5.25s + 2.25. The poly() function provided by MATLAB uses an eigenvalue based algorithm and sometimes it may not be accurate enough. Now consider the well-known Fadeev-Fadeeva algorithm  1 ck = − tr(ARk ), k = 1, 2, · · · , n (2.21) k R1 = I, Rk = ARk−1 + ck−1 I, k = 2, · · · , n where tr(·) takes the trace of the matrix, and ck are the coefficients of the characteristic polynomial of matrix A. It can be seen that the algorithm is recursive and one can use the MATLAB language to rewrite the function poly() using this algorithm. The list of the function is given in Appendix C, and the syntax is exactly the same as the original poly() function.

22

2. Mathematical Models of Feedback Control Systems

Example 2.3.2. Let us demonstrate the above mentioned accuracy problem through an example. Suppose that a matrix is given by   0 1 0 0  0 0 −1 0  A= . 0 0 0 1 0 0 5 0

Using the following MATLAB statements to get the coefficients of the characteristic polynomial: >> A=[0,1,0,0; 0,0,-1,0; 0,0,0,1; 0,0,5,0]; C=poly(A) C = 1.0000 0 -5.0000 0 0

it can be seen that the coefficients obtained are not integers. If one replaces the poly() function by the one using the Fadeev-Fadeeva algorithm, the following results are obtained: >> D=poly(A) D = 1 0

-5

0

0

and it can be seen that the results are exact.

From the theory of ordinary differential equations, it is easily shown that if the initial state is x(0), the solution to the linear state space equation (2.18) is that t eA(t−τ ) Bu(τ )dτ (2.22) x(t) = eAt x(0) + 0

from which it can be seen that the solution x(t) depends heavily upon the evaluation of eAt . The time domain solutions and analysis of (2.22) will be covered in Chapter 4. 2.3.2 Zero-pole-gain Description The zero-pole-gain representation is another way to describe the transfer function of an SISO LTI system. The zero-pole-gain model of a given transfer function is usually represented as G(s) = K

(s + z1 )(s + z2 ) · · · (s + zm ) (s + p1 )(s + p2 ) · · · (s + pn )

(2.23)

where K is referred to as the gain of the system. Be careful that K is not the zero frequency or DC (direct current) gain G(0). In (2.23), −zi (i = 1, · · · , m) are called the zeros and −pi (i = 1, · · · , n) the poles of the system. It is noted that for real-coefficient transfer function models, the poles and zeros are either real or in complex conjugate pairs. The zero-pole-gain representation is

2.3 Other Mathematical Model Representations

23

immediately obtainable from the transfer function representation of a given system. To enter the zero-pole-gain model representation into the MATLAB workspace, issue the following MATLAB statements: >> KGain=K; Z=[z1 ; z2 ; · · ·; zm ]; P=[p1 ; p2 ; · · ·; pn ]; Then, the MATLAB variables (KGain, Z, P) are used to describe the zeropole-gain model of the system. A zero-pole-gain object is provided in Control Systems Toolbox. The object can be constructed using the command zpk(Z,P,KGain) in the same way as other LTI objects. The fields in the zero-pole-gain object are as follows: >> set(zpk) z: p: k: Variable: Ts: InputDelay: OutputDelay: ioDelay: InputName: OutputName: InputGroup: OutputGroup: Notes: UserData:

Ny-by-Nu cell of vectors (Nu = no. of inputs) Ny-by-Nu cell of vectors (Ny = no. of outputs) Ny-by-Nu array of double [ ’s’ | ’p’ | ’z’ | ’z^-1’ | ’q’ ] scalar Nu-by-1 vector Ny-by-1 vector Ny-by-Nu array (I/O delays) Nu-by-1 cell array of strings Ny-by-1 cell array of strings M-by-2 cell array if M input groups P-by-2 cell array if P output groups array or cell array of strings arbitrary

where the zeros, poles and gain of the system are described by the fields z, p and k, respectively. Here, z and p are cells. The other fields are the same as those in transfer function objects and the details will not be repeated here. Example 2.3.3. The zero-pole-gain model G(s) = 6

(s + 1.9294)(s + 0.0353 ± 0.9287i) (s + 0.9567 ± 1.2272i)(s − 0.0433 ± 0.6412i)

can easily be entered into the MATLAB workspace by the following: >> KGain=6; Z=[-1.9294; -0.0353+0.9287j; -0.0353-0.9287j]; P=[-0.9567+1.2272j; -0.9567-1.2272j; +0.0433+0.6412j; +0.0433-0.6412j]; G=zpk(Z,P,KGain) Zero/pole/gain: 6 (s+1.929) (s^2 + 0.0706s + 0.8637) ---------------------------------------------(s^2 - 0.0866s + 0.413) (s^2 + 1.913s + 2.421) Note that for SISO systems, the poles and zeros should be in column vectors to ensure that it can be processed by the Control Systems Toolbox correctly.

24

2. Mathematical Models of Feedback Control Systems

By comparing (2.23) and (2.12), we can observe that the poles and zeros of the system are respectively the roots of the numerator and denominator polynomials, and the gain is in fact the ratio of the coefficients of the highest order term of the numerator and denominator of the transfer function. It should be mentioned that, the zero-pole-gain description for MIMO systems cannot be obtained simply from the transfer function model. In MIMO systems, the poles and in particular zeros are defined very differently. This is beyond the scope of this book. Interested readers can consult [89] and the references therein for more details.

2.4 Modeling of Interconnected Block Diagrams The model formats described above are usually directly obtainable for single block models. In practical situations, a system model may be given by interconnected blocks and the overall system model for the inter-connected system structures can be obtained using the methods given in this section. 2.4.1 Series Connection Consider the series connection of the two blocks shown in Fig. 2.3 (a). It can be seen that the input signal u(t) travels through the first block G1 (s), and the output of G1 (s) is the input to the second block G2 (s), which generates the output y(t) of the overall system. This kind of connection is referred to as a series or cascade connection. ✲ G1 (s) u(t) ✲

G1 (s)

✲ G2 (s)

(a) series connection

y(t) ✲

u(t)

✲ G2 (s)

❄✲ y(t) ✻

(b) parallel connection

Fig. 2.3. Interconnections of blocks

In the series connection, the overall transfer function of the whole system is given by G(s) = G2 (s)G1 (s). For SISO systems, the two blocks G1 (s) and G2 (s) are inter-changeable, i.e, G1 G2 = G2 G1 . For MIMO systems, however, the two blocks are generally not interchangeable. If the two blocks G1 (s) and G2 (s) in a series connection are given by the state space models (A1 , B1 , C1 , D1 ) and (A2 , B2 , C2 , D2 ), respectively, the state space expression for the overall system can be written as

2.4 Modeling of Interconnected Block Diagrams





A1 x1 B1 0   x˙ 1 = + u  x˙ 2 B2 C1 A2 x2 B2 D1

  y = [D C , C ] x1 + D D u.  2 1 2 2 1 x2

25

(2.24)

Assume that the MATLAB description of the transfer function model G1 (s) is represented in an LTI object G1, where it can either be tf, ss or zpk, and that for G2 (s) is G2. The LTI representation of the overall system in a series connection can be simply obtained using the following MATLAB statement: >> G=G2*G1; If the models G1 and G2 are given by symbolic variables, the above operation is also valid. 2.4.2 Parallel Connection A typical parallel connection of two blocks G1 (s) and G2 (s) is shown in Fig. 2.3 (b), where the two blocks are subjected to the same input signal u(t). The outputs of the two blocks are summed up to form the output y(t) of the overall system. The overall transfer function of the parallel connection is then G(s) = G1 (s) + G2 (s). If the two parallel connected blocks G1 (s) and G2 (s) are given by the state space models (A1 , B1 , C1 , D1 ) and (A2 , B2 , C2 , D2 ), respectively, the state space expression of the overall system is given by 



A1 0 x˙ 1 x1 B1   = + u  0 A2 x2 B2 x˙ 2 (2.25)

   y = [C1 , C2 ] x1 + (D1 + D2 )u. x2 The LTI representation of the parallel connection can be obtained using the following MATLAB statement: >> G=G1+G2; where G1 and G2 are LTI objects (tf, ss or zpk) of G1 (s) and G2 (s) respectively. They can also be symbolic variables.

Example 2.4.1. It should be noted that, if G1 (s) and G2 (s) contain the same pole and the result of the parallel manipulation may be simplified further in this case. Consider the two blocks G1 (s) = 1/(s + 1)2 , and G2 (s) = 1/(s + 1). The result of calling the appropriate MATLAB functions is given by the following MATLAB statements: >> G1=tf(1,[1,2,1]); G2=tf(1,[1,1]); G=zpk(G1+G2) Zero/pole/gain: (s+2) (s+1) ----------(s+1)^3

26

2. Mathematical Models of Feedback Control Systems

where the zpk() function is used to get the zero-pole-gain model. In fact, the overall transfer function can be simplified to G(s) = (s+2)/(s+1)2 , since there is a common factor (s + 1) in both the denominators of G1 (s) and G2 (s).

The minimum realization technique can be used to obtain the simplified model and details of the technique will be given later in this chapter. 2.4.3 Feedback Connection The simple feedback connection of two blocks G1 (s) and G2 (s) is shown in Figs. 2.4 (a) and (b), respectively. The two feedback connections in Fig. 2.4 u(t) ✲

✲ G1 (s) ✻

y(t)



G2 (s) ✛ (a) positive feedback

u(t)✲

✲ G1 (s) -✻

y(t)



G2 (s) ✛ (b) negative feedback

Fig. 2.4. Feedback connections

are different with the left one called a system with positive feedback and the right one a system with negative feedback. The overall transfer function of the positive feedback is G(s) = G1 (s)/[1 − G1 (s)G2 (s)], and for negative feedback G(s) = G1 (s)/[1 + G1 (s)G2 (s)]. If the two blocks in the negative feedback connection are represented by the state space models (A1 , B1 , C1 , D1 ) and (A2 , B2 , C2 , D2 ), respectively, the state space expression of the overall system is given by 



A1 −B1 ZD2 C1 −B1 ZC2 x1 B1 Z x˙ 1   = u +  x˙ 2 B2 ZC1 A2 −B2 D1 ZC2 x2 B2 D1 Z (2.26)

   y = [ZC1 , − D1 ZC2 ] x1 + (D1 Z)u x2 where Z = (I + D1 D2 )−1 . If D1 = D2 = 0, then Z = I and the system model can be simplified as 



 B1 x1 A1 −B1 C2 x˙ 1   + u =  x˙ 2 0 x2 B2 C1 A2 (2.27)

  x 1   y = [C1 , 0] . x2

A MATLAB function feedback() is provided in the Control Systems Toolbox to get the overall system model from the feedback connection with the syntax:

2.4 Modeling of Interconnected Block Diagrams

27

>> G=feedback(G1,G2,Sign); where Sign is used to identify the positive or the negative feedback connection. If Sign=-1, the negative feedback structure is indicated. The Sign variable can be omitted in the function call in a negative feedback connection. The LTI objects in the forward path and feedback path are given by G1 and G2 respectively. A MATLAB function, feedback(), is also written for the models represented by symbolic variables, and listed in Appendix C. This function should be placed under the @sym directory in the MATLAB Symbolic Toolbox. Example 2.4.2. Consider again the model in Example 2.4.1. If a negative feedback connection is assumed, one can find the overall transfer function by using the following MATLAB statements: >> G1=tf(1,[1,2,1]); G2=tf(1,[1,1]); G=feedback(G1,G2) Transfer function: s + 1 --------------------s^3 + 3 s^2 + 3 s + 2 For positive feedback connection, we can use >> G=feedback(G1,G2,+1) Transfer function: s + 1 ----------------s^3 + 3 s^2 + 3 s >> syms g1 g2 % declare symbolic variables G=feedback(g1,g2); pretty(G) g1 --------1 + g1 g2

2.4.4 More Complicated Connections In real world, the system structure can be very complex. In this subsection, we shall illustrate how to handle more complicated interconnections. Consider the typical feedback control system structure shown in Fig. 2.2. The overall system can be evaluated by first assuming that Gc (s) and G(s) are in series, and then connected to a negative feedback block H(s). The overall closed-loop transfer function of the typical feedback control system is Gcl (s) =

G(s)Gc (s) . 1 + H(s)G(s)Gc (s)

(2.28)

The overall system object can be obtained using the following MATLAB statement:

28

2. Mathematical Models of Feedback Control Systems

G a=feedback(G*Gc,H) where G, Gc and H are the LTI objects of Gc (s), G(s) and H(s), respectively. Example 2.4.3. If the three blocks in the above typical feedback structure are given by G(s) =

s3 + 7s2 + 24s + 24 , s4 + 10s3 + 35s2 + 50s + 24

Gc (s) =

10s + 5 , s

H(s) =

1 , 0.01s + 1

the overall transfer function of the closed-loop system can be obtained by the following MATLAB statements: >> G=tf([1 7 24 24],[1,10,35,50,24]); Gc=tf([10,5],[1,0]); H=tf([1],[0.01,1]); G_a=feedback(G*Gc,H) Transfer function: 0.1s^5+10.75s^4+77.75s^3+278.6s^2+361.2s+120 -------------------------------------------------------0.01 s^6+1.1 s^5+20.35 s^4+110.5 s^3+325.2 s^2+384 s+120 Furthermore, if one assumes that G is given by its equivalent state space model, the overall system can be obtained using the following MATLAB statements >> G=ss(tf([1 7 24 24],[1,10,35,50,24])); G_a=feedback(G*Gc,H); G_a=tf(G_a) Transfer function: 10s^5+1075s^4+7775 s^3+2.786e004s^2+3.612e004s+1.2e004 --------------------------------------------------------------s^6+110 s^5+2035s^4+1.105e004s^3+3.252e004s^2+3.84e004s+1.2e004 Since a state space submodel is involved, the overall model is obtained in a state space format. One can convert the result back to the transfer function model using the tf() function. It can be seen that although a submodel is not given in the transfer function form, one can still use the same command to evaluate the overall model and the results are the same. This is the benefit from the object-oriented techniques in modern software engineering extensively used in MATLAB.

Unfortunately, the overall system evaluation is not always as simple as in this case where one can perform the calculation by hand. For more complicated structures, evaluations by hand can be laborious and computer aids are very useful. Example 2.4.4. Consider the structure of the DC motor drive system, shown in Fig. 2.5. It can be seen that the overall system model is not easily evaluated. From the block diagram, it can be seen that the difficulty lies in the interconnections among paths 6, 7, 8 and 9. Rearranging path 9 so that it starts from the output signal, then the equivalent transfer function becomes g91 (s) = g9 /g7 . The overall system can then be constructed using the following MATLAB statements:

2.5 Conversion Among Different Model Objects 0.212

29



g8 (s)



1 ✲ 1+0.01s g1 (s)

70 ✲❄ ✲ 1+0.17s✲ 1 ✲ ✲ 1+0.15s✲ ✲ 0.21 ✲ 1+0.0067s 1+0.15s 0.085s 1+0.01s 0.051s ✻ g4 (s) ✻ g2 (s) g3 (s) g5 (s) g6 (s)

0.0044 ✛ g10 (s) 1+0.01s

130 ✲ s g7 (s)

0.1 ✛ 1+0.01s g9 (s)

Fig. 2.5. An example of DC electric drive system

>> g1=tf(1,[0.01,1]); g2=tf([0.17,1],[0.085,0]); g3=g1; g4=tf([0.15,1],[0.051,0]); g5=tf(70,[0.0067,1]); g6=tf(0.21,[0.15,1]); g7=tf(130,[1,0]); g8=0.212; g9=tf(0.1,[0.01,1]); g91=g9/g7; g10=0.0044*g1; gg1=feedback(g7*g6,g8); %paths 6-8 gg2=feedback(gg1*g5*g4,g91); %paths 4-9 G=feedback(gg2*g3*g2,g10)*g1; zpk(G), %overall system Zero/pole/gain: 111852502194.908 (s+100)^2 (s+6.667) (s+5.882) -----------------------------------------------------------------(s+180.9)(s+100)^2(s+84.1)(s+48.2)(s^2+15.2s+74.3)(s^2+27.57s+354) and it can be seen that the transfer function of the overall system can be obtained easily. We can also perform symbolic manipulations to the models. The following commands should be given and the results follow immediately. >> syms g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g91=g9/g7; gg1=feedback(g7*g6,g8); %paths 6-8 gg2=feedback(gg1*g5*g4,g91); %paths 4-9 G=feedback(gg2*g3*g2,g10)*g1; pretty(G) g2 g3 g6 g7 g5 g4 g1 -------------------------------------------------1 + g7 g6 g8 + g6 g5 g4 g9 + g4 g5 g7 g6 g3 g2 g10

The overall model can also be evaluated easily using the MATLAB-based software BlockM[104] and the Simulink program[53, 107] to be introduced later, which are more straightforward to use. The modeling procedures using Simulink will be described in Sec. 2.6.

2.5 Conversion Among Different Model Objects In the previous sections, three LTI model objects have been discussed. From the numerical point of view, the state space object is the most suitable

30

2. Mathematical Models of Feedback Control Systems

one, especially for high order systems. In fact, each of the model formats can be converted to another one, since all of them are equivalent. In this section, some of the typical model format conversions are discussed. 2.5.1 Conversion of LTI Objects to Transfer Functions Given a state space model (A, B, C, D)  x˙ = Ax + Bu y = Cx + Du

(2.29)

with zero initial conditions, one can take the Laplace transform to give  sIX(s) = AX(s) + BU (s) (2.30) Y (s) = CX(s) + DU (s) where I is the identity matrix, which has the same dimension as matrix A. Thus, from the first formula of the above equation, one has X(s) = (sI − A)−1 BU (s).

(2.31)

The equivalent transfer function model can then be obtained as G(s) =

Y (s) = C(sI − A)−1 B + D. U (s)

(2.32)

The most difficult part in the conversion task is to find the inverse matrix of (sI − A). Fortunately, good and reliable algorithms, such as the FadeevFadeeva algorithm, exist which ensure an accurate evaluation. In general, for MIMO systems, the transfer function matrix G(s) can also be evaluated from (2.32). If the zero-pole-gain model of the system is given, one can expand the numerator and denominator polynomials expressed in a factorized form and then multiply the numerator by the gain to obtain the transfer function model. In the Control Systems Toolbox, if an LTI object is given by G, one can use the following command to get the equivalent transfer function object G1 by >> G1=tf(G) Example 2.5.1. Suppose that a system model is described by a state space model 

0 0 x˙ =  0 0

1 0 0 0

0 −1 0 5

   0 0 0 1   x+ u, y = [1, 0, 0, 0]x. 1 0  0 −2

One can use the following MATLAB statements to get the transfer function model

2.5 Conversion Among Different Model Objects

31

>> A=[0,1,0,0; 0,0,-1,0; 0,0,0,1; 0,0,5,0]; B=[0;1;0;-2]; C=[1,0,0,0]; D=0; G=ss(A,B,C,D); G1=tf(G) Transfer function: s^2 + 1.11e-015 s - 3 --------------------s^4 - 5 s^2

Note that a transfer function (matrix) transformed from a given state space model is unique. Example 2.5.2. For a system given in zero-pole-gain form G(s) = 6.8

(s + 3)(s + 7) , s(s + 1.8 ± j1.63)(s + 1)2

one can use the following MATLAB statements to get the transfer function model: >> Z=[-3; -7]; P=[0; -1.8+1.63j; -1.8-1.63j; -1; -1]; K=6.8; G=zpk(Z,P,K); G1=tf(G) Transfer function: 6.8 s^2 + 68 s + 142.8 ---------------------------------------------s^5 + 5.6 s^4 + 14.1 s^3 + 15.39 s^2 + 5.897 s and one can verify the results by hand.

In the earlier versions of the Control Systems Toolbox, the functions ss2tf() and zp2tf() were provided to obtain the transfer function model from given state space or zero-pole-gain models. Here, we shall not present the details of these functions. The interested readers can use the help command to obtain more information about ss2tf() and zp2tf(). 2.5.2 Conversion of LTI Objects to Zero-pole-gain Models Having obtained the transfer function model, it is not a difficult task to get the equivalent zero-pole-gain model. Since one can easily solve this problem if one represents the numerator and denominator by their factorized forms. In the Control Systems Toolbox, one can use the function zpk() to convert an LTI object G into its equivalent zero-pole-gain object G1. The syntax is >> G1=tf(G) Example 2.5.3. The state space model given in Example 2.5.1 can be converted into a zero-pole-gain model using the following MATLAB statements: >> A=[0,1,0,0; 0,0,-1,0; 0,0,0,1; 0,0,5,0]; B=[0;1;0;-2]; C=[1,0,0,0]; D=0; G=ss(A,B,C,D); G1=zpk(G) Zero/pole/gain: (s-1.732) (s+1.732) ----------------------s^2 (s-2.236) (s+2.236)

32

2. Mathematical Models of Feedback Control Systems

Example 2.5.4. If one has obtained the transfer function model, it is easy to find the equivalent zero-pole-gain model using MATLAB. For instance, the zero-polegain model of the transfer function of Example 2.5.2 can be found using the following MATLAB statements: >> Z=[-3; -7]; P=[0; -1.8+1.63j; -1.8-1.63j; -1; -1]; K=6.8; G=zpk(Z,P,K); G1=tf(G); G2=zpk(G1) Zero/pole/gain: 6.8 (s+7) (s+3) -----------------------------s (s+1)^2 (s^2 + 3.6s + 5.897) If there are complex poles/zeros, a second order polynomial will be used to represent the complex conjugates. The poles of the system can in fact be obtained using the following MATLAB statement: >> G2.p{1} ans = 0 -1.8000 + 1.6300i -1.8000 - 1.6300i -1.0000 -1.0000 and the results are exactly the same as the original model.

In the earlier versions of the Control Systems Toolbox, the functions ss2zp() and tf2zp() were provided to obtain the zero-pole-gain model from the given state space model and transfer function model, respectively. For an MIMO state space model, the zeros of the system can not easily be obtained. However, one can rely on the MATLAB function tzero() provided in the Control Systems Toolbox for this task. The syntax of the function is >> Z=tzero(G) where G is a given LTI object. After the function call, the transmission zeros [89] of the system are returned in the vector Z. Example 2.5.5. Consider the state space expression for a two-input, two-output system given by     2.25 −5 −1.25 −0.5 4 6

2.25 −4.25 −1.25 −0.25 2 4 0 0 0 1     x˙ =  x+ u, y = x.   0.25 −0.5 −1.25 −1 2 2 0 2 0 2 1.25 −1.75 −0.25 −0.75 0 2

The transmission zeros can be easily obtained using the following MATLAB statements: >> A=[2.25, -5, -1.25, -0.5; 2.25, -4.25, -1.25, -0.25; 0.25, -0.5, -1.25,-1; 1.25, -1.75, -0.25, -0.75]; B=[4, 6; 2, 4; 2, 2; 0, 2]; C=[0, 0, 0, 1; 0, 2, 0, 2];

2.5 Conversion Among Different Model Objects

33

D=zeros(2,2); G=ss(A,B,C,D); Z=tzero(G) Z = -0.6250 + 0.7806i -0.6250 - 0.7806i

2.5.3 State Space Realization Although from a given state space model, a unique transfer function (matrix) can be obtained, the inverse transformation, i.e., from the given transfer function to find a state space expression or realization, may not be unique. It has been shown through the RLC example in Sec. 2.1 that the state space expression can be different if the state variables are selected differently. The transformation process from a given transfer function to a state space expression is referred to as a state space realization of the transfer function. It is equivalent to saying that a given transfer function model may have an infinite number of different realizations. In this section, some of the commonly encountered types of realization are described. Assume that the transfer function of an SISO model is given by G(s) =

b1 sn−1 + b2 sn−2 + · · · + bn−1 s + bn . sn + a1 sn−1 + a2 sn−2 + · · · + an−1 s + an

A state space expression for G(s) can easily be written as      −a1 −a2 · · · −an−1 −an 1     1  0 0 ··· 0 0    x˙ =  .  x+ .. .. ..  ..  ..  ...  u . . . .    0 ··· 1 0  0  0   y = b , b , ···, b x , b 1 2 n−1 n

(2.33)

(2.34)

where x is the vector of state variables selected for this realization. It should be noted that all the transfer function models studied so far are strictly proper. If the transfer function is not strictly proper, i.e., if there exists a term b0 sn in the numerator of the transfer function model given in (2.33), a conversion is needed, i.e.,  G(s) = b0 + G(s).

(2.35)

In this case, D in the state space model will be D = b0 and the (A, B, C)  matrices can be obtained from the strictly proper transfer function G(s). The above transformation can be performed using the MATLAB function ss(), provided in the Control Systems Toolbox. From the function call, the given LTI object G can be easily converted to the state space object G1. The syntax of the function is

34

2. Mathematical Models of Feedback Control Systems

>> G1 = ss(G) and the function can also be used to deal directly with transfer functions which are not strictly proper. Example 2.5.6. Consider an SISO transfer function G(s) =

s3 + 7s2 + 24s + 24 . s4 + 10s3 + 35s2 + 50s + 24

The state space model of the system can be obtained using the following MATLAB statements: >> num=[1,7,24,24]; den=[1,10,35,50,24]; G=tf(num,den); G1=ss(G) a = x1 x2 x3 x4 x1 -10 -2.188 -0.7813 -0.1875 x2 16 0 0 0 x3 0 4 0 0 x4 0 0 2 0 b = u1 x1 1 x2 0 x3 0 x4 0 c = x1 x2 x3 x4 y1 1 0.4375 0.375 0.1875 d = u1 y1 0 Continuous-time system.

Example 2.5.7. Any MIMO transfer function can also be converted into a state space model using the same ss() function. Consider the MIMO transfer function matrix given in Example 2.2.3. One can get the state space model using the following MATLAB statements >> h11=tf(1,[1,1]); h12=0; h13=tf([1,-1],conv([1,1],[1,2])); h21=tf(-1,[1,-1]); h22=tf(1,[1,2]); h23=tf(1,[1,2]); H=[h11,h12,h13; h21,h22,h23]; G=ss(H) a = x1 x2 x3 x4 x5 x6 x1 -1 0 0 0 0 0 x2 0 1 0 0 0 0 x3 0 0 -2 0 0 0 x4 0 0 0 -3 -1 0 x5 0 0 0 2 0 0

2.5 Conversion Among Different Model Objects x6 b = x1 x2 x3 x4 x5 x6 c = y1 y2 d =

0

0

0

u1 1 1 0 0 0 0

u2 0 0 1 0 0 0

u3 0 0 0 1 0 1

x1 1 0

x2 0 -1

0

0

x3 0 1

35

-2

x4 1 0

x5 -0.5 0

x6 0 1

u1 u2 u3 y1 0 0 0 y2 0 0 0 Continuous-time model.

Similarity transformation of state space models. Since the selection of state variables can be different, the realization of a given transfer function model can also be different. Definition 2.5.1. Suppose that there exists a non-singular matrix T . Define a new state variable vector z such that z = T x. The new state space expression in vector z can be written as   z˙ = A z + B u t t (2.36)  y = Ct z + Dt u; z(0) = T x(0) where

At = T AT −1 , Bt = T B, Ct = CT −1 , Dt = D.

(2.37)

The transformation under T is referred to as a similarity transformation. The MATLAB function ss2ss() is provided in the Control Systems Toolbox to perform a similarity transformation of state space models. The syntax of the function is >> G1 = ss2ss(G, T) where G is the original state space object, and T is the similarity transformation matrix. The transformed state space object under T is returned in G1. Example 2.5.8. In fact, a transformation matrix T can be arbitrarily chosen, provided that T is non-singular. Consider the state space model obtained earlier, and select a transformation matrix with back diagonal elements as 1’s, and others as 0’s,

36

2. Mathematical Models of Feedback Control Systems

then the new state space model under this transformation can be obtained using the following MATLAB statements: >> T=fliplr(eye(4)); G2=ss2ss(G1,T) a = x1 x2 x3 x4 x1 0 2 0 0 x2 0 0 4 0 x3 0 0 0 16 x4 -0.1875 -0.7813 -2.188 -10 b = u1 x1 0 x2 0 x3 0 x4 1 c = x1 x2 x3 x4 y1 0.1875 0.375 0.4375 1 d = u1 y1 0 Continuous-time system.

Controllable canonical form. Suppose that the transfer function model is given in (2.33). The controllable canonical form can then be written as      0 1 ··· 0 0        0 0 · · · 0 0   .  .  .. ..   .    . . ˙ ˙  . x=A x= . c x+Bc u . .  x+  ..   u (2.38) =⇒  0  y=Cc x+Dc u  0 0 · · · 1     −a1 −a2 · · · −an 1   y = [b1 , b2 , · · · , bn ]x. Observable canonical form. The observable canonical form of (2.33) is



˙ x=A o x+Bo u y=Co x+Do u

       



0 1  0 ˙  x= . =⇒  ..      0   y = [0,

   0 · · · 0 −a1 b1 0 · · · 0 −a2   b2     1 · · · 0 −a3  x+  b3  u.  .   . ..  .. . .  ..  . .. . . bn 0 · · · 1 −an 0, · · · , 1]x

(2.39)

It can be seen that the controllable and observable canonical forms are dual. That is

2.5 Conversion Among Different Model Objects

Ac = ATo ,

Bc = CoT ,

Cc = BoT ,

Dc = DoT

37

(2.40)

where (Ac , Bc , Cc , Dc ) denotes the state space model of the controllable canonical realization, and (Ao , Bo , Co , Do ) the realization of the observable canonical form. Jordan canonical form. Assume that the eigenvalues of the matrix A are λ1 , λ2 , · · · , λn and its i-th eigenvector corresponding to the i-th eigenvalue λi is denoted by vi such that Avi = λi vi , i = 1, 2, · · · , n. The modal matrix Λ of A is defined as  J1  Λ = T −1 AT =  

J2

..

(2.41) 

. Jk

  

(2.42)

where Ji ’s are referred to as the Jordan matrices. Suppose that there exists a transformation matrix Tc such that the given state space model can be transformed into a controllable canonical form, then a transformation matrix T can be constructed as T = U Tc such that a modal realization can be obtained, where U = [U1 , U2 , · · · , Uk ]. The following two cases are considered for a Jordan canonical form: 1. If λi,i+1 is a complex conjugate pair, such that λi,i+1 = −σi ± jωi , the Jordan block takes the form   1 0

ωi   σi σ i ωi (2.43) Ji = , Ui =  ..  ..  −ωi σi .  . Re[λi ] Im[λi ]

2. If λi is a real eigenvalue with a multiplicity of  λi 1 0 · · ·  0 λi 1 · · · Ji =  .. .. . .  ... . . . 0

0

0

···

mi , the Jordan block Ji is  0 0 (2.44) ..  .  λi

and the transformation matrix block Ui is   1 0 0 ··· 0  λi  1 0 ··· 0  2   λi  2λ 1 · · · 0 i   Ui =  .. .. .. ..  . (2.45) ..  .  . . . .   2 mi −1  n−1 d  d 1 d 1 n−1 n−1 λi (λin−1 ) (λ ) · · · (λ ) i i 2 m −1 i dλi 2! dλi (mi − 1)! dλi

38

2. Mathematical Models of Feedback Control Systems

A MATLAB function canon() is provided in the Control Systems Toolbox with syntax >> G1=canon(G,type) where G is the state space object of the original system, and G1 is the state space object obtained after conversion. The argument type can either be ’companion’ (for the companion form of realization) or ’modal’ (for the modal form, i.e., the Jordan realization). Example 2.5.9. Consider a system model given by 

2.25  2.25 x˙ =  0.25 1.25

−5 −4.25 −0.5 −1.75

−1.25 −1.25 −1.25 −0.25

   −0.5 4 −0.25  2 x +   u, −1  2 −0.75 2

y = [1, 3, 2, 4]x.

The Jordan realization using the canon() function can be performed by >> A=[2.25, -5, -1.25, -0.5; 2.25, -4.25, -1.25, -0.25; 0.25, -0.5, -1.25,-1; 1.25, -1.75, -0.25, -0.75]; B=[4;2;2;2]; C=[1,3,2,4]; D=0; G=ss(A,B,C,D); G1=canon(G,’modal’) a = x1 x2 x3 x4 x1 -0.5 0.866 0 0 x2 -0.866 -0.5 0 0 x3 0 0 -1.5 0 x4 0 0 0 -1.5 b = u1 x1 -4.243 x2 -2.449 x3 5.097e+007 x4 -5.097e+007 c = x1 x2 x3 x4 y1 -3.182 0.6124 2.94 2.94 d = u1 y1 0 Continuous-time system. One can find the poles of the original system using the following MATLAB statement: >> format long; eig(G.a) ans = -0.50000000000000 + 0.86602540378444i -0.50000000000000 - 0.86602540378444i

2.5 Conversion Among Different Model Objects

39

-1.50000000000000 + 0.00000005006255i -1.50000000000000 - 0.00000005006255i It can be observed that the original repeated eigenvalues at −1.5 are not given exactly. The numerical algorithm gives a complex conjugate pair of poles with very small imaginary parts. It should be noted that the canon() function may give incorrect results when there exists repeated eigenvalues due to the root-finding algorithm for computing the repeated eigenvalues.

Balanced realization. Before discussing the balanced realization problem, consider the following illustrative system

−6



x 10 x1 −1 0 x˙ 1 6 −6 + u, y(t) = [10 10 ] 1 . = 106 x2 0 −2 x2 x˙ 2 It can be seen that the two elements in the B vector and those of the corresponding values in the C vector are significantly different. If a new pair of state variables z1 = 106 x1 and z2 = 10−6 x2 are selected, the system can be transformed to





z z1 1 −1 0 z˙1 u, y(t) = [1 1] 1 + = z2 z2 1 z˙2 0 −2 where the elements in the new B and C vectors are of the same numeric order. One can observe here that the transformation matrix introduced rescales the coordinates of the system to form a set of new coordinates which look more balanced. A MATLAB function balreal() is provided in the Control Systems Toolbox which can be used to perform the balanced realization of a given stable state space model. The actual algorithm for doing this transformation is given in the next chapter. The syntax of the function is >> [G1, Sig, T] = balreal(G) where the existing state space object is given by G and the balanced realized state space object is returned in G1. The transformation matrix is returned in T and the Gramians, which will be defined in the next chapter, of the new system will be returned in Sig. Example 2.5.10. Consider again the system model given in Example 2.5.6, the balanced realization of the system can be obtained using the following MATLAB statements: >> num=[1,7,24,24]; den=[1,10,35,50,24]; G=tf(num,den); [G1,Sig,T]=balreal(G); G1 a = x1 x2 x3 x4 x1 -0.82 0.3146 0.7301 -0.07656 x2 -0.3146 -0.448 -3.788 0.2365

40

2. Mathematical Models of Feedback Control Systems x3 x4 b = x1 x2 x3 x4 c = y1 d =

0.7301 -0.07656

3.788 -0.2365

-7.109 1.393

1.393 -1.623

x2 0.1663

x3 0.4201

x4 -0.04307

u1 -0.9216 -0.1663 0.4201 -0.04307 x1 -0.9216

u1 y1 0 Continuous-time system.

We can see that in the balanced realization of a SISO system, the absolute values of the corresponding elements in the B and C vectors are the same. But for MIMO cases the above argument may no longer be true [89]. Minimum realization. It has been shown in Example 2.4.1 that the order of the overall model obtained by parallel connection of blocks may be higher than the actual order of the system. In the real world, the state space model established using other methods may also produce models with an order higher than necessary or higher than the minimum. This leads to a question: What is the lowest possible order for a given system? This is what the minimum realization concerns. For an SISO transfer function or a zero-pole-gain representation, the minimum realization solution is very simple and straightforward. If the poles and zeros at the same locations can be canceled out (also called a pole-zero cancelation), the minimum realized model can be obtained immediately. The situation with the state space expression is not so straightforward. Fortunately, a MATLAB function minreal() provided in the Control Systems Toolbox can be used directly for solving the minimum realization problem. The syntax of this function is >> G1=minreal(G) where the original LTI object is given by G and the minimum realized one is given in the object G1. Example 2.5.11. Consider a fourth-order state space model given by 

−5  −4 x˙ =  0 0

8 7 0 0

0 0 0 −2

   0 4 0  −2  x+ u, y = [2 − 2 − 2 2]x. 4 2  6 1

Using the following statements, the minimum realized model can be easily obtained

2.6 Modeling of More Complicated Systems

41

>> A=[-5,8,0,0; -4,7,0,0; 0,0,0,4; 0,0,-2,6]; B=[4; -2; 2; 1]; C=[2,-2,-2,2]; D=0; G=ss(A,B,C,D); Gm=minreal(G) 2 state(s) removed a = x1 x2 x1 -1 1.221e-015 x2 -1.477e-014 2 b = u1 x1 4.243 x2 2.236 c = x1 x2 y1 2.828 -0.8944 d = u1 y1 0 Continuous-time model. and the prompt “2 states removed” has been given. In fact, the zero-pole-gain model of the given fourth-order state space model can be obtained as >> zpk(G) Zero/pole/gain: 10 (s-2.6) (s-3) (s-4) ----------------------(s+1) (s-2) (s-3) (s-4) It can be seen that there are common pole-zero pairs at s = 3, and s = 4. Canceling out these two pairs yields a transfer function of  G(s) =

10(s − 2.6) (s + 1)(s − 2)

which is the minimum realization of the system.

2.6 Modeling of More Complicated Systems 2.6.1 Simulink Modeling For many practical systems, the models may contain nonlinear elements. The modeling algorithms given in Sec. 2.4 cannot be directly applied. In this case, the sophisticated Simulink environment can be used to represent a system model. Details of the Simulink modeling are not given in this book and the interested reader may refer to [53, 101, 107]. Here, only a brief guideline for Simulink modeling is given as follows:

42

2. Mathematical Models of Feedback Control Systems

1. Startup and initial preparation: To enter a model in Simulink format, one should first start up the Simulink environment. This is usually done by typing the simulink command under the MATLAB prompt. Then, the main window of Simulink will be shown (or brought to the front, when it is already started) as shown in Fig. 2.6. One should also open a blank

Fig. 2.6. Simulink block library

window, by clicking the File | New menu item, for the new system model. 2. Draw blocks of the system: Open the relevant model block library group so that the components of the system can be copied from them. For instance, the icon labeled “Continuous” in Fig. 2.6 contains the blocks shown in Fig. 2.7 (a), while the ‘Nonlinear’ icon contains those shown in Fig. 2.7 (b). One can select the blocks in these groups and then drag them into the new system model window.

1 s

du/dt

Integrator

Derivative

Rate Limiter

x’ = Ax+Bu y = Cx+Du

1

(s−1)

s+1

s(s+1)

State−Space

Transfer Fcn

Zero−Pole

Memory

Transport Delay

Variable Transport Delay

(a) Continuous model library

Backlash

Switch

Saturation

Quantizer

Dead Zone

Relay

Manual Switch

Coulomb & Viscous Friction

Multiport Switch

(b) Nonlinear model library

Fig. 2.7. Two of the model libraries

3. Specify parameters: It should be noted that the libraries as shown in Fig. 2.7 only contain default models of certain types. For instance, the linear transfer function icon is contained in Fig. 2.7 (a), but only with a default 1/(s + 1) model. To specify the parameters of such a model, one should double click it to get the dialog box, as shown in Fig. 2.8, and then fill in the dialog box with the required parameters.

2.6 Modeling of More Complicated Systems

43

Fig. 2.8. Simulink block library

It should be noted that the numerators and denominators requested in the dialog box are with the coefficients in the descending order of s. 4. Draw links: Once copied all the blocks needed, one can draw links between blocks to make the system complete. The links between the blocks can be drawn by first clicking the output port of the starting block, and then dragging the mouse to the input port of the ending block. A linkage between the two blocks will then be established by Simulink internally. 5. Input and output specification: One should use the “Inport” icon in the “Sources” group to get an input signal for the system, and “Outport” icon in the “Sinks” group to connect to the output of the system. Example 2.6.1. Consider the nonlinear system model shown in Fig. 2.9. It can 0.707 + ✲

✲ -✻

0.4

✻✲ ✲ + 0.4

-

✲ ✻ v



s+1 ✲ +- ❄ ✲ 1 s2 +4s+3 ✻ s v =u+ ✻ ✲

u3 6



✛u

Fig. 2.9. An example of nonlinear system be seen that there are two nonlinear elements in the system. Using the Simulink program, one can easily draw the block diagram of the nonlinear system, as shown in Fig. 2.10.

44

2. Mathematical Models of Feedback Control Systems

0.707

c2nlsys.mdl

Gain s+1

1 In1 Saturation

s2+4s+3

1 s

Transfer Fcn

Integrator

1 Out1

u+u^3/6 Fcn

Fig. 2.10. The nonlinear system modeled by Simulink

Using the sophisticated Simulink program, the user can, in theory, draw the block diagram of a control system of any complexity. The Simulink program also allows the user to perform simulation analysis by its menu items or by relevant function calls. The simulation results can be shown on the scopes provided within Simulink, or returned back to the MATLAB workspace so that they can be shown by the relevant MATLAB plotting facilities. 2.6.2 Linearization of Nonlinear Models Linear systems are far easier to analyze and design than the nonlinear ones. Unfortunately, system models which must be dealt with in practice are not always linear. In this case, an approximation to the system is often required to simplify the analysis and design procedures. One procedure for doing this is the linearization process. System linearization extracts an approximate linear model, i.e., linear model in a neighborhood of the operating point. Consider the nonlinear dynamic system model x˙ i (t) = fi (x1 , x2 , · · · , xn , u, t), i = 1, 2, · · · , n.

(2.46)

An operating point is defined as the values of the state and input variables when the derivatives of the state variables approaches to zeros. It can be obtained by solving the nonlinear equations defined in (2.46) such that fi (x1 , x2 , · · · , xn , u, t) = 0, i = 1, 2, · · · , n

(2.47)

which can be solved numerically. Denote x0 the operating point with an input signal u0 , the nonlinear system can be approximated as   p n   ∂fi (x, u)  ∂fi (x, u)  ∆x˙ i = ∆x + ∆uj . (2.48) j ∂xj x0 ,u0 ∂uj x0 ,u0 j=1 j=1 Using the new state variables for the system model, the linearized model can be obtained as follows:

2.6 Modeling of More Complicated Systems

˙ z(t) = Al |x0 ,u0 z(t) + Bl |x0 ,u0 v(t) where z(t) = ∆x(t), v(t) = ∆u(t), and    ∂f1 /∂u1 ∂f1 /∂x1 · · · ∂f1 /∂xn    .. .. .. .. Al =  = , B   l . . . . ∂fn /∂u1 ∂fn /∂x1 · · · ∂fn /∂xn

45

(2.49)

 · · · ∂f1 /∂up  .. ..  . (2.50) . . · · · ∂fn /∂up

Useful functions for performing the linearization are provided in Simulink. The user can use the trim() function to find the operating point. The syntax of the trim() function is >> [x,u,y,dx]=trim(model name,x0,u0) where model name is the Simulink model name. The variables x0, u0 are the initial guess for the states and input at the operating point. A constrained optimization technique is used to obtain the operating point. For systems without nonlinear elements, the initial guess of x0, u0 can be omitted. The actual operating point is returned in x, u, y, and the values of the derivatives of the state variables are returned in dx. Theoretically speaking, the derivatives of the state variables at the operating point should be equal to 0. Example 2.6.2. Assume that the Simulink model of the nonlinear system is given in Fig. 2.10 and the name of the Simulink model file is c2nlsys.mdl. The operating point of the system can be obtained using the following MATLAB statements: >> [x0,u0,y,dx]=trim(’c2nlsys’,[],1); x0 = 0.1281 -0.0000 0.0905 u0 = 1

x0, u0

Having obtained the operating point, the linearized state space model of the nonlinear system can be obtained by the MATLAB function linmod2() provided in Simulink. The syntax of the function is >> [A,B,C,D]=linmod2(model name,x,u) where x, u is the operating point. The linearized state space expression is returned in (A, B, C, D). If one omits the x, u variables (operating point), the default linearized model can be obtained. Consider again the nonlinear system model analyzed above. The state space expression of the linearized model of the original nonlinear system under the above operating point can be obtained using the following MATLAB statements: >> [A,B,C,D]=linmod2(’c2nlsys’,x0,u0); G0=ss(A,B,C,D) a = x1 x2 x3 x1 -0.707 1 1

46

2. Mathematical Models of Feedback Control Systems x2 x3 b = x1 x2 x3 c = y1 d =

-1.008 0

-4 1

-3 0

u1 0 0 0 x1 1

x2 0

x3 0

u1 y1 0 Continuous-time system. It can be seen that, around the operating point obtained earlier at x0 = [0.1281, 0, 0.0905]T , the linearized system is an autonomous system. If the default setting is used, the linearized model becomes: >> [A,B,C,D]=linmod2(’c2nlsys’); x1 x2 x3 x1 -0.707 1 1 x2 -2 -4 -3 x3 0 1 0 b = u1 x1 0 x2 1 x3 0 c = x1 x2 x3 y1 1 0 0 d = u1 y1 0 Continuous-time system.

G=ss(A,B,C,D)

Note that the results are completely different from the previously obtained autonomous system model. If one selects another initial guess for the input signal u0 = 0, the operating point can be evaluated again and then the new linearized model can be obtained using the following MATLAB statements: >> [x0,u0,y,dx]=trim(’c2nlsys’,[],0); [A,B,C,D]=linmod2(’c2nlsys’,x0,u0); G1=ss(A,B,C,D) a = x1 x2 x3 x1 -0.707 1 1

2.6 Modeling of More Complicated Systems x2 x3 b =

-2 0

-4 1

47

-3 0

u1 0 1 0

x1 x2 x3 c =

x1 1

y1 d =

x2 0

x3 0

u1 y1 0 Continuous-time system. It can be seen that the linearized model is now the same as the linearized model using the default settings.

Example 2.6.3. Consider again the DC motor problem given in Example 2.4.4. The Simulink description is shown in Fig. 2.11, and the state space model can

dcmot.mdl 0.212 Gain 0.1 0.01s+1 Step

Transfer Fcn7

0.17s+1

0.1

0.085s

0.01s+1

Transfer Fcn6 Transfer Fcn5

70

0.21

0.051s

0.0067s+1

0.15s+1

s

Transfer Fcn3

0.15s+1

Transfer Fcn2

Transfer Fcn1

Transfer Fcn

130

1 Out1

0.1

1

0.01s+1

In1

Transfer Fcn4 0.0044 0.01s+1 Transfer Fcn8

Fig. 2.11. Simulink model for the DC motor system easily be obtained using the following MATLAB commands: >> [a,b,c,d]=linmod2(’dcmot’); G=ss(a,b,c,d); zpk(G) Zero/pole/gain: 1118525021.9491 (s+5.882) (s+6.667) (s+100)^2 ----------------------------------------------------------------(s+179.6)(s+100)^2(s+98.9)(s+8.3)(s^2+0.89s+5.8)(s^2+68.26s+2248) which is exactly the same as we obtained earlier in Example 2.4.4.

Problems 1. Enter the following system models into the MATLAB environment

48

2. Mathematical Models of Feedback Control Systems

s3 + 4s2 + 3s + 2 , + 1)[(s + 4)2 + 4]     −0.3 0.1 −0.05 2 ˙ 1 0.1 0 (b). x(t) = x(t) + 0 u(t), y = [1, 2, 3]x(t). −1.5 −8.9 −0.05 4 2. Suppose that the models in Problem-1 are all open-loop models. Evaluate using MATLAB the closed-loop models, if unity negative feedback is assumed. Find all the open-loop and closed-loop poles and zeros of the above models. 3. Assume that the linear ordinary differential equations describing a system are given by   x˙ 1 (t) = −x1 (t) + x2 (t) x˙ 2 (t) = −x2 (t) − 3x3 (t) + u1 (t) , and y = −x2 (t) + u1 (t) − 5u2 (t)  x˙ (t) = −x (t) − 5x (t) − 3x (t) + u (t) 3 1 2 3 2 (a). G(s) =

s2 (s

where there are two input signals u1 (t) and u2 (t). Model the two-input system in the MATLAB workspace. 4. An ordinary differential equation is given by y (t) + 6y(t) ˙ + 5y(t) = 2u(t). y (3) (t) + 13¨ Select a set of states and represent the equation in the MATLAB workspace. 5. Find the equivalent transfer function for the state space model     1 2 3 4 x˙ = 4 5 6 x + 3 u, y = [1, 2, 3]x 7 8 0 2

and also find the poles and zeros of the model. 6. Assume that in the typical feedback control structure, the blocks are given by (a) G(s) =

211.87s + 317.64 (s + 20)(s + 94.34)(s + 0.1684)

169.6s + 400 1 , H(s) = ; s(s + 4) 0.01s + 1 1 1 35786.7s + 108444 , Gc (s) = , H(s) = . (b) G(s) = (s + 4)(s + 20)(s + 74.04) s 0.01s + 1 Find state space models and transfer functions of the overall systems. Get the zero-pole-gain representations of the systems. 7. Suppose that a plant model is given by G(s) = 10/(s+1)3 , and a PID controller by   1 0.4353s GPID (s) = 0.48 1 + + 1.814s 1 + 0.04353s which is connected in series with the plant model G(s). Furthermore, assume that the closed-loop system is formed with a unity negative feedback. Find the closed-loop transfer function and the controllable canonical form of the equivalent state space model. Write out the zero-pole-gain representations of the open-loop and closed-loop systems. 8. Enter the following plant model into MATLAB Gc (s) =

G(s) =

1 s5 + 8s4 + 19.5s3 + 19s2 + 7.5s + 1

and evaluate the closed-loop model if a unity positive or negative feedback is assumed. Find and make comments on the closed-loop poles and zeros.

2.6 Modeling of More Complicated Systems

49

9. Represent the following block diagram in Simulink and then perform a linearization to find the closed-loop transfer function and a state space model.

r



✲ ✻

5



✲ 5



s + 0.5 s + 0.1



20 s(s+2)(s+10)

y ✲

10. Find a state space realization of the plant model given by G(s) = 1/(s + 1)3 . Comment on what may affect the Jordan canonical form. Compare the computer results with those obtained by direct calculations by hand. 11. Consider the system models     −9 −26 −24 1800000 0 0 (a). x˙ = 1 0 x+ u, y = [0, 1, 1.5 × 10−5 ]x 0 1 0 1234 1.25 × 108 s2 + 50s + 1.33 × 10−4 (b). G(s) = . s4 + 10s3 + 35s2 + 50s + 24 Perform balanced realizations for the systems. 12. Assume that the models of the systems are given by     −9 −26 −24 0 1 0 0 0   1 0 (a). x˙ =  x +   u, y = [0, 1, 1, 2]x 0 1 0 0  0 0 1 1 −1 0 2s2 + 18s + 16 . (b). G(s) = 4 s + 10s3 + 35s2 + 50s + 24 Try to check whether these models are minimally realized. If not, find the minimally realized models and give an explanation from the transfer function point of view. 13. Suppose that an overall system is composed from the series connection of two blocks G1 (s) and G2 (s) given respectively by G1 (s) =

s2 + 3s + 5 s+1 , and G2 (s) = 4 . s2 + 3s + 4 s + 4s3 + 3s2 + 2s + 1

If the state space representation for the overall system is required, compare the difference in the results using the following two approaches in MATLAB: (a). Do the series connection of the two transfer functions, and then find the state space expression for the overall system model. (b). Find the state space expressions of the two blocks, and then find the overall system model. 14. Find the overall system model using MATLAB for the feedback systems shown in Fig. 2.12. Try to use Simulink to get the closed-loop system model. Are there any problem in using Simulink, and if so, why? Get the overall system model by hand or by direct call of MATLAB functions such as series() and feedback(). 15. Consider the well-known benchmark problem for testing a computer aided design environment – the F-14 aeroplane problem [30]. The linear model is shown in Fig. 2.13. The parameters in the diagram are given by

50

2. Mathematical Models of Feedback Control Systems

✲✲ ✻

✲ ✲ ✻



s+2 s+1



s4 + 4s3 + 5s2 + 10s + 8 + 10s3 + 35s2 + 50s + 24

s4

s2 + 5s + 4 ✛ (s + 3)(s + 8) (a)

(b)

Fig. 2.12. The block iagrams in Example 14 δ(t) ❄ √

σwG

✲ √a3

n(t)





3as + 1  1 2 a

Zb

1 τa s + 1

Mw



KF

❄ ✛

Kf s

✲ Zw ✲- ❄ ✲ 1 s − Zw ✻✛ U 0 ❄

wG (t)

s+



αc (t)

π 4b



s+

s πVτ0

qG (t)

✲ Mq

4b

1 τs s + 1

❄ ✛∆



✲❄

-

❄ ✛

w(t)

Mw ✛

✲- ❄ ✲ 1 s − Mq ✻ Mb ✻ ✛

KQ



s + ω1 s + ω2





1 ✛α(t) τα s + 1

q(t)

1 U0



Fig. 2.13. The F-14 benchmark problem

τa = 0.05, σwG = 3.0, a = 2.5348, b = 64.13, Vτ0 = 690.4, σα = 5.236 × 10−3 , Zb = −63.9979, Mb = −6.8847, U0 = 689.4, Zw = −0.6385, Mq = −0.6571, Mw = −5.92 × 10−3 , ω1 = 2.971, ω2 = 4.144, τs = 0.10, τα = 0.3959, KQ = 0.8156, Kα = 0.6770, Kf = −3.864, KF = −1.745. Select the input and output as u = n(t) and y(t) = NZp (t) with NZp (t) =

1 ˙ [−w(t) ˙ + U0 q(t) + 22.8q(t)]. 32.2

Try to write out the state space expression and find all the poles and zeros of the system.

6. Model Based Controller Design

For systems control, broadly speaking, there are three major steps, i.e., modeling, analyis and design, also known as the “mad” process. If you are given a system to control, you probably have to go through this “mad” process, or loop, to achieve a satisfactory control performance. For modeling, in Chapter 2, we have discussed the mathematical models of linear feedback control systems where we are more focused on various model forms and their conversions rather than on how to build a model from experiment results which is a big subject known as “system identification” not covered in this book. For analysis, there are basically two types: time-domain analysis (Chapter 4) and frequency-domain analysis (Chapter 5). Equipped with the techniques from Chapters 4 and 5, given a plant model and a designed controller, we can tell in details the time-domain and frequency-domain properties. Now, we are ready to discuss the design of controllers. Given a plant model, how to design or synthesize a controller to meet certain desired specifications of the controlled system, is the major theme of this chapter. Since the controller design is largely dependent on the given model, we call the controller design “model based”. In this chapter, we will introduce two frequency-domain model-based controller design methods, namely, cascade lead-lag compensator design (Sec. 6.1) and model following design (Sec. 6.4). Meanwhile, two time-domain model-based controller design methods will be introduced in detail. They are the popular linear quadratic (LQ) optimal control (Sec. 6.2) and the pole placement techniques (Sec. 6.3). We will also discuss about the state observer and the observer-based control. In Sec. 6.5, the SISOTool, an interactive controller design tool in the Control Systems Toolbox mainly for single input and single output systems, is briefly demonstrated. As a side remark, it should be noted that the “mad” process, in practice, may be iterative which means that a successful system control may need several rounds of modeling, analyis and design.

6.1 Cascade Lead-lag Compensator Design 6.1.1 Introduction to Lead-lag Synthesis In early days of control system implementation, the controllers were mostly in analog form. Due to its simplicity, the phase lead-lag compen-

194

6. Model Based Controller Design

sator was the popular form of system controller since the phase lead-lag block can be usually implemented by the passive networks composed of only resistors and capacitors, known as the RC network. Till today, even with digital computer control, lead-lag compensators are still welcome by the control engineering practitioners. Basically, there are three commonly used types of the compensators, namely, phase lead compensator, phase lag compensator and phase lead-lag compensator. Note that, the compensator or the controller, Gc (s), is usually applied in cascade (series) connection to the plant model G(s). Phase lead compensator. The equivalent RC (resistor and capacitor) network to realize a phase lead compensator is shown in Fig. 6.1 (a). Denote that Z1

C

Im ✻

R1

1 1 − − T αT Z2

ui

R2



Re ✲

uo



(a) lead network

(b) pole-zero positions

Fig. 6.1. Lead compensator

the impedances Z1 = R1 /(1 + R1 Cs) and Z2 = R2 . The transfer function of the phase lead network can be written as Gc (s) = where T =

Z2 Uo (s) 1 1 + αT s = = Ui (s) Z1 + Z2 α 1 + Ts

(6.1)

R1 R2 R1 + R2 C, α = . R1 + R2 R2

(6.2)

Obviously, α > 1. In general, the phase lead compensator can be written as Gc (s) = Kc

1 + αT s . 1 + Ts

(6.3)

The pole-zero location of the compensator is sketched in Fig. 6.1 (b). Since α > 1, the pole is always located on the left hand side of the zero. For some different α’s, the Bode and Nyquist diagrams of the lead compensator with T = 1 are shown in Figs. 6.2 (a) and (b), respectively, through the following MATLAB statements: >> alpha=1.2; T=1; G=tf([alpha*T,1]/alpha,[T,1]); [x,y,w1]=nyquist(G,{.01,10}); [m,p,w2]=bode(G,{.01,10});

6.1 Cascade Lead-lag Compensator Design

195

0.4

0

0.3

-5 -10 α=5 -15 -2 10

40 30 20 10 0 -2 10

α=5 α=4.5

0.2

α=4.5

0.1

10-1

100

α=5

α=4.5 α=4

101

0 α=1.5

-0.1

α=1.1

-0.2 -0.3

10-1

100

101

-0.4 0

(a) Bode diagrams

0.2

0.4

0.6

0.8

1

(b) Nyquist plots

Fig. 6.2. Frequency-domain representation of a lead compensator x=x(:); y=y(:); m=m(:); p=p(:); for alpha0=1.5:0.5:5 G1=tf([alpha0*T,1]/alpha0,[T,1]); [xx,yy]=nyquist(G1,w1); [mm,pp]=bode(G1,w2); x=[x,xx(:)]; y=[y,yy(:)]; m=[m,mm(:)]; p=[p,pp(:)]; end subplot(211); semilogx(w2,20*log10(m)) subplot(212); semilogx(w2,p); figure, plot([x,x],[y -y]), axis([0,1,-0.4,0.4]); axis(’square’)

It can be observed that when α is large, the gain compensation is small but the phase compensation is large. Example 6.1.1. Consider a plant model given by G(s) =

100 . s(0.04s + 1)

The behavior of a lead compensator for the above plant model in frequency-domain is illustrated through this example. The gain and phase margins of the system are obtained using the following MATLAB statements: >> G=tf(100,[0.04,1,0]); [Gm,Pm,Wcg,Wcp]=margin(G); [Gm,Pm,Wcg,Wcp] ans = Inf 28.0202 NaN 46.9782 >> w=logspace(-1,3); [m,p]=bode(G,w); subplot(211), semilogx(w,20*log10(m(:))) subplot(212), semilogx(w,p(:)) We can read that the plant model has an infinite gain margin, while the phase margin is about γ = 28◦ at ω = 47 rad./sec. The Bode diagram of the open-loop model is shown in Fig. 6.3 (a) where the phase margin is marked.

196

6. Model Based Controller Design 10 Gain dB

50 0 -50 10-1

ω=47 100

101

102

5

0 -1 10

103

100

101 102 Frequency (rad/sec)

103

100

101 102 Frequency (rad/sec)

103

30

-150

γ=28o

-180o

-200 -1 10

Phase deg

-100

100

101

102

(a) Plant Bode diagrams

103

20 10 0 -1 10

(b) Compensator Bode diagrams

Fig. 6.3. Bode diagrams demonstration The phase margin can be increased by introducing a phase lead compensator given by Gc (s) = (0.0262s+1)/(0.0106s+1). The Bode diagram of the compensator is shown in Fig. 6.3 (b). In this case, the gain and phase margins of the compensated system can be obtained using the following MATLAB statements: >> Gc1=tf([0.0262 1],[0.0106,1]); bode(Gc1,w) G_o=Gc1*G; [Gm,Pm,Wcg,Wcp]=margin(G_o); [Gm,Pm,Wcg,Wcp] ans = Inf 47.5917 NaN 60.3252 Since the magnitude and the phase around the frequency ω = 60 rad./sec. are both increased in compensator Bode plot shown in Fig. 6.3 (b), the phase margin of the compensated system is increased to 47.6◦ , and the crossover frequency is increased to ω = 60 rad./sec. The open-loop Bode diagram of the compensated system can be obtained using the following MATLAB statements: >> [m,p]=bode(G,w); [m1,p1]=bode(G_o,w); subplot(211), semilogx(w,20*log10([m(:),m1(:)])) subplot(212), semilogx(w,[p(:),p1(:)]) G_c1=feedback(G,1); G_c2=feedback(G_o,1); [y,t]=step(G_c1); y=[y,step(G_c2,t)]; figure, plot(t,y) The Bode diagrams of the compensated system and the original system are compared in Fig. 6.4 (a). Clearly, if the open-loop system is not desirable, one can introduce a lead compensator to increase the gain and the crossover frequency of the system. At the same time, the phase at this frequency can also be compensated, i.e., the phase margin can be increased. This can also be regarded as a simple example of the loop-shaping technique. The closed-loop step responses of the systems before and after phase lead compensation are compared in Fig. 6.4 (b). Obviously, the step response of the compensated system is significantly improved, since the overshoot is reduced due to the increased phase margin, and the speed of response is also increased, due to the increased crossover frequency.

6.1 Cascade Lead-lag Compensator Design

1.5

Gain dB

50

original model

0 ω1=60

ω=47

-50 10-1

100

1

101 102 Frequency (rad/sec)

103

compensated model

-90 Phase deg

197

-120 -150

0.5

γ1=47.6o γ=28o

-180o

-180 10-1

100

101 102 Frequency (rad/sec)

103

(a) Bode diagrams comparison

0

0

0.1

0.2

0.3

0.4

0.5

(b) step response comparison

Fig. 6.4. Comparison of system responses

Phase lag compensator. The equivalent RC network for a phase lag compensator is shown in Fig. 6.5 (a). The pole-zero position of the phase lag Im ✻ Z1 R1 Z2 R2

ui

C





1 1 − αT T

Re ✲

uo



(a) lag network

(b) pole-zero positions

Fig. 6.5. Lag compensator

compensator is sketched in Fig. 6.5 (b). Let Z1 = R1 and Z2 = R2 + 1/(Cs). The transfer function of the phase lag network can be written as Gc (s) =

Z2 Uo (s) 1 + αT s = = Ui (s) Z1 + Z2 1 + Ts

(6.4)

where R2 C = αT, α = R2 /(R1 + R2 ) < 1. In a more general form, the phase lag compensator can be written as Gc (s) = Kc

1 + αT s . 1 + Ts

(6.5)

The Bode diagrams and the Nyquist plots for T = 1 are shown in Figs. 6.6 (a) and (b), respectively, for different values of α. These diagrams are obtained using the following MATLAB statements:

198

6. Model Based Controller Design 5

20

10

4

α=0.1

15 α=0.3

2

5 0 -1 10

α=0.2

1 100

101

0

α=0.3

0 -1 -2

-20

α=0.3 α=0.2

-40 -60 -1 10

α=0.1

3

α=0.2

-3 -4

α=0.1 100

(a) Bode diagrams

101

-5

0

2

4

6

8

10

(b) Nyquist plots

Fig. 6.6. Frequency representation of lag compensator >> alpha=0.9; T=1; G=tf([alpha*T,1]/alpha,[T,1]); [x,y,w1]=nyquist(G,{.1,10}); [m,p,w2]=bode(G,{.1,10}); x=x(:); y=y(:); m=m(:); p=p(:); for alpha0=0.8:-0.1:0.1 G1=tf([alpha0*T,1]/alpha0,[T,1]); [xx,yy]=nyquist(G1,w1); [mm,pp]=bode(G1,w2); x=[x,xx(:)]; y=[y,yy(:)]; m=[m,mm(:)]; p=[p,pp(:)]; end subplot(211); semilogx(w2,20*log10(m)) subplot(212); semilogx(w2,p); figure, plot([x,x],[y -y]), axis([0,10,-5,5]); axis(’square’)

It can be seen that, contrary to the phase lead controllers, the phase in phase lag compensator is decreased. Example 6.1.2. Consider again the plant model in Example 6.1.1. If a phase lag compensator Gc (s) = (0.5s + 1)/(2.5s + 1) is used instead, the gain and phase margins of the compensated system can be obtained using the following MATLAB statements: >> Gc2=tf([0.5 1],[2.5,1]); G=tf(100,[0.04,1,0]); G_o=Gc2*G; [Gm,Pm,Wcg,Wcp]=margin(G_o); [Gm,Pm,Wcg,Wcp] ans = Inf 50.7572 NaN 16.7339 It can be seen that the phase margin of the system is increased to γ = 50.75◦ , while the crossover frequency is reduced to ωc = 16.73 rad./sec. The Bode diagram of the compensated system can be obtained as shown in Fig. 6.7 (a), using the following MATLAB statements: >> [m,p]=bode(G,w); [m1,p1]=bode(G_o,w); subplot(211), semilogx(w,20*log10([m(:),m1(:)])) subplot(212), semilogx(w,[p(:),p1(:)]) G_c1=feedback(G,1); G_c2=feedback(G_o,1); G_c3=feedback(Gc1*G,1); [y,t]=step(G_c1); y=[y,step(G_c2,t),step(G_c3,t)]; figure, plot(t,y)

6.1 Cascade Lead-lag Compensator Design 1.5

50 Gain dB

199

original model

0

lag compensated ω2=16.7

-50 10-1

100

1

ω=47

101 102 Frequency (rad/sec)

103

-90 Phase deg

lead compensated 0.5 γ2=50.7o

-180 10-1

100

γ=28o

101 102 Frequency (rad/sec)

(a) Bode diagrams comparison

103

0

0

0.1

0.2

0.3

0.4

0.5

(b) step response comparison

Fig. 6.7. Comparison of system responses The basic idea of a lag compensator is to decrease the crossover frequency, so as to increase the phase margin of the system. However, this technique will reduce the response speed of the system. The step responses of the phase lag compensated system, the original system and the phase lead compensated system, are also obtained as shown in Fig. 6.7 (b). It can be seen from Fig. 6.7 (b) that both the compensated systems have their overshoots reduced, due to the increment of the phase margins. However the response speed of the lag compensated system is even slower than the original uncompensated system, since the crossover frequency of the compensated system is reduced. The response speed of the lead compensated system, on the other hand, is faster than that of the uncompensated system. Now, let us fix α = 0.2 and change T , i.e., the lag compensator is Gc (s) = (1 + 0.2T s)/(1 + T s). Let us see how T affects the performance of the compensated system. Using the following MATLAB statements: >> G=tf(100,[0.04,1,0]); f1=figure; f2=figure; y=[]; m=[]; p=[]; w=logspace(-2,2); for T=[0.5,1,2.5,5,10,20] Gc2=tf([0.2*T 1],[T,1]); G_o=G*Gc2; G_c=feedback(G_o,1); [mm,pp]=bode(G_o,w); y=[y,step(G_c,t)]; m=[m,mm(:)]; p=[p,pp(:)]; end figure(f1), subplot(211), semilogx(w,20*log10(m)) subplot(212), semilogx(w,p), figure(f2), plot(t,y) the superimposed Bode diagrams and step responses are shown in Figs. 6.8 (a) and (b), respectively. Among the phase lag compensators, we can see that the larger the value of T , the better the performance of the compensated system.

Phase lead-lag compensator. For a phase lead-lag compensator, its equivalent RC network is shown in Fig. 6.9 (a), and its pole-zero location is shown in Fig. 6.9 (b). Denote Z1 = R1 /(1 + R1 C1 s), and Z2 = R2 + 1/(C2 s). The transfer function of the phase lead-lag compensator can be written as

200

6. Model Based Controller Design

T=0.5 T=1

102

Amplitude

T=2.5 (the nominal) 1 T=20

T=10 T=5

0.5

Phase deg

Gain dB

1.5 T=20 60 T=0.5 40 T=1 20 T increases 0 -20 10-2 10-1 100 101 Frequency (rad/sec) -90

-120 T=20

-150

T=10

-180 -2 10

10-1

T=1 T=0.5 T=5 100 101 Frequency (rad/sec)

102

(a) Bode diagrams comparison

0

0

0.1

0.2 0.3 Time (secs)

0.4

0.5

(b) step response comparison

Fig. 6.8. The effect of changing T Z1 C1

Im ✻

R1 Z2 R2

ui

C2

❄ (a) lead-lag network

− uo





1 αT1

1 1 − βT2 T1 −

Re ✲

1 T2

(b) pole-zero positions

Fig. 6.9. Lead-lag compensator

Gc (s) =

1 + αT1 s 1 + βT2 s Z2 Uo (s) = = Ui (s) Z1 + Z2 1 + T1 s 1 + T2 s

(6.6)

where αT1 = R1 C1 , βT2 = R2 C2 , αβ = 1, and clearly, R1 C1 +R2 C2 +R1 C2 = T1 + T2 , T1 T2 = R1 C1 R2 C2 . When α > 1 and β < 1, the first term in (6.6) exhibits the phase lead property while the second term has the phase lag characteristics. As an illustration, with T1 = 0.5, T2 = 0.005, and α = 3, β = 1/3, the Bode diagram, superimposed with the asymptote magnitude diagrams, of the lead-lag compensator is obtained using the following MATLAB statements: >> T1=0.5; T2=0.005; alpha=3; beta=1/3; nc=conv([alpha*T1,1],[beta*T2,1]); dc=conv([T1,1],[T2,1]); w=logspace(-2,4); G=tf(nc,dc); [m,p]=bode(G,w); [x,y]=bd_asymp(G,w); m=m(:); p=p(:); subplot(211); semilogx(w,20*log10(m),x,y) subplot(212); semilogx(w,p)

as shown in Fig. 6.10 (a) where it can be observed that the phase is positive (lead) before it becomes negative (lag). The controller is also known as the

6.1 Cascade Lead-lag Compensator Design

201

phase lead-lag compensator. However, if T2 = 0.5, T1 = 0.005, the Bode

10

0

5

-5

0 -2 10

10-1

100

101

102

103

104

-10 -1 10

100

101

102

103

100

101

102

103

40 20

20 0

0

-20

-20

-40 -2 10

10-1

100

101

102

103

104

10-1

(a) lead-lag compensator

(b) lag-lead compensator

Fig. 6.10. The Bode diagrams of the lead-lag compensators

diagram of the compensator can be obtained using the following MATLAB statements: >> T2=0.5; T1=0.005; alpha=3; beta=1/3; nc=conv([alpha*T1,1],[beta*T2,1]); dc=conv([T1,1],[T2,1]); w=logspace(-2,4); G=tf(nc,dc); [m,p]=bode(G,w); [x,y]=bd_asymp(G,w); m=m(:); p=p(:); subplot(211); semilogx(w,20*log10(m),x,y) subplot(212); semilogx(w,p)

and the Bode diagram is then shown in Fig. 6.10 (b). In this case, since the phase lag action is taken first and then comes the lead action, the controller is referred to as the phase lag-lead compensator. In practical applications, the lead-lag compensator is usually used. In what follows, we will show how to design the phase lead-lag compensator. 6.1.2 Lead-lag Synthesis by Phase Margin Assignment The transfer function of a lead-lag compensator can be written as Gc (s) =

Kc (s + zc1 )(s + zc2 ) , (s + pc1 )(s + pc2 )

(zc1 ≤ pc1 , zc2 ≥ pc2 ).

(6.7)

Denote Kp∗ the desired static position error constant which is defined as Kp = lims→0 Gc (s)G(s) with G(s) the plant model. If the phase angle of the plant model is φ1 (ωc ) at the crossover frequency ω = ωc , the phase angle of the compensator at ωc should be φc (ωc ) = γ − 180◦ − φ1 (ωc ), where γ is the expected phase margin of the compensated system. The magnitude of the plant model at ωc is denoted by A(ωc ). The following synthesis procedure can be used:

202

6. Model Based Controller Design

Case 1. When φc (ωc ) > 0, the lead compensation is required which can be designed as zc 1 − sin φc (6.8) α= 1 = p c1 1 + sin φc and z c1

" √ ωc2 + p2c1 z c1 ωc = αωc , pc1 = . = √ , Kc = " 2 p c1 α ωc + zc21 A(ωc )

(6.9)

The static position error constant of the system can be obtained as K1 = lim sv Go (s) = s→0

bm K c z c 1 an−v pc1

(6.10)

where v is the multiplicity of the pole s = 0 of the plant model G(s) with G(s) =

b0 sm + b1 sm−1 + · · · + bm−1 s + bm sv (a0 sn−v + a1 sn−v−1 + · · · + an−v+1 s + an−v )

and Go (s) is the open-loop transfer function with the compensator, i.e., Go (s) = Gc (s)G(s). If K1 ≥ Kp∗ , the designed phase lead compensator is adequate according to the phase margin assignment. Otherwise, a phase lead-lag compensation is expected. Case 2. For phase lead-lag compensation, it is required to further specify z c2 =

ωc , 10

pc2 =

K 1 z c2 . Kp∗

(6.11)

Case 3. If φc (ωc ) < 0, the phase lag compensation is expected, and Kc =

1 , zc2 = ωc /10, pc2 = K1 zc2 /Kp∗ A(ωc )

(6.12)

where K1 = bm Kc /an−v . Based on the above design algorithm with three cases, a MATLAB function leadlagc() is designed and listed in Appendix C. The syntax is >> Gc=leadlagc(G,wc,gamma,KpStar,key) where G is the LTI object of the plant model, wc is the expected crossover frequency, gamma is the expected phase margin of the compensated system, and KpStar is the static position error constant. If key is provided, the controller will be designed according to the type specified in key with key=1, 2, 3 for the Cases 1, 2, 3 respectively discussed in the the above. If key is not provided, the controller structure will be selected automatically. The returned Gc is the transfer function object of the compensator.

6.1 Cascade Lead-lag Compensator Design

203

Example 6.1.3. Consider the plant model in Example 6.1.1. Different phase margins are assigned with the crossover frequency at ωc = 100 rad./sec. The corresponding compensators can be designed using the following MATLAB statements: >> G=tf(100,[0.04,1,0]); wc=100; f1=figure; f2=figure; m=[]; p=[]; y=[]; w=logspace(-1,3); t=0:0.005:0.2; for gamma=[30,40,50,60,70,80,90] Gc=leadlagc(G,wc,gamma,10); G_o=Gc*G; G_c=feedback(G_o,1); [m1,p1]=bode(G_o,w); y1=step(G_c,t); m=[m,m1(:)]; p=[p,p1(:)]; y=[y,y1]; end figure(f1), subplot(211), semilogx(w,20*log10(m)) subplot(212), semilogx(w,p), figure(f2), plot(t,y) >> Gc Transfer function: 33.49 s + 412.3 --------------s + 812.3 It can be seen that when γ = 90◦ , the lead compensator can be designed as Gc (s) =

s + 12.3106 33.4924s + 412.3106 = 33.4924 . s + 812.3106 s + 812.3106

Phase deg

60 40 20 0 -20 -40 -1 10

1.5 γ=90o

100

γ=30o γ=40o γ=50o

γ=30o

101 102 Frequency (rad/sec)

-90

103

γ=90o

Amplitude

Gain dB

The Bode diagrams of the system under some different γ’s can be obtained as shown in Fig. 6.11 (a), and it can be seen that the phase margins of the compensated

1 γ=90o γ=80o 0.5

γ=30o

-180 10-1

100

101 102 Frequency (rad/sec)

(a) Bode diagrams comparison

103

0

0

0.04

0.08 0.12 Time (secs)

0.16

0.2

(b) step response comparison

Fig. 6.11. The effect of the desired phase margin γ system are consistent with the pre-defined values. The closed-loop step responses of the system are shown in Fig. 6.11 (b) where it can be seen that when the specified phase margin increases, the step response becomes improved in terms of small overshoot. However, for this example, if the phase margin is specified too large, for instance, 80◦ - 90◦ , the system responses are not satisfactory. So, in real control applications, a too aggressive phase margin specification may not be good.

204

6. Model Based Controller Design

Now, let us fix the specified phase margin to γ = 60◦ and change the values of the crossover frequencies ωc . The Bode diagrams and closed-loop step responses of the compensated system are compared in Figs. 6.12 (a) and (b), respectively, by

1.2

50

ωc=500 ωc=300

ωc=500

0

1

ωc=50

-50 -1 10

100

101 102 Frequency (rad/sec)

103

Phase deg

-90

Amplitude

Gain dB

100

0.8

ωc=200 ωc=100 ωc=50

0.6 0.4

ωc=500

-180 10-1

100

ωc=50

0.2 103

101 102 Frequency (rad/sec)

(a) Bode diagrams comparison

0

0

0.02

0.04 0.06 Time (secs)

0.08

0.1

(b) step response comparison

Fig. 6.12. The effect of the desired crossover frequency ωc using the following MATLAB statements: >> G=tf(100,[0.04,1,0]); gamma=60; f1=figure; f2=figure; m=[]; p=[]; y=[]; w=logspace(-1,3); t=0:0.001:0.1; for wc=[50,100,200,300,500] Gc=leadlagc(G,wc,gamma,10); G_o=Gc*G; G_c=feedback(G_o,1); [m1,p1]=bode(G_o,w); y1=step(G_c,t); m=[m,m1(:)]; p=[p,p1(:)]; y=[y,y1]; end figure(f1), subplot(211), semilogx(w,20*log10(m)) subplot(212), semilogx(w,p), figure(f2), plot(t,y) Clearly, the overshoots under different ωc ’s are almost the same. However, when ωc increases, the step response becomes faster.

Example 6.1.4. Consider the transfer function of the plant model given by G(s) =

100 . s(s + 1)(0.0125s + 1)

Set the crossover frequency at ωc = 50 rad./sec. and assign the expected phase margin of the compensated system to γ = 50◦ . The compensator Gc is then designed by calling the leadlagc() function. The Nichols charts of systems before and after the compensation are compared in Fig. 6.13 (a) using the following MATLAB statements: >> G=tf(100,[conv([1,1],[0.0125,1]),0]);

6.1 Cascade Lead-lag Compensator Design

205

Gc=leadlagc(G,50,50,100); zpk(Gc) Zero/pole/gain: 368.8908 (s+3.997) -----------------(s+625.5) >> G_o1=Gc*G; w=logspace(0,4); ngrid(’new’); nichols(G,w); nichols(G_o1,w), axis([-360,0,-40,40])

40

40 0 db 0.25 db 0.5 db 1 db

20

3 db 6 db

10

0 db 30 -1 db -3 db

0

-6 db

-10

-12 db original

-20

compensated

-20 db

-30 -40 -360

Open-Loop Gain (db)

Open-Loop Gain (db)

30

0.25 db 0.5 db 1 db

20 10

-1 db

3 db 6 db

-3 db

compensated

-12 db

-6 db

0 original

-10

-20 db

-20 -30

-270

-180 -90 Open-Loop Phase (deg)

-40 db 0

-40 -360

(a) expected ωc = 50, γ = 50◦

-270

-180 -90 Open-Loop Phase (deg)

-40 db 0

(b) expected ωc = 50, γ = 100◦

Fig. 6.13. Nichols charts for different controllers

From the Nichols chart, the closed-loop uncompensated system is unstable. By introducing the lead compensator, at high frequencies, the Nichols chart is kept away from the M = 1dB contour which not only makes the closed-loop compensated system stable, but also ensures a rather good time domain response of the compensated system. To get an even larger phase margin by using the lead compensator, for instance, γ = 90◦ , the new design result can be obtained by using the following MATLAB statements: >> Gc=leadlagc(G,50,90,100); zpk(Gc) Zero/pole/gain: 106.8351 (s+13.8) ----------------(s+181.2) Let us analyze the compensated system using the following MATLAB statements: >> G_o2=G*Gc; ngrid(’new’); nichols(G,w); nichols(G_o2,w), axis([-360,0,-40,40]) [G1,P1,w1,w2]=margin(G_o2); [G1,P1,w1,w2] ans = 3.4042 28.2808 105.6112 50.0000

206

6. Model Based Controller Design

The Nichols charts of the systems are shown in Fig. 6.13 (b). The actual phase margin under this newly designed controller is γ = 28.28◦ , which is, with surprise, well below the expected γ = 90◦ . It can be seen that although the system is stabilized, the closed-loop behavior of the compensated system may not be very good, due to the poor Nichols charts. Therefore, the pre-specified phase margin of 90◦ cannot be met and the requirements are over-demanding for the implementation under a lead-lag compensation. Similarly, if we wish to achieve a phase margin of γ = 50◦ and at the same time, to have a crossover frequency at ωc = 100 rad./sec., the following MATLAB statements can be used: >> Gc=leadlagc(G,100,50,100); zpk(Gc) Zero/pole/gain: 1698.7153 (s+9.424) ------------------(s+1061) >> G_o3=G*Gc; ngrid(’new’); nichols(G,w); nichols(G_o3,w), axis([-360,0,-40,40]) [G1,P1,w1,w2]=margin(G_o3); [G1,P1,w1,w2] ans = 6.3204 28.4655 274.3693 100.0000 The Nichols charts are shown in Fig. 6.14 (a). Once more, it can be seen that 1.8

40 0 db Open-Loop Gain (db)

30

0.25 db 0.5 db 1 db

20

3 db 6 db

10

-1 db -3 db

-12 db

-10 original

-20

[ωc=50,γ=90o] -- cannot be implemented

1.4

-6 db

0

[ωc=100,γ=50o] -- cannot be implemented

1.6

[ωc=50,γ=50o]

1.2 1 0.8 0.6

-20 db

0.4

compensated -30

0.2

-40 -360

-270

-180 -90 Open-Loop Phase (deg)

-40 db 0

(a) expected ωc = 100, γ = 50



0

0

0.05

0.1

0.15

0.2

0.25

(b) step response comparison

Fig. 6.14. System responses comparisons the pre-specified properties of the desired system cannot be achieved. Therefore, the controller design objective is over-specified. The closed-loop step responses of the systems under the three compensators designed in the above are compared in Fig. 6.14 (b), with the following MATLAB statements: >> G_1=feedback(G_o1,1); G_2=feedback(G_o2,1); G_3=feedback(G_o3,1); [y1,t]=step(G_1); y2=step(G_2,t); y3=step(G_3,t); plot(t,[y1,y2,y3]) It can be seen that the closed-loop response comparison agrees well with the analysis performed earlier from the Nichols charts.

6.2 Linear Quadratic Optimal Control

207

In fact, even if the crossover frequency ωc and the phase margin γ are both assigned, the compensator designed using the approach given above may not guarantee a closed-loop system satisfying all the specifications. Moreover, the closed-loop system may not be even stable with the designed compensator. The closed-loop behavior of the system should be examined before the controller can be used in practice. Some other lead-lag compensator design approaches, such as the root locus based method, will not be discussed in this book.

6.2 Linear Quadratic Optimal Control 6.2.1 Linear Quadratic Optimal Control Strategies Consider a linear time invariant (LTI) system given by its state space model   x(t) ˙ = Ax(t) + Bu(t) (6.13)  y(t) = Cx(t) + Du(t).

Introduce the following performance index for the optimal controller design: 1 1 J = xT (tf )Sx(tf ) + 2 2



tf 

t0

 xT (t)Q(t)x(t) + uT (t)R(t)u(t) dt

(6.14)

where Q and R are weighting matrices for the state variable and the input variable, respectively, and tf is the terminal time for control action which means that the control action is in a finite time interval. S is the weighting matrix for the terminal state. This optimal control problem is referred to as the linear quadratic (LQ) optimal control problem. To solve this LQ optimal control problem, let us construct a Hamiltonian matrix first    1 (6.15) H = − xT (t)Qx(t) + uT (t)Ru(t) + λT (t) Ax(t) + Bu(t) . 2 When there is no constraint on the input signal, the optimal (in this case, the minimum) value can be solved by taking the derivatives of H with respect to u and then by solving the following equation: ∂H = −Ru(t) + B T λ(t) = 0. ∂u

(6.16)

Denote u∗ (t) the optimal control signal u(t). Then, u∗ (t) can be explicitly written in the following form: u∗ (t) = R−1 B T λ(t).

(6.17)

208

6. Model Based Controller Design

On the other hand, it can be shown that λ(t) can be written as λ(t) = −P (t)x(t), where P (t) is the symmetrical solution matrix of the well known Riccati differential equation (RDE) P˙ (t) = −P (t)A − AT P (t) + P (t)BR−1 B T P (t) − Q

(6.18)

with its final value P (tf ) = S. So, the optimal control signal can also be written as u∗ (t) = −R−1 B T P (t)x(t). (6.19) It is interesting to note that the solution of the finite time LQ optimal control problem turns out to be a linear state feedback with a time varying gain matrix which is equal to −R−1 B T P (t). 6.2.2 Linear Quadratic Regulator Problems When tf is finite, solving the LQ optimal control problem amounts to solving the RDE (6.18) which is very difficult to solve. In many applications, we are more concerned with the regulation performance, which implies that tf → ∞, as in many process control systems. If we consider this steady-state performance, the LQ optimal control problem is referred to as an LQR (linear quadratic regulator) problem. In LQR problem, tf = ∞ and the closed-loop system will be asymptotically stabilized. The RDE solution matrix P (t) will tend to a constant matrix, i.e., P˙ (t) = 0. In this case, the RDE reduces to the so-called algebraic Riccati equation (ARE) as follows: −P A − AT P + P BR−1 B T P − Q = 0.

(6.20)

The above ARE can be easily solved by the MATLAB dunction are() in the Control Systems Toolbox. Then, the LQR problem can be solved using a linear state feedback with a constant gain matrix, i.e., u(t) = −Kx(t),

K = −R−1 B T P .

Clearly, the closed-loop system is simply [(A − BK), B, C, D]. A MATLAB function lqr() provided in the Control Systems Toolbox, can be used to design an LQR for a given system with given weighting matrices. The syntax of the function is >> [K,P]=lqr(A,B,Q,R) where (A, B) is the given state space model, (Q, R) are the weighting matrices Q and R, respectively. K is the state feedback gain vector, and P is the solution matrix for the ARE. We remark that the Schur decomposition algorithm is used in the algebraic Riccati equation solver are() which is more reliable than the function lqr().

6.2 Linear Quadratic Optimal Control

209

Example 6.2.1. Consider the following plant in state space form: 

−0.2  0  ˙ x(t) = 0  0 0

0.5 −0.5 0 0 0

0 1.6 −14.3 0 0

0 0 85.8 −33.3 0

   0 0  0  0     0  x(t)+  0  u(t), y = [1, 0, 0, 0, 0]x.  0   100 30 −10

Select the weighting matrices as Q = diag{ρ, 0, 0, 0, 0} and R = 1. When ρ = 1, the LQR problem can be easily solved using the following MATLAB statements: >> A=[-0.2,0.5,0,0,0;0,-0.5,1.6,0,0;0,0,-14.3,85.8,0; 0,0,0,-33.3,100;0,0,0,0,-10]; B=[0; 0; 0; 0; 30]; Q=diag([1,0,0,0,0]); R=1; C=[1,0,0,0,0]; D=0; [K,P]=lqr(A,B,Q,R) K = 0.9260 0.1678 0.0157 0.0371 0.2653 P = 0.3563 0.0326 0.0026 0.0056 0.0309 0.0326 0.0044 0.0004 0.0009 0.0056 0.0026 0.0004 0.0000 0.0001 0.0005 0.0056 0.0009 0.0001 0.0002 0.0012 0.0309 0.0056 0.0005 0.0012 0.0088 The closed-loop state matrix Ac under LQR can be obtained with the following MATLAB statements: >> Ac=A-B*K; step(ss(Ac,B,C,D))

1.2

1.2

1

1

0.8

0.8

Amplitude

Amplitude

and the step response of the closed-loop system is shown in Fig. 6.15 (a).

0.6

ρ=1

0.6

0.4

0.4

0.2

0.2

ρ=5 ρ=10 ρ=50 ρ=100

0

0

0.2

0.4

0.6

0.8 1 Time (secs)

1.2

1.4

(a) LQR design with ρ = 1

1.6

0

0

0.2

0.4

0.6

0.8 1 Time (secs)

1.2

1.4

1.6

(b) LQR with different ρ

Fig. 6.15. Step responses of closed-loop systems For different values of ρ, for example, ρ = 5, 10, 50, 100, the step responses of closed-loop systems under the optimal LQR can be obtained using the following MATLAB statements:

210

6. Model Based Controller Design >> for rho=[1,5,10,50,100] Q(1,1)=rho; [K,P]=lqr(A,B,Q,R); Ac=A-B*K; step(ss(Ac,B,C,D)); hold on end

and the results are compared in Fig. 6.15 (b). Clearly, when ρ increases, the magnitude of y(t) = x1 (t) becomes smaller since the penalty on x1 (t) is heavier. Let us compare the frequency domain behaviors with different ρ’s. Fig. 6.16 shows the closed-loop Bode diagrams for different values of ρ obtained through the following MATLAB statements: >> w=logspace(0,3); m=[]; p=[]; for rho=[1,5,10,50,100] Q(1,1)=rho; [K,P]=lqr(A,B,Q,R); Ac=A-B*K; [m1,p1]=bode(ss(Ac,B,C,D),w); m=[m,m1(:)]; p=[p,p1(:)]; end subplot(211), semilogx(w,20*log10(m)) subplot(212), semilogx(w,p) We can observe from the magnitude Bode plot that the attenuation increases as ρ increases, which is consistent to what is shown in Fig. 6.15 (b). 6 Gain dB

0 -50

-100

4 3

-150 -200 0 10

x3(t)

5 ρ increases

2 101

102 Frequency (rad/sec)

103

0

-180

-1

Phase deg

x2(t)

1

0

x5(t)

x4(t)

-2

-360 100

ρ increases 101

-3 102 Frequency (rad/sec)

(a) LQ control with other Q

103

-4 0

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

1

(b) other states

Fig. 6.16. Bode diagrams and step responses of closed-loop systems To see other state responses under the LQR, let us fix ρ = 100. The step responses of x2 (t) to x5 (t) obtained using the following MATLAB statements: >> [y,t,x]=step(ss(Ac,B,C,D)); figure; plot(t,x(:,2:5)) are shown in Fig. 6.16 (b) where we can observe that since there is no penalty on other state variables due the special structure of the Q matrix, the other state variables except x1 may go very large. Now, let us put some penalties on other states by re-defining that Q = diag(10, 2, 6, 2, 1). By the following MATLAB statements: >> Q=diag([10,2,6,2,1]); [K,P]=lqr(A,B,Q,R); Ac=A-B*K; step(ss(Ac,B,C,D))

6.2 Linear Quadratic Optimal Control

211

the step response of the system under the newly designed LQR is obtained as shown in Fig. 6.17 (a) where we can see that the output response speed is significantly re0.4

0.3

0.35

0.25

0.3

Amplitude

0.35

x3(t)

x2(t)

0.25

0.2

0.2

0.15

0.15 0.1

x4(t)

0.1 0.05 0

0

x5(t)

0.05 1

2

3 4 Time (secs)

5

6

7

0

0

(a) with a new Q

1

2

3

4

5

6

7

(b) other states

Fig. 6.17. Step responses of closed-loop systems duced. However, from the step responses of other states obtained using the following MATLAB statements: >> [y,t,x]=step(ss(Ac,B,C,D)); plot(t,x(:,2:5)) as shown in Fig. 6.17 (b), the amplitudes of other states except x1 are significantly reduced accordingly due to the new weighting matrix Q.

This leaves us a question: How to decide a reasonable Q? This will be briefly discussed in the next subsection. 6.2.3 Weighting Matrices Selections It can be seen from the previous subsection that the performance of the LQR system is heavily dependent upon the selection of the weighting matrices. So, more precisely, we should say that LQR is optimal with respect to the weighting matrices Q and R. Since the optimality is in fact subjected to the selected weighting matrices, an LQR which is optimal with one choice of Q and R may not be optimal with other choices of Q and R matrices. What the “optimal choice” of Q and R is for LQ optimal regulators has been a focused research topic for decades. The answer so far for this question is still a “depends’, that is, it depends on what the “optimal choice” means and in terms of what. In this subsection, we shall briefly address the weighting matrix selection issue. In SISO cases, since the matrix R is a non-zero scalar, we can fix it to unity and adjust the matrix Q only. In this case, the original optimal control performance index in (6.14) can be equivalently represented as

212

6. Model Based Controller Design

 1 J S 1 tf  T Q x (t) x(t) + uT (t)u(t) dt = xT (tf ) x(tf ) + R 2 R 2 t0 R  1 T 1 tf  T = x (tf )S1 x(tf ) + x (t)Q1 x(t) + u2 (t) dt 2 2 t0

(6.21)

where S1 = S/R and Q1 = Q/R. In the sequel, for simplicity, we will replace Q1 and S1 with Q and S, respectively. Several commonly used strategies for weighting matrix selection are summarized[24] below: Cheap control. The term “cheap control” here means that the control efforts are inexpensive and one can use whatever large control signals to ensure the dynamic behavior of the system. In this case, the weight on u(t) can be made very small, i.e., R is very small. Equivalently, under R = 1, the weight on x(t), i.e., Q, should be very large. Usually, we use a single tuning knob ρ  = ρQ. The effect of a cheap control LQR design is demonstrated such that Q through an example below. Example 6.2.2. Consider the plant model in Example 6.2.1. Let Q = ρ diag(10, 20 , 6, 2, 5). For different values of ρ, the LQ optimal controllers can be designed using the following MATLAB statements: >> A=[-0.2,0.5,0,0,0;0,-0.5,1.6,0,0;0,0,-14.3,85.8,0; 0,0,0,-33.3,100;0,0,0,0,-10]; B=[0; 0; 0; 0; 30]; Q=diag([10,20,6,2,5]); R=1; C=[1,0,0,0,0]; D=0; for rho=[1,10,100,100,10000] [K,P]=lqr(A,B,rho*Q,R); Ac=A-B*K; step(ss(Ac,B,C,D)); hold on end and the closed-loop step responses are shown in Fig. 6.18. 0.3 ρ=1

Amplitude

0.25 0.2 0.15

ρ=10

0.1 0.05 0

0

ρ=100 2

4

6 8 Time (secs)

ρ=1000,10000 10 12 14

Fig. 6.18. Step responses of closed-loop systems

6.2 Linear Quadratic Optimal Control

213

It can be seen that when ρ increases, which means that the penalty on the states are increased, the magnitudes of the state responses are significantly reduced which in turn make the output signal smaller.

Expensive control. In contrast to the cheap control strategy, with an expensive control strategy, the control cost is assumed to be quite large. Therefore, the control signal u(t) should be made as small as possible. In this case, a large R should be used. With R = 1, equivalently, Q should be very small. Similarly, Q should be replaced by ρQ with ρ very small. Terminal control. By “terminal control”, it means that in the dynamic optimal control problem, the weighting matrix S tends to infinity which forces the terminal states to zero. A simple solution is to replace S by ρS and send ρ to ∞ or a very large number. In this case, we can set Q = 0 to reduce the Riccati differential equation to the following form: −P˙ = AT P + P A − P BR−1 B T P , where P (tf ) = ρS.

(6.22)

Degree-of-stability design. In controller design, it is desirable that all the closed-loop poles locate on the left hand side of s = −α on the s-plane, where α > 0. This is commonly referred to as the “degree of stability of −α”. To achieve this, a new performance index for LQR problems can be defined as ∞ J= e2αt (xT Qx + u2 )dt (6.23) 0

where Q is a constant matrix. By introducing a new state variable vector ξ(t) such that ξ(t) = eαt x(t) and a new control v(t) = eαt u(t), the original state space equation can be written as ξ˙ = (A + αI)ξ + Bv. Then, (6.23) becomes ∞ [ξ T (t)Qξ(t) + v 2 (t)]dt.

J=

(6.24)

0

The modified algebraic Riccati equation becomes

(A + αI)T P + P (A + αI) + Q − P BB T P = 0

(6.25)

with the optimal control law u∗ (t) = −B T P x(t). Example 6.2.3. Consider again the plant model in Example 6.2.1. Set Q = diag(10, 20, 6, 2, 5). The closed-loop poles achieved under the normal LQR control strategy can be obtained using the following MATLAB statements: >> A=[-0.2,0.5,0,0,0;0,-0.5,1.6,0,0;0,0,-14.3,85.8,0; 0,0,0,-33.3,100;0,0,0,0,-10]; B=[0; 0; 0; 0; 30]; Q=diag([10,20,6,2,5]); R=1; C=[1,0,0,0,0]; D=0; [K,P]=lqr(A,B,Q,R); eig(A-B*K) ans = -92.5275

214

6. Model Based Controller Design -52.5576 +63.9570i -52.5576 -63.9570i -2.9264 -0.4046

It can be seen that there is one pole at s = −0.4 which is pretty close to the imaginary axis indicating that this mode is oscillatory. If we want all the closedloop poles of the system on the left hand side of s = −1 line, the following MATLAB commands can be used to achieve this: >> [K2,P2]=lqr(A+eye(size(A)),B,Q,R); eig(A-B*K2) ans = -93.3510 -53.4023 +64.1404i -53.4023 -64.1404i -3.9272 -1.8793 Clearly, by the “degree-of-stability design” of LQR, all the closed-loop poles have been moved to the left hand side of s = −1. To appreciate the benefit, the step responses and Bode diagrams of the closed-loop system before and after using the “degree-of-stability design” are compared in Figs. 6.19 (a) and (b), respectively by 0.3

0 -50

0.25

-100

-200 -2 10

0.15 0.1

LQ control of α=1

0.05 0

0

2

4

6

8

degree of α=1

-150

normal LQ control

0.2

normal LQ control

10

12

-100 -200 -300 -400 -500 -2 10

(a) step responses

10-1

100

101

102

103

degree of α=1 normal LQ control

10-1

100

101

102

103

(b) Bode diagrams

Fig. 6.19. Responses of the closed-loop systems the following MATLAB statements: >> [y,t,x]=step(ss(A-B*K,B,C,D)); y1=step(ss(A-B*K2,B,C,D),t); [m,p,w]=bode(ss(A-B*K,B,C,D)); [m1,p1]=bode(ss(A-B*K2,B,C,D),w); plot(t,y,’-’,t,y1,’:’), figure, subplot(211), semilogx(w,20*log10(m(:)),’-’,w,20*log10(m1(:)),’:’) subplot(212),semilogx(w,p(:),’-’,w,p1(:),’:’)

6.2.4 Observers and Observer Design In LQR design, we have explicitly assumed that 1) the plant model is perfectly known, and 2) all the states are directly measurable. If the assumption

6.2 Linear Quadratic Optimal Control

215

1) is not true, that is, the model contains uncertainty, we shall use robust control design framework, which is the subject of Chapter 8. In this section, we shall focus on the case when the assumption 2) is not true. Actually, in practice, the state variables are usually not all measurable. If only the output signal rather than the states is measurable, which is often the case in many applications, can we still use LQR? The answer is “yes” if we can design an observer to observe the states from the input and output information. Of course, the system has to be observable. One obvious method is to create an extra copy of the state space model of the original plant model (A, B, C, D). When these two plants are subjected to the same input signal, the state variables can be created or “observed” from the input signal alone. These states should be exactly the same as the states of the original model. This intuitively simple “open-loop” method for state observation is feasible only when the model is exact. However, when there exist some disturbances or the parameters of the original model are not exactly known, the created or “copied” system will fail to give a correct state observation for the original system. Therefore, in practical applications, the effect of the output signal should also be used, together with the input signal, and the idea is similar to what is used in the usual feedback control. The typical control structure of a state observer is shown in Fig. 6.20. If u(t)

y(t)

✲ plant model G(s)





H ✛

✲ D ✲ B

✲ ✲ ❄✲ ✻

A ✛

✲ C

✻ ✻

ˆ state estimate x(t)



Fig. 6.20. A typical structure of state observers

(A, C) is fully observable, the mathematical description of the state observer can be expressed by the following state space model: ˆ˙ = Ax ˆ + Bu − H(C x ˆ + Du − y) x

ˆ + (B − HD)u + Hy = (A − HC)x

(6.26)

ˆ where x(t) is the observation or estimation of the true state x(t), H is a column vector called the observer gain vector, which is selected to make (A − HC) stable. From (6.26), it can be further derived that

216

6. Model Based Controller Design

ˆ˙ − x˙ = (A − HC)x ˆ + Bu + Hy − Ax − Bu x ˆ − x) = (A − HC)(x

(6.27)

which has an analytical solution ˆ 0 ) − x(t0 )]. ˆ − x(t) = e(A−HC)(t−t0 ) [x(t x(t)

(6.28)

ˆ Since (A − HC) is stable, lim [x(t) − x(t)] = 0, which means that the t→∞

ˆ observed state x(t) converges to the true state x(t) asymptotically. A MATLAB function simobsv(), listed in Appendix C, can be used to obtain the observed states of the system. The syntax of the function is >> [xh,x,t]=simobsv(G,H); where G is an LTI object of the system model, H is the observer gain vector. The step responses of the observed or the reconstructed states are returned in matrix xh and the original state vector is returned in x. The time vector is returned in t, which is determined automatically by the function. Example 6.2.4. Consider the following state space model: x˙ =



−3.6994 0.6627 −2.3879

0.6627 −1.4220 0.4994

   0 −2.3879 0 0.4994 x + u −0.0449 −3.2736

y = [−0.7989, −0.7652, 0.8617]x.

Design an observer with the observer gain H1T = [−12.6270, −1.0468, −4.0212], the eigenvalues of the observer are obtained using the following MATLAB statements: >> A=[-3.6994,0.6627,-2.3879;0.6627,-1.4220,0.4994; -2.3879,0.4994,-3.2736]; B=[0; 0; -0.0449]; C=[ -0.7989,-0.7652,0.8617]; D=0; H1=[-29.9482; 7.2402; -27.2489]; eig(A-H1*C) ans = -0.9819 -1.1305 -1.1877 >> [xh,x,t]=simobsv(ss(A,B,C,D),H1); plot(t,x,’-’,t,xh,’:’) and the step responses of the true states and its observations are compared in Fig. 6.21 (a). If the observer gain is changed to H2T = [−650.74, 2173.52, 1355.35], a different set of observer poles are shown as follows: >> H2=[-650.74; 2173.52; 1355.35]; eig(A-H2*C) ans = -11.9613 -11.0561 -9.9814 >> [xh,x,t]=simobsv(ss(A,B,C,D),H2); plot(t,x,’-’,t,xh,’:’)

6.2 Linear Quadratic Optimal Control

0.02

0.02

0.015

0.015

0.01

0.01

x1(t) ^x (t) 1

0.005

-0.01

-0.01 -0.015

x3(t)

-0.03 0

-0.02

^x (t) 3

-0.025 0.5

1

x2(t)

-0.005

-0.015 -0.02

x1(t)

0

x2(t)

-0.005

^x (t) 1

0.005

^x (t) 2

0

217

^x (t) 2

^x (t) 3

x3(t)

-0.025 1.5

2

2.5

3

3.5

4

4.5

5

-0.03 0

(a) with gain H1

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

(b) with gain H2

Fig. 6.21. Step responses of state observers

The corresponding step responses are compared in Fig. 6.21 (b). Clearly, a different choice of the observer gain will lead to a different transient behavior of the observer dynamics. It is generally true that the further away the closed-loop poles go from the imaginary axis, the quicker the transient responses vanish with time. If the state space model of the system is not exactly known, for instance, a1,1 , the actual first element of A matrix, is reduced by 5% and the perturbed matrix A is denoted by A1 , i.e., the output used in the observer is from the perturbed model (A1 , B, C, D) while the observer gain matrix H is designed based on the nominal model (A, B, C, D). To see the effect of this kind of model mismatch, we use the following MATLAB statements: >> A1=A; A1(1,1)=0.95*A(1,1); [y,t,x]=step(ss(A1,B,C,D)); [y1,t,xh1]=step(ss((A-H1*C),(B-H1*D),C,D),t); [y2,t,xh2]=lsim(ss((A-H1*C),H1,C,D),y,t); xh=xh1+xh2; plot(t,x,’-’,t,xh,’:’) to plot the true states and the reconstructed states as compared in Fig. 6.22 (a) where the observer gain matrix H1 is used. We can observe that the initial estimates of the states are almost exact. However, when the time increases, the estimated states will go far away from the actual states. It can be concluded from this example that the state observer designed here is largely dependent upon the accuracy of the nominal model of the system. If the nominal model is not exact, the states ˆ = 0, since the conditions reconstructed may not have the properties lim [x(t)−x(t)] t→∞

in (6.2.4) are no longer satisfied. With H2 , the responses of the observer can be obtained using the following MATLAB statements: >> [y1,t,xh1]=step(ss(A-H2*C,B-H2*D,C,D),t); [y2,t,xh2]=lsim(ss(A-H2*C,H2,C,D),y,t); xh=xh1+xh2; plot(t,x,’-’,t,xh,’:’)

218

6. Model Based Controller Design

0.02

0.3

x1(t)

0.25 ^x (t) 1

0.01

0.2

0

x^2(t)

0.15

x2(t)

x^3(t)

0.1 ^x (t) 2

-0.01

x1(t)

0.05 0

-0.02

-0.1

-0.03 -0.04 0

^x (t) 3 0.5

1

1.5

2

2.5

x2(t)

-0.05

x3(t)

x3(t)

x^1(t)

-0.15 3

3.5

(a) with H1

4

4.5

5

-0.2 0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

(b) with H2

Fig. 6.22. Step responses of state observers with model errors

and the states, together with the reconstructed states, are obtained as shown in Fig. 6.22 (b). In this case, it can be seen that when the poles of the observer moves further away from the imaginary axis, the reconstructed states are even worse. Obviously, in this model mismatching case, the observer using the gain H1 may be less sensitive to the model mismatch than the one using the gain matrix H2 . Note that as observed from Fig. 6.21, the observer using the gain H1 converges slower than the one using H2 . This prompts us a fact that, a quick response of observer as in the case of using the observer gain H2 is at the expense of being more sensitive to the uncertainties and disturbances.

Example 6.2.5. Consider an unstable state space model x˙ =



1 4 7

2 5 8

   3 0 6 x + 0 u, y = [1, 2, 3]x. 0 1

An observer with the gain matrix H T = [1.2222; 2.4786; 1.9402], which makes A − H C stable, can be designed by the following MATLAB scripts: >> A=[1,2,3; 4,5,6; 7,8,0]; B=[0; 0; 1]; C=[1,2,3]; D=0; H=[1.2222; 2.4786; 1.9402]; [xh,x,t]=simobsv(ss(A,B,C,D),H); plot(t,x,’-’,t,xh,’:’); figure; e=x-xh; plot(t,e(:,1),’-’,t,e(:,2),’--’,t,e(:,3),’:’) The step responses of the true states and the observed ones are compared in Fig. 6.23 (a), with the observer error signals shown in Fig. 6.23 (b). It is concluded that even if the original model is unstable, the designed state observer can still reconstruct the states of the system satisfactorily, provided that a suitable observer gain vector is designed. Of course, the original system, although unstable, has to be fully observable.

6.2 Linear Quadratic Optimal Control

14

0.06

12

0.05

10

^x (t) 2 x2(t)

8

0.02

0.1

0.2

0.3

^x (t)-x (t) 1 1

0.01

2 0

^x (t)-x (t) 3 3

0.03

^x (t) 1 x1(t)

4

^x (t)-x (t) 2 2

0.04

^x (t) 3 x3(t)

6

0

219

0.4

0.5

0

0

(a) states and reconstructed states

0.1

0.2

0.3

0.4

0.5

(b) state errors with observers

Fig. 6.23. State observers of unstable models

6.2.5 State Feedback and Observer-based Controllers Having designed a suitable state observer, the state feedback control strategy with observers can be implemented as shown in Fig. 6.24. r(t) + ✲

u(t)✲

-✻

u(t)

y(t) ✲

G(s)

state ✛xˆ feedback K

state ✛ observer ✛

Fig. 6.24. Feedback control with a state observer

Consider the feedback structure shown in Fig. 6.20 (a). The feedback signal K x ˆ(t) can be rewritten, using (6.26), into two subsystems G1 (s) and G2 (s), driven alone by u(t) and y(t) respectively. Therefore, G1 (s) can be described by ˆ˙ 1 (t) = (A − HC)x ˆ 1 (t) + (B − HD)u(t), y1 = K x ˆ 1 (t) x

(6.29)

and G2 (s) by ˆ˙ 2 (t) = (A − HC)x ˆ 2 (t) + Hy(t), y2 = K x ˆ 2 (t). x

(6.30)

The block diagram for the closed-loop system can be represented in Fig. 6.25 (a). From Fig. 6.25 (a), with some block manipulations, the closed-loop system can be equivalently expressed as shown in Fig. 6.25 (b) with Gc (s) = 1/[1 + G1 (s)] and H(s) = G2 (s), which agrees well with the typical feedback

220

6. Model Based Controller Design

r✲

u✲

❖ ✻

G(s)

G1 (s) ✛

✲y

r✲



✲ Gc (s)

✲ G(s)

y ✲

H(s) ✛

G2 (s) ✛

(b)

(a)

Fig. 6.25. Observer based state feedback control

control system structure. The controller Gc (s) can be further derived in the following form: Gc (s) = 1 − K(sI − A + BK + HC)−1 B with its state space realization

A − BK − HC Gc (s) = −K

B 1



.

(6.31)

(6.32)

If the reference input r(t) = 0, Gc (s) can be further simplified into the following state space representation:

A − BK − HC + HDK H Gc (s) = . (6.33) K 0 The above simplified form, with r(t) = 0 and a unity negative feedback, will be used throughout the book unless otherwise stated. The lumped controller Gc (s) in (6.33) is often referred to as the observer-based controller, since the structure information of the observer is implicitly reflected within the controller. The observer-based controller can also be obtained using the MATLAB function reg() provided in the Control Systems Toolbox with the following syntax: >> [Ac,Bc,Cc,Dc]=reg(A,B,C,D,K,H) where (A, B, C, D) is the state space model of the plant, and (K, H) are the state feedback gain vector K and the observer gain vector H, respectively. The returned (Ac, Bc, Cc, Dc) is the state space model of the observer-based controller Gc (s). In fact, reg() is an immediate implementation of (6.33). Example 6.2.6. Consider the LQ optimal control problem in Example 6.2.1. If the weighting matrix Q is selected as Q = diag([1, 0, 0, 0, 0]) with R = 1 and if an observer gain vector is selected as H = [−8.3, 979.24, −19367.61, 4293.85, 0]T , with the following MATLAB statements: >> A=[-0.2,0.5,0,0,0;0,-0.5,1.6,0,0;0,0,-14.3,85.8,0; 0,0,0,-33.3,100;0,0,0,0,-10];

6.2 Linear Quadratic Optimal Control

221

B=[0; 0; 0; 0; 30]; Q=diag([1,0,0,0,0]); R=1; C=[1,0,0,0,0]; D=0; G=ss(A,B,C,D); [K,P]=lqr(A,B,Q,R); H=[-8.3, 979.24, -19367.61, 4293.85, 0]’; Gc=-reg(ss(A,B,C,D),K,H); zpk(Gc) Zero/pole/gain: 11.4839 (s+33.34) (s+14.3) (s+10) (s+1.792) ----------------------------------------------------(s+20.92) (s^2 + 30.19s + 328.1) (s^2 + 6.845s + 120) we can get the controller Gc (s) which is a stable minimum phase model. To check the time-domain performance of the observer based control, let us apply the following MATLAB statements: >> GG1=feedback(G*Gc,1); GG=ss(A-B*K,B,C,D); G1=ss(A-B*K-H*C,B,-K,1); G2=ss(A-H*C,H,K,0); GG2=feedback(G*G1,G2); step(GG,GG1,GG2,2) to get the closed-loop step response of the system under the above designed controller as shown in Fig. 6.26 (a). For comparison, in Fig. 6.26 (a), the step response

1.6 1.4

1.4 with observer-based controller

with observer-based regulator

1.2 1 Amplitude

Amplitude

1.2 1 0.8

with direct state feedback and observer-based controller

0.8 with direct state feedback

0.6

0.6 0.4

0.4

0.2

0.2 0

0

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Time (secs)

(a) LQ controller comparison

2

0

0

0.5

1

1.5 2 Time (secs)

2.5

3

(b) with another H

Fig. 6.26. Step responses of LQ optimal control under the direct state feedback, i.e., all states are measurable, is also plotted. It can be observed that the response under the observer-based controller is exactly the same as the one under the direct state feedback control. The closed-loop step responses for the observer-based regulator is not the same as those responses. It is worth mentioning that it is not fair to compare it with the direct state feedback, since in deriving the regulator, we has assumed that the external input signal r(t) = 0. Let us continue the example with an adjusted observer gain vector H = [441.7, 146689.24, 6670765.515, 2866690.238, 860270.98]T . To design the new observer-based controller, the following MATLAB statements can be issued:

222

6. Model Based Controller Design >> H=[441.7,146689.24,6670765.515,2866690.238,860270.98]’; G=ss(A,B,C,D); Gc=-reg(G,K,H); zpk(Gc) Zero/pole/gain: 464353.6388 (s+33.3) (s+14.48) (s+8.953) (s+4.973) ---------------------------------------------------------(s+157.4) (s^2 + 104.3s + 5008) (s^2 + 246.2s + 1.814e004) >> G_c=feedback(G*Gc,1); step(ss(A-B*K,B,C,D),G_c,3)

The step response comparison is shown in Fig. 6.26 (b). It can be seen that the performance of the observer-based controller depends on the observer gain vector H and, of course, the state feedback gain vector K.

6.3 Pole Placement Design The dynamic behavior of the controlled system is determined by its closedloop pole positions. If the system is fully controllable, the poles of the closedloop system can be arbitrarily shifted to the pre-specified positions. Given the desired pole positions and the system model, how to design the controller to shift the original system poles to the desired positions is the major topic of this section. This is referred to as the pole placement controller design method. 6.3.1 Pole Placement Algorithms Consider the state space model of the system given by x˙ = Ax + Bu, y = Cx

(6.34)

where (A, B, C) matrices have compatible dimensions. The state feedback is used with a constant gain matrix K. Denote r the external reference input of the system. Then, the actual control signal applied to the system is that u = r − Kx. The closed-loop state space model can be written as x˙ = (A − BK)x + Br, y = Cx.

(6.35)

From Theorem 3.2.1, if the given system is fully controllable, the closedloop poles of the system can arbitrarily be assigned through a static state feedback. In what follows, some of the commonly used pole placement algorithms are introduced. Bass-Gura’s algorithm. Assume that the desired closed-loop poles of the system are µi , i = 1, · · · , n. Clearly, the closed-loop characteristic equation α(s) is simply α(s) =

n 

(s − µi ) = sn + α1 sn−1 + α2 sn−2 + · · · + αn−1 s + αn .

i=1

(6.36)

6.3 Pole Placement Design

223

Denote a(s) the open-loop characteristic equation of the original plant model which is written as a(s) = det(sI − A) = sn + a1 sn−1 + a2 sn−2 + · · · + an−1 s + an .

(6.37)

If the original system is fully controllable, the state feedback gain vector K can be obtained from  −1 (6.38) K = [α − a]T L−1 C

where

[a − α]T = [(a1 − α1 ), · · · , (an − αn )], and

a

n−1

 an−2  . L=  ..  a1 1

an−2 an−3 .. . 1

··· ··· .. .

 = [B, AB, · · · , An−1 B], C a1 1

1   .  

(6.39)

It can be seen that L is a non-singular Hankel matrix. A MATLAB implementation of the above pole placement algorithm is given in bass pp() listed in Appendix C. The syntax of bass pp() is >> K=bass pp(A,B,P) where (A, B) is the state space model, P is a vector containing the expected pole positions. The returned variable K is the state feedback gain vector. Ackerman algorithm. The pole placement problem can alternatively be solved in a slightly different way known as the Ackerman algorithm. The state feedback gain vector K is given by the following formula:  −1 α K = −[0, 0, · · · , 0, 1]C

(6.40)

where αT = [α0 , α1 , · · · , αn−1 ]. A MATLAB function acker(), provided in the Control Systems Toolbox, implements the above algorithm with its syntax the same as that of bass pp(). Numerically robust pole placement algorithm. It has been found that the above two pole placement algorithms may not be numerically robust. A MATLAB function place() is provided in the Control Systems Toolbox which can be used to find the feedback matrix K using a numerically robust pole placement algorithm [42]. The syntax is as follows: >> K=place(A,B,P) where (A, B) is the state space model, P is a vector containing the expected pole positions. The returned variable K is the state feedback gain vector. It should be pointed out that the place() function can be used to deal with MIMO pole placement problems. However, in place(), the expected

224

6. Model Based Controller Design

pole positions have to be distinct, that is, the multiplicity of any desired pole cannot be greater than 1. On the other hand, acker(), although it cannot handle the MIMO pole placement problem, can be used for pole placement with desired poles of any multiplicity. Example 6.3.1. Given plant model 

0 0 x˙ =  0 0

1 0 0 0

0 −1 0 11

   0 0 0  1  x+ u, y = [1, 2, 3, 4]x, 1 0  0 −1

design a state feedback controller to place the closed-loop poles at s1,2,3,4 = −1, −2, −1 ± j1. To design the K for pole placement, the following MATLAB statements can be used: >> A=[0,1,0,0; 0,0,-1,0; 0,0,0,1; 0,0,11,0]; B=[0;1;0;-1]; eig(A)’ ans = 0 0 3.3166 -3.3166 >> P=[-1; -2; -1+sqrt(-1); -1-sqrt(-1)]; K=place(A,B,P) K = -0.4000 -1.0000 -21.4000 -6.0000 >> eig(A-B*K)’ ans = -2.0000 -1.0000 - 1.0000i -1.0000 + 1.0000i -1.0000 It can be seen that the poles of the original system are at 0, 0, 3.3166, −3.3166 indicating that the original system is unstable. Since the original system is fully controllable, via the pole placement technique, we are able to place the poles of the closed-loop system to the desired positions which actually stabilize the system with a desirable behavior as well.

Example 6.3.2. Consider again the fourth-order system in Example 3.2.5. To assign the poles of the closed-loop system to s1,2,3,4 = −1, −2, −1 ± j1, the following MATLAB statements can be applied: >> A=[-5,8,0,0; -4,7,0,0; 0,0,0,4; 0,0,-2,6]; B=[4; -2; 2; 1]; C=[2,-2,-2,2]; D=0; P=[-1; -2; -1+sqrt(-1); -1-sqrt(-1)]; K=place(A,B,P) ??? Error using ==> place Can’t place eigenvalues there It can be seen that the closed-loop poles cannot be assigned to the pre-specified positions. Recall the conclusions drawn in Example 3.2.5. The original system is actually not fully controllable. Therefore, the poles of the closed-loop system cannot be assigned freely.

6.3 Pole Placement Design

225

6.3.2 Partial Pole Placement If the system is not fully controllable, it has been shown through an example that the poles of the closed-loop system cannot be assigned freely using the standard functions provided in MATLAB. In this case, it is natural to consider to assign some of the poles to the pre-specified positions, while keep others poles untouched. This method is referred to as the partial pole placement. To illustrate the partial pole placement method, an example is presented below. Example 6.3.3. Consider the system model given by 

0 0 x˙ =  0 0

1 5 0 0

0 0 −7 0

   0 0 0  1 x +   u, y = [1, 2, 3, 4]x. 0  0 −8 1

First, use the following MATLAB statements:

>> A=[0,1,0,0; 0,5,0,0; 0,0,-7,0; 0,0,0,-8]; B=[0; 1; 0; 1]; C=[1,2,3,4]; D=0; p=eig(A)’ p = 0 5 -7 -8 to display the poles of the original system. Now, let us try to place the unstable poles s = 0 and s = 5 to other places, say, sˆ = −1 and sˆ = −2 and leave the stable poles at s = −7 and s = −8 untouched. Clearly, this is a partial pole placement problem. The following MATLAB statements can be applied: >> p1=p; p1(1:2)=[-1,-2]; K1=place(A,B,p1) place: ndigits= 16 K1 = 2.0000 8.0000 0 0 >> eig(A-B*K1)’ ans = -8.0000 -2.0000 -1.0000 -7.0000 Clearly, the poles originally located at s = 0, 5 have been placed to sˆ = −1, −2 as desired, while the other two poles remain unchanged. The designed state feedback gain vector is returned in K. Now, let us try to place the original three poles s = 0, 5, −7 to sˆ = −1, −2, −3. Using the following MATLAB statements: >> p2=p; p1(1:3)=[-1,-2,-3]; K2=place(A,B,p2) place: ndigits= 15 K2 = 1.0e-014 * 0.5468 -0.1250 0 0 >> eig(A-B*K2)’ ans = -8.0000 5.0000 0.0000 -7.0000

226

6. Model Based Controller Design

we can immediately note that the original pole positions are almost unchanged. This is not surprising since K2 obtained is almost a zero vector, which is in fact a wrong solution. Let us check the controllable/uncontrollable subspaces using the following MATLAB statements: >> [Ab,Bb,Cb]=ctrbf(A,B,C); Ab, Bb Ab = -7.0000 0 0 0 0 -0.0936 0.8601 0.0000 0 0.1530 -1.4064 6.5383 0 -0.7030 6.4619 -1.5000 Bb = 0 0.0000 0.0000 1.4142 where it is clearly seen that the pole at s = −7 is in fact a stable but uncontrollable mode. This verifies that the uncontrollable mode cannot be placed to any other positions by any state feedback gain vector. We further repeat that if the uncontrollable mode happens to be unstable, it is not possible to use any state feedback to move this mode to the stable position. In other words, due to this mode, the system is not stabilizable no matter what feedback control law, linear or nonlinear, time invariant or time variant, is used.

6.3.3 Observer Design using Pole Placement Technique Using the pole placement techniques discussed in the above, we can design a state observer by assigning the observer poles to the pre-specified positions. Since the pole placement in observer design is simply a dual problem to the state feedback design, the same problem can be solved using the MATLAB function place() or acker(), as illustrated in the following example. Example 6.3.4. Consider the fourth-order system in Example 6.3.1. The desired poles of the observer are specified as s1,2,3,4 = −1, −2, −1 ± j1. To determine the observer gain matrix H , the following MATLAB statements can be applied: >> A=[0,1,0,0; 0,0,-1,0; 0,0,0,1; 0,0,11,0]; B=[0;1;0;-1]; C=[1,2,3,4]; P=[-1; -2; -1+sqrt(-1); -1-sqrt(-1)]; H=place(A’,C’,P)’ place: ndigits= 17 H = -0.2203 -0.4750 0.4238 1.2247 >> eig(A-H*C)’ ans = -1.0000 - 1.0000i -1.0000 + 1.0000i -1.0000 -2.0000

6.3 Pole Placement Design

227

where the matrix transpose operations on A and C should be noted.

Similarly, if the system is not fully observable, the poles of the observer cannot be assigned freely. In this case, the partial pole placement technique can be used. 6.3.4 Observer-based Controller Design Using Pole Placement We have discussed on controller and observer design using the pole placement technique. Clearly, the pole placement technique can be used to design the observer-based controller. This observer-based controller has been discussed in Sec. 6.2.5 for LQ optimal control problems. Under the typical feedback control system structure as shown in Fig. 6.25 (b), Gc (s) and H(s) can be represented by [(A − BK − HC), B, −K, 1], and [(A − HC), H, C, 0], respectively. With the reference r = 0, the observer-based regulator is then represented as

A − BK − HC + HDK H Gc (s) = (6.41) K 0 which can be obtained using the MATLAB function reg() provided in the Control Systems Toolbox. Example 6.3.5. Consider a plant model given by ˙ x(t) =



−0.3 1 −1.5

0.1 0.1 −8.9

   2 −0.05 0 x(t) + 0 u(t). 4 −0.05

Assume that the desired pole positions of the closed-loop system are −1, −2, −3, respectively. From the following MATLAB statements: >> A=[-0.3,0.1,-0.05; 1,0.1,0; -1.5,-8.9,-0.05]; B=[2; 0; 4]; C=[1,2,3]; D=0; P1=[-1,-2,-3]; Kp1=place(A,B,P1); step(ss(A-B*Kp1,B,C,D)); the step response of the output signal is obtained as shown in Fig. 6.27 (a). If all the expected poles are −1, with the following MATLAB statements: >> P2=[-1,-1,-1]; Kp2=place(A,B,P2); ??? Error using ==> place Can’t place poles with multiplicity greater than rank(B). it can be seen that for the desired poles with multiplicity greater than 1, place() fails to perform the pole placement. In this case, the function acker() should be used. Let us try the following MATLAB statements: >> Kp2=acker(A,B,P2); step(ss(A-B*Kp2,B,C,D));

6. Model Based Controller Design

2

10

0

0 -10

-2

Amplitude

Amplitude

228

-4 -6

-20 -30 -40

-8

-50

-10 0

0.5

1

1.5

2

2.5 3 3.5 Time (secs)

4

4.5

-60 0

5

(a) system poles at (−1, −2, −3)

5

10

15 20 Time (secs)

25

30

(b) system poles at (−1, −1, −1)

Fig. 6.27. Step responses of the compensated system with state feedback We can perform the pole placement successfully. The closed-loop response is shown in Fig. 6.27 (b) where it can be seen that, compared with Fig. 6.27 (b), the speed of response is reduced and the magnitude of the output is increased. Now, let us assume that the states are not directly measurable. We have to use the observer-based controller. To design an observer with its desired poles located at (−1, −2, −3), we can use the following MATLAB statements: >> P4=[-1,-2,-3]; Ko1=place(A’,C’,P4)’; Ac=A-B*Kp1-Ko1*C; Ah=A-Ko1*C; t=0:.1:20; G=ss(A,B,C,D); Gc=ss(Ac,Ko1,Kp1,0); G_c=feedback(G*Gc,1); step(G_c,t)

3.5

10

3

0

2.5

-10

2

Amplitude

Amplitude

with the closed-loop step response shown in Fig. 6.28 (a), which is completely

1.5 1

-30 -40

0.5

-50

0

-60

-0.5 -1

-20

0

2

4

6

8

10 12 14 Time (secs)

16

18

(a) observer poles at (−1, −2, −3)

20

-70 0

0.5

1

1.5

2

2.5 3 3.5 Time (secs)

4

4.5

5

(b) observer poles at (−100, −200, −150)

Fig. 6.28. Step responses of observed-based systems different to the one using the direct state feedback shown in Fig. 6.27 (a). Due to the observer dynamics, the expected system behavior under the direct state feedback may change significantly. In Chapter 8, we will further discuss this issue.

6.4 Model Following Control

229

Let us examine what will happen if the desired observer pole positions are chosen further left, e.g., (−100, −200, −150). By the following MATLAB statements: >> P5=[-100;-200;-150]; Ko2=place(A’,C’,P5)’; Ac=A-B*Kp1-Ko2*C; Ah=A-Ko2*C; t=0:.01:5; G=ss(A,B,C,D); Gc=ss(Ac,Ko2,Kp1,0); G_c=feedback(G*Gc,1); step(G_c,t) the step response of the closed-loop system is shown in Fig. 6.28 (b) which is very different to what is shown in Fig. 6.28 (a). We remark that the desired observer poles should be chosen wisely. A systematic design framework will be discussed in Chapter 8.

6.4 Model Following Control In this section, we will introduce an intuitively simple model-based controller design technique which is still widely used in practice. The basic idea is that, given a plant model and the desired close-loop transfer function, the controller can actually be directly computed. In the next subsection, we will first specify what “the desired close-loop transfer function” should be. 6.4.1 Standard Model Formats with Different Criteria The optimality of a control system can be defined in many different ways. For instance, the H2 - and the H∞ -norm measures are very useful in assessing the robustness of the control system. An old but useful time-domain measure is the integral of time-weighted absolute error (ITAE) criterion defined as ∞ t|e(t)|dt (6.42) J= 0

where e(t) is the error signal defined as e(t) = r(t) − y(t), r(t) is the reference input signal, y(t) is the actual output signal. A n-th order type-I system with the ITAE optimal criterion is defined in the following form: T (s) =

an . sn + a1 sn−1 + a2 sn−2 + · · · + an−1 s + an

(6.43)

The coefficients ai minimizing the ITAE criterion of the system T (s), have been pre-computed as summarized in Table 6.1. Similarly, the n-th order type-II system with the ITAE optimal criterion is defined as T (s) =

sn

+ a1

sn−1

an−1 s + an + a2 sn−2 + · · · + an−1 s + an

(6.44)

230

6. Model Based Controller Design Table 6.1. Standard models under ITAE criterion (type-I) denominator, with an+1 = ωnn

n overshoot ωn ts 1

s + ωn 2

2

4.6%

6.0

s +1.41ωn s+ωn2

3

2%

7.6

s3 +1.75ωn s2 +2.15ωn2 s+ωn3

4

1.9%

5.4

s4 +2.1ωn s3 +2.4ωn2 s2 +2.7ωn3 s+ωn4

5

2.1%

6.6

s5 +2.8ωn s4 +5.0ωn2 s3 +5.5ωn3 s2 +2.4ωn4 s+ωn5

6

5%

7.8

s6 +2.25ωn s5 +6.6ωn2 s4 +8.6ωn3 s3 +7.45ωn4 s2 +2.95ωn5 s+ωn6

Table 6.2. Standard models under ITAE criterion (type-II) n

overshoot

denominator, with a0 = ωnn

2

7%

s2 + 3.2ωn s + ωn2

3

35%

s3 + 1.75ωn s2 + 3.25ωn2 s + ωn3

4

36%

s4 + 2.41ωn s3 + 4.93ωn2 s2 + 5.14ωn3 s + ωn4

5

57%

s5 + 2.19ωn s4 + 6.5ωn2 s3 + 6.3ωn3 s2 + 5.24ωn4 s + ωn5

6

61%

s6 +6.12ωn s5 +13.42ωn2 s4 +17.16ωn3 s3 +14.14ωn4 s2 +6.76ωn5 s+ωn6

with the optimal coefficients ai listed in Table 6.2. For the type-II case, since there is an extra numerator term with coefficients dependent on the parameters of the denominator, which represents a zero in the closed-loop transfer function, the type-II system is more difficult to achieve compared with the type-I system. For type-I systems, the Butterworth standard transfer function with its coefficients shown in Table 6.3, is also very useful for controller design. A MATLAB function std tf(), listed in Appendix C, can be used to determine the standard transfer functions of different types and orders. The syntax is >> Gs=std tf(id,wn,n) where id is the criterion identifier with id=1 for the ITAE type-I model, id=2 for the ITAE type-II model, and id=3 for the Butterworth model. wn is the natural frequency ωn , and n is the expected order of the standard transfer function returned in the transfer function object Gs. The step responses of type-I and type-II systems with optimal ITAE criteria for different orders are shown in Fig. 6.29 (a), with the following MATLAB statements: >> t=0:0.2:15; y=[];

6.4 Model Following Control

231

Table 6.3. Butterworth suggestions for type I systems denominator, with an+1 = ωnn

n overshoot ωn ts 1

s + ωn

2

4.6%

6.0

3

8.12%

8

4

11.14%

10

5

12.64%

11

6

14.31%

1.6 1.4

s2 + 1.4ωn s + ωn2 s3 + 2.0ωn s2 + 2.0ωn2 s + ωn3 4

s + 2.6ωn s3 + 3.4ωn2 s2 + 2.6ωn3 s + ωn4 s5 + 3.24ωn s4 + 5.24ωn2 s3 + 5.24ωn3 s2 + 3.24ωn4 s + ωn5 6

s +3.86ωn s5 +7.46ωn2 s4 +9.13ωn3 s3 +7.46ωn4 s2 +3.86ωn5 s+ωn6

14

1.2

II, n=5

y(t) II, n=4 II, n=3

II, n=6

y(t)

1

1.2 II, n=2

0.8

1

n=1

0.8 0.6 0.4 0.2 0

0

0.6

type I, n=1 I, n=2 I, n=3 I, n=4 I, n=5 I, n=6 2

4

6

n=2 n=3

0.4

n=4 0.2 ωnt 8

10

(a) type I & II ITAE systems

n=5 ωn t

n=6 12

0

0

5

10

15

(b) Butterworth systems

Fig. 6.29. Step responses of standard systems

for i=1:6, Gs=std_tf(1,1,i); y=[y,step(Gs,t)]; end for i=2:6, Gs=std_tf(2,1,i); y=[y,step(Gs,t)]; end plot(t,y) The step responses of the Butterworth standard systems are shown in Fig. 6.29 (b), using the following MATLAB statements: >> t=0:0.2:15; y2=[]; for i=1:6, Gs=std_tf(3,1,i); y2=[y2,step(Gs,t)]; end plot(t,y2) It can be seen that the overshoot of a Butterworth system is slightly larger than that of the optimal ITAE criteria for type-I system when n is large. 6.4.2 Model Following Controller Design Given transfer function model G(s), a straightforward design of the controller Gc (s) can be obtained such that the closed-loop transfer function is

232

6. Model Based Controller Design

close to some closed-loop transfer function T (s), also known as complementary sensitivity transfer function, which actually can be pre-decided according to an ITAE optimal standard model given in Table 6.1, Table 6.2, or Table 6.3. More specifically, the controller Gc (s) can be simply designed as follows: Gc (s)G(s) = T (s), 1 + Gc (s)G(s)

⇒ Gc (s) =

T (s) [1 − T (s)]G(s)

(6.45)

where 1/G(s), the inverse of plant model G(s), is used in (6.45). It can further be seen that the transfer function T (s)/[1 − T (s)] is of the order 1/k, if a k-th order T (s) is selected. If G(s) is of the order n/m, to make the Gc (s) physically realizable, k has to be greater than n − m. Example 6.4.1. Consider a transfer function model G(s) =

100 . (s + 1)(s2 + 0.2s + 1)

Clearly, the standard optimal closed-loop model should be selected as a third-order transfer function from Table 6.1. Let us further specify that the natural frequency is ωn = 30 rad./sec. Thus, T (s) can be constructed as T3 (s) =

s3

+ 1.75ωn

ωn3 27000 = 3 . + 2.15ωn2 s + ωn3 s + 52.5s2 + 1935s + 27000

s2

The controller Gc (s) can be designed using the following MATLAB statements: >> G=tf(100,conv([1,1],[1,0.2,1])); wn=30; Gs=std_tf(1,wn,3); Gc=inv(G)*feedback(Gs,1,1); zpk(Gc) Zero/pole/gain: 270 (s+1) (s^2 + 0.2s + 1) -------------------------s (s^2 + 52.5s + 1935) >> G_c=feedback(G*Gc,1); step(G_c) with the closed-loop step response shown in Fig. 6.30 (a). Moreover, the Nichols charts of the original model together with the compensated system can be obtained using the following MATLAB statements: >> ngrid(’new’); nichols(G); nichols(G*Gc), axis([-360,0,-40,40]) and the results are compared in Fig. 6.30 (b) where it can be seen that the original closed-loop system is unstable while the compensated system is stable. The dynamic behavior of the compensated system is significantly improved. To appreciate the robustness of the designed controller, let us perturb the denominator of the plant model to (s + 1)(s2 + ρs + 1). The nominal plant model is the case when ρ = 0.2. Under the same controller designed using the nominal plant model, for ρ = 0.05, 0.1, 0.15, 0.2, 0.5 and 1, the corresponding closed-loop step responses can be obtained using the following MATLAB statements:

6.4 Model Following Control

1.2

233

40 0 db

Amplitude

1

30

0.25 db 0.5 db 1 db

20

0.8

-1 db

3 db 6 db

10

-3 db

0.6

0

-6 db

0.4

-10

-12 db original model

-20

-20 db

compensated model

0.2 -30

0

0

0.05

0.1

0.15 0.2 Time (secs)

0.25

0.3

0.35

-40 -360

(a) step response

-270

-180

-90

-40 db 0

(b) Nichols charts

Fig. 6.30. Time and frequency domain analysis of the compensated system >> t=0:0.01:1; f1=figure; f2=figure; ngrid(’new’); for r=[0.05,0.1,0.15,0.2,0.5,1] G.den{1}=conv([1,1],[1,r,1]); G_o=G*Gc; G_c=feedback(G_o,1); figure(f1); step(G_c,t); hold on; figure(f2); nichols(G_o); end figure(f2), axis([-360,0,-40,40]) as compared in Fig. 6.31 (a) and and the open-loop Nichols charts are compared

1.2 other ρ values

Amplitude

1 0.8

ρ=0.05

40

ρ=0.05

30

ρ=0.1 0.25 db 0.5 db 1 db

20

ρ=0.1

0.4

-1 db

3 db 6 db

10

0.6

0 db

-3 db

0

-6 db

-10

-12 db

-20

-20 db

0.2 -30

0

0

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Time (secs)

(a) step response

1

-40 -360

-270

-180

-90

-40 db 0

(b) Nichols charts

Fig. 6.31. System analysis under different ρ in Fig. 6.31 (b). We can observe that when ρ is small, the responses may not be as good as the nominal result. However, when ρ is larger, the responses and the Nichols charts of the system tend to be satisfactory. We can conclude that the closed-loop system “follows” the standard model system robustly. This controller is thus called the “model-following controller”.

At the first look, it seems that all the control problems can be solved easily using such a technique, provided that the optimal ITAE standard forms are

234

6. Model Based Controller Design

available for all the orders k. However, life is not as easy as this. In fact, there are several restrictions on this design methodology as briefly summarized below: • non-minimum phase plants: It can be seen directly from (6.45) that if the original plant model G(s) is non-minimum phase, the inverse of G(s) will contain unstable modes which will make Gc (s) unstable. Although the closed-loop transfer function is always stable due to the cancelation of the unstable pole in Gc (s) and nonminimum phase zero in G(s), we must be clear that this kind of pole-zero cancelation is always not permissible in practice. As we have discussed in Chapter 3, the overall system, though stable in input-output sense, will not be internally stable. Thus, the modelfollowing controller design algorithm can only be used for minimum phase plants. • unstable plants: Similarly, if the original plant model is unstable, there will be a pole-zero cancelation for the unstable mode. For the reason discussed in the above, clearly, the model-following controller design algorithm can only be used for stable plants. • high-order controllers: If the order of the plant model is high, it is inevitable that the order of the designed controller will also be high. However, sometimes, this high-order controller is not preferred in real-time implementations. Example 6.4.2. Consider a high-order plant model given by G(s) =

3s3 + 5s2 + 3s + 2 . (s2 + 3s + 2)(s2 + s + 3)(s2 + 0.4s + 1)

To make the controller implementable, the order of the standard system model should be higher than 3. Here, a fourth-order standard type-I ITAE model is selected. The model-following controller can be designed using the following MATLAB statements: >> num=[3,5,3,2]; den=conv([1,3,2],conv([1,1,3],[1,0.4,1])); G=tf(num,den); wn=30; Gs=std_tf(1,wn,4); Gc=inv(G)*feedback(Gs,1,1); zpk(Gc) Zero/pole/gain: 270000(s+1)(s+2)(s^2 + 0.4s + 1)(s^2 + s + 3) --------------------------------------------------------------s(s+35.04)(s+1.292)(s^2 + 0.3746s + 0.516)(s^2 + 27.96s + 2080) >> step(feedback(G*Gc,1)) with the obtained closed-loop step response shown in Fig. 6.32 (a), which is very satisfactory. Consider that the gain of the controller is changed by ρ times. In this case, we can draw the closed-loop step responses of the perturbed systems using the following MATLAB statements:

6.5 SISOTool — An Interactive Controller Design Tool

1.4

1.2

1.2

1

ρ=1.5 ρ=1.3 ρ=1.1

ρ=1.4 ρ=1.2

Amplitude

Amplitude

1 0.8 0.6 0.4

0

0.8

ρ=1, norminal ρ=0.9 ρ=0.8

0.6 0.4

0.2 0

235

0.2 0.05

0.1

0.15 0.2 Time (secs)

0.25

(a) step response

0.3

0.35

0

0

0.1

0.2 0.3 Time (secs)

0.4

0.5

(b) for different values of ρ

Fig. 6.32. System analysis with a high-order model-following controller

>> for KK=[0.8:0.1:1.5] Gc1=KK*Gc; G_c=feedback(G*Gc1,1); step(G_c); hold on end as shown in Fig. 6.32 (b). Clearly, the designed controller, though it is high order, has certain robustness. However, in some time-critical and memory-critical realtime applications, this high order control is not very preferred.

6.5 SISOTool — An Interactive Controller Design Tool SISOTool is an interactive controller design tool provided in the Control Systems Toolbox mainly for single input and single output systems. SISOTool is particularly useful for classroom use due to its nice GUI (graphical user interface). In SISOTool, the root locus based and Bode diagram based methods are implemented for model-based controller synthesis. We shall demonstrate the use of SISOTool through an example. Example 6.5.1. Consider the following open-loop plant model: G(s) =

1 . s(0.1s + 1)(0.02s + 1)(0.01s + 1)(0.005s + 1)

Firstly, let us enter this model into the workspace of MATLAB and then invoke the SISOTool program using the following MATLAB statements: >> G=tf(1,[convs([0.1 1],[0.02 1],[0.01,1],[0.005 1])]); sisotool(G) A user interface window appears as shown in Fig. 6.33 where the root locus and the Bode diagram for the plant model are displayed.

236

6. Model Based Controller Design

Fig. 6.33. The user interface of SISOTool

Within the SISOTool interface, a toolbar is provided for the interactive controller design with several utility icons. The left most icon in the toolbar is the “edit” mode. After the “edit” icon, there are 4 icons for the user to add, respectively, a real pole, a real zero, a pair of complex poles and a pair of complex zeros for the controller. An “eraser” icon is provided to remove the added zeros or poles. After the “eraser” icon, 4 other icons provide different zooming facilities. These buttons are useful for the user to design a controller. In what follows, with SISOTool, an interactive method for tuning a phase lead compensator is presented. According to Fig. 6.1 (b), it is seen that the phase lead controller should have a zero on the right of the pole. Then, we can use the corresponding icons to add the real zero and the real pole. It can be seen that the shape of the root locus and the Bode diagram will change automatically for the new system with a phase lead controller. Then, click the Analysis | Response to Step Command menu item to display the step response of the closed system in another window. For an interactive design, one should check the Real-Time Update box. For an effective interactive design, we can place the step response window side by side with the main interface. Furthermore, the zooming facilities can be applied to select an area on the root locus axis to get more information around the imaginary axis. The controller design task is simply by dragging the pole, zero and gain in the root locus plot until a satisfactory step response of the system is observed. An example design is shown in Fig. 6.34, with the designed controller C(s) = 0.642(0.13s + 1)/(0.059s + 1). The gain and phase

6.5 SISOTool — An Interactive Controller Design Tool

237

Fig. 6.34. With a designed controller

margin are also displayed in the Bode diagram. The step response obtained is shown in Fig. 6.35 which is fairly satisfactory with a small overshoot and a fast response speed.

Fig. 6.35. Step response of the compensated system

238

6. Model Based Controller Design

By interactively changing the positions of the zeros and poles, we have a much better understanding about the qualitative relationship between the pole and zero positions and the system step responses. Alternatively, Bode diagrams can also be used to design a cascade compensator. As an example, let us design the phase lead controller again. We can add a real zero and a real pole on the Bode diagram. Zooming the Bode diagram to focus on the area of interest, we can interactively tune the pole position, zero position and the gain of the controller by dragging up and down the magnitude response. Finally, the controller can be designed as shown in Fig. 6.36. The step response obtained is similar to what we have achieved before by using the root locus approach. It can be seen from the results that the bandwidth is increased from 16.2 rad./sec. to 22.7 rad./sec. The gain and phase margins are also increased in the compensated system.

Fig. 6.36. Controller design using the Bode diagram

Apart from the typical feedback structure, other system structures are also supported in SISOTool. Clicking the FS button on the system structure icon, we can pick up one of the feedback system structures as shown in Fig. 6.37. The rest of the controller design is the same as described in the above. Problems 1. Consider a plant model

6.5 SISOTool — An Interactive Controller Design Tool

239

Fig. 6.37. Other supported feedback structures in SISOTool

G(s) =

210(s + 1.5) (s + 1.75)(s + 16)(s + 1.5 ± j3)

and its controller Gc (s) = 52.5(s + 1.5)/(s + 14.86). Investigate the closed-loop dynamic behavior. Compare the gain and phase margins of the original plant and the compensated plant. Try to suggest how to further improve the control performance. 2. Given the following two transfer function models: 16 , (a). G(s) = s(s + 1)(s + 2)(s + 8) 2(s + 1) , (b). G(s) = s(47.5s + 1)(0.0625s + 1)2 design lead-lag compensators to ensure that the compensated systems have the expected phase margins and crossover frequencies. Try to change the expected margins to improve the performances of the closed-loop systems. Use both time and frequency-domain analysis to characterize your closed-loop systems. 3. Given the state space matrices     0 −0.2 0.5 0 0 0  0   0 −0.5 1.6 0 0      0 −14.3 85.8 0 , B =  0  A= 0  0   0 0 0 −33.3 100  30 0 0 0 0 10 Q = diag([ρ, 0, 0, 0, 0]), R = 1, for different values of ρ, solve the corresponding algebraic Riccati equation. For each ρ, design a state feedback controller and compare the closed-loop response. Comment on the compared results with frequency-domain justifications. 4. Design a state observer for the plant model given by     0 0 1 0 0 1 1 0 0 0 0  2     x˙ =  0 1 0 1 −1  x +  1  u, y = [0, 0, 0, 1, 1]x. 0 1 1 1 0  0 0 0 1 0 0 1

Perform a simulation analysis of the designed observer. Comment on whether the behavior of the observer is satisfactory. If not, re-design the observer until a satisfactory result is obtained. 5. Consider a state space model given by     0 −0.2 0.5 0 0 0  0   0 −0.5 1.6 0 0      ˙  0 0 −14.3 85.8 0  x+  0  u, y=[1, 0, 0, 0, 0]x. x=  0    0 0 0 −33.3 100 30 0 0 0 0 −10

Find the poles and zeros of the system. With the expected poles located at P = [−1, −2,−3,−4, −5], design a state feedback using pole placement method.

240

6. Model Based Controller Design

Try other expected pole locations to further improve the dynamic behavior of the closed-loop system. Design an observer-based controller for the original plant model and investigate the closed-loop behavior of the new closed-loop system. 6. Given a plant model     2 1 0 0 0 0  0 2 0 1 x˙ =  x +   u, 0 0 −1 0  1 0 0 0 −1 1

Try to find a state feedback gain vector K to place the closed-loop poles at (−2, −2, −1, −1). Check whether it is possible to place all the poles to −2. If not, try to explain why. 7. For the plant models in Problems 3-6, design the observer-based controllers. Compare the results with the existing direct state feedback approaches and comment on the performance differences. 8. Consider a plant model given by G(s) =

10 . (0.1s + 1)(0.2s + 1)(0.5s + 1)

Use the model-following controller design method to design a suitable controller. Try the standard models of different types and with different parameters. Manually adjust the reference model to improve the control performance. 9. Suppose the plant model is given by G(s) = 1000/[s(0.26s+1)]. Design a phase lead and a phase lead/lag controller.

7. PID Controller Design

PID (proportional-integral-derivative) control is one of the earlier control strategies [12]. It has a simple control structure and it is easy to tune in real world. Therefore, it has a wide range of applications in industrial control. According to a survey for process control systems in 1989, more than 90% of the control loops were of the PID type [5]. PID control has been an active topic since decades ago. This can be observed from the latest PID related research monographs [5, 4, 109, 94, 97]. Compared to the model-based controller design techniques presented in Chapter 6, it is widely recognized that PID controllers are less model-dependent. As verified in numerous industrial applications, the success of PID controllers does not require any detailed model information about the plant to be controlled. Usually, only some additional experiments such as a step reaction curve experiment or a relay feedback experiment around the nominal operating point, will be enough for a reasonably good PID controller parameter setting. Due to the practically attractive features of PID controllers, we believe that PID controllers will continue to dominate in real world applications. This is also the reason why we prepared a chapter dedicated to PID controllers. In this chapter, several useful PID-type controller design techniques will be presented and the implementation issues of the algorithms will be discussed. In Sec. 7.1, the proportional, integral and derivative actions are explained in detail and some variations of the typical PID structure are also introduced. In Sec. 7.2, the well known empirical Ziegler-Nichols tuning formula and its modified versions will be discussed in detail. The approaches for identifying the equivalent first-order plus delay models, which is essential in some of the PID controller design algorithms, will be presented. Some other simple PID setting formulae such as the refined PID tuning and the predictive PI controller design will be presented in Sec. 7.3. In Sec. 7.4, some of the advanced PID tuning formulae, including the internal model control, the gain-phase margin assignment and pole placement based PID controller design techniques will be presented. In Sec. 7.5, the optimal tuning formulae will be discussed. In Sec. 7.6, a pseudo-derivative feedback control strategy is introduced as a practical alternative to PID controller. Since time-delay is commonly seen in control engineering practice, Sec. 7.7 is dedicated to the controller design for time-delay systems with a moderate exposure to the

242

7. PID Controller Design

classical Smith-predictor control. In Sec. 7.8, some of the advanced topics on PID control will be presented, such as the integrator windup phenomenon and prevention and the automatic tuning techniques. Finally, some suggestions on controller structure selections for practical process control are provided.

7.1 Introduction 7.1.1 The PID Actions A typical structure of PID control system is shown in Fig. 7.1, where it can be seen that in a PID controller, the error signal e(t) is used to generate PID controller

✲ proportional r(t)



e(t)

✲ ✲ integral









✲ plant model

y(t)





✲ derivative d/dt

Fig. 7.1. A typical PID control structure

the proportional, integral and derivative actions with the resulted signals weighted and summed to form the control signal u(t) applied to the plant model. A mathematical description of the PID controller is

de(t) 1 t u(t) = Kp e(t) + e(τ )dτ + Td (7.1) Ti 0 dt where u(t) is the input signal, the error signal e(t) is defined as e(t) = r(t) − y(t), and r(t) is the reference input signal. The behavior of the proportional, integral and derivative actions will be demonstrated individually through the following example. Example 7.1.1. Consider a third-order plant model given by G(s) = 1/(s + 1)3 . If the proportional control strategy is selected, i.e., Ti → ∞ and Td → 0 in the PID control strategy, for different values of Kp , the closed-loop responses of the system can be obtained using the following MATLAB statements: >> G=tf(1,[1,3,3,1]); for P=[0.1:0.1:1],

7.1 Introduction

243

G_c=feedback(P*G,1); step(G_c), hold on; end figure; rlocus(G), axis([-2 2 -2 2]); k=rlocfind(G) k = 8.0378

2

0.6

Kp=1

Kp=0.9 Kp=0.8

P=8.0378

1.5

0.5

Imag Axis

Amplitude

1 0.4 0.3

0.5 0

-0.5 0.2

Kp=0.2

0.1 0

0

-1

Kp=0.1 1

2

3

4

5 6 Time (secs)

7

8

(a) closed-loop step response

-1.5 9

10

-2 -2

-1.5 -1

-0.5 0 0.5 Real Axis

1

1.5

2

(b) root locus

Fig. 7.2. Closed-loop step responses As shown in Fig. 7.2 (a), when Kp increases, the response speed of the system increases and the overshoot of the closed-loop system increases correspondingly. When Kp is large enough, the closed-loop system will become unstable, which can be directly concluded from the root locus analysis in Chapter 5. The root locus of the example system is shown in Fig. 7.2 (b), where it is seen that when Kp is outside the range of (0, 8.0378), the closed-loop system becomes unstable. Fix Kp = 1 and apply the PI control strategy. With different Ti , the following MATLAB statements: >> Kp=1; for Ti=[0.7:0.1:1.5] Gc=tf(Kp*[1,1/Ti],[1,0]); G_c=feedback(G*Gc,1); step(G_c), hold on end axis([0,20,0,2]) can be used to generate the closed-loop step responses of the example systems as shown in Fig. 7.3 (a). The most important feature of a PI controller is that there is no steady-state error in the step response if the closed-loop system is stable. Further examination shows that if Ti is smaller than 0.6, the closed-loop system will not be stable. It can be seen that when Ti increases, the overshoot tends to be smaller but the speed of response tends to be slower. Fixing both Kp and Ti at 1, i.e., Ti = Kp = 1, when the PID control strategy is used, with different Td , the following MATLAB statements: >> Kp=1; Ti=1;

244

7. PID Controller Design

2

1.6 Ti=0.7

1.6

Ti=0.8

1.4

Ti=0.9

1.4

1.2 1 0.8

0.4

0.4

0.2

0.2 0

1 0.8 0.6

0.6

0

Td=1.9 Td=1.7

Td=1.5

1.2 Amplitude

Amplitude

1.8

2

4

6

8

10 12 14 Time (secs)

(a) PI control

16

18

20

0

0

2

4

6

8

10 12 14 Time (secs)

16

18

20

(b) PID control

Fig. 7.3. Closed-loop step responses for Td=[0.1:0.2:2] Gc=tf(Kp*[Ti*Td,Ti,1]/Ti, [1,0]); G_c=feedback(G*Gc,1); step(G_c), hold on end axis([0,20,0,1.6]) can be used to get the closed-loop step responses shown in Fig. 7.3 (b). Clearly, when Td increases, the speed of response will increase and the overshoot will also increase.

In practical applications, the pure derivative action is usually not used directly due to the undesirable noise amplification. It is usually replaced by a first-order model with a lag. Thus, the Laplace transformation representation of the approximate PID controller can be written as   sTd  1 + E(s) (7.2) U (s) = Kp 1 + Ti s 1 + s Td N and N is a large number so as to get a good approximation. This is the socalled “soft-derivative” approximation. It is noticed that when N → ∞, the action of the approximate derivative approaches to the pure derivative. The effect of N is illustrated through the following example.

Example 7.1.2. Consider the plant model in Example 7.1.1. The PID controller parameters are Kp = 1, Ti = 1, and Td = 1. With different N , the following MATLAB commands: >> Td=1; Gc=tf(Kp*[Ti*Td,Ti,1]/Ti,[1,0]); G_c=feedback(G*Gc,1); step(G_c), hold on for N=[100,1000,10000,1:10] nn=Kp*([Ti*Td,0,0]+conv([Ti,1],[Td/N,1]))/Ti; dd=[Td/N,1,0]; Gc=tf(nn,dd); G_c=feedback(G*Gc,1); step(G_c)

7.1 Introduction

245

end figure; [y,t]=step(G_c); err=1-y; plot(t,err) are used to get the closed-loop step responses with the approximate derivative terms as shown in Fig. 7.4 (a). The error signal e(t) when N = 10 is shown in Fig. 7.4 (b). It can be seen that with N = 10, the approximation is fairly satisfactory.

1.4

1

N=1

Amplitude

1.2

0.8

Higher values of N

1

0.6

0.8

0.4

0.6

0.2

0.4

0

0.2 0

0

-0.2 5

10

15 20 Time (secs)

25

30 -0.4 0

(a) output signal

2

4

6

8

10

12

14

16

18

20

(b) error signal

Fig. 7.4. PID control with approximate derivatives

7.1.2 PID Control with Derivative in Feedback Loop From Fig. 7.4 (b), it can be seen that there exists a jump when t = 0 in the error signal of the step response. This means that the derivative action may not be desirable in such a control strategy. In practice, it may happen that the derivative operator is preferred in the feedback path for easy implementation with possibly pure analog elements. It may be expected that the derivative action, directly acting on the output signal, could be smoother with no jump or “kick”. This PID control strategy is shown in Fig. 7.5. r(t)

✲ - ✻

✲ Kp (1+ 1 ) Ti s

✲ -✻

✲ plant model

y(t)



Td s ✛ 1+Td s/N Fig. 7.5. PID control with derivative on output signal

Recall the typical feedback control structure shown in Fig. 2.2. The controller and feedback transfer functions can be equivalently written as   1 Gc (s) = Kp 1 + (7.3) Ti s

246

7. PID Controller Design

H(s) =

(1 + Kp /N )Ti Td s2 + Kp (Ti + Td /N ) + Kp . Kp (Ti s + 1)(Td s/N + 1)

(7.4)

The following example is designed to illustrate the consequence of using the derivative in the feedback path. Example 7.1.3. For the plant model in Example 7.1.1, by the following MATLAB statements: >> G=tf(1,[1,3,3,1]); Ti=1; Td=1; Kp=1; N=10; do=[Td/N 1 0]; no=Kp*([Ti*Td,0,0]+conv([Ti,1],[Td/N,1]))/Ti; Gc=tf(no,do); G_c=feedback(G*Gc,1); step(G_c), hold on nH=[(1+Kp/N)*Ti*Td,Kp*(Ti+Td/N),Kp]; dH=Kp*conv([Ti,1],[Td/N,1]); H=tf(nH,dH); Gc1=tf(Kp*[Ti,1],[Ti,0]); G_c1=feedback(G*Gc1,H); step(G_c1) the closed-loop step responses for system with normal PID and PID with D in feedback path are obtained and compared in Fig. 7.6. By observation, the response 1.5 D in feedback

Amplitude

normal PID 1

0.5

0 0

5

10

15 20 Time (secs)

25

30

Fig. 7.6. The closed-loop step responses comparison with D in the feedback loop may be slower and the overshoot may tend to be larger compared with that using the normal PID control.

7.2 Ziegler-Nichols Tuning Formula 7.2.1 Empirical Ziegler-Nichols Tuning Formula A very useful empirical tuning formula was proposed by Ziegler and Nichols in early 1942 [116]. The tuning formula is obtained when the plant model is given by a first-order transfer function model with a pure time-delay which can be expressed by G(s) =

k e−sL . 1 + sT

(7.5)

7.2 Ziegler-Nichols Tuning Formula

247

In real-time process control systems, a large variety of plants can be modeled approximately by (7.5). If the system model cannot be physically derived, experiments can be made to extract the parameters for the approximate model (7.5). For instance, if the step response of the plant model can be measured through an experiment, the output signal can be recorded as sketched in Fig. 7.7 (a), from which the parameters of k, L and T (or a) can be extracted. ✻ y(t)

✛ 1 ✲✻Imaginary

k

Kc

real



a

time✲ t

✛L ✲✛ T ✲

(a) time response

(b) Nyquist plot

Fig. 7.7. Sketches of the responses of a first-order plus delay model

With L and a, the PID controller parameters can be retrieved from Table 7.1. In Fig. 7.7 (a), a = kL/T . Table 7.1. Ziegler-Nichols tuning formulae Controller

from step response

type

Kp

P

1/a

Ti

PI

0.9/a

3L

PID

1.2/a

2L

Td

from frequency response Kp

Ti

Td

0.5Kc L/2

0.4Kc

0.8Tc

0.6Kc

0.5Tc

0.12Tc

If the frequency response experiments can be performed, from the Nyquist plot as shown in Fig. 7.7 (b), the crossover frequency ωc and the ultimate gain Kc can be obtained. Let Tc = 2π/ωc . The PID controller parameters can be retrieved from Table 7.1, too. It should be noted that Table 7.1 applies for the design of P (proportional) and PI (proportional plus integral) controllers in addition to the PID controller with the same set of experimental data from the plant. A MATLAB function ziegler(), listed in Appendix C, can be used to design PID controllers using Ziegler-Nichols tuning formulae discussed above. The syntax of the function is that >> [Gc,Kp,Ti,Td]=ziegler(key,vars) where key determines the controller type with key=1 for P controller, key=2

248

7. PID Controller Design

for PI controller and key=3 for PID controller. When step response data is available, vars=[K, L, T, N ] while vars=[Kc , Tc , N ] for the frequency response data. The returned variables G is the transfer function object of the controller and (Kp, Ti, Td) are respectively (Kp , Ti , Td ). When key=4, the PID controller with derivative in the feedback path is designed and its algorithm will be explained in Sec. 7.2.2. Example 7.2.1. Consider a fourth-order plant G(s) =

10 . (s + 1)(s + 2)(s + 3)(s + 4)

Enter the following MATLAB statements: >> G=tf(10, conv([1,1],conv([1,2],conv([1,3],[1,4])))); step(G); k=dcgain(G) k = 0.4167 The open-loop step response is shown in Fig. 7.8 (a). From the step response, the 1.4

0.5

PI control

0.45

1.2

PID control

0.4

1 Amplitude

Amplitude

0.35 0.3

0.25 0.2

0.15

0.8 P control

0.6 0.4

0.1

0.2

0.05 0

t1=0.76

0

1

t2=2.72 2

3 4 Time (secs)

5

6

(a) open-loop step response

7

0

0

2

4

6

8

10 12 14 Time (secs)

16

18

20

(b) closed-loop step response

Fig. 7.8. Controller design and responses with time-domain parameters parameters of the approximate first-order plus delay model are k = 0.2941, L = 0.76 and T = 2.72 − 0.76 = 1.96, based on which the P, PI and PID controllers can be designed using the following MATLAB statements: >> L=0.76; T=2.72-L; [Gc1,Kp1]=ziegler(1,[k,L,T,10]); Kp1 Kp1 = 6.1895 >> [Gc2,Kp2,Ti2]=ziegler(2,[k,L,T,10]); [Kp2,Ti2] ans = 5.5705 2.5308 >> [Gc3,Kp3,Ti3,Td3]=ziegler(3,[k,L,T,10]); [Kp3,Ti3,Td3] ans = 7.4274 1.5200 0.3800

7.2 Ziegler-Nichols Tuning Formula

249

With different controllers designed above, the closed-loop responses by using the following MATLAB statements: >> G_c1=feedback(G*Gc1,1); step(G_c1); hold on G_c2=feedback(G*Gc2,1); step(G_c2); G_c3=feedback(G*Gc3,1); step(G_c3); are shown in Fig. 7.8 (b). It can be observed that the steady-state error exists when the P controller is used. The response of the PID controller is faster than that of the PI controller.

If the frequency response of the plant model can be measured, the ultimate gain Kc and the crossover frequency ωc can be read from the Nyquist plot as shown in Fig. 7.7 (b). With Kc and ωc , the parameters of different PIDtype controllers can be obtained from Table 7.1. In this case, the MATLAB function ziegler() can still be used. In fact, since the crossover frequency ωc and the ultimate gain Kc are the gain margin of the open-loop plant model, one can directly obtain the parameters using the margin() function. Example 7.2.2. Consider the problem in Example 7.2.1. By the following MATLAB statements: >> G=tf(10, [1,10,35,50,24]); nyquist(G); axis([-0.2,0.6,-0.4,0.4]) [Kc,pp,wg,wp]=margin(G); [Kc,wg], Tc=2*pi/wg; ans = 12.6000 2.2361 >> [Gc1,Kp1]=ziegler(1,[Kc,Tc,10]); Kp1 Kp1 = 6.3000 >> [Gc2,Kp2,Ti2]=ziegler(2,[Kc,Tc,10]); [Kp2,Ti2] ans = 5.0400 2.2479 >> [Gc3,Kp3,Ti3,Td3]=ziegler(3,[Kc,Tc,10]); [Kp3,Ti3,Td3] ans = 7.5600 1.4050 0.3372 the Nyquist plot of the system can be obtained as shown in Fig. 7.9 (a), and the P, PI, PID controllers can be designed. With these different controllers, the closed-loop system responses can be obtained using the following MATLAB statements: >> G_c1=feedback(G*Gc1,1); step(G_c1); hold on G_c2=feedback(G*Gc2,1); step(G_c2); G_c3=feedback(G*Gc3,1); step(G_c3); and the step responses of the closed-loop system are shown in Fig. 7.9 (b).

250

7. PID Controller Design

1.5

0.4

PI control

0.3

PID control Amplitude

Imag Axis

0.2 0.1 0

-0.1

1

P control 0.5

-0.2 -0.3 -0.4 -0.2 -0.1

0

0.1 0.2 0.3 0.4 0.5 0.6 Real Axis

(a) Nyquist plots

0

0

2

4

6

8

10 12 14 Time (secs)

16

18

20

(b) closed-loop step response

Fig. 7.9. Controller design and responses with frequency domain parameters

7.2.2 Derivative Action in Feedback Path Assume that the derivative action is placed in the feedback path, the normal PID parameters (Kp , Ti , Td ) can be obtained from [114]   T ′T ′ T′ Kp = Kp′ 1 + d′ , Ti = Ti′ + Td′ , Td = ′ i d ′ (7.6) Ti Ti + Td where (Kp′ , Ti′ , Td′ ) are the PID parameters with derivative in the feedback path. In other words, if a PID controller, with derivative action in forward path, is designed, then an equivalent PID controller with the derivative action in the feedback path, can be obtained by solving the following algebraic equation: " Ti ± Ti (Ti − 4Td ) 2 . (7.7) x − Ti x + Ti Td = 0, ⇒ x1,2 = 2 It is reasonable to assume in most PID controller designs that Ti > 4Td . In this case, the above equation will have real roots x1,2 . Thus, from (Kp , Ti , Td ), the equivalent PID parameters for the new structure, i.e., with derivative in the feedback path, can be computed as follows: " " Ti − Ti (Ti − 4Td ) Ti + Ti (Ti − 4Td ) ′ ′ , Td = , Ti = 2 2 (7.8) 2T K " i p Kp′ = . Ti + Ti (Ti − 4Td )

The MATLAB function ziegler() can still be used to design such a PID controller. The syntax of the function now becomes >> [Gc,Kp,Ti,Td,H]=ziegler(key,vars) with key=4 and H is the equivalent feedback transfer function object.

7.2 Ziegler-Nichols Tuning Formula

251

Example 7.2.3. Consider the plant model in Example 7.2.1. The normal PID controller can be designed using the Ziegler-Nichols algorithm. An effective design of PID controller with derivative in the feedback path can also be obtained with the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); N=10; [Kc,Pm,wc,wp]=margin(G); Tc=2*pi/wc; [Gc1,Kp1,Ti1,Td1]=ziegler(3,[Kc,Tc,N]); [Gc2,Kp2,Ti2,Td2,H]=ziegler(4,[Kc,Tc,N]); [Kp2,Ti2,Td2] ans = 7.5600 1.4050 0.3372 >> G_c1=feedback(G*Gc1,1); step(G_c1); hold on G_c2=feedback(G*Gc2,H); step(G_c2) with the step response comparison given in Fig. 7.10 (a). It can be seen that al2 1.8 PID with D in feedback 1.6

normal PID

Amplitude

1.4 1.2 1 0.8 0.6 0.4 0.2 0

0

5

10

15 20 Time (secs)

25

30

Fig. 7.10. PID controllers comparison though the PID controller with derivative in the feedback path might be easier and faster to be implemented compared to the normal PID controller, its performance may not be very satisfactory. Sometimes, such a PID controller should be designed using a dedicated algorithm to ensure a good control performance.

7.2.3 Methods for First-order Plus Delay Model Fitting It can be seen that the model (7.5) is very important in designing a PID controller. The method in Sec. 7.2.1 for finding L and T of a given plant may not be satisfactory. Among other model fitting methods, the sub-optimal reduction method [106] is very effective at the expense of heavy computational load. In this section, two effective and frequently used algorithms will be introduced. Frequency response based method. Consider the frequency response of a first-order model   k k G(jω) = e−Ls  e−jωL . (7.9) = Ts + 1 T jω + 1 s=jω

252

7. PID Controller Design

The ultimate gain Kc at the crossover frequency ωc is actually the first intersection of Nyquist plot with the negative part of the real axis, i.e.,    k(cos ωc L − ωc T sin ωc L) = − 1 1 + ωc2 T 2 Kc (7.10)   sin ωc L + ωc T cos ωc L = 0 where k is the steady-state value or DC gain of the system which can directly be evaluated from the given transfer function. Define two variables x1 = L and x2 = T satisfying   f (x , x ) = kK (cos ω x − ω x sin ω x ) + 1 + ω 2 x2 = 0 1 1 2 c c 1 c 2 c 1 c 2 (7.11)  f2 (x1 , x2 ) = sin ωc x1 + ωc x2 cos ωc x1 = 0. The Jacobian matrix is that

J=





∂f1 /∂x1 ∂f2 /∂x1

∂f1 /∂x2 ∂f2 /∂x2



−kKc ωc sin ωc x1−kKc ωc2 x2 cos ωc x1 = ωc cos ωc x1 −ωc2 x2 sin ωc x1

(7.12) 2ωc2 x2 −kKc ωc sin ωc x1 . ωc cos ωc x1

So, (x1 , x2 ) can be solved using any quasi-Newton algorithm. The MATLAB function getfod(), listed in Appendix C, is designed for solving x1 and x2 . Transfer function based method. Consider the first-order model with delay given by Gn (s) = ke−Ls /(1 + T s). Taking the first- and second-order derivatives of Gn (s) with respect to s, one can immediate find that G′n (s) T = −L − , Gn (s) 1 + Ts

G′′n (s) − Gn (s)



G′n (s) Gn (s)

2

=

T2 . (1 + T s)2

Evaluating the values at s = 0 yields Tar = −

G′n (0) = L + T, Gn (0)

T2 =

G′′n (0) 2 − Tar Gn (0)

(7.13)

where Tar is also referred to as the average residence time. From the former equation, one has L = Tar − T . Again, the DC gain k can be evaluated from Gn (0). In practice, if the transfer function of the plant model is known, use the actual G(s) to replace Gn (s) so as to identify the parameters of the equivalent first-order plus delay model. Note that this method may not be suitable for systems with unknown mathematical models. In practical situations, such as in the automatic tuning techniques, the frequency based method is more useful.

7.2 Ziegler-Nichols Tuning Formula

253

A MATLAB function getfod(), listed in Appendix C, can be used to find the key parameters of the first-order plus delay model. The syntax of the function is >> [k,L,T]=getfod(G,method) where from the given transfer function object G, one can find the values of (k, L, T ) using the above algorithms. The variable method is used to represent the identification method with method=1 for transfer function based method and otherwise for the frequency response based method. Example 7.2.4. Consider the fourth-order model used in Example 7.2.1. The parameters of its approximate first-order plus delay model can be obtained using the following MATLAB scripts: >> G=tf(10, [1,10,35,50,24]); [k,L,T]=getfod(G); [k,L,T] ans = 0.4167 0.7882 2.3049 >> [Gc1,Kp3,Ti3,Td3]=ziegler(3,[k,L,T,10]); [Kp3,Ti3,Td3] ans = 8.4219 1.5764 0.3941 >> [k,L,T]=getfod(G,1); [k,L,T] ans = 0.4167 0.8902 1.1932 >> [Gc2,Kp4,Ti4,Td4]=ziegler(3,[k,L,T,10]); [Kp4,Ti4,Td4] ans = 3.8602 1.7804 0.4451 >> G_c1=feedback(G*Gc1,1); step(G_c1); hold on G_c2=feedback(G*Gc2,H); step(G_c2) and the step responses with the above designed two PID controllers are shown in Fig. 7.11. It can be seen that although the PID controller designed with the 1.4 frequency response based method 1.2

Amplitude

1 0.8 transfer function based method 0.6 0.4 0.2 0

0

1

2

3 4 Time (secs)

5

6

7

Fig. 7.11. PID controller responses transfer function based identification algorithm looks better, it does not reflect at all the characteristics of Ziegler-Nichols tuning, due to the inaccurately identified parameters.

254

7. PID Controller Design

Example 7.2.5. Consider the simple plant model given by G(s) = e−s /(s + 1)3 , and it is noted that there has been already a time-delay term in the plant model. Here, Simulink is used to simulate this system. The Simulink model for analyzing the systems with reference input and disturbances is shown in Fig. 7.12. The “PID

c7fsimd.mdl

Step at t1 num(s) den(s) step at t2

plant model

1 Transport Delay

Outport

PID Step Input

s1

PID with Approximate Derivative

Fig. 7.12. Simulink description of a PID control structure with approximate derivative” icon is used for the PID controller, where it should be noted that the controller is represented by GPID (s) = P +

I Ds + . s s/N + 1

(7.14)

Comparing with (7.3), the following variables should be entered in the dialog box of the PID controller such that P=Kp, I=Kp/Ti, D=Kp*Td, N=N/Td The disturbance, added in front of the plant model, is assumed to be a square wave starting from time t1 to t2. Using the Pad´e approximation of the delay term, one can design the ZieglerNichols controller using the following MATLAB statements: >> G=tf(1,[1,3,3,1]); N=10; Tdly=1; [nP,dP]=pade(Tdly,3); G_o=G*tf(nP,dP); [k,L,T]=getfod(G_o); t1=0; t2=0; tend=50; U=1; [Gc1,Kp,Ti,Td]=ziegler(3,[k,L,T,N]); [Kp,Ti,Td] ans = 1.3833 4.3285 1.0821 >> G_c=feedback(G_o*Gc1,1); step(G_c); hold on num=G.num{1}; den=G.den{1}; [tt1,x,yy1]=sim(’c7fsimd’,tend,[]); plot(tt1,yy1) With the designed Ziegler-Nichols controller (Kp, Ti, Td), the closed-loop step response of the system is shown in Fig. 7.13. Clearly, the PID design using Pad´e approximation for time delay element gives a satisfactory result. The slight initial oscillation in Fig. 7.13 is due to the non-minimum-phase nature of Pad´e approximation. With the Pad´e approximation for the delay term, the Ziegler-Nichols controller can be designed using the frequency response method via the following MATLAB statements:

7.2 Ziegler-Nichols Tuning Formula

255

1

Amplitude

0.8 0.6 0.4 0.2 0 0

2

4

6

8

10 12 14 Time (secs)

16

18

20

Fig. 7.13. PID controller design and responses >> [Kc,p,wc,w]=margin(G_o); Tc=2*pi/wc; [Gc1,Kp,Ti,Td]=ziegler(3,[Kc,Tc,N]); [Kp,Ti,Td] ans = 1.4971 3.4285 0.8228 >> G_c=feedback(G_o*Gc1,1); step(G_c); hold on [tt2,x,yy2]=sim(’c7fsimd’,tend,[]); plot(tt2,yy2) Clearly, both of the two approaches give similar results.

Finally, note that a MATLAB function using the sub-optimal model reduction technique, as remarked at the beginning of this subsection, is provided in CtrlLAB for finding the parameters (k, L, T ), which can be used to validate the results obtained using the identification techniques introduced in this subsection. 7.2.4 A Modified Ziegler-Nichols Formula Consider the Nyquist frequency response shown in Fig. 7.14 (a). For a ✻Imaginary

✻Imaginary real

real



I action

❪A ✰ P action ❫ D action (a) original Nyquist plot



A1

(b) new Nyquist plot

Fig. 7.14. Sketches of first-order plus delay model

selected point A on the Nyquist curve, the control efforts of P, I and D are shown in the directions in Fig. 7.14 (a). Thus, with properly chosen Kp , Ti

256

7. PID Controller Design

and Td , it is possible to move the given point A on the Nyquist curve of the uncontrolled plant to an arbitrary position on the Nyquist plot of the controlled system. The typical Nyquist plot under PID control is shown in Fig. 7.14 (b) where A1 corresponds to the point A in Fig. 7.14 (a). Denote point A in the complex plane as G(jω0 ) = ra ej(π+φa ) . Suppose A is to be moved to A1 which is represented by G1 (jω0 ) = rb ej(π+φb ) . Assume that the PID controller at frequency ω0 is Gc (s) = rc ejφc . Then, obviously, rb ej(π+φb ) = ra rc ej(π+φa +φc ) .

(7.15)

Therefore, rc = rb /ra and φc = φb − φa . So, based on the above analysis, PI and PID controllers can be designed as follows: • PI control: Kp =

rb cos(φb − φa ) 1 , Ti = ra ω0 tan(φa − φb )

(7.16)

which means that φa > φb for a positive Ti . As a special case, the Ziegler-Nichols algorithm design is by Kp = Kc rb cos φb , Ti = −

Tc , where Tc = 2π/ωc 2πtanφb

(7.17)

where ra = 1/Kc and φa = 0. To get a positive Ti , it is required that cos φb < 0, which implies that the point A1 should be in the second or the third quadrant in Fig. 7.14 (b). • PID control: Kp =

rb cos(φb − φa ) , ra

ω0 Td −

1 = tan(φb − φa ). ω0 Ti

(7.18)

Clearly, Ti and Td are not unique according to (7.18). To get a unique PID design, it is a usual practice to set Td = αTi where α is a constant. Given an α, Ti and Td can be obtained uniquely from   ) 1 Ti = tan(φb − φa ) + 4α + tan2 (φb − φa ) , Td = αTi . (7.19) 2αω0 By inspection, it is seen that the Ziegler-Nichols tuning formula is a special case when α = 1/4. The Ziegler-Nichols tuning formula can be rewritten as follows:     Tc 1 + sin φb Tc 1 + sin φb Kp = Kc rb cos φb , Ti = , Td = (7.20) π cos φb 4π cos φb where ra = 1/Kc , φa = 0, and α = 1/4.

7.2 Ziegler-Nichols Tuning Formula

257

It can be seen that the PI or PID controllers can be designed by a suitable choice of rb and φb . This is called the modified Ziegler-Nichols PI/PID tuning formula, which has been implemented in the MATLAB function ziegler(), too. The only difference is that vars=[Kc , Tc , rb , φb , N ]. Example 7.2.6. Consider the plant model given by G(s) = 1/(s + 1)3 . The PID controller by the original Ziegler-Nichols tuning method can be obtained as follows: >> G=tf(1,[1,3,3,1]); [Kc,pp,wg,wp]=margin(G); Tc=2*pi/wg; [Gc1,Kp1,Ti1,Td1]=ziegler(3,[Kc,Tc,10]); [Kp1,Ti1,Td1] ans = 4.8007 1.8137 0.4353 Now, let’s illustrate the flexibility of the modified Ziegler-Nichols PI/PID tuning formula. First, fix rb = 0.5 and change φb . By the following MATLAB statements: >> G_c=feedback(G*Gc1,1); step(G_c); rb=0.5; hold on for pb=[10:10:70] [Gc2,Kp2,Ti2,Td2]=ziegler(3,[Kc,Tc,rb,pb,10]); G_c2=feedback(G*Gc2,1); step(G_c2); end set(gca,’Xlim’,[0,20]) the closed-loop step responses of the system for different values of φb are shown in Fig. 7.15 (a). Clearly, when φb increases, the overshoot and oscillation become 1.6

Ziegler-Nichols tuning

φb φb=20o

1.4

=10o

Amplitude

1.2 Amplitude

1.5

Ziegler-Nichols tuning

1 0.8 0.6

φb=60o φb

0.4

1

rb=0.1 rb=0.2 rb=0.3

0.5

=70o

0.2 0

0

rb=0.4 2

4

6

8

10 12 14 Time (secs)

(a) for different φb

16

18

20

0

0

1

2

3

4

5 6 Time (secs)

7

8

9

10

(b) for different rb

Fig. 7.15. Closed-loop step responses of the modified Ziegler-Nichols method smaller. When φb is larger than 60◦ , there is no overshoot but the response becomes too sluggish. Empirically, rb ∈ (40◦ , 50◦ ). Now, fix φb at φb = 45◦ and change rb . By the following MATLAB statements: >> G_c=feedback(G*Gc1,1); step(G_c); pb=45; hold on; for rb=[0.1:0.1:1] [Gc2,Kp2,Ti2,Td2]=ziegler(3,[Kc,Tc,rb,pb,10]); G_c2=feedback(G*Gc2,1); step(G_c2);

258

7. PID Controller Design end set(gca,’Xlim’,[0,10])

the closed-loop step responses of the system for different rb are compared in Fig. 7.15 (b). It can be seen that the smaller the rb , the smaller the overshoot and the slower the response. Clearly, rb = 0.45 and φb = 45◦ can be considered as a good choice for this example with almost no overshoot and with a reasonably fast response.

It can be concluded that the modified tuning method is advantageous over the original Ziegler-Nichols PI/PID tuning technique.

7.3 Other PID Controller Tuning Formulae In practice, there are many variants of the traditional Ziegler-Nichols PID tuning method introduced in the above section. In this section, four representative PID tuning formulae in the spirit of Ziegler-Nichols PID tuning method will be discussed. 7.3.1 Chien-Hrones-Reswick PID Tuning Algorithm The so-called Chien-Hrones-Reswick (CHR) method emphasizes on the set-point regulation or on the disturbance rejection. In addition, the qualitative specifications on the response speed and overshoot can be accommodated. Compared with the traditional Ziegler-Nichols tuning formula, the time constant T of the plant is used explicitly. The CHR PID controller setting formulae are summarized in Table 7.2 for set-point regulation, where the more heavily damped closed-loop response which ensures the “quickest response without overshoot” is labeled as “0% overshoot” and the “quickest response with 20% overshoot” is labeled as “20% overshoot”. Table 7.2. Chien-Hrones-Reswick tuning formula for set-point regulation Controller type P PI PID

with 0% overshoot Kp Ti Td 0.3/a 0.35/a 1.2T 0.6/a T 0.5L

with 20% overshoot Kp Ti Td 0.7/a 0.6/a T 0.95/a 1.4T 0.47L

Similarly, Table 7.3 is for disturbance rejection. A MATLAB function chrPID(), listed in Appendix C, can be used to design different controllers using the Chien-Hrones-Reswick algorithms. The syntax of the function is

7.3 Other PID Controller Tuning Formulae

259

Table 7.3. Chien-Hrones-Reswick tuning formula for disturbance rejection Controller type P PI PID

with 0% overshoot Kp Ti Td 0.3/a 0.6/a 4L 0.95/a 2.4L 0.42L

with 20% overshoot Kp Ti Td 0.7/a 0.7/a 2.3L 1.2/a 2L 0.42L

>> [nn,dd,Kp,Ti,Td]=chrPID(key,typ,vars) where the returned variables are defined similar to those in ziegler(). key=1, 2, 3 is for P, PI and PID controllers, respectively. The variable typ for the type of criteria used with typ=1 for set-point control and others for disturbance rejection. vars=[k, L, T, N, Os ] with Os = 0 for no overshoot, and others for 20% overshoot. Example 7.3.1. Consider the plant model in Example 7.2.1. The Ziegler-Nichols PID controller and the four CHR controllers for different controller types and specifications are obtained using the following statements: >> G=tf(10,conv([1,1],conv([1,2],conv([1,3],[1,4])))); [k,L,T]=getfod(G); N=10; [Gc1,Kp,Ti,Td]=ziegler(3,[k,L,T,N]); PIDt=[Gc1.num{1},Gc1.den{1},Kp,Ti,Td]; [Kp,Ti,Td] ans = 8.4219 1.5764 0.3941 >> [Gc2,Kp,Ti,Td]=chrpid(3,1,[k,L,T,N,0]); PIDt=[PIDt; Gc2.num{1},Gc2.den{1},Kp,Ti,Td]; [Kp,Ti,Td] ans = 4.2110 2.3049 0.3941 >> [Gc3,Kp,Ti,Td]=chrpid(3,1,[k,L,T,N,20]); PIDt=[PIDt; Gc3.num{1},Gc3.den{1},Kp,Ti,Td]; [Kp,Ti,Td] ans = 6.6674 3.2268 0.3704 >> [Gc4,Kp,Ti,Td]=chrpid(3,2,[k,L,T,N,0]); PIDt=[PIDt; Gc4.num{1},Gc4.den{1},Kp,Ti,Td]; [Kp,Ti,Td] ans = 6.6674 1.8917 0.3310 >> [Gc5,Kp,Ti,Td]=chrPID(3,2,[k,L,T,N,20]); PIDt=[PIDt; Gc5.num{1},Gc5.den{1},Kp,Ti,Td]; [Kp,Ti,Td] ans = 8.4219 1.5764 0.3310 For different controllers designed in the above, the step responses of the closedloop system can be obtained using the following MATLAB statements: >> for i=1:5 nn=PIDt(i,1:3); dd=PIDt(i,4:6); G_c=feedback(G*tf(nn,dd),1); step(G_c); hold on

260

7. PID Controller Design end set(gca,’XLim’,[0,10])

as summarized in Fig. 7.16 (a). It can be seen that the set-point regulation based 1.4

20% disturbance rejection Ziegler-Nichols tuning

1.2

0.2

0% disturbance rejection

Ziegler-Nichols tuning

0.15 Amplitude

Amplitude

1 0.8 20% set-point 0.6

0.1 20% disturbance rejection 0.05

20% set-point

0% set-point 0.4

0

0.2 0

0

0% set-point 0% disturbance rejection

-0.05

1

2

3

4

5 6 Time (secs)

7

8

9

10

0

(a) set-point step response

2

4

6

8

10 12 14 Time (secs)

16

18

20

(b) disturbance step response

Fig. 7.16. Closed-loop step responses of CHR controllers controller with 0% overshoot gives a satisfactory result. Similarly, with the following MATLAB statements: >> for i=1:5 nn=PIDt(i,1:3); dd=PIDt(i,4:6); G_c=feedback(G,tf(nn,dd)); step(G_c); hold on end set(gca,’XLim’,[0,30]) the closed-loop responses to a step disturbance signal can be obtained as shown in Fig. 7.16 (b). Clearly, compared with the traditional Ziegler-Nichols controller, the effect of the disturbance signal can be significantly reduced by a CHR controller.

7.3.2 Cohen-Coon Tuning Algorithm Another Ziegler-Nichols like tuning algorithm is the so-called Cohen-Coon tuning formula. Referring to the first-order plus delay model (7.5) approximately obtained from experiments, denote a = kL/T , and τ = L/(L + T ). The different controllers can be designed by the direct use of Table 7.4. A MATLAB function cohenpid() is prepared and listed in Appendix C which can be used to design a PID controller using the Cohen-Coon algorithm. The syntax of the function is >> [Gc,Kp,Ti,Td,H]=cohenpid(key,vars) where key is for the type of controller with key= 1, 2, 3,5 for P, PI, PID and PD control, respectively. key=4 is for the PID controller with D in the feedback path. vars=[k, L, T, N ]. Among the returned variables, G is the transfer function object of the controller, Kp, Ti, Td are for Kp , Ti and Td , respectively, and H is for the effective transfer function object in the feedback path if key=4.

7.3 Other PID Controller Tuning Formulae

261

Table 7.4. Controller parameters of Cohen-Coon method Controller P PI PD PID

Kp 

Ti 

1 0.35τ 1+ a 1−τ   0.92τ 0.9 1+ a 1−τ   0.13τ 1.24 1+ a 1−τ   0.18τ 1.35 1+ a 1−τ

Td

3.3 − 3τ L 1 + 1.2τ

2.5 − 2τ L 1 − 0.39τ

0.27 − 0.36τ L 1 − 0.87τ 0.37 − 0.37τ L 1 − 0.81τ

Example 7.3.2. Consider the plant model given in Example 7.2.1 with its P, PI, PD, and PID controllers being designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); [k,L,T]=getfod(G); [Gc1,Kp1]=cohenpid(1,[k,L,T,10]); [Kp1] ans = 7.8583 >> [Gc2,Kp2,Ti2]=cohenpid(2,[k,L,T,10]); [Kp2,Ti2] ans = 8.3036 1.5305 >> [Gc3,Kp3,Ti3,Td3]=cohenpid(3,[k,L,T,10]); [Kp3,Ti3,Td3] ans = 10.0579 1.7419 0.2738 >> [Gc4,Kp4,Ti4,Td4]=cohenpid(5,[k,L,T,10]); [Kp4,Td4] ans = 9.0895 0.1805 With the following MATLAB statements: >> t=0:.1:10; G_c1=feedback(G*Gc1,1); G_c2=feedback(G*Gc2,1); G_c3=feedback(G*Gc3,1); G_c4=feedback(G*Gc4,1); plot(t,y)

y=step(G_c1,t); y=[y step(G_c2,t)]; y=[y step(G_c3,t)]; y=[y step(G_c4,t)];

the closed-loop step responses of the system under different controllers designed above can be obtained as shown in Fig. 7.17. It should be noted that there exist steady-state error in the P and PD control strategies. Therefore, PID controller is recommended.

7.3.3 Refined Ziegler-Nichols Tuning Since the PID controller designed by the conventional Ziegler-Nichols tuning formula often exhibits rather strong oscillation in the set-point response

262

7. PID Controller Design 2 1.8

PI control

1.6 Amplitude

1.4

PID control

1.2 1 0.8 0.6

PD control

0.4

P control

0.2 0

0

1

2

3

4

5 6 Time (secs)

7

8

9

10

Fig. 7.17. Step responses under controllers of Cohen-Coon method

with large overshoot, a refinement to such PID controller tuning algorithm can be used by the idea of set-point weighting:

dy 1 edt − Td (7.21) u(t) = Kp (βuc − y) + Ti dt where the derivative action is performed on the output signal and a fraction of the input signal is added to the control signal. Usually, β < 1. The control law can be rewritten as  

dy 1 edt − Kp (1 − β)y + Td u(t) = Kp βe + . (7.22) Ti dt The block diagram representation of the control system can be constructed as shown in Fig. 7.18. Compared with the typical feedback control struc✲ β uc (t)

e(t) ✲

✲ ✻

Kp



1 Ti s

❄ ✻



u✲

plant

✲y

✻ ✛ Kp (1 − β) ✛ ✻ Kp Td s ✛

Fig. 7.18. Refined PID control structure

ture shown in Fig. 2.2, after some transfer function block manipulations, the controller Gc (s) and the feedback H(s) can be easily obtained as follows:   1 Gc (s) = Kp β + , (7.23) Ti s

7.3 Other PID Controller Tuning Formulae

263

Ti Td β(N + 2 − β)s2 /N + (Ti + Td /N )s + 1 . (7.24) (Ti βs + 1)(Td s/N + 1) Define the normalized delay constant τ as τ = L/T and a constant κ by κ = Kc k. For different ranges of the variables τ and κ, the PID controller parameters were suggested as follows: H(s) =

• If 2.25 < κ < 15 or 0.16 < τ < 0.57, use the original Ziegler-Nichols design parameters. To ensure that the overshoot is less than 10% or 20%, β should be evaluated respectively from 36 15 − κ , or β = . (7.25) β= 15 + κ 27 + 5κ • If 1.5 < κ < 2.25 or 0.57 < τ < 0.96, the integral parameter Ti in the Ziegler-Nichols controller should be refined to Ti = 0.5µTc , where 8 4 (µ − 1). (7.26) µ = κ, and β = 9 17 • If 1.2 < κ < 1.5, in order to keep the overshoot less than 10%, the parameters of the PID should be refined as     12 + κ 5 1 4 κ+1 . (7.27) Kp = , Ti = 6 15 + 14κ 5 15

A MATLAB function rziegler(), listed in Appendix C, can be used to design a refined PID controller. The syntax is >> [Gc,Kp,Ti,Td,beta,H]=rziegler(vars) where vars=[k, L, T, N, Kc , Tc ] and the returned variables G is the cascade controller Gc (s) with H the feedback controller H(s). The variables (Kp, Ti, Td, beta) are (Kp , Ti , Td , β), respectively.

Example 7.3.3. Consider the plant model in Example 7.2.1. The refined PID controller can be designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); [k,L,T]=getfod(G); [Kc,p,wc,m]=margin(G); Tc=2*pi/wc; [Gc,Kp,Ti,Td,beta,H]=rziegler([k,L,T,10,Kc,Tc]); [Kp,Ti,Td,beta] ans = 8.4219 1.5764 0.3941 0.4815 >> G_c=feedback(G*Gc,H); step(G_c); hold on [Gc,Kp1,Ti1,Td1]=ziegler(3,[k,L,T,10]); [Kp1,Ti1,Td1] ans = 8.4219 1.5764 0.3941 >> G_c=feedback(G*Gc,1); step(G_c); and the closed-loop step response under the refined Ziegler-Nichols PID controller is shown in Fig. 7.19, with a comparison with the response from the conventional Ziegler-Nichols PID controller. The response is significantly improved but it is not as good as the ones using other tuning algorithms such as the one from using the modified Ziegler-Nichols method with rb = 0.45, and φb = 45◦ .

264

7. PID Controller Design 1.4 Ziegler-Nichols 1.2

refined Ziegler-Nichols

Amplitude

1 0.8 0.6 0.4 0.2 0

0

1

2

3

4

5 6 Time (secs)

7

8

9

10

Fig. 7.19. Step responses under refined Ziegler-Nichols controller

7.3.4 Predictive PI Tuning Algorithm The predictive PI tuning algorithm is based on a different idea. Let us introduce the idea first. Suppose that G(s) and Gc (s) are the transfer function representations of the plant model and the controller, respectively. With a unity negative feedback, the closed-loop transfer function is that Gcl (s) =

Gc (s)G(s) . 1 + Gc (s)G(s)

(7.28)

If an ideal closed-loop transfer function Gcl (s) is specified, the controller can be explicitly written as Gc (s) =

Gcl (s) 1 . G(s) 1 − Gcl (s)

(7.29)

Clearly, with different desired Gcl (s) and different plant model, different analytical methods for solving the PID controller design problems can be proposed. In what follows, the plant model is assumed to be fit satisfactorily by a first-order model with delay, i.e., G(s) = ke−Ls /(T s + 1). The desired closedloop transfer function is given by Gcl (s) = e−Ls /(1+λT s) with λ the tunable parameter for the controller design. It can be seen that λ should be chosen to be less than 1 such that the closed-loop response will be faster than that of the plant. With the chosen Gcl (s), it follows from (7.29) that Gc (s) =

1 + sT Kp (1 + λsT − e−sL )

(7.30)

where there is an integral action in the controller since G(0) → ∞. Hence, the controller output signal U (s) can be written as

7.3 Other PID Controller Tuning Formulae

 

1 Kp 1 −sL (1 − e U (s) = )U (s) 1+ E(s) − λKp sT 1 + sT 1 sT + 1 E(s) − (1 − e−sL )U (s). = λKp T s λT s

265

(7.31)

Clearly, the first term is a PI controller and the second term is in fact a predictor. It should be remarked that for systems with a large delay, the prediction in the second term is better than the traditional derivative term. Thus, this control structure is also referred to as the predictive PI controller. A MATLAB function predpi() is prepared and listed in Appendix C which can be used in the predictive PI controller design. The syntax is that >> Gc=predpi(vars) where vars=[k, L, T, m, λ] with m the order of Pad´e approximation to make Gc (s) an approximated linear controller object. From (7.31), the controller can be approximated using a Pad´e approximation Pm (s, L) such that a rational cascade controller Gc (s) can be obtained from Gc (s) =

λ(sT + 1) λ(sT + 1)D[Pm (s, L)] ≈ 1 + λT s − e−sL (1 + λT s)D[Pm (s, L)] − N [Pm (s, L)]

(7.32)

which is returned in Gc. Example 7.3.4. Consider again the plant model in Example 7.2.1. The predictive PI controller for different values of λ can be designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); [k,L,T]=getfod(G); for lam=[0.1,1:5,10,100,1000] Gc=predpi([k,L,T,2,lam]); G_c=feedback(G*Gc,1); step(G_c), hold on end The closed-loop step responses for different values of λ are shown in Fig. 7.20. It

other large λ

Amplitude

1 0.8

λ=1 λ=2 λ=3

0.6

λ=0.1

0.4 0.2 0

0

10

20

30 40 Time (secs)

50

60

Fig. 7.20. Step responses under predictive PI controllers

266

7. PID Controller Design

can be seen that when λ is increased to a certain point, the step response cannot be further improved. In fact, when λ is too large, the error integral may also grow large. In practical applications, one may choose a value of λ between 0.5 and 5 [5].

7.4 Advanced PID Tuning Methods 7.4.1 Gain and Phase Margin Assignment Algorithm The gain and phase margin assignment algorithm for PID controller design was introduced by ˚ Astr¨om and H¨ agglund [4]. The basic idea is to shift a specific point in the frequency response of the system to another designated place, for instance, a point with the magnitude of 1 and the phase equal to a pre-specified value so as to force the closed-loop system to maintain the desired phase margin. Assume that the point on the plant model G(s) and the controller Gc (s) can respectively be written as G(jω) = rp (ω)ej[π+φp (ω)] , Gc (jω) = rc (ω)ejφc (ω)

(7.33)

and the expected frequency response is B = rs (ω)ej[π+φs (ω)] . Then, one can find that rc (ω)rp (ω)ej[π+φc (ω)+φp (ω)] = rs (ω)ej[π+φs (ω)] . (7.34) The following are two cases for designing a PID controller with preassigned margin. Gain margin assignment. Define φs (ωg ) = 0, and rs (ωg ) = 1/Am , where 1/Am is the expected gain margin. The gain and phase of the controller can respectively be written as rc (ωg ) =

1 rs (ωg ) = , φc (ωg ) = φs (ωg )−φp (ωg ) = −φp (ωg ) (7.35) rp (ωg ) Am rp (ωg )

where ωg is the specified frequency. From the above equation, it is easy to find that 1 ωg Td − = −φp (ωg ). (7.36) ωg Ti Assuming that Ti = αTd , from the above equation Ti and Td are given by " φ2 (ωg )α2 + 4α − φ(ωg )α Td = , and Ti = αTd . (7.37) 2αωg The gain of the controller is  1 1 Kp 1 + 2 2 + Td2 ωg2 = . Ti ωg Am rp (ωg )

(7.38)

7.4 Advanced PID Tuning Methods

267

Phase margin assignment. Define rs (ωc ) = 1 and φs (ωc ) = φm (ωc ) where φm (ωc ) is the expected phase margin. Then, ωc Td −

1 = tanφm ωc Ti

(7.39)

where ωc is the specific frequency point. It can be seen that there are infinite numbers of solutions to such equations. For simplicity, assume that Ti = αTd . Then, Td and Ti can be obtained from " tanφm + 4/α + tan2 φm Td = , with Ti = αTd . (7.40) 2ωc Kp can be obtained from Kp =

cos φm = Kc cos φm . | G(jωc ) |

(7.41)

A MATLAB function gphapid() is listed in Appendix C. The function can be used to design a PID controller by gain margin or phase margin assignment. The syntax of the function is >> [Gc,Kp,Ti,Td,H]=gphapid(key,vars,G) where key=3 is for the normal PID controller, while key=4 for the effective PID with D in feedback path. The variable vars=[id, p1 , ω1 , N ], with id=1 for gain margin assignment, and id=2 for phase margin assignment, and p1 is the expected gain or phase margin, and ω1 is the expected frequency. G is the transfer function object of the plant model. (Kp, Ti, Td) are the PID controller parameters, and Gc is the forward path transfer function object, and H is the effective feedback transfer function object when key=4. Example 7.4.1. Consider the plant model in Example 7.2.1. To assign different expected gain margins at frequency ωg = 5 rad./sec., the PID controllers can be designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); f1=figure; f2=figure; ngrid(’new’) for Am=[2:5] [Gc,Kp1,Ti1,Td1]=gphapid(3,[1,Am,5,4,10],G); G_o=G*Gc; G_c=feedback(G_o,1); figure(f1); step(G_c), hold on; figure(f2); nichols(G_o) end figure(f2); axis([-360,0,-40,40]) and the step responses and Nichols charts of the systems are compared in Figs. 7.21 (a) and (b), respectively.

7.4.2 Internal Model Controller The typical structure of an internal model control (IMC) is shown in Fig. 7.22, in which the effect of all the disturbances acting on the system

268

7. PID Controller Design

40

1.6

Am=2

0 db 30

Amplitude

1.2

Open-Loop Gain (db)

1.4 Am=3

1 0.8 0.6 Am=4 Am=5

0.4

20

1

2

3

4

5 6 Time (secs)

7

8

9

-6 db

-10

-12 db

Am=2 Am=3

-40 -360

10

-3 db

0

-30

0

-1 db

3 db 6 db

10

-20

0.2 0

0.25 db 0.5 db 1 db

-270

(a) step responses

-20 db Am=4 Am=5 -40 db 0

-180 -90 Open-Loop Phase (deg)

(b) Nichols charts

Fig. 7.21. Response comparisons for gain margin assignments d(t) internal model controller y(t) r(t) u(t) ❄ ✲ ✲ Gf ✲ G+ ✲ G(s) ✲ ✲ m





plant model

Gm

❄ ✛ Fig. 7.22. A typical internal model control structure

have equivalently been represented by the signal d(t). In the system structure, Gm (s) is the plant model and G+ (s) is an approximate inverse of Gm (s). The block Gf (s) is assumed to be a low-pass filter, a common choice of Gf (s) is that Gf = 1/(1 + Tf s), where Tf can be designed freely by the user. In general, the internal model controller can be obtained as Gc (s) =

Gf (s)G+ m (s) . 1 − Gf (s)G+ m (s)Gm

(7.42)

By selecting a model Gm (s) = k/(1 + T s) with its inverse written as 1 + sT , k

(7.43)

1 + sT . ks(L + Tf )

(7.44)

G+ m (s) = a PI controller can be found simply as Gc (s) =

If the plant model can be approximated by G(s) = ke−Ls /(1 + T s), one may select a model Gm (s) by taking the first-order Pad´e approximation to the delay term such that Gm (s) =

k 1 − sL/2 . T s + 1 1 + sL/2

(7.45)

7.4 Advanced PID Tuning Methods

269

Then, using the internal model control strategy, a PID controller can be designed as Gc (s) =

(1 + sL/2)(1 + sT ) (1 + sL/2)(1 + sT ) ≈ . ks(L + Tf + sTf L/s) ks(L + Tf )

(7.46)

A MATLAB function imcpid() in Appendix C can be used to design a PI or PID controller for a given first-order plus delay plant model. The syntax of the function is that >> [Gc,Kp,Ti,Td,H]=imcpid(key,vars) where key=2, 3 respectively corresponds to PI and PID control structures, and vars is [k, L, T, N, Tf ]. The returned variables are defined exactly the same as in other functions for PID controller design. Example 7.4.2. Consider again the fourth-order plant model in Example 7.2.1. The IMC-based PI controllers for different values of Tf can be designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); [K,L,T]=getfod(G); Tf=[1:10]; for Tf=[1:10] [Gc,Kp1,Ti1]=imcpid(2,[K,L,T,10,Tf]); G_c=feedback(G*Gc,1); step(G_c), hold on end The obtained closed-loop step responses are shown in Fig. 7.23 (a). Clearly, when

1.2 Tf=2

Tf=3

0.8

0.8

0.6 Tf=10 0.4

0

0.6 Tf=10

0.4

Tf=9

Tf=9

0.2 0

Tf=2

Tf=1

1 Amplitude

Amplitude

Tf=1 1

0.2

5

10

15 20 Time (secs)

(a) PI control

25

30

0

0

5

10

15 20 Time (secs)

25

30

(b) PID control

Fig. 7.23. Closed-loop step responses of internal model controllers Tf increases, the speed of the response becomes slow. Consider the IMC-based PID controller design using the following MATLAB statements: >> for Tf=[1:10] [GcKp2,Ti2,Td2]=imcpid(3,[K,L,T,10,Tf]); G_c=feedback(G*Gc,1); step(G_c), hold on end

270

7. PID Controller Design

The resulted closed-loop system responses are shown in Fig. 7.23 (b). It is obvious that the PID controller for this example may not be as good as the corresponding PI controllers.

7.4.3 Pole Placement Tuning The pole placement technique has been discussed in Chapter 6 where it has been demonstrated that the controllable system may have all its poles arbitrarily assigned through state feedback, such that ideal system responses can be obtained. Similarly, using PI or PID controllers, the specific modes of the system can also be assigned. PI control of a first-order plant. If the process model can be approximated by a first-order model G(s) = k/(1+sT ), one can design a PI controller   1 Gc (s) = Kp 1 + (7.47) sTi to give a second-order closed-loop model Gcl (s) =

G(s)Gc (s) 1 + Gc (s)G(s)

(7.48)

with the closed loop characteristic equation 1 + Gc (s)G(s) = 0 ⇒ s2 +

kKp 1 + kKp s+ = 0. T T Ti

(7.49)

If one wants to place the closed-loop poles such that it is with a damping ratio ζ and a natural frequency ω0 , the desired characteristic equation can be written as s2 + 2ζω0 s + ω02 = 0. Comparing the two equations gives ω02 =

kKp , T Ti

2ζω0 =

1 + kKp T

(7.50)

from which the PI controller can be designed with Kp =

2ζω0 T − 1 2ζω0 T − 1 , Ti = . k ω02 T

(7.51)

PID control of plants with two real poles. Assume that the plant model can approximately be written as G(s) = k/[(1 + sT1 )(1 + sT2 )], where T1 and T2 are real values. An ideal PID controller can be represented by   Kp (1 + Ti s + Ti Td s2 ) 1 . (7.52) Gc (s) = Kp 1 + + Td s = sTi Ti s The characteristic equation of the system can then be written as

7.5 Optimum PID Controller Design

3

s +



1 1 kKp Td + + T1 T2 T1 T2



2

s +



1 kKp + T1 T2 T1 T2



s+

kKp = 0. T1 T2 Ti

271

(7.53)

One may select a suitable closed-loop transfer function denominator (s + αω0 )(s2 + 2ζω0 s + ω02 ) = 0.

(7.54)

With given α, ζ and ω0 , the parameters of the PID controller can be retrieved as follows: Kp =

T1 T2 ω02 (1 + αζ) − 1 T1 T2 ω02 (1 + αζ) − 1 , , Ti = Kp T1 T2 αω03 T1 T2 ω0 (α + 2ζ) − T1 − T2 Td = . T1 T2 ω02 (1 + 2αζ) − 1

(7.55)

PID control of second-order plants. For a second-order plant model G(s) = (b1 s + b2 )/(s2 + a1 s + a2 ), where the poles are assumed to be either real or complex. A PID controller can be represented in a slightly different way as follows:   ki 1 Gc (s) = Kp 1 + + kd s + T d s = Kp + (7.56) sTi s with Ti = Kp /ki , and Td = kd /Kp . Thus, for the closed-loop system, the denominator can be written as s(s2 + a1 s + a2 ) + (b1 s + b2 )(kd s2 + Kp s + ki ) = 0.

(7.57)

If one selects the denominator of the closed-loop system as given in (7.54), the parameters of the PID controller can be set as follows:    a2 b22 −a2 b1 b2 (α+2ζ)ω0 −(b2 − a1 b1 )[b2 (1+2αζ)ω02 +αb1 ω03 ]   Kp =    b32 − b1 b22 (α + 2ζ)ω0 + b21 b2 (1 + 2αζ)ω02 − αb31 ω03    (−a1 b1 b2 + a2 b21 + b22 )αω03 . (7.58) k = i   b32 − b1 b22 (α + 2ζ)ω0 + b21 b2 (1 + 2αζ)ω02 − αb31 ω03      −a1 b22 +a2 b1 b2 +b21 (α + 2ζ)ω0 − b1 b2 ω02 (1 + 2αζ) + b21 αω03    kd = b32 − b1 b22 (α + 2ζ)ω0 + b21 b2 (1 + 2αζ)ω02 − αb31 ω03

Note that from the nominal models in pole-placement control, the model structures are quite restricted since it may not be easy to design a suitable controller when there exists time delays.

7.5 Optimum PID Controller Design Optimum setting algorithms of PID are proposed by Zhuang and Atherton [115] for various criteria. Consider the general form of the optimum criteria

272

7. PID Controller Design

Jn (θ) =





[tn e(θ, t)]2 dt

(7.59)

0

where e(θ, t) is the error signal which enters the PID controller, with θ the PID controller parameters. For the system structure shown in Fig. 7.1, two setting strategies are proposed: one for the set-point input, the other for the disturbance signal d(t). In particular, three values of n are discussed, i.e., for n = 0, 1, 2. These three cases correspond respectively to three different optimum criteria: the integral squared error (ISE) criterion, integral squared time weighted error (ISTE) criterion, and the integral squared time-squared weighted error (IST2 E) criterion [114]. 7.5.1 Set-point Optimum PID Tuning If the plant can be represented by the model in (7.5), the typical PI controller can be empirically represented as  b a1 L 1 T (7.60) , Ti = Kp = k T a2 + b2 (L/T ) where the (a, b) pairs can be obtained from Table 7.5. When the first-order Table 7.5. set-point PI controller parameters range of L/T criterion a1 b1 a2 b2

ISE 0.980 -0.892 0.690 -0.155

0.1 − 1 ISTE 0.712 -0.921 0.968 -0.247

IST2 E 0.569 -0.951 1.023 -0.179

ISE 1.072 -0.560 0.648 -0.114

1.1 − 2 ISTE 0.786 -0.559 0.883 -0.158

IST2 E 0.628 -0.583 1.007 -0.167

approximation to the plant model can be obtained, the PI controller can be designed easily by the direct use of Table 7.5 and (7.60). For the PID controller, its gains can be set as follows:   b3  b L T a1 L 1 , Td = a3 T , Ti = (7.61) Kp = k T a2 + b2 (L/T ) T where for different ratio L/T , the coefficients (a, b) are defined in Table 7.6. Similar to the Ziegler-Nichols tuning technique, here the PID controller design amounts to checking a look-up table, too. To include the derivative action in the output signal, the corresponding PID controller is given by   1 sTd Y (s), (7.62) U (s) = Kp 1 + E(s) − Ti s 1 + sTd /N where the parameters (a, b) should be determined according to Table 7.7.

7.5 Optimum PID Controller Design

273

Table 7.6. set-point PID controller parameters range of L/T criterion a1 b1 a2 b2 a3 b3

ISE 1.048 -0.897 1.195 -0.368 0.489 0.888

0.1 − 1 ISTE 1.042 -0.897 0.987 -0.238 0.385 0.906

2

IST E 0.968 -0.904 0.977 -0.253 0.316 0.892

ISE 1.154 -0.567 1.047 -0.220 0.490 0.708

1.1 − 2 ISTE 1.142 -0.579 0.919 -0.172 0.384 0.839

IST2 E 1.061 -0.583 0.892 -0.165 0.315 0.832

Table 7.7. Set-point PID controller parameters with D in feedback path range of L/T criterion a1 b1 a2 b2 a3 b3

ISE 1.260 -0.887 0.701 -0.147 0.375 0.886

0.1 − 1 ISTE 1.053 -0.930 0.736 -0.126 0.349 0.907

2

IST E 0.942 -0.933 0.770 -0.130 0.308 0.897

ISE 1.295 -0.619 0.661 -0.110 0.378 0.756

1.1 − 2 ISTE 1.120 -0.625 0.720 -0.114 0.350 0.811

IST2 E 1.001 -0.624 0.754 -0.116 0.308 0.813

7.5.2 Disturbance Rejection PID Tuning Sometimes one may want to design disturbance rejection PID controllers, i.e., to design a controller having a good rejection performance on the disturbance signal d(t). The parameters of the PI controller should be set as  b  b T L 2 a1 L 1 Kp = , Ti = (7.63) T T a2 T where the parameters (a, b) are obtained directly from Table 7.8. Table 7.8. Disturbance rejection PI controller parameters range of L/T criterion a1 b1 a2 b2

ISE 1.279 -0.945 0.535 0.586

0.1 − 1 ISTE 1.015 -0.957 0.667 0.552

IST2 E 1.021 -0.953 0.629 0.546

ISE 1.346 -0.675 0.552 0.438

1.1 − 2 ISTE 1.065 -0.673 0.687 0.427

Furthermore, for the PID controller,   b3  b  b L a1 L 1 T L 2 Kp = , Ti = , Td = a3 T T T a2 T T

IST2 E 1.076 -0.648 0.650 0.442

(7.64)

274

7. PID Controller Design

and the (a, b) parameters are determined from Table 7.9. Table 7.9. Disturbance rejection PID controller parameters range of L/T criterion a1 b1 a2 b2 a3 b3

ISE 1.473 -0.970 1.115 0.753 0.550 0.948

0.1 − 1 ISTE 1.468 -0.970 0.942 0.725 0.443 0.939

IST2 E 1.531 -0.960 0.971 0.746 0.413 0.933

ISE 1.524 -0.735 1.130 0.641 0.552 0.851

1.1 − 2 ISTE 1.515 -0.730 0.957 0.598 0.444 0.847

IST2 E 1.592 -0.705 0.957 0.597 0.414 0.850

A MATLAB function optpid() in Appendix C can be used to get the parameters of the PID controller. The syntax of the function is >> [Gc,Kp,Ti,Td,H]=optpid(key,typ,vars) where key =2, 3, 4 for PI, normal PID controllers, and PID controllers with D in feedback path respectively, typ=1, 2 for set-point and disturbance rejection, respectively. The variable vars=[k, L, T, N, C], where C is the criterion type with C=1,2,3 for ISE, ISTE and IST2 E criteria respectively. The returned variables Gc is the cascade controller object, (Kp, Ti, Td) are the PID controller parameters, and H is returned, if key=4, as the equivalent feedback transfer function for the structure with the derivative in the feedback path. Example 7.5.1. Consider the plant model in Example 7.2.1. The optimal PI controllers can be designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); N=10; [k,L,T]=getfod(G); for iC=1:3 [Gc,Kp,Ti,Td]=optpid(2,1,[k,L,T,N,iC]); G_c=feedback(G*Gc,1); step(G_c), hold on, end and the relevant closed-loop step responses are shown in Fig. 7.24 (a). It can be seen that the overshoot of the ISE controller is the largest and its response speed is the fastest. To design PID controllers under different criteria and structures, one may use the following MATLAB statements: >> iC=[1:3,1:3]; iD=[3,3,3,4,4,4]; for i=1:length(iC) [Gc,Kp,Ti,Td,H]=optpid(iD(i),1,[k,L,T,N,iC(i)]); G_c=feedback(G*Gc,H); step(G_c), hold on, end and the closed-loop step responses are obtained as shown in Fig. 7.24 (b). Similar observation can be made from Fig. 7.24 (a).

7.5 Optimum PID Controller Design

1.6

1.5

1.4

ISE criterion ISTE criterion IST2E criterion

D in feedback

IST2E criterion Amplitude

Amplitude

1.2

ISE criterion ISTE criterion

275

1 0.8 0.6

1

ISE criterion ISTE criterion IST2E criterion

0.5

0.4

D in forward

0.2 0

0

2

4

6 8 Time (secs)

10

12

0

14

0

1

(a) PI control

2

3

4

5 6 Time (secs)

7

8

9

10

(b) PID control

Fig. 7.24. Closed-loop step responses of optimal controllers

7.5.3 Gain and Phase Margins Assignment for PID Design If the frequency response of the plant model is given, especially when the crossover frequency ωc and the ultimate gain Kc are known, with Tc = 2π/ωc , three types of PID controllers are summarized in Table 7.10, where κ = kKc is the normalized gain of the plant model. Table 7.10. PID controller parameters for ISTE criterion PID

set-point

Kp

0.509Kc

Ti

0.051(3.302κ + 1)Tc

Td

0.125Tc

disturbance rejection

D in feedback

4.434κ − 0.966 Kc 5.12κ + 1.734 1.751κ − 0.612 Tc 3.776κ + 1.388

4.437κ − 1.587 Kc 8.024κ − 1.435

0.144Tc

0.037(5.89κ + 1)Tc 0.112Tc

For PI controller, however, it can be designed from Table 7.11. It can be seen that, given the first-order model, the PI controller can also be designed easily by the look-up table method.

Table 7.11. PI controller parameters for ISTE criterion PI

set-point

disturbance rejection

Kp

4.264 − 0.148κ Kc 12.119 − 0.432κ

Ti

0.083(1.935κ + 1)Tc

1.892κ + 0.244 Kc 3.249κ + 2.097 0.706κ − 0.227 Tc 0.7229κ + 1.2736

276

7. PID Controller Design

When the relay automatic tuning strategies are used, the oscillation frequency ω0 and the magnitude a0 can be measured. Then, T0 = 2π/ω0 and K0 = 4h/(a0 π). Assume that κ0 = kK0 . The PID controller parameters of different types can then be designed using Table 7.12. Table 7.12. PID controller parameters for ISTE criterion for autotuning PID

set-point

Kp

0.604K0

Ti

0.04(4.972κ0 + 1)T0

Td

0.130T0

disturbance rejection

D on output

6.068κ0 − 4.273 K0 5.758κ0 − 1.058 1.1622κ0 − 0.748 T0 2.516κ0 − 0.505

2.354κ0 − 0.696 K0 3.363κ0 + 0.517

0.15T0 c

0.271κ0 T0 0.1162T0 c

The PI controllers for disturbance rejection can also be obtained with the direct use of Table 7.13. Table 7.13. PI controller parameters for ISTE criterion for autotuning PI

set-point

disturbance rejection

Kp

1.506κ0 − 0.177 K0 3.341κ0 + 0.606

Ti

0.055(3.616κ0 + 1)T0

6.068κ0 − 4.273 K0 5.758κ0 − 1.058 5.352κ0 − 2.926 T0 5.539κ0 5.536

7.5.4 Improved Gain-phase Approach The gain-phase assignment algorithm can be used to design a PID controller by " m cos φ tanφ+ 4/α+tan2 φ Kp = = mKc cos φ, Td = , Ti = αTd (7.65) | G(jωc ) | 2ωc where α = 0.413(3.302κ + 1) or α = 1.687κ0 , and the constants φ and m can be obtained from one of the following two cases: • For the normalized gain κ, φ = 33.8◦ (1 − 0.97e−0.45κ ), m = 0.614(1 − 0.233e−0.347κ ).

(7.66)

• If the frequency and the gain under automatic tuning are measured, the following approach can be used: φ = 33.2◦ (1 − 1.38 e−0.68κ0 ), m = 0.613(1 − 0.262 e−0.44κ0 ).

(7.67)

7.5 Optimum PID Controller Design

277

The MATLAB function optpid() can be used again to solve for the PID controller parameters with the improved gain-phase method. The syntax of the function, for the particular design tasks with this algorithm, is as follows: >> [Gc,Kp,Ti,Td,H]=optpid(key,typ,vars) where vars=[k, L, T, N, Kc , Tc , κ] are the relevant parameters of the plant model. As before, if the value of key is selected as key=4, the effective PID controller, with derivative action in the feedback path, can be designed. Example 7.5.2. Still consider the plant model in Example 7.2.1. The PID controller can be designed using the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); [Kc,pm,wc,wm]=margin(G); Tc=2*pi/wc; kappa=dcgain(G)*Kc; [k,L,T]=getfod(G); N=10; vars=[k,L,T,N,Kc,Tc,kappa]; [Gc,Kp,Ti,Td,H]=optPID(3,1,vars); [Kp,Ti,Td] ans = 6.4134 2.6276 0.3512 >> G_c=feedback(G*Gc,1); step(G_c), figure, ngrid(’new’); nichols(G*Gc); axis([-360,0,-40,40]) and the closed-loop step response and the Nichols chart of the system are obtained as shown in Figs. 7.25 (a) and (b), respectively. It can be seen that the responses are satisfactory, compared with the controllers designed using other approaches. 40

1.2

0 db 30 Open-Loop Gain (db)

Amplitude

1 0.8 0.6 0.4

0.25 db 0.5 db 1 db

20

3 db 6 db

10

-1 db -3 db

0

-6 db

-10

-12 db

-20

-20 db

-30 0

0

1

2

3

4

5 6 Time (secs)

7

(a) step responses

8

9

10

-40 -360

-270

-180 -90 Open-Loop Phase (deg)

-40 db 0

(b) Nichols charts

Fig. 7.25. Responses for the optimal gain/phase margins design

Example 7.5.3. Let us revisit the original Ziegler-Nichols tuning algorithms. We have experienced in Sec. 7.2 that the original Ziegler-Nichols parameter setting formula does not achieve a very satisfactory PID control performance. In this example, we will show, via redesigning PID controller for the plant model in Example 7.2.1, a new Ziegler-Nichols parameter setting procedure can give a much improved performance which is even better than that achieved by the optimum PID parameter setting method. Before applying the original Ziegler-Nichols parameter setting formula, the optimal reduced order model is obtained first to extract the characteristics of the

278

7. PID Controller Design

plant model. Then, with this optimally reduced first-order plus delay model, a PID controller can be designed using the Ziegler-Nichols algorithm. By the following MATLAB statements: >> G=tf(10,[1,10,35,50,24]); Gr=opt_app(G,0,1,1); L=Gr.ioDelay; T=Gr.den{1}(1)/Gr.den{1}(2); K=Gr.num{1}(2)/Gr.den{1}(2); Gc=ziegler(3,[K,L,T,10]); % Ziegler-Nichols PID Gc1=optpid(3,1,[K,L,T,10,2]); % optimum PID step(feedback(G*Gc,1),feedback(G*Gc1,1)) the new Ziegler-Nichols PID controller and the optimum PID controller can be designed with their step responses compared in Fig. 7.26. We can see that the new Ziegler-Nichols parameter setting procedure gives a much improved performance compared with that presented in Example 7.2.1.In fact, this new Ziegler-Nichols PID controller performs even better than the optimum PID controller in terms of step response speed. 1.4 1.2 1 0.8

New Ziegler−Nichols PID

0.6

optimum PID

0.4 0.2 0

0

1

2

3

4

5

6

Fig. 7.26. Step responses comparison of two PID controllers

7.6 A Pseudo Derivative Feedback Control Strategy It was shown in [77] that the PDF (pseudo-derivative feedback) controller has certain advantages over the traditional PID controller. A peudo-derivative feedback control strategy, proposed in [77], is shown in Fig. 7.27. In this section, we will explain this controller and its design in detail. Note that the algorithm introduced in [77] can only be applied to firstand second-order plant models. Xue and Atherton [105] proposed a reduction based PDF controller design technique. The advantage of this control technique is that there is only one control action (the integral action) in the forward loop, also known as “one master”.

7.6 A Pseudo Derivative Feedback Control Strategy r(t)

+ ✲ ✲ - ✻

Ki s

m(t)

+ ✲

✲ G(s)

-✻

279

y(t)



Kp +Kd s

✻ Fig. 7.27. The PDF control strategy

For a second-order plant model given by G0 (s) =

b , s2 + a1 s + a2

(7.68)

the transfer function of the inner loop system is that GI (s) =

s2

b b = 2 . + (a1 + bKd )s + (a2 + bKp ) s + 2ηωn s + ωn2

(7.69)

Thus, if the denominator of the closed-loop system is denoted as   s3 +2ηωn s2 +ωn2 s+bkH Ki =(s+α) s2 +(2ηωn − α)s+ωn2 − α(2ηωn − α) , (7.70) it can be found that   bkH Ki = α ωn2 − α(2ηωn − α) = α3 − 2ηωn α2 + ωn2 α = F(α). (7.71)

To ensure that there is no overshoot for the system, all the poles of the system should be assumed to be real. Thus, from (7.71)   ∆ = (2ηωn − α)2 − 4 ωn2 − α(2ηωn − α) ≥ 0. (7.72)

From the above equation, one obtains αmin ≤ α ≤ αmax where " " 2η + 2 4η 2 − 3 2η − 2 4η 2 − 3 ωn , αmax = ωn αmin = 3 3

with 4η 2 − 3 ≥ 0. Selecting Ki as the maximum allowable value to provide the fastest response yields dF(α) = 3α2 − 4ηωn α + ωn2 = 0, dα

d2 F(α) = 6α − 4ηωn < 0. dα

From the first equation in the above, one can obtain " 1 2η − 4η 2 − 3 ωn α∗ = 3

where it is obvious that α∗ ∈ [αmin , αmax ], and it follows that

(7.73)

(7.74)

280

7. PID Controller Design

 F(α) ωn3  " 2 2 (4η − 3)3 − 16η 3 + 18η . = bkH 27bkH

(7.75)

It can be shown that

" 2ωn3  dKi∗ =− 2η − 4η 2 − 3 dη 9bkH

2

≤ 0.

(7.76)

Thus, to ensure the fastest response and the largest value of Ki∗ , we know that η should be made as small as possible. Therefore, * √ 3 3 ωn3 ∗ = 0.866, and Ki = η= . (7.77) 4 9 bkH Moreover, it can be shown that α∗ = αmin = αmax =



3ωn α∗3 , and Ki∗ = . 3 bkH

(7.78)

Note that all the three poles of the closed loop system are located at −α∗ . So, the step response of the closed loop system can be obtained from Y (s)=

α∗2 α∗3 1 1 α∗ 1 − (7.79) = − − ∗ 3 ∗ 3 kH s(s+α ) kH s kH (s+α ) kH (s+α∗ )2 kH (s+α∗ )

and the output of the system can be found as  1  1 ∗ 1  1− 1− y(t)= α∗2 t2 +α∗ t+1 e−α t = kH 2 kH



  1 2 τ +τ + 1 e−τ (7.80) 2

where τ = α∗ t. To achieve the settling time ts , it requires that y(ts ) = 0.98/kH , which gives τ = 7.5167. It follows that α∗ = 0.5167/ts . The parameters of the PDF controller can be obtained as 1 ∗ 1  ∗2 α∗3 3α − a1 , Kp = 3α − a2 , and Ki = Kd = . (7.81) b b bkH

A MATLAB function get pdf() listed in Appendix C has been prepared to design a PDF controller from a given second-order model in (7.68). The syntax of the function is >> [Kp,Ki,Kd]=get pdf(G, T s, kH) where G is the second order model and Kp, Ki and Kd are the parameters of the PDF controller. For high order plant models, the optimally reduced model is obtained automatically in get pdf() so as to find the parameters of the PDF controller. T s is the expected settling time and kH is the feedback transfer function. Since the actual plant always comes with actuator saturation, we can draw the Simulink model as shown in Fig. 7.28 for the PDF control strategy with a saturator with the upper and lower bounds given by uh and ul respectively.

7.6 A Pseudo Derivative Feedback Control Strategy

2 Out2

pdf_sim.mdl Ki(s) Step

281

num(s)

s

den(s)

Transfer Fcn

Transfer Fcn1

Saturation

1 Out1

Kd*(Kp/10+1).s+Kp Kd/10.s+1 PD controller kH

Fig. 7.28. Simulink model for PDF control strategy

Example 7.6.1. Consider the plant model given by [105] G(s) =

6s3 + 26s2 + 6s + 20 . s4 + 3s3 + 4s2 + 2s + 2

The design objective is to have a closed loop system with a settling time ts = 0.5. Use two model reduction methods to design the PDF controllers and investigate the behavior of the controllers for the original model. The following MATLAB commands can be used to design the PDF controller: >> num=[6 26 6 20]; den=[1 3 4 2 2]; G=tf(num,den); T_s=0.5; kH=1; [Kp,Ki,Kd]=get_pdf(G,T_s,kH); [Kp,Ki,Kd] ans = 17.2721 87.0540 1.0607 Setting the saturation bounds as [−2.5, 2.5], we can issue the following MATLAB statements to simulate the system with and without actuator saturation: >> uh=0.4; ul=-0.4; [t1,x,y]=sim(’pdf_sim’,[0,2]); y1=y(:,1); uh=inf; ul=-inf; [t2,x,y2]=sim(’pdf_sim’,[0,2]); y2=y2(:,1); plot(t1,y1,t2,y2), figure; plot(t1,y(:,2)) The step responses are compared in Fig. 7.29 (a) and the control signal is shown in Fig. 7.29 (b). It can be seen that the PDF control results are satisfactory, although it is designed based on a reduced order model. In fact, we can find and compare the open-loop step responses of the reduced order model and the original one using the following MATLAB commands: >> t=0:.1:10; Gr=opt_app(G,0,2,0) Transfer function: 39.03 --------------------s^2 + 3.701 s + 3.903 >> y=step(G,t); y1=step(Gr,t); plot(t,y,t,y1) The results are compared in Fig. 7.30, from which it can be seen that the open-loop fitting is very poor. Thus, a very accurate reduced model is not necessary for this example.

282

7. PID Controller Design

1.4 0.4

1.2

0.35

1

0.3

0.8

0.25 0.2

0.6 without saturation 0.4

0.15

with saturation

0.1

0.2 0

0.05

0

0.5

1

1.5

2

0

0

(a) step responses

0.5

1

1.5

2

(b) control signal

Fig. 7.29. System responses with PDF control strategy 12

10

second order model

8

original model

6

4

2

0

0

2

4

6

8

10

Fig. 7.30. Open-loop step response comparison

7.7 Control Design for Time-Delay System In real world systems, delay is everywhere. Under the context of process control systems, a time-delay may be defined as the time interval from the application of a control signal to any observable change in the process variable. Generally speaking, delays in systems can be classified into two groups: lumped delays and distributed delays. Examples for systems with lumped delays are transportation processes such as control of coal flow rate on belt, economic systems, computer controlled systems, remote control etc. Heat exchangers and electric transmission lines are examples for systems with distributed delays. For more and detailed examples of systems with time delays, please refer to [33, 51]. Delay differential equations (DDE), initially introduced in the eighteenth century by Laplace and Condorcet[33] , are used to describe dynamic systems with time delays, also known as dead-time or transport-lag which were also studied in terms of difference differential equations in [11]. In general, time-

7.7 Control Design for Time-Delay System

283

delay may have negative impact on control system performance. Time delays have always been among the most difficult problems encountered in process control. It could occur for various reasons and in different magnitudes. In modern digital control systems, time-delay can also arise in the form of sampling intervals, or the inherent polling and waiting states involved in collision avoidance for multiple access field-network systems. To reduce the time-delay effect, the best approach to minimize the delay itself through careful and proper system and industrial engineering. However, in practical implementation, we have various physical, spatial and operational constraints in the system. In particular, in some cases, the delay is intrinsic to the system itself. In view of the above observations, control of time-delay systems represents one important class of problems which has and will continue to pose a strong challenge for control engineers. On the other hand, it should be pointed out that time delay or an artificial delay line may be utilized to achieve a better control performance. The comb filter originally invented in color TV to separate the chromatic signals is a good example, e.g. [56]. In repetitive learning control (RLC)[35] , the delay is used to construct the internal model of periodic disturbances with a known period. In iterative learning control (ILC)[59, 18] , the learning updating law uses the delayed error signals and the delayed control signals (previous trials) to construct the control signal for the present iteration so that improvements along iterations can be expected. To compensate the time delay effect, one of the popular methods is the socalled Smith predictor scheme[91, 50] . In this section, we shall briefly discuss the basic ideas and fundamental limitations of the Smith predictor scheme together with an optimization based design methodology. 7.7.1 Smith-Predictor Control The Smith controller was proposed in [90]. Assume that a model for the process Gp (s) is available which is described by gp0 (s) = gp (s)e−sLo

(7.82)

where gp (s) is a delay-free rational function. The structure of the Smith-predictor controller is shown in Fig. 7.31. In this figure, the following equation regarding the control signal u(t) can be established such that U (s) = Gc (s)[R(s) − Y (s) − gp (s)U (s) + Gc (s)gp (s)e−sL0 U (s)]

(7.83)

where U (s), R(s) and Y (s) are the Laplace transforms of the corresponding signals. With Y (s) = Gp (s)U (s), we can eliminate the control signal U (t) and set up the relationship from the input signal R(s) to the output signal Y (s), thus the transfer function of the overall system can be written as

284

7. PID Controller Design r(t)

y(t)

u(t)

✲ Gc (s) ✲ ✲ ✻ ✻

✲ Gp (s)



❄ gp (s)

❄ ✲ e−sL0





Fig. 7.31. The time-delay compensation by Smith-predictor.

G(s) =

Y (s) Gp (s)Gc (s) . = U (s) 1 + Gc (s)[gp (s) − gp e−sL0 + Gp (s)]

(7.84)

When the plant model is perfect, i.e., gp0 (s) = Gp (s), the closed-loop transfer function between the input r(t) and output y(t) is given by G(s) = G∗ (s) =

Gc (s)gp (s) −Lo s e . 1 + Gc (s)gp (s)

(7.85)

This implies that the characteristic equation is free of the delay so that the primary controller Gc (s) can be designed with respect to gp (s). The achievable performance can thus be greatly improved over a conventional system without the delay-free output prediction. However, one remarkably undesirable feature of the Smith-predictor is that it always retains the poles of the system. This has been shown in [72, 98]. Practical implications of the feature are limitations in the scope of application. The Smith-predictor cannot be applied to unstable and poorly damped systems because the closedloop cannot be stabilized. In the next subsection, we shall introduce, based on [93], an optimal design method for Smith-predictor. 7.7.2 Design Smith-Predictor by Optimal Model Fitting Traditionally, one would design the controller Gc (s) based on the process model gp0 (s). One may tend to believe that the perfect matching between the plant model and the true plant would give the best control results. But this may not be true. We shall show this through the optimal model fitting based Smith-Predictor design. Consider an equivalent representation of the Smith-predictor controller as shown in Fig. 7.32. The distinction of the Smith-predictor system from a single-loop control system is in an additional compensator C(s) in the feedback path with the transfer function, C(s) =

gp (s)(1 − e−sLo ) + 1. Gp (s)

The overall feedback block is given by

(7.86)

7.7 Control Design for Time-Delay System

r(t)



✲ Gc (s)



gp (s) ✛

u(t)

✲ Gp (s)

285

y(t)



C(s) ✛

Ga (s) Fig. 7.32. An equivalent representation of the Smith-predictor controller

Gs (s) = G(s)Gp (s).

(7.87)

When Lo = 0, C(s) = 1, Gs (s) = Gp (s), and with this particular model, Fig. 7.32 becomes a single-loop control system. The Smith “compensated” process is actually the true process itself. Thus, the single-loop control system can be viewed as a particular case of a mismatched Smith system with Lo = 0. In general, Gs (s) may be regarded as the Smith “compensated” process. Under the assumed perfectly-matched condition, i.e., Gp (s) = gp0 (s), we have C(s) =

gp (s) , Gp (s)

Gs (s) = gp (s).

(7.88)

Assume that the time-delay system Gp (s) is described by Gp (s) = Gr (s)e−sL ,

(7.89)

where Gr (s) is a delay-free rational function, under the perfectly-matched condition, Gr (s) = gp (s), L = Lo and C(s) = esLo . This indicates that the compensator C(s) gives a considerable phase lead in the feedback loop, in the form of a deadtime inverse. The total phase advance will increase with an increasing L. It is this compensator C(s) that neutralizes the deadtime of the process. The Smith “compensated” process Gs (s) given by (7.87) is then the delay-free part of the process Gr (s), and the controller may thus be designed directly with Gr (s). The concept of the inherent phase lead compensation in the Smith-predictor structure was discussed in detail by ˚ Astr¨om[2] . With this particular representation, every Smith system has an associated “compensated” process Gs (s), and all the uncertainty is concentrated in this process. The properties of Gs (s) will thus directly affect the achievable closed-loop performance of the Smith system. For example, if the frequency response Gs (jω) shows the first-order process characteristics, then high gains in the controller Gc (s) are permitted, and good closed-loop performance can be expected. On the other hand, if the frequency response Gs (jω) consists of resonant peaks, then the controller Gc (s) has to be considerably detuned for closed-loop stability, and poor performance may be expected. The “compensated” process Gs (s) can thus act as a unifying element in the analysis

286

7. PID Controller Design

and design of the Smith-predictor controller. Furthermore, it provides an indication of when to use the Smith system, and how to make the best use of it. As described above, an assessment of the closed-loop performance can be inferred from the properties of the “compensated” process Gs (s). Some measures, e.g., the bandwidth, the relative degree, the relative gain and the relative deadtime) can be used to give a rough indication of the relative ease the process may be controlled, or equivalently, the achievable closed-loop performance. A more general measure would be based on the entire frequency response of the process. There could possibly be several formulations of the performance measure based on the frequency response. For example, one may want to compare the frequency response of gs with that of a reference model to predict the relative performance. Alternatively, the measure may be based on a determination of the amplitude response attenuation. To illustrate the latter, it is noted that to produce a good achievable closed-loop performance, the process should have low gains, particularly at frequencies where the phase lag/lead is large. Thus, the area enclosed within the Nyquist curve of gs (s) may serve as a suitable numerical indicator of the achievable performance. While such a measure may not necessarily be optimal, it can serve as a quick and useful assessment of the achievable closed-loop performance. Mathematically, it can be described by J(Gs ) =



0

θupp

¯ 2 (θ)dθ, W 2 (θ)G s

(7.90)

¯ s (θ) is the gain of Gs at the phase lag of θ, and W is a phase-weighted where G specification, analogous to the frequency-weighted performance specification in robust control theory. θupp is the upper phase range to compute the integral, and for general control purposes, a suggested value is θupp = −π. The Smith system with “compensated” process Gs,1 (s) is considered to yield potentially better performance than that with “compensated” process Gs,2 (s) if J(Gs,1 ) < J(Gs,2 ). This is an optimal fitting procedure with Smith-predictor in the process loop. Unlike traditional identification techniques, the desired model is one which will yield a more controllable “compensated” process Gs (s), not necessarily the perfect model. Assuming the actual process is known, it is possible to search for this optimal model g˜p0 (s) such that the performance measure J is minimized, i.e., min J(Gs ) = J(Gs |gp0 =˜gp0 ). (7.91) ∀gp0

˜ p (s) = Gp (s), so that it is possible for a mismatched Smith In general, G system to yield a better performance than a perfectly-matched one. Besides, since the single-loop control system can be viewed as a special mismatched ˜ p (s) = gp0 (s) |L =0 , the single-loop conSmith system with Lo = 0, then if G o trol system should yield a better closed-loop performance. Such an exhaustive

7.7 Control Design for Time-Delay System

287

search procedure for the optimal model could be computationally intensive. Alternatively, J can be computed for a set Π of possible models, and among them, the particular one which yields the lowest value of J can be selected, i.e., gp0 = g˜p0 ∈ Π, where min J(Gs ) = J(Gs |gp0 =˜gp0 ).

(7.92)

gp0 ∈Π

˜ p (s), the design of the controller Gc (s) can With the optimally fit model G be carried out based on the Smith “compensated” process Gs (s). In general, Gs (s) does not have a well-defined structure so that frequency response design methods would be more general and appropriate. For the implementation of Gc (s) as PID controllers, off-the-shelves design techniques are available, e.g., the well-known Ziegler-Nichols tuning rules[116] and the ˚ Astr¨om-H¨agglund tuning rules[3] which use one point information on the Nyquist curve. Now we shall present an illustrative example. Example 7.7.1. Consider a high-order process described by Gp (s) = 1/(s + 1)10 . Assume two models for the process are available: a perfect model gp0,1 (s) = Gp (s), and a reduced-order model given by gp0,2 (s) =

1 e−4.47s . (1.94s + 1)3

Note that gp0,2 is matched to Gp at ω = 0 and ω = ωu where ωu is the ultimate frequency of Gp . In the mismatched Smith predictor control system using the reduced-order modeling, the function C(s) provides a significant phase lead in the ultimate frequency range of the process as shown by the Bode plot in Fig. 7.33. The Nyquist plot of 2.5 2 1.5 1 0.5 10-2 200 150 100 50 0 10-2

10-1

100

10-1

100

Fig. 7.33. The Bode plot of C(s)

the “compensated” process Cs (s) with the perfect and reduced-order model are shown in Fig. 7.34 (a). In this case, clearly J(Gs,2 ) < J(Gs,1 ) for any specification

7. PID Controller Design

0.4

1.2

0.2

1

0

2 1

0.8

1

-0.2

imag

2

y,r

288

-0.4

0.6 0.4

-0.6

0.2

-0.8 -1 -1

-0.5

0 real

0.5

1

0 0

50

(a) Nyquist plots

100 150 200 250 300 350 t

(b) step responses

Fig. 7.34. System responses with Smith predictor W used in the performance measure of (7.90), where Gs,1 and Gs,2 are the Smith “compensated” processes associated with gp0,1 and gp0,2 , respectively. Finally, the closed-loop response of the Smith predictor control systems to a set-point change at t = 0, and a 10% load disturbance at t = 200 are compared in Fig. 7.34 (b). For a fair comparison, PID controllers are used in both cases, and they are tuned using the well-accepted ˚ Astr¨ om-H¨ agglund frequency response method[3] . The Smith system employing reduced-order modeling clearly shows a much better performance compared with the perfectly-matched Smith system.

7.8 More Topics on PID Control 7.8.1 Integral Windup and Anti-windup PID Controllers A Simulink model for the study of the phenomenon of integrator windup is shown in Fig. 7.35.

3 Out3

c7fwind.mdl

2 Out2 Kp

Step

Gain

1

num(s)

Ti.s

den(s)

Transfer Fcn

plant

Saturation

1 Out1

Fig. 7.35. Simulink model for integrator windup demonstration

The plant model is given by G(s) = 10/(s4 + 10s3 + 35s2 + 50s + 24), and the parameters for the PI controller is given by Kp = 5.04 and Ti = 1.124.

7.8 More Topics on PID Control

289

With an actuator saturation nonlinear element given by Ui = 3.5, the related signals in the PI controlled system are shown in Fig. 7.36. When there is an initial set-point change in r(t), the error signal is initially so large that 1.5 output y(t) 1 0.5

t1

0

0 1 2 3 4 control signal u(t)

4

5

6

7

8

9

10

5

6

7

8

9

10

5

6

7

8

9

10

2 t2 0 6 4 2 0

0

0

1 2 3 4 integrator output yi(t)

1

2

3

4

Fig. 7.36. Integrator windup demonstration

the control signal u(t) reaches its actuator saturation limit quickly. Even when the output signal reaches the reference value at the time t1 , which gives an negative error signal, due to the large value of the integrator output, the control signal still remains at the saturation value Ui , which makes the output of the system continuously increasing, until it reaches the time t2 , the negative action of the error signal begin to have effect. This phenomenon is referred to as the integrator windup action which is unwanted in control applications. Therefore, we need to briefly introduce different anti-windup PID controllers for use in practice. We shall use Simulink for illustration. An anti-windup PID controller is provided as an icon in Simulink environment and the internal structure is shown in Fig. 7.37. The signal reflecting the actuator saturation is fed into the integrator action, which is determined by a ratio 1/Tt . For instance, one can simulate the PID control system in the previous example using the Simulink model as shown in Fig. 7.38 (a). For different Tt , the output signals are compared in Fig. 7.38 (b). It can be seen that for smaller values of Tt , the windup phenomenon can be reduced more significantly. 7.8.2 Automatic Tuning of PID Controllers An automatic tuning (also known as autotuning or autotuner) PID controller strategy is proposed by ˚ Astr¨om and H¨ agglund [4]. Now the commercial automatic tuning PID controllers are available from most of the hardware manufacturers.

290

7. PID Controller Design

1/Tt Saturation

Anti Windup Gain 1 Ti.s

1 Set point

2 system output

Integrator b

Kp

set point weighting

ModifiedProportional PID action

−Tds Td/N.s+1

1 control signal

c7awpid.mdl

Derivative

Fig. 7.37. Simulink model of an anti-windup PID structure 1.4 Tt=10

1.2

Tt=5

1

c7fpid.mdl 0.8 Sp

Step

num(s)

u y

Saturation

den(s) Transfer Fcn

1 Out1

Auti−windup PID controller

Tt=2 Tt=1 Tt=0.1

0.6 0.4 0.2 0

0

1

2

3

4

5

6

7

8

9

10

(b) the effect of Tt

(a) Simulink model

Fig. 7.38. Effect of anti-windup PI controllers

The structure of the relay type of automatic tuning is shown in Fig. 7.39, and it can be seen that the two modes are alternated by the use of the switching. When the operator feels the need to adjust the parameters of the ✲ uc (t)✲





PID controller relay element

control u(t) ✲

plant

y(t) ✲

tuning

Fig. 7.39. Structure of a relay automatic tuning PID controller

PID controller, he can simply press a button and the process is switched to the tuning mode, and the parameters can be tuned automatically. When this tuning task is completed, the process can be switched back to normal feedback control mode again.

7.8 More Topics on PID Control

291

Under the tuning mode, the system is equivalent to the structure shown in Fig. 7.40 (a), and the typical relay nonlinearity is shown in Fig. 7.40 (b). Several approaches can be used to determine the crossover frequency ωc and h ✛ ✻ uc (t)

✲ e(t) ✲ relay element ✻

u(t)✲

y(t)



plant

✛ (a) relay control block diagram



✲ ✲

✛∆✲ ❄ ✲

(b) typical relay element

Fig. 7.40. Nonlinear model of relay control

the ultimate gain Kc . The describing function approach is the theoretical basis for relay autotuning analysis and the Tsypkin’s method [7] can also be applied as described below. Determining ωc and Kc with the describing function method. In the describing function approach [7], one can approximately represent the static nonlinear element by an equivalent gain in analyzing the so-called limit cycles. Such a gain is referred to as the describing function of the nonlinearity and it is in fact input amplitude dependent. For different nonlinear functions, the describing functions may also be different, and a comprehensive studies on describing functions can be found in [7]. The limit cycle, or oscillation, can be determined approximately by finding the intersection of the Nyquist plot of the plant model with the negative reciprocal of the describing function N (a), as illustrated in Fig. 7.41 (a), which means that the conditions when the oscillation occurs are Im ✻

Im ✻ Re ✲



1 N (a)

Re ✲



G(jω)

(a). determination of oscillations

π∆ − 4h 1 − N (a) (b). describing function of relay

Fig. 7.41. Determination of the magnitude and frequency of oscillations

1 + N (a)G(s) |s=jωc = 0, i.e., G(jωc ) = −

1 . N (a)

(7.93)

The describing function of the system with relay nonlinearity given in Fig. 7.40 (b) is that 4h " 2 N (a) = a − ∆2 − j∆ (7.94) πa2

292

7. PID Controller Design

from which the negative reciprocal of the describing function N (a) is simply −

1 π" 2 π∆ =− a − ∆2 − j N (a) 4h 4h

(7.95)

which is just a straight line as shown in Fig. 7.41 (b). The crossover frequency ωc and the ultimate gain Kc can be obtained. For simplicity, assume that ∆ = 0. Then, the describing function can be simplified to N (a) = 4h/(πa). So, immediately, we have Kc =

4h 2π , Tc = . πa ωc

(7.96)

Determining ωc and Kc with Tsypkin’s method. The describing function method is essentially based on the principle of fundamental harmonic equivalence. Tsypkin’s method, on the other hand, can be used when more accurate analysis of relay systems is required where the higher order harmonics need to be considered apart from the fundamental one. The Fourier series expansion of the square wave signal, which is the output of the relay action, can be written as y(t) =

∞  4h sin nω(t − t1 ) nπ

(7.97)

n=1(2)

where “(2)” in the above equation represents a step of 2, i.e., only odd harmonics are considered since relay function is an odd function. The Fourier series expansion of the output signal can then be written as c(t) =

∞  4h gn sin[nω(t − t1 ) + φn ] nπ

(7.98)

n=1(2)

with gn and φn the magnitude and phase of the plant model, i.e., G(njω) = gn ejφn . If the external input to the system is 0, then x(t) = −c(t), and the switching point satisfies x(t1 ) = δ, x(t ˙ 1 ) < 0. The locus A(ω) can be defined as ∞    VG (nθ) sin(nθ) + UG (nθ) cos(nθ) Re[AG (θ, ω)] = (7.99) n=1(2)



 1 VG (nθ) cos(nθ) − UG (nθ) sin(nθ) Im[AG (θ, ω)] = n

(7.100)

n=1(2)

where G(njω) = UG (nω) + jVG (nω). Assume that t1 = 0. The magnitude and frequency of the limit cycles can be solved from Im[AG (0, ω) + AG (ω∆t, ω)] = −

πδ 2h

(7.101)

7.8 More Topics on PID Control

293

and with the constraints Re[AG (0, ω) − AG (ω∆t, ω)] < 0. If the relay element is symmetrical, then one has Im[AG (0, ω)] = −

πδ . 4h

(7.102)

7.8.3 Control Strategy Selections It has been pointed out in some references such as [5] that the PID type controllers can only be used for plants with relatively small time-delay (or equivalent delays). When the delay constant increases, the PID controller cannot guarantee good responses. In fact, apart from the traditional PID control structure, other control strategies may also be used to deal with such cases. For instance, when the delay term is very large, compared with the time constant of the plant model, a predictor, usually a Smith predictor, can be used to compensate the delay effect. There are also other control strategies which can be used for controller designs. This leaves us a question: in practical applications, what kind of controller structure should be used to design a usable controller for a given plant model? Such a question is well studied in [6], where the normalized parameters τ and κ are introduced, from which different control strategies are suggested as summarized in Table 7.14, where apart from the τ and κ parameters, τ2 and κ2 are also introduced, for the plant model given by G(s) = Kv e−sL /[s(1 + sTv )] with the relations ) 2 sG(s) lim +atan κ22 − 1 1 L s→0 π ) = Kv Kc Tc , and τ2 = τ2 = , κ2 = . (7.103) Tv ωc |G(jωc )| 2π κ22 − 1 It can be seen that Table 7.14, in some sense, can be used as a guide for choosing a suitable controller structure for a given plant model. Problems 1. For the following plant models 1 1 −1.5s + 1 , (b). Gb (s) = , (c). Gc (s) = (a). Ga (s) = (s + 1)3 (s + 1)5 (s + 1)3 design PID (or PI) controllers using different design algorithms in this chapter and compare the closed-loop behaviors of the controlled systems. 2. Find the first-order (with delay) approximations to the plant models given by 12(s2 − 3s + 6) (a). G(s) = , (s + 1)(s + 5)(s2 + 3s + 6)(s2 + s + 2) −5s + 2 e−0.5s (b). G(s) = (s + 1)2 (s + 3)3 using various algorithms discussed in this chapter. Compare the closeness of the approximation using relevant time and frequency domain analysis techniques.

294

7. PID Controller Design Table 7.14. Controller selection from the plant model ranges of τ or κ

no precise control necessary

high noise

τ > 1, κ < 1.5

I control

I+B+C

PI+B+C

PI+B+C

0.6 < τ < 1

I or PI control

I+A

PI+A

PI+A+C or PID+A+C

PI control

PI

PI or PID

PID

τ2 > 0.3, κ2 < 2

P or PI control

PI

PI or PID

PI or PID

τ2 < 0.3, κ2 > 2

PD+E

F

PD+E

PD+E

1.5 < κ < 2.25 0.15 < τ < 0.6 2.25 < κ < 15 τ < 0.15, κ > 15or

precise control needed low low measuresaturation ment noise

A represents forward compensation suggested B represents forward compensation necessary C represents dead-zone compensation suggested D represents dead-zone compensation necessary E represents set-point weighting necessary and F for pole placement

3. Investigate disturbance rejection properties of the controllers designed in Problem 1. Assume that the disturbances are added in the steady-state responses. If any of the controller does not perform well for disturbance rejection, design a new PID controller to improve the disturbance rejection performance and meanwhile check whether the new PID type controller is suitable for set-point control. 4. For different PID controllers, analyze the compensated systems with time and frequency domain tools. When the derivative term in the controller is disabled, what will happen with the control performance? 5. Write a MATLAB function for the design of pole-placement PI or PID controllers and use the designed controllers for the plant model in Example 7.2.1 and explain what will happen. 6. Construct a Simulink model for PID control system structures with the plant model containing a pure delay term. Try to design different PID controllers for the plant models given below: 1 (a). Ga (s) = e−s , (s + 1)(2s + 1) 1 (b). Gb (s) = e−30s , (17s + 1)(6s + 1) s+2 (c). Gc (s) = e−0.1s . (s + 1)(4s + 1) Compare the simulation results with the approximate results when the pure delay term is replaced by a Pad´e approximant, and also try to analyze the system under Smith predictor control.

A. More on Laplace Transformation

In this appendix, a basic Laplace transformation table is given first, from which the Laplace transformation of some other functions can be derived. Emphasis is put on how to use symbolic computation tools, such as The MATLAB Symbolic Toolbox, to obtain Laplace and inverse Laplace transformation via some examples.

A.1 A Table of Basic Laplace Transformations Table A.1. A List of Some Basic Laplace Transformations ID

F (s)

f (t)

0≤t

Comments

1

1 (1 − e−τ s ) s

u(t − τ )

unit step input at t = τ

2

e−τ s

δ(t − τ )

unit impulse at t = τ

1 sn 1 −τ s e s √ π(2n − 1)! 1 2n sn+1/2 1 (s + a)n ω s2 + ω 2 s s2 + ω 2

1 tn−1 (n − 1)!

n is a positive integer

3 4 5 6 7 8

u(t) − u(t − τ )

rectangular signal

tn−1/2 1 tn−1 e−at (n − 1)! sin ωt cos ωt

A.2 Deriving Transformations for Other Functions From Table A.1, the Laplace transformation of some other functions can be derived. For instance, the Laplace transformation of a unit step signal

380

A. More on Laplace Transformation

at t = τ = 0 can be derived using the first row in the Table A.1 which yields L[u(t)] = 1/s. Similarly, the Laplace transformation of the unit impulse function with τ = 0 can be obtained as L[δ(t)] = 1. Using Table A.1, the following inverse Laplace transformation formulae can be derived and the proofs of these formulae are left as problems for the reader through computer programs as briefly introduced in the next section. 1 =e−at s+a  √  √π 1 t = L−1 2 s3/2

1 1 = (1 − e−at ) L−1 s(s + a) a

1 1 L−1 = (e−at − e−bt ) (s + a)(s + b) b−a

s 1 L−1 = (ae−at − be−bt ) (s + a)(s + b) a−b

 (s + d) 1  (d − a)e−at − (d − b)e−bt = L−1 (s + a)(s + b) b−a 

 1 a −bt 1 b −at L−1 e + e = 1− s(s + a)(s + b) ab b−a b−a



(s+d) b(d − a) −at a(d − b) −bt 1 = d− e + e L−1 s(s + a)(s + b) ab b−a b−a

−at −bt 1 e e e−ct = + + L−1 (s+a)(s+b)(s+c) (b − a)(c − a) (c − b)(a − b) (a − c)(b − c)

(s + d) (d − a)e−at (d − b)e−bt (d − c)e−ct = + + L−1 (s+a)(s+b)(s+c) (b − a)(c − a) (c − b)(a − b) (a − c)(b − c)

√ 2 s + a ω a + ω2 L−1 2 sin(ωt + φ), φ = tan−1 = s + ω2 ω a

√ 2 s sin θ + ω cos θ a + ω2 = sin(ωt + θ) L−1 s2 + ω 2 ω "

(α − a)2 +b2 −at s+α b sin(bt+φ), φ=tan−1 = e L−1 (s + a)2 + b2 b α−a

1 1 −1 = 2 (1 − cos ωt) L s(s2 + ω 2 ) ω √

s+α α2 + ω 2 ω α L−1 − cos(ωt + φ), φ = tan−1 = 2 2 2 s(s + ω ) ω ω2 α

−at 1 ω e 1 sin(ωt − φ), φ=tan−1 + √ = 2 L−1 (s+a)(s2 +ω 2 ) a +ω 2 a ω a2 +ω 2

1 1 L−1 = e−at sin bt (s + a)2 + b2 b L−1



(A.1) (A.2) (A.3) (A.4) (A.5) (A.6) (A.7) (A.8) (A.9) (A.10) (A.11) (A.12) (A.13) (A.14) (A.15) (A.16) (A.17)

A.3 Laplace Transformation using Symbolic Toolbox

s+d =e−at cos bt (s + a)2 + b2

" 1 1 L−1 2 e−ζωn t sin ωn 1 − ζ 2 t = " 2 s + 2ζωn s + ωn2 ωn 1 − ζ L−1

381

(A.18) (A.19)

The proofs of some of the equations are easier. For instance, (A.1) can easily be proved from the sixth row in Table A.1 with n = 1 while (A.4) can be directly obtained from (A.1) by partial fraction expansion. In what follows, we will demonstrate how to use The Symbolic Toolbox in MATLAB to perform Laplace and inverse Laplace transformations.

A.3 Laplace Transformation using Symbolic Toolbox The Symbolic Toolbox provided in MATLAB is very useful in performing Laplace and inverse Laplace transformations. Note that The Symbolic Toolbox can perform mixed symbolic and high precision numerical computation for a wide variety of problems. To use the Symbolic Toolbox, the first thing is to declare the symbolic variables using the syms command. If a variable is not declared as a symbol, it is regarded as a conventional MATLAB variable. For instance, by the following MATLAB command: >> syms s t a b c d the variables s, t, a, b, c, d are now symbolic. One thing to note is that in syms command line, there is no comma to separate the variable names. Two functions laplace() and ilaplace() are provided in the Symbolic Toolbox in MATLAB to perform respectively the Laplace and the inverse Laplace transformation for a given function in symbolic form. Example A.3.1. To perform the Laplace transformation for the function e−bt cos(at+ c), the following MATLAB statements can be used: >> syms s t a b c; laplace(exp(b*t)*cos(a*t+c)) ans = ((s-b)*cos(c)-a*sin(c))/((s-b)^2+a^2) Furthermore, the above solution can be transformed into the LATEX-format by the latex() function provided in Symbolic Toolbox of MATLAB, as shown below: >> latex(ans) {\frac {\left (s-b\right )\cos(c)-a\sin(c)} {\left (s-b\right )^{2}+{a}^{2}}} The above result interpreted in LATEX is shown as follows: (s − b) cos(c) − a sin(c) . (s − b)2 + a2

382

A. More on Laplace Transformation

Example A.3.2. To verify the inverse Laplace transformation in (A.10), the following MATLAB statements can be used: >> syms s a b c d; ilaplace((s+d)/((s+a)*(s+b)*(s+c))) ans = 1/(a-b)/(a-c)*exp(-a*t)*d-1/(a-b)/(a-c)*exp(-a*t)*a -1/(b-c)/(a-b)*exp(-b*t)*d+1/(b-c)/(a-b)*exp(-b*t)*b -1/(b-c)/(a-c)*exp(-c*t)*c+1/(b-c)/(a-c)*exp(-c*t)*d >> latex(ans) with the LATEX-form shown below: e−at d e−at a e−bt d − − + (a − b) (a − c) (a − b) (a − c) (b − c) (a − b) e−bt b e−ct c e−ct d − + . (b − c) (a − b) (b − c) (a − c) (b − c) (a − c)

Example A.3.3. Perform the inverse Laplace transformation of the following transfer function model: G(s) =

s4

s3 + 7s2 + 24s + 24 . + 10s3 + 35s2 + 50s + 24

The results can be obtained immediately by the following MATLAB statements: >> syms s; ilaplace((s^3+7*s^2+24*s+24)/(s^4+10*s^3+35*s^2+50*s+24)) ans = 4*exp(-4*t)-6*exp(-3*t)+2*exp(-2*t)+exp(-t) >> latex(ans) ans = 4\,{e^{-4\,t}}-6\,{e^{-3\,t}}+2\,{e^{-2\,t}}+{e^{-t}} The LATEX representation of the solution is given by 4 e−4 t − 6 e−3 t + 2 e−2 t + e−t .

Example A.3.4. Consider the transfer function F (s) = a/(s4 + a4 ). Its inverse Laplace transformation can be performed using the following MATLAB statements: >> syms a s; L=ilaplace(a/(s^4+a^4)) L = a*sum(-1/4*_alpha/a^4*exp(_alpha*t),_alpha=RootOf(_Z^4+a^4)) >> laplace(L) ans = a/(s^4+a^4) The LATEX display of the inverse Laplace transformation is as follows: a



alpha=RootOf ( Z 4 +a4 )

−1/4

alpha e alpha t a4

A.3 Laplace Transformation using Symbolic Toolbox

383

which relies on the root-finding routine to find all the alpha. Clearly, it is not always possible to get a meaningful inverse Laplace transformation for any transfer function symbolically via the MATLAB Symbolic Toolbox.

Example A.3.5. To appreciate the limitations of the purely symbolic computation, let us consider a simple problem which is to find the inverse Laplace transformation of the following transfer function: F (s) =

1 . s5 + 2s4 + 3s3 + 4s2 + 5s + 6

To get the answer, use the following MATLAB statements: >> ilaplace(1/(s^5+2*s^4+3*s^3+4*s^2+5*s+6)) ans = sum(1/42*_alpha*(-1+_alpha)*exp(_alpha*t), _alpha=RootOf(_Z^5+2*_Z^4+3*_Z^3+4*_Z^2+5*_Z+6)) It can be seen that the analytical solution cannot be found, since a 5-th order algebraic function is evolved. The combination of analytical and numerical solutions can be achieved using the vpa() function >> vpa(ans,6) ans = .885062e-1*exp(-1.491797988*t)-.192465e2*exp(-.805786*t)*cos(1.22290*t)+ .152081*exp(-.805786*t)*sin(1.22290*t)+ 1.*i*(.760406e-1*exp(-.805786*t)*cos(1.22290*t)+ .962325e-3*exp(-.805786*t)*sin(1.22290*t))+ 1.*i*(-.760406e-1*exp(-.805786*t)*cos(1.22290*t).962325e-3*exp(-.805786*t)*sin(1.22290*t)).865815e-1*exp(.551685*t)*cos(1.25335*t).616952e-2*exp(.551685*t)*sin(1.25335*t)+ 1.*i*(-.308476e-2*exp(.551685*t)*cos(1.25335*t)+ .432908e-1*exp(.551685*t)*sin(1.25335*t))+ 1.*i*(.308476e-2*exp(.551685*t)*cos(1.25335*t).432908e-1*exp(.551685*t)*sin(1.25335*t)) where 6 is the number of digits requested. With the use of vpa() function, virtually any number of digits are possible. One can safely set it to 100, 1000 or an even bigger integer. Alternatively, the numerical computation has to be used to complement the symbolic result. Using the roots yields >> roots([1,2,3,4,5,6]) ans = 0.5517+ 1.2533i 0.5517- 1.2533i -1.4918 -0.8058+ 1.2229i -0.8058- 1.2229i

384

A. More on Laplace Transformation

Thus, the inverse Laplace transformation can approximately be written as

0.5517 + 1.2533i (0.5517+1.2533i)t 1 e + 0.5987e−1.4918t + 42 −0.4483 + 1.2533i

−0.8058 + 1.2229i (−0.8058+1.2229i)t 0.5517 − 1.2533i (0.5517−1.2533i)t + e e −1.8058 + 1.2229i −0.4483 − 1.2533i −0.8058 − 1.2229i (−0.8058−1.2229i)t + . e −1.8058 − 1.2229i

Alternatively, the pfrac() function, listed in Appendix C and explained in Chapter 4, can be used to get the concise form of the results >> [r,p,k]=pfrac(1,[1,2,3,4,5,6]); r = 0.0885 + 0.0000i -1.4918 -0.1521 -0.8058 + 3.1289 -0.8058 -0.0868 0.5517 + 1.4997 0.5517 -

[r,p]

1.2229i 1.2229i 1.2533i 1.2533i

which can be interpreted as 0.0885e−1.4918t − 0.1521e−0.8058t sin(1.2229t + 3.1289) − 0.0868e0.5517t sin(1.2533t + 1.4997)

Problems 1. Verify (A.9) and (A.11) by hand. 2. Verify (A.1) to (A.19) using the MATLAB Symbolic Toolbox. Obtain their inverse Laplace transformations to check whether the original functions can be recovered. 3. Perform the Laplace transformation for the following f (t): (a). fa (t) =

sin αt , t

(b). fb (t) = t5 sin αt, (c). fc (t) = t8 cos αt,

(d). fd (t) = t6 eαt , (e). fe (t) =

cos αt , t

(f). ff (t) = eβt sin(αt + θ), (g). fg (t) = e−12t + 6e9t . 4. Perform the inverse Laplace transformation for the following F (s): √ √ 1 √ , (b). Fb (s) = s − a − s − b, 2 − a )( s + b) s−a s−a √ , , (d). Fd (s) = √ 2 (c). Fc (s) = ln s−b s(s − a2 )( s + b) . (s − 1)8 3a2 s2 + a2 (e). Fe (s) = 3 , (f). F (s) = , (g). F (s) = ln , g f s + a3 s7 s2 + b2 s2 + 3s + 8 1s+α , (i). Fi (s) = (h). Fh (s) = 08 2s−α i=1 (s + i)

(a). Fa (s) = √

s(s2

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

B.1 Introduction B.1.1 What is CtrlLAB CtrlLAB, a MATLAB based toolkit with an integrated graphical user interface (GUI), is designed by the authors for solving the modeling, analysis and design problems in SISO feedback control systems. CtrlLAB has become a flexible and a powerful tool in both teaching and engineering design with minimized user efforts. It can be used as an companion to this book. CtrlLAB, written and tested under MATLAB v4.2, was first made public in the MathWorks anonymous ftp site as a user contributed MATLAB program. Since then, many useful feedback comments have been received. Over the years, CtrlLAB has been greatly improved. It has already been used as a CAI (computer aided instruction) tool to control courses in many universities worldwide. The latest version of CtrlLAB can also run under other versions of MATLAB, including MATLAB 6.5, the most recent version. It is still freely downloadable from the MATLAB Central http://www.mathworks.com/matlabcentral/index.shtml Currently, CtrlLAB is the most downloaded tool under the control category in the MATLAB Central. The main facilities provided by CtrlLAB are: • • • • • • • •

Model entry, including Simulink model entry; Model display; State space realizations; Model reduction using various algorithms; System analysis in frequency and time domains; Graphical display with figure editing and manipulation; A GUI matrix processor and editor; Many controller design modules such as the model-based approaches (leadlag, LQ optimal, pole-placement, etc); PID parameter setting and PID tuning schemes; and robust controller design approaches (such as LQG, LQG/LTR, H2 , H∞ , etc) are provided.

386

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

B.1.2 Installation and Requirements With the downloaded ctrllab.zip file, unzip it using WinZip or pkunzip software to a directory. Before running CtrlLAB, the directory of CtrlLAB should be added to the MATLAB path. This can be set with the use of File | Set Path manu item in the MATLAB command window. CtrlLAB is written for the PC Windows platform. It should also be able to run on other platforms. Although CtrlLAB has not been fully tested on other platforms, with a MATLAB version newer than 4.2c, the cross platform compatibility will be much better than what was experienced under MATLAB version 4.2c. We believe that under version 6.5, CtrlLAB can run on other platforms with little modification. B.1.3 Execution of CtrlLAB To run CtrlLAB, simply type ’ctrllab’ under the MATLAB prompt, and a graphical user interface with menus will pop up as shown in Fig. B.1. The user has to enter or to define the models first which include the plant, the controller and the feedback element. The default models for the latter two are all unity. The possible time delay may also be specified. With the specified models, the analysis and design tasks can be performed.

Fig. B.1. The graphical user interface of CtrlLAB

Menus and dialog boxes are provided to invoke relevant functions to fulfill the users’ own analysis and design tasks. Note that all the functions provided in CtrlLAB can be accessed through the efficient user friendly GUI. There is no need to call these functions manually. CtrlLAB is designed for linear feedback control system analysis and design by only mouse clicks and numeric-key

B.2 Model Entry and Model Conversion

387

strokes. Great efforts have been made to minimize the user involvement in the analysis and design of feedback control systems.

B.1.4 Copyright and Declaration of CtrlLAB CtrlLAB can be freely distributed “as-is”, i.e., in its unmodified form. Users are free to modify their own copy of CtrlLAB without distributing a modified version or including it in any commercial product. The authors hold the copyright of CtrlLAB in full. In no event will the authors or their Departments be liable for any special, incidental, indirect, or consequential damages of any kind, or damages whatsoever resulting from the use of CtrlLAB.

B.2 Model Entry and Model Conversion B.2.1 Transfer Function Entry To quickly enter a model, by default, the user can click one of the model icons in the block diagram shown in Fig. B.1, and CtrlLAB will check first whether the model exists in the work space or not. If it does not exist, a dialog box shown in Fig. B.2 will appear by default, which allows the user to enter the system model by specifying the numerator and denominator, respectively in the appropriate edit boxes.

Fig. B.2. Dialog box for transfer function model entry

The transfer function model can be entered in two ways. One method is the standard MATLAB vectors in descending orders of the operator s. The second method is by representing the polynomials in a “natural way”. These two methods for representing polynomials are demonstrated in Table B.1. It can be seen that for the factorized polynomials, the s polynomial representation is much more “natural” and simpler than a pure MATLAB expression.

388

B. CtrlLAB — A Feedback Control System Analysis and Design Tool Table B.1. Examples of polynomial representations

Mathematical 2

MATLAB commands

’s’ polynomial s2+5s+4

s + 5s + 4

[1,5,4]

s2 (s + 5)(s2 + 7)

[conv([1,5],[1,0,7]),0,0] s2(s+5)(s2+7)2

1.5s3 (s3 +7s2 +6s+2)12

too complicated

1.5s3(s3+7s2+6s+2)12

B.2.2 Entering Other Model Representations The state space model or zero-pole-gain model can also be entered if the corresponding item from the list box shown in Fig. B.2 is selected. In Fig. B.2, if the menu item pole-zero (for zero-pole-gain model) is selected, the dialog box shown in Fig. B.3 will appear, where the zero-pole-gain

Fig. B.3. Dialog box for zero-pole-gain model entry

model parameters in the corresponding edit boxes can be entered. Then, press the OK button to confirm and return. Internally, a transfer function object will be generated automatically from the user specified zero-pole-gain model. For state-space item, the dialog box is shown in Fig. B.4 where in the corresponding edit boxes, the (A, B, C, D) matrices of the system can be entered. Then, a transfer function object of the block can be generated automatically from the given state space model. B.2.3 More Complicated Model Entry If the system model under study has a more complicated structure such as complex block diagrams or a system containing nonlinearities, the Simulink program should be used to construct the system model. In this case, the user can select the Simulink item from the dialog box shown in Fig. B.2. Then, it will be requested to provide a model name (an internal name) and then the Simulink editing environment will appear as shown in Figs. B.5 (a) and

B.2 Model Entry and Model Conversion

389

Fig. B.4. Dialog box for state space model entry

Sum

1 s

1

Integrator du/dt Derivative

Gain

x’ = Ax+Bu y = Cx+Du State−Space

1 s+1 Transfer Fcn

(s−1) poles(s) Zero−Pole

Simulink

Nonlinear

Double click to call Simulink

(a) model library

(b) model entering window

Fig. B.5. Simulink model entering in CtrlLAB

(b), where Fig. B.5 (a) is the model library from which all the Simulink library models can be accessed. Figure B.5 (b) is a blank Simulink model editing window and the user can start to draw the system model between the input and output ports of the system. Once the model entry process is completed in the Simulink edit window as shown in Fig. B.5 (b), double click Return to CtrlLAB button to return the user system model to CtrlLAB. If the user model in Simulink is nonlinear, the linearized transfer function model of the user system will be created and saved for CtrlLAB use, together with the original Simulink model. A simple nonlinear model entry example in CtrlLAB is shown in Fig. B.6 which uses Simulink to describe the nonlinear part. Note the Return to CtrlLAB button in Fig. B.6 for returning a linearized transfer function object for use with CtrlLAB.

390

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

Fig. B.6. An example of complicated model entry in CtrlLAB via Simulink

B.3 Model Transformation and Reduction B.3.1 Model Display To display the model of a block in Fig. B.1, select Model | Model select in the menu shown in Fig. B.7 or simply click the relevant block button in the main interface as shown in Fig. B.1.

Fig. B.7. Model selecting menu

As an example, consider the transfer function of the plant model given by G(s) =

s3 + 7s2 + 24s + 24 . s4 + 10s3 + 35s2 + 50s + 24

To display the transfer function model of the plant, simply press the G(s) button in the main interface shown in Fig. B.1 and the transfer function model will then be displayed in the Information Display window as shown in Fig. B.8. The displayed model can also be modified in the display window by

B.3 Model Transformation and Reduction

391

Fig. B.8. Transfer function display

pressing the Modify button. Then, the dialog box, shown in Fig. B.2, will be displayed again for model parameter changes. The block model can be displayed in various formats. This can be done by selecting the Model | Model display menu, shown in Fig. B.9, with the transfer function format as the default. Through the Model | Model display |

Fig. B.9. Display format selection

Factorised TF menu item, the transfer function in the factorised format will be displayed as shown in Fig. B.10.

Fig. B.10. Factorised transfer function display format

Moreover, the state space model can be displayed by the Model | Model display | state-space menu item and the result is displayed as demonstrated in Fig. B.11. When the Matrix form button is clicked, the Matrix Processor is activated and the typical window is shown in Fig. B.12. The zero-pole-gain format of the system is displayed by the Model | Model display | Pole-zero menu item which is shown in Fig. B.13.

392

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

Fig. B.11. State space model display format

Fig. B.12. Display via The Matrix Processor

Fig. B.13. Zero-pole-gain display format

If the nonlinear system model is involved, to show the system model, only the linearized model will be displayed as in Fig. B.14. To display the original Simulink model, simply press the Simulink model button. B.3.2 State Space Realizations Different state space realizations can be performed for a given transfer function plant model. This can be done by the Model | Realization menu items shown in Fig. B.15, and an example of the Jordan canonical form of the system is obtained as shown in Fig. B.16, via the Matrix Processor interface.

B.3 Model Transformation and Reduction

393

Fig. B.14. Linearized model display

Fig. B.15. State space realization menu

Fig. B.16. Jordan realization

B.3.3 Model Reduction Reduced order models of the system can also be obtained by the Model | Reduction menu item and the model reduction dialog box will be shown as in Fig. B.17, where various model reduction approaches are implemented such as the continued-fraction approach, the Pad´e method, the Routh method, the dominant mode method, the balanced realization method, the optimal reduction method, the FF-Pad´e method, the modal method, and the optimal Hankel approximation method. For example, if the Pad´e approximation method from the list box of model reduction methods is chosen, the expected order of the reduced model can be specified as in Fig. B.17. The reduced order model is then obtained as shown in Fig. B.18.

394

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

Fig. B.17. Model reduction dialog box

Fig. B.18. Model reduction result via the Pad´e approximation method

To compare the reduced order model with the original model, press Compare responses button in the model display window. Then, a new dialog box pops up for choosing a comparison plot from a list of responses which include the Bode diagrams, Nyquist plots, Nichols charts, as well as the step and impulse responses between the original model and the reduced order model. For instance, the step response comparison and the Bode diagram comparison of the original system and the reduced model via Pad´e approximation method are shown in Figs. B.19 (a) and (b), respectively, where the solid line is for

1

0

0.9 -20

0.8

-40

0.7 0.6

-60 -2 10

0.5

10-1

100

101

102

10-1

100

101

102

0

0.4 0.3

-50

0.2 0.1 0

0

1

2

3

4

5

6

7

8

9

(a) step response comparison

10

-100 -2 10

(b) Bode diagram comparison

Fig. B.19. Comparisons between the reduced order and the original models

the original model and the dotted line is for the reduced order model. It can

B.4 Feedback Control System Analysis

395

be seen that the responses of the two models are quite close. Especially in the step response comparison, the two curves are almost indistinguishable.

B.4 Feedback Control System Analysis Various linear system analysis tasks covered in this book can be performed by the direct use of CtrlLAB. After the model entry for the system as illustrated in Sec. B.2, select Analysis menu in the main interface shown in Fig. B.1. Then, the system analysis menu is shown as in Fig. B.20. In this

Fig. B.20. System analysis menu in CtrlLAB

menu, plots for time domain, frequency domain and root locus analysis can be generated only by mouse clicks. In what follows, some detailed instructions are given. B.4.1 Frequency Domain Analysis The Bode diagram of the system can be obtained by the Analysis | Bode diagram menu item and the results is shown as in Fig. B.21 (a). Via the Options

0

0

-20

-20

-40

-40

-60 -2 10

10-1

100

101

102

-60 -2 10

0

0

-50

-50

-100 -2 10

10-1

100

101

(a) Bode diagram

102

-100 -2 10

10-1

100

101

102

10-1

100

101

102

(b) with asymptotes

Fig. B.21. Bode diagram of a given linear system

396

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

| Show asymptotes sub-menu in the Bode diagram window, the Bode plot asymptotes are drawn together with the exact Bode diagram, as demonstrated in Fig. B.21 (b). The properties of the graphs can be modified by the Options | Plot preference sub-menu in the Bode diagram window, and a dialog box is then provided as shown in Fig. B.22, where some of the details on the graph can

Fig. B.22. Graph properties setting dialog box

be modified such as the boxes, grid, colors etc. Moreover, the open-loop and the closed-loop properties of the plots can also be changed. If a controller model is available, the Combination group with two check boxes allows the user to choose the Compensated as well as the Uncompensated frequency response. For instance, if the user checks the Closed-loop box, the closed-loop Bode diagram can then be obtained as shown in Fig. B.23. 0 -10 -20 -30 -40 -1 10

100

101

102

100

101

102

0

-50

-100 -1 10

Fig. B.23. The modified graph

B.4 Feedback Control System Analysis

397

The Nyquist and Nichols charts can be obtained via the Analysis | Nyquist plot and Analysis | Nichols chart menu items with the results shown in Figs. B.24 (a) and (b), respectively.

0.6

40

0.4

30 Open-Loop Gain (db)

0 db

0.2 0 -0.2 -0.4

0.25 db 0.5 db 1 db

20

-1 db

3 db 6 db

10

-3 db

0

-6 db

-10

-12 db

-20

-20 db

-30 -0.6 0

0.2

0.4

0.6

0.8

1

(a) Nyquist plots

-40

-350

-300

-250 -200 -150 -100 Open-Loop Phase (deg)

-40 db -50 0

(b) Nichols chart

Fig. B.24. Frequency response

The root locus plot can be obtained by using the Analysis | Root locus. For some particular systems, the directly obtained root locus of the system may not be very informative due to the poor automatically chosen plot ranges. In this case, the user can change the axis of the plot via the Options | Zoom | User define menu item on the root locus window and a dialog box is then given as shown in Fig. B.25 (a). The ranges of the x and y axes can be changed

3 2 1 0 -1 -2 -3 -10

-8

(a) zoom dialog box

-6

-4

-2

0

(b) root locus

Fig. B.25. Root locus analysis

until a good display result is obtained. For instance, with the properly chosen

398

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

axes, the more informative root locus of the system can then be redrawn as shown in Fig. B.25 (b). B.4.2 Time Domain Analysis The step and impulse response of the system can be obtained directly from the menu Analysis | Step response, and Analysis | Impulse response, respectively. For instance, the step response of the system can be obtained as shown in Fig. B.26 (a). This step response shown in Fig. B.26 (a) is the closed-loop

0.6

1 0.9

0.5

0.8 0.7

0.4

0.6 0.3

0.5 0.4

0.2

0.3 0.2

0.1

0.1 0

0

0.5

1

1.5

2

(a) closed-loop system

2.5

3

0

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

(b) open-loop system

Fig. B.26. Step response analysis

step response. One can obtain the open-loop step response of the system by selecting the relevant sub-menu item in the Analysis menu and the open-loop step response of the system can then be redrawn in the step response window as shown in Fig. B.26 (b). For nonlinear systems, one can also specify the type of input signals, via the Options | Simulation parameters menu item in the relevant graphics window. A dialog box will appear as shown in Fig. B.27 which prompts the user to specify the input signals as well as the simulation parameters. For instance, when studying the system with the Simulink model, to display the step response of the linearised system and that of the original system, check the Show linearised box and the time response of the system can then be displayed as shown in Fig. B.28. The plot range can also be set by the Options | Plot range menu item on the graphics window. A dialog box, shown in Fig. B.29 (a), prompts the user to select a new plot range. For instance, the user can set a new terminating time at 50, and the new system responses are then obtained as shown in Fig. B.29 (b). Other signal types apart from the step and impulse signals can also be applied. For instance, the user can select square wave, saw tooth wave and sine wave, using the dialog box shown in Fig. B.27. Other parameters such

B.4 Feedback Control System Analysis

399

Fig. B.27. Simulation parameter setting dialog box 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

Fig. B.28. Step responses of nonlinear system before and after linearization 1.2 1 0.8 0.6 0.4 0.2 0

(a) plot range setting

0

5

10

15

20

25

30

35

40

45

50

(b) with a new time range

Fig. B.29. Time range modifications

as the frequency of the signal can also be changed. The time response to a square wave input is shown in Fig. B.30 (a). To display other signals such as

400

B. CtrlLAB — A Feedback Control System Analysis and Design Tool 2

2.5 2

1.5

1.5 1

1 0.5

0.5

0 0

-0.5 -1

-0.5

-1.5 -1 -1.5 0

-2 5

10

15

20

25

30

35

40

45

-2.5 50 0

5

(a) square wave input response

10

15

20

25

30

35

40

45

50

(b) error signal

Fig. B.30. Time response of other signals

the error signal e(t), select Options | Other signals menu item in the graphics window and click the error signal e(t) in the block diagram of the feedback system. The step response of the error signal can then be obtained as shown in Fig. B.30 (b). B.4.3 System Properties Analysis The stability property, gain and phase margins, and the analytical solutions to step and impulse signals can also be obtained through the menu system. For instance, consider the nonlinear system model, the gain and phase margins to the linearised model can be obtained as shown in Fig. B.31, and

Fig. B.31. Gain and phase margins

the analytical solutions to the step response of the system can then be shown as in Fig. B.32.

B.5 Controller Design Examples B.5.1 Model-Based Controller Designs We shall use the phase lead-lag controller design problem as an example to illustrate the controller design for a given plant model via CtrlLAB. The model-based controller design menu is shown in Fig. B.33, and it can be seen that several model-based design algorithms can be selected within the

B.5 Controller Design Examples

401

Fig. B.32. Analytical closed-loop step response

Fig. B.33. System design menu

menu with details discussed in Chapter 6. For instance, with a typical leadlag controller design dialog box shown in Fig. B.34, the user is requested to enter the parameters such as the expected phase margin (γ), the crossover frequency ωc and the steady-state error tolerance Kv .

Fig. B.34. Lead-leg compensator dialog box

Let us try a plant model given by G(s) = 1/[s(s + 1)(0.2s + 1)]. Set the expected phase margin γ = 50◦ and the crossover frequency ωc = 5 rad./sec., and Kv = 100. Then, a lead-lag compensator can be designed as shown in Fig. B.35 (a). With a proper menu selection, the controller can be shown in the factorised form, also shown in Fig. B.35 (a). The Bode diagrams of the system before and after lead-lag compensation can be obtained using the Analysis | Bode diagram menu item, as shown in Fig. B.35 (b).

Via CtrlLAB, it is also very easy to design the LQ optimal controller and the pole-placement controller with either full state feedback or observerbased structures. The straightforward model following controllers can also be designed with CtrlLAB.

402

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

50 Compensated

0

original

-50 -100 10-2

10-1

100

101

102

103

-100 -150

compensated

original

-200 -250 10-2

(a) lead-lag controller

10-1

100

101

102

103

(b) Bode diagram comparison

Fig. B.35. A lead-lag compensator

B.5.2 Design of PID Controllers Consider the PID controller design problem with the plant model G(s) = 10/[(s + 1)(s + 2)(s + 3)(s + 4)] entered via CtrlLAB. By the Design | PID controller menu item, the design menu will appear as shown in Fig. B.36. It can be seen that different PID controller design algorithms have been implemented within CtrlLAB. The “one-shot” sub-menu item in Fig. B.36 means that the

Fig. B.36. Main menu for PID controller design

PID controller can be designed directly from the known plant model with no other extra specification needed. One may design a PID controller using the Ziegler-Nichols algorithm by selecting the menu Design | PID controller | One-shot design | Ziegler-Nichols tuning. This will immediately generate the PID controller as shown in Fig. B.37 (a). Furthermore, the refined ZieglerNichols controller can be designed as also shown in Fig. B.37 (a), when the One-shot design | Refined Ziegler-Nichols menu is selected. By the Analysis | Step response menu item, the closed-loop step responses of the system will be obtained as compared in Fig. B.37 (b) together with the step response of the uncompensated system. Apart from the standard PID controllers, other similar structures such as the P controller, the PI controller, and the PID controller with D in the feedback loop, can also be designed, which can be selected from the Design

B.5 Controller Design Examples

403

1.4 Ziegler-Nichols 1.2

refined Ziegler-Nichols

1 0.8 0.6 0.4

uncompensated

0.2 0

(a) controller parameters

0

2

4

6

8

10

12

14

16

18

20

(b) step response comparison

Fig. B.37. Ziegler-Nichols PID controller

PID controller | Controller type menu item as shown in Fig. B.38. We know that

Fig. B.38. PID controller structures

the PID controller parameter setting is based on the first-order plus delay model. Given a high order plant model, we can select different approaches to fit the original plant model by a standard first-order model with time delay. The fitting algorithms can be selected from the menu shown in Fig. B.39.

Fig. B.39. First-order plus delay model fitting methods

PID type controllers can also be designed with other algorithms using the Specified parameters and Optimum PID menu items as shown in Figs. B.40 and B.41, respectively.

Fig. B.40. PID with specified parameters

404

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

Fig. B.41. Optimum PID controller design

With above different tuning algorithms, PID controllers can be designed with a better performance. For instance, the sub-optimal first-order approximation to the plant model can be obtained using First-order model identification | Optimal reduction menu item, and from which an optimum PID controller can be designed. Using these controllers, the closed-loop step responses are then compared in Fig. B.42. It can be seen that the performance can be 1.4

Ziegler-Nichols Optimum normal PID with freq ident Optimum normal PID

1.2 1 0.8

Optimum PID, with D in feedback

0.6

Refined Ziegler-Nichols 0.4 Original model 0.2 0

0

1

2

3

4

5

6

7

8

9

10

Fig. B.42. Step response comparison of different PID controllers

significantly improved compared with the results from other “one-shot” PID controllers. B.5.3 Robust Controller Design In this section, only the H∞ controller design via CtrlLAB will be demonstrated, although other design problems can also be solved in CtrlLAB. The example we shall use is the double integrator plant model as given in Example 8.3.8. The design sub-menus for the robust controllers can be obtained by selecting the Design | Robust control menu item as shown in Fig. B.43.

Fig. B.43. Robust control design menu

To get an H∞ optimal controller, select the Design | Robust control | H inf optimal menu item with the dialog box shown in Fig. B.44. The user

B.5 Controller Design Examples

405

Fig. B.44. H-norm based dialog box

needs to specify various weighting functions W1 (s), W2 (s) and W3 (s) in the dialog box. To design an H∞ controller for the sensitivity problem, the radio button Sensitivity should be checked such that a new dialog box will appear as shown in Fig. B.45 (a). In Fig. B.45 (a), the expected order and the

(a) dialog box for the sensitivity problem

(b) optimal H∞ controller

Fig. B.45. Robust control design results

natural frequency for the ITAE standard reference model should be entered. For instance, if one selects n = 2 and ωn = 10 rad./sec., an optimal H∞ controller can be designed as shown in Fig. B.45 (b). The Nichols charts and the closed-loop step response of the system can then be obtained as shown in Figs. B.46 (a) and (b), respectively. Other types of robust controllers, such as the H2 controller and the LQG/LTR controllers, can also be designed and analyzed using the menus and dialog boxes with little effort.

406

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

2

40 0 db 30

0.25 db 0.5 db 1 db

20

3 db 6 db

10

1.8 1.6 -1 db

1.4

-3 db

1.2

0

-6 db

-10

-12 db

0.8

-20

-20 db

0.6

1

0.4 -30

0.2 -40

-350

-300

-250

-200

-150

-100

(a) Nichols charts

-40 db -50 0

0

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

(b) closed-loop step response

Fig. B.46. Robust control system analysis

B.6 Graphical Interface Based Tools Two useful graphics based tools are provided in CtrlLAB which can be used to process matrices and figures, respectively. In the following subsections, detailed descriptions to these two programs will be given. B.6.1 A Matrix Processor A matrix processor, MatxProc() is developed which can be used to process and edit matrices and state space models, and perform various kind of matrix analysis in a visual way. The graphical user interface facilities are extensively used to make the Matrix Processor very easy and flexible to use. By typing MatxProc in the MATLAB prompt, a graphical user interface will appear as shown in Fig. B.47. The program can also be called from

Fig. B.47. A matrix processor interface

B.6 Graphical Interface Based Tools

407

within CtrlLAB. In MATLAB, MatxProc() can be called using the format MatxProc(A), where A is a given matrix or just simply MatxProc. The File | New matrix menu can be selected to create a new matrix and a dialog box shown in Fig. B.48 will appear to prompt the user to select from different matrix templates. For instance, if one selects a Hilbert matrix with 3 rows, the matrix will then be created by MatxProc as shown in Fig. B.49.

Fig. B.48. Matrix creating dialog box

Fig. B.49. Creating a new matrix

Various display formats are allowed in the MatxProc(). The user can select the Format menu as shown in Fig. B.50 (a). It can be seen that the user can specify different display precisions (high, normal, or rational), different alignment requirements (left, right, and center), and different truncating thresholds. For instance, the high precision display is given in Fig. B.50 (b), with part of the matrix elements hidden due to the limited size of the win-

408

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

(a) Format menu

(b) high precision display

Fig. B.50. Display formats of a matrix

dow. The hidden part of the matrix can be displayed via the horizontal scroll bar. The matrix in rational number format can also be displayed. A matrix displayed can be analyzed and processed within MatxProc(). For instance, to analyze the matrix, simply select the Analysis menu and the menu appears as shown in Fig. B.51. To get the parameters of the given

Fig. B.51. Matrix analysis menu

matrix, select the Analysis | Matrix parameters menu item and the analysis results will be obtained and displayed in the Information Display window as shown in Fig. B.52. Other analysis tasks such as evaluating the determinant, trace, norm, characteristic polynomial of the matrix can also be performed using the Analysis menu. Matrix manipulation such as matrix inversion and rotation can be performed within MatxProc(). To manipulate the matrix, select the Analysis | Manipulations menu as shown in Fig. B.53 (a). Using the above introduced menu, the inversion of the matrix can easily be obtained as shown in Fig. B.53 (b). Different decompositions for a given matrix can also be obtained, such as the QR decomposition, LU decomposition, singular value decomposition (SVD), etc. The Analysis | Decomposition menu is shown in Fig. B.54 (a), where the U matrix of the Schur decomposition can easily be obtained by

B.6 Graphical Interface Based Tools

409

Fig. B.52. Matrix parameters display

(a) manipulation menu

(b) inverse matrix

Fig. B.53. Matrix manipulations

(a) decomposition menu

(b) U matrix

Fig. B.54. Matrix decompositions

selecting the relevant menu item, and the results are shown in Fig. B.54 (b). Besides, a push button labelled T matrix is added to the GUI which prompts the user to display the other matrix, for example, the T matrix, such that A = UT UT . Matrix function evaluations can be performed within MatxProc() by selecting the Analysis | Matrix evaluation menu and the contents of the menu are displayed in Fig. B.55 (a). When the user selects the Cos(A) function display, then the cosine of matrix A can be obtained as shown in Fig. B.55 (b). A given matrix can be edited using the Edit menu as shown in Fig. B.56 (a). By the Edit | Edit an element menu item, the cursor will be changed to the cross sign, which prompts the user to select a matrix element. Once the user has selected an element to edit, the value of the element will be filled into the edit box for modification, as shown in Fig. B.56 (b). Once the edit process is done, the user can press the Accept button to confirm the change.

410

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

(a) Matrix evaluation menu

(b) cosine function

Fig. B.55. Matrix function evaluations

(a) matrix edit menu

(b) matrix editing interface

Fig. B.56. Matrix editing facilities

The matrix can be shown in other formats as well, such as the TEX-format and the MATLAB format. This is particularly useful in dealing with large and complicated matrices. For instance, the TEX-format of the matrix can be obtained by selecting the Edit | Show in TeX format menu item and the result is as shown in Fig. B.57 (a), while the MATLAB command line format display of the matrix is shown in Fig. B.57 (b).

(a) TEX-format

(b) MATLAB format

Fig. B.57. Matrix display in other formats

B.6 Graphical Interface Based Tools

411

B.6.2 A Graphical Curve Processor The graphics curve processor is not currently an independent MATLAB function. It has been integrated into CtrlLAB. It is mainly used to “decorate” the graphs obtained using CtrlLAB to any degree of complexity. It can be used to do simple things such as to add or remove the grids, to add arrows, to add the floating legends to the graph etc. Most of the figures in this book used this unique Graphical Curve Processor within CtrlLAB. We remark that, although the current version of MATLAB has provided a plot editing toolbar for various graph editing utilities, the Graphical Curve Processor within CtrlLAB has been working similarly and more powerfully with early versions of MATLAB since version 4.2c. The Graphical Curve Processor within CtrlLAB is compatible with MATLAB versons 5.x and 6.x. The ultimate objective is to minimize the user effort in using CtrlLAB. An Option menu has been added to the standard MATLAB graphics window such that some of the useful facilities can be called from this menu which is shown in Fig. B.58 (a). For instance, via the Options | Axis and grid | Boxes 1.2 1 0.8 0.6 0.4 0.2 0

(a) Options menu

0

5

10

15

20

25

30

35

40

45

50

(b) curve without box and grid

Fig. B.58. Graphics Processor menu and results

off and Options | Axis and grid | Grid off menu items, the time response graph will then be changed to the display format shown in Fig. B.58 (b), where the grids and boxes are turned off. Note that, to turn off the grids, we can type grid off within the MATLAB command line. However, our objective here is to avoid such a user involvement. At this point, we remark again, as we said before, that CtrlLAB is designed for linear feedback control system analysis and design by only mouse clicks and some essential numeric-key strokes. Great efforts have been made to minimize the user involvement in the analysis and design of feedback control systems. The Matrix Processor and Graph Processor described in this section are part of these efforts, among other arts.

412

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

To draw several curves together with a common coordinate, select the Options | Axis and grid | Hold on menu item to hold the current graph coordinate and then display another curve on the current plot. This is demonstrated in Fig. B.59 (a). To cancel the hold protection, select the Options | Axis and Grid | Hold off menu item. To locate the specific points on the graph, use the Options | Cursor positions menu item. For instance, the curves with some points selected and marked are shown in Fig. B.59 (b). Furthermore, various legends can be added to the graphs. The Options | Legends menu is shown in Fig. B.60 where one can select to add, move or edit text strings on the graphs, and also to draw lines or lines with arrows on the graph. Two text legends are added on the graph shown in Fig. B.61 (a) and several lines and arrows can be further added on the graph as shown in Fig. B.61 (b). It can be seen that the legends (including lines and arrows) can be added or edited freely using the facilities provided. The user can also remove the legends by selecting Options | Legends | Delete legends menu item to remove an existing legend. The properties of the legends can be modified if the user selects the Legends | Properties menu item, and a dialog box for assigning legend properties will be displayed as shown in Fig. B.62 (a). With proper settings, the modified version of the graph with different fonts, line types will be obtained as shown in Fig. B.62 (b). The user may also change the view window in the graph window by selecting the Options | Zoom menu item as shown in Fig. B.63 (a), which allows the user to change the current coordinates using a mouse. For instance, the user can redefine the range for display by dragging a mouse and the results can then be displayed as shown in Fig. B.63 (b). Moreover, using the Zoom | User defined menu item, a dialog box shown in Fig. B.64 (a) will pop up which allows the user to select a reasonable display range. If the plot range in Fig. B.64 (a) is used, the zoomed output will be displayed as shown in Fig. B.64 (b).

2

1.2

1.8

(31.36,1)

(10.69,0.9829)

1

1.6

(6.464,0.8743)

1.4

0.8 (4.352,0.7242)

1.2 1

0.6

(29.79,0.5)

(4.192,0.4848)

0.8 0.4

0.6

(1.76,0.3216)

0.4

0.2

0.2 0

0

5

10

15

20

25

30

35

(a) graph holding

40

45

50

0

0

5

10

15

20

25

30

35

40

(b) cursor positioning

Fig. B.59. Screen hold and cursor

45

50

B.6 Graphical Interface Based Tools

413

Fig. B.60. Legends menu

1.2

1.2

1

1

0.8

0.8

This is curve 1

0.6

0.6

0.4

0.4

This is curve 2

0.2 0

0

This is curve 1

This is curve 2

0.2

5

10

15

20

25

30

35

40

45

(a) examples of legends

50

0

0

5

10

15

20

25

30

35

40

45

50

(b) examples of arrows and lines

Fig. B.61. Adding more legends on graphs 1.2 1 0.8

Τηισ ισ χυρϖε 1

0.6 0.4

This is curve 2

0.2 0

(a) legend properties dialog box

0

5

10

15

20

25

30

35

40

45

50

(b) modified legends

Fig. B.62. Changing the properties of legends

Problems 1. Use the following plant models to test the previously described analysis and design tasks using CtrlLAB.

414

B. CtrlLAB — A Feedback Control System Analysis and Design Tool

1 0.9 0.8 0.7 0.6 0.5 0.4 2

(a) Zoom menu

4

6

8

10

12

(b) zoomed graphic display

Fig. B.63. Zoom facilities 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0

(a) axis specification dialog box

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5

(b) zoomed graphic display

Fig. B.64. Axis range specifications 50000 , (a). G(s) = (s + 1)(s + 2)(s + 3)(s + 4)(s  + 5)(s   + 6)(s + 7)(s + 8) 2.25 −5 −1.25 −0.5 4  2.25 −4.25 −1.25 −0.25  2 (b). x˙ =  x +   u, y = x1 + 5x2 , 0.25 −0.5 −1.25 −1  2 1.25 −1.75 −0.25 −0.75 0 (c). The DC drive system given in Example 2.4.4. Use both the direct method and the Simulink method to create the system model. 2. Analyze the system matrix in system (b) in the previous problem. Find the norms, determinant, eigenvalues, and the characteristic polynomial of A, and do LU, QR, SVD decomposition of A within CtrlLAB. Find the matrices eA , sin(A) and log(A). 3. Try to reproduce Fig. 4.1 (a) by using the Graphics Processor.

C. MATLAB Functions Developed by the Authors

The following listed MATLAB functions are frequently used throughout this book. Some of the functions are essentially good complements to The Control Systems Toolbox. This appendix can also be regarded as a showcase on how to effectively implement new MATLAB functions for analysis and design of linear feedback systems. A complete set of M-functions developed by the authors for use with this textbook can be downloaded from the “MATLAB Paradise” web site: http://www.matlab-world.com/progs/linfdb funs.zip They are also available for downloading from the MathWorks web site under the “Book Program”. atannyq()

Syntax see page 167

function [x,y,w]=atannyq(G,w) if nargin==1, [x0,y0,w]=nyquist(G); elseif nargin==2, [x0,y0]=nyquist(G,w); end x0=[x0(:) x0(:)]; y0=[y0(:) -y0(:)]; pp=atan2(y0,x0); H=2/pi*atan(x0.^2+y0.^2); x0=H.*cos(pp); y0=H.*sin(pp); if nargout==0, plot(x0,y0); xlabel(’Real Axis’); ylabel(’Imaginary Axis’) else, x=x0; y=y0; end augment()

Syntax see page 107

function [Ga,Xa]=augment(G,cc,dd,X) G=ss(G); Aa=G.a; Ca=G.c; Xa=X; Ba=G.b; D=G.d; if (length(dd)>0 & sum(abs(dd))>1e-5), if (abs(dd(4))>1e-5), Aa=[Aa dd(2)*Ba, dd(3)*Ba; zeros(2,length(Aa)),... [dd(1),-dd(4); dd(4),dd(1)]];

Ca=[Ca dd(2)*D dd(3)*D]; Xa=[Xa; 1; 0]; Ba=[Ba; 0; 0]; else, Aa=[Aa dd(2)*B; zeros(1,length(Aa)) dd(1)]; Ca=[Ca dd(2)*D]; Xa=[Xa; 1]; Ba=[B;0]; end end if (length(cc)>0 & sum(abs(cc))>1e-5), M=length(cc); Aa=[Aa Ba zeros(length(Aa),M-1); zeros(M-1,length(Aa)+1) eye(M-1); zeros(1,length(Aa)+M)]; Ca=[Ca D zeros(1,M-1)]; Xa=[Xa; cc(1)]; ii=1; for i=2:M, ii=ii*i; Xa(length(Aa)+i)=cc(i)*ii; end end Ga=ss(Aa,zeros(size(Ca’)),Ca,D);

bass pp()

Syntax see page 223

function K=bass_pp(A,B,p) n=length(B); a1=poly(p); alpha=[a1(n:-1:2),1];

416

C. MATLAB Functions Developed by the Authors

a=poly(A); aa=[a(n:-1:2),1]; L=hankel(aa); C=ctrb(A,B); K=(a1(n+1:-1:2)-a(n+1:-1:2))*inv(L)*inv(C); bd asymp()

Syntax see page 174

function [wpos,ypos]=bd_asymp(G,w) G1=zpk(G); Gtf=tf(G); if nargin==1, w=freqint2(Gtf.num{1},Gtf.den{1},100); end zer=G1.z{1}; pol=G1.p{1}; gain=G1.k; wpos=[]; pos1=[]; for i=1:length(zer); if isreal(zer(i)) wpos=[wpos, abs(zer(i))]; pos1=[pos1,20]; else if imag(zer(i))>0 wpos=[wpos, abs(zer(i))]; pos1=[pos1,40]; end, end, end for i=1:length(pol); if isreal(pol(i)) wpos=[wpos, abs(pol(i))]; pos1=[pos1,-20]; else if imag(pol(i))>0 wpos=[wpos, abs(pol(i))]; pos1=[pos1,-40]; end, end, end wpos=[wpos w(1) w(length(w))]; pos1=[pos1,0,0]; [wpos,ii]=sort(wpos); pos1=pos1(ii); ii=find(abs(wpos)0, kslp=sum(pos1(ii)); ii=(ii(length(ii))+1):length(wpos); wpos=wpos(ii); pos1=pos1(ii); end while 1 [ypos1,pp]=bode(G,w_start); if isinf(ypos1), w_start=w_start*10; else, break; end end wpos=[w_start wpos]; ypos(1)=20*log10(ypos1); pos1=[kslp pos1]; for i=2:length(wpos) kslp=sum(pos1(1:i-1)); ypos(i)=ypos(i-1)+... kslp*log10(wpos(i)/wpos(i-1)); end ii=find(wpos>=w(1)&wpos0, V=1; cc=vv(ii); else z=G2.z{1}; p=G2.p{1}; for i=1:length(z), ii=find(abs(z(i)-p)0 if real(z(i))>=0, V=2; cc=[cc,z(i)]; break; end, end, end, end kalmdec()

Syntax see page 71

function [Gk,T,K]=kalmdec(G) G=ss(G); A=G.a; B=G.b; C=G.c; [Ac,Bc,Cc,Tc,Kc]=ctrbf(A,B,C); nc=rank(ctrb(A,B),eps*100); n=length(A); ic=n-nc+1:n; [Ao1,Bo1,Co1,To1,Ko1]=... obsvf(Ac(ic,ic),Bc(ic),Cc(ic)); if nc ’); tau=tt(key); Qnum=den; Qden=JJ(key,:); nn=JJ(key,:)-[zeros(1,k),1]; g1=tf(Qnum,Qden); g2=tf(JJ(key,:),nn); Gc=minreal(g1*g2); mncirc()

Syntax see page 169

function [h1,h2]=mncirc(M,N) if nargin==1, N=[1/3,1/4,1/6,1/12]*pi; N=[-N(end:-1:1),N]; elseif nargin==0 M=[1.3,1.4,1.5,2,3]; M=[M, 1./M]; N=[1/3,1/4,1/6,1/12]*pi; N=[-N(end:-1:1),N]; end Mx=[]; My=[]; Nx=[]; Ny=[]; t=[0:pi/30:2*pi]; for i=1:length(M) r=M(i)/(1-M(i)^2); x0=r*M(i); Mx=[Mx; r*cos(t)+x0];

C. MATLAB Functions Developed by the Authors

My=[My; r*sin(t)]; end for i=1:length(N) r=sqrt(1+N(i)^2)/(2*N(i)); x0=-1/2; y0=1/(2*N(i)); Nx=[Nx; r*cos(t)+x0]; Ny=[Ny; r*sin(t)+y0]; end h1=line(Mx’,My’); h2=line(Nx’,Ny’); set([h1;h2],’Color’,’r’,’LineStyle’,’:’); opt app()

Syntax see page 93

function G_r=opt_app(G_Sys,nn,nd,key,G0) GS=tf(G_Sys); num=GS.num{1}; den=GS.den{1}; Td=totaldelay(GS); GS.ioDelay=0; GS.InputDelay=0;GS.OutputDelay=0; if nargin=PAngle & PAngle>=0) xP=xx(2); yP=yy(2); elseif (pi>=PAngle&PAngle>pi/2) xP=xx(1); yP=yy(2); elseif (3*pi/2>=PAngle&PAngle>pi) xP=xx(1); yP=yy(1); else xP=xx(2); yP=yy(1); end xx1=xP; yy1=Kslp*(xx1-pp); if yy1>yy(2) | yy1 2.25 & kappa0.16 & tau1.2 & kappa6, error(’the order is too high’); end

422

C. MATLAB Functions Developed by the Authors

if id==1, M=TypeISys; elseif id==2, M=TypeIISys; n=n-1; else, M=TypeBSys; end dd=M(n,1:n+1).*(wn*ones(1,n+1)).^[0:n]; nn=dd(n+1); if id==2, nn=dd(n:n+1); end G=tf(nn,dd); timmomt()

Syntax see page 75

function M=timmomt(G,k) G=ss(G); C=G.c; B=G.b; iA=inv(G.a); iA1=iA; M=zeros(1,k); for i=1:k M(i)=-C*iA1*B; iA1=iA*iA1; end writepid() is used by PID controllers function [Gc,H]=writepid(Kp,Ti,Td,N,key) H=1; switch key case 1, Gc=Kp; case 2, Gc=tf(Kp*[Ti,1],[Ti,0]); case 3, nn=[Kp*Ti*Td*(N+1)/N,Kp*(Ti+Td/N),Kp]; dd=Ti*[Td/N,1,0]; Gc=tf(nn,dd); case 4, d0=sqrt(Ti*(Ti-4*Td)); Ti0=Ti; Kp=0.5*(Ti+d0)*Kp/Ti; Ti=0.5*(Ti+d0); Td=Ti0-Ti; Gc=tf(Kp*[Ti,1],[Ti,0]); nH=[(1+Kp/N)*Ti*Td, Kp*(Ti+Td/N), Kp]; H=tf(nH,Kp*conv([Ti,1],[Td/N,1])); case 5, Gc=tf(Kp*[Td*(N+1)/N,1],[Td/N,1]); end

ziegler()

Syntax see pages 247 and 250

function [Gc,Kp,Ti,Td,H]=ziegler(key,vars) Ti=[]; Td=[]; if length(vars)==4, K=vars(1); L=vars(2); T=vars(3); N=vars(4); a=K*L/T; if key==1, Kp=1/a; elseif key==2, Kp=0.9/a; Ti=3.33*L; elseif key==3 | key==4 Kp=1.2/a; Ti=2*L; Td=L/2; end elseif length(vars)==3, K=vars(1); Tc=vars(2); N=vars(3); if key==1, Kp=0.5*K; elseif key==2, Kp=0.4*K; Ti=0.8*Tc; elseif key==3 | key==4 Kp=0.6*K; Ti=0.5*Tc; Td=0.12*Tc; end elseif length(vars)==5, K=vars(1); Tc=vars(2); rb=vars(3); N=vars(5); pb=pi*vars(4)/180; Kp=K*rb*cos(pb); if key==2, Ti=-Tc/(2*pi*tan(pb)); elseif key==3 | key==4 Ti=Tc*(1+sin(pb))/(pi*cos(pb)); Td=Ti/4; end end [Gc,H]=writepid(Kp,Ti,Td,N,key);

References

1. K. J. ˚ Astr¨ om. Introduction to Stochastic Control Theory. Academic Press, London, 1970. 2. K. J. ˚ Astr¨ om. Frequency domain properties of Otto Smith regulators. Int. J. Control, 26:307–314, 1977. 3. K. J. ˚ Astr¨ om and T. H¨ agglund. Automatic tuning of simple regulators with specifications on phase and amplitude margins. Automatica, 20(5):645–651, 1984. 4. K. J. ˚ Astr¨ om and T. H¨ agglund. Automatic Tuning of PID Controllers. Instrument Society of America, Research Triangle Park, 1988. 5. K. J. ˚ Astr¨ om and T. H¨ agglund. PID Controllers: Theory, Design and Tuning. Instrument Society of America, 1995. 6. K. J. ˚ Astr¨ om, C. C. Hang, P. Persson, and W. K. Ho. Towards intellegient PID control. Automatica, 28(1):1–9, 1992. 7. D. P. Atherton. Nonlinear Control Engineering — Describing Function Analysis and Design. Van Nostrand Reinhold, London, 1975. 8. D. P. Atherton and P. Borne, editors. Concise Encyclopedia of Modelling and Simulation. Pergamon Press, 1992. 9. M. Axtell and E. M. Bise. Fractional calculus applications in control systems. In Proc. of the IEEE 1990 Nat. Aerospace and Electronics Conf., pages 563–566, New York, USA, 1990. 10. R. Bellman. Dynamic Programming. Princeton University Press, Princeton, NJ, 1957. 11. R. E. Bellman and K. L. Cooke. Differential-Difference Equations. Academic Press, New York, 1963. 12. S. Bennett. Development of the PID controllers. IEEE Control Systems Magazine, 13(2):58–65, 1993. 13. H. W. Bode. Network Analysis and Feedback Amplifier Design. Van Nostrand, Princeton, NJ, 1945. 14. A. Bultheel and M. van Barel. Pad´e techniques for model reduction in linear system theory: a survey. Journal of Computational and Applied Mathematics, 14:401–438, 1986. 15. F. M. Callier and C. A. Desoer. Multivariable Feedback Systems. SpringerVerlag, 1982. 16. C. F. Chen, C. Y. Chang, and K. W. Han. Model reduction using the stabilityequation method and the continued fraction method. International Journal of Control, 32:81–94, 1980. 17. Y. Q. Chen and K. L. Moore. Discretization schemes for fractional order differentiators and integrators. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 49(3):363–367, 2002.

424

References

18. Y. Q. Chen and C. Y. Wen. Iterative Learning Control: Convergence, Robustness and Applications, volume LNCIS-248 of Lecture Notes Series on Control and Information Science. Springer-Verlag, London, 1999. 19. R. Y. Chiang and M. G. Sofanov. Robust Control Toolbox User’s Guide. The MathWorks, 1992. 20. J. F. Claerbout. Fundamentals of Geophysical Data Processing With Applications to Petroleum Prospecting. Blackwell Scientific Publications, http://sepwww.stanford.edu/oldreports/fgdp2/, 1976. 21. E. J. Davison. A method for simplifying linear dynamic systems. IEEE Transactions on Automatic control, 11:93–101, 1966. 22. M. Decoster and A. R. van Cauwenberghe. A comparative study of different reduction methods (Parts 1 & 2). Journal A, 17:68–74;125–134, 1976. 23. L. Dorcak. Numerical models for simulation the fractional - order control systems. In UEF SAV, The Academy of Sciences Institute of Experimental Physics, pages 62–68, Kosice, Slovak Republic, 1994. 24. P. Dorota. Linear Quadratic Control — An Introduction. McGraw Hill, New York, 1995. 25. J. C. Doyle, B. A. Francis, and A. R. Tannerbaum. Feedback Control Theory. MacMillan Publishing Company, New York, 1991. 26. J. C. Doyle, K. Glover, P. P. Khargoneckar, and B. A. Francis. State space solutions to standard h2 and h∞ control problems. IEEE Trans. Automatic Control, 34(8):831–847, 1989. 27. J. C. Doyle and G. Stein. Robustness with observers. IEEE Trans. on Automatic Control, AC-24:607–611, April 1979. 28. W. R. Evans. Graphical analysis of control systems. Trans. AIEE, 67:547–551, 1948. 29. G. E. Forsythe, M. A. Malcolm, and C. B. Moler. Computer Methods for Mathematical Computations. Prentice-Hall, Englewood Cliffs, 1977. 30. D. K. Frederick and M. Rimer. Benchmark problem for CACSD packages. In Abstracts of the Second IEEE Symposium on Computer-Aided Control System Design, Santa Barbara, USA, 1985. 31. J. S. Freudenberg and D. P. Looze. Frequency Domain Properties of Scalar and Multivariable Feedback Systems, volume 104 of Lecture Notes in Control and Information Sciences. Springer-Verlag, Berlin, 1988. 32. K. Glover. All optimal Hankel-norm approximations of linear multivariable systems and their L∞ -error bounds. International Journal of Control, 39:1115– 1193, 1984. 33. H. Gorecki, S. Fuksa, P. Grabowski, and A. Korytowski. Analysis and Synthesis of Time Delay Systems. John Wiley and Sons, PWN-Polish Scientific Publishers, Warszawa, 1989. 34. A. Gruca and P. Bertrand. Approximation of high-order systems by low-order models with delays. International Journal of Control, 28:953–965, 1978. 35. S. Hara, Y. Yamamoto, T. Omata, and M. Nakano. Repetitive control system: a new type servo system for periodic exogenous signals. IEEE Trans. on Automatic Control, 33(7):659–668, 1988. 36. X. H. Hu. FF-Pad´e method of model reduction in frequency domain. IEEE Transactions on Automatic Control, 32:243–246, 1987. 37. M. F. Hutton. Routh approximation for high-order linear systems. In Proceedings of 9th Allerton Conference, pages 160–169, 1971. 38. C. Hwang and Y. Lee. Multi-frequency Pad´e approximation via jordan continued-fraction expansion. IEEE Transactions on Automatic Control, 34:444–446, 1989.

References

425

39. R. E. Kalman. On the general theory of control systems. In Proc. 1st Int. Congress on Automatic Control, pages 481–492, Moscow, 1961. Butterworths, London. Volume 1. 40. R. E. Kalman. Mathematical description of linear dynamical systems. SIAM J. Control, 1(2):152–192, 1963. 41. R. E. Kalman. When is a linear control system optimal? Trans. ASME (J. Basic Eng.) Series D, 86:51–60, March 1964. 42. J. Kautskey, N. K. Nichols, and P. Van Dooren. Robust pole-assignment in linear state feedback. International Journal of Control, 41(5):1129–1155, 1985. 43. V. Kirshnamurth and V. Seshadri. A simple and direct method of reducing order of linear systems using Routh approximations in the frequency domain. IEEE Transactions on Automatic Control, 21:797–799, 1976. 44. P. Lanusse, V. Pommier, and A. Oustaloup. Fractional control system design for a hydraulic actuator. In Proc. of the First IFAC Conference on Mechatronics Systems, Mechatronic’2000, Darmstadt, Germany, 9 2000. 45. C. H. Lubich. Discretized fractional calculus. SIAM J. Math. Anal., 17(3):704– 719, 1986. 46. T. N. Lucas. Some further observations on the differential method of model reduction. IEEE Transactions on Automatic Control, 37:1389–1391, 1992. 47. B. J. Lurie. Three-parameter tunable tilt-integral-derivative (TID) controller. US Patent US5371670, 1994. 48. J. M. Maciejowski. Multivariable Feedback Design. Addison-Wesley, Wokingham, England, 1989. 49. S. Manabe. The non-integer integral and its application to control systems. ETJ of Japan, 6(3/4):83–87, 1961. 50. J. E. Marshall. Control Time-Delay Systems, volume 10 of Control Engineering Series. IEE, London, 1979. 51. J. E. Marshall, H. Gorecki, K. Walton, and A. Korytowski. Time Delay Systems, Stability and Performance Criteria with Applications. Ellis Horwood Limited, West Sussex, England, 1992. 52. The MathWorks. MATLABTM , The Language of Technical Computing, Using MATLAB version 6.1. The MathWorks, June 2001. 53. The MathWorks. Simulink – Model-Based and System-Based Design: Using Simulink version 4.1. The MathWorks, June 2001. 54. D. Matignon. Stability result on fractional differential equations with applications to control processing. In IMACS-SMC Proceedings, pages 963–968, Lille, France, 7 1996. 55. O. Mayr. The Origins of Feedback Control. MIT Press, 1970. 56. G. Melchior. Receiver for PAL color television system. US Patent US03553353, 1971. 57. J. L. Melsa and S. K. Jones. Computer Programs for Computational Assistance in the Study of Linear Control Theory. McGraw-Hill, New York, 1973. 58. K. S. Miller and B. Ross. An Introduction to the Fractional Calculus and Fractional Differential Equations. Wiley, New York, 1993. 59. K. L. Moore. Iterative Learning Lontrol for Deterministic Systems. Advances in Industrial Control. Springer-Verlag, 1993. 60. H. Nyquist. Regeneration theory. Bell Syst. Tech. Journal, 11:126–147, 1932. 61. K. B. Oldham and J. Spanier. The Fractional Calculus. Academic Press, New York, 1974. 62. A. Oustaloup. Linear feedback control systems of fractional order between 1 and 2. In Proc. of the IEEE Symposium on Circuit and Systems, Chicago, USA, 4 1981.

426

References

63. A. Oustaloup. Nouveau syst´eme de suspension: La suspension CRONE. INPI Patent 90 046 13, 1990. 64. A. Oustaloup. La commande CRONE: Commande robuste d’ordre non entie. Edition Hermes, Paris, 1991. 65. A. Oustaloup. La D´ erivation non Enti`ere. HERMES, Paris, 1995. 66. A. Oustaloup, F. Levron, F. Nanot, and B. Mathieu. Frequency band complex non integer differentiator : characterization and synthesis. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 47(1):25–40, 1 2000. 67. A. Oustaloup and B. Mathieu. La Commande CRONE : du Scalaire au Multivariable. HERMES, Paris, 1999. 68. A. Oustaloup, B. Mathieu, and P. Lanusse. The CRONE control of resonant plants: application to a flexible transmission. European Journal of Control, 1(2), 1995. 69. A. Oustaloup, P. Melchoir, P. Lanusse, C. Cois, and F. Dancla. The CRONE toolbox for MATLAB. In Proc. of the 11 th IEEE International Symposium on Computer Aided Control System Design - CACSD, Anchorage, USA, 9 2000. 70. A. Oustaloup, X. Moreau, and M. Nouillant. The CRONE suspension. Control Engineering Practice, 4(8):1101–1108, 1996. 71. A. Oustaloup, J. Sabatier, and P. Lanusse. From fractal robustness to CRONE control. Fractionnal Calculus and applied Analysis, 2(1):1–30, 1999. 72. Z. J. Palmor and Y. Halevi. On the design and properties of multivariable dead time compensation. Automatica, 19:255–264, 1983. 73. I. Petras, L. Dorcak, and I. Kostial. Control quality enhancement by fractional order controllers. Acta Montanistica Slovaca, 2:143–148, 1998. 74. I. Petras, L. Dorcak, P. O’Leary, B. M. Vinagre, and I. Podlubny. The modelling and analysis of fractional-order control systems in frequency domain. In Proceedings of ICCC’2000, pages 261 – 264, High Tatras, Slovak Republic, May 23-26 2000. 75. I. Petr´ aˇs. The fractional-order controllers: Methods for their synthesis and application. J. of Electrical Engineering, 50(9-10):284–288, 1999. 76. I. Petr´ aˇs and L. Dorˇca ´k. The frequency method for stability investigation of fractional control systems. SACTA Journal, 2(1-2):75–85, 1999. 77. R. M. Phalen. Automatic Control Systems. Cornell University Press, Warszawa, 1977. 78. I. Podlubny. Fractional-order systems and fractional-order controllers. In UEF03-94, The Academy of Sciences Institute of Experimental Physics, Kosice, Slovak Republic, 1994. 79. I. Podlubny. The Laplace transform method for linear differential equations of the fractional order. In Proc. of the 9th International BERG Conference, pages 119–119, Kosice, Slovak Republic (in Slovak), 9 1997. 80. I. Podlubny. Fractional Differential Equations. Academic Press, San Diego, 1999. 81. I. Podlubny. Fractional-order systems and PIλ Dµ -controllers. IEEE Trans. Automatic Control, 44(1):208–214, 1999. 82. I. Podlubny, L. Dorcak, and J. Misanek. Application of fractional - order derivatives to calculation of heat load intensity change in blast furnace walls. Transactions of Tech. Univ. of Kosice, 5(5):137–144, 1995. 83. L. S. Pontryagin, V. G. Boltyanskii, R. V. Gamkrelidze, and Y. F. Mischenko. The Mathematical Theory of Optimal Processes. Interscience Publishers, New York, 1962. K. N. Trirogoff (Transl.).

References

427

84. I. Postlethwaite and A. G. J. MacFarlane. A Complex Variable Approach to the Analysis of Linear Multivariable Feedback Systems. Springer-Verlag, Berlin, 1979. 85. A. S. Rao, S. S. Lamba, and S. V. Rao. Routh approximant time-domain reduced order models for single-input single-output systems. Proceedings of IEE, Part D, 125:1095–1063, 1978. 86. H.-F. Raynaud and A. Zerga¨ınoh. State-space representation for fractional order controllers. Automatica, 36:1017–1021, 2000. 87. S. G. Samko, A. A. Kilbas, and O. I. Marichev. Fractional Integrals and Derivatives and Some of Their Applications. Nauka i technika, Minsk, 1987. 88. Y. Shamash. Linear system reduction using Pad´e approximation to allow retention of dominant modes. International Journal of Control, 21:257–272, 1975. 89. S. Skogestad and I. Postlethwaite. Multivariable Feedback Control: Analysis and Design. John Wiley & Sons, 1996. 90. O. J. M. Smith. Closer control of loops with dead-time. Chemical Engineering Progress, 53:217–219, 1957. 91. O. J. M. Smith. A controller to overcome dead time. ISA J., 6:28–33, 1959. 92. G. Stein and M. Athans. The LQG/LTR procedure for multivariable feedback control design. IEEE Trans. on Automatic Control, 32(2):105–114, 1987. 93. K. K. Tan. Towards Autonomous Process Control With Relay-based Feedback Identification. PhD thesis, National University of Singapore, 10 Kent Ridge Crescent, Dec. 1994. 94. K. K. Tan, Q. G. Wang, C. C. Hang, and T. Hagglund. Advances in PID Controllers. Advances in Industrial Control. Springer Verlag, 2000. 95. P. J. Torvik and R. L. Bagley. On the appearance of the fractional derivative in the behavior of real materials. Transactions of the ASME, 51(4):294–298, 6 1984. 96. A. I. G. Vardulakis. Linear Multivariable Control – Algebraic Analysis and Synthesis methods. John Wiley & Sons Ltd., Chichester, England, 1991. 97. L. P. Wang and W. R. Cluett. From Plant Data to Process Control : Ideas for Process Identification and PID Design. Taylor & Francis, Research Triangle Park, 8 2000. 98. K. Watanabe, E. Nobuyama, T. Kitamori, and M. Ito. A new algorithm for finite spectrum assignment of single-input systems with time-delay. IEEE Trans. on Aut. Control, 37(9):1377–1383, 1992. 99. W. M. Wonham. Linear Multivariable Control—A Geometric Approach, volume 101 of Lecture Notes in Economics and Mathematical Systems. Springer-Verlag, Berlin, 1974. 100. S. C. Woon. Analytic continuation of operators - operators acting complex s - time. Applications: From number theory and group theory to quantum field and string theories. Rev. Math. Phys., 11(4):463–501, 1999. 101. D. Xue. Computer-Aided Design of Control Systems With MATLAB. Tsinghua University Press (in Chinese), Beijing, 1996. 102. D. Xue. Model Reduction Techniques and Applications. Lecture Notes of Northeastern University, Shenyang, China, 1996. 103. D. Xue and D. P. Atherton. An optimal model reduction algorithm for linear systems. In Proceedings of American Control Conference, pages 2128–2129, Boston, USA, 1991. 104. D. Xue and D. P. Atherton. BLOCKM – a block diagram modelling interface and its applications. In Proceedings IEEE Symposium on CACSD, pages 242– 249, Napa, California, USA, 1992.

428

References

105. D. Xue and D. P. Atherton. A reduction-based PDF controller design algorithm. In Proceedings of IEEE Conference on Decision and Control, pages 2917–2922, Texas, USA, 1993. 106. D. Xue and D. P. Atherton. A suboptimal reduction algorithm for linear systems with a time delay. Int. J. Control, 60(2):181–196, 1994. 107. D. Xue and Y. Q. Chen. MATLAB/Simulink Based System Simulation Techniques. Tsinghua University Press, Beijing 100084, China, April 2002. 108. D. Xue, A. Goucem, and D. P. Atherton. A menu-driven interface to PCMATLAB for a first course on control systems. Int. J. of Electrical Engineering Education, 28(1):21–33, 1991. 109. C.-C. Yu. Autotuning of PID Controllers : Relay Feedback Approach. Advances in Industrial Control. Springer Verlag, 5 1999. 110. G. Zames. Feedback and optimal sensitivity: Model reference transformations, multiplicative seminorms and approximate inverses. IEEE Trans. on Automatic Control, AC-26(4):301–320, April 1981. 111. P. Zavada. Operator of fractional derivative in the complex plane. Commun. Math. Phys., 192(2):261–285, 1998. 112. Z. Zhang and J. S. Freudenberg. Loop transfer recovery for nonminimum phase plants. IEEE Trans. on Automatic Control, 35(5):547–553, May 1990. 113. K. Zhou. Optimal and Robust Control. Prentice Hall, Upper Saddle River, 1996. 114. M. Zhuang. Computer Aided PID Controller Design. PhD thesis, Sussex University, U.K., 1992. 115. M. Zhuang and D. P. Atherton. Automatic tuning of optimum PID controllers. Proceedings IEE, Pt-D, 140:216–224, 1993. 116. J. G. Ziegler and N. B. Nichols. Optimum settings for automatic controllers. Transactions of ASME, 64:759–768, 1942.

Index

analytical solution, 100–109 analytical solution of linear FODEs, 352 anti-windup controller, 289–290 asymptotes of root locus, 145–146 automatic tuning, 242, 252, 276, 290–292 – describing function method, 291–292 – Tsypkin’s method, 291–292 autonomous system, 46, 105–108, 130 balanced realization, 39–40, 67, 94 bandwidth, 170 Bezout equation, 322 bilinear transformation, 313–315, 330 bisectional algorithm, 80, 332 block diagram, 24–31, 41–47 Bode asymptotes, 173–174 Bode diagram, 172–177, 184 Butterworth standard model, 230–231 closed-loop frequency response, 168–171 closed-loop performance, 287 comb filter, 283 commute, 351 complementary sensitivity function, 81–82, 85 constant N and M circles, 168–169, 171 constant N and M contours, 178 constant ζ and ωn contours, 153–155 control strategy selection, 293–294 controllability, 62–64, 70 – controllability Gramian, 66–67, 79 – controllable canonical form, 36 – controllable index, 64 – controllable staircase form, 62–64 coprime factorization, 321–324 CRONE control, 357 crossover frequency, 354 CtrlLAB, 2, 6, 178, 255, 385–412 – Graphics Curve Processor, 110, 154, 411–412

– Matrix Processor, 406–410 damping ratio, 110, 358 deadtime, 283 descriptor system, 311 detectability, 68–70 Dirac function, 103, 126 direct discretization, 365 distributed delay, 282 disturbance feedforward, 339 dominant damping, 154 dominant poles, 153, 155 effective damping ratio, 170 effective natural frequency, 170 existence of H∞ controller, 325 Fadeev-Fadeeva algorithm, 30 feedback connection, 26–27 FODE’s, 351 fractal robustness, 357 fractional calculus, 350 fractional derivative operator, 350 fractional dynamic systems, 350 fractional integral operator, 350 fractional lead-lag compensator, 362 Fractional order controllers, 354 frequency response, 155–190 frequency template, 359 full information control, 339 gain/phase margins, 141, 180–185 – assignment, 201–207, 241, 266–267, 275–278 γ-iteration, 332 general mixed sensitivity problem, 317 Gr¨ unwald-Letnikov definition, 351 Gramians, 39 H∞ optimal control problem, 311 H2 -norm evaluation – via ˚ Astr¨ om algorithm, 78–79

430

Index

– via Lyapunov equation, 79–80 H∞ -norm evaluation, 80 Hamiltonian matrix, 80, 207, 332 high-order process, 287 Hurwitz criterion, 53–54 impulse function, 106, 126 impulse response, 126–129 indirect discretization, 365 initial conditions, 14, 45, 46, 62, 65, 72, 100, 108, 121, 130–133 integral squared value, 93 integrator windup, 242, 288–289 internal model controller, 241, 267–270 internal stability, 60–62, 309, 319 isodamping lines, 358 ITAE standard model, 229–234, 344–346, 405 iterative learning control, 283 Jordanian realization, 37–39 Kalman decomposition, 51, 70, 73 Kalman filters, 297–299, 301, 304, 306 L1 -norm, 77 L2 -norm, 77 L∞ -norm, 77 Lp -norm, 77 Laplace transformation, 12–13, 379–384 – inverse Laplace transformation, 13, 100, 103 – properties, 12–13, 379–381 – using Symbolic Toolbox, 381–384 linear fractional-order differential equations, 351 linear quadratic problems, 207–214 linearization, 41–47, 388–392 loop-shaping, 196 lumped delay, 282 Lyapunov equation, 58, 66, 79 Lyapunov stability criterion, 58–59 Markov parameters, 76 Matrix Processor, 385, 391 minimum realization, 26, 40–41, 72–74 Mittag-Leffler function, 352 Mittag-Leffler function in two parameters, 353 mixed stability and performance problem, 317, 325 model conversion, 29–41 – state space to transfer function, 30–31

– state space to zero-pole-gain, 31–32 – transfer function to state space, 33–41 – zero-pole-gain to state space, 32 model fitting, 251–253 model mismatch, 284 model reduction, 67, 85–97, 251, 255, 385, 393–395, 404 natural frequency, 110, 358 Nichols charts, 177–180, 184 non-minimum phase model, 141, 185–186, 234, 254, 307, 321, 323–324 observability, 65–66, 70 – observability Gramian, 66–67 – observable canonical form, 36–37 – observable staircase form, 65–66 observer, 214–218 observer-based controller, 193, 220, 227–229 one degree-of-freedom controller, 3 optimal model fitting, 284 optimal reduction method for time-delays, 93 Oustaloup recursive approximation, 374 output estimation, 339 overshoot, 113, 196, 199, 203, 204, 230, 231, 243, 246, 258–260, 262, 263, 274, 327 Pad´e approximation, 88, 90–294 – for delays, 93 Pad´e approximation, 99, 138 parallel connection, 25–26 partial fraction expansion, 100–105, 127, 381 partial pole placement, 225–226 PDF controller, 278–282 peak value, 78, 113, 171, 179, 321 phase lag, 197–199 phase lead, 194–196 phase lead/lag, 199–207 PIλ Dµ Controller, 361 PID control, 241–294 – Chien-Hrones-Reswick algorithm, 258–260 – Cohen-Coon algorithm, 260–261 – gain phase margin assignment, 266–267 – improved gain phase approach, 275–278

Index – internal model control, 268–270 – modified Ziegler-Nichols formula, 255–258 – optimum setting, 271–278 – pole placement, 270–271 – predictive PI tuning, 264–266 – refined Ziegler-Nichols formula, 261–263 – Ziegler-Nichols formula, 246–249 PID controller, 278 pole placement, 5, 193, 222–229, 241, 270–271, 293, 323, 385, 401 – Ackerman algorithm, 223 – Bass-Gura’s algorithm, 222–223 – robust assignment, 223 pole-zero cancelation, 40, 61, 72, 234 pole-zero excess, 14, 320, 324 positive-definite, 53, 54, 58, 296–298, 325 prefilter, 356 pseudo-derivative feedback, 278 recursive method, 78, 89 relative stability, 57–58 relay nonlinearity, 276, 290, 292 repetitive learning control, 283 Riccati equation, 208, 301, 325, 335 – algebraic, 208, 213, 297–298 – differential, 208, 213 Riemann-Liouville definition, 351 rise time, 113 robust oscillatory mode , 358 root locus, 142–155 Routh approximation, 88 Routh criterion, 53–58 – applications, 57–58 – Routh table, 54–57 Runge-Kutta algorithm, 131–132 second-order system – Bode diagrams, 172–173 – Nyquist plots, 159–160 – root locus, 142–145 – time response, 109–115 semidifferential equations, 353 sensitivity function, 81–83 sensitivity problem, 317, 319–324, 344–347 separation principle, 298–299 series connection, 11, 24–25 settling time, 113 similarity transformation, 35–36, 70, 73 Simulink, 41–47, 388–389

431

singular matrix, 35, 60, 223, 311, 337 singular system, 311 singular value decomposition, 408 small gain theorem, 308–309 Smith-Predictor, 283 stability, 88 stability equation method, 90 stability margin, 83–85 – guaranteed, 84–85 stabilizability, 67–68, 70 stable minimum-phase fitting, 370–373 standard H∞ problem, 311 state augmentation, 105–108, 116, 129 state feedback, 67–68, 208, 219–220, 222–224, 226 state space model, 18–22 state transition matrix, 100, 105, 109 steady-state, 76, 156, 294 steady-state error, 139, 202, 243, 249, 261 steady-state value, 112, 113, 117–119, 252 step function, 115–116 step response, 115–126 step size, 129 superposition principle, 51, 130 system augmentation, 308, 310, 315–319, 326, 334 Taylor series, 74–76 theoretically optimal loop response, 354 TID control, 354, 355 Tilt compensator, 355 Tilted proportional and integral control, 354 time delay, 93 time moment, 74–75 time response, 99–138 – impulse response, see impulse response – step response, see step response – with arbitrary inputs, 129–135 time-delay, 283 transfer function, 13–17 transmission zeros, 32–33 two degree-of-freedom controller, 2 two-port state space, 311, 318, 324–326, 332, 336, 339 uncertainty, 83 – additive uncertainty, 83, 84, 309 – multiplicative uncertainty, 83, 84, 310 – structured uncertainty, 83

432

Index

– unstructured uncertainty, 83, 309–310 variable step size, 132 weighting function, 93, 296, 300, 303, 315–321, 325, 332, 339–347, 405 weighting matrix, 207–209, 211–214, 220, 296, 303, 306

well-posedness, 60, 309 Youla parameterization, 319 zero initial conditions, 131 zero input response, 130 zero-pole-gain model, 22–24 zooming, 121, 397–412

About the Authors

433

About the Authors

Dingy¨ u Xue received his BSc, MSc and D Phil from Shenyang Polytechnic University, P. R. China in 1985, Northeastern University, PRC in 1988 and Sussex University, UK in 1992, respectively. He has been in the faculty of Department of Automatic Control since 1993 and was promoted to a full Professor in 1997, Northeastern University where he is now the Director of Institute of AI and Robotics. He also took up research posts in Sussex University, UK, National University of Singapore, University of Walse Swansea and University of Sheffield. He is now the Fellow of System Simulation Society of China (SSSC), vice-director of Education Committee of SSSC, President of Liaoning Provincial System Simulation Association. From 1988, while he was doing research work towards a D Phil in Sussex University, UK, he began utilizing MATLAB as the main tool and developed several commercial programs using MATLAB, namely, the Control Kit, BlockM and Reduct. Especially, since he took up the post in Northeastern University, he concentrated on the reform of the course of computer aided control systems design and introduced MATLAB as the main tool in the course. The book “Computer aided control systems design using MATLAB” by Tsinghua University Press in 1996 has been acknowledged as the first thorough introduction to MATLAB in conjunction with control systems in China. A series of books on the topic has been published in Tsinghua University Press since and earned the author good reputation among the Chinese readers world wide. The book has been cited by quite a lot of books and journal papers in China. Three other books have been published in Tsinghua University Press since then. The major research interest of Professor Xue covers the areas of CACSD, systems simulation, system modelling and identification. He has published many papers and books and developed a freely downloadable MATLAB based feedback control systems analysis and design tool — CtrlLAB, which was also documented and exclusively used in this book. E-mail: xue [email protected]; URL: http://www.matlab-world.com/index e.htm.

434

About the Authors

YangQuan Chen received his B.Eng. in Industrial Automation from University of Science and Technology of Beijing (USTB) in 1985 and his M.Eng. in Automatic Control from Beijing Institute of Technology (BIT) in January 1989. In the periods 87.7-87.10 and 87.10-88.6, he visited the Space Research Corporation (SRC, Brussels, Belgium) and was invited to BIT, respectively, as a guest researcher for flying vehicle projects. From 1987 to 1995, he had been with the Department of Electrical Engineering of Xi’an Institute of Technology (XIT). He had served as a Dept. Head since 1992 and an Associate Professor since 1994 in XIT. He received a number of national ministerial-level awards for his excellence in teaching and academic research in China. Since May 1995, he had been a PhD candidate in the School of EEE, Nanyang Technological University (NTU), Singapore and he received his PhD in July 1998. Since Jan. 1996, he joined the Dept. of Electrical Engineering, National University of Singapore (NUS) as a Research Engineer and then a Professional Officer in the Center for Intelligent Control. Dr Chen joined Singapore Science Park Design Center, Seagate Technology International in 1999 for servo product design of ultra low cost hard disk drives (U8, U10, U6-series). In Seagate, Dr Chen filed 16 patent disclosures with one granted US Patent, 13 pending US Patents and a couple of Seagate Patent Awards. He also authored more than 50 archived technical reports in various aspects of disk drive control. Since Sept. 2000, Dr Chen joined the Center for Self-Organizing and Intelligent System (CSOIS), Electrical and Computer Engineering Dept. of Utah State University (USU) as a Research Assistant Professor where he teaches graduate and upper level undergraduate courses while leading the Sensing and Perception Group for the ODIS (omnidirectional inspection system) project. Since July 2002, Dr Chen joined the tenure track faculty in USU. Dr Chen authored over 100 academic papers plus numerous technical reports. His latest research monograph is ”Iterative Learning Control: Convergence, Robustness and Applications” (Lecture Notes Series in Control and Information Science, Springer-Verlag, 1999). His current research interests include autonomous navigation and intelligent control of unmanned ground vehicle, real-time distributed computing, machine vision network, information fusion, iterative/repetitive/adaptive learning control and most recently fractional order calculus in control. Dr Chen is a Senior Member of IEEE and an Associate Editor in the Conference Editorial Board of Control Systems Society of IEEE. E-mail: [email protected] URL’s: www.ece.usu.edu and

www.crosswinds.net/~yqchen