INSTRUCTOR Workbook QUBE-Servo Experiment for MATLAB /Simulink Users Standardized for ABET * Evaluation Criteria Developed by: Jacob Apkarian, Ph.D., Quanser Michel Lévis, M.A.SC., Quanser COURSEWARE SAMPLE QUBE educational solutions are powered by: Course material complies with: Captivate. Motivate. Graduate. *ABET Inc., is the recognized accreditor for college and university programs in applied science, computing, engineering, and technology, providing leadership and quality assurance in higher education for over 75 years. COURSEWARE SAMPLE QUBE™-Servo PREFACE Preparing laboratory experiments can be time-consuming. Quanser understands time constraints of teaching and research professors. That’s why the QUBE-Servo experiment comes with a new generation of mix-andmatch, rich digital media courseware that allows easy adaptation of material to a specific course. The courseware is also aligned with requirements of ABET accreditation. All this allows professors to get their labs running faster, saving months of time typically required to develop lab materials and exercises. Quanser QUBE-Servo courseware provides step-by-step pedagogy for a wide range of control challenges. You can select a pre-defined lab section where students start with the basic principles and progress to more advanced applications of control theories. Or you can select a specific topic and use the exercises to supplement the theory students learnt in class with hands-on experience in lab. To make the courseware easily adaptable to your specific course, Quanser also offers a comprehensive mapping of courseware topics to the most popular control engineering textbooks: • • • • • • • • Control Systems Engineering by Norman S. Nise Feedback Systems by K.J. Åström, R.M. Murray Feedback Control of Dynamic Systems by G.F. Franklin, J.D. Powell, A. Emai-Naeini Modern Control Systems by R.C. Dorf, R.H. Bishop Modern Control Engineering by K. Ogata Automatic Control Systems by F. Golnaraghi, B.C. Kuo Control Systems Engineering by I.J. Nagrath, M. Gopal Mechatronics by W. Bolton This document provides an abbreviated example of background and in-lab exercise courseware sections for the QUBE-Servo experiment. Please note that the examples are not complete as they are intended to give you a brief overview of the structure and content of the courseware you will receive with the QUBE-Servo. This courseware sample based on the MATLAB/Simulink software. material prepared for users of The QUBE-Servo courseware is aligned with requirements of ABET accreditation. ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 1 of 8 COURSEWARE SAMPLE QUBE™-Servo 1. QUBE™-SERVO COURSEWARE TABLE OF CONTENTS The full Table of Contents of the Quanser QUBE-Servo courseware is shown here: 1. QUBE-SERVO INTEGRATION 1.1. BACKGROUND 1.1.1. QUARC SOFTWARE 1.1.2. DC MOTOR 1.1.3. ENCODERS 1.2. IN-LAB EXERCISES 1.2.1. CONFIGURING A SIMULINK MODEL FOR THE QUBE-SERVO 1.2.2. READING THE ENCODER 1.2.3. DRIVING THE DC MOTOR 2. FILTERING 2.1. BACKGROUND 2.2. IN-LAB EXERCISES 3. STABILITY ANALYSIS 3.1. BACKGROUND 3.1.1. SERVO MODEL 3.1.2. STABILITY 3.2. IN-LAB EXERCISES 4. BUMP TEST MODELING 4.1. BACKGROUND 4.1.1. APPLYING THIS TO THE QUBE-SERVO 4.2. IN-LAB EXERCISES 5. FIRST PRINCIPLES MODELING 5.1. BACKGROUND 5.2. IN-LAB EXERCISES 6. SECOND-ORDER SYSTEMS 6.1. BACKGROUND 6.1.1. SECOND-ORDER STEP RESPONSE 6.1.2. PEAK TIME AND OVERSHOOT 6.1.3. UNITY FEEDBACK 6.2. IN-LAB EXERCISES 7. PD CONTROL 7.1. BACKGROUND 7.1.1. SERVO MODEL 7.1.2. PID CONTROL 7.1.3. PV POSITION CONTROL 7.2. IN-LAB EXERCISES 8. PENDULUM MOMENT OF INERTIA 8.1. BACKGROUND 8.2. IN-LAB EXERCISES ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 2 of 8 COURSEWARE SAMPLE QUBE™-Servo 9. ROTARY PENDULUM MODELING 9.1. BACKGROUND 9.2. IN-LAB EXERCISES 10. BALANCE CONTROL 10.1. BACKGROUND 10.2. IN-LAB EXERCISES 11. SWING-UP CONTROL 11.1. BACKGROUND 11.1.1. ENERGY CONTROL 11.1.2. HYBRID SWING-UP CONTROL 11.2. IN-LAB EXERCISES 11.2.1. ENERGY CONTROL 11.2.2. HYBRID SWING-UP CONTROL 12. OPTIMAL LQR CONTROL 12.1. BACKGROUND 12.2. IN-LAB EXERCISES 12.2.1. LQR CONTROL DESIGN 12.2.2. LQR-BASED BALANCE CONTROL 13. SYSTEM REQUIREMENTS 13.1. OVERVIEW OF FILES 13.2. USING THE SUPPLIED QUARC CONTROLLERS 13.3. SETUP FOR PENDULUM SWING-UP APPENDIX A INSTRUCTOR’S GUIDE A.1 PRE-LAB QUESTIONS AND LAB EXPERIMENTS A.1.1. HOW TO USE THE PRE-LAB QUESTIONS A.1.2 HOW TO USE THE LABORATORY EXPERIMENTS A.2 ASSESSMENT FOR ABET ACCREDITATION A.2.1 ASSESSMENT IN YOUR COURSE A.2.2 HOW TO SCORE THE PRE-LAB QUESTIONS A.2.3 HOW TO SCORE THE LAB REPORT A.2.4 ASSESSMENT OF THE OUTCOMES FOR THE COURSE A.2.5 COURSE SCORE FOR OUTCOME A A.2.6 COURSE SCORES FOR OUTCOMES B,K AND G A.2.7 ASSESSMENT WORKBOOK A.3 RUBRICS REFERENCES ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 3 of 8 COURSEWARE SAMPLE QUBE™-Servo 3. BACKGROUND SECTION - SAMPLE Bump Test Modeling The bump test is a simple test based on the step response of a stable system. A step input is given to the system and its response is recorded. As an example, consider a system given by the following transfer function: 𝑌(𝑠) 𝑈(𝑠) = 𝐾 𝜏𝑠+1 (4.1) The step response shown in Figure 4.1 is generated using this transfer function with K = 5 rad/V-s and τ = 0.05 s. Figure 4.1: Input and output signal used in the bump test method The step input begins at time t0. The input signal has a minimum value of umin and a maximum value of umax. The resulting output signal is initially at y0. Once the step is applied, the output tries to follow it and eventually settles at its steady-state value yss. From the output and input signals, the steady-state gain is ∆𝑦 𝐾= (4.2) ∆𝑢 where Δy = yss-y0 and Δu = umax-umin. In order to find the model time constant, τ, we can first calculate where the output is supposed to be at the time constant from: (4.3) 𝑦(𝑡1 ) = 0.632∆𝑦 + 𝑦𝑜 Then, we can read the time t1 that corresponds to y(t1) from the response data in Figure 4.1. From the figure we can see that the time t1 is equal to: 𝑡1 = 𝑡𝑜 + 𝜏 From this, the model time constant can be found as: 𝜏 = 𝑡1 − 𝑡0 (4.4) ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 4 of 8 COURSEWARE SAMPLE QUBE™-Servo 4. IN-LAB EXERCISES First Principle Modeling Based on the models already designed in QUBE-Servo Integration and Filtering labs, design a VI that applies a 1-3 V 0.4 Hz square wave to the motor and reads the servo velocity using the encoder as shown in Figure 5.2. Figure 5.2: Applies a step voltage and displays measured and simulated QUBE-Servo speed. Create subsystem called QUBE-Servo Model, as shown in Figure 5.2, that contains blocks to model the QUBE-Servo system. Thus using the equations given above, assemble a simple block diagram in Simulink to model the system. You'll need a few Gain blocks, a Subtract block, and an Integrator block (to go from acceleration to speed). Part of the solution is shown in Figure 5.3. Figure 5.3: Incomplete QUBE-Servo Model subsystem. ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 5 of 8 COURSEWARE SAMPLE QUBE™-Servo It may also help to write a short Matlab script that sets the various system parameters in Matlab, so you can use the symbol instead of entering the value numerically in the Gain blocks. In the example shown in Figure 5.3, we are using Rm for motor resistance and kt for the current-torque constant. To define these, write a script like: % Resistance Rm = 8.4; % Current-torque (N-m/A) kt = 0.042; 1. A-1, A-2 The motor shaft of the QUBE-Servo is attached to a load hub and a disc load. Based on the parameters given in Table 5.1, calculate the equivalent moment of inertia that is acting on the motor shaft. Answer 5.1 Outcome Solution A-1 From Figure 5.1, the total moment of inertia acting on the motor shaft is the sum of the motor armature / rotor inertia, Jm, the hub inertia, Jh, and the disc inertia, Jd. The equivalent moment of inertia is therefore Jeq = Jm + Jh + Jd (Ans. 5.1) A-2 Given the disc moment of inertia in Equation 5.3 and the parameters defined in Figure 5.1, the moment of inertia of the hub and disc load are: 1 Jh = md rh2 2 and 1 𝐽d = 𝑚𝑑 𝑟𝑑2 2 Using the parameters from Table 5.1, evaluate Ans.5.1 to obtain 𝐽𝑒𝑞 = 4.0 𝑥 10−6 + 1 1 0.0106(0.0111)2 + 0.053(0.0248)2 = 2.09 𝑥 10−5 2 2 □□□ ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 6 of 8 COURSEWARE SAMPLE QUBE™-Servo 2. K-3 Design the QUBE-Servo Model subsystem as described above. Attach a screen capture of your model and the Matlab script (if you used one).. Answer 5.2 Outcome Solution K-3 The completed model is shown in Figure 5.4. The current depends on the angular rate of the shaft and the applied voltage, as expressed in Equation 5.1. The acceleration of the shaft equals the torque divided by the equivalent moment of inertia, as described in Equation 5.2. The Matlab script used for this is: Rm = 8.4; kt = 0.042; km = 0.042; Jr = 4e-6; mh = 0.0106; rh = 22.2/1000/2; Jh = 0.5*mh*rh^2; md = 0.053; rd = 49.5/1000/2; Jd = 0.5*md*rd^2; Jeq = Jr + Jh + Jd; Figure 5.4: Completed QUBE-Servo Model subsystem. ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 7 of 8 COURSEWARE SAMPLE QUBE™-Servo 3. □□□ B-5, B-9 Build and run the QUARC controller with your QUBE-Servo model. The scope response should be similar to Figure 5.5. Attach a screen capture of your scopes. Does your model represent the QUBE-Servo well? Explain. (a) Motor Speed Figure 5.5: QUBE Response (b) Motor Voltage Answer 5.3 Outcome Solution B-5 If the experimental procedure was followed correctly, the user should be able to run the QUARC controller and obtain a response similar to Figure 5.5. B-9 The model represents the actual QUBE-Servo system accurately because in the simulated response (purple) matches the measured response (yellow) quite well in Figure 5.5. □□□ ©2013 Intellectual property of Quanser. Do not reproduce without written permission. QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM Page 8 of 8 You Can Rely On Quanser To Advance Control Education For over two decades Quanser has focused solely on the development of solutions for advanced control education and research. Today, over 2,500 University of Manchester • California Institute of Technology Polytechnic School of Lausanne • Hong Kong University of Science and Technology universities, colleges and research institutions around the world rely on a University of Waterloo • Carnegie Mellon University growing portfolio of Quanser control systems. University of Toronto • Monash University • Kyoto University University of Melbourne • ETH Zurich • Yale University Our Rotary Control solutions offer quality, convenience, ease of use, ongoing technical support and affordability. They are part of a wider range f Alberta • Gifu University • Loughborough University University of California, Berkeley • KTH • McMaster University of Quanser control lab solutions designed to enhance students’ academic University Munich • Rice University • Kyoto Institute of Technology experience. They come as complete workstations and can captivate University of Auckland • MIT • Imperial College London undergraduate and graduate students, motivate them to study further The Chinese University of Hong Kong • Virginia Tech and encourage them to innovate. University of Houston • KAIST • Karlsruhe University f Cincinnati • McGill University • Australian National University Engineering educators worldwide agree that Quanser workstations are reliable and robust. Choose from a variety of mechatronics experiments King Soud University • I.I.T Kharagpur •Memorial University University of British Columbia • Delft University of Technology and control design tools appropriate for teaching at all levels as well as University of Texas at Austin • Beijing Institute of Technology advanced research. Take advantage of engineering expertise that includes f Tokyo • Princeton University • Hebei University of Technologymechatronics, electronics, software development and control system design. University of Wisconsin-Madison • Holon Institute of TechnologyLeverage the accompanying ABET-aligned courseware which have been of Klagenfurt • Harvard University • Tokyo Institute of Technology developed to the highest academic standards. Last but not least, rely on University of Reading • Tsinghua University • Cornell University Quanser’s engineers for ongoing technical support as your teaching or University of Michigan • Korea University • Queen’s University research requirements evolve over time. University of Bristol • Purdue University • Osaka University University of Stuttgart • Georgia Tech • Ben-Gurion University University Eindhoven • Ajou University • Kobe University University of Maryland College Park • Nanyang Technological University University of New South Wales • Washington University in St.Louis National University of Singapore • Harbin Institute of TechnologyLearn more at www.quanser.com or contact us at info@quanser.com University of Victoria • Boston University • Donghua University Northwestern University • Tongji University • Royal Military College Follow us on: University of Quebec • Clemson University • Fukuoka University Adelaide University • University of Barcelona • SUNY Queen’s University Belfast •Istanbul Technical University ABET, Inc., is the recognized accreditor for college and university programs in applied science, computing, engineering, e Los Andes • Louisiana Tech • Norwegian University of Science and Technology and technology. Among the most respected accreditation organizations in the U.S., ABET has provided leadership and quality assurance in higher education for over 75 years. United States Military Academy • CINVESTAV • Drexel University MATLAB® and Simulink® are registered trademarks of the MathWorks, Inc. Products and/or services pictured and referred to herein and their accompanying specifications may be subject to change without notice. Products and/or services mentioned herein are trademarks or registered trademarks of Quanser Inc. and/or its affiliates. MATLAB® and Simulink® are registered trademarks of The MathWorks Inc. Windows® is a trademark of the Microsoft. Other product and company names mentioned herein are trademarks or registered trademarks of their respective owners. ©2013 Quanser Inc. All rights reserved. v2.2