Ball and Beam Educational Tool for Advanced Control System Laboratory Zulhisyam Salleh1, Ahmad Nasharuddin A.Rashid2, Fizatul A. Patakor3 1,2 Electrical Eng. Department Politeknik Melaka, Malaysia 3 Electrical Eng. Department,Politeknik Ungku Omar, Perak, Malaysia Abstract: The practical implementation of advanced controlled system for an industrial application involves a wide variety of integrated field such as control electronics, power electronics, electric machine and drives. The ball and beam educational tool presented here allows student to work with all different fields. The system includes a ball, a beam, a motor, several sensors, intelligent drive and PC as a host. This educational tool involves the modelling process, analysis and control of the ball and beam system using Matlab/Simulink and experimental hardware. The control is designed in closed-loop system using PID tuning method. This research presents the very useful and influential laboratory system that provides PC-based control software that enable student to compare the simulation and experiment. Thus, it is easier for students to relate the theoretical concepts that they have learned in class. . 1. Introduction Curricular on the advanced control system include the study of complex control algorithms that are often abstract and difficult to understand, as well as there are many aspects of control electronics. Therefore, to help the students to understand them better, it is necessary to carry out laboratory sessions with real control systems and hardware implementation. The Ball and Beam Educational tool that available in Electrical Department in Politeknik Melaka are suitable for courses in basic control system, control system , and electrical motor control. It is able to control the position of a stainless steel ball on the track by adjusting the rotating angle of a beam. The 1 system consists of two parts, namely the ball and beam body and the control system as Figure 1. The ball and beam body consists of a v-grooved steel bar and a free rolling ball. The linear sensor measures the position of the ball on the track by measuring the output voltage from the stainless steel bar. A DC motor is connects to a gear reducer, which controls the angle of beam, accordingly realize the position control of the ball. Experiments such as system modelling, design of feedback controller using P, PD and PID control system design can be achieved with this experiment platform. Figure 1: Basic component and their interconnection of Ball and Beam Educational Tool (source: GBB1004 User Guide and Experiment Manual V 2.051) With the experiment platform, students will learn the method of control system analysis and design as they are new in this area. Experiment course based on the control system analysis and design of ball and beam describes how to select control algorithm for better performance index after the electrical and mechanical part of the control system is completely confirmed. Method of 2 control system analysis and design is introduced gradually according to the learning characteristic of the student base on Table 1 Table 1: Method of control system analysis Comprehensive Experiment PID adjustment Design Experiment Status feedback control Verifying Experiment System modelling and stability analysis 2. Problem Statement Most of control problems that we meet in laboratory practical work are straight forward to control. For a fixed input signal, the output stays more or less constant. However in real life application, a set of control system are either by design or nature are unstable (Kuo and Golnaraghi, 2003). The feedback control is essential to make them operate safely. The control of unstable system is critically important to many of the most difficult control problems and must study in the laboratory. The problem is that the real unstable systems are usually dangerous and cannot be brought to the laboratory. Then the ball and beam system is seen can resolve this paradox. It is simple, safe mechanism and yet has the important dynamic features of an unstable system. 3. Research Objective The main objectives of the work presented in this research are as follows: i. Built a simulation model for ball and beam system ii. Design a proportional controller (P), proportional plus derivative controller (PD) and proportional plus integral and derivative controller (PID) for ball and beam system. iii. Compare the results of P, PD and PID controller iv. Use the designed controller to control the real plant in experimental rig and compare the different performance. 3 4. Literature Review The ball and beam system is often used by many control theorists and engineers testing and analyzing the results of many different theoretical control schemes (Salem, 2013). In order to stabilize unstable ball and beam system, a vast control system is designed in the literature. Some researchers used non-model based control strategies such as Neural Network (Li and Yu, 2010), Fuzzy Logic (Amjad et al., 2010, Iqbal et al., 2005) LQR controller (Rahmat et al., 2010) and PID(Yu and Ortiz, 2005) to control the ball position and beam angle. A proportional-integral-derivative controller (PID controller) is a generic control loop feedback mechanism that widely used in industrial control systems. A PID controller calculates an "error" value as the difference between a measured process variable and a desired set point. The controller attempts to minimize the error by adjusting the process control inputs. Although PID controller can be classified as conventional controller, however it is very important to student know the concept of the controller before they enter the working environment. In the absence of knowledge of the underlying process, a PID controller has historically been considered to be the best controller (Bennett, 1930). By tuning the three parameters in the PID controller algorithm, student can experience to tuning the parameter of the controller. Finally, provide control action designed for specific process requirements. The change in closed-loop response because of the changes in PID parameters with respect to a step input can be describes as in Table 2. Table 2: The correlation of Kp and Ki, to rise time, overshoot, settling time and steady-state Closed-loop response increase Kp error of speed response Rise time Overshoot Settling time Decrease Increase 4 Small change Steady-state error Decrease Ki Decrease Increase Increase Eliminate Kd Small change Decrease Decrease Small change Note that the correlation may not be exactly accurate, because Kp, Ki and Kd are dependent on each other. In fact, changing one of these variables can change the effect of the other two. For this reason, the table should be used as a reference when student determining the values of Kp, Ki and Kd. The ball and beam system in this educational tool has 2 Degrees-of-Freedom (DOFs). The ball is assumed to have friction, rotary moment of inertial and coriolis acceleration during motion on the beam. However, some of the dynamic properties were neglected in this research work regarding the ball and beam mechanism in order to simplify the dynamic equation of the system. 5. Methodology The work undertaken in this research is divided into two stages; simulation study and experimental work. The simulation study is carried out using Matlab version 7.9.0 (R2009b) involving numerical design of the drives system. The experimental work is realized using Matlab/Simulink software and then connected to intelligent controller. Comparison performances for both controllers are investigated. 5.1 Description of the systems The ball and beam is functionally divided into the following component Ball and beam apparatus that include Mechanical plant with built-in DC servo motor and DC voltage supply IPM100 intelligent servo drive system PC with the control program. The details of functional blocks are discussed in the following sections 5 5.1.1 Mechanical Part The mechanical plant consists of a base, a beam, a ball, a lever arm, a belt pulley, a support block and a motor as shown in Figure 2. The ball can roll freely along the whole length of the beam. The beam is connected to the fixed support block at one side and to the movable lever arm at another one. In turn the motion of the lever arm is controlled by the DC brush motor through belt pulley. The motor is equipped with built-in rotary optical incremental encoder (1000P/R) that provides feedback information about current actual rotary position of the motor shaft. In the slot along the beam there is a linear potentiometer sensor that senses current linear actual position of the ball on the beam. Both measured positions are fed back to the control system to organize a closed loop control. As the servo gear turns by an angle theta, the lever arm changes the angle of the beam by alpha. When the beam is moved away from horizontal position, gravity causes the ball to roll along the beam. The purpose is to design and implement a control algorithm that moves the shaft of the motor in such a way that the desired position of the ball is stabilized on the beam. Figure 2: Functional of mechanical part 5.1.2 Intelligent Drive The motion of the motor’s shaft is governed by IPM100 intelligent drive. This is a high precision, fully digital servo drive with embedded intelligence and 100W power amplifier suitable for brushless/brush motors. Based on feedback information from sensors it computes and then 6 applies appropriate PWM modulated voltage to the motor windings in such a way that a sufficient torque moves the motor shaft according the user programmed control algorithm. The drive is called “intelligent” because besides built-in power amplifier for control signal amplification and PWM-modulation it has an on-board Digital Signal Processor (DSP), memory and other digital logic which offer advanced motion control and PLC functionality. Real-time trajectory generation, closed loop servo control, handling commands from host computer and processing I/O signals are executed on-board according to the stored programs and on-line commands from host PC. This embedded intelligence provides a true real-time control performance independent of any delays caused by PC’s non-real time Operating System. Although the drive can operate both in stand-alone and slave modes, ball and beam application examples given in this manual make use of its stand-alone features. Physically IPM100 is located inside the electric control box and communicates with the upper-level PC through RS-232 interface. The DC voltage to the drive is provided by the DC power supply also inside the electric control box. 5.1.3 PC based Control Software With this educational tool student can easily programs the drive with the high-level Technosoft Motion Language (TML) in IPM Motion Studio running on host PC. The code and on-line commands are downloaded to the drive for execution through PC’s COM port. IPM Motion Studio is an advanced and intuitive-based Windows Integrated Development Environment for the set-up and analysis of motion control applications with IPM drives. With this platform it is easy to: Identify motor, sensor and load parameters Tune and adjust the servo-drive control loops 7 Build flexible motion control algorithms/programs using TML Analyze and evaluate the behaviour of the system The user can define the motor commands to be applied to the motor. The Motion Wizard tool can help to generate all TML instructions in a graphical way without need to write any actual TML code. Specific selection and definition dialogs can be opened, viewed and edited depending on the command type to be generated. The advanced graphics tools include Data Logger, Control Panel, and Watches for TML parameters, registers and memory. They can be used to perform real-time analysis of the behaviour of the motion system. 5.2 System Modelling The open-loop transfer function of the plant for the ball and beam experiment is given below: ( )= ( ) ( ) = (1) ( ) The design criteria for this problem are: Settling time less than 3 seconds Overshoot less than 10% For this problem, the assumptions are ball rolls without slipping and friction between the beam and ball is negligible. The constants and variables for this example are defined as follows: (m) Table 3: Parameter of the ball and beam mass of the ball 0.028 kg (R) radius of the ball 0.01 m (d) lever arm offset 0.04 m 8 (g) gravitational acceleration -9.8 m/s^2 (L) length of the beam 0.4 m (J) ball's moment of inertia (r) ball position coordinate (alpha) beam angle coordinate (theta) 5.2.1 servo gear angle PID Controller Design The block diagram for this example with a controller and unity feedback of the ball's position is shown below: Figure 3:Proportional closed-loop control Where r is the input and R is the output of the system. First, this educational tool will study the response of the system shown above when a proportional controller is used. Then, derivative and/or integral control will be added if necessary. The transfer function for a PID controller is: ( )= + + + = + (2) The closed-loop transfer function for proportional control (P) with a proportional gain (Kp), proportional plus derivative controller (PD) and proportional plus integral plus derivative (PID) can be modelled by copying the lines of MATLAB code in Error! Reference source not found. 9 into a new m-file. The step response of the simulated system should look like the one shown in Figure 5. For proportional controller as Figure 5(a), the system remains marginally unstable with the addition of a proportional gain. Then, in Figure 5(b), the PD controller with the gain Kp=6 and Kd=6 is used to control the ball and beam system. The simulation result is demonstrated that the system is stable but both the overshoot and settling time are too high. The inertial system has minus breadth surging signals under the PD controller. Then, the ball and beam system is controlled using PID controller with the following parameters: Kp=15, Kd=10, Ki=0.5. As Figure 5(c), the result has met the design requirement, where the overshoot is less than 10% and the settling time less than 3 sec. Students can change the gain of the controller to some value and see the output of the simulation. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Ball&Beam PID Control M File %%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% m R g L d J K = = = = = = = 0.11; 0.015; -9.8; 0.4; 0.04; 2*m*R^2/5; (m*g*d)/(L*(J/R^2+m)); %simplifies input num = [-K]; % P Controller den = [1 0 0]; ball=tf(num,den); kp = 3; sys_cl_P=feedback(kp*ball,1); subplot(3,1,1) step(0.25*sys_cl_P) title('Step Response of P Controller') kp2 = 6; % PD Controller kd2 = 6; contrPD=tf([kd2 kp2],1); sys_cl_PD=feedback(contrPD*ball,1); t=0:0.01:10; 10 subplot(3,1,2) step(0.25*sys_cl_PD,t) title('Step Response of PD Controller') kp3 = 15; % PID Controller kd3 = 10; Ki=0.5; contrPID=tf([kd3 kp3 Ki],[1 0]); sys_cl_PID=feedback(contrPID*ball,1); t=0:0.01:10; subplot(3,1,3) step(0.25*sys_cl_PID,t) title('Step Response of PID Controller') Figure 4: Programming code for P, PD and PID controller S t e p R e s p o n s e o f P C o n t r o lle r A m p litu d e 0 .5 0 .2 5 0 -0 .2 5 -0 .5 0 1 2 3 4 5 T im e ( s e c ) 6 7 8 9 10 7 8 9 10 (a) S te p R e s p o n s e o f P D C o n tro lle r A m p litu d e 0 .3 0 .2 0 .1 0 0 1 2 3 4 5 T im e (s e c ) (b) 11 6 S tep R esponse of P ID C ontroller A m plitude 0 .3 0 .2 0 .1 0 0 1 2 3 4 T im e 5(sec) 6 7 8 9 10 (c) Figure 5: Simulation result of step response under different controller (a) P controller, (b) PD controller and (c) PID controller 5.3 Experimental Rig The closed-loop control algorithm employed in the demo application example is given in Figure 6 Figure 6: Structure Of The Control Algorithm The DC servo motor provides actuation of the beam via a gear. The PID control algorithm inside IPM100 intelligent drive has been employed in an inner control loop as a motor position controller. The PID gain is chosen in such a way that the motor exhibits a fast response without overshoot. The drive realizes the control according to the following sequence: 1. It downloads the control program written by the user in Matlab/Simulink via RS232 interface and stores it in the on-board internal memory 12 2. The feedback information is read from motor encoder and linear potentiometer of the beam every discrete sample time (the sample time is also programmable; 5 ms is default value for the demo program) 3. The on-board DSP decodes the downloaded program and computes the control signal according to the programmed algorithm based on feedback position information 4. The computed resulting control signal is amplified and PWM modulated by IPM’s power stage 5. The motor of the mechanical plant is powered in such a way that the rotation of its shaft balances the ball on the beam around the user-specified position. 5.3.1 PID controller Design Figure 7 shows the program control in Matlab/Simulink that link to the IPM100 intelligent drive and Figure 8 shows the switch of controller mode. In this experiment, student can easily switched from the mode of P controller, PD controller and PID controller and key in parameter of the controller gain in GUI. Figure 9 shows the result of the experiment. Large fluctuation observed in P controller and the system stabilizes quickly under the PD controller though the steady state errors are big as in Figure 9(b). For PID response as Figure 9(c), steady state error has been clearly lowered. All of the design requirements are satisfied. With this experiment student may try different parameters to obtain a satisfactory response in practice. 13 Figure 7: PID controller in Matlab/Simulink Figure 8: Controller Mode (a) 14 (b) (c) Figure 9: Experimental Results Under (a)P Controller, (b) PD Controller (c) PID Controller 6. Conclusion A Ball and Beam Educational Tool that allows student to make in-depth analysis of P, PD and PID controller have been presented. It is simple, compact and safe, is the best laboratory solution to advanced control system. Equipped with modern intelligent power drive module and intuitive programming Windows interface it is an ideal tool for control systems modelling. It is a piece of laboratory equipment that designed especially for teaching advanced control courses to students and for doing study in motion control field. It can serve as a convenient tool for practical implementation of many classical and modern control system design methods. The controller design can be expanded to root locus method and frequency domain response method. 15 Appendix A. Technical Specification : Moving range Control precision Synchronous belt reduction ratio Weight 400mm < 5mm Ball diameter Motor 30mm DC servo 70W 4 Power supply AC220V 50HZ 1A (AC110V optional) < 10Kg Dimension 530 x 200 x 332 mm 16 References Amjad, M., Kashif, M., Abdullah, S. and Shareef, Z. 2010. A Simplified Intelligent Controller for Ball and Beam System. Education Technology and Computer (ICETC), 2010 2nd International Conference on, 2010, IEEE, V3-494-V3-498. Bennett, S. 1930. A History of Control Engineering. Iqbal, J., Khan, M. A., Tarar, S., Khan, M. and Sabahat, Z. 2005. Implementing Ball Balancing Beam Using Digital Image Processing and Fuzzy Logic. Electrical and Computer Engineering, 2005. Canadian Conference on, 2005, IEEE, 2241-2244. Kuo, B. C. and Golnaraghi, M. F. 2003. Automatic Control Systems, John Wiley & Sons New York. Li, X. and Yu, W. 2010. Synchronization of Ball and Beam Systems with Neural Compensation. International Journal of Control, Automation and Systems, 8, 491-496. Rahmat, M. F., Wahid, H. and Wahab, N. A. 2010. Application of Intelligent Controller in a Ball and Beam Control System International Journal On Smart Sensing And Intelligent Systems 03, 46-60. Salem, F. A. 2013. Mechatronics Design of Ball and Beam System; Education and Research International Journal of Computational Engineering Research, 03, 54-79. Yu, W. and Ortiz, F. 2005. Stability Analysis of Pd Regulation for Ball and Beam System. Control Applications, 2005. CCA 2005. Proceedings of 2005 IEEE Conference on, 2005, IEEE, 517-522. 17