UNIVERS ITI TEKNOLOGI MALAYSIA BORANG PENGESAHAN STATUS TESIS JUDUL : THE DEVELOPMENT OF A TEACHING AID FOR CONTROL ENGINEERING SESI PENGAJIAN: Saya 2007/2008 HASMATH HASEERA BINTI SYED IBRAHIM (HURUF BESAR) mengaku membenarkan tesis (PSM/ Sarjana / Doktor Falsafah)* ini disimpan di Perpustakaan Universiti Teknologi Malaysia dengan syarat-syarat kegunaan seperti berikut: 1. 2. 3. 4. Tesis adalah hakmilik Universiti Teknologi Malaysia. Perpustakaan Universiti Teknologi Malaysia dibenarkan membuat salinan untuk tujuan pengajian sahaja. Perpustakaan dibenarkan membuat salinan tesis ini sebagai bahan pertukaran antara institusi pengajian tinggi. **Sila tanda ( ) SULIT (Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIAH RASMI 1972) TERHAD (Mengandungi maklumat TERHAD yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan) TIDAK TERHAD Disahkan oleh (TANDATANGAN PENULIS) Alamat tetap NO 2, BLOK 14, JLN 1/90G, OFF JLN IKAN EMAS, CHERAS 56000, KUALA LUMPUR 8TH MAY 2008 Tarikh: CATATAN: * (TANDATANGAN PENYELIA) PM. DR. ZAHARUDDIN BIN MOHAMED Nama Penyelia Tarikh: 8TH MAY 2008 Potong yang tidak berkenaan. ** Jika tesis ini SULIT atau TERHAD, sila lampirkan surat daripada pikah berkuasa/ organisasi berkenaan dengan menyatakan sekali sebab dan tempoh tesis ini perlu dikelaskan sebagai SULIT atau TERHAD. Tesis dimaksudkan sebagai tesis bagi Ijazah Doktor Falsafah dan Sarjana secara penyelidikan, atau disertasi bagi pengajian secara kerja kursus dan penyelidikan, atau Laporan Project Sarjana Muda (PSM) “I hereby declare that I have read this thesis and in my opinion this thesis is sufficient in terms of scope and quality for the award of the degree of Bachelor of Electrical Engineering (Mechatronic) Signature Name of Supervisor Date : : : . PM. DR. Zaharuddin bin Mohamed 8TH MAY 2008 THE DEVELOPMENT OF A TEACHING AID FOR CONTROL ENGINEERING HASMATH HASEERA BINTI SYED IBRAHIM A thesis submitted in fulfillment of the requirement for the award of the degree of Bachelor of Electrical Engineering (Mechatronic) Faculty of Electrical Engineering Universiti Teknologi Malaysia MAY 2008 ii I declare that this thesis entitled “The Development of a Teaching Aid for Control Engineering” is the results of my own research except as cited in the references. The thesis has not been accepted for any degree and is not concurrently submitted in candidature of any other degree. Signature : …………………………………… Name : HASMATH HASEERA BINTI SYED IBRAHIM Date : 8 TH MAY 2008 iii In memory of my beloved mother for her never-ending love and support iv ACKNOWLEDGEMENT In the name of Allah, Most Gracious, Most Compassionate. All praise is due to Him, The Lord of the Universe. First of all, I would like to express my highest gratitude to PM. Dr. Zaharuddin Bin Mohamed, the project supervisor for all of the helpful guidance and advice. It was indeed very important for the development of this project. My deepest appreciation goes to my family and friends, for their encouragement and support which had gained my confidence in completing this project successfully. A special thanks to the technicians at Robotic Lab and Control Lab for their assistance in getting all the apparatus and equipment needed for this project. Last but not least, I would like to thank to everyone whom had helped in the making of this project. Thank you… v ABSTRAK Kejuruteraan Sistem Kawalan merupakan salah satu bidang kejuruteraan yang penting pada masa kini. Setiap bakal jurutera perlulah dilengkapi dengan ilmu pengetahuan yang mendalam mengenai bidang ini. Projek ini dibangunkan untuk kemudahan pelajar kejuruteraan. Alat Bantu Belajar Sistem Kawalan ini sebenarnya merupakan adaptasi sistem kawalan yang mudah. Dalam projek ini, kawalan masa nyata bagi DC Servo dilakukan. Ianya melibatkan dua elemen yang berbeza iaitu perisian komputer dan perkakasan sebenar. Komunikasi antara dua sistem ini dilakukan melalui alat perolehan data. Pengawal yang dibangunkan adalah Pengawal Berkadaran (P), Pengawal Pembeza-Berkadaran (PD), Pengawal PengamirBerkadaran (PI) dan Pengawal Pengamir-Pembeza-Berkadaran (PID). Setiap pengawal ini mempunyai keberkesanan yang tersendiri dalam memperolehi sambutan keluaran sistem. vi ABSTRACT Control System Engineering is one of the important branches of engineering nowadays. Every future engineer should be well occupied with an in-depth knowledge about control system theory. This project is developed for the benefit of the engineering students. The Teaching Aid for Control is actually an adaptation of a simple control system. In this project, a real-time control of a DC motor is considered. It involves two different elements, which are the software and hardware. The communication of both elements is via a data acquisition card. The developed controllers are Proportional Controller (P), Proportional-Derivative Controller (PD), Proportional-Integral (PI) and Proportional-Integral-Derivative Controller (PID). Each of these controllers has its own attribute toward the effectiveness of the system response. vii TABLE OF CONTENTS CHAPTER TITLE PAGE TITLE PAGE i DECLARATION ii DEDICATION iii ACKNOWLEDGEMENT iv ABSTRAK v ABSTRACT vi TABLE OF CONTENTS vii LIST OF TABLES xi LIST OF FIGURES xii LIST OF SYMBOL/ABBREVIATION/NOTATION/TERMINOLOGYxiv LIST OF APPENDICES 1 2 xvi INTRODUCTION 1 1.1 Background of the Project 1 1.2 Objective of the Project 4 1.3 Scope of the Project 4 1.3.1 The Hardware Development 4 1.3.2 The Software Development 4 1.3.3 The Interfacing 5 LITERATURE REVIEW 6 2.1 6 Previous Researches viii 2.1.1 The Development of an Undergraduate Laboratory Course in Control System 2.1.2 2.2 2.3 2.4 2.5 2.6 A Real-Time for Teaching Power System Control Design 6 8 Control System Theory 8 2.2.1 The Control System Characteristics 9 2.2.1.1 Input and Output 9 2.2.1.2 Closed Loop System 9 2.2.1.3 Analysis and Design Objectives 10 2.2.1.3.1 Transient Response 10 2.2.1.3.2 Steady-State Response 10 2.2.1.3.3 Stability 10 Controllers 11 2.3.1 The Proportional Controller (P) 11 2.3.2 The Proportional-Derivative Controller (PD) 12 2.3.3 The Proportional-Integral Controller (PI) 12 2.3.4 The Proportional-Integral-Derivative Controller (PID) 13 Hardware 14 2.4.1 CE 110 Servo Motor Trainer 14 2.4.2 The Mathematical Modeling of Servo Motor 15 2.4.2.1 Servo Control System 15 2.4.2.2 The Actuator and Speed Sensor Characteristics 18 2.4.2.3 The Motor Transfer Function 20 2.4.2.4 The Angular Speed Control 21 2.4.2.5 The Angular Position Control 21 Software 22 2.5.1 MATLAB SIMULINK 22 2.5.2 MATLAB GUIDE 23 2.5.3 MATLAB REAL-TIME WINDOWS TARGET 23 2.5.4 MATLAB SISO Design Tool 24 Interfacing 25 2.6.1 25 PCL 818 Data Acquisition Card ix 3 METHODOLOGY 26 3.1 Overall System Design 27 3.2 Hardware Development 28 3.2.1 28 3.3 3.2.1.1 Motor Calibration Characteristics 28 3.2.1.2 Speed Sensor Calibration 29 3.2.1.3 Measurement of Time Constant 30 3.2.1.4 Angular Position Transducer Calibration 31 Software Development 31 3.3.1 32 3.3.2 3.4 4 Mathematical Modeling of Servo Motor MATLAB SIMULINK 3.3.1.1 Creating Simulink Diagram for Normal Mode 32 3.3.1.2 Parameter Setting for Normal Mode 34 3.3.1.3 The Simulation for Normal Mode 34 3.3.1.4 Creating Simulink Diagram for External Mode 35 3.3.1.5 Parameter Setting for External Mode 36 3.3.1.6 The Simulation for External Mode 38 MATLAB GUIDE 39 3.3.2.1 GUI Layout 39 3.3.2.2 GUI Programming 39 Interfacing 43 3.4.1 44 The Connector Pin Assignment RESULTS AND DISCUSSION 45 4.1 Servo System Modeling 45 4.1.1 Motor Calibration Characteristics 45 4.1.2 Speed Sensor Calibration 49 4.1.3 Measurement of Time Constant 50 4.1.4 The Angular Position Transducer Calibration 50 4.1.5 The System Transfer Function 52 4.2 Original System 53 4.3 Proportional Controller (P) 55 x 5 4.4 Proportional-Derivative Controller (PD) 58 4.5 Proportional-Integral Controller (PI) 60 4.6 Proportional-Integral-Derivative Controller (PID) 63 CONCLUSION AND RECOMMENDATIONS 66 5.1 Recommendations 66 5.2 Recommendation for Future Work 66 REFERENCES 67 APPENDIX A Manual on How to Use Teaching Aid for Control 68 APPENDIX B Block Diagram of PCL 818 72 APPENDIX C Connector, Switch and VR Location of PCL 818 73 APPENDIX D CE 110 Front Panel 74 APPENDIX E CE 120 Controller 75 xi LIST OF TABLES TABLE NO. TITLE PAGE Table 3.1: The Switch Setting 43 Table 3.2: The Jumper Setting 43 Table 4.1: The Motor Calibration Characteristic (Clutch Disengaged) 46 Table 4.2: The Motor Calibration Characteristic (Clutch Engaged) 46 Table 4.3: The Speed Sensor Calibration 49 Table 4.4: The Angular Position Transducer Calibration 50 xii LIST OF FIGURES FIGURE NO. TITLE PAGE Figure 1.1: The Basic Structure of Teaching Aid for Control Engineering 2 Figure 1.2: The Project Environment 2 Figure 1.3: The Design of the Teaching Aid 3 Figure 2.1: A Control System 8 Figure 2.2: The Closed Loop Configurations 9 Figure 2.3: The Proportional Controller 11 Figure 2.4: The Proportional-Derivative Controller 12 Figure 2.5: The Proportional-Integral Controller 13 Figure 2.6: The Proportional-Integral-Derivative Controller 13 Figure 2.7: The CE110 DC Servo Motor Trainer 14 Figure 2.8: A Servo Control System 15 Figure 2.9: The Servo Control System with Clutch Disengaged 15 Figure 2.10: The Servo Control System with Clutch Engaged 18 Figure 2.11: The Block Diagram of a Feedback Control System 19 Figure 2.12: The Block Diagram of Feedback Servo System 20 Figure 2.13: The Motor Transfer Function 20 Figure 2.14: The Block Diagram for Feedback Control System for Velocity Control21 Figure 2.15: The Block Diagram of a Feedback Control System for Position Control21 Figure 2.16: The Simulink Environment 22 Figure 2.17: The GUIDE Layout 23 Figure 2.18: The SISO Tool Environment 24 Figure 2.19: The PCL 818 Data Acquisition Card 25 Figure 3.1: The Flow of Work 26 Figure 3.2: The Overall System Design 27 Figure 3.3: The Connection for Motor Calibration 28 Figure 3.4: The Connection for Speed Sensor Calibration 29 xiii Figure 3.5: The Connection for Time Constant Measurement 30 Figure 3.6: The Connection for Angular Position Transducer Calibration 31 Figure 3.7: Creating New Model from Simulink Library 32 Figure 3.8: The Connection between Blocks 33 Figure 3.9: The Block Parameters Configuration 33 Figure 3.10: The Simulink Diagram with Normal Mode 34 Figure 3.11: Installation of a New Data Acquisition Board 35 Figure 3.12: The Parameter Setting for Analog Input Block 36 Figure 3.13: The Solver Settings 37 Figure 3.14: The Real-Time Workshop 37 Figure 3.15: The Target Selection 38 Figure 3.16: The Simulink Diagram with External Mode 38 Figure 3.17: The example of a GUI 40 Figure 3.18: The Connector Pin Assignment 44 Figure 4.1: Motor Speed versus Motor Drive Voltage 47 Figure 4.2: The Voltage to Speed Converter 48 Figure 4.3: The Speed Sensor Calibration 49 Figure 4.4: The Angular Position Transducer Calibration 51 Figure 4.5: The GUI for Original System 53 Figure 4.6: The Real-Time Simulation Result 54 Figure 4.7: The Output Response 55 Figure 4.8: The GUI for Proportional Controller 56 Figure 4.9: The Real-Time Simulation for P Controller 56 Figure 4.10: The Output Result for P controller 57 Figure 4.11: The GUI for PD Controller 58 Figure 4.12: The Real-Time Simulation for PD Controller 59 Figure 4.13: The Output Result for PD Controller 59 Figure 4.14: The GUI for PI Controller 61 Figure 4.15: The Real-Time Simulation for PI Controller 61 Figure 4.16: The Output Result for PI Controller 62 Figure 4.17: The GUI for PID Controller 63 Figure 4.18: The Real-Time Simulation for PID Controller 64 Figure 4.19: The Output Result for PID Controller 64 xiv LIST OF SYMBOL/ABBREVIATION/NOTATION/TERMINOLOGY ω - Angular Velocity θ - Angular Position Vω - Voltage from Speed Sensor Vθ - Voltage from Angular Position Sensor Ki - Motor Constant Kω - Speed Constant Kθ - Angle Constant J - Inertial Load I - Inertia of Flywheel R - Armature Resistance L - Armature Inductance V(t) - Motor Input Voltage i(t) - Armature Current VL - Load Control Voltage Tm - Input Torque Vbemf - The motor back electromotive voltage b - Friction Coefficient of Rotating Component P - Proportional I - Integral D - Derivative Kp - Proportional Gain Ki - Integral Gain Kd - Derivative Gain rpm - revolution per minute rev/s - revolution per second DAQ - Data Acquisition DMA - Direct Memory Access xv ADC - Analog to Digital Converter DAC - Digital to Analog Converter S/E - Single Ended DIF - Differential LCL - Local Mode REM - Remote Mode INT - Internal EXT - External xvi LIST OF APPENDICES APPENDIX TITLE PAGE APPENDIX A Manual on How to Use Teaching Aid for Control 68 APPENDIX B Block Diagram of PCL 818 72 APPENDIX C Connector, Switch and VR Location of PCL 818 73 APPENDIX D CE 110 Front Panel 74 APPENDIX E CE 120 Controller 75 CHAPTER 1 INTRODUCTION Teaching Aid for Control Engineering is an additional method in teaching and learning the basic of the control system engineering. This is done via demonstrating simple controls of a DC Servo Motor Trainer. This control process however is through a graphical user interface (GUI) created by using tools provided in MATLAB software and also a data acquisition card. 1.1 Background of the Project Control System is one of the important branches of engineering. Almost all of today’s technologies used control system as their fundamental element. From small device to an advance computer, they would work poorly without a control system. Thus, it is important for an engineer to have depth knowledge in control system technology. In most of the engineering courses offered in many universities, control system is one of their core subjects. However, this course is still taught traditionally, where students have to learn theories in class and apply it in laboratory experiment. Using equipment in laboratory, students can sometimes become overwhelmed with the setup procedures. Thus, they would become less aware on how they could control a system. It would be rather fascinating if they could learn control system with the power of controlling a system at their very fingertips. This could be easily done by using computers. 2 Computer has been increasingly important in today’s world. Even many engineering tools nowadays are using Computer Aided Design (CAD). One of the software that is widely used for control system analysis and design is MATLAB. There are many features of MATLAB software. However, this teaching aid will only use several of it. The basic structure of The Teaching Aid for Control is consisting of a computer with MATLAB software, a data acquisition board and a DC Servo Motor Trainer. These three components will be interfaced with each other. Figure 1.1 describes the basic structure of teaching aid for control. Figure 1.1: The Basic Structure of Teaching Aid for Control Engineering The environment of the project had taken place at the Robotic Laboratory, Universiti Teknologi Malaysia (UTM). Figure 1.2 below shows the project environment with a computer, an interface board and a DC Servo Motor. Figure 1.2: The Project Environment 3 Teaching aid for control is actually an adaptation of simple control system. A basic control system has a controller, a plant and a feedback sensor. The controller is actually the GUI (Graphical User Interface) tools from MATLAB. The plant is the DC Servo Motor Trainer. The feedback sensor is embedded in the Servo Motor Trainer. Figure 1.3 shows the design of this teaching aid. Figure 1.3: The Design of the Teaching Aid Notice that this teaching aid is actually a combination of two devices with different attributes. Computer as we all know is a digital device. The DC Servo motor on the other hand is an analog device. Thus, there is a need for a platform to do the communication between these devices. The platform should convert the digital value from computer to analog value comprehensible by the motor. It should also convert the analog value from the motor to digital value readable by the computer. In other words, the platform should have Digital-to Analog Converter (DAC) and Analog-to-Digital Converter (ADC). 4 1.2 Objective of the Project The objective of this project is to develop a teaching aid for control engineering. 1.3 Scope of the Project The scope of this project is divided into three parts, which are the hardware development, the software development and the interfacing. 1.3.1 The Hardware Development The hardware used for this project was the CE110 DC Servo Motor Trainer. The characteristic of the Servo Motor is determined and calibration was performed. 1.3.2 The Software Development As for the software development, the tools from MATLAB used are as follows; MATLAB- Simulink, for creating the controller and perform the simulation MATLAB- GUIDE, for adjusting control parameters MATLAB-Real-Time Windows Target, for the real time execution with the servo motor MATLAB SISO Design Tool for design analysis The software development is accordingly with the sequence above. 5 1.3.3 The Interfacing The PCL 818 Data Acquisition Card is used for the interfacing. First, the setting for Data Acquisition Card is changed to according to the system requirements. Then, the calibration is performed. CHAPTER 2 LITERATURE REVIEW Before developing this teaching aid, there were several references taken as guide. These references are including past projects and researches, the manual of the device and software, and other related sources. 2.1 Previous Researches Below are the projects done by the previous researcher, which are somewhat related to this project. It was taken as a guide in providing a useful teaching aid. 2.1.1 The Development of an Undergraduate Laboratory Course in Control System This is a research by Elio Abiakel (Ohio University, 2003). The objective of this project is to develop several experiments for undergraduate laboratory course. The purpose of these experiments is to design controller and interface it with an outside plant. The experiments were created using the combination of Matlab Simulink, Matlab Real-Time Workshop and dSPACE ControlDesk. Matlab Simulink is used to create the controller; Matlab Real-Time workshop was used to interface with outside plant and dSPACE ControlDesk was used for data capturing and realtime parameter tuning. One of the plants used was Quanser SRV-02 DC Servo. The 7 interfacing between hardware and software are done by using dSPACE Data Acquisition Card and dSPACE Interface Board. Below are some examples of experiment developed by the author of this thesis; Gain Compensation and Feedback for DC Servo Lag Compensation for Speed Control of a DC Servo Lead Compensation for Position Control of a DC Servo Tuning a PID Controller PID Controller for Flexible Joint LQR Control with Observer for Flexible Joint LQR Control for Flexible Link 2D freedom of Helicopter It was found that there are certain similarities between Teaching Aid for Control Engineering with this project. Both use Matlab Simulink software to develop the controller and DC Servo Motor as the plant. However, this project used different model of plant and data acquisition card. The method of control was also is quite different, where it has different type of controller and controlled parameter. Teaching Aid for Control emphasis on the syllabus of Control System taught in Universiti Teknologi Malaysia (UTM). The controller taught in this particular subject is Proportional Controller, Proportional-plus-Integral Controller, Proportional-plusDerivative Controller and Proportional-plus-Integral-plus-Derivative Controller. Other advanced controller is taught in subjects like Artificial Intelligence, Advanced Control System, etc. 8 2.1.2 A Real-Time for Teaching Power System Control Design This project is the work of G. Jackson, U.D Annakage, A.M Gole, D. Lowe, and M.P McShane (2005). This paper is almost similar with previous thesis, but this paper is about the teaching for Power System Control Design for post-graduate program. The objective was to develop real-time simulation for the teaching of design principles for power system controls. The approach used by the authors was rapid prototyping control. The dSPACE data acquisition card was used to interface with a real time power system simulator (RTDS). Again, Matlab Simulink was used to create the controller. 2.2 Control System Theory Control system is consists of subsystems and processes (or plants) assembled for purpose of controlling the output of the processes. In its simplest form, a control system provides an output or response for a given input or stimulus, as shown in Figure 2.1. (Norman S. Nise, 2004) Figure 2.1: A Control System 9 2.2.1 The Control System Characteristics 2.2.1.1 Input and Output As stated earlier, the input is the given stimulus or the desired response. The output is the actual response. Input is also known as the forced response. Output is the combination of transient response and the forced response. Transient response is the exponential response of the physical system before reaching to the steady-state value. The transient response is due to the system acquiring or dissipating energy. It is desire of most control system to get the output equivalent with the input given. However, this would be practically difficult since the input would be an instantaneous signal and the physical system on the other hand requires time before reaching a constant value. Thus, a control mechanism needed to get the response approximately with the desired response. This is where a control system plays its role. 2.2.1.2 Closed Loop System A system normally exposed to disturbances. These disturbances would affect the performance of the system. A control system with closed loop configuration would overcome this problem. Correcting actions are done by sending back the output signal and compares it with the input. The controller would correct the discrepancy between the input and output. Figure 2.2 describes the closed-loop system configurations. Figure 2.2: The Closed Loop Configurations 10 2.2.1.3 Analysis and Design Objectives It was mention earlier that a physical system would practically unable to achieve output that is exactly equal with the input. The control system would be able to overcome this problem. There are three important analysis and design objectives that will be used in this teaching aid, which are the transient response, the steadystate error and the stability. 2.2.1.3.1 Transient Response Transient response represents how fast a system response when an input is applied. This is crucial for some system that requires speed as their main importance. However, if the response was too fast, it could possibly cause permanent damage of the physical system. 2.2.1.3.2 Steady-State Response Steady-state happens when the system achieve a constant condition. The steady-state error occurs when the steady-state of output response is not equal to the input signal. It is another objective of a control system to overcome this error and to produce output that is same as the input. 2.2.1.3.3 Stability The foremost important criterion of control system is stability. Without this, there is no point of getting good transient response. An unstable system response has no steady-state response. The response will not settle in certain value, but will continuously grow without stopping. This will cause the system to self-destruct. Thus, stability comes first when creating a control system. 11 2.3 Controllers The closed-loop system has feedback element used to send the actual response signal to the controller. This feedback element should be able to convert the actual response to the signal same as the input. For example, if an input given to a motor is an electric signal and output response obtained is the speed. Thus, the feedback element should be able to yield electric signal proportional with the speed. A sensor or transducer would be able to do this. The controller is the element that would compensate the value from the sensor. There are several type of controllers introduced in this chapter. Each has different combination of design objectives. 2.3.1 The Proportional Controller (P) The objective of a Proportional controller is to improve the system gain. For certain applications, there is a need to amplify the output signal. The proportional controller has a gain, Kp. This controller would not compensate the response from the sensor. It would only amplify the signal according to the value of Kp. Figure 2.3 shows the configuration of a Proportional Controller. Figure 2.3: The Proportional Controller 12 2.3.2 The Proportional-Derivative Controller (PD) The objective of a Proportional-Derivative controller is to improve the system gain and transient response. This controller will not improve the steady-state error. As the name suggest, this controller has a derivative element, Kds and a proportional element, Kp. The derivative element causes the system to have an exponential response. This exponential response will determine the transient response of the system. In this teaching aid, we could adjust the parameters of this controller. Figure 2.4 shows the basic structure of PD Controller. Figure 2.4: The Proportional-Derivative Controller 2.3.3 The Proportional-Integral Controller (PI) The objective of a Proportional-Integral controller is to improve the system Ki gain and steady-state error. It has an integral element which will cause the s system to have a decaying exponential response. When this response reached value of zero, the system will only left with the forced response. Thus, the output will reach to the same level as the input eventually. This controller also has the proportional element, Kp to improve the system gain. Figure 2.5 shows the configuration of a PI controller. 13 Figure 2.5: The Proportional-Integral Controller 2.3.4 The Proportional-Integral-Derivative Controller (PID) The PID controller is the combination of PI Controller and PD Controller. This controller could achieve steady-state response, improves transient response and gain. Figure 2.6 describes the basic structure of PID Controller. Figure 2.6: The Proportional-Integral-Derivative Controller 14 2.4 Hardware The hardware used in this project is the CE110 DC Servo Motor Trainer. This servo motor is used as the plant for the control system. 2.4.1 CE 110 Servo Motor Trainer The CE110 DC Servo Motor is specifically designed for the study and investigation of basic and advance control system. It is generally relates with the position and speed control systems. Figure 2.7 shows is the picture of the CE110 DC Servo Motor Trainer. Figure 2.7: The CE110 DC Servo Motor Trainer The specification of the DC Servo Motor is as follows; Analog input in range of 0V~±10V. The plus-minus sign of input enables variable shaft speed of rotation in either direction. Shaft speed is up to 1999 rpm. Electrically operated clutch is enabled by a toggle switch. Clutch engages an output shaft via 30:1 reduction gearbox. MATLAB compatible data file format, which is suitable with this project where the software that will be used is MATLAB. It is designed to be mounted and controlled by a compatible external controller, either analog or digital. 15 2.4.2 The Mathematical Modeling of Servo Motor The mathematical modeling for the DC Servo Motor is required in order to get the transfer function that represents the characteristics of the system. In this teaching aid, the transfer function of the DC Servo Motor should be determined first before creating the controller using the Simulink diagram. 2.4.2.1 Servo Control System The basic form of a servo system is consisting of electric motor with an output shaft that has an inertial load, J and friction in the bearing and load. Figure 2.8 shows the basic form of servo control for CE110 DC Servo Motor Trainer. Figure 2.8: A Servo Control System Initially, the clutch disengaged. This configuration is described in Figure 2.9 below. Figure 2.9: The Servo Control System with Clutch Disengaged 16 The system model is the relationship between the input torque from the motor and the torque required to drive the load and the flywheel and also to overcome the friction. Tm = Load Torque + Inertial Torque + Frictional Torque ..........(1) The Load Torque is proportional to the load control voltage vL. The Inertial Torque is determined by the flywheel inertia and the shaft acceleration d . dt The Frictional Torque is proportional to the shaft speed ω. Thus, Tm = kLvL + I d + bω ………………………………………..……(2) dt Where; kL = Gain constant of load / generator I = Inertia of flywheel b = Friction coefficient of rotating components The governing electrical equation V (t) = Ri + L di + Vbemf ………………………………………..…..(3) dt Where; V (t) = motor input voltage R = Armature resistance L = Armature inductance i = Armature current Vbemf = the motor back emf 17 The motor torque and Vbemf can be written in term of motor constant, Km; Vbemf = Km ω…………………………………….…..(4) Tm = Km i……………………………………..……(5) Combining equations, by taking Laplace transform and eliminating variables, the transfer function is:- Output Speed; ω(s) Km KL(R sL) V(s) VL(s) ………...(6) 2 (sI b)(sL R) Km (sI b)(sL R) Km 2 The transfer function simplifies if inductance, L of the armature circuit is assumed to be small compared to the inertia of flywheel. This gives the first order transfer function:- ω(s) Km K L V(s) VL …………….…………..……………...(7) Ts 1 Ts 1 Where T, time constant is; IR ………………………………...………(8) bR K m 2 T K m Km bR Km 2 …………………...................................(9) K L KL bR Km 2 …………………………..…………...(10) 18 Normally, the servo-control system has initial load. In this case, VL=0, thus; ω(s) K m V(s) ……………………...……………………...…(11) (Ts 1) When clutch is engaged, the gearbox and output position shaft are connected to the main shaft as shown in Figure 2.10. Figure 2.10: The Servo Control System with Clutch Engaged The output shaft position, θ is related to the main shaft velocity, ω by; θ(s) ω(s) …………………………...…………….(12) 30 Where, the value 30 is related to the 30:1 reduction of speed through the gearbox. 2.4.2.2 The Actuator and Speed Sensor Characteristics Figure 2.11 represent a servo control system when it is used as a feedback control system. 19 Figure 2.11: The Block Diagram of a Feedback Control System The speed of motor, ω is controlled by adjusting the applied voltage, V(t). The sensor of the motor will sense the shaft speed and the angular position. It then will send output signals in term of voltages. These output voltages are: Vω ~ voltage from speed sensor Vθ ~ voltage from the position sensor Both of these voltages are proportional to shaft speed and shaft position respectively. If Ki, Kω, Kθ are the motor, speed sensor, and angle gain constants, then ω = Ki V ……….……………………………(13) Vω = K ω ω …………………………………….(14) Vθ = Kθ θ …………………………………….(15) Combining equation (11), (13) and (14), the standard system transfer function is Vω K1 V(s ) (Ts 1) …………………………………….(16) Where K1 = Ki K ω, is the steady-state gain of the transfer function from the input voltage V(s) and sensed shaft speed. The relation between shaft speed sensed and shaft position sensed is:- Vθ K2 Vω …………..…………………………………….(17) s 20 Where K 2 K 30 K The overall system transfer function is the combination of the system transfer function for angular velocity and angular position as shown in Figure 2.12. Figure 2.12: The Block Diagram of Feedback Servo System The overall motor transfer function is: Vθ K1K2 V(s) s(Ts 1) ………………………………………….(18) 2.4.2.3 The Motor Transfer Function The time constant and the steady-state gain could be obtained from the graph relating the speed with the applied voltage as shown in Figure 2.13. Figure 2.13: The Motor Transfer Function 21 2.4.2.4 The Angular Speed Control Figure 2.14 below shows the block diagram of a feedback control for angular velocity control. Figure 2.14: The Block Diagram for Feedback Control System for Velocity Control 2.4.2.5 The Angular Position Control Figure 2.15 below is the block diagram of a feedback control for angular position control. Figure 2.15: The Block Diagram of a Feedback Control System for Position Control 22 2.5 Software The software used in this project is MATLAB. There are many toolboxes in this software, such as Simulink, Image Processing, Virtual Reality, and Filter Design. This teaching aid is actually an integration of several MATLAB toolboxes. Each has different functions in this teaching aid. The toolboxes are the Simulink, GUIDE, Real-Time Windows Target and SISO Design Tool. 2.5.1 MATLAB SIMULINK MATLAB-Simulink is a high level block diagram simulation program. It is a software package that is used for modeling, simulating and analyze a system. The Simulink library is consist of blocks divided into groups according to their functions. In this teaching aid, Simulink will be used to create the controller. Figure 2.16 shows the Simulink Library and example of a Simulink diagram. Figure 2.16: The Simulink Environment 23 2.5.2 MATLAB GUIDE GUIDE is the MATLAB graphical user interface development environment. It is consist of a set of tools for creating GUI and program the GUI. This toolbox is used to choose the parameters of the controller. Figure 2.17 below shows the layout of GUIDE toolbox. Figure 2.17: The GUIDE Layout 2.5.3 MATLAB REAL-TIME WINDOWS TARGET Another toolbox used for this project is MATLAB Real-Time Windows Target. This toolbox is used for prototyping and testing with a real-time system. The controller from Simulink diagram will be interfaced to the outside plant through this toolbox. The Simulink library has the block diagram for this toolbox. 24 2.5.4 MATLAB SISO Design Tool SISO Design Tool is another MATLAB toolbox used for this project. It is very helpful in analyzing the response for a closed loop system. The Bode Plot, Root Locus, Nichols Chart and the step input response of a system could be viewed from this toolbox. Figure 2.18 shows the environment of SISO Tool. Figure 2.18: The SISO Tool Environment 25 2.6 Interfacing 2.6.1 PCL 818 Data Acquisition Card The PCL-818 is a high speed, high performance data acquisition card with multi-function. This data acquisition card is the hardware platform which obtains sensor output and sends control signals. Since the measured signal from sensor is analog, this card has ADC (Analog-to-Digital Converter) to makes signal compatible with the computer. It also has DAC (Digital-to-Analog Converter), so that the computed signal can be fed back to the plant. Figure 2.19 below shows the PCL 818 Data Acquisition Card. Figure 2.19: The PCL 818 Data Acquisition Card CHAPTER 3 METHODOLOGY The Teaching Aid for Control Engineering is developed in several stages. Figure 3.1 shows the flow of work from one stage to another. Figure 3.1: The Flow of Work The teaching aid for control was designed accordingly with the diagram above. The flow of work starts with the hardware development. Once the system characteristic was obtained, we can start with the software development and finally the interfacing. 27 3.1 Overall System Design Before conducting this project, a full view of the expected results was carefully observed. The general idea of the overall system design is as shown in Figure 3.2. Figure 3.2: The Overall System Design From the figure above, we could see that the overall system was fragmented into three different parts. The computer will acts as the controller and input signal was given by the MATLAB software in the computer. The PCL 818 DAQ will do the interfacing and the CE110 Servo motor will response according to the control signal. Note that the sensor used is the tachometer. Thus, the control parameter for this teaching aid is the speed. Although the CE110 DC Servo Motor provides another sensor (Potentiometer), only the speed response was chosen. This is because the speed varies accordingly with the voltage and also the transfer function for speed is in the first order. The potentiometer is used for angular position control. This would give the system transfer function in second-order system. Thus, it is much difficult to control and involving with much higher order system. Student can performed this higher order control once they are familiarized with the lower system order. 28 3.2 Hardware Development Hardware development comes first before the software. This is because the plant characteristics need to be studied first before we could control it. In this project, the hardware used was the CE110 DC Servo Motor Trainer. The characteristic of this motor is determined by performing the system calibration. This is done experimentally, where the output reading from motor was taken as the input signal is varied. However, the calibration was first done by using an external controller that is the CE 120 Controller. 3.2.1 Mathematical Modeling of Servo Motor This procedure was conducted in order to obtain the transfer function of the plant. The servo motor characteristics would be changed in time. Thus, there is a need to calibrate this motor in order for it to be efficient. This calibration was done experimentally. Below are the procedures for the experiments: 3.2.1.1 Motor Calibration Characteristics The setting for the equipment is as shown in Figure 3.3. Figure 3.3: The Connection for Motor Calibration 29 The initial setting was Clutch Disengaged for CE110 and Potentiometer reading is 0V for the CE120. The potentiometer voltage was then slowly increased until the motor starts to turn. The voltage reading for this speed is known as the Dead-Zone value. The potentiometer then was increased to 1V. The reading of the motor speed was recorded. After that, the potentiometer voltage was increased another 1V until 10V. The same steps were repeated for negative value of the potentiometer and also for clutch disengaged. All the reading was recorded. The graph of the system response was then plotted and the equation relating the input voltage and the speed response was obtained. 3.2.1.2 Speed Sensor Calibration The setting for the equipment is as shown in Figure 3.4. Figure 3.4: The Connection for Speed Sensor Calibration The initial setting was Clutch Disengaged for CE110 and Potentiometer reading is 0V for the CE120. The potentiometer voltage was then slowly increased until the speed sensor reads 1V. The corresponding value of speed was recorded. The process was repeated until 9V. The same procedure was also conducted for negative voltage. 30 3.2.1.3 Measurement of Time Constant The setting for the equipment is as shown in Figure 3.5. Figure 3.5: The Connection for Time Constant Measurement The initial setting was Clutch Disengaged for CE110 and for the CE120, the function generator LEVEL at zero position, and OFFSET was adjusted until the voltage reads 0V. The function generator was set to a square wave with 0.05Hz frequency and LEVEL at 2.5V. The potentiometer voltage was also set to 2.5V. The output square wave signal was observed using the oscilloscope. The time constant is the 63% of final value of the output. 31 3.2.1.4 Angular Position Transducer Calibration The setting for the equipment is as shown in Figure 3.6. Figure 3.6: The Connection for Angular Position Transducer Calibration The initial setting was Clutch Engaged for CE110 and the reference position dial was set to zero. The potentiometer was then slowly increased until the motor output shaft gives the specified angles. These angles are between -150° to 150° with increment of 30° for each reading. The voltage reading for every angle was recorded. The graph of the system response was then plotted. 3.3 Software Development A stated earlier in Chapter 2, the software used in this project was MATLAB. The MATLAB toolboxes used in this project were Simulink, GUIDE, Real-Time Windows Target and SISO Design Tool. The development of the software starts with the Simulink diagram, then the GUI and finally the real-time testing using Real-Time Windows Target. The SISO Design Tool is part of the GUI program. 32 3.3.1 MATLAB SIMULINK MATLAB Simulink was used to create a block diagram which will represent the DC Servo control system. The Simulink diagram was created for five types of model, one for the original system and four others for the controllers (P, PI, PD, and PID). Each type has an External Mode diagram and a Normal Mode diagram. Thus, there were total of ten Simulink diagrams developed for this project. The Normal Mode Simulink diagram was used for simulation purpose only, without connecting it to the real system. This diagram will show the desired output. As for the External Mode, the Simulink diagram created for real-time simulation only. This diagram will show the actual output. 3.3.1.1 Creating Simulink Diagram for Normal Mode To create a Simulink diagram, first ‘simulink’ was typed at the Command Window or the Simulink icon at the top of the window was clicked. Then, the ‘Simulink Library Browser’ will appear and a new diagram was created by choosing File>>New>>Model as shown in Figure 3.7. Figure 3.7: Creating New Model from Simulink Library 33 After that, a new empty Simulink model will appear. The appropriate blocks from the Simulink Library Browser was chosen by click and drag the block to the Simulink model. The connection between blocks is done by just click at the end of a block and drags the arrow to another block as shown in Figure 3.8. Figure 3.8: The Connection between Blocks The parameter of the block was set by double-clicking at the particular block and the ‘Block Parameters’ block will appear. Then, we could adjust the parameter as desired. For example, we could set the Step Input block to 3V as shown in Figure 3.9 below. Figure 3.9: The Block Parameters Configuration 34 3.3.1.2 Parameter Setting for Normal Mode The parameter of a Simulink diagram is in default in Normal Mode and the Simulation time is 10 seconds. This parameter can be changed by clicking the ‘Configuration Parameters’ under the ‘Simulation’ tab. 3.3.1.3 The Simulation for Normal Mode Once all the parameters were set accordingly, the simulation was started by choose the ‘Start’ under the ‘Simulation’ tab or by just clicking at the ► button. The output will be displayed on the Scope. The result was viewed by double-clicking at the Scope block and the Scope window will appear. Figure 3.10 shows an example of Normal Mode Simulink diagram created in this teaching aid. Figure 3.10: The Simulink Diagram with Normal Mode The ‘Controller’ and the ‘Voltage to Speed’ block is user-defined block. The transfer function block is the transfer function of the motor obtained by the servo modeling 35 3.3.1.4 Creating Simulink Diagram for External Mode The Simulink diagram for external mode created in just the same way as the Normal Mode, except that in this teaching aid the external mode has additional two blocks for real time interfacing. The blocks can be found in the Simulink Library Browser under the section of the Real-Time Windows Target. The blocks used were the ‘Analog Input’ and ‘Analog Output’. ‘Analog Input’ is input from the sensor and the ‘Analog Output’ will send signal to drive the motor. These block need to be set according to the channels used in the data acquisition card. For this teaching aid, the channel for Analog Input was 9 and the channel for Analog Output was 2. The parameter of the block can be set by double-clicking on the block. Here is an example on how to set the parameter for Analog Input Block. First, the ‘Install new board’>> Advantech>> PCL 818 was chosen as shown in Figure 3.11 below. Figure 3.11: Installation of a New Data Acquisition Board 36 Then, the value of sampling time, Input Channels and Input range was set. The ‘Board Setup’ button was clicked to test whether the Simulink software can detect the data acquisition board. After that, the ‘Advantech PCL-818’ window will appear and Test button as shown in Figure 3.12 was clicked. Figure 3.12: The Parameter Setting for Analog Input Block If the board is at the specified address, the windows will prompt the user that the board is presence at the address verified 3.3.1.5 Parameter Setting for External Mode The ‘Configuration Parameters’ under the ‘Simulation’ tab was chosen. The Configuration Parameters window will appear as shown in Figure 3.13. 37 Figure 3.13: The Solver Settings The solver type was changed to ‘Fixed-Step’ and Solver type ode5 (DomandPrince) was chosen. The Fixed-Step size chosen was 0.001 since it is the smallest sampling time provided by MATLAB. The Tasking Mode chosen was SingleTasking. Next, Real-Time Workshop tab was chosen as shown in Figure 3.14. Figure 3.14: The Real-Time Workshop 38 In the Target Selection, Browse button was clicked and the Real-Time Target (rtwin.tlc) file as shown in Figure 3.15 was chosen. Figure 3.15: The Target Selection 3.3.1.6 The Simulation for External Mode Before the Simulink diagram could run in the real-time, we must first build the Simulink diagram. This can be done by choosing ‘Configuration Parameter’ under the ‘Simulation’ tab. Choose Build under the Real-Time Workshop tab or simply press ‘Ctrl+B’. After the model has been successfully build, we need to click the connect button. Then, the Simulink diagram will start to initialize and this would takes a few seconds until it is ready. After that, the real-time execution was started by clicking the start button ►. Figure 3.16 shows the External Mode Simulink diagram environment. Figure 3.16: The Simulink Diagram with External Mode 39 3.3.2 MATLAB GUIDE MATLAB GUIDE was used to create a graphical user interface. It is important for the convenience of the user to change the parameters of the controller. There were five GUIs created for this teaching aid, one for original system and four for controllers (P, PI, PD, and PID). This GUI is gives the user the ability to do both normal mode and external mode simulations simultaneously. User could also analyze their system performance by using this GUI. 3.3.2.1 GUI Layout The first step in creating a GUI is designing the GUI layout. Before implementing into the software, the GUI layout was first sketched to make sure that all the particulars needed were included in the GUI. Then, the components were chosen. There are many components in the GUIDE such as the push button, slider, radio button, and many more. The method in selecting these components is similar with the Simulink diagram, where we just have to click on the component and drag it into the layout area. The layout of the GUI is as shown in Figure 2.17. The components are at the left-hand side of the window. The components parameter was set by double-clicking on the component. The Property Inspector will appear. Then, the appropriate settings were done. The GUI needed to be run by clicking at the ► icon at the top of the GUI layout window. Once, the GUI was run, the Simulink diagram will automatically appear. The output response of the system can be observed from the Simulink Scope. 3.3.2.2 GUI Programming Once the GUI Layout was saved, the program of the GUI will automatically appear. This program was then manipulated to perform the desired actions when the component was clicked. The programming language used here is the M-File 40 programming. Figure 3.17 below shows an example of GUI created for this teaching aid. Figure 3.17: The example of a GUI From figure above, there are many different component used. Each has its own function. The function of each of the components is as follows: 1. Sliders: There are three sliders for this teaching aid, each for the gain of the controller. These sliders have an allowable range. This is to prevent the user from entering no permitted values. 41 2. Text Box: The text box will display the chosen value from the slider. The user can also enter the value directly on the text box and the slider will move automatically to the value indicated. However, the text box will show the previous value entered if the user enter value that is not within the allowable range. 3. List Box: The List Box will show all the values of controller’s gain and the history of the simulation done previous. However, this List for viewing purpose only. Students need to readjust the slider or directly enter the value of previous simulation on the text box to review the previous results. 4. Push Buttons: There are total of seven push buttons used in this teaching aid. The function of each push button is as follows; Under the SIMULATION Panel, SIMULATE When this button is clicked, the Simulation of the Simulink diagram will start. ANALYSIS When this button is clicked, the SISO Design Toolbox will appear and student can analyze the system. CLEAR The function of this button is to clear the values in the List Box. 42 Under the REAL-TIME APPLICATION Panel OPEN The function of this push button is to open the External Mode Simulink diagram. In default, the Normal Mode Simulink Diagram will open when GUI is run. CONNECT This button will initialize the connection between the Simulink diagram and the data acquisition card. The model for each external mode Simulink was initially built. Thus, user can connect to execute in real-time without rebuild the model. START The real-time simulation starts when this button is clicked. STOP The real-time simulation can be stopped before the simulation stop time by clicking this button. 43 3.4 Interfacing The Interfacing device used in this project is the PCL818 Data Acquisition Card. This card was used to perform conversion from digital to analog and vice versa. Table 3.1 shows the setting of switches for this data acquisition card. Table 3.1: The Switch Setting Switch SW1 SW2 SW3 Category Timer Clock Selection DMA Selection Base Address Selection SW4 Local Mode Range Selection SW5 Channel Configurations SW6 Input Range Control Description Clock input frequency: 1MHz or 10MHz DMA Transfer: DMA1 or DMA3 Address: 300h-30Fh Analog Input Ranges: DIP Switch Unipolar or Bipolar Analog input channels: Single-Ended (S/E) or Differential(DIF) A/D input range: Local (LCL) or Remote (REM) Setting 1MHz DMA3 OFF OFF 0-10V Unipolar ON ON ON ON ON ON OFF ON S/E LCL Table 3.1 shows the setting of switches for this data acquisition card. Table 3.2: The Jumper Setting Jumper JP1 and JP2 JP3 and JP4 JP5 Category TRIG0 and GATE0 JP1: TRIG0 JP2: GATE0 Reference of D/A Converter: INT (0-5V or 0-10V) or EXT (-10V-10V) Internal Voltage Reference: -5V or -10V Setting TRIG0 and D10 are shorted together GATE0 and G12 are shorted together INT Two left pins are shorted -10V Two right pins are shorted 44 3.4.1 The Connector Pin Assignment The connector pin assignment is as shown in Figure 3.18. Figure 3.18: The Connector Pin Assignment CHAPTER 4 RESULTS AND DISCUSSION Teaching Aid for Control Engineering was successfully created. In this chapter, the results for each teaching aid model will be discussed. 4.1 Servo System Modeling The experiments of servo motor modeling were conducted as stated in the previous chapter. The purpose of these experiments is to get the CE110 DC Servo Motor Trainer transfer function. The result of the experiment was recorded in tabular form and the graph relating the parameters was obtained. Then, the equation of the parameters is derived from the graph. Finally, the motor transfer function was obtained. 4.1.1 Motor Calibration Characteristics From the experiment conducted, the results are as in the Table 4.1 (Clutch Disengaged) and Table 4.2 (Clutch Engaged). 46 Table 4.1: The Motor Calibration Characteristic (Clutch Disengaged) Motor Drive Voltage (V) (Positive) 0 Dead-zone= 0.17 1 2 3 4 5 6 7 8 9 10 Motor Speed (rpm) 0 0 160 350 550 750 945 1145 1350 1550 1750 1950 Motor Drive Voltage (V) (Negative) 0 Dead-zone= -0.15 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 Motor Speed (rpm) 0 0 -175 -371 -569 -769 -965 -1165 -1364 -1565 -1761 -1960 Table 4.2: The Motor Calibration Characteristic (Clutch Engaged) Motor Drive Voltage (V) (Positive) 0 Dead-zone= 1.0 2 3 4 5 6 7 8 9 10 Motor Speed (rpm) 0 0 232 410 598 782 969 1156 1340 1530 1730 Motor Drive Voltage (V) (Negative) 0 Dead-zone= -1.0 -2 -3 -4 -5 -6 -7 -8 -9 -10 Motor Speed (rpm) 0 0 -250 -436 -622 -827 -1015 -1209 -1408 -1604 -1800 From these tables, Motor Speed versus Motor Drive Voltage graph was obtained. It is as shown in Figure 4.1. 47 The Motor Calibration Characteristic 2500 2000 1500 Motor Speed (rpm) 1000 500 0 -15 -10 -5 0 5 10 15 -500 -1000 -1500 -2000 -2500 Motor Drive Voltage (V) Clutch Disengaged Clutch Engaged Figure 4.1: Motor Speed versus Motor Drive Voltage From the graph above, the equation that relates Motor Speed with the Motor Drive Voltage for Clutch Disengaged is as follows; Positive: Speed = 197.7 (Voltage) - 34.976 Dead-zone: 0.17 Dead-zone: -0.15 Negative: Speed = 197.89 (Voltage) + 21.055 48 From these equations, the Voltage to Speed converter block was created as shown in Figure 4.2 below. Figure 4.2: The Voltage to Speed Converter From Figure 4.1, the motor constant, Ki was obtained as shown below; Ki (1750 0)rpm 1750rev 3.303rev / V sec (9 0.17)V 8.83V (60 sec) 49 4.1.2 Speed Sensor Calibration From the experiment conducted, the result is as in the Table 4.3 below. Table 4.3: The Speed Sensor Calibration Motor Speed (rpm) (Positive) 200 400 600 802 1002 1203 1403 1605 1805 Speed Sensor Input (V) Motor Speed (rpm) (Negative) -200 -401 -601 -801 -1001 -1202 -1403 -1603 -1804 1 2 3 4 5 6 7 8 9 Speed Sensor Output (V) -1 -2 -3 -4 -5 -6 -7 -8 -9 The graph Motor Speed versus Speed Sensor Input was obtained. It is as shown in Figure 4.3. Speed Sensor Calibration 10 8 6 SpeedSensor Output (V) 4 2 0 -2000 -1500 -1000 -500 0 500 1000 -2 -4 -6 -8 -10 Motor Speed (rpm) Speed Sens or Output Figure 4.3: The Speed Sensor Calibration 1500 2000 50 From the graph, the speed sensor constant, Kω; K 4.1.3 (9 0)V 9V 0.3V /(rev / sec) (1805 0)rpm 1805rev 60 sec Measurement of Time Constant Using the oscilloscope, the waveform of the output was obtained. The time constant was founded around 0.55 seconds. Thus, T = 0.55 seconds. 4.1.4 The Angular Position Transducer Calibration From the experiment conducted, the result is as in the Table 4.4. Table 4.4: The Angular Position Transducer Calibration Indicated Angle (°) -150 -120 -90 -60 -30 0 30 60 90 120 150 Position Sensor Output (Volts) -8.35 -6.74 -5.03 -3.29 -1.78 0.08 1.66 3.23 5.52 6.63 8.36 The graph Motor Speed versus Position Sensor Output was obtained using values from table above. It is as shown in Figure 4.4. 51 Angular Position Sensor Calibration 10 8 Position Sensor Output (V) 6 4 2 0 -180 -150 -120 -90 -60 -30 0 30 60 90 120 150 180 -2 -4 -6 -8 -10 Indicated Angle (°) Position Sensor Output (V) Figure 4.4: The Angular Position Transducer Calibration From this graph above, the speed sensor constant, Kθ; K (6.63 0)V 6.63V 0.055V / o (120 0) o 120 o 52 4.1.5 The System Transfer Function Since in this teaching aid the control parameter is the speed, the motor transfer function is between the Input Voltage and the Speed. Referring to the equation 16, the transfer function is given as; Vω K1 V(s ) (Ts 1) …………………………………….(16) K1 = KiKω = (3.303) (0.3) = 0.99 ≈ 1 However, since the calibration was done using the CE120 controller, there are some gain effect. Thus, the system transfer function was again calibrated for the gain adjustment using direct control to the MATLAB Software and the result is that the system gain K1 is equal to 0.77. Thus, the system transfer function is: Vω 0.77 V(s ) (0.55s 1) 53 4.2 Original System This teaching aid provides GUI for original system without any controller. The original system will show the response of the pure system without any compensation. Figure 4.5 below shows how the system should response according to the transfer function obtained. Figure 4.5: The GUI for Original System 54 The GUI for real-time execution is as shown in Figure 4.6 below. Figure 4.6: The Real-Time Simulation Result The system was compared using MATLAB SISO Design Tool by selecting the ANALYSIS push button of the GUI. The Scope in the Simulink does not provide the user to view the value of the response. Thus, this tool becomes assistance for user to determine the response characteristics. Figure 4.7 shows the result from SISO Design Tool. 55 Figure 4.7: The Output Response From Figure 4.7, the steady-state value, the rise time and the steady-state error was obtained. These three criteria will determine the design objectives. For system without any compensation, the pure system; Output = 0.435V Rise Time = 0.683 Steady-state error = 56.5% 4.3 Proportional Controller (P) The first controller built for this teaching aid is the Proportional Controller. The GUI almost similar with the previous system, but there is a slight difference. In this GUI, the user can select their desired value of Kp. The value of Kp was within the range of 0 to 5. This range was chosen to prevent the user from entering value that could lead the system to unstable condition. Stability is the primary concern of this teaching aid. Figure 4.8 shows the GUI for Proportional Controller where the value Kp was chosen randomly by moving the slider. 56 Figure 4.8: The GUI for Proportional Controller There is another additional push button and also a list box used in this controller. The purpose of these additional components is explained in Chapter 2. The GUI for real-time execution is as shown in Figure 4.9. Figure 4.9: The Real-Time Simulation for P Controller 57 Figure 4.10 shows the result from the SISO Design Tool for Proportional Controller. Figure 4.10: The Output Result for P controller From Figure 4.10 above; Output = 0.729V Rise Time = 0.328 Steady-state error = 27.1% For the value of Kp = 3.48, the output was increased to 0.729V. Thus, the system gain was improved. The rise time and steady-state was also improved. However, this controller was mot meant to improve these two criteria. This is because the output for the system with this controller could be higher than input given. It just amplify and not correcting the values. 58 4.4 Proportional-Derivative Controller (PD) The next controller built for this teaching aid was the Proportional Derivative Controller (PD Controller). Note that there is an additional slider was added for the value of Kd. The range of Kd is between 0 to 0.005. The value of Kd is quite small because the system would become unstable for larger values of Kd. This controller is important for improving the transient response. Figure 4.11 below is an example of the GUI with PD Controller, where the value of Kp and Kd was also randomly chosen. Figure 4.11: The GUI for PD Controller 59 The GUI for real-time execution is as shown in Figure 4.12. Figure 4.12: The Real-Time Simulation for PD Controller Figure 4.13 below shows the result from the SISO Design Tool for PD Controller. Figure 4.13: The Output Result for PD Controller 60 From Figure 4.13; Output = 0.646 V Rise Time = 0.439 s Steady-state error = 35.4% As explained in the literature review, the purpose of this controller is to improve the system gain and transient response. We can see that the output response is much faster than the original. For the value of Kp = 2.37 and Kd = 0.0194, the rise time of the output was increased to 0.439 s. The rise time for original system was 0.683 sec, which is much slower. Thus, the system transient response was improved. 4.5 Proportional-Integral Controller (PI) The next controller is the Proportional-Integral Controller (PI Controller). The GUI is similar with the PD Controller, but the Kd slider is replaced with Ki slider. The range of Ki is from 0 to 5. Figure 4.14 is an example of the GUI with PI Controller with the value of Kp and Ki randomly chosen. 61 Figure 4.14: The GUI for PI Controller The GUI for real-time execution is as shown in Figure 4.15 below. Figure 4.15: The Real-Time Simulation for PI Controller 62 Figure 4.16 below shows the result from the SISO Design Tool for PI Controller. Figure 4.16: The Output Result for PI Controller From Figure 4.16 above; Output = 1 V Rise Time = 0.558 s Steady-state error = 0% As explained in the literature review, the purpose of this controller is to improve the system gain and the steady-state error. We can see that the output response has reached the same level as the input given, which is 1V. For the value of Kp = 0.205 and Ki =4.885, the value of the steady-state output was 1V, which is equal to the input given. The output of the original system was 0.435 which is 56.5% error from the input value. 63 4.6 Proportional-Integral-Derivative Controller (PID) The next controller is the Proportional Integral Derivative Controller (PID Controller). The GUI is similar with the PI Controller, but there is an additional Kd slider. Figure 4.17 below shows an example of the GUI with PI Controller which the value of Kp, Ki and Kd was randomly chosen. Figure 4.17: The GUI for PID Controller 64 The GUI for real-time execution is as shown in Figure 4.18. Figure 4.18: The Real-Time Simulation for PID Controller Figure 4.19 below shows the result from the SISO Design Tool for PI Controller. Figure 4.19: The Output Result for PID Controller 65 From Figure 4.19; Output = 1 V Rise Time = 0.558 s Steady-state error = 0% As explained in the literature review, the purpose of this controller is to improve the system gain, transient response and the steady-state error. We can see that the output response has reached the same level as the input given, which is 1V. For the value of Kp = 1.62, Ki = 6.81 and Kd = 0.0214, all of the three design objectives was improved. CHAPTER 5 CONCLUSION AND RECOMMENDATIONS The Teaching Aid for Control Engineering was successfully developed. The objective of this project was finally achieved. The teaching Aid for Control Engineering could be used for enhancing the teaching method of control system subject. 5.1 Recommendations This teaching aid could also be implemented in the laboratory experiments such as System Identification, Computer Aided Design and Characteristics of Simple Controller. The Simulink diagram could be masked so that the student has to analyze on their own. They could also create a controller regarding certain requirements given by the lecturer. 5.2 Recommendation for Future Work For future work, it is recommended that this teaching aid is further enhanced for other complex controllers such as Fuzzy Logic, Neural-Fuzzy and many more. It is also recommended that this sort of teaching aid is developed for other subjects learned by the undergraduate student. 67 REFERENCES 1. Nise, Norman S. Control System Engineering, 4th Edition, John Wiley and Sons Inc. 2004 2. CE110 Servo Trainer Manual, TQ Education and Training Ltd 2000 3. CE120 Controller Manual, TQ Education and Training Ltd 2000 4. PCL-818 High Performance Data Acquisition Card with Programmable Gain User Manual, Advantech Co. Ltd, 1993 5. Abiakel, Elio The Development of an Undergraduate Laboratory Course in Control System, The Ohio State University 2003 6. G. Jackson, U.D. Annakkage, A. M. Gole, D. Lowe, and M.P. McShane, A Real-Time Platform for Teaching Power System Control Design 7. Nasarudin Ahmad and Shaharum bin Sulaiman, Lab Sheet Makmal Kawalan 1, Angular Speed Control and Angular Position Control, 2004 8. Norazman Abdul Majid, Masdinal Alauyah Md.Yusuff, Tina Abdullah, Sahirah Marzuki, Zanariah Md. Salleh, Faruk Muhammad, Siti Aishah Abd Hamid, Rohayah Kahar, Academic Report Writing, Pearson Prentice Hall, 2006 9. http://www.tq.com/ 10. http://www.advantech.com/ 11. http://www.mathworks.com 12. http://control-systems-principles.co.uk 13. http://www.unc.edu/ 14. http://www.phys.unsw.edu.au/ 15. http://www.dartmouth.edu/ 68 APPENDIX A Manual on How to Use Teaching Aid for Control In this manual, the PID Controller is used as an example. The process of GUI for other controller is almost the same with this example. It is assumed that the PID.fig file is already placed in the Matlab>> work directory. 1. Start MATLAB, type ‘guide’ at the Command Window. 2. The GUIDE Quick Start box will appear, choose ‘Open Existing GUI’ tab. 69 3. Choose the file C:\Matlab7\work\PID.fig 4. The PID.fig file will open and click on the run button 70 5. The GUI figure will open. 6. Then, the user can select their desired value of gains and run in both non-realtime and real-time simulation. 7. The function of the GUI components is as follows; Sliders: There are three sliders for this teaching aid, Kp, Kd, and Ki. Kp is for adjusting the system gain, Kd is for adjusting the time response and Ki is for adjusting the steady-state error Text Box: The text box will display the chosen value from the slider. List Box: The List Box will show all the values of controller’s gain and the history of the simulation done previous. The List Box is for viewing purpose only. 71 Push Buttons: There are total of seven push buttons used in this teaching aid. The function of each push button is as follows; Under the SIMULATION Panel, SIMULATE Start the simulation of the Simulink diagram. ANALYSIS Open the SISO Design Toolbox. CLEAR Clear the values in the List Box. Under the REAL-TIME APPLICATION Panel OPEN Open the External Mode Simulink diagram. CONNECT Initialize the connection between the Simulink diagram and the data acquisition card. If any problem occurs during this process, rebuild the system by pressing ‘Ctrl + B’ on the Simulink diagram. START Start the real-time simulation. STOP Stop the real-time simulation. 72 APPENDIX B Block Diagram of PCL 818 73 APPENDIX C Connector, Switch and VR Location of PCL 818 74 APPENDIX D CE 110 Front Panel 75 APPENDIX E CE 120 Controller