ABSTRACT Title of Thesis: CONTROL OF A BEAM AND BALL SYSTEM WITH ARBITRARILY SHAPED SMOOTH BEAMS Ryan K. Lee Master of Science, 2020 Thesis Directed by: Dr. William Levine Department of Electrical and Computer Engineering This thesis develops a general model for the problem of controlling a ball on a curved beam for any beam defined by y = f(x). The model is converted to dimensionless param- eters and simulated. The performance of LQR with a model for the motor in the controls lab at the University of Maryland College Park is studied and a different nonlinear control method is investigated. The effects of feedback delay and increased sampling interval are studied. CONTROL OF A BEAM AND BALL SYSTEM WITH ARBITRARILY SHAPED SMOOTH BEAMS by Ryan K. Lee Thesis submitted to the Faculty of the Graduate School of the University of Maryland, College Park in partial fulfillment of the requirements for the degree of Master of Science 2020 Advisory Committee: Professor William Levine, Chair/Advisor Professor Nuno Martins Professor P.S. Krishnaprasad ?c Copyright by Ryan K. Lee 2020 Acknowledgments I owe my thanks to all the people that have made this thesis possible. First and foremost I?d like to thank Dr. Levine for being a wonderful advisor and being extremely patient with me. He has always been willing to answer all my questions and help me whenever I ran into a wall. I?d like to thank Dr. Krishnaprasad and Dr. Martins for being part of my defense committee and being amazing professors! I learned a lot in the classes I took with them. I?d like to thank my parents, Dr. Richard Lee and Aii-Hwa Lee. They?ve been super patient and supportive in my pursuit of this degree and finishing this thesis. I?d like to thank my partner Kaylee Yisu Slyh. She?s been super supportive and some- one I can lean on when I hit walls and things seemed bleak. Thank you everyone! ii Table of Contents 1 Introduction and Background 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Formulation of The Problem 9 2.0.1 Beam Dynamics with Motor Model . . . . . . . . . . . . . . . . . 10 2.0.2 Ball Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1 Dimensionless Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3 Simulations 28 3.0.1 Simulink Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.0.2 The Different Beams . . . . . . . . . . . . . . . . . . . . . . . . . 31 4 Simulation Results and Analysis 33 4.0.1 Poles of All Systems with Different Shaped Beams . . . . . . . . . 33 4.0.2 Testing Which Poles are Which . . . . . . . . . . . . . . . . . . . 34 4.0.3 Test of the Flat Beam . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.0.4 Analyzing the Differently Curved Beams . . . . . . . . . . . . . . 42 4.0.5 Effects of Changing Q . . . . . . . . . . . . . . . . . . . . . . . . 54 iii 4.0.6 Effects of Changing the Gear Ratio . . . . . . . . . . . . . . . . . 71 4.0.7 Test of Bound of Domain of Attraction . . . . . . . . . . . . . . . 80 5 Design of Physical System 95 5.0.1 Camera, Sampling Rate, and Delay of the Controller . . . . . . . . 95 5.0.2 Possible Cameras and Processing Cards . . . . . . . . . . . . . . . 101 5.0.3 Delay Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 5.0.4 A Note on 3d Printing . . . . . . . . . . . . . . . . . . . . . . . . 104 6 Conclusions and Suggestions for Further Research 105 iv Chapter 1: Introduction and Background 1.1 Introduction This thesis develops a general mathematical model for a small, light ball sliding on a frictionless beam. The beam can have any smooth shape. In addition, the beam is attached to the end of a rod that is rotated about an axis perpendicular to the plane of the beam. This is illustrated in Figure 2.1. The model includes the dynamics of the motor that rotates the beam. The resulting model is controlled by the voltage applied to the motor. It is assumed that all the elements of the four-dimensional state vector for this system can be measured or estimated with high accuracy. The feasibility of this assumption, based on using a camera to estimate the position and velocity of the ball, is evaluated. The problem of regulating the system (driving all four states to zero) is solved for several beams using the Linear Quadratic Regulator (LQR) as the control algorithm. The range of initial conditions for which such a controller can stabilize the system is studied. A preliminary determination of the feasibility of increasing the range of initial conditions that can be captured by means of a nonlinear control is made. The following section presents some background and history of the ball and beam family of control experiments. Next, the dynamics of the ball and beam, as described above, is derived. The precise assumptions on 1 the beam are given. The model is then revised to depend only on dimensionless parameters. This greatly facilitates the use of the model for the design of a physical implementation that can be used for experiments in the laboratory. Several choices for the shape of the beam are then analyzed in some detail. First, an LQR control for a flat beam is applied. The range of initial conditions for which this con- troller stabilizes the system is determined. Then, the systems are linearized about the zero state; an LQR based control is designed for this linear model; the resulting closed-loop re- sponse to initial conditions is then computed. The range of initial conditions for which this controller stabilizes the system is determined. It is, in most cases, disappointingly small. As a preliminary study of the possibilities of a nonlinear control, the following sim- ulated experiment was performed: A maximum input signal was applied to try to drive the ball from its non-zero initial condition towards its zero position. The maximum initial condition that could be driven towards zero for a given maximum input voltage was deter- mined for each of the beams studied. The effect of longer sampling intervals and the effect of modest feedback delays on the closed-loop systems is then studied. This is to determine the feasibility of using a cam- era as the measuring device for the state of the ball. The thesis concludes with some suggestions for further research and some recom- mendations for a hardware implementation of the ball and beam problems studied. 2 1.2 Background The earliest paper on the ball and beam experiment was written by P.E. Wellstead in 1978. It was titled ?Ball and beam experiment? [2]. In the paper, Wellstead describes an ex- periment which involves a steel ball rolling on a horizontally-pivoted beam. Since the pub- lication of the original paper, various implementations of this system, and the correspond- ing control problem, have become standard in introductory controls laboratory courses. Wellstead also mentions the ball and beam experiment as a case study in his textbook, ?Introduction to Physical System Modeling? [3]. In this case study, he goes into great detail about the schema of the ball and beam system and a simplified model as seen below. 3 Figure 1.1: The above figures are taken from the case study on the ball and beam system [3]. As shown, a simple straight ball and beam system is described. Wellstead describes the dynamics for the ball as mg sin? = mx? and for small incli- nations, the relationship between the ball position and the angle of the beam as ? = g?1x?. He then determined the position of the ball cannot be controlled directly and only could be controlled through the acceleration of the ball, x?. He then states the presence of two integrators and the dynamical properties of the beam results in a difficult, open loop unsta- ble problem. He then proceeds to develop an in depth mathematical model for the system assuming the ball is a point mass and calculating the system?s Lagrangian from L = U ?T where U is potential energy and T is the kinetic energy of the system. The then uses the La- 4 grangian to derive the equations of motion. After this, he proceeds to develop a bond graph of the system which allows the conversion of this system into state space. In the notes and references for this case study, he comments on the relations between the ball and beam ex- periment and the inverted pendulum and multiple inverted pendulums systems. They both amount to similar open loop unstable systems but at the time, he argued that the inverted pendulum and multiple inverted pendulums had practical significance to the dynamic of robots and prosthetic limbs. In 1992, K.J. Astrom and Michael Lundh developed a controls course [4]. They wanted to make sure the controls lab and controls curriculum at Lund Institute of Tech- nology in Sweden would give students a strong background in control theory and practical experience in making control systems that worked. As part of the way to accomplish this, the ball and beam experiment was one of the system used as part of their ?desk top pro- cesses?. Figure 1.2: An image of the ball and beam experiment proposed by Astrom and Lundh for the controls curriculum. [4] 5 The motor was strong enough to throw the ball off the beam. This shows an impor- tance of the ball and beam experiment in teaching future engineers about control theory and developing control systems. The usual ball and beam experiment uses a ball that is much lighter than the beam and a beam angle that is always less than ?30 degrees. For such a system, a linear model is sufficient. The problem becomes much more challenging if the ball is heavy enough to influence the beam dynamics. This is especially so if the beam angle can be large. A much greater complication can arise if the rotation of the ball becomes significant. This could occur if the ball is relatively heavy and there is enough friction between the ball and the beam to cause the ball to spin. To our knowledge, no one has investigated this situation. As stated in [5], a significant difference between the straight ball and beam and the curved ball and beam systems is that the linearized model of the curved ball and beam system has two eigenvalues in the right-half complex plane. Another significant difference is that the controability domain Q and the basin attraction, B, do not coincide in the linear model of the curved ball and beam system. But the basian B can be made arbitrarily close to the domain Q. This paper by Aoustin and Formal?skii develops detailed equations of motion and a linearized model of the circular beam and ball system. In conclusion, the linearized model of the circular beam and ball experiment is harder to control because of it?s two unstable modes. 6 More recent experiments add more nonlinearity to the problem and develop solutions to the resulting control problems. In [1], an offset of the beam pivot point from the axis of rotation adds more complexity because one or more poles appear in the open right-hand plane. This system isn?t too hard to analyze and this added difficulty enhances the educa- tional value of this experiment. The paper proceeds to show how one can find a controller for such a system when the beam is a half circle. The nonlinear dynamics are derived by means of Lagrangian mechanics, converted to dimensionless parameters and linearized. Three different control methods are studied. A classical single-input single-output method was used because the system linearized at the origin is controllable and observable. The second method studied uses a lead compensator in the outer loop of the feedback of ?where ? is the angle between the position of the ball ball and the tip of the beam. The third con- troller they implemented for the physical system was based on a linear quadratic regulator (LQR). The second controller could only be tested in simulations because the motor in the lab was too weak. The controller based on LQR is explained and performance is shown in the paper. Another example of more modern experiments is [6]. Yeong-Hwa Chang, Wei-Shou Chan and Chia-Wen Chang investigated applying a Takagi-Sugeno (T-S) fuzzy adaptive dynamic surface control (DSC) (TSFADSC) to the ball and beam system. In recent years, underactuated nonlinear systems have been of interest since such systems are light weight and low power. Controlling these systems is much more complex than controlling fully actuated systems. DSC was considered because it can overcome the problem of ?explosion 7 of complexity? caused by repeated differentiation found in traditional backstepping con- trol approaches. DSC techniques can also effectively deal with model uncertainties found in nonlinear systems and external disturbances. They model the straight beam and ball system using the Euler-Lagrange equation, develop the T-S fuzzy model and implement adaptive dynamic surface control using the T-S fuzzy model. Results from simulations and experiments show that their method does work and overcomes the problem of ?explo- sion complexity? and the computational infeasibility that comes up with conventional DSC. These are only two examples of how beam and ball systems are being used to inves- tigate different control approaches to handle different nonlinear aspects of the curved beam and ball problem and develop new control methods. These papers also show how important the beam and ball experiment has been to academia. In [4], the beam and ball problem is said to be popularly viewed as an academic benchmark. 8 Chapter 2: Formulation of The Problem Consider the coordinate systems shown in figure 2.1, where the beam is a shape de- fined by yr = fr(xr) and ru is the distance from the motor shaft to the base of the beam. There are three generalized coordinates, xr,yr, and ?. The dynamics of the system needs to be written in terms of xr,yr, and ? in the inertial frame. 9 Figure 2.1: Diagram of the system where X, Y are the axes of the inertial coordinate system and Xr,Yr are the axes of the rotating coordinate system, ? is the angle of the beam, and ru is the distance between the axis of rotation and the center of mass. We ignore the radius of the ball for the sake of simplicity. I.e. the ball is treated as a point directly on the beam. The origin of the inertial frame is the center of the motor shaft. If ? = 0, the frames line up i.e. X overlaps Xr and Y overlaps Yr of the beam . The position of the ball is p (xr, yr)r move the ball so it?s center is on the beam. 2.0.1 Beam Dynamics with Motor Model We assume the ball is light enough compared to the beam that we can ignore it?s effect on the beam dynamics. This, we can model the beam plus the dc motor dynamics without considering the ball. Define Mb as the mass of the beam, Jb is the inertia of the beam, and ru as the distance from the center of rotation of the motor shaft to the center of mass of the beam. 10 The general pendulum equation that will be used for this thesis based on figure 2.1 is Jb?? =Mbgru sin(?) + T (2.1) where T is input Torque. The beam plus DC motor can be described as follows: Define: Vin is voltage applied to the DC motor. ?m is the angular velocity of the motor shaft. ?s is the angular velocity of the beam. ?s is the angle of the beam. Kg is the gear ratio. Km is the emf constant. Im is motor current. Rm is motor resistance. Tm is torque generated by the motor. T0 is torque at the output after the gearbox. Jm is the motor inertia. Jb is the beam inertia. Tm is the output torque from the motor. 11 The electrical subsystem is described by: Vin = ImRm +Km?m = ImRm +KmKg?s (2.2) The mechanical subsystem is described by: ??s T0 = KgTg = Kg(Js??m+Jb )+Mbgrusin(?) = ??s(J 2 nKg +Jb)+Mbgrusin(?) (2.3)Kg Electric coupling is: Tm = KmIm (2.4) Combining equation (2.2), (2.3) and (2.4) yields, Tm T0 JmK 2 g + Jb Mbgru J Mbgru Im = = = ??s + sin(?) = ??(t) + sin(?) (2.5) Km KmKg KmKg KmKg K KmKg where J = J K2m g + Jb (2.6) and K = KmKg (2.7) Rearranging equation (2.5) yields: K K2 Vin(t) = J??(t) +Mbgrusin(?(t)) + ??(t) (2.8) Rm Rm The pendulum dynamics and DC motor dynamics have to be combined into one equation 12 because the motor shaft is directly attached to the beam. Equation (2.8) is a torque equation for the dc motor and beam combined where the input is Vin and output it ??. 2.0.2 Ball Dynamics The ball can slide or rotate along the beam but which it does is a complicated func- tion of the beam?s and ball?s surface and the normal force exerted by the ball on the beam. For the sake of a reasonable analysis and because both the rotational energy of the ball and the fiction forces are expected to be small, they are ignored. Thus, there are two forces acting on the ball; gravity and the force due to the interaction with the beam. To determine this interaction force we need to first calculate the accelera- tion of an arbitrary point on the beam. From figure 2.1, let ir and jr be the orthonormal basis vectors in the rotating frame Xr,Yr. Then, the position of an arbitrary point on the beam is given by p = xrir + yrj (2.9)r r Since this point is on the beam, yr = fr(xr). So p = x r r ir + fr(xr)j (2.10)r denotes an arbitrary point on the beam. 13 In the inertial frame, ????? }?ir = cos(?)i+ sin(?)j??? } (2.11)j = ? sin(?)i+ cos(?)j r where i and j are the orthonormal basis vectors in te inertial frame. Rewriting equation (2.10) in the inertial frame yields p = xr cos(?)i? fr(xr) sin(?)i+ xr sin(?)j + fr(xr) cos(?)j ? rr u sin(?)i+ ru cos(?)ji (2.12) where the terms with ru are added to account for the shift in the beam away from the axis of rotation. Taking the first and second derivative of equation (2.12) yields dp r dfi r= x?r(cos(?)? sin(?))i dt dxr dfr + x?r(sin(?) + cos(?))j dxr ? ??(xr sin(?) + fr(xr) cos(?))i (2.13) + ??(xr cos(?)? fr(xr) sin(?))j ? ru cos(?)??i? ru sin(?)??j 14 d2p ri = x?r(cos(?)? dfr dfr sin(?))i+ x?r(sin(?) + cos(?))j dt2 dxr dxr + x?r??(? ? dfr dfr sin(?) cos(?))i+ x?r??(cos(?)? sin(?))j dxr dxr d2? 2 f 2 r d fr x?r ( sin(?))i+ x? 2 2 r ( cos(?))j dxr dx 2 r ? ??(xr sin(?) + fr(xr) cos(?))i+ ??(xr cos(?)? fr(xr) sin(?))j (2.14) ? dfr dfr??x?r(sin(?) + cos(?))i+ ??x?r(cos(?)? sin(?))j dxr dxr ? ??2(xr cos(?)? fr(xr) sin(?))i+ ??2(?xr sin(?)? fr(xr) cos(?))j + ru sin(?)?? 2i? ru cos(?)??i ? r 2u cos(?)?? j ? ru sin(?)??j Both the beam acceleration vector and the gravity acceleration vector have to be decom- pose into a component perpendicular to the beam and a component tangent to the beam at the arbitrary point po. This is because the total force on the ball perpendicular to the beam must be negative or the ball loses contact with the beam. First, we need to deter- mine a local orthonormal coordinate system at point p. Note that this needs to be ex- pressed in terms the of the world coordinate system. Let hr(xr, yr) = yr ? fr(xr) in the rotating frame. Then ?h = ? dfrr ir + j is perpendicular to the beam at xr. In the in-dxr r ertial frame, ?h = ? dfri (cos(?)i + sin(?)j) + (? sin(?)i + cos(?)j). The tangent todxr the beam is perpendicular to ?h i.e., tanh dfrr = ?ir ? j in the rotating frame anddxr r tanhi = ?(cos(?)i+sin(?)j)? dfr (? sin(?)i+cos(?)j) in the inertial frame. This is justdxr one way to define the perpendicular. We want the one that points away from the peak of the beam. ?hi and tanhi are both normalized to give the orthonormal vectors to the ball 15 on the beam. ? tanh (?(xr) sin(?)? cos(??)))i+ (??(xr) cos(?)? sin(?))jim(xr, ?) := = 1 + ?2(x 2r) 1 + ? (xr) (2.15) ? ?h (??(xr) cos(?)? sin(??)))i+ (??(xr) sin(?) + cos(?))jj (x , ?) := = m r 1 + ?2(xr) 1 + ?2(xr) (2.16) where dfr := ?(xr).dxr Then define ????? }?im(xr, ?) := ???(xr, ?)i+ ??(xr, ?)??? } j (2.17) j (xr, ?) := ??(xr, ?)i+ ??(xr, ?)jm where ??(x?r) cos(?)? sin(?)??(xr) = (2.18) 1 + ?2(xr) and ??(x?r) sin(?) + cos(?)??(xr) = (2.19) 1 + ?2(xr) Note that im and j are a moving (function of r and ?) coordinate system (frame) form the ball. Furthermore, the ball is constrained by the beam to have acceleration in the im direction. Gravity is simply gj in the inertial frame and is the only force acting on the ball other than the constraint force imposed by the beam. Projecting gravity onto equation (2.17) yields ????? }?gj ? i? m (xr, ?) = g??(xr, ?) ?? } (2.20)gj ? j (xr, ?) = g??(x , ?)m r 16 in the im and j directions respectively in the inertial frame. Rewriting equation (2.14)m d2p r [i = x?r(cos(?)? ?(xr) sin(?)) dt2 + 2x?r??(? sin(?)? ?(x ) cos(?))? x? 2r r (?(xr) sin(?)) ? ??(xr sin(?) + fr(xr) cos(?)) ] ? [?? 2(xr cos(?)? fr(xr) sin(?)) + ru sin(?)??2 ? ru cos(?)?? i + x?r(sin(?) + ?(xr) cos(?)) + 2x?r??(cos(?)? ?(xr) sin(?)) (2.21) + x? 2r (?(xr) cos(?)) + ??(xr cos(?)? fr(xr) sin(?)) + ??2(?xr sin(?)? fr(xr) c]os(?)) ? ru cos(?)??2 ? ru sin(?)?? j := abeam 2 where ?(x ) = d frr dx2 .r 17 Projecting equation (2.21) onto equation (2.17) abea[m ? im(xr, ?) = ? x?r(cos(?)? ?(xr) sin(?)) + 2x?r??(? sin(?)? ?(xr) cos(?))? x? 2r (?(xr) sin(?)) ? ??(xr sin(?) + fr(xr) cos(?)) ] ? ??2[ (xr cos(?)? fr(xr) sin(?)) + ru sin(?)?? 2 ? ru cos(?)?? ?? (2.22) + x?r(sin(?) + ?(xr) cos(?)) + 2x?r??(cos(?)? ?(xr) sin(?)) + x? 2r (?(xr) cos(?)) + ??(xr cos(?)? fr(xr) sin(?)) + ??2(?xr sin(?)? fr(xr) c]os(?)) ? ru cos(?)??2 ? ru sin(?)?? ?? a[ beam ? j (x , ?) =m r x?r(cos(?)? ?(xr) sin(?)) + 2x?r??(? sin(?)? ?(xr) cos(?))? x? 2r (?(xr) sin(?)) ? ??(xr sin(?) + fr(xr) cos(?)) ] ? [?? 2(xr cos(?)? fr(xr) sin(?)) + r 2 (2.23)u sin(?)?? ? ru cos(?)?? ?? + x?r(sin(?) + ?(xr) cos(?)) + 2x?r??(cos(?)? ?(xr) sin(?)) + x? 2r (?(xr) cos(?)) + ??(xr cos(?)? fr(xr) sin(?)) + ??2(?xr sin(?)? fr(xr) c]os(?)) ? ru cos(?)??2 ? ru sin(?)?? ?? 18 Combining equations (2.20), (2.22) and (2.23) yields equations (2.24) and (2.25) which are the dynamics of the ball. ai =m [ g??? x?r(cos(?)? ?(xr) sin(?)) + 2x?r??(? sin(?)? ?(xr) cos(?))? x? 2r (?(xr) sin(?)) ? ??(xr sin(?) + fr(xr) cos(?)) ] ? 2[?? (xr cos(?)? fr(xr) sin(?)) + ru sin(?)?? 2 ? r cos(?)?? ?? (2.24)u + x?r(sin(?) + ?(xr) cos(?)) + 2x?r??(cos(?)? ?(xr) sin(?)) + x? 2r (?(xr) cos(?)) + ??(xr cos(?)? fr(xr) sin(?)) + ??2(?xr sin(?)? fr(xr) c]os(?)) ? ru cos(?)??2 ? ru sin(?)?? ?? 19 ma{j =m [ m g?? + x?r(cos(?)? ?(xr) sin(?)) + 2x?r??(? sin(?)? ?(x ) cos(?))? x? 2r r (?(xr) sin(?)) ? ??(xr sin(?) + fr(xr) cos(?)) ] ? ??2[ (xr cos(?)? fr(xr) sin(?)) + ru sin(?)?? 2 ? ru cos(?)?? ?? (2.25) + x?r(sin(?) + ?(xr) cos(?)) + 2x?r??(cos(?)? ?(xr) sin(?)) + x? 2r (?(xr) cos(?)) + ??(xr cos(?)? fr(xr) sin(?)) + ??2(?xr sin(?)? fr(xr) cos}(?))] ? ru cos(?)??2 ? ru sin(?)?? ?? + Fconstraint where Fconstraint is the force of constraint in the j direction.m Rewriting ai yieldsm 20 x?r = { 1 g?? ((c[os(?)? ?(xr) sin(?))?? ? (sin(?) + ?(xr) cos(?))??) ? 2x?r??(? sin(?)? ?(xr) cos(?))? x? 2r (?(xr) sin(?)) ? ??(xr sin(?) + fr(xr) cos(?)) ] ? [?? 2(x 2 (2.26)r cos(?)? fr(xr) sin(?)) + ru sin(?)?? ? ru cos(?)?? ?? + 2x?r??(cos(?)? ?(xr) sin(?)) + x? 2r (?(xr) cos(?)) + ??(xr cos(?)? fr(xr) sin(?)) + ??2(?xr sin(?)? fr(xr) co]s(?})) ? ru cos(?)??2j ? ru sin(?)?? ?? 2.1 Dimensionless Parameters To get dimensionless parameters for the ball, we used ru, Mb = the mass of the beam and ? = time as scale factors. In order to understand how to express the dynamics in di- mensionless time, first consider the general problem d f(x(t)). Using the chain rule yields: dt d df ? f(x(t)) = ?? dx ??? (2.27) dt dx x(t) dt t 21 and d2f(x(t)) d2f ??? (dx ??? )2 df ??? d2x??= + ? (2.28) dt2 dx2 x(t) dt t dx x(t) dt2 t Furthermore, scaling the time does not change the amplitude of a function of time. It does change the amplitude of the derivative. Letting f(t) equal ?(x(t)) where x(t) = t? = t? yields: d?(t?) d?(t?) dt? d?(t?) = (t) = ? (2.29) dt dt? dt dt? and d2?(t?) d2?(t?) = ? 2 (2.30) dt2 dt?2 Applying (2.30) to (2.1) without the input torque T , gives IB ?? = (Mbrug) sin(?)) (2.31) d2? 2 (t) = ? 2 d ? Mbrug t? (t?) = sin(?( )) (2.32) dt2 dt2 Ib ? where t? = ?t. In addition: Ib Dimesionless Inertia : = I? (2.33) M 2bru yr xr Dimensionless Lengths : y? = and x? = (2.34) ru ru 22 dy(t) 1 dy(t) dy?(t?) Dimensionless V elocities : = = ? dt ru dt dt? (2.35) dx(t) 1 dx(t) dx?(t?) and = = ? dt ru dt dt? d2y(t) 1 d2y(t) d2y?(t?) Dimensionless Acceleration : = = ? 2 dt2 ru dt2 dt?2 (2.36) d2x(t) 1 d2x(t) d2x?(t?) and = = ? 2 dt2 ru dt2 dt?2 1 Dimensionless Torque : T? = T (2.37) r2uMb g Dimensionless Gravity : g? = (2.38) ru Dimensionless Mass of the Beam : M?b = 1 (2.39) m Dimensionless Mass of the Ball : m? = (2.40) Mb ru Dimensionless Offset from the Axis of Rotation : ??= = 1 (2.41) ru Vin Dimensionless V oltage : V?in = (2.42) Vmax Rewriting equation (2.1) in terms of dimensionless parameters yields d2? g g? (t?) = sin(?(t?)) = sin(?(t?)) (2.43) dt?2 r I?? 2u I?? 2 ? ? Equation?(2.43) implies that the natural ?frequency? of the beam is g? or 1 g? . Choos-I? ??2 ? I? ing ? = g? makes this one. I? 23 Applying the method in (2.29) to ?(xr). df(xr) df(xr) | dx?r df(x?rru) 1 ?(rux?r)?(xr) = = x?rru = = (2.44)dxr dx?r dxr dx?r ru ru Applying the same idea to ?(xr), d2f(xr) d df(xr) dx?r d 1 df(rux?r) ?(xr) = = ( |x?rru ) = ( )dx2r dx dx?r dxr dx ru dx?r (2.45) d dx?r df(rux?r) 1 d 2f(rux?r) ?(rux?r) = ( ) = = dx?r dx dx? 2r ru dx? 2 2 r ru ? and ? do not depend on time explicitly. (2.44) and (2.45) are applied to equation (2.26), (2.25) and ??(xr) and ??(xr). Turning equation (2.26) into a dimensionless equation is done as follows: x?r? 2 {= 1 [ g?? (co(s(?)? ?(xr) sin(?))?? ? (sin(?) + ?(xr) cos(?)??) ? 2x?r? ???(? sin(?)? ?(x?r) cos(?))? x? 2r ? 2(?(xr) sin(?)) ? ??? 2(xr sin(?) + fr(xr) cos(?)) ) (2.46) ? ??2? 2( (xr cos(?)? fr(xr) sin(?)) + r 2 2 u sin(?)?? ? ? ru cos(?)??? 2 ?? 1 + 2x?r? ???(cos(?)? ?(xr) sin(?)) + x? 2? 2r ( ?(xr) cos(?)) ru + ??? 2(xr cos(?)? fr(xr) sin(?))) +]}?? 2? 2(?xr sin(?)? fr(xr) cos(?)) ? ru cos(?)??2? 2 ? ru sin(?)??? 2 ?? Equation (2.46) is in dimensionless time but is still has a dimension of length. If we divide 24 both sides of the equation by ru and handle all f(xr), ?(xr) and ?(xr) terms appropriately, this will give us a dimensionless equation (2.47) { 1 [ x??r = g???(x?r) (co(s(?(t?))? 1 ?(rux?r) sin(?(t?)))?? ? (sin(?(t?)) + 1 ?(rux?r) cos(?(t?))??)ru ru ? 1 12x??r??(t?)(? sin(?(t?))? ?(rux?r) cos(?(t?)))? x??2r( ?(x?r) sin(?(t?)))ru ru ? fr(x?rru)??(t?)(xr sin(?(t?)) + cos(?(t?))) ru ? 2 ? fr(x?rru) ) (??(t?) (x?r cos(?) sin(?(t?))) + ` sin(?(t?))??(t?) 2 ? ` cos(?(t?))??(t?) ?(??xr) ru 1 1 + 2x??r??(t?)(cos(?(t?))? ?(rux?r) sin(?(t?))) + x??2r( ?(x?r) cos(?(t?)))ru ru fr(x?rru) + ??(t?)(x?r cos(?(t?))? sin(?(t?))) ru f (x? r ) ) ]}r r u + ??(t?)2(?x?r sin(?(t?))? cos(?(t?)))? ` cos(?(t?))??(t?)2 ? ` sin(?(t?))??(t?) ?(??xr) ru (2.47) Similarly, converting equation (2.25) to a dimensionless quantity yields equation (2.48). 25 m Fc ={ y??r?Mb m [ 1 1 g??? + x??r[cos(?(t?))? ?(rux?r) sin(?(t?))] + 2x??r??(t?)[? sin(?(t?))? ?(rux?r) cos(?(t?))] Mb ru ru ? x??2 1 fr(x?rru)r[ ?(rux?r) sin(?(t?))]? ??(t?)[x?r sin(?) + cos(?(t?))]ru ru ? 2 ? fr(x? ] rru) [?? (t?)[x?r cos(?(t?)) sin(?(t?))] + ` sin(?(t?))?? 2(t?)? ` cos(?(t?))??(t?) ??(x?r) ru 1 1 + x??r[sin(?(t?)) + ?(rux?r) cos(?(t?))] + 2x??r??(t?)[cos(?(t?))? ?(rux?r) sin(?(t?))] ru ru ??2 1 fr(x?rru)+ xr[ ?(rux?r) cos(?(t?))] + ??(t?)[x?r cos(?(t?))? sin(?(t?))]ru ru ] } + ??2(t?)[? fr(x?rru)x?r sin(?(t?))? cos(?(t?))]? ` cos(?(t?))??2(t?)? ` sin(?(t?))??(t?)) ??(x?r) ru (2.48) The dimensionless equation for the beam and DC motor is: 2 K ? K 2 J??(t?)? = Vin(t?) Mbgrusin(?(t?))? ??(t?)? (2.49) Rm Rm Converting to dimensionless time and substituting in the appropriate dimensionless quan- tities from equations (2.33) though (2.42) results in 2 K K 2 J?Mbru??(t?)? 2 = V?in(t?)V 2 max ?Mbr g?sin(?(t?))? ??(t?)? (2.50) R um Rm . 26 Rearranging the terms in equation (2.50) and simplifying yields 1 KV K2max ??(t?) = ( V?in ? g?sin(?)? ???) (2.51) J?? 2 R 2mMbru R 2 mMbru 27 Chapter 3: Simulations 3.0.1 Simulink Model Simulink models were developed based on equations (2.47), (2.48) and (2.51) for catenary, parabolic and quartic beams. Dimensionless time was not used because the effects using a longer sampling interval were of interest. An example of the simulink models is shown in figure 3.1, 3.2 and 3,3. 28 Figure 3.1: Each block is labeled accordingly. The block ?Inverted Pendulum and Motor? contains the dynamics seen in equation (2.51) and is seen below in figure 3.2. The block named ?X-Dynamics of Ball - Rotating Frame? contains the x-dynamics of ball seen in equation (2.47) and is seen below in figure 3.3. The block named ?Y-Dynamics - Rotating Frame? contains the dynamics for the y position of the ball seen in equation (2.48). The block ?Transformation to Reference Frame? translates the position of the ball from the rotating frame to the reference frame. The blocks on the right are different scopes and outputs to the work space. Figure 3.2: The implementation of the inverted pendulum and motor. Integrators are used to get ?? and ?. A function block is used to implement equation (2.51). 29 Figure 3.3: The implementation of the x-dynamics of the ball. Integrators are used to get x?r and xr. A function block is used to implement the equations for x??r. The linear analysis tool is then used to generated a linearized model of the system around the operating point ???????? ?? ???? ? ???????? ?????0?? ? ?? ?? ??? ? ?? ??? ?????0?? XO = ????? ????? = ????? ? (3.1)????? xr ? ?????? ?????? 0?????? ????x?r 0 This linearized system is then exported to the matlab workspace which is first checked for controllability. If the linearized system is controllable, then the LQR function is used to generate a feedback gain vector K that will stabilize the system. The vector Gain is im- plemented with a gain block in the feedback loop as seen in figure 3.1. 30 3.0.2 The Different Beams The Catenary beam studied in this thesis is defined by xr y(xr) = ?5 cosh( ) + 5 + ru (3.2) 5 which is plotted below. The two parabolic beams were that were studied in this thesis are defined by Parabolic beam 1 : y(xr) = ?0.05x2 + ru (3.3) Parabolic beam 2 : y(xr) = ?0.5x2 + ru Two quartic beams were studied in this thesis. They are defined by Quartic beam 1 : y(xr) = ?0.05x4 + ru (3.4) Quartic beam 2 : y(xr) = ?0.5x4 + ru The flat bean studied in this thesis is defined by y = ru (3.5) Figure 3.4 shows all the beams plotted on one plot for comparison. 31 Figure 3.4: All the beams on one plot for comparison. 32 Chapter 4: Simulation Results and Analysis For all simulations, the inertia of the beam is aproximated by M L2b Ib = (4.1) 2 where L is the length of the beam. The ball stays on the beam when the force of constraint is negative and leaves the beam otherwise. For all systems, ??o = 0 and (x?r)o = 0 always. 4.0.1 Poles of All Systems with Different Shaped Beams This section contains all the poles for all the beams. Table 4.1: Poles For all Linearized Systems Beam Name Pole1 Pole2 Pole3 Pole4 Catenary Beam -0.0695 +11.0678i -0.0695 -11.0678i 6.2610 + 0i -6.2610 + 0i Parabolic Beam 1 -0.0695 +11.0678i -0.0695 -11.0678i 9.8995 + 0i -9.8995 + 0i Parabolic Beam 2 -0.0695 +11.0678i -0.0695 -11.0678i 31.3050 + 0i -31.3050 + 0i Quartic Beam 1 -0.0695 +11.0678i -0.0695 -11.0678i 0.0007 + 0i -0.0007 + 0i Quartic Beam 2 -0.0695 +11.0678i -0.0695 -11.0678i 0.0022 + 0i -0.0022 + 0i Flat Beam -0.0695 +11.0678i -0.0695 -11.0678i 0+0i 0+0i Note pole 3 and pole 4 are effectively zero for the quartic beams. 33 4.0.2 Testing Which Poles are Which For this section, only the catenary beam was studied. Linearization about the operat- ing point was changed to see how the poles changed. Operating point 1 is ???? ???? ???? ?? 0??? ?? 0 Operating Point 1 = ??? = (4.2)xr??? ???0??? x?r 0 This is the same as equation (3.1). The second operating point is ???? ???? ???? ?? 0 ??? ?? 0 Operating Point 2 = ??? ??? = ???? (4.3)xr 1??? x?r 0 The poles are as seen below: Table 4.2: Pole Comparison between Linearizing around Operating Points Operating point Pole1 Pole2 Pole3 Pole4 Operating Point 1 -0.0695 +11.0678i -0.0695 -11.0678i 6.2610 + 0i -6.2610 + 0i Operating Point 2 -0.0695 +11.0678i -0.0695 -11.0678i 7.1515 + 0i -7.1515 + 0i As seen in table 4.2, pole 3 and pole 4 are different between linearizing around the two operating points. Thus pole 3, pole 4 are for the ball. It is interesting that the ball has two poles that are equal and opposite. Thus pole 1 and 2 are the poles for the beam. Since they stay the same between the different beam shapes, the linear analysis tool is linearizing all the beams to the same shape. 34 4.0.3 Test of the Flat Beam This experiment was run to study how MATLAB linearizes the beams. If it linearizes all the beams to a flat beam at the operating point, then the gain for the system with a flat beam might work with all other beams, at least for very small initial conditions. Of course, the poles associated with the ball are both on the imaginary axis for the flat beam. They include one unstable pole for the curved beam. The results are as follows. R = 1 and the Q matrix used was ???? ?5 0 0 0 ??????0 300 0 0Q = ??? (4.4)0 0 10 0 0 0 0 300 This Q matrix was chosen because the gain matrix generated from this was be tested on all the other beam shapes. It has large weights on velocities so as to dampen out oscil- lations. After linearizing the system and using LQR with the Q above, the gain vector Gain = [195.3281 130.3552 -3.1623 -19.5646] was generated. Results for the Flat Beam are as follows: L = 20cm, ru = 5cm, m = 0.01kg, Mb = 0.1 kg, Km = 0.00768, Kg = 350, Vmax = 6 and Rm = 2.6 ohm. Table 4.3: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -0.0695 +11.0678i -0.0695 -11.0768i 0 + 0i 0 + 0i After LQR -0.9966 +11.0760i -0.9966 -11.0760i -0.1841 + 0i -1.3715 + 0i 35 Figure 4.1: Results for the flat beam defined by y(xr) = ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1cm. The gain vector Gain = [195.3281 130.3552 -3.1623 -19.5646]. Table 4.4: Range of (xr)o Beam Name Range for (xr)o Flat [-240,240] Table 4.4 indicates the range of (xr)o that could be stabilized. It should be -inf to inf but any (xr)o outside of the range in table 4.4 fails to stabilize. This gain vector was then tested with all the curved shaped beams to see what range of 36 (xr)o could be stabilized. Table 4.5: Test of Gain Vector from Flat Beam on the Other Nonlinear Systems Beam Name Range for (xr)o Catenary Beam 0 Parabolic Beam 1 0 Parabolic Beam 2 0 Quartic Beam 1 [-0.03,0.03] Quartic Beam 2 [-0.01,0.01] 37 Figure 4.2: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r5 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [195.3281 130.3552 -3.1623 -19.5646]. 38 Figure 4.3: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r . m =5 u 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.0000000000001. The gain vector Gain = [195.3281 130.3552 -3.1623 -19.5646]. 39 Figure 4.4: Results for the parabolic beam defined by y(xr) = ?0.5x2r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.0000000000001. The gain vector Gain = [195.3281 130.3552 -3.1623 -19.5646]. 40 Figure 4.5: Results for the parabolic beam defined by y(xr) = ?0.05x2r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.0000001. The gain vector Gain = [195.3281 130.3552 -3.1623 -19.5646]. As seen in figures 4.2 through 4.5, the gain vector from the flat beam doesn?t work for the catenary beam and the parabolic beams. This is not surprising given that the poles corresponding to the ball is well into the right hand plane. 41 4.0.4 Analyzing the Differently Curved Beams For all beam shapes, the values for the system are L = 20cm, ru = 5cm, m = 0.01kg, Mb = 0.1 kg, Km = 0.00768, Kg = 350, Vmax = 6 and Rm = 2.6 ohm. The beams were tested to see how they performed with LQR as the control method and a model for the motor in the controls laboratory. Each nonlinear system was linearized with the linear analysis tool around operating point 1, a gain vector was generated using LQR, and then the performance was analyzed. Catenary Beam The A and B matrix after linearization are: ???? ?0 1.0000 0 0 ??? ?122.5000 ?0.1389 0 0 A = ??? 0 0 0 1.0000?? (4.5)?318.5000 ?? ?0.1389 ?39.2000 0??? 0 ?? ? ? ??0.0517B = ??? (4.6)0 0.0517 R = 1 and Q is ????30 0 0 0 ???? ??? 0 300 0 0Q = 0 0 1 0 ??? (4.7) 0 0 0 300 This was chosen because there were a lot of oscillations when trying to stabilize the ball with smaller weights on the velocity terms. The open loop poles and the closed-loop poles after LQR are as follows. Table 4.6: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -0.0695 +11.0678i -0.0695 -11.0768i 6.2610 + 0.0000i -6.2610 + 0.0000i After LQR -0.9905 +11.0760i -0.9905 -11.0760i -5.8134 + 0.0000i -6.6799 + 0.0000i 42 LQR yields a gain of vector Gain = [3698.5 547.4 -1687.6 -270.1]. Figure 4.6 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?1 Figure 4.6: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r . m =5 u 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [3698.5 547.4 -1687.6 -270.1]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. 43 Table 4.7: Ranges for xr and ? that Are Stabilizable for The Catenary Beam Beam Name Range for ?o Range for (xr)o Catenary Beam [?1.14? ,1.14? ] [-3.50,3.50] 16 16 Parabolic Beam 2 The A and B matrix after linearization are: ???? ?0 1.0000 0 0 ?? ???? ? 122.5000 ?0.1389 0 0 A = ?? (4.8)0 0 0 1.0000 ?441.0000 ? ?0?.2779 9?80.0000 0??? 0 ??? ???0.0517B = 0 ??? (4.9) 0.1034 R = 1 and Q is ???? ???30 0 0 0 ? ??? 0 300 0 0Q = 0 0 1 0 ??? (4.10) 0 0 0 300 This was chosen because there were a lot of oscillations when trying to stabilize the ball with smaller weights on the velocity terms. The open loop poles and closed-loop poles after LQR are as follows. Table 4.8: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -0.0695 +11.0678i -0.0695 -11.0768i 31.3050+0.0000i -31.3050 + 0.0000i After LQR -0.4869 +11.0547i -0.4869 -11.0547i -32.037 + 0.0000i -30.6038 + 0.0000i LQR yields a gain of vector Gain = [-9611 -329 24358 778]. Figure 4.7 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?.5 44 Figure 4.7: Results for the parabolic beam defined by y(xr) = ?0.5x2r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?.5. The gain vector Gain = [-9611 -329 24358 778]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.9: Ranges for xr and ? that Are Stabilizable for Parabolic Beam 2 Beam Name Range for ?o Range for (xr)o Parabolic Beam 2 [?1.42? ,1.42? ] [-.86,.86] 8 8 45 Parabolic Beam 1 ???? ?0 1.0000 0 0 ?? ???? ? 122.5000 ?0.1389 0 0 A = ?? (4.11)0 0 0 1.0000 ?441.0000 ?? ?0.2779 ?98.0000 0??? 0 ?? ??? ? 0.0517 B = ??? (4.12)0 0.1034 The controllability matrix generated for this system using the controllability function ?ctrb? in matlab is [B AB A2B A3B] = ???? ?0 0.0516923076923077 ?0.0071825904852071 ?6.33130967898933?? ? ? ??0.0516923076923077 ?0.0071825904852071 ?6.33130967898933 1.759595995985270 0.103384615384615 ?0.0143651809704142 ?12.6626193585697??? 0.103384615384615 ?0.0143651809704142 ?12.6626193585697 3.51919199205267 (4.13) The error LQR returns is: ?The ?lqr? command failed to stabilize the plant or find an optimal feedback gain. To remedy this problem: 1. Make sure that all unstable poles of A are controllable through B (use MINREAL to check) 2. Modify the weights Q and R to make [Q N;N? R] positive definite (use EIG to check positivity).? With the choice of Q as in equation (4.7), R = 1, and N is a column vector of zeroes, [Q N; N? R] is positive definite. Thus the problem with the system must regard 1. Formatting in matlab was changed to ?long g? to see exactly what was going on since matlab with ?format short g? was not showing what was going on accurately. With 6 dec- imal places, it looked like the second row was half of the fourth row but the rank function was giving 4. The controllability matrix having a rank of 4 is contradicting what matlab was showing for the controllability matrix and the error LQR was reporting above. 46 The second row is essentially 1 the fourth row. Element by element division of the 2 fourth row divined by the second row yields { } 2 2 2.00000000009335 2.00000000004667 (4.14) Thus the row rank of this matrix is 3 which means this system is uncontrollable. This ex- plains why LQR is requesting the user to make sure all unstable poles of A are controllable though B using minreal. This also explains why minreal reduces the system down from four to two states. Only the poles for the beam are left after minreal and minreal will only do this to states are not controllable. The gain vector generated for Parabolic Beam 2 was tested and the range for (xr)o = 0. All other beams were rechecked after finding this with Parabolic Beam 1 to make sure they are indeed controllable. The Catenary Beam, Parabolic Beam 2, and the quartic beams are all controllable. If a new operating point is chosen to linearize at, the results are as follow. ???? ????? ???? 0 ??? ?? Operating Point 3 = ??? ??? = ? ? ?? 0? ??? (4.15)xr .2 x?r 0 The A and B matrix after linearization are: ???? ?0 1 0 0 ?? ???? ? 122.5000 ?0.1389 0 0 A = (4.16) 0 0 0 1.0000?? ?440.6378 ? ?0.2778 97.6477 0 47 ???? ??0 ? ???0.0517B = 0 ? ? ?? (4.17) 0.1033 R = 1 and Q is ????30 0 0 0? ? ??? ?? 0 300 0 0Q = 0 0 1 0 ??? (4.18) 0 0 0 300 This was chosen because there were a lot of oscillations when trying to stabilize the ball with smaller weights on the velocity terms. The open loop poles and closed-loop poles after LQR are as follows. Table 4.10: Open Loop Poles and Pole Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -0.0695 +11.0678i -0.0695 -11.0768i 9.8817+0.0000i -9.8817 + 0.0000i After LQR -1.0041 +11.0224i -1.0041 -11.0224i -9.8804 + 0.0000i -9.8828 + 0.0000i LQR yields a gain of vector Gain = [3177500 321500 -1587300 -160600]. Figure 4.8 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?0.0017 48 Figure 4.8: Results for the parabolic beam defined by y(xr) = ?0.05x2r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.0017. The gain vector Gain = [3177500 321500 -1587300 -160600]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.11: Ranges for xr and ? that Are Stabilizable for Parabolic Beam 1 Beam Name Range for ?o Range for (xr)o(cm) Parabolic Beam 1 [0] [-0.0017,0.0017] Testing ? = pio could not stabilize the ball so I decided to stop there since that is an512 49 extremely small theta. As seen in figure 4.8, the new operating point is controllable but has bad performance. Quartic Beam 1 The A and B matrix after linearization are: ???? ?0 1.0000 0 0 ?? ???? ? 122.5000 ?0.1389 0 0 A = (4.19) 0 0 0 1.0000 ? ? ? ? ? ?441.0000 ?0.2779 0.0000 0 ??? 0 ??? 0.0517 B = ??? ??? (4.20)0 0.1034 R = 1 and Q is ???? ???5 0 0 0? ???0 10 0 0Q = (4.21)0 0 1 0??? 0 0 0 10 This Q was chosen because there were not a lot of oscillations when trying to stabilize the ball. Increasing the weights on velocities causes a loss in performance which will be shown in a later section. The open loop poles and closed-loop poles after LQR are as follows. Table 4.12: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -0.0695 +11.0678i -0.0695 -11.0768i 0.0007+0.0000i -0.0007 + 0.0000i After LQR -0.3132 +11.0705i -0.3132 -11.0705i -0.2417+0.15555ii -0.2417 - 0.1555i LQR yields a gain of vector Gain = [12.4335 30.4954 -1 -5.8574]. Figure 4.9 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?0.02 50 Figure 4.9: Results for the quartic beam defined by y(x 4r) = ?0.05xr + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.02. The gain vector Gain = [12.4335 30.4954 -1 -5.8574]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.13: Ranges for xr and ? that Are Stabilizable for Quartic Beam 1 Beam Name Range for ?o Range for (xr)o Quartic Beam 1 [ ?? , ? ] [-0.020,0.020] 4303.6 4303.6 Quartic Beam 2 The A and B matrix after linearization are: 51 ???? ?0 1.0000 0 0 ?? ???? ? 122.5000 ?0.1389 0 0 A = ??? (4.22)0 0 0 1.0000?441.0000 ??0.2779 ?0.0000 0??? 0 ??? ???0.0517B = 0 ??? (4.23) 0.1034 R = 1 and Q is ???? ???5 0 0 0? ???0 10 0 0Q = (4.24)0 0 1 0??? 0 0 0 10 This Q was chosen because there were not a lot of oscillations when trying to stabilize the ball. Increasing the weights on velocities causes a loss in performance which will be shown in a later section. The open loop poles and closed-loop poles after LQR are as follows. Table 4.14: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -0.0695 +11.0678i -0.0695 -11.0768i 0.0022+0.0000i -0.0022 + 0.0000i After LQR -0.3132 +11.0705i -0.3132 -11.0705i -0.2417+0.1555ii -0.241-0.1555i LQR yields a gain of vector Gain = [12.4335 30.4958 -1.0001 -5,8575]. Figure 4.10 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?0.006 52 Figure 4.10: Results for the quartic beam defined by y(xr) = ?0.5x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.006. The gain vector Gain = [12.4335 30.4958 -1.0001 -5,8575]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.15: Ranges for xr and ? that Are Stabilizable for Quartic Beam 2 Beam Name Range for ?o Range for (xr)o Quartic Beam 2 [ ?? , ? ] [-0.0064,0.0064] 13659 13659 53 Overall Analysis Overall the ball has to start near the top of the beam to be stabilizable for all the beams. Note the slight differences seen in the poles in the quartic beams is expected and shows the linear analysis tool is linearizing the beams to a flat beam at operating point 1. I.e. the top of the beam. Parabolic beam 1 is uncontrollable at operating point 1. It is seen by the error mes- sage LQR returns to the user and if one looks at the controllability matrix. This is an odd case since it happens to be a case where the system is uncontrollable. As seen in figure 4.8, at the new operating point, the system is controllable. Of course, choosing a different Q will result in a different gain matrix from LQR which can potentially change the ranges of ? and xr. It would be of interest to see if a different control strategy would increase the starting ranges for ? and xr. 4.0.5 Effects of Changing Q This experiment studies the effects of changing Q on the performance of the con- troller for their respective systems. The results are as follows. Catenary Beam There are 3 Qs studied with the Catenary Beam. They are: ???? ?5 0 0 0??? ???0 10 0 0Qc1 = (4.25)0 0 1 0??? 0 0 0 10 54 ???? ?30 0 0 0 ?? ??? ? 0 100 0 0 Qc2 = (4.26)0 0 1 0 ? ? ??0 0 0 100??? ?30 0 0 0 ?? ??? ? 0 300 0 0 Qc3 = 0 0 1 0 ??? (4.27) 0 0 0 300 Qc1 was chosen since it has some weights on velocities to deal with any oscillations. Qc2 and Qc3 have increased weights on the velocity terms to study how they affect the control of the system. The results are as follows: Table 4.16: Closed-Loop Pole Comparison between Different Q Choices after LQR Q Pole1 Pole2 Pole3 Pole4 Qc1 -0.1936 +11.0680i -0.1936 -11.0680i -6.1814 +0i -6.3397 +0i Qc2 -0.5752 +11.0705i -0.5752 -11.0705i -6.0060 +0i -6.5063 +0i Qc3 -0.9966 +11.0760i -0.9966 -11.0760i -5.8136 + 0i -6.6797 + 0i Table 4.17: Gain Vectors Produced by LQR for Different Qs Q Gain Vector Qc1 [3198.6 500.6 -1587.6 -253.6] Qc2 [3455.1 522.9 -1634.9 -261.3] Qc3 [3698.3 547.4 -1687.6 -270.1] The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with different choices of Q are as follows. Table 4.18: Ranges for xr and ? that Are Stabilizable for The Catenary Beam with Different Qs Q Range for ?o Range for (xr)o Q [?1.15? ,1.15?c1 ] [-3.62,3.62]16 16 Q [?1.14? ,1.14?c2 ] [-3.56,3.56]16 16 Q [?1.14? ,1.14?c3 ] [-3.50,3.50]16 16 55 Figure 4.11: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + ru and5 Qc1 is used. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [3198.6 500.6 -1587.6 -253.6]. 56 Figure 4.12: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + ru and5 Qc2 is used. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [3455.1 522.9 -1634.9 -261.3]. 57 Figure 4.13: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r and5 u Qc3 is used. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [3698.5 57.4 -1687.6 -270.1]. As seen in the x position of the ball in figure 4.11, with a choice ofQc1, there are a lot of oscillations. As the weights on the velocity terms in Q are increased, these oscillations are suppressed as seen in figures 4.12 an 4.13. With a choice of Q3, the system stabilizes much faster than when Qc1 or Qc2 is used. There is an obvious performance gain between figure 4.11 and figures 4.12 and 4.13. The ball stabilizes much faster in about 5 seconds figure 4.12 and 4.13 compared to about 10 seconds in figure 4.11. 58 Between figures 4.11 though 4.13, there is not any obvious difference between the voltages into the motor besides slightly less oscillations in figure 4.13 than figures 4.11 and 4.12. As the weights on velocities increase, the ranges of ?o and (xr)o that are stabilizable shrink. There seems to be a trade off between these ranges and system performance. Parabolic Beam 2 There are 3 Qs studied with Parabolic Beam 2. They are: ???? ?5 0 0 0?? ?? ? ?0 10 0 0Qp1 = (4.28)0 0 1 0?? ??0 0 0 10??? ?30 0 0 0 ??? Qp2 = ? ??? 0 100 0 0 ??? (4.29)0 0 1 0 0 0 0 100 ??? ?30 0 0 0 ?? ?? ? ? 0 300 0 0Qp3 = 0 0 1 0 ??? (4.30) 0 0 0 300 Qp1 was chosen since it has some weights on velocities to deal with any oscillations. Qp2 and Qp3 have increased weights on the velocity terms to study how they affect the control of the system. The results are as follows: Table 4.19: Closed-Loop Pole Comparison between Different Q Choices after LQR Q Pole1 Pole2 Pole3 Pole4 Qp1 -0.1123 +11.6673i -0.1123 -11.6673i -31.4362 -31.1747 +0i Qp2 -0.2869 +11.0634i -0.2869 -11.0634i -31.7237 -30.8965 +0i Qp3 -0.4869 +11.0547i -0.4869 -11.0547i -32.0370 +0i -30.6038 + 0i 59 Table 4.20: Gain Vectors Produced by LQR for Different Qs Q Gain Vector Qp1 [-9509 -311 23849 762] Qp2 [-9557 -319 24086 769] Qp3 [-9611 -329 24358 778] The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with different choices of Q are as follows. Table 4.21: Ranges for xr and ? that Are Stabilizable for Parabolic Beam 2 with Different Qs Q Range for ?o Range for (xr)o Q [?1.38? ,1.38?p1 ] [-0.85,0.85]8 8 Q ?1.40?p2 [ ,1.40? ] [-0.85,0.85]8 8 Q [?1.42?p3 ,1.42? ] [-0.86,0.86]8 8 60 Figure 4.14: Results for the parabolic beam defined by y(xr) = ?0.5x2r+ ru and Qp1 used. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?.5. The gain vector Gain = [-9509 -311 23849 762]. 61 Figure 4.15: Results for the parabolic beam defined by y(xr) = ?0.5x2r + ru Qp2 used. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?.5. The gain vector Gain = [-9557 -319 24086 769]. 62 Figure 4.16: Results for the parabolic beam defined by y(xr) = ?0.5x2r + ru Qp3 used. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?.5. The gain vector Gain = [-9611 -329 24358 778]. Just as with the catenary beam, increasing the weights on the velocity terms dampens oscillations and causes the system to converge faster. In the x position of the ball in figure 4.16, one can see how little oscillations there are at 8 seconds compared to 8 seconds in figure 4.14. In all cases, it seems voltage in the motor is extremely high and there?s no obvious difference between the different Qs. But with this system, as the weights on the velocity terms increase, the ranges that are stabilizable for ?o and (xr)o increased. This 63 is opposite of what happens to the catenary beam. For this system, there is no trade off between these two. Quartic Beam 1 There are 2 Qs studied with Quartic Beam 1. They are: ???? ?5 0 0 0?? ??? ? 0 10 0 0 Qq1 = ??? (4.31)0 0 1 0? 0 0 0 10??? ?30 0 0 0 ??? ??? 0 100 0 0Qq2 = (4.32)0 0 1 0 ??? 0 0 0 100 Qq1 was chosen since it has some weights on the velocity terms to dampen out oscil- lations. Qq2 was chosen to study the effects of increasing weights on the velocity terms. Table 4.22: Closed-Loop Pole Comparison between Different Q Choices after LQR Q Pole1 Pole2 Pole3 Pole4 Qq1 -0.3132 +11.0705i -0.3132 -11.0705i -0.2417 +0.1555i -0.2417 -0.1555i Qq2 -0.9632 +11.0943i -0.9632 -11.0943i -0.8109 +0i -0.1008 +0i Table 4.23: Gain Vectors Produced by LQR for Different Qs Q Gain Vector Qq1 [12.4335 30.5954 -1 -5.8574] Qq2 [66.7982 74.5631 -1 -11.1742] The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with different choices of Q are as follows.. Table 4.24: Ranges for xr and ? that Are Stabilizable for Quartic Beam 1 with Different Qs Q Range for ?o Range for (xr)o Q ?? ?q1 [ , ] [-0.00073,0.00073]4303.6 4303.6 Q ?? ?q2 [ , ] [-0.00060,0.00060]5236 5236 64 Figure 4.17: Results for the quartic beam defined by y(xr) = ?0.05x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.02. The gain vector Gain = [12.4335 36.4954 -1 -5,8574]. 65 Figure 4.18: Results for the quartic beam defined by y(xr) = ?0.05x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.02. The gain vector Gain = [66.7982 74.5631 -1 -11.1742]. Increasing the weights on the velocity terms causes the system to perform worse in some regards. This can be seen in the xposition of the ball in figure 4.18. By 30 seconds, the ball hasn?t even gotten as close to 0 when compared to figure 4.17. Oddly enough, voltage into the motor is slightly less with a more aggressive Q. This is seen when comparing voltage between figure 4.18 and 4.17. Increasing the weights on the velocity terms also cause the stabilizable ranges for ?o and (xr)o to shrink as seen by table 4.24. 66 Quartic Beam 2 There are 3 Qs studied with Quartic Beam 2. They are: ???? ?5 0 0 0??? ???0 10 0 0QQ1 = (4.33)0 0 1 0???? 0 0 0 10??? ?30 0 0 0 ?? ??? 0 100 0 0QQ2 = 0 0 1 0 ? ? ?? (4.34)? 0 0 0 100??? ???30 0 0 0 ? ??? 0 300 0 0QQ3 = 0 0 1 0 ??? (4.35) 0 0 0 300 QQ1 was chosen since it has some weights on the velocity terms so as to damp out oscillations. QQ2 and QQ3 were chosen to study the effects of increasing weights on the velocity terms. Table 4.25: Closed-Loop Pole Comparison between Different Q Choices after LQR Q Pole1 Pole2 Pole3 Pole4 QQ1 -0.3132 +11.0705i -0.3132 -11.0705i -0.2417 +0.1555i -0.2417 -0.1555i QQ2 -0.9632 +11.0943i -0.9632 -11.0943i -0.8109 +0i -0.1007 +0i QQ2 -1.6493 +11.1428i -1.6493 -11.1428i -1.3819 +0i -0.0578 +0i Table 4.26: Gain Vectors Produced by LQR for Different Qs Q Gain Vector QQ1 [12.4338 30.4958 -1 -5.8575] QQ2 [66.7986 74.5633 -1.0001 -11.1743] QQ3 [180.2157 125.0892 -1.0001 -18.0561] The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with different choices of Q are as follows. 67 Table 4.27: Ranges for xr and ? that Are Stabilizable for Quartic Beam 2 with Different Qs Q Range for ?o Range for (xr)o Q [ ?Q1 , ? ] [-0.0064,0.0064]13659 13659 QQ2 [ ? , ? ] [-0.0063,0.0063]16535 16535 Q ? ?Q3 [ , ] [-0.0062,0.0062]18480 18480 Figure 4.19: Results for the quartic beam defined by y(xr) = ?0.5x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.006. The gain vector Gain = [12.4338 30.4958 -1 -5.8575]. 68 Figure 4.20: Results for the quartic beam defined by y(xr) = ?0.5x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.006. The gain vector Gain = [66.7986 74.5633 -1.0001 -11.1743]. 69 Figure 4.21: Results for the quartic beam defined by y(x ) = ?0.5x4r r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.006. The gain vector Gain = [180.2157 125.0892 -1.0001 -18.0561]. Again, increasing the weights on the velocity terms causes the system to perform worse. This can be seen in figure 4.19 through 4.21. In the same time frame, the ball takes longer and longer to get to 0 when the weights on velocity are increased. The maximum voltage into the motors between all three choices of Q are about the same but the voltage curves are different between figures 4.19, 4.20 and 4.21. As a more aggressive Q is used, the voltage into the motor is a higher value for longer. As with Quartic Beam 1, as a more aggressive Q is used, the range for stabilizable ?o 70 an (xr)o shrink ever so slightly as seen in table 4.27. 4.0.6 Effects of Changing the Gear Ratio For all beam shapes, the values for the system are L = 20cm, ru = 5cm, m = 0.01kg, Mb = 0.1 kg, Km = 0.00768, Kg = 3500, Vmax = 6 and Rm = 2.6 ohm. The gear ratio was increased to 3500 to investigate what effect this would have on the closed-loop system. Note that increasing the gear by a factor of ten would increase the damping ratio for the beam by a factor of 100 due to the back EMF in the motor. Catenary Beam R = 1 and Q is ???? ?30 0 0 0 ??? 0 300 0 0 Q = ??? ??? (4.36)0 0 1 0 0 0 0 300 This was chosen because there were a lot of oscillations when trying to stabilize the ball with smaller weights on the velocity terms. The open loop poles and the closed-loop poles using LQR are as follows. Table 4.28: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -6.9474 +8.6159i -6.9474 -8.6159i 6.2610 + 0.0000i -6.2610 + 0.0000i After LQR -11.0460 +8.9709i -11.0460 -8.9709i -2.3964 + 0.0000i ?9.8984 + 0.0000i LQR yields a gain of vector Gain = [1120.9 93.8 -319 -53.8]. Figure 4.22 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?1. 71 Figure 4.22: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r5 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 3500,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [1120.9 93.8 -319 -53.8]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.29: Ranges for xr and ? that Are Stabilizable for The Catenary Beam Beam Name Range for ?o Range for (xr)o (cm) Catenary Beam [?1.04? ,1.04? ] [-2.62,2.62] 16 16 72 Parabolic Beam 2 R = 1 and Q is ???? ??30 0 0 0 ? ??? ? 0 300 0 0 Q = 0 0 1 0 ??? (4.37) 0 0 0 300 This was chosen because there were a lot of oscillations when trying to stabilize the ball with smaller weights on the velocity terms. The open loop poles and closed-loop poles using LQR are as follows. Table 4.30: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -6.9474 +8.6159i -6.9474 -8.6159i 31.3050+0.0000i -31.3050 + 0.0000i After LQR -8.1358 +7.2652i -8.1358 -7.2652i -40.9107 + 0.0000i -24.6654 + 0.0000i LQR yields a gain of vector Gain = [-1182.8 -97.6 354.4 114.5]. Figure 4.23 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?.5cm 73 2 Figure 4.23: Results for the parabolic beam defined by y(x ) = ? xrr + r . m = 0.01kg,1.4142 u Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 3500,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?.5cm. The gain vector Gain = [-1182.8 -97.6 354.4 114.5]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.31: Ranges for xr and ? that Are Stabilizable for Parabolic Beam 2 Beam Name Range for ?o Range for (xr)o(cm) Parabolic Beam 2 [?1.83? ,1.83? ] [-1.18,1.18] 8 8 74 Quartic Beam 1 R = 1 and Q is ???? ?5 0 0 0??????0 10 0 0Q = (4.38)0 0 1 0??? 0 0 0 10 This Q was chosen because there were not a lot of oscillations when trying to stabilize the ball. Increasing the weights on velocities causes a loss in performance which will be shown in a later section. The open loop poles and closed-loop poles using LQR are as follows. Table 4.32: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -6.9474 +8.6159i -6.9474 -8.6159i 0.0007+0.0000i -0.0007 + 0.0000i After LQR -7.4008 +8.7758i -7.4008 -8.7758i -2.4131+0i -0.3186 - 0i LQR yields a gain of vector Gain = [99.66 14.3681 -1 -3.6654]. Figure 4.24 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?0.02cm. 75 4 Figure 4.24: Results for the quartic beam defined by y(xr) = ? xr + r . m = 0.01kg,2.1147 u Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 3500,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.02cm. The gain vector Gain = [99.66 14.3681 -1 -3.6654]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.33: Ranges for xr and ? that Are Stabilizable for Quartic Beam 1 Beam Name Range for ?o Range for (xr)o(cm) Quartic Beam 1 [ ?? , ? ] [-0.052,0.052] 3173.3 3173.3 76 Quartic Beam 2 R = 1 and Q is ???? ?5 0 0 0??????0 10 0 0Q = (4.39)0 0 1 0??? 0 0 0 10 This Q was chosen because there were not a lot of oscillations when trying to stabilize the ball. Increasing the weights on velocities causes a loss in performance which will be shown in a later section. The open loop poles and closed-loop poles using LQR are as follows. Table 4.34: Open Loop Poles and Closed-Loop Poles After LQR is Applied Pole1 Pole2 Pole3 Pole4 Open Loop -6.9474 +8.6159i -6.9474 -8.6159i 0.0022+0.0000i -0.0022 + 0.0000i After LQR -7.4005 +8.7758i -7.4005 -8.7758i -2.4131+0i -0.3186 - 0i LQR yields a gain of vector Gain = [99.66 14.3681 -1 -3.6654]. Figure 4.25 shows how the system performs when the beam starts at ?o = 0 and the ball starts at (xr)o = ?0.006cm. 77 4 Figure 4.25: Results for the quartic beam defined by y(xr) = ? xr + r . m = 0.01kg,1.1892 u Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 3500,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.006cm. The gain vector Gain =[99.66 14.3681 -1 -3.6654]. The maximum ranges of xr and ? for which the ball can be stabilized by means of the LQR with given weights are as follows. Table 4.35: Ranges for xr and ? that Are Stabilizable for Quartic Beam 2 Beam Name Range for ?o Range for (xr)o(cm) Quartic Beam 2 [ ?? , ? ] [-0.016,0.016] 10134 1.0134 78 Analysis First, the poles (pole 1 and pole 2) that represent the beam move when the gear ratio is changed. This is another confirmation of which poles represent what in the system. For the catenary beam and parabolic beam 2, the voltage into the motor is much less. There are also much fewer oscillations and the ball converges much faster. Theta doesn?t oscillate as much. The same thing is also observed in the plots (figure 4.24 and 4.25) for the quartic beams. Oddly enough, the range of stabilizable ? and xr decreased as gear ratio was in- creased for the catenary beam. The ranges of ? and xr increased for parabolic beam 2 and the quartic beams. xr increased quite drastically for quartic beam 2. The range went from [-0.0064,0.0064] to [-0.016,0.016]. This is still not a large range but it does show a stronger motor would be better. The results yield more evidence that adding some friction to the model would elimi- nate much of the osscilations and shows the catenary beam keeps being an oddity compared to the quartic and parabolic beams. 79 4.0.7 Test of Bound of Domain of Attraction A very simple nonlinear controller would be initially bang-bang. That is, start with the maximum possible voltage with the sign determined by the need to move in the direc- tion to, eventually, drive the ball towards the desired equilibrium point. Because the beams extended to infinity, there is no question of the ball eventually leaving the beam other than by having a positive force of constraint. Once the ball gets, in some sense that would need to be made precise, close enough to the equilibrium point, the control would need to switch. If it switches to the opposite extreme voltage, the ball may fly off the beam. Design of a feedback controller that would cause the ball to converge to the desired equilibrium point is challenging and beyond the scope of this thesis. However, the feasibility of such a controller can be tested by simply applying the first portion of the controller. Start with the maximum possible voltage and see what range of initial conditions of the ball can be prevented from rolling off to infinity. The following describes these tests. For the systems in this experiment, m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, and Rm = 2.6 ohm. Table 4.36: Minimum Voltage (V) Into the Motor to Get the Ball to x = 0 in the World Frame Beam Shape Voltage (V) Catenary -680V Parabolic 1 -300V Parabolic 2 -172V* Quartic 1 -32V Quartic 2 -7V* 80 *Quartic Beam 2 and Parabolic Beam 2 don?t work as well when the ball starts at -12.5cm compared to the other beams. Please see the following results. Catenary Beam For this beam, (xr)o = -12.5cm and ?o = 0. Successful voltage into the motor is -680V and unsuccessful is -290V. Figure 4.26: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + ru. m5 = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball start at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -680V. 81 Figure 4.27: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r5 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball start at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -670V. As seen in figure 4.26, when the ball reaches x = 0 in the world frame, it is slowing down and then goes back down. It would be feasible to ?catch? the ball in situations like this. 82 Parabolic 1 For this beam, (xr)o = -12.5cm and ?o = 0. Successful voltage into the motor is - 300V and unsuccessful is -290V. in this time frame. If the time frame is extended, the ball will get to zero for larger voltages. 2 Figure 4.28: Results for the parabolic beam defined by y(x ) = ? xrr + r . m = 0.01kg,4.4721 u Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -300V. 83 2 Figure 4.29: Results for the parabolic beam defined by y(xr) = ? xr + r4.4721 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -290V. 84 2 Figure 4.30: Results for the parabolic beam defined by y(x xrr) = ? + r4.4721 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -80V. As seen in figure 4.30, the ball does get to x = 0 in the world frame. No matter what voltage is used, the ball flys past zero. However, changing the voltage once the ball starts in the right direction would, almost certainly, fix this. 85 Parabolic 2 The initial position for the ball and beam is (xr)o = -5cm and ?o = 0. The results are as follows. x2Figure 4.31: Results for the parabolic beam defined by y(xr) = ? r + ru. m = 0.01kg,1.4142 Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?5cm. Constant voltage = -172V 86 2 Figure 4.32: Results for the parabolic beam defined by y(x xrr) = ? + r1.4142 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?5cm. Constant voltage = -170V 87 2 Figure 4.33: Results for the parabolic beam defined by y(xr) = ? xr + ru. m = 0.01kg,1.4142 Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?5cm. Constant voltage = -150V -170Vs and -150V dont get the ball to x=0 in the world frame. It is interesting to see a situation where the ball is too far away get to 0 within a reasonable rotation of the beam. 88 Quartic 1 For this beam, (xr)o = -12.5cm and ?o = 0. Successful voltage into the motor is -32V and unsuccessful is -22V. 4 Figure 4.34: Results for the quartic beam defined by y(xr) = ? xr + ru. m = 0.01kg,2.1147 Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -32V 89 4 Figure 4.35: Results for the quartic beam defined by y(xr) = ? xr + r2.1147 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?12.5cm. Constant voltage = -22V 90 Quartic 2 The initial position for the ball and beam is (xr)o = -5cm and ?o = 0. The results are as follows. 4 Figure 4.36: Results for the quartic beam defined by y(x ) = ? xrr + ru. m = 0.01kg,1.1892 Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?5cm. Constant voltage = -7V 91 4 Figure 4.37: Results for the quartic beam defined by y(xr) = ? xr + ru. m = 0.01kg,1.1892 Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?5cm. Constant voltage = -2V 92 4 Figure 4.38: Results for the quartic beam defined by y(xr) = ? xr + r . m = 0.01kg,1.1892 u Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam and ball starts at ?o = 0 and (xr)o = ?5cm. Constant voltage = -1V As seen in figure 4.38, -1V into the motor isn?t even able to get the ball towards x = 0. Overall Analysis It was seen with the Quartic Beam 2 and Parabolic Beam 2 that there are limits to how far one can start the ball away from x = 0cm and be able to still capture it. Figure 4.37 and 4.38 show there are limits to the domain of attraction if the motor 93 voltage is bounded. All the beams have this but it was the easier to show with the Quartic Beam 2 since the voltages are so small and close together. It is also seen that there are voltages where the ball can almost get to x = 0 in the world frame. A nonlinear stabilizing control should be easy to design in these cases. A stronger motor would also bring down some of these voltage values and the ball could reach x=0 in the world frame at a much smaller theta. There are several hard problems to solve before one can find an implementable non- linear control that would have a large domain of attraction. Specifically, the effects of non-zero initial velocity need to be addressed. Furthermore, slowing the beam and ball movement once the ball is going in the right direction has to be accomplished without causing the ball to leave the beam. It is a lot easier to create a ball launcher than it is to stabilize the ball and beam at the origin. 94 Chapter 5: Design of Physical System 5.0.1 Camera, Sampling Rate, and Delay of the Controller The pendulum angle can be easily, accurately and cheaply measured by an encoder or potentiometer. The angular velocity can be measured by means of a tachometer although the experience in the control laboratory is that intrinsic noise in the tachometer measure- ment causes it to be less useful than differentiating the angle and low-pass filtering the result. Thus, the camera is only needed to measure the position and, if the measurement is sufficiently noise-free, to estimate the ball velocity. Nowadays, cameras for use as sensors in a control system are available in a very wide range of capabilities, sizes and costs. The driving issues in choosing the camera are cost, resolution, repeatability and sampling rate. If we wish to mount the camera on the beam, then it?s weight becomes critical as well. Here, because it is something we can analyze by means of the simulation, we focus on the sample rate and delay. The ?zero-order hold? block is used to study the effects of sampling rate on the controller. Below is an example of how the ?zero-order hold? block is implemented in the model. 95 Figure 5.1: The ?zero-order hold? block is placed in the feedback loop and is labeled ?Sampling Time Difference?. I will only sample the it?s input at the desired setting. So if it?s set to .1, the block will sample it?s input and change it?s output to that every .1 seconds. The results for the different beams are as follows. 96 Catenary Beam Sampling time in the ?zero-order hold? block is set to .1 seconds. Figure 5.2: Results for the catenary beam defined by y(xr) = ?5 cosh(xr ) + 5 + r5 u. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?1. The gain vector Gain = [3698.5 547.4 -1687.6 -270.1]. 97 Parabolic Beam 2 Sampling time in the ?zero-order hold? block is set to .03 seconds. Figure 5.3: Results for the parabolic beam defined by y(xr) = ?0.5x2r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?.5. The gain vector Gain = [-9611 -329 24358 778]. 98 Quartic Beam 1 Sampling time in the ?zero-order hold? block is set to .1 seconds. Figure 5.4: Results for the quartic beam defined by y(xr) = ?0.05x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.02. The gain vector Gain = [12.4335 36.4954 -1 -5,8574]. 99 Quartic Beam 2 Sampling time in the ?zero-order hold? block is set to .1 seconds. Figure 5.5: Results for the quartic beam defined by y(xr) = ?0.5x4r + ru. m = 0.01kg, Mb = 0.1kg, ru = 5cm, L = 20cm, Km = 0.00768, Kg = 350,Vmax = 6, Rm = 2.6 ohm. The beam starts at ?o = 0 and (xr)o = ?0.02. The gain vector Gain = [12.4335 30.4958 -1.0001 -5,8575]. Analysis Across the board, performance is worse for increasing sampling interval of the con- troller but that was expected. It is a pleasant surprise that relatively slow sampling rates would not hurt the stabilizability. The catenary and quartic beams LQR-based controllers can function at 10 samples per seconds while the LQR-based controller for the parabolic 100 beam 2 cannot stabilize at that sampling time. A sample must be taken every 0.03 seconds in order for the controller to work for parabolic beam 2. 5.0.2 Possible Cameras and Processing Cards Table 5.1: Processing Cards Name Price NVIDIA Jetson Tx2 Module $451.10 NVIDIA Jetson Tx2 4GB $299 NVIDIA Jetson AGX Xavier $899 NVIDIA Jetson Nano Starting at $59 Potentially building a desktop that can handle the processing power would be better than buying a modular card like these. Xavier is an updated version of Tx2 and is much faster but costs more of course. The Jetson Nano could be an option. It starting price is at $59 dollars for the 2gb developer kit. There?s a different kit with the Nano that starts at $100 dollars. It is geared towards students from my understanding so this could be a good card to use if it has the power needed to cut costs down for the experiment. There is a Jetson Tx2 Module already in the lab. Table 5.2: Cameras Manufacturers FPS Range Max Resolution View Angle Model Number Price ELP 30-120fps 1920(H)x1080(V) 180 ELP-USBFHD01M-L180 $45 Firsting 30fps 1920(H)x1080(V) 90 NA $19.99 ELP 20-30fps 3264(H)x2448(V) 75 ELP-USB8MP02G-L75 $59.99 There is a ELP-USBFHD01M-L180 in the lab already. For what we need, there is a plethora of cameras to choose from. Camera Resolution Camera resolution depends on the price of the camera and the distance of the image from the center of the cameras views. However, blurring?as would occur towards the edges 101 of the images of an inexperience camera?might not cause a significant degradation in the estimate of the position of the center of the ball. We leave further analysis of this problem for future study. 5.0.3 Delay Analysis The delay the systems can handle is of interest because converting an image to a (x,y) coordinate of the ball will always take some amount of time. It is of importance to find out how much time it takes based on the equipment used in the system and how much delay our system can handle in xr and x?r. If it takes too long to convert an image to a (x,y) coordinate of the ball, cameras can?t be used to track the ball successfully. Delay Tolerances in Simulink Models A transport delay block is used to simulate a signal taking time to be converted from an image to a (x,y) coordinate. These are put on the xr and x?r lines in the simulink model as seen below: Figure 5.6: Example of a Simulink Model with transport delay blocks on the xr and x?r lines. 102 Table 5.3: Maximum Delays in xr and x?r for Different Systems Beam Shape Delay (s) Catenary 0.01 Parabolic 2 0.01 Quartic 1 2.4 Quartic 2 2.4 Quartic beams make sense since the ball starts so close to the top of the beam already but are so large that they are unrealistic for any real version of the system. The delay in the catenary and parabolic beam 2 might be an issue since Jetson TX2 has a 1400 Megapixel/s ISP that works with partnered camera modules. Predicting Delay Predicting the time it takes to convert an image to an (x,y) coordinate for the ball is extremely difficult since there are so many variables involved. Concerning the camera, there are two ways that an image can be taken. If a USB cam- era is used, then USB 3.0 ports add about 125?s ?13?s delay to any signal going though one. Any usb camera itself will add some delay based on how long it takes to convert an image into data and the length of the wire will also add some delay which may or may not be said on the spec sheet. I could not find anything on the time the Firsting webcam take to convert and image to data. As stated earlier, a partner camera could be paired with a jetson card. If this is done, there is an ISP on the jetson card itself. For example, the TX2 can process 1400 megapixels/s. The hardware in the computer will also add delay and predicting these are very hard. It is known hardware has some variance to the spec sheet they come with but a general idea obtained. Due to covid-19, I do not have access to the lab at the moment and cannot look at what hardware are in the computers in the controls lab. 103 I believe delay due to the length of a wire is almost negligible. A CAT5e cable has the propagation delay of 4.8-5.3ns/m [7]. This is essentially nothing but worth remembering wires do add delay. It is advised to figure out this delay time experimentally. In order to calculate this delay time accurately, the best way is to build the system with chosen hardware and run an experiment to determine the total delay for that specific set up. 5.0.4 A Note on 3d Printing When modeling beams on Solidworks, I attempted to see if I could model materials used by 3d printers to calculate the moment of inertia and the center of gravity. I discovered anything printed by 3d printers are nonhomogeneous and the best way to find these out would be experimentally. Solidworks had no model for the materials used in 3D printers that I could find. 104 Chapter 6: Conclusions and Suggestions for Further Research It is obvious a stronger motor is needed for this experiment. It is also clear that LQR- based controls result in very limited domains of attraction. A linear control similar to the one in Sheng et al. would do a little better but the domain would still be small. It is surpris- ing that we could not find an LQR-based control that would be equivalent to, or better than Sheng et al. classical controller. One nonlinear control scheme that would be interesting to investigate would be based on Model Predictive Control. The idea would be first to linearize the system at the current state. Second, design a LQ controller to drive the current state toward the zero state. The result would be a time-varying gain. Implement this gain; go one step; then redo the design of the LQ control. Another approach would be to design a nonlinear feedback controller for the beam that ignores the ball. The idea would be to get a nice, well-behaved, controlled beam. Then design an outer loop nonlinear controller for the ball using the beam angle as the control signal. This desired beam angle would then be input into the beam controller. It would be interesting to investigate the effects of friction on these systems. The assumption that there is zero friction makes ignoring the revolution of the ball valid. With- out friction, the ball will not rotate. Adding friction would make the controlled systems oscillate a little less as demonstrated by the changed gear ratio test. But the real interest 105 would be the effect on the rotation of the ball. This would store more energy in the ball and complicate the control. It would also add another, difficult to observe, state to the system. Furthermore, because whether the ball rotates or slides would depend on the constraint force. This study would be best preceded by solution of the simpler problems. Another relatively easy series of experiments to perform would be to vary ru. This would have the effect of varying the beam poles. It would also be very desirable to, as was originally planned, create a physical imple- mentation of this experiment. 106 Bibliography [1] Sheng J, Renner J, Levine WS. A ball and curved offset beam experiment. InProceed- ings of the 2010 American Control Conference 2010 Jun 30 (pp. 402-408). IEEE. [2] Wellstead, P. E. and co-workers (1978). Ball and beam experiment. Int. J. Elect. Engng Educ., 15, 21. [3] Wellstead, Peter E. Introduction to physical system modelling. Vol. 4. London: Aca- demic Press, 1979. [4] Astrom KJ, Lundh M. Lund control program combines theory with hands-on experi- ence. IEEE Control Systems Magazine. 1992 Jun;12(3):22-30. [5] Aoustin Y, Formal?skii AM. Beam-and-ball system under limited control: Stabilization with large basin of attraction. In2009 American Control Conference 2009 Jun 10 (pp. 555-560). IEEE. [6] Chang YH, Chan WS, Chang CW. TS fuzzy model-based adaptive dynamic surface control for ball and beam system. IEEE transactions on industrial electronics. 2012 Apr 3;60(6):2251-63. [7] Category 5 cable [Internet]. Wikipedia. Wikimedia Foundation; 2020 [cited 2020Nov23]. Available from: https://en.wikipedia.org/wiki/Category 5 cable [8] Rotating reference frame [Internet]. Wikipedia. Wikimedia Foundation; 2020 [cited 2020Nov23]. Available from: https://en.wikipedia.org/wiki/Rotating reference frame 107