FRACTIONAL ORDER MODELING AND CONTROL: DEVELOPMENT OF ANALOG STRATEGIES FOR PLASMA POSITION CONTROL OF THE STOR-1M TOKAMAK by Shayok Mukhopadhyay A thesis submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in Electrical Engineering Approved: Dr. YangQuan Chen Major Professor Dr. Donald Cripps Committee Member Dr. Ajay Singh Committee Member Dr. Byron R. Burnham Dean of Graduate Studies UTAH STATE UNIVERSITY Logan, Utah 2009 ii Copyright © Shayok Mukhopadhyay 2009 All Rights Reserved iii Abstract Fractional Order Modeling and Control: Development of Analog Strategies for Plasma Position Control of the STOR-1M Tokamak by Shayok Mukhopadhyay, Master of Science Utah State University, 2009 Major Professor: Dr. YangQuan Chen Department: Electrical and Computer Engineering This work revolves around the use of fractional order calculus in control science. Techniques such as fractional order universal adaptive stabilization (FO-UAS), and the fascinating results of their application to real-world systems, are presented initially. A major portion of this work deals with fractional order modeling and control of real-life systems like heat flow, fan and plate, and coupled tank systems. The fractional order models and controllers are not only simulated, they are also emulated using analog hardware. The main aim of all the above experimentation is to develop a fractional order controller for plasma position control of the Saskatchewan torus-1, modified (STOR-1M) tokamak at the Utah State University (USU) campus. A new method for plasma position estimation has been formulated. The results of hardware emulation of plasma position and its control are also presented. This work performs a small scale test measuring controller performance, so that it serves as a platform for future research efforts leading to real-life implementation of a plasma position controller for the tokamak. (167 pages) iv To my family and friends for making my life a pleasurable experience. v Acknowledgments I would like to thank my advisor, Dr. Chen, for his ideas and guidance. Without his motivation and insight this work would have been impossible. He always answered my questions and helped me out when I was stuck with a problem. I would like to thank the Utah Science Technology and Research Initiative (USTAR), the Electrical and Computer Engineering (ECE) Department, Utah State University (USU), and Dr. Chen for their support which made this work possible. I would like to thank my committee members: Dr. Cripps for his comments; and Dr. Singh for explaining the basics of plasma physics, the operation of the tokamak, helping with practical work in the plasma physics lab, and answering my questions. I would also like to thank Professor Farrell Edwards for providing me the opportunity to work on this project and helping me understand its scope and aim. He is the person responsible for making this work take shape. I would like to thank Jared Bench for bringing me up to speed initially, getting me familiarized with the tokamak, and also explaining the details about the various electrical systems. I would like to thank Jeremy Bishop for answering all my practical, as well as theoretical, questions during my work at the plasma physics lab and helping me out on my projects; Heidi Johnson for helping me out on some of the physics; and Tom Apedaile for his help with some of the practical hands-on work on the tokamak. I would like to thank Dr. Yan Li for being my fractional calculus mentor and also being a very good friend who was always ready to help me with my problems. Understanding fractional calculus would have been a monumental task without him. I would like to thank Calvin Coopmans for his help with the fractional order controller and model boards. Without his hardware expertise none of the experiments would have seen light of day. I would like to thank Yiding Han for the countless late night rides back home, which helped me a lot; Hu Sheng for his help with the fan and plate experiments; Amin Hernandez for his help with one of the controller boards; and Justin Hamm for my great new computer. I would like to thank all the other members of CSOIS for making my time here enjoyable, and vi the members of the Applied Fractional Calculus (AFC) reading group for creating a solid platform to discuss ideas. The constructive criticism obtained from the members greatly helped me with my problems encountered during the course of this work. I would like to thank Dr. Chen again for guiding me through my ECE 6930 independent study course in fractional calculus, which formed the backbone for this work, and also Varsha Bhambhani for her notes on the subject. Dr. Bruce J. West’s visit to CSOIS, USU, organized by Dr. Chen and the ECE Department, deserves commendation since it provided me with new perspectives towards fractional calculus. Finally, I would like to thank my family for always standing by my decisions and having faith in me, and my fiancée for being infinitely patient. Shayok Mukhopadhyay vii Contents Page Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi 1 Introduction . . . . . . . . . . . . . . . . . . . 1.1 Motivation . . . . . . . . . . . . . 1.2 Literature Review . . . . . . . . . 1.3 Contribution and Organization . . . . . . .... . . . . . . . . . .... . . . . . . . . . ..... . . . . . . . . . . . . .... . . . . . . . . . .... . . . . . . . . . . . . . .... . . . . . . . . . ... . . . . . . 1 1 2 3 2 Fractional Order Calculus in Controls: A First Glance . . . . . . . . . . . 2.1 Fractional Order PID Controllers: An Overview . . . . . . . . . . . . . . 2.2 Fractional Order Universal Adaptive Stabilization (FO-UAS) . . . . . . 2.2.1 Mathematical Preliminaries . . . . . . . . . . . . . . . . . . . . . 2.2.2 Nussbaum Function . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.3 Stability Analysis of the Fractional Order UAS . . . . . . . . . . 2.2.4 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.5 Results I: FO-UAS vs. IO-UAS . . . . . . . . . . . . . . . . . . . 2.2.6 Results II: Effect of Different Nussbaum Functions on FO-UAS . 2.2.7 Results III: Other Experiments . . . . . . . . . . . . . . . . . . . 2.2.8 Results IV: Effect of Varying b, c, and a2 . . . . . . . . . . . . . . 2.2.9 Results V: Very Low-Speed Regulation and External Noise . . . 2.3 Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Conclusion and Future Work . . . . . . . . . . . . . . . . . . . . . . . . ... . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6 7 7 9 10 11 12 13 18 22 23 23 24 3 Verification: Validation Platform 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 The Coupled Tank System . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.2 System Identification . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Hardware-in-the-Loop Implementation of a FO-PI Control System 3.2.2 Analog Hardware Implementation . . . . . . . . . . . . . . . . . . 3.3 Determining The Fractional Order α of a ‘Fractor’ . . . . . . . . . . . . . 3.4 Designing an Optimal FO-PI Controller . . . . . . . . . . . . . . . . . . . 3.5 Approximation of a FO-PI Controller Using Practically Available Orders . 3.6 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 . 28 . 28 . 30 . 30 . 31 . 31 . 33 . 36 . 36 . 38 viii 3.7 3.8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.1 Integer Order Control vs. Fractional Order Control 3.7.2 Analog Implementation vs. Digital Implementation Future Work . . . . . . . . . . . . . . . . . . . . . . . . . 4 Verification: Validation Platform 2 . . . 4.1 The Heat Flow System: An Overview 4.2 System Modeling . . . . . . . . . . . . 4.2.1 Integer Order Modeling . . . . 4.2.2 Fractional Order Modeling . . 4.3 Controller Design . . . . . . . . . . . . 4.4 Experimental Setup . . . . . . . . . . 4.5 Results . . . . . . . . . . . . . . . . . . 4.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 40 41 43 .... . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . 44 . 44 . 44 . 45 . 46 . 48 . 48 . 50 . 53 5 Verification: Validation Platform 3 . . . . . . . 5.1 The Fan and Plate System: An Overview . 5.2 System Modeling . . . . . . . . . . . . . . . 5.2.1 Integer Order Modeling . . . . . . . 5.2.2 Fractional Order Modeling . . . . . 5.3 Controller Design . . . . . . . . . . . . . . . 5.4 Experimental Setup . . . . . . . . . . . . . 5.5 Results . . . . . . . . . . . . . . . . . . . . . 5.6 Conclusion and Future Work . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . 54 . 54 . 54 . 57 . 57 . 63 . 64 . 64 . 69 6 Plasma Position Control of The STOR-1M Tokamak . 6.1 A Tokamak - An Introduction . . . . . . . . . . . . . . . 6.2 The STOR-1M Tokamak - System Overview . . . . . . . 6.3 Basic Operation . . . . . . . . . . . . . . . . . . . . . . . 6.4 Plasma Position Estimation . . . . . . . . . . . . . . . . 6.5 Plasma Position Modeling . . . . . . . . . . . . . . . . . 6.6 Controller Design . . . . . . . . . . . . . . . . . . . . . . 6.7 Experimental Setup . . . . . . . . . . . . . . . . . . . . 6.8 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8.1 Simulation Results . . . . . . . . . . . . . . . . . 6.8.2 Analog Hardware Emulation Results . . . . . . . 6.9 Difference Based Modeling and Control . . . . . . . . . 6.10 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 . 71 . 72 . 74 . 76 . 79 . 84 . 84 . 85 . 85 . 86 . 89 . 93 7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 7.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 ix Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix A Fractional Order Derivatives and Integrals . . . . . . . . . . . . . A.1 Fractional Order Derivatives . . . . . . . . . . . . . . . . . . . . . . A.2 Properties of Fractional Derivatives . . . . . . . . . . . . . . . . . . A.3 Fractional Integrals and Laplace Transforms of Fractional Derivatives Appendix B Bode Plots of Available ‘Fractors’ - July 18, 2008 . . . . . . . . . Appendix C Bode Plots of Available ‘Fractors’ - June 22, 2009 . . . . . . . . . Appendix D Fractional Order Plant Board Details . . . . . . . . . . . . . . . . D.1 Model Board Operational Waveforms and Schematics . . . . . . . . D.2 Model Board Factsheet . . . . . . . . . . . . . . . . . . . . . . . . . Appendix E Fractional Order Controller Board Details . . . . . . . . . . . . . Appendix F Analog Signal Division - Schematics . . . . . . . . . . . . . . . . . Appendix G STOR-1M Tokamak System Details . . . . . . . . . . . . . . . . . Appendix H Mittag - Leffler Function: Code . . . . . . . . . . . . . . . . . . . Appendix I Fractional Order System Modeling: Code . . . . . . . . . . . . . . Appendix J Approximation of an FO-PI Controller: Code . . . . . . . . . . . . Appendix K Plasma Position Estimation: Code . . . . . . . . . . . . . . . . . K.1 Parameter Setter Script . . . . . . . . . . . . . . . . . . . . . . . . . K.2 Position Estimator Model File . . . . . . . . . . . . . . . . . . . . . K.3 Plasma Position Calculator . . . . . . . . . . . . . . . . . . . . . . . K.4 Plasma Current Averaging and Validation . . . . . . . . . . . . . . . K.5 Plasma Current De-trending . . . . . . . . . . . . . . . . . . . . . . K.6 Plasma Position Estimation Using Mirnov Coils . . . . . . . . . . . . K.7 Vector Downsampler . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 103 103 105 106 107 113 118 118 119 121 123 124 126 130 132 133 133 134 135 139 140 140 151 x List of Tables Table Page 3.1 Parameters of the ZN−PID controller for the coupled tank. . . . . . . . . . 31 3.2 Parameters of the optimal FO-PI controller for the coupled tank. . . . . . . 36 3.3 Parameters of the AFO-PI controller for the coupled tank. . . . . . . . . . . 37 4.1 System parameters for the heat flow plant. . . . . . . . . . . . . . . . . . . . 45 4.2 Heat flow plant - FO-model parameters. . . . . . . . . . . . . . . . . . . . . 47 4.3 Controller parameters for the heat flow system. . . . . . . . . . . . . . . . . 49 5.1 Initial parameters of the fan and plate system. . . . . . . . . . . . . . . . . 57 5.2 Fan and plate system - FO model parameters. . . . . . . . . . . . . . . . . . 58 5.3 Controller parameters for the fan and plate plant. . . . . . . . . . . . . . . . 64 6.1 STOR 1-M tokamak parameters. . . . . . . . . . . . . . . . . . . . . . . . . 74 6.2 Controller parameters for the STOR-1M tokamak. . . . . . . . . . . . . . . 84 6.3 Controller parameters for the STOR-1M tokamak - voltage difference based. 92 C.1 ‘Fractor’ characteristics comparison. . . . . . . . . . . . . . . . . . . . . . . 113 G.1 STOR 1-M, bank voltages (nominal values). . . . . . . . . . . . . . . . . . . 124 G.2 STOR 1-M, horizontal and vertical field parameters. . . . . . . . . . . . . . 124 G.3 STOR 1-M, Rogowski coil parameters. . . . . . . . . . . . . . . . . . . . . . 125 G.4 STOR 1-M, plasma position magnetic pickup coil parameters. . . . . . . . . 125 G.5 STOR 1-M, bank timing and duration (ms). . . . . . . . . . . . . . . . . . . 125 G.6 STOR 1-M, mini shot log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 xi List of Figures Figure Page 2.1 H-I-L FO-UAS control scheme. . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2 Actual H-I-L setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3 Integer order UAS - squarewave tracking. . . . . . . . . . . . . . . . . . . . 14 2.4 Integer order UAS - sinewave tracking. . . . . . . . . . . . . . . . . . . . . . 14 2.5 Fractional order UAS - squarewave tracking, α = 0.6. . . . . . . . . . . . . . 15 2.6 Fractional order UAS - squarewave tracking, α = 0.1. . . . . . . . . . . . . . 15 2.7 Fractional order UAS - squarewave tracking, α = 0.3. . . . . . . . . . . . . . 16 2.8 Fractional order UAS - squarewave tracking, α = 0.75. . . . . . . . . . . . . 16 2.9 Fractional order UAS - sinewave tracking, α = 0.5. . . . . . . . . . . . . . . 17 2.10 Fractional order UAS - sawtooth wave tracking, α = 0.5. . . . . . . . . . . . 17 2.11 Fractional order UAS - Nussbaum function = k2 cos(k). . . . . . . . . . . . p 2.12 Fractional order UAS - Nussbaum function = k cos( |k|). . . . . . . . . . . 18 19 2.13 Fractional order UAS - Nussbaum function = cos( πk k 2 )e . . . . . . . . . . . 2 19 2.14 k̇(t) = |y(t)|. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.15 k̇(t) = y 4 (t). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.16 u(t) = +N (k(t))y(t) + (cb)−1 a2 0 Dtα y(t). . . . . . . . . . . . . . . . . . . . . 21 2.17 Squarewave tracking - a2 = 0.5. . . . . . . . . . . . . . . . . . . . . . . . . . cb 22 2.18 Squarewave tracking - a2 = 2. . . . . . . . . . . . . . . . . . . . . . . . . . . cb 24 2.19 Squarewave tracking - a2 = −0.5. . . . . . . . . . . . . . . . . . . . . . . . . cb 25 xii 2.20 Squarewave tracking ±0.1rad/s. . . . . . . . . . . . . . . . . . . . . . . . . 25 2.21 Squarewave tracking ±0.05rad/s. . . . . . . . . . . . . . . . . . . . . . . . . 26 2.22 Squarewave tracking ±1rad/s, external noise added. . . . . . . . . . . . . . 26 3.1 The coupled tank apparatus − courtesy of: KentRidge Instruments. . . . . 29 3.2 The coupled tank system - schematic. . . . . . . . . . . . . . . . . . . . . . 29 3.3 Coupled tank sensor calibration. . . . . . . . . . . . . . . . . . . . . . . . . 30 3.4 Simulinkr model for digital FO-PID control. . . . . . . . . . . . . . . . . . 31 3.5 Overall analog control layout. . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3.6 Analog FO-PID controller board - schematic. . . . . . . . . . . . . . . . . . 33 3.7 Analog FO-PID controller board - prototype. . . . . . . . . . . . . . . . . . 34 3.8 Bode plot of a ‘Fractor’ with α = 0.9. . . . . . . . . . . . . . . . . . . . . . 34 3.9 Bode plot of a ‘Fractor’ with α = 0.868. . . . . . . . . . . . . . . . . . . . . 35 3.10 Bode plot of a ‘Fractor’ with α = 0.385. . . . . . . . . . . . . . . . . . . . . 35 3.11 Comparison of AFO-PI and FO-PI controllers. . . . . . . . . . . . . . . . . 38 3.12 Comparison of control strategies - 1. . . . . . . . . . . . . . . . . . . . . . . 39 3.13 ITAE comparison - 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.14 Comparison of control strategies - 2. . . . . . . . . . . . . . . . . . . . . . . 41 3.15 ITAE comparison - 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.1 The heat flow plant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.2 Fractional order vs. integer order modeling − comparison. . . . . . . . . . . 45 4.3 Heat flow FO-model Bode plot. . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.4 Heat flow system simulation setup. . . . . . . . . . . . . . . . . . . . . . . . 49 4.5 FO vs. IO control simulation - heat flow system. . . . . . . . . . . . . . . . 50 4.6 Digital FO-PI control - heat flow system (H−I−L). . . . . . . . . . . . . . . 51 4.7 Analog FO-PI control - heat flow system, experiment 1. . . . . . . . . . . . 52 xiii 4.8 Analog FO-PI control - heat flow system, experiment 2. . . . . . . . . . . . 52 5.1 The fan and plate system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.2 The fan and plate system − step response. . . . . . . . . . . . . . . . . . . . 55 5.3 Kalman filter implementation for the fan and plate system. . . . . . . . . . 56 5.4 IO vs. FO modeling simulation - fan and plate system. . . . . . . . . . . . . 58 5.5 Fan and plate FO - model Bode plot. . . . . . . . . . . . . . . . . . . . . . . 59 5.6 Fan and plate FO-model board schematic. . . . . . . . . . . . . . . . . . . . 60 5.7 Generalized analog FO-model board. . . . . . . . . . . . . . . . . . . . . . . 60 5.8 Generalized analog FO-model board schematic. . . . . . . . . . . . . . . . . 61 5.9 Fan and plate plant analog FO-model vs. plant data. . . . . . . . . . . . . . 62 5.10 Analog fractional FO-PII controller board. . . . . . . . . . . . . . . . . . . . 63 5.11 Digital FO-PI control setup - fan and plate system (H−I−L). . . . . . . . . 64 5.12 Analog FO-PI control of the analog FO-model board - setup. . . . . . . . . 65 5.13 FO-PI control vs. ZN-PID control - fan and plate system (H−I−L). . . . . 66 5.14 Analog FO-PI control of the analog FO-model board - result #1. . . . . . . 67 5.15 Analog FO-PI vs. analog PID control of the analog FO-model board. . . . . 68 5.16 Analog FO-PI control of the analog FO-model board - result #2. . . . . . . 69 6.1 The tokamak as a transformer. . . . . . . . . . . . . . . . . . . . . . . . . . 72 6.2 The STOR-1M tokamak. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.3 Various bank currents for the STOR-1M tokamak. . . . . . . . . . . . . . . 75 6.4 Plasma current and voltage. . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.5 The position measurement system. . . . . . . . . . . . . . . . . . . . . . . . 76 6.6 Position estimation from the geometry. . . . . . . . . . . . . . . . . . . . . . 77 6.7 Estimated position. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.8 Plasma position modeling - Vc = 123V . . . . . . . . . . . . . . . . . . . . . . 80 xiv 6.9 Bode plot for GiT (s)|Vc =123V . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 6.10 Analog hardware model of the tokamak for Vc = 123V . . . . . . . . . . . . . 83 6.11 Plasma position control - simulation for Vc = 123V . . . . . . . . . . . . . . . 85 6.12 Plasma position control (ratio) - hardware emulation for Vc = 123V . . . . . 86 6.13 Plasma position control (error) - hardware emulation for Vc = 123V . . . . . 87 6.14 Plasma position control (absolute) - hardware emulation for Vc = 123V . . . 88 6.15 Plasma position control (test) - hardware emulation for Vc = 123V . . . . . . 88 6.16 Plasma position control (comparison) - hardware emulation for Vc = 123V . 89 6.17 Modeling based on pickup coil signal difference. . . . . . . . . . . . . . . . . 90 6.18 Controller performance for the signal difference case, reference = 0V . . . . 92 B.1 ‘Fractor-0’ Bode plot, α = 0.5175. . . . . . . . . . . . . . . . . . . . . . . . 107 B.2 ‘Fractor-1’ Bode plot, α = 0.5645. . . . . . . . . . . . . . . . . . . . . . . . 108 B.3 ‘Fractor-2’ Bode plot, α = 0.7425. . . . . . . . . . . . . . . . . . . . . . . . 108 B.4 ‘Fractor-3’ Bode plot, α = 0.7900. . . . . . . . . . . . . . . . . . . . . . . . 109 B.5 ‘Fractor-4’ Bode plot, α = 0.9440. . . . . . . . . . . . . . . . . . . . . . . . 109 B.6 ‘Fractor-5’ Bode plot, α = 0.8630. . . . . . . . . . . . . . . . . . . . . . . . 110 B.7 ‘Fractor-6’ Bode plot, α = 0.9190. . . . . . . . . . . . . . . . . . . . . . . . 110 B.8 ‘Fractor-7’ Bode plot, α = 0.8680. . . . . . . . . . . . . . . . . . . . . . . . 111 B.9 ‘Fractor-8’ Bode plot, α = 0.7460. . . . . . . . . . . . . . . . . . . . . . . . 111 B.10 ‘Fractor-9’ Bode plot, α = 0.3850. . . . . . . . . . . . . . . . . . . . . . . . 112 B.11 ‘Fractor-10’ Bode plot, α = 0.6495. . . . . . . . . . . . . . . . . . . . . . . . 112 C.1 ‘Fractor-0’ Bode plot, α = 0.966. . . . . . . . . . . . . . . . . . . . . . . . . 114 C.2 ‘Fractor-1’ Bode plot, α = 0.715. . . . . . . . . . . . . . . . . . . . . . . . . 114 C.3 ‘Fractor-4’ Bode plot, α = 0.99. . . . . . . . . . . . . . . . . . . . . . . . . . 115 C.4 ‘Fractor-5’ Bode plot, α = 0.905. . . . . . . . . . . . . . . . . . . . . . . . . 115 xv C.5 ‘Fractor-6’ Bode plot, α = 0.922. . . . . . . . . . . . . . . . . . . . . . . . . 116 C.6 ‘Fractor-8’ Bode plot, α = 0.7705. . . . . . . . . . . . . . . . . . . . . . . . 116 C.7 ‘Fractor-9’ Bode plot, α = 0.832. . . . . . . . . . . . . . . . . . . . . . . . . 117 C.8 ‘Fractor-10’ Bode plot, α = 0.772. . . . . . . . . . . . . . . . . . . . . . . . 117 D.1 Analog FO model board test I/O waveform. . . . . . . . . . . . . . . . . . . 118 D.2 Analog FO model board - enlarged schematic. . . . . . . . . . . . . . . . . . 120 E.1 Analog FO-PII controller board - detailed schematic. . . . . . . . . . . . . . 122 F.1 Analog divider 1 - courtesy of National Semiconductor. . . . . . . . . . . . 123 F.2 Analog divider 2 - courtesy of EDN, Europe. . . . . . . . . . . . . . . . . . 123 K.1 Simulinkr model for plasma position estimation. . . . . . . . . . . . . . . . 134 xvi Acronyms IO Integer Order FO Fractional Order H-I-L Hardware-In-The-Loop UAS Universal Adaptive Stabilization FO-UAS Fractional Order Universal Adaptive Stabilization IO-UAS Integer Order Universal Adaptive Stabilization F-MIGO Fractional Ms Constrained Integral Gain Optimization FO-PI Fractional Order Proportional, Integral FO-PID Fractional Order Proportional, Integral and Derivative FO-PII Fractional Order Proportional, with Dual Integral Channels AFO-PI Approximated Fractional Order Proportional, Integral PID Proportional, Integral and Derivative FOPDT First Order Plus Delay Time ZN-PID Ziegler Nichols Tuned PID Controller A/D Analog-to-Digital D/A Digital-to-Analog STOR Saskatchewan Torus BT Toroidal Field Bank OH Ohmic Heating Bank VE Vertical Equilibrium Bank HC Horizontal Compensation Bank VC Vertical Compensation Bank Vc Vertical Field Compensation Voltage Vi Magnetic Pickup Coil Voltage - Inner Position Vo Magnetic Pickup Coil Voltage - Outer Position Vu Magnetic Pickup Coil Voltage - Upper Position Vl Magnetic Pickup Coil Voltage - Lower Position 1 Chapter 1 Introduction 1.1 Motivation The process of questioning the reasons for the occurrence of natural phenomenon can be attributed as the cornerstone of all science in general. Scholars from myriad different fields dedicate their lifetimes to have a better understanding of our world. Notable contributions in the world of mathematics came from great people like Sir Isaac Newton, G.W. Leibniz, Leonhard Euler, to name a few. They laid down the basic concepts for calculus, a mathematical tool that forever changed our outlook in several aspects. It is only when one understands that all modern science depends on work that is centuries old, that one feels truly humbled. Students of engineering, however, get exposed early on to the fact that understanding concepts are as important as putting them into use in real life. Getting things to work for real is a challenge in itself, since nature does not always like to play by the rigid rules of mathematics. The modern day devices, such as cell phones and computers, perform a variety of mathematical calculations like wavelet transforms, fourier transforms, etc. Seeing math in action is an infinitely fulfilling experience, almost indistinguishable from magic. While most modern day devices and commercial equipment make tremendous use of classical calculus and the integer order school of thought, there exists another close parallel, i.e., fractional calculus. Fractional calculus is as old as classical calculus itself, but it has not gained as much rapport (comparatively) because one runs into the difficulty of not being able to comprehend the physical meanings of a fractional derivative or an integral. The basic motivation for this work is to be able to see and experience the effects of the use of fractional calculus on real-life experiments. Resistance to any arcane science is a characteristic of the human mind, I am, however, overjoyed by the fact that my time spent 2 performing the experiments with fractional calculus has transformed me into a true believer of mathematics. 1.2 Literature Review Oldham and Spanier, in their book [1], provide a good grounding in the basic concepts required for fractional calculus. Podlubny’s book [2] provides a lot of useful definitions and results regarding fractional calculus. It also highlights certain applications and methods of calculation. The Gamma, Beta, and Mittag-Leffler functions form the base for fractional calculus. The Mittag-Leffler function turns out to be a generalization of the widely used exponential function, ex , and the scope of fractional calculus becomes apparent. Additionally, Samko [3], Miller and Ross [4] provide a good introduction to fractional calculus. The work of Ziegler and Nichols [5], provides a usable controller which is ready to be tweaked. The ease of use of their control strategy and tuning rules however makes their work a solid foundation of control science, so solid that almost every process imaginable and in use in the industry still has a proportional, integral and derivative (PID) controller which is tuned based on their work. The authors Aström et al. [6, 7] delve into further details about PID controllers, their tuning and design, in the face of certain specifications and constraints. The physical meaning of fractional order derivatives and integrals is hard to imagine but there are analytical results to help with the calculations. However when implementing the same in the simulation or a hardware-in-the-loop (H-I-L) setting, the use of Oustaloup’s recursive approximation [8, 9] is indispensable. The beginning of this work talks about nonidentifier-based universal adaptive stabilisation, Ilchmann’s work [10] provides the details about the same. The authors Li et al. [11] deal with the FO-UAS. Their results have been applied to some of the experiments in this work and the conclusions obtained are very good. Fractional order PID (FO-PID) control is a useful control strategy since it provides five parameters to be tuned as opposed to the three available in ordinary PID control. The work of the authors Chen and Bhaskaran [12] is extremely useful for tuning fractional 3 order proportional integral (FO-PI) controllers for a wide class of plants. The methodology used therein results in a readily usable and practical approach for tuning FO-PI controllers. Auto-tuning strategies for simple FO-PI controllers, and also tuning rules for other types of controllers like FO-[PI], and their uses are presented by Wang et al. [13]. Varying time delay systems are a challenge to tune, which is dealt by Bhambhani et al. in their work [14]. This work also deals with a simple frequency domain fitting approach for obtaining fractional order models of systems. The authors Djamah et al. [15] and Das [16] provide an insight into fractional order system modeling methodologies. As the title indicates, Das [16] has a more practical and direct approach. This work uses special analog devices called ‘Fractors.’ Bohannan’s work [17] provides details about the implementation and the characteristics of these devices. Petras et al. provide an insight into other methods for analog realization of fractional controllers in their work [18]. Wesson, White, and Kadomstev [19–21] provide general details about the tokamak, the fundamentals of plasma physics and some theory about plasma confinement in toroidal magnetic confinement devices. A good definitive reference on the subject is the book by Artsimovich [22], where as Ariola and Pironti’s work [23] deals with the controls aspect of the plasma confinement problem. This work heavily relies on Wolfe’s and Emami’s works [24, 25] for the operational parameters of the STOR-1M tokamak, and details about the previous plasma position control system, respectively. In order to understand the magnetic disturbances and magnetohydrodymanic (MHD) instabilities that affect the plasma column, consulting the book [26] by Bateman is recommended. 1.3 Contribution and Organization As mentioned earlier, this work concentrates on the application of fractional calculus to real-life systems. One of the contributions of this work is to test the performance of the FO-UAS control strategy on a direct current (DC) motor and to observe the performance benefits obtained. Chapter 2 provides the mathematical details and the experimental 4 results. The ability to track sinusoidal, sawtooth and square wave signals with almost negligible steady-state error and near instantaneous rise times is a good finding. The next contribution comes in the form of the prototype FO-PID controller board used for the analog control experiments on the coupled tank system. Chapter 3 provides an indepth coverage of the experimental setup and the results. This chapter also definitively shows the advantages purely analog control has over the digital versions. Finding an equivalent FO-PI controller by using two or more of the available ‘Fractors’ to approximate the optimal FO-PI controller designed according to Chen and Bhaskaran’s tuning rules [12], is the main mathematical contribution of this chapter. Chapter 4 deals with fractional order modeling and control of the heat flow plant. This chapter presents a frequency domain fitting procedure to model a plant using fractional calculus. Experimental results verifying the same are presented in this chapter. Chapter 5 deals with the real-life hardware implementation of the fractional order modeling methodology presented in Chapter 4. The plant modeled is the fan and plate system. The details of the fractional order (FO) model board and the fractional order proportional, dual integral (FO-PII) controller board are presented in this chapter. The results of a FO controller controlling a FO plant (in the purely analog hardware setting) have also been presented. This entire work is presented in such a fashion that the experiments performed and the results obtained, build up towards controlling the plant described in Chapter 6. The plant dealt with here is the STOR-1M tokamak. The tuning rules used in the previous chapters, the analog hardware setup used, etc., are all used in this chapter to verify that the FOPI controller proposed for plasma position control of the STOR-1M tokamak achieves the requirements in a real-life analog hardware emulation setting. Estimation of plasma position prior to applying any control theory however is the most interesting part of this chapter since it does not use any of the complex mathematics normally used by plasma physicists [25], but relies on simple results from basic physics and the geometry of the device to obtain a good estimate of the plasma position. 5 Chapter 7 forms the conclusion of this work, it summarizes the results obtained and presents some possibilities for future work. The appendices contain valuable information pertaining to this work. Appendix A provides certain basic definitions used in fractional calculus. Appendices B and C present the Bode plots of the ‘Fractors’ taken at different dates. Details about the fractional order model board are included in Appendix D. Details about the fractional order controller board are presented in Appendix E. Appendix F provides schematics for implementing analog signal division. Appendix G presents operational details about the STOR-1M tokamak. The code used for various experiments in this work are included in Appendices H, I, J, and K. 6 Chapter 2 Fractional Order Calculus in Controls: A First Glance The purpose of this chapter is to introduce basic elements of fractional calculus to the reader. The first section establishes basic ideas about fractional order PID control. The second section is dedicated to a more sophisticated control strategy called the FO-UAS. Various real-time hardware-in-the-loop experiments have been performed on a DC motor for comparing the integer order (IO) and fractional order (FO) approaches of universal adaptive stabilization (UAS). Data obtained from the experiments presented in this chapter shows that fractional calculus is indeed useful in real life. 2.1 Fractional Order PID Controllers: An Overview A simple traditional PID controller can be written in the following form: u(t) = Kp e(t) + Ki Z e(t)dt + Kd d (e(t)) , dt (2.1) where u(t) is the output of the PID controller, e(t) is the error and Kp , Ki , Kd are the proportional, integral and the derivative gains, respectively. There are several different methods for tuning PID controllers that have been explored by researchers over the years. The work of Aström et al. [6, 7] can be referred to as an example. The tuning rules by Ziegler and Nichols [5], however, are the most prevalently used since its use is simple. The relay auto-tuning procedure is convenient and it provides for a good initial controller to start out with. Replacing the integer order derivatives and integrals in eq. (2.1) by integral and derivative operators of arbitrary real order provides a fractional order PID or FO-PID controller. 7 The mathematical representation of such a controller is as follows: uf (t) = Kpf e(t) + Kif λ a Dt e(t) + Kdf µ a Dt e(t) , (2.2) where uf (t) is the output of the FO-PID controller, e(t) is the error. λ, µ ∈ R are the orders of the integral and differential operators, respectively. Kpf , Kif , Kdf are the proportional, integral, and the derivative gains for the FO-PID controller. The operator of the form a Dtp shown here is the Grünwald-Letnikov (GL) form of the fractional differintegral operator where a, t are the terminals. Preliminary information about such operators can be found in Appendix A. Podlubny’s book [2] must be consulted if one desires delving into the details. As seen from eq. (2.2), one can tune five separate parameters of the FO-PID controller, thus providing more finesse. 2.2 Fractional Order Universal Adaptive Stabilization (FO-UAS) All real-life systems are not necessarily simple or linear. There are many complex systems with a high degree of uncertainty. Adaptive control is interesting from the point of view of controlling such systems. UAS is a special case of adaptive control. Li et al. [11] study the UAS for systems with state space representations. The work presented in the following sections is the application of the results from Li et al. [11] to real-life systems. Mukhopadhyay et al. [27] provide an abridged version of the experimental details and results shown here. 2.2.1 Mathematical Preliminaries This subsection provides some elementary information about the mathematics necessary to describe the FO-UAS system. Riemann-Liouville and Caputo fractional operators, the Mittag-Leffler function, and its Laplace transform are discussed mainly since they are widely used. The Riemann-Liouville and Caputo fractional operators are the primary mathematical tools used for working out the mathematics related to FO-UAS. Some details about the mathematical results used in fractional calculus can be found in Appendix A. For a thor- 8 ough understanding, however, Podlubny’s book [2] is recommended. The uniform formula of a fractional integral with α ∈ (0, 1) is defined as follows: −α a Dt f (t) 1 = Γ(α) Z where f (t) is an arbitrary integrable function, t a f (τ ) dτ, (t − τ )1−α −α a Dt (2.3) is the αth fractional integrator on [a, t], and Γ(·) denotes the Gamma function. For an arbitrary real number p, the RiemannLiouville and Caputo fractional operators are defined as follows: p a Dt f (t) = C p a Dt f (t) = d[p]+1 −([p]−p+1) [ a Dt f (t)], [p]+1 dt (2.4) d[p]+1 f (t)], dt[p]+1 (2.5) and −([p]−p+1) [ a Dt respectively. Here [p] stands for the integer part of p, D and C D are Riemann-Liouville and Caputo fractional operators, respectively. The exponential function is frequently used in the solutions of integer order systems. Similarly, a function frequently used in the solutions of fractional order systems is the Mittag-Leffler function. It is defined as follows: Eα (z) = ∞ X k=0 zk , Γ(kα + 1) (2.6) where α > 0. The Mittag-Leffler function in two parameters has the following form: Eα,β (z) = ∞ X k=0 zk , Γ(kα + β) (2.7) where α and β are arbitrary complex numbers. When α > 0 and β = 1, Eα (z) = Eα,1 (z). 9 Moreover, the Laplace transform of the Mittag-Leffler function in two parameters has the following form: L{tβ−1 Eα,β (−λtα )} = sα−β , sα + λ 1 (<(s) > |λ| α ), (2.8) where s is the variable in Laplace domain, <(s) denotes the real part of s, λ ∈ R and L{·} stands for the Laplace transform. 2.2.2 Nussbaum Function Definition 2.2.1 A piecewise right continuous and locally Lipschitz function N (·) : [k0 , ∞) → R is called a Nussbaum function if 1 sup k>k0 k − k0 Zk N (τ )dτ = +∞, Zk N (τ )dτ = −∞, k0 and 1 inf k>k0 k − k0 k0 for some k0 ∈ (k0 , ∞), where k0 ∈ R. It is easy to see that Definition 2.2.1 holds true for some k0 ∈ (k0 , ∞) if and only if it is valid for all k0 ∈ (k0 , ∞) [10]. The Nussbaum function plays a crucial role in UAS [10, 28–33], also Li et al. [11,34] show that the Mittag-Leffler function Eα (−λtα ) for λ > 0 and α ∈ (2, 3] is a Nussbaum function. Details about the following results can be found from the work by Li et al. [11]. Lemma 2.2.1 Suppose that f (k) is bounded for all k and N (k) is a Nussbaum function with respect to k. Then f (k) + N (k) is also a Nussbaum function with respect to k. Lemma 2.2.2 ek cos(k) is a Nussbaum function with respect to k. 10 From Lemmas 2.2.1 and 2.2.2 the following theorem can be proved. Theorem 2.2.2 Eα (−λkα ) is a Nussbaum function with respect to k, where α ∈ (2, 3] and λ > 0. 2.2.3 Stability Analysis of the Fractional Order UAS This section discusses the asymptotic stability of the following two fractional scalar systems by using the method of fractional UAS: • Fractional dynamics with integer order control strategy, • Fractional dynamics with fractional control strategy. The mathematical results presented here are from the work on FO-UAS by Li et al. [11]. Consider the real fractional system as in (2.9) with the control law given by (2.10). In reality, such a model would correspond to the case of a vehicle running on water or any agent moving about in a complex environment. Consider the fractional dynamics ẋ(t) = a1 x(t) + a2 0 Dtα x(t) + bu(t) y(t) = cx(t), (2.9) x(0) = x0 , with the fractional control strategy u(t) = −N (k(t))y(t) − (cb)−1 a2 0 Dtα y(t) k̇(t) = y 2 (t), (2.10) k(0) ∈ R, where a1 , a2 , b, c, x0 ∈ R are unknown. N (k) is an arbitrary Nussbaum function with respect to k, and α ∈ (0, 1). The effect of varying a2 , b, and c on the performance of the FO-UAS scheme can be seen in sec. 2.2.4. Note that if a2 = 0, then the system described by eq. (2.9) reduces to an integer order system. The corresponding integer order control law would be 11 obtained by substituting a2 = 0 in eq. (2.10). Applying eq. (2.10) to eq. (2.9) yields the closed-loop system ẏ(t) = [a1 − cbN (k(t))]y(t) k̇(t) = y 2 (t), (2.11) k(0) ∈ R. By using Lemma 3.1 [11], it is obvious that k(t) is bounded and y(t) converges to zero as t → ∞. 2.2.4 Experimental Setup Based on the theoretical results in sec. 2.2.3 the experiments have been performed on a DC motor, with both integer order UAS and fractional order UAS control strategies. The fractional order UAS was actually tested on a hardware-in-the-loop setup. Figure 2.1 shows the details of the entire experimental system and fig. 2.2 shows the actual experimental setup. The diagram shown in fig. 2.1 uses the control strategy as mentioned in eq. (2.10). The plant used is a DC motor. It is interfaced to the Quanser Q4 board through a combined analog-to-digital (AD)/ digital-to-analog (DA) converter and power amplifier unit [35]. The saturation bound of the plant input is ±5V . The Nussbaum function used here is the MittagLeffler function. It is represented by the ‘s-function’ block in fig. 2.1. The Mittag-Leffler function is coded in ‘C’ as a c-mex ‘*.dll’ file [36], since the existing Simulinkr block for implementing custom functions is not yet supported by the real-time workshop (RTW). However, coding it in ‘C’ has a performance benefit since it operates much faster than a normal MATLABr function call. The blocks to the right of the fractional derivative block are used to change the type of the derivative from Riemann-Liouville to the Caputo form. The error e(t) is used to obtain the function k(t). k(t) is fed to the Mittag-Leffler function to produce the Nussbaum function N (k(t)). Note that the parameter α used for the MittagLeffler function is different from the fractional order α used in the control loop. All the parameters a, b, c, and a2 are initially set to 1. The effect of varying these parameters are discussed in sec. 2.2.5. A signal generator block is used so that the reference can be changed 12 as required. The performance of the fractional order UAS can thus be studied for different reference signals. 2.2.5 Results I: FO-UAS vs. IO-UAS The experiments are first conducted with the integer order UAS control law. They are then repeated with the fractional order UAS and the results are compared. As can be seen from fig. 2.3, the integer order UAS has a finite steady-state error, which is quite big. Also it has a slow response time. From fig. 2.4 it is clear that the integer order UAS does not track a sinusoidal reference well. It has a slow response, and it fails to track the reference midway, after which the error is around 0.1275. It can be seen from fig. 2.5 that for α = 0.6 the fractional order UAS performs really Fig. 2.1: H-I-L FO-UAS control scheme. 13 well. It has a fast response and the steady-state error is of the order of 0.02. The control effort is highest when the squarewave switches. This behavior is obvious since the error is the highest at that point. From figs. 2.5, 2.6, 2.7, and 2.8 it can be seen that as α decreases, the steady-state error increases. As α increases a lot of noise is introduced into the system and the settling time increases. From fig. 2.9 it is seen that the fractional order UAS can track a sinewave reference. The error is in the range of 0.02 to 0.04. Figure 2.10 shows that the fractional order UAS can track a sawtooth reference. The steady-state error is around 0.005. 2.2.6 Results II: Effect of Different Nussbaum Functions on FO-UAS The results shown so far are obtained using the Mittag-Leffler function as a Nussbaum Fig. 2.2: Actual H-I-L setup. 14 Fig. 2.3: Integer order UAS - squarewave tracking. Fig. 2.4: Integer order UAS - sinewave tracking. 15 Fig. 2.5: Fractional order UAS - squarewave tracking, α = 0.6. Fig. 2.6: Fractional order UAS - squarewave tracking, α = 0.1. 16 Fig. 2.7: Fractional order UAS - squarewave tracking, α = 0.3. Fig. 2.8: Fractional order UAS - squarewave tracking, α = 0.75. 17 Fig. 2.9: Fractional order UAS - sinewave tracking, α = 0.5. Fig. 2.10: Fractional order UAS - sawtooth wave tracking, α = 0.5. 18 function. This section examines the effects of using different functions as a Nussbaum function. From fig. 2.11 it is clear that using k2 cos(k) as the Nussbaum function has unpleasant effects. Noise is clearly visible in the output and the control effort remains beyond saturation for a long time. Extreme control effort saturation is not observed when the functions p πk 2 k cos( |k|) and cos( )ek are used as Nussbaum functions. But they produce a lot of 2 output noise as shown in figs. 2.12 and 2.13, respectively. A similar effect is observed when these cases are repeated with a sinusoidal reference. When the above mentioned Nussbaum functions are used in the fractional order UAS to track a sinusoidal reference, a lot of noise is introduced initially and the error is a lot higher than observed in the previous cases. 2.2.7 Results III: Other Experiments Various experiments have been performed for different values of the parameters. For certain values of b, c, and a2 the performance is not affected much, however, other values have bad effects. Different functions like k̇(t) = |y(t)|, y 4 (t) or λy γ (t), γ ∈ R, and λ is a constant, have been tried. Increasing the power of y or certain values for λ affect the Fig. 2.11: Fractional order UAS - Nussbaum function = k2 cos(k). 19 p Fig. 2.12: Fractional order UAS - Nussbaum function = k cos( |k|). Fig. 2.13: Fractional order UAS - Nussbaum function = cos( πk k 2 )e . 2 20 performance adversely. Some of the other cases tried out are operational, but they do not give the best performance. A change in sign of the terms on the right hand side of the control input in eq. (2.10) does not have bad effects, but it increases the steady-state error. The same experiments have been tried out with a high gear and low gear configuration for the motors. It is observed that the gear configuration does not affect the performance of the fractional order UAS. From fig. 2.14 it is observed that changing the second part of eq. (2.10) to k̇(t) = |y(t)| has no drastic effect, however, the steady-state error increases by a small amount and so does the control effort. However, if it is changed to k̇(t) = y 4 (t), the output becomes very noisy and a large steady-state error is introduced as shown in fig. 2.15. Also the control effort is always beyond the saturation bounds, which is not good. If the sign of the control effort in eq. (2.10) is changed, then the system is still operational due to the Nussbaum functions ability of searching, as observed in fig. 2.16. However, it can be clearly seen that the steady-state error increases and so does the control effort. Fig. 2.14: k̇(t) = |y(t)|. 21 Fig. 2.15: k̇(t) = y 4 (t). Fig. 2.16: u(t) = +N (k(t))y(t) + (cb)−1 a2 0 Dtα y(t). 22 2.2.8 Results IV: Effect of Varying b, c, and a2 In the previous experiments the values of the variables b, c, and a2 are all taken equal a2 to one. Thus it is obvious that the fractional order UAS works when the co-efficient of cb the second term in eq. (2.10) equals one. The following experimental results explore the a2 is changed. performance of the fractional order UAS when the value of cb From fig. 2.17 it can be seen that the fractional order UAS works well even when a2 a2 = 0.5. Also when the value of = 2, as seen in fig. 2.18, it is found that the cb cb a2 = −0.5, performance of the fractional order UAS does not deteriorate. However, when cb the performance is a bit slower, i.e. the settling time is a bit higher as seen in fig. 2.19. Also in this case, the error is a a little larger in the beginning, but it is seen to reduce with time. The system, however, does not follow the squarewave as well as the previous cases because each cycle of the squarewave has a certain small amount of disturbance in the beginning. Fig. 2.17: Squarewave tracking - a2 = 0.5. cb 23 2.2.9 Results V: Very Low-Speed Regulation and External Noise Experiments were performed in which the reference signals were set as low as 0.1 rad/s and 0.05 rad/s. Another experiment was performed when the reference was set to 1 rad/s, but additional band-limited white noise was introduced into the loop. The results are as follows. In fig. 2.20, the fractional order UAS control scheme works well even for a low reference of 0.1 rad/s. Initially the error, while tracking the negative half cycle of the square wave, is large but the error decreases with time. Also the control effort never goes beyond the saturation limit and no erratic behaviour or noisy output is seen. Figure 2.21 shows the case when the reference is set to 0.05 rad/s. Here the fractional UAS starts out with an error larger than the previous case, but over time the error decreases. The output is a bit noisier than the previous case which may be attributed to the fact that frictional resistance and sensor noise play a vital role when tracking such low speeds. However, it should be noted that the fractional UAS cannot track any reference having a magnitude lower than 0.05 rad/s for this particular motor. Figure 2.22 shows the case when additional band-limited white noise is injected into the loop. Even with the deliberately added noise, the fractional UAS does a good job. For the most part, the error and the output is similar to the results obtained without noise and the minimum steady-state error obtained is of the order of 0.01. However when disrupted by noise, some spikes are seen in the error which quickly settle down. The maximum steady-state error with external added noise is found to be around 0.275 which decreases promptly to 0.06. 2.3 Observations The results of the experiments conducted can be summarized as follows. The fractional order UAS definitely works better than the integer order case. The experiments have been performed on a DC motor hence, it is not essential to have a model/plant with fractional dynamics for conducting experiments. The performance deteriorates when the fractional order α is made too less or too large. When properly tuned it tracks a squarewave with ease and is also found to track sawtooth and sinusoidal references. The performance is 24 Fig. 2.18: Squarewave tracking - a2 = 2. cb largely dependent on the selection of a proper Nussbaum function and it is seen that a bad choice may adversely effect the results. The performance changes slightly for different a2 values of the ratio . However, the fractional order UAS still works when different values cb a2 are used for . Using different functions and different gains on the right hand side of the cb eq. k̇(t) = y 2 (t), has a profound impact on the performance. Changing the sign of the terms on the right hand side of eq. (2.10) generally changes the steady-state error by a sizeable amount. The fractional order UAS performs well even when tracking a reference of very small magnitude or when additional noise is induced deliberately into the loop. 2.4 Conclusion and Future Work When properly tuned, with the right parameters, the fractional order UAS works better than the integer order case. The experiments have been performed on a DC motor, hence its application is not only restricted to models with fractional dynamics. The response of the fractional UAS is fast, and it works remarkably well even when tracking sinusoidal and 25 Fig. 2.19: Squarewave tracking - a2 = −0.5. cb Fig. 2.20: Squarewave tracking ±0.1rad/s. 26 Fig. 2.21: Squarewave tracking ±0.05rad/s. Fig. 2.22: Squarewave tracking ±1rad/s, external noise added. 27 sawtooth references. Finding the optimal values for the parameters a, b, c, a2 , and α is a definite direction for future work. Also, the reason as to why the output is different for different Nussbaum functions, and why the fractional order UAS works best when a Mittag-Leffler function is used as a Nussbaum function, need to be researched. An explanation needs to be found for the fractional order UAS’s ability to track sinusoidal references. 28 Chapter 3 Verification: Validation Platform 1 This chapter is dedicated to purely analog fractional order proportional integral (PI) control of the coupled tank system. A custom circuit board has been built to perform analog PID/FOPID control. Specialized circuit elements called ‘Fractors’ [17] are used to perform fractional order integration/differentiation of the error signals. The design of the board, subsequent experimentation, and its comparison to similar digital control techniques have been presented. The benefits of purely analog control when dealing with nonlinearities are also discussed. Further, a method of approximating a particular fractional order α∗ , with any number of practically available orders α1 , α2 , ....αn , has been presented. This chapter forms a base for the other analog fractional order proportional integral (FO-PI) control experiments performed as a part of this work. 3.1 The Coupled Tank System 3.1.1 Overview Figure 3.1 shows the plant being used [37]. It consists of a tank which can be partitioned into two separate tanks by the use of a baffle plate. The baffle plate may be raised or lowered in order to adjust the coupling of the two tanks. Water is fed from pipes at the top. The water pumps are located in a reservoir below the tanks. The pumps take analog inputs. They have internal circuitry to generate the pulse width modulated signals required to drive the motors. Outlets at the bottom of each tank drain the water. The rate of drainage can be adjusted using clamps. Capacitive sensors monitor the water level. For our experiments, tank no. 2 is the actuating tank and the water level of tank no. 1 is controlled. Figure 3.2 shows the schematic of the system. 29 Fig. 3.1: The coupled tank apparatus − courtesy of: KentRidge Instruments. Fig. 3.2: The coupled tank system - schematic. Figure 3.3 shows the relation between the voltage output by the water level sensors and the actual height of the water column. The lower range of the sensors is extremely nonlinear, as seen from the plots. One of the objectives of this work is to test how different control strategies work in the face of such nonlinearities. 30 Fig. 3.3: Coupled tank sensor calibration. 3.1.2 System Identification A simple step response system identification method is used to model the coupled tank as a first order plus delay time (FOPDT) system. The model of the plant obtained is as follows: G(s) = K 0.8148 −0.999s e−Ls = e . Ts + 1 3.634s + 1 (3.1) L = 0.2156. Also from eq. (3.1) it can L+T be inferred that the system takes quite a long time to react to stimulus. The the relative dead time is calculated as τ = 3.2 Experimental Setup From the FOPDT model in eq. (3.1), the parameters of the Ziegler Nichols (ZN) tuned PID controller are obtained as shown in table 3.1. These values will be used to carry out the 31 Table 3.1: Parameters of the ZN−PID controller for the coupled tank. Kp 0.26878 Ki 0.5 Kd 0.4995 ZN-PID controller experiments in order to compare it against the fractional order variants. The ZN step response tuning rules can be found in any standard PID tuning reference. 3.2.1 Hardware-in-the-Loop Implementation of a FO-PI Control System Figure 3.4 shows the Simulink model used for digital ZN-PID and digital FO-PI control of the coupled tank system. This is a H-I-L system that is interfaced to the coupled tank through a Quanser Q4 board [38]. The WinCon toolbox [39] is used to send signals to and capture data from the plant. The Quanser Q4 board converts the digital signals from the computer into analog and feeds it to the plant. It also samples the incoming analog signals and converts them back to digital so they can be read using the computer. A sampling time of 1 millisecond (ms) is used for all the digital control experiments. Digital control implies a setup having a controller implemented in Simulinkr, and the control effort, plant feedback signals pass through A/D, D/A converters, respectively, on the Quanser board. 3.2.2 Analog Hardware Implementation Figure 3.5 shows the setup for analog PID/FO-PI control. Everything including the Fig. 3.4: Simulinkr model for digital FO-PID control. 32 reference signals and the controller is replaced with analog hardware. The Quanser board and the computer is used only for the purpose of data monitoring. The schematic shown in fig. 3.6 is used to create the board shown in fig. 3.7. The board has three multi-turn 20KΩ potentiometers which allows the user to tweak the proportional, integral, and derivative gains (Kp , Ki , and Kd ). The board has circuitry that computes the error signal based on the reference and the plant outputs. A regular analog PID controller [40] uses capacitors where as our board shown in fig. 3.6 uses ‘Fractors.’ This board can be used for analog PID control or analog FO-PID control. It also has channel selector switches which enable one to switch off the proportional (P), integral (I), and derivative (D) channels at will. Two ‘TLV2774i’ rail-to-rail output, single supply, quad op-amps [41], are used for performing all the mathematical operations. Capacitors are placed in series with the ‘Fractors.’ This enables one to perform analog PID control by shorting out the ‘Fractors’ using the switches across them. The disjoint portion of the schematic showing the part labeled ‘IC7805’ is the power supply unit for the board. The schematic shown in fig. 3.6 belongs to the prototype controller board. The prototype board has a derivative (D) channel. The updated and final version of the analog FO-PID controller board has two integrating (I) channels, as opposed to one on the prototype board. A bigger schematic and Fig. 3.5: Overall analog control layout. 33 other details about the final version of the controller board are provided in Appendix E. 3.3 Determining The Fractional Order α of a ‘Fractor’ Figure 3.8 shows the Bode plot of the ‘Fractor’ with α = 0.919. It is used to perform some of the the analog FO-PI control experiments. The mathematical relations used to calculate the order of the fractional integrator from the Bode plots are as follows: M agnitude = −α × 20dB/Decade, P hase = −α × π . 2 (3.2) (3.3) Comparing the values of α obtained by using eq. (3.2) and eq. (3.3) shows that they match closely for the flat phase portion from 103 to 104 rad/sec as seen in fig. 3.8. The value of the fractional order α obtained from the magnitude plot and subsequent verification from the phase plot can be easily seen in fig. 3.9. It must be noted that the Bode plot shown in fig. 3.9 is for one of the ‘Fractors’ used for the analog approximated fractional order proportional, integral (AFO-PI) control experiments. Also, fig. 3.10 shows a zoomed in view of the Bode plot of the ‘Fractor’ with α = 0.385. This is the second ‘Fractor’ used Fig. 3.6: Analog FO-PID controller board - schematic. 34 Fig. 3.7: Analog FO-PID controller board - prototype. Fig. 3.8: Bode plot of a ‘Fractor’ with α = 0.9. for the AFO-PI control experiments. It can be seen clearly from this figure that the phase angle remains fairly constant at the value obtained using eq. (3.2) and eq. (3.3). Note that this particular ‘Fractor’ has the smallest bandwidth among all the other ones used to perform the experiments. 35 For Fractor with α=0.868 Magnitude (dB) 0 System: sys_temp Frequency (rad/sec): 1.01e+004 Magnitude (dB): −26 System: sys_temp −20 Frequency (rad/sec): 1.02e+003 Magnitude (dB): −8.64 −40 −60 −80 1260 1080 Phase (deg) 900 720 540 System: sys_temp Frequency (rad/sec): 1.98e+003 Phase (deg): 105 360 180 System: sys_temp Frequency (rad/sec): 1.01e+004 Phase (deg): 97 0 −180 2 10 3 10 Frequency (rad/sec) 4 10 Fig. 3.9: Bode plot of a ‘Fractor’ with α = 0.868. Fig. 3.10: Bode plot of a ‘Fractor’ with α = 0.385. 5 10 36 3.4 Designing an Optimal FO-PI Controller The procedure to obtain an optimal FO-PI controller is detailed in Chen and Bhaskaran’s work [12]. The gains for the optimal FO-PI controller are presented in table 3.2. Their tuning rules are as follows: K∗ = Ti∗ =T 1 Kp 0.2978 τ + 0.000307 0.8578 2 τ − 3.402τ + 2.405 , (3.4) , (3.5) where α∗ , K ∗ , and Ti∗ form the parameters of the optimal FO-PI controller. To know more about the process of selecting α∗ , please consult Chen and Bhaskaran’s work [12]. 3.5 Approximation of a FO-PI Controller Using Practically Available Orders The ‘Fractors’ available may not always have the same order as obtained for the de- signed optimal FO-PI controller. Hence, it is required to approximate the optimal FO-PI controller by a different FO-PI controller such that the new controller is as good as the original one. The obtained optimal FO-PI controller can be represented as follows: Co (s) = Kpo + Kio . sα∗ (3.6) Say α1 , ..., αm , represent the fractional orders of all the available ‘Fractors’ subject to the following conditions: m ≥ 2, αi 6= α∗ ∀ i ∈ [1, 2, ....m]. Table 3.2: Parameters of the optimal FO-PI controller for the coupled tank. α∗ 0.9 K∗ 1.6926 Ki∗ 0.5511 (3.7) 37 Let: Ci (s) = KPi + 1 , sαi (3.8) now the approximated FO-PI controller C̄o (s) can be written as follows: C̄o (s) = m X KIi Ci (s). (3.9) i=1 A fit in the frequency domain is thus obtained by minimizing the following index: J J = ≈ Z ∞ 0 N ω X k=0 C̄o (jω) − Co (jω)2 dω, C̄o (jωk ) − Co (jωk )2 , (3.10) (3.11) ωk = k(∆ω) + ωL , ∆ω = ωH − ωL . Nω The ‘fminsearch’ function in MATLABr is used to find a good approximation to the optimal FO-PI controller using the values of α practically available. The values for which the index ‘J’ is minimized is selected. The parameter of the AFO-PI controller obtained are shown in table 3.3. Figure 3.11 shows that the approximation of the optimal FO-PI controller using the available ‘Fractors’ matches the original controller in the frequency domain. To perform the AFO-PI control experiments the ‘Fractor’ in the D channel of the board has been moved over to a different location so it acts like another fractional integrator, in addition to the existing I channel on the board. The results presented for analog FO-PI control have been Table 3.3: Parameters of the AFO-PI controller for the coupled tank. Fractor No. 1 2 αi 0.8680 0.3850 KPi 1.1730 0.3065 KIi 0.3065 0.4467 38 Fig. 3.11: Comparison of AFO-PI and FO-PI controllers. carried out with a ‘Fractor’ having α = 0.9. 3.6 Results From fig. 3.12 it is clear that digital PID performs the worst followed by the digital FO-PI controller. It may occur to readers that the oscillations in the output may be due to integrator wind-up. However, that is clearly not the case, since the same gains work perfectly well in the analog case as seen from the plots. Also, the digital experiments have been carried out with anti-windup mechanisms only to find no appreciable difference in performance. From the plots it is evident that analog PID control does a good job, however, it has a big steady-state error. The optimal FO-PI controller does a very good job, but it is a bit slower compared to the analog AFO-PI controller. The approximated controller converges quickly to the reference with infinitesimally small steady-state error. 39 Fig. 3.12: Comparison of control strategies - 1. This fact is amply clarified from the comparison of the integral of time and absolute error (ITAE) shown in fig. 3.13. Figure 3.14 compares the performance of the controllers when they track a very low reference. In this zone the sensor is extremely nonlinear. From the results it can be seen that the digital PID and FO-PI controllers fail completely in this case. The analog PID controller is severely affected by the nonlinearities and it completely loses track of the reference and starts tracking at a much higher level. However, the analog FO-PI and the analog AFO-PI controllers do a better job. The analog FO-PI controller shows a faster response, however, it has a big steady-state error. The approximated analog FO-PI controller has a slower response, but it has a lower steady-state error. From fig. 3.15 it is clear that the AFO-PI controller does a better job compared to the others in the presence of nonlinearities. 40 Fig. 3.13: ITAE comparison - 1. 3.7 Conclusion It must be noted the term “digital controller” for this work implies a controller im- plemented on a computer as a part of a hardware-in-the-loop system having a A/D and D/A converter in the loop. Dedicated digital controllers implemented on microcontrollers with advanced algorithms may be similar or better when compared to analog variants. The findings of this work cannot be generalized to all digital controllers. 3.7.1 Integer Order Control vs. Fractional Order Control It is evident from figs. 3.13 and 3.15, that the fractional order control strategies do a better job as compared to their analog or digital counterparts. The reason for the analog AFO-PI controller performing better than the others may be attributed to the fact that 41 Fig. 3.14: Comparison of control strategies - 2. it has two fractional order integrators. In the integer order math world two fractional integrators would represent a large number of terms, thus enabling the AFO-PI controller to react to very slight differences in error in a multitude of different ways. 3.7.2 Analog Implementation vs. Digital Implementation Based on the plots obtained with a digital control strategy one may think that there might be a case of integrator windup. However, the same gains and parameters work perfectly for the analog setting. Digital control tends to converge slower to the steady state as compared to its analog counter parts, which explains the reason for the comparatively low control outputs for the analog controllers in fig. 3.12. Analog ZN-PID has a short rise time, but, it slows down later with a big steady-state error. Both the analog FO-PI control strategies perform well. The optimal controller with fractional Ms constrained integral 42 Fig. 3.15: ITAE comparison - 2. gain optimization (F-MIGO) design is faster initially, however, it has a small steady-state error. The analog AFO-PI controller with approximated terms and two ‘Fractors’ has a slightly slower rise time, but it has virtually no steady-state error. When dealing with nonlinearities, the analog AFO-PI controller does the best job among the others although it has a substantial steady-state error. The others have even bigger errors. The digital strategies fail completely. With digital control for low references in the nonlinear region, it has been observed that the tubes which carry water to the tank take a long time to fill up. Thus inhibiting any water flow into the tank for a long time. This can be explained by the fact that the periodic sampling coupled with nonlinear feedback from the plant is just too slow a combination. Noise compounds the problem further. At such low references, noise plays a vital role and the digital control strategies get even slower if a filter is used. 43 Contrary to all of the above, the analog controllers show immediate response. 3.8 Future Work The criteria presented in eq. (3.10) can be used to model plants with fractional order transfer functions. Also, a circuit board with fractional order integrators can be used to emulate the plant in hardware, and another such board may be used to control it. The results of such experimentation indeed holds the possibility of being interesting. Another direction of work is to use the analog FO-PI controller where digital control is not possible due to speed and time requirements, i.e., plasma position control of a tokamak [42]. The plasma lifetime is of the order of a few milliseconds. The sampling rate, the lag induced due to A/D-D/A conversion, and processing time in the computer will be large enough as to render a standard digital control solution useless. It is thus needed to discuss better analog control strategies. 44 Chapter 4 Verification: Validation Platform 2 4.1 The Heat Flow System: An Overview The heat flow plant shown in fig. 4.1 consists of a plastic duct fitted with a blower and a heating coil at one end. There are also three fast settling platinum temperature transducers placed at equal intervals along the length of the duct. The transducers are used to measure temperature at these points along the duct and fan speed is measured using a tachometer. 4.2 System Modeling Figure 4.2 shows a plot of the real plant data as well as the integer order and fractional order models. It must be noted that just the data obtained from the first sensor (the one nearest to the heating coil) has been used for modeling and controlling the temperature of the heat flow plant. Details about the system parameters can be found in table 4.1. A Fig. 4.1: The heat flow plant. 45 Table 4.1: System parameters for the heat flow plant. Parameter Name Fan Input Signal Heater Input Signal Output Sensor Name Value 3V (Step) 3V (Step) T0 (Sensor−1) similar exercise is possible with data from any other sensor. The details concerning each type of modeling can be found in the following sections. 4.2.1 Integer Order Modeling The ‘System Identification Toolbox’ available in MATLABr is used to obtain an integer Fig. 4.2: Fractional order vs. integer order modeling − comparison. 46 order model for the heat flow plant. The toolbox has an easy to use interface where one can provide the input and output data vectors, specify the sampling interval for the data, and also try out various types of models. Of all the available methodologies, an autoregressive exogenous (ARX) model worked best for the heat flow plant. The transfer function obtained is shown in eq. (4.1). Please note the use of the suffix ‘i’ used in the nomenclature of the transfer function. From this point forward a suffix of ‘i’ signifies an integer order model and similarly a suffix of ‘f ’ signifies an fractional order model unless otherwise specified. Gihf (s) = 4.2.2 0.02467s2 + 0.006552s + 0.0002862 s3 + 0.4129s2 + 0.04732s + 0.0009909 (4.1) Fractional Order Modeling Let: Pj Pi (s) = Pi=1 k ai si i=1 bi s i , i, j, k ∈ Z, j ≤ k, (4.2) represent an integer order transfer function of a system. Let α1 , ..., αm , represent the fractional orders of all the available ‘Fractors’ subjected to the following condition: m ≥ 2. (4.3) Let: Pf (s) = k1 k2 + , α1 , α2 ∈ R, sα1 + c1 sα2 + c2 (4.4) be the fractional order model approximating eq. (4.2). Note that α1 , α2 in eq. (4.4) are from eq. (4.3). A fit in the frequency domain is thus obtained by minimizing the following: J J = ≈ Z ∞ 0 N ω X |Pf (jω) − Pi (jω)|2 dω, |Pf (jωk ) − Pi (jωk )|2 , k=0 ωk = k(∆ω) + ωL , ∆ω = ωH − ωL . Nω (4.5) (4.6) 47 The ‘fminsearch’ function in MATLABr is used and the values of k1 , k2 , α1 , α2 , c1 , c2 for which the index ‘J’ is minimized is selected. Thus we can now have a fractional order transfer function that can be implemented in analog hardware, since, the orders α1 , α2 used are among the practically available orders of the ‘Fractors.’ Note that, in the event none of the practically available orders of the ‘Fractors’ are suitable, eqs. (3.9) and (3.11) can be used to optimize a model obtained with any arbitrary fractional order to the ones available. Figure 4.3 shows the Bode plots for the integer order model and the fractional order model of the heat flow system. The fractional order model used for modeling the heat flow system is of the following form: Gfhf (s) = k1 k2 + β , +a s +b (4.7) sα where k1 , k2 , a, b, α, β ∈ R. The index represented in eq. (4.5) is minimized to find the optimal values for the constants k1, k2, a, b, α, and β for the heat flow system. The values of the constants used for modeling the heat flow system using a fractional order transfer function are shown in table 4.2. Figure 4.4 shows the Simulinkr implementation of the fractional order transfer function whose parameter values are presented in table 4.2. The transfer function attained by the use of the parameters in table 4.2 presents only the relation between the input voltage to the plant, and the output voltage obtained from the sensors. In order to convert it to temperature, multiplication by a certain output gain, and adding appropriate room temperature offsets is essential, as shown in fig. 4.4. It is also observed from fig. 4.3 that the frequency response of the fractional order and integer order models has a maximum difference of three units until about a frequency of 100 rad/sec. For higher frequencies the difference diminishes and the frequency response of both the models coincide. Thus it can be concluded that the methodology used to obtain a fractional order Table 4.2: Heat flow plant - FO-model parameters. Parameter Value k1 0.0463 k2 −0.0299 a 0.1762 b 0.9605 α 0.6495 β 0.5645 48 model works fairly well. 4.3 Controller Design The plant described in eq. (4.2) can be approximated by a FOPDT model. The gain K, time constant T , and the delay L of the obtained FOPDT model are used to design the integer order and fractional order controllers. The parameters of the ZN-PID controller used are shown in table 4.3. The eqs. (3.4) and (3.5) described in sec. 3.4 are used to design the FO-PI controller. The parameter values of the FO-PI controller used for the heat flow system are also shown in table 4.3. 4.4 Experimental Setup Figure 4.4 shows the Simulinkr models used to test the designed controllers on the Fig. 4.3: Heat flow FO-model Bode plot. 49 integer order and fractional order models. Given the fact that IO/FO mathematics may be used to design a controller or estimate a plant model, there exist four possible combinations for controllers and plants. However, only two of them are considered in fig. 4.4 because for a real-life scenario, it is only the design methodology used for the controller that matters. Models are only approximations, so even if we can conclude that a particular combination of a model and controller gives the best results, such a conclusion would have no physical meaning. Hence, the other two cases have not been considered for simulation. The analog hardware control experiments performed with the analog controller board have the same setup as discussed for the coupled tank in sec. 3.2.2. The only differences being the controller parameters (shown in table 4.3), and a different plant being controlled. The details have thus been omitted. Table 4.3: Controller parameters for the heat flow system. Controller FO−PI ZN−PID Kp 2.6847 10.7652 Ki 0.1472 1.3262 Kd 0 0.1885 Order 0.7 1 Fig. 4.4: Heat flow system simulation setup. 50 4.5 Results This section discusses the experimental results. As seen in fig. 4.5 the FO-PI controller works much better than the ZN tuned PID controller. The FO-PI controller has a faster rise time, shorter settling time, and much lesser overshoot. Hence, all the H-I-L experiments and the analog control experiments have been performed using the FO-PI controller. Figure 4.6 shows the results obtained when the FO-PI controller is implemented in Simulinkr as a part of a H-I-L setup using the Quanser board. From the results it is observed that the actual H-I-L system responds faster than the simulation. However, a lot of oscillation is seen in the output when it reaches close to the reference. This behavior can be attributed to the time delay induced in the system as a result of the A/D, D/A conversion taking place as the signals pass from the computer to the plant and vice versa. A disturbance is induced in the plant temperature by unplugging the controller input. It is seen that the controller responds promptly once it is plugged back in. However, it is seen that the control effort has very large and continuous fluctuations between the entire output supply voltage range. Fig. 4.5: FO vs. IO control simulation - heat flow system. 51 Figure 4.7 shows the results of the analog FO-PI control experiment conducted by connecting the analog FO-PI controller board directly to the heat flow plant. Simulinkr and the Quanser system are used only for data acquisition. It is clearly observed that the rise time is the same for both the H-I-L controller and the true analog FO-PI controller. However, the output obtained with the analog FO-PI controller has very small fluctuations about the reference. Also, the control effort shows a much lesser amplitude of fluctuations. It also reacts to the disturbance more quickly and has a much lesser overshoot. The smooth operation of the controller is evident from the error curve which is almost flat for a majority of the time period. It is thus clearly obvious that the analog implementation of the FO-PI controller works better than the digitally implemented controller in the H-I-L setting. The benefits of cutting down the delays induced due to A/D, D/A conversion are thus clearly visible. Figure 4.8 shows the results obtained when a higher reference is set. The heat flow system has a very large time constant, thus it takes a long time for the temperature to rise. Fig. 4.6: Digital FO-PI control - heat flow system (H−I−L). 52 Fig. 4.7: Analog FO-PI control - heat flow system, experiment 1. Fig. 4.8: Analog FO-PI control - heat flow system, experiment 2. 53 Another factor being the limited control effort of the analog FO-PI controller board which saturates at 5 volts. Thus, the controller output remains at the saturation limit till the plant temperature attains the reference and then the control effort drops down. Experiments have been performed for checking disturbance rejection. For such a high reference it is observed that there is a very small but finite steady-state error. 4.6 Conclusion It can thus be concluded from the experimental results presented in the previous section that FO-PI control performs better than ZN-PID control. Analog FO-PI control has lesser output oscillations as compared to the digital variants. Hence, analog FO-PI control is the way to go for control applications where the operating time and operational delays are of critical importance. From the results obtained from fractional order modeling of the heat flow plant, it is evident that a FO approach to system modeling is indeed possible. If the values from table 4.2 and the form of the FO transfer function presented in eq. (4.7) are compared to the IO eq. (4.1), it is found that the order of the model has been reduced from three to less than one. Thus, demonstrating that FO modeling can be a valuable tool for reducing the order of complex high order IO models. 54 Chapter 5 Verification: Validation Platform 3 5.1 The Fan and Plate System: An Overview Figure 5.1 shows the real setup of the fan and plate system. As is evident from the name it is a simple system which consists of a fan blowing air towards a plate. The control objective is to maintain the angle of the fan at a desired constant value by changing the rate of flow of air. The actuator is the fan and the problem is essentially of motor speed control. The compressibility of air, turbulence from other sources, and the time it takes air to travel from the fan to the plate makes this a very interesting control problem. The first step is system modeling which is discussed in detail in the next section. 5.2 System Modeling Figure 5.2 shows that the output of the fan and plate system is very noisy. The observed noise can be attributed to the aerodynamics of the system. The air escaping around the Fig. 5.1: The fan and plate system. 55 Fig. 5.2: The fan and plate system − step response. sides of the plate and the gushing stream of air from the fan causes oscillations in the plate angle. These oscillations are manifested as noise. Filtering is one way to get rid of the noise, however, any low-pass filter slows down the system greatly. This effect is more pronounced in this plant because the control is initially implemented in a H-I-L setup using the Quanser board so the delay induced by A/D, D/A converters is also added to it. The fan oscillates violently when a controller is tested with a low-pass filter in the loop. Hence, a Kalman filter is used to reduce the noise, which may provide a better system model and help us view the output with reduced noise. Kalman [43] discusses the details of the filtering strategy. Welch and Bishop [44] explain the fundamentals about the same. Figure 5.3 shows the 56 setup used for noise removal with the help of a Kalman filter. Yi Cao’s work [45] has been used for implementing the same. The initially sampled noisy data is processed with the help of the ‘System Identification Toolbox’ present in MATLABr . A simple first order model is obtained, the transfer function for this single input single output (SISO) system is transformed into a state space equivalent to obtain the required matrices for the Kalman filter. As seen in fig. 5.2 the estimated output obtained from the Kalman filter is subtracted from the actual plant output. It was observed that the mean estimated output was off from the mean actual output by a small factor. This difference can be adjusted by using a gain equal to the ratio of the mean actual output, and the mean estimated output. Finally, the output from the model is added to the difference between the actual and estimated outputs. The noise is thus reduced to a great extent without the lag of a low-pass filter. Table 5.1 shows the initial model used to obtain the state space matrices required for the Kalman filter to work. Fig. 5.3: Kalman filter implementation for the fan and plate system. 57 Table 5.1: Initial parameters of the fan and plate system. Type of Model Transfer Function State Space 5.2.1 Parameters 2.459/(s + 0.7837) A = −0.7837, B = 1, C = 2.4588, D = 0 Integer Order Modeling The filtered data obtained, as shown in fig. 5.2, can then be used to obtain either a integer order or fractional order model of the fan and plate system. For the integer order model the ‘System Identification Toolbox’ is used as mentioned earlier. Figure 5.4 shows the comparison between the simulated results obtained from the integer order and fractional order models. The details about fractional order modeling are presented in the next section, however, it can be observed that both the models fit the plant output quite well. Equation (5.1) represents the integer order FOPDT model for the fan and plate system. Gif an (s) = 5.2.2 3.1376e−0.62s Ke−Ls = . Ts + 1 1.2759s + 1 (5.1) Fractional Order Modeling The details of the modeling methodology used for obtaining a fractional order model have already been described in sec. 4.2.2. The fractional order transfer function obtained for the fan and plate system is similar to eq. (4.7). It can thus be represented as: Gff an (s) = g1 g2 + , sγ + c sδ + d (5.2) where g1 , g2 , c, d, γ, δ ∈ R. The index represented in eq. (4.5) is minimized to find the optimal values for the constants g1 , g2 , c, d, γ, δ for the fan and plate system. Note that the procedure used is exactly similar to the one used for the heat flow system. The values of the constants used for modeling the fan and plate system using a fractional order transfer function are shown in table 5.2. The Simulinkr model used to simulate the response of the fractional order model of the fan and plate system is similar to the one showed for the 58 heat flow plant in fig. 4.4. The parameters are the ones given in table 5.2. Figure 5.5 shows the comparison between the Bode plots of the integer order model and the fractional order model. It can be seen that the frequency response of the fractional order model is quite close to that of the integer order model for lower frequencies, but for higher frequencies there is some error between then two. Table 5.2: Fan and plate system - FO model parameters. Parameter Value g1 0.9747 g2 1.8860 c 3.2322 d 0.6427 γ 1.5645 δ 0.944 Fig. 5.4: IO vs. FO modeling simulation - fan and plate system. 59 Fig. 5.5: Fan and plate FO - model Bode plot. Another aim of this work is to be able to emulate the results obtained above by using analog hardware. Thus proving that fractional order modeling is not only possible theoretically, but also that it can be implemented in real life. Figure 5.6 shows the actual analog hardware implementation for emulating eq. (4.7). It is specific to the parameters of the fan and plate system mentioned in table 5.2. The unused operational amplifiers appear in the schematic because quad op-amp chips have been used. The board shown in fig. 5.7, however, is a more general implementation. The schematic shown in fig. 5.6 has been implemented on a bread board to test its performance. Due to the excessive number of operational amplifiers used, tuning the hardware is a difficult task. When the hardware emulating the plant is connected to the controller the hardware starts behaving unreliably. The reason may be attributed to the fact that when a single 60 Fig. 5.6: Fan and plate FO-model board schematic. Fig. 5.7: Generalized analog FO-model board. 61 signal passes through a large number of amplifiers on the controller board, and the plant board, there exists a very small range of values of gains for each amplifier which allow the signal to pass through as required, without getting railed or clipped. The schematic shown in fig. 5.6 is specific to the fan and plate system because of the presence of an integrator of order greater than one. It is thus more practical to design a general purpose board that can be used to emulate a greater number and variety of plants. Figure 5.8 shows a simpler, more general, and practical approach to emulating the fractional order models of any plant using hardware. The board shown in fig. 5.7 is based on the schematic shown k in fig. 5.8. It implements a single term fractional order equation of the form α . For s +a details about the board Appendix D must be consulted. A model for the fan and plate k plant having the form α can be obtained by minimizing the index given in eq. (4.5). s +a Due to the presence of just a single term the frequency response is not as close to the frequency response of the integer order model. However, it is clearly seen from fig. 5.9 that the modeled output matches the plant output closely in the time domain. Due to the lesser number of operational amplifiers used in the generalized FO model board, the problem of feasible amplifier gains being in a very narrow range is eliminated. Another appealing feature is that one can easily cascade multiple such boards to attain FO models of the form shown in eq. (5.3) or connect them in parallel to obtain FO models of the form shown in Fig. 5.8: Generalized analog FO-model board schematic. 62 Fig. 5.9: Fan and plate plant analog FO-model vs. plant data. eq. (5.4). As it is general in nature and not strictly designed with the parameters of the fan and plate system in mind; the amplifier gains, the ‘Fractors,’ and the capacitors can be changed to be able to model any other plant as well. Gf (s) = Gf (s) = (sα + a)(sβ k + b)(sγ + c) · · · (sη + n) k1 k2 k3 kn + β + γ + ··· + η +a s +b s +c s +n sα (5.3) (5.4) 63 5.3 Controller Design The board shown in fig. 5.10 is the final version of the FO-PI controller. The reason it is called an FO-PII controller is due to the fact that this board does not have a derivative channel, but it has two integrator channels. Another difference between this board and the one shown in fig. 3.7 is that this board can operate either in unipolar or bipolar configuration. The previous board is only capable of unipolar operation. As for all the other plants in this work, the eqs. (3.4) and (3.5) described in sec. 3.4 are used to design the FO-PI controller. One may not always have the ‘Fractor’ with the desired order at hand, and an approximation using the methodology described in sec. 3.5 maybe required. Hence, this board has two integrators. For details pertaining to this board please refer to Appendix E. Table 5.3 shows the parameters of the FO-PI controller and the ZN-PID controller used to carry out the experiments mentioned in this chapter. As for every other experiment in this work, the FO-PI controller has been tuned according to Chen and Bhaskaran’s Fig. 5.10: Analog fractional FO-PII controller board. 64 Table 5.3: Controller parameters for the fan and plate plant. Controller FO−PI ZN−PID Kp 0.2899 0.7871 Ki 1.2785 0.8064 Kd 0 0.31 Order 0.9 1 rules [12]. 5.4 Experimental Setup Figure 5.11 shows the setup used for H-I-L FO-PI control experiments on the fan and plate system. A similar setup with a PID controller in place of the FO-PI controller has been used to perform the H-I-L ZN-PID control experiments on the fan and plate system. Figure 5.12 shows the purely analog control setup where the plant being controlled is the emulated fan and plate system using the analog FO-model board. The setup uses an analog controller board to control a plant model implemented using analog electronics. The Quanser system and the computer is used only to monitor the data and provide the reference input to the controller. The results of the experimental setups shown in fig. 5.11 and fig. 5.12 are presented in the next section. 5.5 Results It is clearly seen from fig. 5.13 that the FO-PI controller performs much better than the ZN-PID controller. Although the PID controller has a slightly smaller overshoot, it has poor disturbance rejection characteristics. The output with the PID controller is seen Fig. 5.11: Digital FO-PI control setup - fan and plate system (H−I−L). 65 Fig. 5.12: Analog FO-PI control of the analog FO-model board - setup. to be slow to react to disturbances. Whereas, the output of the FO-PI controller reacts quickly to disturbances and settles faster to a value near the reference. Small oscillations in the output are observed due to air turbulence, currents, compressibility, and the delay between the time the air leaves the fan and hits the surface of the plate. Air escaping around the edges and the bottom of the plate also contribute to some of the effects. It should be noted that fins have been added on the side of the plate to reduce the effects due to air escaping around the sides. The delay induced by A/D, D/A conversion of the sensor, actuator signals also contributes to the observed oscillations. Figure 5.14 shows the results of one of the experiments performed with the setup shown in fig. 5.12. The controller has 66 Fig. 5.13: FO-PI control vs. ZN-PID control - fan and plate system (H−I−L). a fast response and controls the plant output steadily at the reference with virtually no error. The disturbances seen at around a time of 15 seconds and 20 seconds are induced on purpose to test the disturbance rejection capabilities of the controller board. Disturbances are created by either shutting down the controller or the plant or both. The sections of the control effort plot which show a zero effort, correspond to the amount of time that the FO-PII controller board was turned off. Similarly, the effort is found to hit the 5 volt rail voltage when the plant is turned off. From the control effort plot it is also evident that the effort remains steadily at around 1V and is saturated for very short periods when the error is large. Figure 5.15 shows the zoomed in section of a square wave tracking experiment performed with the older FO-PID controller board as shown in fig. 3.7. This board operates only in the unipolar mode, hence the negative half cycles have been omitted, hence the time 67 Fig. 5.14: Analog FO-PI control of the analog FO-model board - result #1. axis shows a start time of around 20 seconds. The analog PID control experiments on the analog FO-model board have been performed by replacing the ‘Fractors’ by capacitors, so that the controller board can act like an analog integer order proportional, integral and derivative (IO-PID) controller. From the plots it is evident that analog ZN-PID control is slower even in the purely analog setting despite the absence of sampling and A/D, D/A conversion delays. It is also seen that the IO-PID controller output oscillates, whereas, the FO-PI controller reaches the set point and stays there firmly. The control effort for the analog IO-PID controller is also seen to be railed for a period of time longer than the FO-PI controller, and it is found to oscillate between both the upper and lower saturation limits even for small variations in the plant output. Figure 5.16 represents the results of 68 Fig. 5.15: Analog FO-PI vs. analog PID control of the analog FO-model board. squarewave tracking experiments performed using the setup shown in fig. 5.12. As seen in fig. 5.16, the experiment is performed for two different amplitudes. The controller can track both the positive and negative half cycles, as the new FO-PII controller board can operate in bipolar mode. It can be seen that for the reference of 3◦ , the output follows the reference with almost no error (other than the error at the point where the squarewave switches signs). It also has a very fast rate of rise. For a reference of 4.5◦ , however, the output takes a comparatively longer time to reach the reference. This is possible since the reference being tracked is very close to the saturation limit of the controller output. It thus results in a slower rate of rise because the controller may be saturated for a longer period of time as compared to the previous case. The steady-state error in this case too is infinitesimally small. 69 Fig. 5.16: Analog FO-PI control of the analog FO-model board - result #2. 5.6 Conclusion and Future Work From the experimental results presented in the previous section, it can be clearly seen that FO-PI control is superior to integer order ZN-PID control in the H-I-L/simulation setting, and the actual analog hardware setting. The obvious benefits observed are: faster response, little or no overshoot, fast disturbance rejection, more robustness to noise, infinitesimally small steady-state error, and lesser control effort. This chapter also shows that fractional order modeling of systems is not only possible in theory, but it can also be implemented in real life. The results obtained from the experiments regarding analog FO control of the analog FO plant have very little or no noise. This 70 phenomenon is obvious, since, noise can easily be eliminated from properly tuned analog circuits. Also, this setup was unaffected by external factors like air turbulence, etc., which are the causes of disturbance and noise for the real fan and plate system. Connecting many units of the FO model board, as mentioned in eqs. (5.3) and (5.4), and obtaining more accurate fractional order models representing real-life phenomena should definitely be considered as a direction for future work. Similarly, building hardware units for controllers based on other fractional order strategies, and testing them on real-life plants may provide interesting results with better performance over the current methodologies discussed. 71 Chapter 6 Plasma Position Control of The STOR-1M Tokamak 6.1 A Tokamak - An Introduction The word tokamak is an acronym for the Russian words “toroidal’naya kamera v magnitnykh katushkakh” which means a toroidal chamber in magnetic coils [19–23]. The tokamak is thus a doughnut shaped device which continues to be the most promising means for magnetic confinement of heated plasma. Nuclear fusion appears to be the most promising source of energy required to quench the worlds ever growing energy demands. E = (mr − mp )c2 (6.1) Equation (6.1) is the Einstein equation which provides a relation between the loss of mass and the resultant energy. E is the resultant energy produced due to nuclear fusion. mr , mp are the masses of the nuclei before and after the reaction, respectively, and c is the speed of light. It should be noted that the process occurring is a fusion reaction in which Hydrogen nuclei fuse together to form Helium, accompanied by a release of energy. Plasmas are known as the fourth state of matter. To generate fusion energy one must heat the fuel sufficiently high so that it transforms into plasma (an ionized gas containing positively and negative charged ions, which are good conductors of electricity, and are affected by a magnetic field), and confine the plasma for a sufficiently long time so that the energy produced is more than that used in heating. The tokamak is one such magnetic confinement device [21, 22]. The ability to estimate the displacement of the plasma from the center of the toroidal chamber is important if one has to control it. Controling the position of the plasma col- 72 umn, so that it remains centered in the toroidal chamber, is a requirement to ensure greater lengths of plasma discharge. Previous plasma position controllers used on the STOR-1M where simple PID controllers and the position was estimated using analytical and empirical results from physics literature [25]. This work, however, applies the control engineers black-box approach to the tokamak. The plasma lifetime is of the order of 3-5ms, which necessitates the use of analog components, since digital controllers will be too slow to react to the system in question. The proposed analog FO-PI controller has been tested on the coupled tank system [46]. Tests on the heat flow and fan and plate systems are demonstrated in Chapters 4 and 5, respectively. 6.2 The STOR-1M Tokamak - System Overview The STOR 1-M [24] is a small size tokamak whose parameters are shown in table 6.1. Figure 6.1 shows the tokamak as a transformer. As observed, it consists of a laminated core with a primary winding similar to a conventional transformer. The plasma inside the toroidal shell forms the secondary winding. The toroidal shell of the STOR-1M is maintained at about 1.1 × 10−4 Torr for achieving a stable breakdown. The gas currently used is Hydrogen. The toroidal shell is fitted with roughing and turbo pumps in order to Fig. 6.1: The tokamak as a transformer. 73 be able to achieve the desired pressure in the high vacuum range. As shown in fig. 6.1 the toroidal field coils carry current all around the outside of the shell which produces a toroidal magnetic field along the center of the shell. When the primary of the transformer is energized and a breakdown occurs inside the shell, plasma is formed and it starts conducting current. This current flows through the plasma itself, hence it is known as the plasma current. The plasma current flow gives rise to a poloidal magnetic field. The interaction of the poloidal and toroidal magnetic fields produce the resultant helical magnetic field, which ensures magnetic confinement of the plasma. The charged particles in the plasma follow this helical field line. Control and vertical field coils are also shown in fig. 6.1, the vertical field coils produce fields required for stable operation and plasma breakdown. The control coils are used for plasma position control. The core and some of the coils are clearly visible in fig. 6.2, which shows the actual STOR-1M tokamak. Some of the capacitor banks which are Fig. 6.2: The STOR-1M tokamak. 74 Table 6.1: STOR 1-M tokamak parameters. PARAMETER Major radius Minor radius Toroidal magnetic field Plasma current Electron density Electron temperature Confinement time VALUE 21 cm 5.0 cm 0.5 − 1 T 5 to 10 kA ≈ 6 × 1012 /cm3 ≈ 300 eV ≈ 1 ms used to power the various fields, are also seen. Appendix G must be consulted for further details. 6.3 Basic Operation Figure 6.3 shows the input current waveforms for a particular shot when plasma break- down was achieved. It must be noted that the time at which a bank fires, the sequence of firing, the amplitude of current required, and the shapes of the current waveforms are required to achieve plasma breakdown. A difference of 10 to 20% in any of the above may result in no plasma. The banks displayed in fig. 6.3 are as follows: BT - Toroidal field bank, IOh - Ohmic heating bank, IV e - Vertical equilibrium bank, IHc - Horizontal compensation bank, and IV c - Vertical compensation bank. Each bank is essentially an array of large capacitors which are charged prior to firing a shot. When a bank fires, it discharges through its respective coils producing the waveforms shown. IV c is negative because this current flows in a direction opposite to the other coils. Figure 6.3 shows the input quantities required to obtain a stable plasma discharge. Figure 6.4 shows the loop voltage Vl and the plasma current Ip measured as a result of a plasma discharge. Please note that these plots show data only in the range of 3ms to 7ms, because prior to 3ms one can find only noise generated due to stray magnetic fields emerging from the banks firing. The data post 7ms is also not trustworthy because the plasma has already lost its equilibrium and is now unstable. The ideal plasma current shape should be a flat topped wave with a ramp on either side marking the beginning and end, respectively [19]. 75 Fig. 6.3: Various bank currents for the STOR-1M tokamak. Fig. 6.4: Plasma current and voltage. 76 6.4 Plasma Position Estimation Figure 6.5 is a representation of the toroidal chamber and the four magnetic pickup coils used to collect data for position measurement. Please note that the directions of the control current and plasma current shown in this figure are fictitious and for representational purposes only. When a plasma discharge occurs, there is current flowing through the toroidal shell. This current induces a certain voltage into the magnetic pickup coils. If the plasma is centered then the diametrically opposite pickup coils should have an equal amount of voltage induced in them. However, the plasma column is not very stable and keeps moving rapidly, thus inducing different voltages in the pickup coils. One can estimate the position of the center of the plasma column from the differences in the induced voltages. Emami [25], uses the difference between the signals for plasma position estimation and control. However, a difference can indicate the displacement only as a percent deviation from the center. Hence, we choose to use a ratio of voltages, which aided by some simple mathematics allows us to Fig. 6.5: The position measurement system. 77 make a more practical estimation. Figure 6.6 shows the geometry of the toroidal chamber. The inner circle represents the inside of the chamber and the outer circle represents the outer surface of the steel shell. Note that the thickness has been exaggerated here for representational purposes, also note that fig. 6.6 is not drawn to scale. The distance between the magnetic pickup coils ≈ 10cm (i.e. 2× the minor radius). Bo and Bi correspond to the magnetic field of the outer and inner horizontal pickup coils respectively, and the blue blocks show the approximate location of the pickup coils. Let the red circle represents an assumed position of the plasma column. Let ro and ri represent the distance of the center of the plasma column from the magnetic pickup coils. The following relations (refer to the book by Purcell [47], or any other standard reference for basic physics) can then be arrived at: Bo = αo Vo = µo Ip , 2πro Fig. 6.6: Position estimation from the geometry. (6.2) 78 Bi = αi Vi = µi Ip , 2πri ri + ro = 100, (6.3) (6.4) where Vo , Vi are the voltages induced in the outer and inner pickup coils, respectively. Ip is the plasma current. α0 , αi are the constant multiplication factors for the coils in Gauss/V, which are approximately equal (i.e., α0 ≈ αi ) [24]. If the plasma column were to hit the outer wall then ro = 15 and ri = 85, providing us with: Vo Bo ri = = = 5.6667. Vi Bi ro (6.5) Thus we conclude that, when the pickup of one of the coils is 5.6667 times the other then the plasma column must have hit the wall. Similarly, the plasma column is centered if the ratio equals unity. This is based on the simplifying assumption that the plasma column can be treated as an infinitesimally small point, ignoring the plasma current distribution in the toroidal chamber. This approach is suitable for offline calculation purposes for position estimation. It also provides a better understanding of the physical movement of the plasma column. The estimated horizontal and vertical position can be seen from fig. 6.7. A compensation voltage of 123V corresponds to stable operating conditions for the shots taken. The position measured is calculated using eq. (6.5). Data has been acquired over five successive good shots, for the same operating conditions. This data has been averaged for the purposes of calculating position. This eliminates stray effects and other uncontrollable circumstances, which may provide corrupt data and cause calculation errors. It is seen that as the voltage decreases, the horizontal position is affected. The plasma column starts diverging from the center. However, when the voltage is reduced to 95V or below, the plasma lifetime reduces greatly. Thus, the position can be seen to vary by large amounts. For modeling position for control purposes, the most stable operating condition at 123V is chosen. This is the nominal operating condition for the plant. For our work the horizontal 79 Fig. 6.7: Estimated position. position is of major interest, because there are no external forces acting in the vertical direction on the plasma column. This is due to the nature of the physical equations governing the plasma dynamics [19, 20]. 6.5 Plasma Position Modeling Figure 6.7 shows the plots for horizontal and vertical position as well as the ratio of the voltage signals of the concerned magnetic pickup coils. It can be seen that for the purpose of position control, one does not need to know the absolute position, but just knowing the 80 ratio is sufficient. Maintaining the ratio of the pickup coil voltages at unity automatically ensures that the plasma column is centered. We thus concentrate on modeling the ratio of the horizontal field pickup coil voltages in this section. The ratio of the horizontal magnetic Vi pickup coil voltages is shown in fig. 6.8. The plot shows that the first 0.8ms worth of Vo data is composed of garbage values. The reason for this can be found in figs. 6.3 and 6.4. From fig. 6.4 it is seen that conduction of plasma current starts from about 3.4ms. The garbage data shown in fig. 6.8 is collected by the data acquisition cards prior to this time. The huge spike appearing in fig. 6.8 occurs at around 3.8ms as a result of the horizontal compensation (HC) bank, firing as shown in fig. 6.3. A better idea of the occurrence of Fig. 6.8: Plasma position modeling - Vc = 123V . 81 events can be obtained by comparing the spike on fig. 6.8 to those on fig. 6.7. From fig. 6.8 it can be seen that the IO model obtained by using the ‘System Identification Toolbox’ available in MATLABr models the steady-state dynamics rather well. However, it does not capture a lot of the transient behavior. The fractional order model has a certain offset from the steady-state value, however, it has a slower rate of rise as compared to the IO model. The frequency response of the FO model also does not match that of the IO model. The IO model is thus chosen to be the best representation for testing the controllers to be designed for plasma position control. A value of 123V for the vertical field compensation voltage Vc , is the value at which the plasma lasts the longest (if other fields and parameters are adjusted to the values mentioned in Appendix G). If the value of Vc changes then the steady-state value of the plasma position changes, as is evident from fig. 6.7. The different transfer functions (IO models) found for different operating voltages for plasma position are as follows. It must be noted that the following models have been obtained with an aim of emulation using small signal analog electronics, hence a compensation voltage, Vc = 123V , has been represented by a 5V signal, and proportionally thereof for all the other compensation voltages. GiT (s)|Vc =123V = 2.84s3 + 1.14e7s2 + 1.12e14s + 4.5e20 s4 + 1.51e4s3 + 3.94e13s2 + 4.37e17s + 2.147e021 GiT (s)|Vc =100V = s3 115.7s2 + 1.355e9s + 5.424e15 + 6282s2 + 5.901e12s + 1.631e16 (6.6) (6.7) GiT (s)|Vc =95V = −1.343e4s5 − 7.79e10s4 − 3.5e17s3 − 7.93e23s2 − 7.93e29s + 4.56e32 s6 + 1.65e4s5 + 2.16e13s4 + 2.93e17s3 + 3.39e25s2 + 3.04e29s + 1.19e33 (6.8) GiT (s)|Vc =90V = −4.673e6s5 − 1.773e13s4 − 5.84e19s3 − 6.22e25s2 − 1.82e31s + 1.31e34 s6 + 1.49e6s5 + 1.56e13s4 + 1.31e19s3 + 3.31e25s2 + 1.05e31s + 2.9e34 (6.9) As stated earlier, eq. (6.6) represents the most stable operating condition for the tokamak. 82 For all further analysis, experimentation and comments, eq. (6.6) will be used as the nominal system model. It can be seen from the Bode plot in fig. 6.9 that the magnitude remains constant almost over five decades. The phase remains almost at zero degrees for approximately the same length. Signifying that the model for the complex device known as the tokamak, is unfortunately nothing more than a pure DC gain. As a result a simple IO transfer function will suffice, not necessitating the use of a FO model. The FO model used in fig. 6.8 is obtained as described in sec. 4.2.2. Equation (6.10) shows the FO model for the IO model described in eq. (6.6). Gf T (s)|Vc =123V = −285.457 103.256 + 0.746 + 242.071 s + 395.806 s1.5645 (6.10) The model represented in eq. (6.10) is not used for two reasons, the first being a poor fit in the frequency domain (which was the best fit ever obtained for an FO model for the tokamak). The second reason is the high gains required on the amplifiers in order to implement the transfer function. A gain of 400 for any operational amplifier not only means amplifying the input 400 times, but it also implies amplifying the noise by the same Fig. 6.9: Bode plot for GiT (s)|Vc =123V . 83 amount. Hence for reasons of practicality, this model has been discarded. Figure 6.10 shows a comparative plot of the output obtained by using the transfer function represented by eq. (6.6), its FOPDT equivalent shown in eq. (6.11), and the corresponding analog hardware model. GT (s)|Vc =123V = 0.2096e−0.0007s 0.0864s + 1 (6.11) The output from the analog hardware model is obtained by using the FO-model board shown in fig. 5.7. However since this is a simple FOPDT model, the ‘Fractors’ are replaced by capacitors with capacitances of 1µF in order to achieve the right rate of rise. The potentiometers are adjusted to get the correct amplitude (gain) on the output signal as required. From fig. 6.10 it is evident that the output of the analog hardware model of the tokamak is slightly higher than the output obtained from eq. (6.6). This is done on purpose in order to test the robustness of the analog FO controller board. A question may arise regarding the necessity of emulating the nominal transfer function for plasma position using analog hardware. The answer lies in the fact that an H-I-L test setup would be far too slow. Although the performance can be simulated using Simulinkr , Fig. 6.10: Analog hardware model of the tokamak for Vc = 123V . 84 yet it does not give any concrete evidence about the controllers reliability of performance when actually tested on field. A GP 6 analog computer was also tried in order to circumvent the necessity of building separate hardware, however, the potentiometers on the GP 6 limit the rise time to a value that is unacceptable for the process in question. The GP 6 manual by Petersen [48] is an invaluable reference for learning more about the device and the ways to use it. It appears from fig. 6.10 that the rise time of the analog hardware is nowhere near the rise times of the models describing the system. It must be noted that the minimum possible sampling interval allowed by the Quanser system (which is used to acquire data for this particular experiment) is 1ms. Hence, nothing can really be said about the data in between. But from the plot it is obvious that the output reaches its steady-state value after 1ms, which is in conformation to the output obtained from the IO model in eq. (6.6). 6.6 Controller Design Equations (3.4) and (3.5) described in sec. 3.4 are used to design the FO-PI controller for the tokamak system. Table 6.2 shows the parameters of the FO-PI controller and the ZN-PID controller used to carry out the experiments mentioned in this chapter. As for previous experiments in this work, the FO-PI controller has been tuned according to Chen and Bhaskaran’s tuning rules [12]. 6.7 Experimental Setup The setup shown in fig. 5.12 has been used for the hardware experiments; the only changes being the adjustment of the plant parameters to model the tokamak system. The Table 6.2: Controller parameters for the STOR-1M tokamak. Controller FO−PI ZN−PID Kp 170.2649 706.584 Ki 32.0719 714.285 Kd 0 0.00035 Order 0.7425 1 85 controller gains are also tuned according to the values in table 6.2. The simulation results are obtained using a standard Simulinkr model with a controller and a plant, designed as per the parameters provided in the preceding sections. 6.8 Results This section presents the results of the experiments described in the preceding section. It must be noted that the hardware experiments are emphasized more for the tokamak system. Simulating a process for a length of time in the order of a few milliseconds is easy to do in software. However, testing the behavior of the hardware and seeing if it works in the same time frame are of paramount importance. Sampling time limitations, and the difficulty in adding disturbances (within the time span of 5ms) to the hardware experiments, make the results from the hardware and the simulation appear different. 6.8.1 Simulation Results From fig. 6.11 it can be seen that the FO-PI controller performs much better than Fig. 6.11: Plasma position control - simulation for Vc = 123V . 86 the ZN-PID controller. The IO-PID controller shows a lot of oscillations in the output and needs about 0.8ms to settle down to the required reference. The FO-PI controller achieves the same within 0.3ms, without any overshoot or oscillations. A disturbance of about 0.6cm on each side has been introduced into the simulation. The FO-PI controller rejects it almost immediately, whereas the ZN-PID controller shows some oscillations in this case too. 6.8.2 Analog Hardware Emulation Results Figure 6.12 shows the results of one of the analog hardware emulation experiments performed with the analog FO-PI controller board and the analog FO model board for the tokamak system. It should be noted that fig. 6.12 represents the ratio of the horizontal magnetic pickup coil voltages. Thus, the objective is to maintain the ratio at unity. From fig. 6.12 it can be seen that the controller responds fast. In about 2ms from the start, the output reaches very close to the desired set point. There is an overshoot of about 0.5%, and at about 3ms it can be said that the output has settled close to the expected reference. Thus for a plasma lifetime of about 4 − 5ms, or even 3.5ms, it is seen that the proposed Fig. 6.12: Plasma position control (ratio) - hardware emulation for Vc = 123V . 87 FO-PI controller will work well. Figure 6.13 shows the error signal for the experiment whose results are displayed in fig. 6.12. From the error plot it is clear that after 2ms the error is almost zero, which shows that the controller acts fast and stays at the reference. Figure 6.14 shows the results displayed in fig. 6.12 in terms of the equivalent plasma position in centimetres. Note that the model and the controller are designed to control the ratio of the horizontal magnetic pickup coil voltages, since, one does need to know the absolute position for control purposes. Figure 6.14 has been included for better understanding of the real physical position control of the plasma column. All the experimental results are based on the assumption that the vertical field compensation voltage is maintained at 123V , and all other parameters are as mentioned in Appendix G, corresponding to the most stable operational condition observed. Figure 6.15 is shown just to verify controller operation for a different reference and also to check disturbance rejection. A disturbance is added at about 2ms, the controller is seen to recover from it and get back to the desired reference. Some oscillations are observed in this case. Figure 6.16 shows the comparison between the ZN-PID controller and the FO-PI controller for a different set of tests that were carried on Fig. 6.13: Plasma position control (error) - hardware emulation for Vc = 123V . 88 Fig. 6.14: Plasma position control (absolute) - hardware emulation for Vc = 123V . Fig. 6.15: Plasma position control (test) - hardware emulation for Vc = 123V . 89 the analog hardware emulation setup. For this test, a disturbance was added at the start, hence the delayed operation (i.e., the output converges to the reference at 3ms as opposed to 2ms as observed in fig. 6.12). From fig. 6.16 it is clear that even for extremely high speed applications, the FO-PI controller is slightly faster than the ZN-PID controller tuned as per the gains presented in table 6.2. On measuring the time difference it is found that the FO-PI controller has an advantage of 1µs over the IO, ZN-PID controller. The gains required for the FO-PI controller are significantly lower than that of the ZN-PID controller, implying lesser control effort and lower amplification of noise. 6.9 Difference Based Modeling and Control The models for plasma position presented in the previous section are based on the ratio of the voltages of the inner and outer magnetic position pickup coils. However, analog division of two signals is a challenging operation and it raises concerns of reliability and ‘divide by zero’ errors. Some possible implementations for analog signal division [49, 50] have been presented in Appendix F. Fig. 6.16: Plasma position control (comparison) - hardware emulation for Vc = 123V . 90 However for purposes of control, one can consider the difference between the horizontal magnetic pickup coil signals, to get around the problems associated with division. Again, as one does not need to know the absolute position for the purposes of control, the reference to the controller can just be zero. A null difference between the voltages of the pickup coils would mean that the plasma column is centered. Figure 6.17 shows the actual (and Fig. 6.17: Modeling based on pickup coil signal difference. 91 modeled) difference in voltages as obtained from the horizontal magnetic pickup coils. GiT (s)|Dif f,Vc =123V = A(s) , where, B(s) (6.12) A(s) = −1.035e4s14 − 1.381e11s13 − 1.16e18s12 − 7.616e24s11 −3.374e031s10 − 1.274e38s9 − 3.313e44s8 − 7.15e50s7 −9.928e56s6 − 1.02e63s5 − 4.86e68s4 − 8.78e73s3 +1.68e78s2 − 2.73e81s + 3.35e84 (6.13) B(s) = s15 + 9.535e6s14 + 8.74e13s13 + 6.027e20s12 + 2.662e27s11 +1.318e34s10 + 3.47e40s9 + 1.205e47s8 + 1.914e53s7 +4.39e59s6 + 3.7e65s5 + 4.69e71s4 + 1.29e77s3 +8.96e80s2 + 1.303e84s + 3.591e87 (6.14) Equations (6.13) and (6.14) present the numerator and denominator polynomials of the model representing the difference in voltages of the horizontal position magnetic pickup coils. The model is obtained using a Box-Jenkins (BJ) model found in the ‘System Identification Toolbox’ available in MATLABr . As is clearly observed, the model required is of a very high order, and it would be intuitively obvious that the difference between the coil voltages would change with almost every shot. It is also seen from fig. 6.17 that the difference between the coil voltages has a non-zero mean value. For testing the controller, this mean value is modeled as a FOPDT system and the variations in the voltage difference observed in fig. 6.17 are added as a disturbance, for judging the controller performance. The FOPDT equivalent for the model in eqs. (6.12), (6.13), and (6.14) is as follows: GT (s)|Dif f,Vc =123V = 0.000676e−0.0007s . 0.0001275s + 1 (6.15) It is observed from table 6.3 that the gains of the FO-PI controller are significantly higher than that for the previous case. This can be attributed to the fact that the values for K, L, and T in eq. (6.15) are very small. Also, the values for the PID controller are not much 92 different than that from the previous case. According to step response ZN-PID tuning rules, the values of Ki , and Kd are dependent on the delay L, which is the same for both cases. Figure 6.18 shows the comparison of the ZN-PID and FO-PI controllers tuned as per the gains presented in table 6.3. The output labeled ‘FO-PI2’ corresponds to the controller tuned according to the gains in table 6.2. All the controllers have near similar performance Table 6.3: Controller parameters for the STOR-1M tokamak - voltage difference based. Controller FO−PI ZN−PID Kp 520.4958 323.2761 Ki 2219.6163 714.2857 Kd 0 0.00035 Order 1.1 1 Fig. 6.18: Controller performance for the signal difference case, reference = 0V . 93 for this case, and each of them attain the set-point of zero within 0.5ms. A disturbance from the actual output data is also added, and the controllers are seen to recover quickly. It is interesting that the controller used for controlling the plasma position, designed based on the ratio of the magnetic coil pickup signals, works the best. It might be of practical value to use this controller, since the gains required are still within the practical limits laid down by hardware, noise issues, etc. 6.10 Conclusion From the experimental results presented in the previous section, it can be concluded that the FO-PI controller works better than the ZN-PID controller. Despite the extremely fast operational requirements, the FO-PI controller manages to be faster than the ZN-PID controller. The results have been confirmed by hardware emulation, thus corroborating the fact that the proposed controller is feasible for implementation on the STOR-1M tokamak. 94 Chapter 7 Conclusion The preceding chapters have presented a variety of applications of fractional calculus in control systems. The conclusions of this work can thus be summarized as follows. 7.1 Summary The FO-UAS experiments provide some insight into the power of the application of fractional calculus to control engineering. The FO-UAS strategy outdoes the integer order UAS in every aspect possible. It also shows us that one can achieve extremely fast response times by using fractional derivatives and integrals in the control loop. The steady-state error is also minimal. What is more intriguing is that the FO-UAS can track sinusoidal and sawtooth references of varying frequencies along with the regular square wave. The use of the Mittag-Leffler function (which forms the base of fractional calculus) as the Nussbaum function shows great benefits as compared to other functions, in terms of steady-state error and control effort. The integer order UAS is known to be affected by noise and is also known to be a poor performer when tracking low references. The FO-UAS scheme however works without any problems for extremely low references, and also in the presence of external noise. Even in the presence of noise the control effort does not saturate, which is an extremely valuable feature of this control strategy. Experiments on the coupled tank system provide some interesting results as well. The coupled tank system has a large time constant and the sensors are extremely noisy with a high degree of nonlinearity in the lower range of operation. From the results we can conclude that digital (H-I-L) control whether integer order PID or FO-PI, is inferior to their purely analog counterparts by a substantial margin. Another important conclusion is that any required FO-PI controller can be approximated by a number of the available 95 ‘Fractors.’ Surprisingly, the approximated analog FO-PI controller is seen to have the best performance as compared to all other controllers. The presence of a greater number of ‘Fractors’ can thus be concluded to be beneficial. FO-PI control also results in a lot less actuator saturation and lesser average control output, it is thus more efficient. From the experiments on the heat flow plant it can be concluded that fractional order modeling of systems is not only possible in theory, but it can also be implemented in real life. It can also be used as a tool to reduce the order of integer order models. The heat flow plant has a very slow response and the benefits of using an FO-PI controller are readily observable. Low control effort, lesser overshoot, lesser oscillations are some of them. The superiority of purely analog control over digital H-I-L control is obvious from the results obtained. Noise, oscillations, and delay are reduced to a great extent when one uses an FO-PI controller in the analog setting. The fan and plate system provides an interesting challenge because it is affected by nonlinear phenomenon like air turbulence, compressibility of air, etc. The system is extremely noisy and has a certain delay. It can be easily concluded from the experimental results that the ZN-PID controller is not a prudent choice for such systems because it is affected by noise, the output does not follow the reference well, and it has poor disturbance rejection. Using the FO-PI controller solves the above problems, and even though the system is noisy, the output returns to the desired reference almost immediately after a disturbance occurs. A model of the fan and plate system is implemented in hardware and the analog FO-PI controller is tested on it to provide some interesting results. When the ‘Fractors’ are replaced by capacitors to make the analog FO-PI board into a IO-PID board, the controller is seen to be slower. The control output is seen to be saturated longer, and a small but definite steady-state error is observed. Using an analog FO-PI controller overcomes all the problems mentioned. It can thus be concluded that the FO-PI controller is definitely better than the integer order controller. All of the experimentation in this work has been performed with the sole aim of testing the FO-PI control strategy that is designed for the STOR-1M tokamak. Before the plasma 96 position can be controlled, it is important to be able to estimate the plasma position. Using the ratio of voltages from the magnetic pickup coils can be concluded to be the easiest and most useful method of estimating position offline. For the tokamak it is observed that integer order modeling works a lot better than the equivalent fractional order model. The simulation results show that the FO-PI controller is faster than the IO-PID controller, has lesser output oscillations and better disturbance rejection characteristics. Analog hardware experiments performed with the analog FO controller and model boards confirm the findings obtained from the simulations. The analog FO-PI controller is faster than the purely analog implementation of the ZN-PID controller, and has an advantage of about 1µs over the ZNPID controller. In a process which lasts only about 4−5ms, this can prove to be a significant advantage. The FO-PI controller designed for the tokamak system is also robust and handles disturbances well. The final conclusion is that fractional order calculus is practically useful in control science; it helps to obtain much better results as compared to the presently widespread integer order methodologies. 7.2 Future Work Understanding the reasons behind the superior operation of the FO-UAS when tracking sinusoidal, sawtooth references is a definite direction for future work. Also, understanding the reason behind the better performance of certain Nussbaum functions over the others promises to be an interesting area for future work. Developing different controller structures for FO control, newer tuning rules is a future possibility. This work provides a nudge in the direction of FO modeling. Using the basic FO model boards, cascading them or using them in parallel can be used to get more accurate FO models of systems. Using strategies other than a frequency domain fit to model FO systems can be explored. Developing the FO controller board into an independent unit which tunes itself either automatically or using programmed rules, and using this FO controller unit to control a variety of plants by simply connecting them to it is definitely an exciting idea. Implementing 97 the controller on the real STOR-1M tokamak system is a definite future step. Studying the effectiveness of fractional calculus on such a system in real life will be an exciting area for future work. 98 References [1] K. B. Oldham and J. Spanier, The Fractional Calculus:Integrations and Differentiations of Arbitrary Order. New York: Academic Press, 1974. [2] I. Podlubny, Fractional Differential Equations. An Introduction to Fractional Derivatives, Fractional Differential Equations, Some Methods of Their Solution and Some of Their Applications. San Diego-Boston-New York-London-Tokyo-Toronto: Academic Press, 1999. [3] S. Samko, A. Kilbas, and O. Marichev, Fractional Integrals and Derivatives: Theory and Application. Yverdon, Switzerland: Gordon and Breach Science Publishers, 1993. [4] K. Miller and B. Ross, An Introduction to the Fractional Calculus and Fractional Differential Equations. New York: John Wiley and Sons Inc., 1993. [5] J. B. Ziegler and N. B. Nichols, “Optimum settings for automatic controllers,” Transactions of the American Society of Mechanical Engineers, vol. 64, pp. 759–768, 1942. [6] K. J. ˚Aström and T. Hägglund, PID Controllers: Theory, Design, and Tuning. search Triangle Park, NC: Instrument Society of America, 1995. Re- [7] K. J. ˚Aström and T. Hägglund, “Automatic tuning of simple regulators with specifications on phase and amplitude margins,” Automatica, vol. 20, pp. 645–651, 1984. [8] A. Oustaloup, “From Fractality to Non Integer Derivation Through Recursivity, A Property Common to These Two Concepts: A Fundamental Idea for A New Process Control Strategy,” in Proceedings of the Twelfth International Association for Mathematics and Computers in Simulation World Congress, Paris, France, vol. 3, pp. 203–208, July 1988. [9] A. Oustaloup, F. Levron, B. Mathieu, and F. Nanot, “Frequency-band complex noninteger differentiator: Characterization and synthesis,” IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, vol. 47, no. 1, pp. 25–39, Jan. 2000. [10] A. Ilchmann, Non-Identifier-Based High-Gain Adaptive Control. New York: SpringerVerlag, 1993. [11] Y. Li, Y. Chen, and Y. Cao, “Fractional order universal adaptive stabilization,” Third International Federation of Automatic Control Workshop on Fractional Differentiation and its Applications, Ankara, Turkey, Nov. 2008. [12] Y. Chen and T. Bhaskaran, “Practical Tuning Rule Development for Fractional Order Proportional and Integral Controllers,” Journal of Computational and Nonlinear Dynamics, vol. 3, pp. 021 403–1–021 403–8, Apr. 2008. 99 [13] C. Wang, Y. Jin, and Y. Chen, “Auto-tuning of FOPI and FO[PI] controllers with iso-damping property,” Submitted to the joint IEEE Decision and Control Conference and Chinese Decision and Control Conference (CDC-CCC09), Shanghai, China, Dec. 2009. [14] V. Bhambhani, Y. Q. Chen, and D. Xue, “Optimal fractional order proportional integral controller for varying time-delay systems,” 17th International Federation of Automatic Control World Congress, July 2008. [15] T. Djamah, R. Mansouri, S. Djennoune, and M. Bettayeb, “Optimal Low Order Model Identification of Fractional Dynamic Systems,” Applied Mathematics and Computation, vol. 206, pp. 543–554, Dec. 2008. [16] S. Das, Functional Fractional Calculus for System Identification and Controls. BerlinNew York: Springer, 2007. [17] G. Bohannan, “Analog Realization of a Fractional Control Element - Revisited,” in Proceedings of the 41st IEEE International Conference on Decision and Control, Tutorial Workshop 2: Fractional Calculus Applications in Automatic Control and Robotics, Las Vegas, pp. 203–208, Dec. 2002. [18] I. Petras, I. Podlubny, P. O’Leary, L. Dorčák, and B. Vinagre, Analogue Realization of Fractional Order Controllers. Kosice: FBERG, Technical University of Kosice, 2002. [19] J. Wesson and D. Campbell, Tokamaks. Oxford: Clarendon Press, 2004. [20] R. White, The Theory of Toroidally Confined Plasmas. Press, 2006. London: Imperial College [21] B. Kadomstev, F. Troyon, M. Watkins, P. Rutherford, M.Yoshikawa, and V. Mukhovatov, “Tokamaks,” Nuclear Fusion, vol. 30, no. 1675-1694, 1990. [22] L. A. Artsimovich, Controlled Thermonuclear Reactions. Breach Science Publishers, 1964. New York: Gordon and [23] M. Ariola and A. Pironti, Magnetic Control of Tokamak Plasmas. London: SpringerVerlag, 2008. [24] S. W. Wolfe, The STOR-1M Tokamak: Experiments on Current Reversal and Fast Current Ramping. Ph.D. Thesis, University of Saskatchewan, Saskatoon, Dec. 1986. [25] M. Emaami-Khonsari, Modelling and Control of Plasma Position in the STOR-M Tokamak. Ph.D. Thesis, University of Saskatchewan, Saskatoon, 1990. [26] G. Bateman, MHD Instabilities, 2nd ed. Cambridge, MA: MIT Press, 1980. [27] S. Mukhopadhyay, Y. Li, and Y. Chen, “Experimental Studies of a Fractional Order Universal Adaptive Stabilizer,” Mechtronic and Embedded Systems and Applications, 2008. IEEE/ASME International Conference, pp. 591–596, Oct. 2008. 100 [28] S. Townley, “Generic properties of universal adaptive stabilization schemes,” Decision and Control, Proceedings of the 31st IEEE Conference, vol. 4, pp. 3630–3631, Sept. 1992. [29] H. Lei and W. Lin, “A universal control approach for a family of uncertain nonlinear systems,” Proceedings of the 44th IEEE Conference on Decision and Control, and the European Control Conference, pp. 802–807, Dec. 2005. [30] J. Zhang and P. A. Ioannou, “Non-identifier based adaptive control scheme with guaranteed stability,” Proceedings of the 2006 American Control Conference, pp. 5456–5461, 2006. [31] H. Schuster, C. Westermaier, and D. Schröder, “Non-identifier-based adaptive tracking control for a two-mass system,” Proceedings of the 2006 American Control Conference, pp. 190–195, 2006. [32] H. Schuster, C. Westermaier, and D. Schröder, “Non-identifier-based adaptive control for a mechatronic system achieving stability and steady state accuracy,” Proceedings of the 2006 IEEE International Conference on Control Applications, pp. 1819–1824, Oct. 2006. [33] H. Lei, W. Lin, and B. Yang, “Adaptive robust stabilzation of a family of uncertain nonlinear systems by output feedback: The non-polynomial case,” Proceedings of the 2007 American Control Conference, pp. 5341–5346, July 2007. [34] Y. Li and Y. Chen, “When is a Mittag-Leffler Function a Nussbaum Function?” Automatica, vol. 45, no. 8, pp. 1957–1959, 2009. [35] “Universal Power Module http://www.quanser.com. - User Manual” [Online]. Available: [36] S. Mukhopadhyay, “Mittag-leffler Function, m-file, cMex DLL, and Sfunction,” July 2008, Matlab Central File Exchange [Online]. Available: http://www.mathworks.com/matlabcentral/fileexchange/20731. [37] “KentRidge Instruments Coupled-Tank Control Apparatus” [Online]. Available: http://www.kri.com.sg/ctank.html. [38] “Quanser Hardware in http://www.quanser.com. the Loop (H.I.L) Boards” [Online]. Available: [39] “Quanser Control Solutions - Wincon Manual.” [40] “eCircuit Center − Operational Amplifier − PID Controller” [Online]. Available: http://www.ecircuitcenter.com/Circuits/op_pid/op_pid.htm. [41] “TLV277x Operational Amplifiers” [Online]. Available: http://www.ti.com. [42] A. Wootton and L. Wang, “Tokamak position control,” IEEE Transactions On Plasma Science, vol. 18, no. 6, pp. 1008–1020, Dec. 1990. 101 [43] R. E. Kalman, “A new approach to linear filtering and prediction problems 1,” Transactions of the American Society of Mechanical Engineers − Journal of Basic Engineering, vol. 82, pp. 35–45, 1960. [44] G. Welch and G. Bishop, “An Introduction to the Kalman Filter,” Department of Computer Science, University of North Carolina at Chapel Hill, NC, Technical Report TR 95-041, 2004. [45] Y. Cao, “Learning the Kalman filter in r MATLAB Central File Exchange, Jan. 2008. [Online]. http://www.mathworks.com/matlabcentral/fileexchange/18465. Simulink,” Available: [46] S. Mukhopadhyay, C. Coopmans, and Y. Chen, “Purely analog fractional order PID control using discrete fractional capacitors (Fractors): Synthesis and experiments.” San Diego, USA: Submitted to the proceedings of the ASME IDETC/CIE 2009, Aug.Sept. 2009. [47] E. M. Purcell, Electricity and Magnetism, vol. 2. New York: McGraw-Hill, 1984. [48] I. Petersen, “Using the Comdyna GP−6 analog computer,” Department of Electrical Engineering, Australian Defence Force Academy [Online]. Available: http://routh.ee.adfa.edu.au/~irp/Teaching/Control_Theory_1/Lab2/lab2.pdf. [49] D. Cripe, “Analog divider uses few components,” Electronics Design, Strategy News-EDN, Europe, Mar. 2007. [Online]. Available: http://www.edn-europe.com/analogdividerusesfewcomponents+article+553+Europe.html. [50] “Op amp circuit collection,” Sept. 2002, National Semiconductor Application Note 31 [Online]. Available: http://www.national.com. 102 Appendices 103 Appendix A Fractional Order Derivatives and Integrals This Appendix provides an extremely condensed and brief introduction to the most important and commonly used definitions when dealing with fractional order calculus. The results quoted here are from Podlubny’s book [2]. The readers are suggested to use the book for further details. A.1 Fractional Order Derivatives Definition A.0.1 General expression for the Grünwald-Letnikov(GL) derivative, for p > 0. p a Dt f (t) = h−p lim h→0 nh = t − a n X n (−1)r f (t − rh) r r=0 (A.1) Definition A.0.2 GL fractional derivative of the power function. p a Dt (t − a)ν = Γ(ν + 1) (t − a)ν−p Γ(−p + ν + 1) (A.2) Where (p < 0, ν > −1) or (p ≥ 0, ν > [p]), where [p] denotes the integer part of p. Definition A.0.3 The Riemann-Liouville(RL) fractional derivative. p a Dt f (t) 1 = Γ(m + 1 − p) d dt (m+1) Z t (t − τ )(m−p) f (τ )dτ, (m ≤ p < m + 1) a Where m = [p]. (We can also use m ∈ Z, see the next definition). (A.3) 104 Definition A.0.4 The fractional order Caputo derivative. C α a Dt f (t) = 1 Γ(n − α) Z t a f (n) (τ )dτ , (n − 1 < α < n), (n ∈ Z) (t − τ )α+1−n (A.4) Assuming 0 ≤ n − 1 < α < n and f (t) has n + 1 continuous derivatives in [a, T ] ∀ T > a; as shown in eq. (A.5) the Caputo derivative becomes a conventional nth derivative of f (t) lim C Dα f (t) α→n a t n = f (a) + Z t f (n+1) (τ )dτ = f (n) (t), n = 1, 2, ... (A.5) a • Practical advantages of the Caputo approach The Riemann-Liouville approach leads to initial conditions containing the limit values of the Riemann-Liouville fractional derivatives at the lower terminal t = a as shown in eq. (A.6) lim t→a α−1 f (t) a Dt = b1 (A.6) where b1 is a given constant. The condition given in eq. (A.6), although mathematically useful is practically useless hence the the Caputo approach with initial conditions as given in eq. (A.5) is used for engineering problems. Definition A.0.5 The left Riemann-Liouville derivative. If k − 1 ≤ p < k, then p a Dt f (t) 1 = Γ(k − p) d dt k Z t (t − τ )k−p−1 f (τ )dτ, (k ∈ Z) (A.7) a Definition A.0.6 The corresponding right Riemann-Liouville derivative. p t Db f (t) 1 = Γ(k − p) d − dt k Z t b (t − τ )k−p−1 f (τ )dτ, (k ∈ Z, k − 1 ≤ p ≤ k) (A.8) 105 A.2 Properties of Fractional Derivatives Linearity: Dp (λf (t) + µg(t)) = λD p f (t) + µDp g(t), (λ, µ ∈ C) (A.9) Leibniz rule: If f (t) is continuous in [a, t] and ϕ(t) has n + 1 continuous derivatives in [a, t] then: p a Dt (ϕ(t)f (t)) n X p (k) p−k p ϕ (t) a Dt f (t) − Rn (t) k k=0 = (A.10) where, Rnp (t) = 1 n!Γ(−p) Z t (t − τ )−p−1 f (τ )dτ a Z t ϕn+1 ()(τ − )n d. (A.11) τ Fractional derivatives of a composite function: ∞ X p k!(t − a)k−p Γ(k − p + 1) k k=1 !ar k X X 1 h(r) (t) (m) k × F (h(t)) Πr=1 ar ! r! p a Dt F (h(t)) = a)−p (t − ϕ(t) + Γ(1 − p) (A.12) m=1 where Pk r=1 rar = k and Pk r ar = m. RL fractional differentiation of an integral depending on a parameter: α 0 Dt Z 0 t K(t, τ )dτ = Z 0 t α τ Dt K(t, τ )dτ + lim τ →t−0 α−1 K(t, τ ) τ Dt (A.13) 106 A.3 Fractional Integrals and Laplace Transforms of Fractional Derivatives Definition A.0.7 Grünwald-Letnikov fractional integral. −p a Dt f (t) = hp lim h→0 nh = t − a n X p f (t − rh) r r=0 (A.14) Or −p a Dt f (t) 1 = Γ(p) Z t (t − τ )p−1 f (τ )dτ (A.15) a If the derivative f 0 (t) is continuous in [a, b] then integrating eq. (A.15) by parts we get −p a Dt f (t) f (a)(t − a)p 1 = + Γ(p + 1) Γ(p + 1) t Z (t − τ )p−1 f 0 (τ )dτ (A.16) a Definition A.0.8 The Laplace transform of the RL derivative L{0 Dpt f (t); s} = sp F (s) − n−1 X k=0 sk h i p−k−1 f (t) 0 Dt t=0 , (n − 1 ≤ p < n) (A.17) Definition A.0.9 The Laplace transform of the Caputo derivative p p L{C 0 Dt f (t); s} = s F (s) − n−1 X sp−k−1 f (k) (0), (n − 1 < p ≤ n) (A.18) k=0 Definition A.0.10 The Laplace transform of the Grünwald-Letnikov derivative L{0 Dtp f (t); s} = sp F (s) (A.19) 107 Appendix B Bode Plots of Available ‘Fractors’ - July 18, 2008 The following figures show the Bode plots of the various available ‘Fractors’ (FO integrators in which these devices were used). These devices were built during the years 2001 - 2003 and some appear to have aged. Signs of aging are differences between the expected and the current characteristics. Some of the ‘Fractors’ appear to have no flat phase at all (due to aging), however the ‘Fractors’ which show a gradual change in their phase plots still have the flat phase phenomenon occurring over a very small bandwidth. The eqs. (3.2) and (3.3) are useful and important with regard to the use of ‘Fractors.’ Fig. B.1: ‘Fractor-0’ Bode plot, α = 0.5175. 108 Fig. B.2: ‘Fractor-1’ Bode plot, α = 0.5645. Fig. B.3: ‘Fractor-2’ Bode plot, α = 0.7425. 109 Fig. B.4: ‘Fractor-3’ Bode plot, α = 0.7900. Fig. B.5: ‘Fractor-4’ Bode plot, α = 0.9440. 110 Fig. B.6: ‘Fractor-5’ Bode plot, α = 0.8630. Fig. B.7: ‘Fractor-6’ Bode plot, α = 0.9190. 111 Fig. B.8: ‘Fractor-7’ Bode plot, α = 0.8680. Fig. B.9: ‘Fractor-8’ Bode plot, α = 0.7460. 112 Fig. B.10: ‘Fractor-9’ Bode plot, α = 0.3850. Fig. B.11: ‘Fractor-10’ Bode plot, α = 0.6495. 113 Appendix C Bode Plots of Available ‘Fractors’ - June 22, 2009 The following plots show the Bode plots of the ‘Fractors’, measured at a different date. As seen in table C.1, there has been some change in the characteristics of the ‘Fractors’ over time. It must be noted that these devices have an impedance/resistance of the order of 1-5 MΩ. ‘Fractors’ 2, 3, and 7 appeared to be shorted at the time of the second measurement and had an impedance/resistance of about 2-4Ω. Hence, they can be declared unusable. Table C.1: ‘Fractor’ characteristics comparison. ‘Fractor’ No. 0 1 2 3 4 5 6 7 8 9 10 α-2008 0.5175 0.5645 0.7425 0.79 0.9440 0.8630 0.9190 0.8680 0.7460 0.3850 0.6495 α-2009 0.966 0.715 N/A N/A 0.99 0.905 0.922 N/A 0.7705 0.832 0.772 Change - %/yr 86.66% 26.66% N/A N/A 4.87% 4.64% 0.326% N/A 3.28% 116.103% 18.86% 114 Fig. C.1: ‘Fractor-0’ Bode plot, α = 0.966. Fig. C.2: ‘Fractor-1’ Bode plot, α = 0.715. 115 Fig. C.3: ‘Fractor-4’ Bode plot, α = 0.99. Fig. C.4: ‘Fractor-5’ Bode plot, α = 0.905. 116 Fig. C.5: ‘Fractor-6’ Bode plot, α = 0.922. Fig. C.6: ‘Fractor-8’ Bode plot, α = 0.7705. 117 Fig. C.7: ‘Fractor-9’ Bode plot, α = 0.832. Fig. C.8: ‘Fractor-10’ Bode plot, α = 0.772. 118 Appendix D Fractional Order Plant Board Details D.1 Model Board Operational Waveforms and Schematics Figure D.1 shows the open loop output obtained for a input signal with unit ampli- tude and 1Hz frequency. Specific parameters for obtaining this output are C7 = 2200µF, α = 0.5645, gains for integrators 1, 2, and the output buffer are 1, 5, and 3, respectively. Feedback and input resistances are equal. This setup can be used as a standard reference or as a check to see if the hardware is working properly prior to experimentation. Fig. D.1: Analog FO model board test I/O waveform. 119 D.2 Model Board Factsheet • All resistors used have a value of 10kΩ. • All potentiometers used have a value of 200kΩ. • Use testpoints TP1 and TP5 to measure the gain for integrator 1. • Use potentiometer R6 to change the gain for integrator 1. • Use testpoints TP4 and TP7 to measure the gain for integrator 2. • Use potentiometer R7 to change the gain for integrator 2. • Use testpoints TP3 and TP2 to measure the output gain. • Use potentiometer R5 to change the output gain. • Use testpoints TP8 and TP1 to measure the feedback gain. • Use potentiometer R9 to change the feedback gain. • Use power, input, and output polarities as marked on the circuit board. • The Switch across the ‘Fractor’ must be used to short it after prolonged operation. 120 Fig. D.2: Analog FO model board - enlarged schematic. 121 Appendix E Fractional Order Controller Board Details • Use testpoints TP1 and TP4 to measure gain Kp . • Use potentiometer R4 to change Kp . • Use testpoints TP5 and TP4 to measure gain Ki1 . • Use potentiometer R13 to change Ki1 . • Use testpoints TP8 and TP4 to measure gain Ki2 . • Use potentiometer R18 to change Ki2 . • Output gain can be measured across pins 9 and 14 of the second chip (marked IC4 in the schematic and placed vertically on the board). • Input power pin configuration (−5V, GN D, +5V ). • Reference pin configuration (−, +). • Feedback pin configuration (−, +). • Output pin configuration (+, −). • Pin configurations apply to the side with the printed text. • Switches across ‘Fractors’ must be used to short them after prolonged operation. • Other switches are useful for turning channels on or off selectively. 122 Fig. E.1: Analog FO-PII controller board - detailed schematic. 123 Appendix F Analog Signal Division - Schematics The operational details for the schematic shown in fig. F.2 can be found in the March 2007 issue of the Electronics Design Strategy News (EDN), Europe [49]. Fig. F.1: Analog divider 1 - courtesy of National Semiconductor. Fig. F.2: Analog divider 2 - courtesy of EDN, Europe. 124 Appendix G STOR-1M Tokamak System Details For the important system parameters pertaining to the STOR-1M tokamak please consult table 6.1. Table G.1 shows the nominal voltages for the various capacitor banks. These voltages represent to the nominal operating condition of the tokamak. The nominal values for the horizontal and vertical fields have been presented in table G.2. Table G.3 provides the calibration factors for the various Rogowski coils. The pickup coil parameters shown in table G.4 have been obtained from Wolfe’s thesis [24]. Table G.5 presents the details about bank firing times. Table G.6 shows the (most important) shots which were used to obtain the position model, controller etc. For all shots the operating pressure is required to be maintained at about 1.1 − 1.5 × 10−4 Torr. Table G.1: STOR 1-M, bank voltages (nominal values). Bank Name Voltage (V) BT 3000 HC 30 VC 123 VEF 470 VES 290 CTB 2400 CTF 220 CTS 190 Table G.2: STOR 1-M, horizontal and vertical field parameters. Bank Name Rated Voltage (V) Nominal Voltage (V) Variac Setting Voltmeter Multiplier HC 450 30 10/120 1 VC 150 123 34/120 30 VEF 750 470 50/120 100 VES 450 290 4.2/10 100 TH N/A 125 Table G.3: STOR 1-M, Rogowski coil parameters. Measured Parameter IP IBT IOH IV E IHC IV C Calibration Factor - A/V 127.075 × 106 1 10.95 × 106 3.7 × 106 3.18 × 106 4.117 × 106 Table G.4: STOR 1-M, plasma position magnetic pickup coil parameters. Coil Name Up Down In Out a(mm) 3.5 3.5 3.5 3.5 l(mm) 6 6 6 6 N 462 460 460 480 R(Ω) 22 22.2 22.6 22.8 L(mH) 0.97 0.93 0.96 1.01 Cal. - Gauss/V 3.23 3.37 3.26 3.17 Table G.5: STOR 1-M, bank timing and duration (ms). Bank Name BT HC VC VEF CTB CTF RF Firing Time 1.2 3.6 2.8 3.4 0 3.4 3.1 Duration 10 10 10 10 10 10 0.3 Table G.6: STOR 1-M, mini shot log. (Vc ) Bank Voltage 90V 95V 100V 123V 3535, 3560, 3581, 3601, Shot 3536, 3561, 3582, 3602, Numbers 3537, 3538, 3562, 3563, 3583, 3584, 3603, 3604, 3539 3564 3585 3605 126 Appendix H Mittag - Leffler Function: Code 1 # define S _ F U N C T I O N _ N A M E mitlef 2 /* D e f i n e s and I n c l u d e s - cMex v e r s i o n */ 3 # define S _ F U N C T I O N _ L E V E L 2 4 # i n c l u d e " math . h " 5 # i n c l u d e " s i m s t r u c. h " 6 % source of the gamma f u n c t i o n o b t a i n e d from Ooura ’ s M a t h e m a t i c a l S o f t w a r e P a c k a g e s - S p e c i a l F u n c t i o n s - Gamma / Error F u n c t i o n s 7 double dgamma ( double x ) 8 { 9 int k , n ; 10 double w , y ; 11 n = x < 1.5 ? -(( int ) (2.5 - x ) ) : ( int ) ( x - 1.5) ; 12 w = x - ( n + 2) ; 13 y = ( ( ( ( ( ( ( ( ( ( ( ( - 1 . 9 9 5 4 2 8 6 3 6 7 4e -7 * w + 1 . 3 3 7 7 6 7 3 8 4 0 6 7e -6) * w - 14 2 . 5 9 1 2 2 5 2 6 7 6 8 9e -6) * w - 1 . 7 5 4 5 5 3 9 3 9 5 2 0 5e -5) * w + 15 1 . 4 5 5 9 6 5 6 8 6 1 7 5 2 6e -4) * w - 3 . 6 0 8 3 7 8 7 6 6 4 8 2 5 5e -4) * w - 16 8 . 0 4 3 2 9 8 1 9 2 5 5 7 4 4e -4) * w + 0 . 0 0 8 0 2 3 2 7 3 0 2 7 8 5 5 3 4 6 ) * w - 17 0.017645244547851414) * w - 0.024552490005641278) * w + 18 0.19109110138763841) * w - 0.233093736421782878) * w - 19 0.422784335098466784) * w + 0.99999999999999999; 20 if ( n > 0) { 21 w = x - 1; 22 for ( k = 2; k <= n ; k ++) { 23 24 25 w *= x - k ; } } else { 127 26 w = 1; 27 for ( k = 0; k > n ; k - -) { 28 y *= x - k ; 29 } 30 } 31 return w / y ; 32 } 33 double o n e _ n o r m( double a r g u m e n t) { 34 // note in our case the a r g u m e n t is always a constant , hence the one norm is always the a b s o l u t e value 35 return fabs ( a r g u m e n t) ; 36 } 37 static void m d l I n i t i a l i z e S i z e s ( S i m S t r u c t * S ) 38 { 39 int_T i ; 40 s s S e t N u m S F c n P a r a m s (S , 0) ; 41 if ( s s G e t N u m S F c n P a r a m s ( S ) != s s G e t S F c n P a r a m s C o u n t ( S ) ) { 42 return ; /* P a r a m e t e r m i s m a t c h r e p o r t e d by the S i m u l i n k engine */ 43 } 44 s s S e t N u m I n p u t P o r t s (S ,5) ; // we have 5 inputs 45 // if (! s s S e t N u m I n p u t P o r t s (S , 1) ) return ; 46 // s s S e t I n p u t P o r t W i d t h (S , 0 , D Y N A M I C A L L Y _ S I Z E D ) ; 47 for ( i =0;i <5; i ++) { 48 s s S e t I n p u t P o r t W i d t h (S , i , 1) ; // each port is just one wide 49 s s S e t I n p u t P o r t D i r e c t F e e d T h r o u g h (S , i , 1) ; 50 } 51 s s S e t N u m O u t p u t P o r t s (S ,1) ; // need just one output port 52 // if (! s s S e t N u m O u t p u t P o r t s (S ,1) ) return ; 53 s s S e t O u t p u t P o r t W i d t h (S , 0 , 1) ; // width of output port is one 54 s s S e t N u m S a m p l e T i m e s (S , 1) ; 128 55 /* Take care when s p e c i f y i n g e x c e p t i o n free code - see s f u n t m p l. doc */ 56 s s S e t O p t i o n s (S , S S _ O P T I O N _ E X C E P T I O N _ F R E E _ C O D E ) ; 57 } 58 static void m d l I n i t i a l i z e S a m p l e T i m e s ( S i m S t r u c t * S ) 59 { 60 s s S e t S a m p l e T i m e (S , 0 , I N H E R I T E D _ S A M P L E _ T I M E ) ; 61 s s S e t O f f s e t T i m e (S , 0 , 0.0) ; 62 } 63 64 static void m d l O u t p u t s( S i m S t r u c t *S , int_T tid ) 65 { 66 int_T i ; 67 double alpha , beta , wye ,n , eps ; 68 int_T n I n p u t P o r t s = s s G e t N u m I n p u t P o r t s ( S ) ; 69 real_T * y = s s G e t O u t p u t P o r t R e a l S i g n a l (S ,0) ; 70 double f =0; 71 double fa =1; 72 double j =0; 73 for ( i = 0; i < n I n p u t P o r t s ; i ++) { 74 I n p u t R e a l P t r s T y p e uPtrs = s s G e t I n p u t P o r t R e a l S i g n a l P t r s (S , i ) ; 75 // since we a l r e a d y know that the number of inputs is 5 76 switch ( i ) { 77 case 0: 78 alpha =* uPtrs [0]; 79 break ; 80 case 1: 81 beta =* uPtrs [0]; 82 break ; 83 case 2: 84 wye =* uPtrs [0]; 85 break ; 129 86 case 3: 87 n =* uPtrs [0]; 88 break ; 89 case 4: 90 eps =* uPtrs [0]; 91 break ; 92 d e f a u l t: 93 return ; 94 } 95 } 96 //* y = alpha + beta + wye + n + eps ; - test line 97 while ( o n e _ n o r m( fa ) >= eps ) { 98 fa =(( dgamma ( j + n +1) / dgamma ( j +1) ) / dgamma ( alpha * j + alpha * n + beta ) ) * pow ( wye , j ) ; 99 f = f + fa ; j = j +1; 100 } 101 //* y = dgamma (5) ; - test line 102 *y=f; 103 } 104 static void m d l T e r m i n a t e ( S i m S t r u c t * S ) {} 105 /* S i m u l i n k/ Real - Time W o r k s h o p I n t e r f a c e */ 106 # ifdef M A T L A B _ M E X _ F I L E /* Is this file being c o m p i l e d as a MEX - file ? */ 107 # i n c l u d e " s i m u l i n k. c " /* MEX - file i n t e r f a c e m e c h a n i s m */ 108 # else 109 # i n c l u d e " c g _ s f u n. h " /* Code g e n e r a t i o n r e g i s t r a t i o n f u n c t i o n */ 110 # endif 130 Appendix I Fractional Order System Modeling: Code 1 %% e x a m p l e usage 2 %%[x , fval , exif ] = f m i n s e a r c h ( @ ( x ) fmdhf (x , wh , wl , N ) ,[1 1 1 1]) ; 3 f u n c t i o n f = fmdhf (v , wh , wl , N ) 4 % v = k1 a k2 b ; 5 % all a v a i l a b l e f r a c t i o n a l orders , you may accept these as an 6 % a r g u m e n t or modify the code m a n u a l l y 7 alpha10 = 0.6495; 8 alpha9 = 0.3850; 9 alpha8 = 0.7460; 10 alpha7 = 0.8680; 11 alpha6 = 0.9190; 12 alpha5 = 0.8630; 13 alpha4 = 0.9440; 14 alpha3 = 0.7900; 15 alpha2 = 0.7425; 16 alpha1 = 0.5645; 17 alpha0 = 0.5175; 18 d e l t a _ w =( wh - wl ) / N ; 19 s u m _ o f _ d i f f _ s q =0; 20 for j =1: N 21 wk = j *( d e l t a _ w) + wl ; 22 sv = sqrt ( -1) * wk ; 23 % enter plant t r a n s f e r f u n c t i o n here 24 num = 25 den = sv ^3 + 0 . 4 1 2 9 * sv ^2 + 0 . 0 4 7 3 2 * sv + 0 . 0 0 0 9 9 0 9 ; 26 trx = num / den ; 0 . 0 2 4 6 7 * sv ^2 + 0 . 0 0 6 5 5 2 * sv + 0 . 0 0 0 2 8 6 2 ; 131 27 sum = trx ; 28 a p p r o x _ t e r m =( v (1) /( sv ^ alpha (1) + v (2) ) ) +( v (3) /( sv ^ alpha (2) + v (4) ) ) ; 29 % change above line m a n u a l l y to i n c r e a s e terms or take in 30 % terms as a r g u m e n t 31 diff = sum - a p p r o x _ t e r m ; 32 s u m _ o f _ d i f f _ s q = s u m _ o f _ d i f f _ s q +( diff ^2) ; 33 end 34 f = abs ( s u m _ o f _ d i f f _ s q ) ; 35 end 132 Appendix J Approximation of an FO-PI Controller: Code 1 f u n c t i o n f = f r a c s p l i t( Ks , wh , wl ,N ,m , Kpo , Kio , ao , ais ) 2 if (( length ( ais ) <m ) ||( length ( Ks ) <(2* m ) ) ) 3 d i s p l a y( ’ Number of orders do not match a c t u a l l y s u p p l i e d orders ’) ; 4 f = inf ; 5 else 6 d e l t a _ w =( wh - wl ) / N ; 7 s u m _ o f _ d i f f _ s q =0; 8 for j =1: N 9 wk = j *( d e l t a _ w) + wl ; 10 sum =0; 11 count =0; % p o s i t i o n index 12 for i =1: m 13 Term = Ks ( i + count ) * Ks ( i + count +1) + Ks ( i + count +1) /(( sqrt ( -1)* wk ) ^ ais ( i ) ) ; 14 count = count +1; 15 sum = sum + Term ; 16 end 17 diff = sum -( Kpo + Kio /(( sqrt ( -1) * wk ) ^ ao ) ) ; 18 s u m _ o f _ d i f f _ s q = s u m _ o f _ d i f f _ s q +( diff ^2) ; 19 end 20 f= sum_of_diff_sq; 21 22 end end 133 Appendix K Plasma Position Estimation: Code K.1 Parameter Setter Script 1 global s t o p t i m e; 2 global d1 ; 3 global d2 ; 4 global d3 ; 5 global d4 ; 6 global d5 ; 7 global d6 ; 8 global d7 ; 9 global d8 ; 10 global S c o p e D a t a 4 ; 11 global S c o p e D a t a 5 ; 12 global S c o p e D a t a 8 ; 13 global S c o p e D a t a 9 ; 14 global ord ; 15 global f ; 16 % These are global v a r i a b l e s used by the p o s i t i o n c a l c u l a t o r do not 17 % change or delete 134 K.2 Position Estimator Model File Fig. K.1: Simulinkr model for plasma position estimation. 135 K.3 1 Plasma Position Calculator %% SYNTAX :: [ output ]= p l a s m a p o s i t i o n ( shot1 , shot2 , shot3 , shot4 , shot5 , filter_order , pass_band , e s t i m a t i on _mod e , s u p p r e s s) 2 %% usage :: p o s p a r a m ;[ y ]= p l a s m a p o s i t i o n (3601 ,3602 ,3603 ,3604 ,3605 ,1 ,8000 ,1 ,0) ; 3 %%[ output ]=[ t_horz h o r z _ d i s p t_vert v e r _ d i s p h _ r a t i o v _ r a t i o ]; follow format to e x t r a c t 4 %% TIP :: Best p e r f o r m a n c e o b t a i n e d with f i l t e r _ o r d e r =1 and p a s s _ b a n d =8000. If e s t i m a t i o n _ m o d e = 1 then it uses a ratio of 1 as center and ratio of 5.667 as wall , h o w e v e r if e s t i m a t i o n _ m o d e = 0 then it uses a ratio of 1 as center but a ratio of 2 as wall ( which should not be used ) . 5 %%============================================================== 6 %% NOTE : 7 %% p o s p a r a m sets the v a r i a b l e s needed by the s i m u l i n k files 8 %% DO NOT be a l a r m e d by w a r n i n g m e s s a g e s for divide by zero errors , always use as p o s p a r a m; p l a s m a p o s i t i o n (... a r g u m e n t s ...) ; they occur when the signal is i n i t i a l l y zero before the plasma starts , h o w e v e r it has been h a n d l e d i n t e r n a l l y in the s i m u l i n k files . 9 f u n c t i o n [ o u t _ d a t a ]= p l a s m a p o s i t i o n ( name1 , name2 , name3 , name4 , name5 , order , freq , Md , s u p p r e s s) 10 global s t o p t i m e; 11 global d1 ; 12 global d2 ; 13 global d3 ; 14 global d4 ; 15 global S c o p e D a t a 4 16 global S c o p e D a t a 5 17 global S c o p e D a t a 8 18 global S c o p e D a t a 9 19 global ord ; 20 global f ; 136 21 ord = order ; 22 f = freq ; 23 % read files 24 % r e a d _ 6 1 3 3 script d e v e l o p e d by Dr . Singh 25 [ head d a t a 1 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name1 ) ,’ _c . txt ’) ) ; 26 [ head d a t a 2 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name2 ) ,’ _c . txt ’) ) ; 27 [ head d a t a 3 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name3 ) ,’ _c . txt ’) ) ; 28 [ head d a t a 4 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name4 ) ,’ _c . txt ’) ) ; 29 [ head d a t a 5 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name5 ) ,’ _c . txt ’) ) ; 30 % e x t r a c t time 31 t = d a t a 1 _ c o m p (: ,1) ; 32 % d e t r e n d plasma c u r r e n t and remove biases 33 Ipavg = i p v a l i d a t o r ( name1 , name2 , name3 , name4 , name5 ,1) ; 34 % get mean p o s i t i o n coil data across 5 shots 35 c1avg = mean ([ d a t a 1 _ c o m p (: ,2) ’; d a t a 2 _ c o m p (: ,2) ’; d a t a 3 _ c o m p (: ,2) ’; d a t a 4 _ c o m p (: ,2) ’; d a t a 5 _ c o m p (: ,2) ’;]) ;% up 36 c2avg = mean ([ d a t a 1 _ c o m p (: ,3) ’; d a t a 2 _ c o m p (: ,3) ’; d a t a 3 _ c o m p (: ,3) ’; d a t a 4 _ c o m p (: ,3) ’; d a t a 5 _ c o m p (: ,3) ’;]) ;% down 37 c3avg = mean ([ d a t a 1 _ c o m p (: ,4) ’; d a t a 2 _ c o m p (: ,4) ’; d a t a 3 _ c o m p (: ,4) ’; d a t a 4 _ c o m p (: ,4) ’; d a t a 5 _ c o m p (: ,4) ’;]) ;% in 38 c4avg = mean ([ d a t a 1 _ c o m p (: ,5) ’; d a t a 2 _ c o m p (: ,5) ’; d a t a 3 _ c o m p (: ,5) ’; d a t a 4 _ c o m p (: ,5) ’; d a t a 5 _ c o m p (: ,5) ’;]) ;% out 39 % p r e p a r e data for s i m u l i n k 40 d1 =[ t c1avg ’]; 41 d2 =[ t c2avg ’]; 42 d3 =[ t c3avg ’]; 43 d4 =[ t c4avg ’]; 44 s t o p t i m e= t ( end ) ; 45 mode = Md ; 46 % assign zero for simple wall estimation , 1 47 % for a c c u r a t e wall e s t i m a t i o n 48 % sim ( ’ f i l t e r d i f f p o s . mdl ’) ; 137 49 % no sign change p o s i t i o n e s t i m a t o r by ratio 50 % sim ( ’ f i l t e r p o s n s . mdl ’) ; 51 % no sign change p o s i t i o n e s t i m a t o r by ratio 52 % sim ( ’ f i l t e r p o s. mdl ’) ; 53 % p o s i t i o n e s t i m a t o r by ratio - i n c o r p o r a t i n g sign change 54 if mode ==1 55 sim ( ’ f i l t e r p o s n s _ f i n a l . mdl ’) ; 56 % no sign change a c c u r a t e wall d e t e c t i o n 57 else 58 sim ( ’ f i l t e r p o s n s. mdl ’) ; 59 % p o s i t i o n e s t i m a t o r by ratio - i n c o r p o r a t i n g no sign change 60 end 61 bound =3.5* ones ( length ( t ) ,1) ; 62 z e r o l i n e =0* ones ( length ( t ) ,1) ; 63 if s u p p r e s s ==0 % plots s u p p r e s s e d 64 figure 65 if mode ==1 66 plot (t , c1avg ./ c2avg , ’g ’ , S c o p e D a t a 4. time , S c o p e D a t a 4. s i g n a l s. values , ’r ’) ; 67 else 68 plot (t , c2avg ./ c1avg , ’g ’ , S c o p e D a t a 4. time , S c o p e D a t a 4. s i g n a l s. values , ’r ’) ; 69 end 70 axis ([0 t ( end ) -5 5]) ; 71 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Pickup ratio ’) ; 72 title ( ’ V e r t i c a l p o s i t i o n coils ’) ; 73 figure 74 if mode ==1 75 plot (t , c3avg ./ c4avg , ’g ’ , S c o p e D a t a 5. time , S c o p e D a t a 5. s i g n a l s. values , ’r ’) ; 76 else 138 77 plot (t , c4avg ./ c3avg , ’g ’ , S c o p e D a t a 5. time , S c o p e D a t a 5. s i g n a l s. values , ’r ’) ; 78 end 79 axis ([0 t ( end ) -5 5]) ; 80 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Pickup ratio ’) ; 81 title ( ’ H o r i z o n t a l p o s i t i o n coils ’) ; 82 % above plots for filter data p e r f o r m a n c e 83 % lower plots for d i s p l a c e m e n t 84 figure 85 plot (t , zeroline , ’ k : ’) ; hold on ; 86 plot ( S c o p e D a t a 8. time , S c o p e D a t a 8. s i g n a l s. values , ’r ’) ; 87 hold on 88 plot (t , bound , ’b - - ’ ,t , - bound , ’k - - ’) ; 89 legend ( ’ Zero ’ , ’ Displacement ’ , ’ Upper bound ’ , ’ Lower bound ’) ; 90 axis ([0 t ( end ) -5 5]) ; 91 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ C e n t i m e t r e s from centre ’) ; 92 title ( ’ A p p r o x i m a t e V e r t i c a l displacement ’) ; 93 figure 94 plot (t , zeroline , ’ k : ’) ; hold on ; 95 plot ( S c o p e D a t a 9. time , S c o p e D a t a 9. s i g n a l s. values , ’r ’) ; 96 hold on 97 plot (t , bound , ’b - - ’ ,t , - bound , ’k - - ’) ; 98 legend ( ’ Zero ’ , ’ Displacement ’ , ’ Inner bound ’ , ’ Outer bound ’) ; 99 axis ([0 t ( end ) -5 5]) ; 100 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ C e n t i m e t r e s from centre ’) ; 101 title ( ’ A p p r o x i m a t e H o r i z o n t a l displacement ’) ; 102 % a u t o s a v e r enable if needed 103 % save ( ’ C :\ Files \ dat \ pos . mat ’ , ’ ScopeData8 ’ , ’ ScopeData9 ’) ; 104 figure 105 plot (t , Ipavg ) ; 106 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Amperes ’) ; 107 title ( ’ Plasma current ’) ; 139 108 grid on ; 109 end 110 o u t _ d a t a =[ S c o p e D a t a 9. time , S c o p e D a t a 9. s i g n a l s. values , S c o p e D a t a 8. time , S c o p e D a t a 8. s i g n a l s. values , S c o p e D a t a 5. s i g n a l s. values , S c o p e D a t a 4. s i g n a l s. values ]; 111 % Scope9 Hpos 112 % Scope8 Vpos 113 % Scope5 Hratio 114 % Scope4 Vratio 115 end K.4 Plasma Current Averaging and Validation 1 f u n c t i o n ret = i p v a l i d a t o r ( name1 , name2 , name3 , name4 , name5 , a s f u n c t i o n) 2 [ head data1 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name1 ) , ’. txt ’) ) ; 3 t = data1 (: ,1) ; % time 4 i p _ n e w _ m e a n = I p _ c a l _ m e a n ( name1 , name2 , name3 , name4 , name5 ) ; 5 cval = I p _ c o m p e n s a t o r ( i p _ n e w _ m e a n ) 6 i p _ n e w _ m e a n ( cval ) 7 if a s f u n c t i o n ==0 8 % method mode for d i s p l a y p u r p o s e s 9 figure 10 plot (t , i p _ n e w _ m e a n) ; 11 hold on 12 plot ( t (1: length ( t ) -1 ,:) , diff ( i p _ n e w _ m e a n ) ,’r ’) ; 13 hold on 14 plot (t , ip_new_mean - i p _ n e w _ m e a n ( cval ) ,’m ’) ; 15 title ( strcat ( ’ Shot nos . ’, n u m 2 s t r( name1 ) , ’ - - ’ , n u m 2 s t r( name2 ) , ’ - - ’ , n u m 2 s t r( name3 ) , ’ - - ’ , n u m 2 s t r( name4 ) , ’ - - ’ , n u m 2 s t r( name5 ) ) ) ; 16 legend ( ’ N u m e r i c a l l y i n t e g r a t e d Ip ’ , ’ A p p r o x i m a t e derivative ’ , ’ C o m p e n s a t e d Ip ’) ; 140 17 xlabel ( ’ Time - seconds ’) ; 18 ylabel ( ’ Ip - Amperes ’) ; 19 else 20 ret = ip_new_mean - i p _ n e w _ m e a n ( cval ) ; 21 % f u n c t i o n mode for use by others 22 23 end end K.5 Plasma Current De-trending 1 f u n c t i o n [ r e t _ n u m b e r ]= I p _ c o m p e n s a t o r ( ipval ) 2 d = diff ( ipval ) ; 3 for i =1: length ( d ) 4 if (( d ( i ) <=0.005) &&( d (i -1) <0) ) 5 % h i t t i n g end of plasma 6 d i s p l a y( ’ time found ’) ; 7 r e t _ n u m b e r =( i +1) ; 8 end 9 10 end end K.6 1 Plasma Position Estimation Using Mirnov Coils %% SYNTAX :: [ output ]= p l a s m a p o s i t i o n m i r n o v ( shot1 , shot2 , shot3 , shot4 , shot5 , filter_order , pass_band , e s t i m a t i on_ mode , suppress , cvolt , rotateby , time ) 2 %%[ output ]=[ t_vert v e r t _ d i s p t_h45 h 4 5 _ d i s p t_horz h o r z _ d i s p t_h135 h 1 3 5 _ d i s p ]; follow format to e x t r a c t 3 %% TIP :: Best p e r f o r m a n c e o b t a i n e d with f i l t e r _ o r d e r =1 and p a s s _ b a n d =8000 if e s t i m a t i o n _ m o d e = 1 then it uses a ratio of 1 as center and ratio of 5.667 as wall , h o w e v e r if e s t i m a t i o n _ m o d e = 0 then it uses a ratio of 1 as center but a ratio of 2 as wall ( which should not be used ) ; cvolt is the c o m p e n s a t i o n v o l t a g e valid 141 values are 123 , 90 , 95 , 100 volts , s u p p r e s s =1 does not show plots , use 0 to see plots , rotate by is the angle ( d e g r e e s) to rotate all coils by , r o t a t i o n is used to fit o b s e r v e d data to p r a c t i c a l coil a r r a n g e m e n t on the tokamak , time is the i n s t a n t in m i l l i s e c o n d s for the final s c a t t e r plot , if m a k e _ a _ m o v i e =1 then it makes a movie , use 0 for normal o p e r a t i o n 4 %%============================================================== 5 %% NOTE : 6 %% p o s p a r a m; p l a s m a p o s i t i o n m i r n o v (... a r g u m e n t s ...) ; 7 %% p o s p a r a m sets the v a r i a b l e s needed by the s i m u l i n k files 8 %% DO NOT be a l a r m e d by w a r n i n g m e s s a g e s for divide by zero errors , always use as they occur when the signal is i n i t i a l l y zero before the plasma starts , h o w e v e r it has been h a n d l e d i n t e r n a l l y in the s i m u l i n k files . 9 f u n c t i o n [ o u t _ d a t a ]= p l a s m a p o s i t i o n m i r n o v ( name1 , name2 , name3 , name4 , name5 , order , freq , Md , suppress , cvolt , rot , instant , m a k e _ a _ m o v i e ) 10 global s t o p t i m e; 11 global d1 ; 12 global d2 ; 13 global d3 ; 14 global d4 ; 15 global d5 ; 16 global d6 ; 17 global d7 ; 18 global d8 ; 19 global S c o p e D a t a 4 20 global S c o p e D a t a 5 21 global S c o p e D a t a 8 22 global S c o p e D a t a 9 23 global ord ; 24 global f ; 25 ord = order ; 142 26 f = freq ; 27 % read files 28 [ head d a t a 1 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name1 ) ,’ _c . txt ’) ) ; 29 [ head d a t a 2 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name2 ) ,’ _c . txt ’) ) ; 30 [ head d a t a 3 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name3 ) ,’ _c . txt ’) ) ; 31 [ head d a t a 4 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name4 ) ,’ _c . txt ’) ) ; 32 [ head d a t a 5 _ c o m p ]= r e a d _ 6 1 3 3 ( strcat ( n u m 2 s t r( name5 ) ,’ _c . txt ’) ) ; 33 % e x t r a c t time 34 t = d a t a 1 _ c o m p (: ,1) ; 35 Ipavg = i p v a l i d a t o r ( name1 , name2 , name3 , name4 , name5 ,1) ; 36 % get mean p o s i t i o n coil data across 5 shots 37 [ head data1 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name1 ) ,’ _d . txt ’) ) ; 38 [ head data2 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name2 ) ,’ _d . txt ’) ) ; 39 [ head data3 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name3 ) ,’ _d . txt ’) ) ; 40 [ head data4 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name4 ) ,’ _d . txt ’) ) ; 41 [ head data5 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name5 ) ,’ _d . txt ’) ) ; 42 % for mirnov coil data 1 = time , coils are 2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 43 [ head id1 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name1 ) ,’ _b . txt ’) ) ; 44 [ head id2 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name2 ) ,’ _b . txt ’) ) ; 45 [ head id3 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name3 ) ,’ _b . txt ’) ) ; 46 [ head id4 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name4 ) ,’ _b . txt ’) ) ; 47 [ head id5 ]= r e a d _ 6 1 3 3( strcat ( n u m 2 s t r( name5 ) ,’ _b . txt ’) ) ; 48 c o m p e n s a t i o n v o l t a g e = cvolt ; 49 % Mirnov coil c a l i b r a t i o n f a c t o r s o b t a i n e d from 50 % in lab e x p e r i m e n t a l data 51 f a c t o r v e c t o r = [ 4 4 8 . 9 2 9 0 ; 4 1 9 . 4 8 9 7 ; 4 4 9 . 5 1 9 7 ; 4 2 6 . 4 5 9 2 ; 4 8 6 . 5 9 8 9 ;_ 52 525.5160;493.7818;402.9175]; 53 % f o l l o w i n g if - loops read files for shots when the 54 % mirnov coils where c a l i b r a t e d 55 if c o m p e n s a t i o n v o l t a g e ==90 56 [ head c90a ]= r e a d _ 6 1 3 3 ( ’3661 _d . txt ’) ; 57 [ head c90b ]= r e a d _ 6 1 3 3 ( ’3662 _d . txt ’) ; 143 58 c 9 0 c o m p _ c o i l 1 = mean ([ c90a (: ,2) ’; c90b (: ,2) ’]) ; 59 c 9 0 c o m p _ c o i l 2 = mean ([ c90a (: ,3) ’; c90b (: ,3) ’]) ; 60 c 9 0 c o m p _ c o i l 3 = mean ([ c90a (: ,4) ’; c90b (: ,4) ’]) ; 61 c 9 0 c o m p _ c o i l 4 = mean ([ c90a (: ,5) ’; c90b (: ,5) ’]) ; 62 c 9 0 c o m p _ c o i l 5 = mean ([ c90a (: ,6) ’; c90b (: ,6) ’]) ; 63 c 9 0 c o m p _ c o i l 6 = mean ([ c90a (: ,7) ’; c90b (: ,7) ’]) ; 64 c 9 0 c o m p _ c o i l 7 = mean ([ c90a (: ,8) ’; c90b (: ,8) ’]) ; 65 c 9 0 c o m p _ c o i l 8 = mean ([ c90a (: ,9) ’; c90b (: ,9) ’]) ; 66 c 9 0 _ c o m p _ m a t =[ c 9 0 c o m p _coi l1 ’ , c 9 0 c o m p _coil2 ’ , c 9 0 c o m p _co il3 ’ , c 9 0 c o m p _coil 4 ’ , c 9 0 c o m p _ coil5 ’ , c 9 0 c o m p _coil 6 ’ , c 9 0 c o m p _ coil7 ’ , c 9 0 c o m p _coil 8 ’]; 67 d a t a 1 _ c o m p = data1 (: ,2:9) - c 9 0 _ c o m p _ m a t ; 68 d a t a 2 _ c o m p = data2 (: ,2:9) - c 9 0 _ c o m p _ m a t ; 69 d a t a 3 _ c o m p = data3 (: ,2:9) - c 9 0 _ c o m p _ m a t ; 70 d a t a 4 _ c o m p = data4 (: ,2:9) - c 9 0 _ c o m p _ m a t ; 71 d a t a 5 _ c o m p = data5 (: ,2:9) - c 9 0 _ c o m p _ m a t ; 72 elseif c o m p e n s a t i o n v o l t a g e ==95 73 [ head c95a ]= r e a d _ 6 1 3 3 ( ’3659 _d . txt ’) ; 74 [ head c95b ]= r e a d _ 6 1 3 3 ( ’3660 _d . txt ’) ; 75 c 9 5 c o m p _ c o i l 1 = mean ([ c95a (: ,2) ’; c95b (: ,2) ’]) ; 76 c 9 5 c o m p _ c o i l 2 = mean ([ c95a (: ,3) ’; c95b (: ,3) ’]) ; 77 c 9 5 c o m p _ c o i l 3 = mean ([ c95a (: ,4) ’; c95b (: ,4) ’]) ; 78 c 9 5 c o m p _ c o i l 4 = mean ([ c95a (: ,5) ’; c95b (: ,5) ’]) ; 79 c 9 5 c o m p _ c o i l 5 = mean ([ c95a (: ,6) ’; c95b (: ,6) ’]) ; 80 c 9 5 c o m p _ c o i l 6 = mean ([ c95a (: ,7) ’; c95b (: ,7) ’]) ; 81 c 9 5 c o m p _ c o i l 7 = mean ([ c95a (: ,8) ’; c95b (: ,8) ’]) ; 82 c 9 5 c o m p _ c o i l 8 = mean ([ c95a (: ,9) ’; c95b (: ,9) ’]) ; 83 c 9 5 _ c o m p _ m a t =[ c 9 5 c o m p _coi l1 ’ , c 9 5 c o m p _coil2 ’ , c 9 5 c o m p _co il3 ’ , c 9 5 c o m p _coil 4 ’ , c 9 5 c o m p _ coil5 ’ , c 9 5 c o m p _coil 6 ’ , c 9 5 c o m p _ coil7 ’ , c 9 5 c o m p _coil 8 ’]; 84 d a t a 1 _ c o m p = data1 (: ,2:9) - c 9 5 _ c o m p _ m a t ; 85 d a t a 2 _ c o m p = data2 (: ,2:9) - c 9 5 _ c o m p _ m a t ; 144 86 d a t a 3 _ c o m p = data3 (: ,2:9) - c 9 5 _ c o m p _ m a t ; 87 d a t a 4 _ c o m p = data4 (: ,2:9) - c 9 5 _ c o m p _ m a t ; 88 d a t a 5 _ c o m p = data5 (: ,2:9) - c 9 5 _ c o m p _ m a t ; 89 elseif c o m p e n s a t i o n v o l t a g e ==100 90 [ head c100a ]= r e a d _ 6 1 3 3 ( ’3657 _d . txt ’) ; 91 [ head c100b ]= r e a d _ 6 1 3 3 ( ’3658 _d . txt ’) ; 92 c 1 0 0 c o m p _ c o i l 1 = mean ([ c100a (: ,2) ’; c100b (: ,2) ’]) ; 93 c 1 0 0 c o m p _ c o i l 2 = mean ([ c100a (: ,3) ’; c100b (: ,3) ’]) ; 94 c 1 0 0 c o m p _ c o i l 3 = mean ([ c100a (: ,4) ’; c100b (: ,4) ’]) ; 95 c 1 0 0 c o m p _ c o i l 4 = mean ([ c100a (: ,5) ’; c100b (: ,5) ’]) ; 96 c 1 0 0 c o m p _ c o i l 5 = mean ([ c100a (: ,6) ’; c100b (: ,6) ’]) ; 97 c 1 0 0 c o m p _ c o i l 6 = mean ([ c100a (: ,7) ’; c100b (: ,7) ’]) ; 98 c 1 0 0 c o m p _ c o i l 7 = mean ([ c100a (: ,8) ’; c100b (: ,8) ’]) ; 99 c 1 0 0 c o m p _ c o i l 8 = mean ([ c100a (: ,9) ’; c100b (: ,9) ’]) ; 100 c 1 0 0 _ c o m p _ m a t =[ c 1 0 0 c o m p _c oil1 ’ , c 1 0 0 c o m p _co il2 ’ , c 1 0 0 c o m p _coi l3 ’ , c 1 0 0 c o m p _coil 4 ’ , c 1 0 0 c o m p_ coil 5 ’ , c 1 0 0 c o m p_ coil6 ’ , c 1 0 0 c o m p _coil 7 ’ , c 1 0 0 c o m p_ coil 8 ’]; 101 d a t a 1 _ c o m p = data1 (: ,2:9) - c 1 0 0 _ c o m p _ m a t ; 102 d a t a 2 _ c o m p = data2 (: ,2:9) - c 1 0 0 _ c o m p _ m a t ; 103 d a t a 3 _ c o m p = data3 (: ,2:9) - c 1 0 0 _ c o m p _ m a t ; 104 d a t a 4 _ c o m p = data4 (: ,2:9) - c 1 0 0 _ c o m p _ m a t ; 105 d a t a 5 _ c o m p = data5 (: ,2:9) - c 1 0 0 _ c o m p _ m a t ; 106 elseif c o m p e n s a t i o n v o l t a g e ==123 107 [ head c123a ]= r e a d _ 6 1 3 3 ( ’3655 _d . txt ’) ; 108 [ head c123b ]= r e a d _ 6 1 3 3 ( ’3656 _d . txt ’) ; 109 c 1 2 3 c o m p _ c o i l 1 = mean ([ c123a (: ,2) ’; c123b (: ,2) ’]) ; 110 c 1 2 3 c o m p _ c o i l 2 = mean ([ c123a (: ,3) ’; c123b (: ,3) ’]) ; 111 c 1 2 3 c o m p _ c o i l 3 = mean ([ c123a (: ,4) ’; c123b (: ,4) ’]) ; 112 c 1 2 3 c o m p _ c o i l 4 = mean ([ c123a (: ,5) ’; c123b (: ,5) ’]) ; 113 c 1 2 3 c o m p _ c o i l 5 = mean ([ c123a (: ,6) ’; c123b (: ,6) ’]) ; 114 c 1 2 3 c o m p _ c o i l 6 = mean ([ c123a (: ,7) ’; c123b (: ,7) ’]) ; 115 c 1 2 3 c o m p _ c o i l 7 = mean ([ c123a (: ,8) ’; c123b (: ,8) ’]) ; 145 116 c 1 2 3 c o m p _ c o i l 8 = mean ([ c123a (: ,9) ’; c123b (: ,9) ’]) ; 117 c 1 2 3 _ c o m p _ m a t =[ c 1 2 3 c o m p _c oil1 ’ , c 1 2 3 c o m p _co il2 ’ , c 1 2 3 c o m p _coi l3 ’ , c 1 2 3 c o m p _coil 4 ’ , c 1 2 3 c o m p_ coil 5 ’ , c 1 2 3 c o m p_ coil6 ’ , c 1 2 3 c o m p _coil 7 ’ , c 1 2 3 c o m p_ coil 8 ’]; 118 d a t a 1 _ c o m p = data1 (: ,2:9) - c 1 2 3 _ c o m p _ m a t ; 119 d a t a 2 _ c o m p = data2 (: ,2:9) - c 1 2 3 _ c o m p _ m a t ; 120 d a t a 3 _ c o m p = data3 (: ,2:9) - c 1 2 3 _ c o m p _ m a t ; 121 d a t a 4 _ c o m p = data4 (: ,2:9) - c 1 2 3 _ c o m p _ m a t ; 122 d a t a 5 _ c o m p = data5 (: ,2:9) - c 1 2 3 _ c o m p _ m a t ; 123 end 124 c1avg = mean ([ d a t a 1 _ c o m p (: ,1) ’; d a t a 2 _ c o m p (: ,1) ’; d a t a 3 _ c o m p (: ,1) ’; d a t a 4 _ c o m p (: ,1) ’; d a t a 5 _ c o m p (: ,1) ’;]) ; 125 c2avg = mean ([ d a t a 1 _ c o m p (: ,2) ’; d a t a 2 _ c o m p (: ,2) ’; d a t a 3 _ c o m p (: ,2) ’; d a t a 4 _ c o m p (: ,2) ’; d a t a 5 _ c o m p (: ,2) ’;]) ; 126 c3avg = mean ([ d a t a 1 _ c o m p (: ,3) ’; d a t a 2 _ c o m p (: ,3) ’; d a t a 3 _ c o m p (: ,3) ’; d a t a 4 _ c o m p (: ,3) ’; d a t a 5 _ c o m p (: ,3) ’;]) ; 127 c4avg = mean ([ d a t a 1 _ c o m p (: ,4) ’; d a t a 2 _ c o m p (: ,4) ’; d a t a 3 _ c o m p (: ,4) ’; d a t a 4 _ c o m p (: ,4) ’; d a t a 5 _ c o m p (: ,4) ’;]) ; 128 c5avg = mean ([ d a t a 1 _ c o m p (: ,5) ’; d a t a 2 _ c o m p (: ,5) ’; d a t a 3 _ c o m p (: ,5) ’; d a t a 4 _ c o m p (: ,5) ’; d a t a 5 _ c o m p (: ,5) ’;]) ; 129 c6avg = mean ([ d a t a 1 _ c o m p (: ,6) ’; d a t a 2 _ c o m p (: ,6) ’; d a t a 3 _ c o m p (: ,6) ’; d a t a 4 _ c o m p (: ,6) ’; d a t a 5 _ c o m p (: ,6) ’;]) ; 130 c7avg = mean ([ d a t a 1 _ c o m p (: ,7) ’; d a t a 2 _ c o m p (: ,7) ’; d a t a 3 _ c o m p (: ,7) ’; d a t a 4 _ c o m p (: ,7) ’; d a t a 5 _ c o m p (: ,7) ’;]) ; 131 c8avg = mean ([ d a t a 1 _ c o m p (: ,8) ’; d a t a 2 _ c o m p (: ,8) ’; d a t a 3 _ c o m p (: ,8) ’; d a t a 4 _ c o m p (: ,8) ’; d a t a 5 _ c o m p (: ,8) ’;]) ; 132 c1int = c u m t r a p z(t , c1avg ) * f a c t o r v e c t o r (1) ; 133 c2int = c u m t r a p z(t , c2avg ) * f a c t o r v e c t o r (2) ; 134 c3int = c u m t r a p z(t , c3avg ) * f a c t o r v e c t o r (3) ; 135 c4int = c u m t r a p z(t , c4avg ) * f a c t o r v e c t o r (4) ; 136 c5int = c u m t r a p z(t , c5avg ) * f a c t o r v e c t o r (5) ; 137 c6int = c u m t r a p z(t , c6avg ) * f a c t o r v e c t o r (6) ; 146 138 c7int = c u m t r a p z(t , c7avg ) * f a c t o r v e c t o r (7) ; 139 c8int = c u m t r a p z(t , c8avg ) * f a c t o r v e c t o r (8) ; 140 d1 =[ t c1int ’]; 141 d2 =[ t c5int ’]; 142 d3 =[ t c2int ’]; 143 d4 =[ t c6int ’]; 144 s t o p t i m e= t ( end ) ; 145 mode = Md ; 146 sim ( ’ f i l t e r p o s n s _ f i n a l . mdl ’) ; % no sign change a c c u r a t e wall detection 147 bound =3.5* ones ( length ( t ) ,1) ; 148 z e r o l i n e =0* ones ( length ( t ) ,1) ; 149 if s u p p r e s s ==0 % plots s u p p r e s s e d 150 figure 151 if mode ==1 152 plot (t , c1int ./ c5int , ’g ’ , S c o p e D a t a 4. time , S c o p e D a t a 4. s i g n a l s. values , ’r ’) ; 153 else 154 plot (t , c5int ./ c1int , ’g ’ , S c o p e D a t a 4. time , S c o p e D a t a 4. s i g n a l s. values , ’r ’) ; 155 end 156 axis ([0 t ( end ) -5 5]) ; 157 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Pickup ratio ’) ; 158 title ( ’ V e r t i c a l p o s i t i o n coils ’) ; 159 %%%%%%%%%%%%%%%%% 160 figure 161 if mode ==1 162 plot (t , c2int ./ c6int , ’g ’ , S c o p e D a t a 5. time , S c o p e D a t a 5. s i g n a l s. values , ’r ’) ; 163 164 else plot (t , c6int ./ c2int , ’g ’ , S c o p e D a t a 5. time , S c o p e D a t a 5. s i g n a l s. values , ’r ’) ; 147 165 end 166 axis ([0 t ( end ) -5 5]) ; 167 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Pickup ratio ’) ; 168 title ( ’ P o s i t i o n coils at 135 d e g r e e s to horizontal ’) ; 169 %%%%%%%%%%%%%%%% 170 % lower plots for d i s p l a c e m e n t 171 figure 172 plot (t , zeroline , ’ k : ’) ; hold on ; 173 plot ( S c o p e D a t a 8. time , S c o p e D a t a 8. s i g n a l s. values , ’r ’) ; 174 hold on 175 plot (t , bound , ’b - - ’ ,t , - bound , ’k - - ’) ; 176 legend ( ’ Zero ’ , ’ Displacement ’ , ’ Upper bound ’ , ’ Lower bound ’) ; 177 axis ([0 t ( end ) -5 5]) ; 178 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ C e n t i m e t r e s from centre ’) ; 179 title ( ’ A p p r o x i m a t e V e r t i c a l displacement ’) ; 180 tv = S c o p e D a t a 8 . time ; 181 v = S c o p e D a t a 8. s i g n a l s. values ; 182 %%%%%%%%%%%%%%%%%%%%%% 183 figure 184 plot (t , zeroline , ’ k : ’) ; hold on ; 185 plot ( S c o p e D a t a 9. time , S c o p e D a t a 9. s i g n a l s. values , ’r ’) ; 186 hold on 187 plot (t , bound , ’b - - ’ ,t , - bound , ’k - - ’) ; 188 legend ( ’ Zero ’ , ’ Displacement ’ , ’ Inner bound ’ , ’ Outer bound ’) ; 189 axis ([0 t ( end ) -5 5]) ; 190 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ C e n t i m e t r e s from centre ’) ; 191 title ( ’ A p p r o x i m a t e d i s p l a c e m e n t at 135 d e g r e e s to horizontal ’) ; 192 t135 = S c o p e D a t a 9. time ; 193 h135 = S c o p e D a t a 9. s i g n a l s. values ; 194 %%%%%%%%%%%%%%%%%%%%%% 195 end 196 d1 =[ t c3int ’]; 148 197 d2 =[ t c7int ’]; 198 d3 =[ t c4int ’]; 199 d4 =[ t c8int ’]; 200 sim ( ’ f i l t e r p o s n s _ f i n a l . mdl ’) ; % no sign change a c c u r a t e wall detection 201 if s u p p r e s s ==0 % plots s u p p r e s s e d 202 figure 203 if mode ==1 204 plot (t , c3int ./ c7int , ’g ’ , S c o p e D a t a 4. time , S c o p e D a t a 4. s i g n a l s. values , ’r ’) ; 205 else 206 plot (t , c7int ./ c3int , ’g ’ , S c o p e D a t a 4. time , S c o p e D a t a 4. s i g n a l s. values , ’r ’) ; 207 end 208 axis ([0 t ( end ) -5 5]) ; 209 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Pickup ratio ’) ; 210 title ( ’ H o r i z o n t a l p o s i t i o n coils ’) ; 211 %%%%%%%%%%%%%%%%% 212 figure 213 if mode ==1 214 plot (t , c4int ./ c8int , ’g ’ , S c o p e D a t a 5. time , S c o p e D a t a 5. s i g n a l s. values , ’r ’) ; 215 else 216 plot (t , c8int ./ c4int , ’g ’ , S c o p e D a t a 5. time , S c o p e D a t a 5. s i g n a l s. values , ’r ’) ; 217 end 218 axis ([0 t ( end ) -5 5]) ; 219 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Pickup ratio ’) ; 220 title ( ’ P o s i t i o n coils at 45 d e g r e e s to horizontal ’) ; 221 % above plots for filter data p e r f o r m a n c e 222 223 figure 149 224 plot (t , zeroline , ’ k : ’) ; hold on ; 225 plot ( S c o p e D a t a 8. time , S c o p e D a t a 8. s i g n a l s. values , ’r ’) ; 226 hold on 227 plot (t , bound , ’b - - ’ ,t , - bound , ’k - - ’) ; 228 legend ( ’ Zero ’ , ’ Displacement ’ , ’ Inner bound ’ , ’ Outer bound ’) ; 229 axis ([0 t ( end ) -5 5]) ; 230 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ C e n t i m e t r e s from centre ’) ; 231 title ( ’ A p p r o x i m a t e H o r i z o n t a l displacement ’) ; 232 th = S c o p e D a t a 8 . time ; 233 h = S c o p e D a t a 8. s i g n a l s. values ; 234 %%%%%%%%%%%%%%%%%%%%%% 235 figure 236 plot (t , zeroline , ’ k : ’) ; hold on ; 237 plot ( S c o p e D a t a 9. time , S c o p e D a t a 9. s i g n a l s. values , ’r ’) ; 238 hold on 239 plot (t , bound , ’b - - ’ ,t , - bound , ’k - - ’) ; 240 legend ( ’ Zero ’ , ’ Displacement ’ , ’ Inner bound ’ , ’ Outer bound ’) ; 241 axis ([0 t ( end ) -5 5]) ; 242 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ C e n t i m e t r e s from centre ’) ; 243 title ( ’ A p p r o x i m a t e d i s p l a c e m e n t at 45 d e g r e e s to horizontal ’) ; 244 t45 = S c o p e D a t a 9 . time ; 245 h45 = S c o p e D a t a 9 . s i g n a l s. values ; 246 % save ( ’ C :\ Files \ dat \ pos . mat ’ , ’ ScopeData8 ’ , ’ ScopeData9 ’) ; 247 figure 248 plot (t , Ipavg ) ; 249 xlabel ( ’ Time - seconds ’) ; ylabel ( ’ Amperes ’) ; 250 title ( ’ Plasma current ’) ; 251 grid on ; 252 end 253 o u t _ d a t a =[ tv ,v , t45 , h45 , th ,h , t135 , h135 ]; 254 % set this to be angle of r o t a t i o n as per d e s i r e d 255 r o t a t i o n _ a n g l e = rot ; % d e g r e e s 150 256 t i m e d e s= i n s t a n t *1 e -3; 257 index = t i m e d e s /5e -7; 258 plot ( v ( index ) * cos ( d e g 2 r a d (90+ r o t a t i o n _ a n g l e ) ) ,v ( index ) * sin ( d e g 2 r a d (90+ r o t a t i o n _ a n g l e ) ) ,’b * ’) ; 259 hold on ; 260 plot ( h45 ( index ) *( cos ( d e g 2 r a d (45+ r o t a t i o n _ a n g l e ) ) ) , h45 ( index ) *( sin ( d e g 2 r a d (45+ r o t a t i o n _ a n g l e ) ) ) ,’r * ’) ; 261 hold on ; 262 plot ( h ( index ) * cos ( d e g 2 r a d (0+ r o t a t i o n _ a n g l e ) ) ,h ( index ) * sin ( d e g 2 r a d (0+ r o t a t i o n _ a n g l e ) ) ,’m * ’) ; 263 hold on ; 264 plot ( h135 ( index ) *( cos ( d e g 2 r a d (135+ r o t a t i o n _ a n g l e ) ) ) , h135 ( index ) *( sin ( d e g 2 r a d (135+ r o t a t i o n _ a n g l e ) ) ) ,’c * ’) ; 265 grid on 266 axis ([ -3.5 3.5 -3.5 3.5]) 267 title ( strcat ( ’ P o s i t i o n s c a t t e r plot from mirnov coil data at time = ’, n u m 2 s t r( t i m e d e s) ,’ seconds ’) ) ; 268 xlabel ( ’ C e n t i m e t r e s - X ’) ; ylabel ( ’ C e n t i m e t r e s - Y ’) 269 if ( m a k e _ a _ m o v i e ==1) 270 close all 271 pause (3) ; 272 figure ; 273 %// m o v i e m o d e 274 v = d o w n s a m p l e b y (v ,100) ; 275 h45 = d o w n s a m p l e b y ( h45 ,100) ; 276 h = d o w n s a m p l e b y (h ,100) ; 277 h135 = d o w n s a m p l e b y ( h135 ,100) ; 278 tvect = d o w n s a m p l e b y ( tv ,100) ; 279 j =0; 280 for index =1: length ( v ) 281 j = j +1; 151 282 plot ( v ( index ) * cos ( d e g 2 r a d (90+ r o t a t i o n _ a n g l e ) ) ,v ( index ) * sin ( d e g 2 r a d (90+ r o t a t i o n _ a n g l e ) ) ,’bo ’ , h45 ( index ) *( cos ( d e g 2 r a d (45+ r o t a t i o n _ a n g l e ) ) ) , h45 ( index ) *( sin ( d e g 2 r a d (45+ r o t a t i o n _ a n g l e ) ) ) ,’bo ’ , h ( index ) * cos ( d e g 2 r a d (0+ r o t a t i o n _ a n g l e ) ) ,h ( index ) * sin ( d e g 2 r a d (0+ r o t a t i o n _ a n g l e ) ) ,’mo ’ , h135 ( index ) *( cos ( d e g 2 r a d (135+ r o t a t i o n _ a n g l e ) ) ) , h135 ( index ) *( sin ( d e g 2 r a d (135+ r o t a t i o n _ a n g l e ) ) ) ,’co ’) ; 283 grid on ; 284 xlabel ( ’ C e n t i m e t r e s - X ’) ; ylabel ( ’ C e n t i m e t r e s - Y ’) ; title ( strcat ( ’ P o s i t i o n at time t = ’ , n u m 2 s t r( tvect ( index ) ) ,’ seconds ’) ) ; 285 axis ([ -3.5 3.5 -3.5 3.5]) ; 286 F ( j ) = g e t f r a m e( gcf ) ; 287 end 288 movie (F ,1) ; 289 m o v i e 2 a v i(F , ’ pos . avi ’) ; 290 d i s p l a y( ’ movie written ’) ; 291 close all ; 292 end 293 end K.7 1 Vector Downsampler f u n c t i o n res = d o w n s a m p l e b y ( vect , step ) 2 a = vect ; 3 j =1: step : length ( a ) ; 4 for i =1: length ( j ) 5 b(i)=a(j(i)); 6 end 7 res = b ; 8 end

Download PDF

advertisement