Implementation of Proportional and Derivative Controller in a Ball and Beam System Alexander F. Paggi and Tooran Emami United States Coast Guard Academy Abstract This paper presents a design of two cascade proportional and derivative (P and D) controllers for a ball and beam system. The controller has been designed by using root locus techniques. This study shows there are two control tasks for the ball and beam system. First a proportional controller is designed to adjust the angle of a beam. Second a derivative controller is designed for the position of a ball on the beam at specific location. The controllers are designed in Matlab and its control toolbox. These controllers are applied to a real-world ball and beam system to clarify the hardware and software interface. Keywords PD Controller, root locus, ball and beam. I. INTRODUCTION A ball and beam system is used for testing both classical and modern control techniques. The system is unstable and can be used to demonstrate a variety of controller design. The system is simply a free rolling ball on top of a beam, with one side of the beam stationary and the other side connected to a servomotor. The servo-motor changes the angle of the beam, which determines the position of the ball. Implementation of a feedback loop is needed for the ball and beam system to maintain the position of the ball on the beam [1]. The applications in the U. S. Coast Guard for automatic controller for an unstable system are vast and needed. An example of this would be a dynamic positioning system, which is used on Coast Guard buoy tenders to precisely place aids to navigation. The task for the ball and beam system is to fine-tune the angle of the beam using the servo-motor to adjust the position of the ball on the beam. An example of system similar to this in industry would be the pitch controller for an aircraft [1]. Fuzzy logic controllers (FLC), unlike traditional logic which consists only of 1 or 0, FLC can range anywhere between 0 to 1 [2]. This makes fuzzy logic closer in spirit to human thinking and natural language then the traditional logical systems [2]. FLC s are able to control even overly complex processes better than conventional quantitative techniques [2]. The study of FLC is vast because of the large number of practical implementations that they can be used for. Fuzzy logic rules are easily learned and defined because they are done in linguistic values, which is natural language resulting from an engineer s reasoning [2]. A proportional-plus-derivative (PD) controller uses the derivative of the error to determine the best controller [4]. By sending both the error and the derivative of the error to the plant, the (PD) controller will improve the transient response for a closed-loop system [5]. Proportional-integral-derivative (PID) controllers need to be modelled to determine the parameters of the controller to define the complex algorithms needed for the controller [3]. Fuzzy logics systems, on the other hand, use human knowledge to develop the fuzzy rules it uses for determining logic [3]. This makes fuzzy logic controllers simple to design and doesn t require the task of solving nonlinear systems [3]. Based on these results, fuzzy logic controllers are better than classical controllers because they are easily developed and are able to handle nonlinear systems. Many published works were looked at for this paper. The first paper was about the applications of a ball and beam controller [1]. The next was about the design of a fuzzy PID controller on a ball and beam system [6]. The next focused on a controller that was only fuzzy logic to control a ball and beam system [3]. The fourth paper focused on the better understanding the ball and beam system [7]. The fifth paper was about fuzzy logic control systems [2]. The sixth reference was the controls textbook, which was helpful in understand statements made in the papers used [6]. The seventh paper was the Quanser user manual, which had many of the needed information for designing the controller [4]. The final paper was about ways in which to teach root locus compensator [8]. The current paper presents a design of two cascade proportional derivative (PD) controllers for a ball and beam system. Root locus techniques are used to design the controllers. One of the controllers is designed to adjust the angle of a beam that is applied to a servo DC motor. The second controller is designed for the position of a ball on of beam. The controllers are designed in Matlab and its control toolbox. II. MODELING This section focuses on the fundamental theory to design a controller for a ball and beam system seen in Figure 1.
Table I: Ball and Beam Required Values Description Symbol Value Units Length of Beam LBeam 0.4255 m Distance between servo output gears shaft and coupled joint R arm 0.0254 m Figure 1: Quanser ball and beam system [7]. The first step is to model the ball and beam system. The system can be broken down into two plants. The first part is the servo system, as it shows in Figure 2. θ sd θ s Mass of Ball Mb 0.064 Kg Radius of Ball Rb 0.0127 m Gravity Grav 9.81 m/s^2 Using the values in Table I, the mass moment of inertia for a sphere (J B ) can be determine as Equation (4) [4]. J B = 2MbRb2 5 (4) Figure 2: Servo system with PD controller. where θ s is defined as the servo arm angle output and θ sd is the servo desired arm angle. The next step is to determine the transfer function for the servo plant (G p1 ), with the time constant (τ), and gain (K 1 ) seen in Equation (1) [4]. G p1 (s) = K 1 s(τs+1) It is easy to determine the servo closed-loop transfer function as equation (2). G cl = (1) PD G p1 1+PDG p1 (2) Once having (J B ) the model gain of the Ball and Beam system (K BB ) can be determine as Equation (5). K BB = MbGravR arm Rb 2 LBeam(MbRb 2 +J B ) Obtaining the ball and beam transfer function (G bb ) can be determine in Equation (6) [4]. (5) G bb (s) = X(s) θ l (s) = K BB s 2 (6) The overall closed loop ball and beam block diagram is show in Figure 4. The first component is the servo motor that controls the angle of the beam and second component is the ball and beam. The multiplication of two these two cascaded plants together gives the overall open-loop transfer function of the ball and beam system, as it can be seen in Equation (3) and Figure 3. G OpenL (s) = G bb (s)g cl (s) (3) Figure 4: Ball and Beam System with two PD compensators. The open-loop transfer function can be defined from the block diagram in Figure 4 such as: G OL bb = PD 2 G cl G bb (7) Figure 3: The cascade of servo and ball and beam system. To find the transfer function (G bb ) of the ball and beam the characteristics such the mass of the ball (Mb), length of beam (LBeam), radius of ball (Rb), and the distance between the servo output gears shaft and the coupled joint (Rarm ) are needed. The numerical value of these characteristic in given in [4] as it can be seen in Table I. The closed-loop transfer function of the overall ball and beam system can be determine in Equation (8). III. G cl bb = Controller Design PD 2 G cl G bb 1+PD 2 G cl G bb (8) Root locus technique is used to design the controller. The design specifications of percent overshoot and settling time correspond to a pole such as:
s 2 0 n j n 1 (9) where ( ) is the damping ratio and (ω n ) is the natural frequency. This design point also can be defined as Equation (10) in terms of its real and imaginary numbers. s 0 = σ 0 + jω 0 (10) The proportional compensator is given as Equation (11). 1 PD1 K p : (11) G ( s ) p1 0 The derivative compensator is designed as Equation (12) PD2 KGc( s) : Kds (12) The magnitude criteria can be used to determine the controller gain (K) as it is shown in Equation (13) [4]. 1 K (13) G ( s ) G ( s ) c 0 open loop 0 Figure 5: Step response of the servo before designing the compensator. A design specification of an overshoot of 15% and settling time of 0.756 second has been chosen to stabilize the DC motor. Root locus technique is applied to design a PD compensator for the servo. The proportional compensator has a gain for the servo DC motor of Kp = 6 (16) The closed loop transfer function of the servo DC motor is determined by substituting Equations (15) and (16) into Equating (2) as: With the derivative gain (Kd) can be determined from equation (14) GcL = 361.47 (s+14.58) (s+24.79) (17) K Kd (14) The closed-loop transfer function ( G closed loop ) can be determined. The last step of the controller design is to simulate and measure the transient response specifications and if it is necessary redesign the controllers. To verify the results the closed loop unit step response of the servo DC motor with the PD compensator in Equation (16) shows in Figure 8. This response has an overshoot of 19.1%, and a settling time of 0.029 seconds. So far this design has met the given specifications for the servo DC motor. IV. RESULTS This section presents the results of the ball and beam system using MATLAB. The closed-loop step response of the ball and beam in figure 4 requires the ball to stay at the middle of the beam within a settling time less than 8 seconds and an overshoot less than 15%. The first step of this process was to design a PD controller for the servo DC motor. The servo DC motor has a transfer function as: Gp 1.53 () s s(0.0248 1) (15) The step response of the servo DC motor shows in Figure (5). As can be seen the system is unstable. Figure 6: Step response after designing the compensator for the servo. In figure 6 the response shows a very small overshoot that is so small it is basically zero. The settling time is around 0.328 seconds. After obtaining the controller for the servo, the next step is to design a controller for the overall ball and beam model that is in cascade with the closed-loop DC motor. The
open loop ball and beam transfer function from Equation (6) and Table I can be found as: Gbb () s 0.41829 2 s (18) Again root locus technique is applied to design a PD compensator for the overall ball and beam system in Figure 4. Note that the given system specification is chosen to be a settling time less than 3 seconds and an overshoot less than 15%. The derivative control has a gain of Kd = 1.33 (19) The overall closed-loop transfer function can be determined by substituting Equations (17), (18), and (19) into Equation (8) as: G cl bb = 201.98 (s+25.51) (s+13.26) (s+0.597) (20) The closed loop unit step response of the overall ball and beam shows in Figure 7. It can see that this response has 0% overshoot, a settling time of 15 seconds. As the results with the two PD controllers the closed-loop specification has met. Figure 8: Response from the servo motor. Appling the above controller to an actual ball and beam system was done using Matlab Simulink. For the servo, the Kd = 0 and the Kp = 6.0009 were used. For the ball and beam aspect of the controller the Kd = 0.8352 and the Kp = 0 were implemented to maintain the response shown below. Figure 9 shows the response of the ball location of the beam of when a derivative gain of Kd=0.8 was applied to the actual ball and beam system. Applying a derivative gain of Kd=1.33 to real system caused a poor performance for the system. By decreasing the derivative gain coefficient to 0.8 the system performed with better and much faster response as it shows in Figure 9. Note that both simulation and real system have no overshoot with these controllers for the ball position on the beam. Figure 7: Step response of the system after the implementation of two compensators. In figure 8 there is a large overshoot (almost 15%) with the Kp = 6 as the controller. The simulation has a settling time similar to actual response of the servo angle on the ball and beam system. Figure 9: Response from the ball and beam system of the placement of the ball over time. The figure 9 shows that the ball starts at -20, the servo side of the ball and beam system. Once the controller starts the servo arm pushes the ball up fast causing the ball to increase speed, depicted by the steep slope in the figure. After increasing the speed of the ball, the controller corrected itself by paralleling to the ground. This caused the ball to stop directly in the middle of the beam (zero location). This response shows that the system has no percent overshoot and that the system has a setting time of around 4 seconds.
V. CONCLUSIONS This paper focuses on using pole placement compensator techniques to design a cascaded proportional and derivative controller for a ball and beam system. The results show there are two control tasks for the ball and beam system. First to adjust the angle of a beam, and second is the position of a ball on the beam. To adjust the angle of beam the first proportional controller has been designed for the DC motor. The second derivative controller is designed for the position of ball on the beam. DISCLAIMER "The views expressed in this article are the personal views of the authors and do not necessarily represent the views of the United States, the Department of Homeland Security, or the United States Coast Guard." REFERENCES [1] T. Anjali and S. S. Mathew, "Implementation of optimal control for ball and beam system," 2016 International Conference on Emerging Technological Trends (ICETT), Kollam, 2016, pp. 1-5. [2] C. C. Lee, "Fuzzy logic in control systems: fuzzy logic controller. I," in IEEE Transactions on Systems, Man, and Cybernetics, vol. 20, no. 2, pp. 404-418, Mar/Apr 1990. [3] M. Amjad, M. I. Kashif, S. S. Abdullah and Z. Shareef, "Fuzzy logic control of ball and beam system," 2010 2nd International Conference on Education Technology and Computer, Shanghai, 2010. [4] Quanser Inc. QUARC, student workbook. [5] Nise, Norman S. Control Systems Engineering. Hoboken, NJ: Wiley, 2015.. [6] W. Yuanyuan and L. Yongxin, "Fuzzy PID controller design and implement in Ball-Beam system," 2015 34th Chinese Control Conference (CCC), Hangzhou, 2015, pp. 3613-3616. [7] Zhu Chenghai, Li Jianan, Wang Fudong, Yang Xinhao, Zhao Ying and Shi Xiaoli, "Design and implementation of Ball and Beam control system based on iterative learning control," 2016 IEEE Advanced Information Management, Communicates, Electronic and Automation Control Conference (IMCEC), Xi'an, 2016, pp. 1288-1292. [8] R. T. O'Brien and J. M. Watkins, "A streamlined approach for teaching root locus compensator design," Proceedings of the 40 th IEEE Conference on Decision and Control Conference, December 2001, pp. 3224-3229.