47 CHAPTER 3 LQR BASED PID TUNING FOR TRAJECTORY TRACKING OF MAGNETIC LEVITATION SYSTEM 3.1 INTRODUCTION Magnetic levitation systems have received wide attention recently because of their practical importance in many engineering systems such as high-speed maglev passenger trains, frictionless bearings, levitation of wind tunnel models, vibration isolation of sensitive machinery, levitation of molten metal in induction furnaces, and levitation of metal slabs during manufacturing (Almuthari & Zribi 2004). Magnetic levitation (maglev) technology reduces the physical contact between moving and stationary parts and in turn eliminates the friction problem. However, Maglev systems are inherently nonlinear, unstable and are described by highly nonlinear differential equations which present additional difficulties in controlling these systems (Hajjaji & Ouladsine 2001). So the design of feedback controller for regulating the position of the levitated object is always a challenging task. In recent years, many methods have been reported in the literature for controlling magnetic levitation systems. The feedback linearization technique has been used to design control laws for magnetic levitation systems (Barie & Chaisson 1996). The input-output, input-state, and exact linearization techniques have been used to develop nonlinear controllers (Charara et al 1996). The current control scheme was employed for the control purpose instead of the conventional voltage control by Oliveira et al (1999). Control
48 laws based on the gain scheduling approach (Kimand & Kim 1994), linear controller design (Rifai & Youcef 1998), and neural network techniques (Lairi & Bloch 1999) have also been used to control magnetic levitation systems. Classical optimal control theory has evolved over decades to formulate the well known LQR, which minimizes the excursion in state trajectories of a system while maintaining minimum controller effort. This typical behavior of LQR has motivated control designers to use it for the tuning of PID controllers (Das et al 2013). PID controllers are most common in process industries due to its simplicity, ease of implementation and design problem reduces to the ARE which is solved to calculate the state feedback gains for a chosen set of weighting matrices. These weighting matrices regulate the penalties on the deviation in the trajectories of the state variables (x) and control signal (u). Indeed, with an arbitrary choice of weighting matrices, the classical state-feedback optimal regulators seldom show good set-point tracking performance due to the absence of integral term unlike the PID controllers. Thus, combining the tuning philosophy of PID controllers with the concept of LQR allows the designer to enjoy both optimal set-point tracking and optimal cost of control within the same design framework. The objective of this work is to present a PID controller tuning approach via LQR based on dominant pole placement method. PID tuning based on LQR method is tested on a benchmark magnetic levitation system for trajectory tracking application, and the performance of the controller in tracking the reference trajectory is assessed using various test signals. 3.2 MAGNETIC LEVITATION SYSTEM MODEL Magnetic levitation systems are electromechanical devices which suspend ferromagnetic materials using electromagnetism. The schematic
49 diagram of the magnetic levitation system is shown in Figure 3.1. A steel ball in a magnetic levitation system is levitated in mid air by controlling the current applied to the coils. The maglev system consists of an electromagnet, a steel ball, a ball post, and a ball position sensor. Figure 3.1 Magnetic levitation system diagram Figure 3.2 Block diagram of closed loop magnetic levitation system Figure 3.2 illustrates the overall block diagram of magnetic levitation system. The entire system is encased in a rectangular enclosure which contains three distinct sections. The upper section contains an electromagnet, made of a solenoid coil with a steel core. The middle section consists of a chamber where the ball suspension takes place. One of the electro magnet poles faces the top of a black post upon which a one inch steel
50 ball rests. A photo sensitive sensor embedded in the post measures the ball elevation from the post. The last section of maglev system houses the signal conditioning circuitry needed for light intensity position sensor. The entire system is decomposed into two subsystems, namely, mechanical subsystem and electrical subsystem. The various parameters of magnetic levitation system are given in Table 3.1. The coil current is adjusted to control the ball position in the mechanical system, where as the coil voltage is varied to control the coil current in an electrical system. Thus, the voltage applied to the electromagnet indirectly controls the ball position. In the following section, the nonlinear mathematical model of the maglev system is obtained and linearized around the operating region in order to design a stabilizing controller. Table 3.1 Magnetic levitation system parameters Symbol Description Value L c Coil inductance 412.5mH Coil resistance R c N c Number of turns in the coil wire 2450 l c Coil length 0.0825m r c Coil steel core radius 0.008m R s Current sense resistance K m Electromagnet force constant 6.5308E-005 r b Steel ball radius 1.27E-002 m M b Steel ball mass 0.068kg K b Ball position sensor sensitivity 2.83E-003 m/v g Gravitational constant 9.81 m/s 2
51 3.3 MATHEMATICAL MODEL OF MAGLEV SYSTEM Figure 3.3 Schematic of the maglev plant the electrical circuit shown in Figure 3.3 d Vc ( Rc Rs ) Ic L Ic dt (3.1) The transfer function of the circuit can be obtained by applying Laplace transform to Equation (3.1) G c ( s) Ic( s) Kc Vc ( s) cs 1 (3.2) where 1 K c Rc Rs and Lc c Rc Rs
52 3.3.1 Equation of Motion of a Ball The force applied on the ball due to gravity can be expressed by Fg M g b (3.3) Force generated by the electromagnet is given by 1 K I2 F m c c 2 x2 b (3.4) The total force experienced by the ball is the sum of F g and F c 1 K I2 F m c c F g M g 2 x2 b b (3.5) can be obtained as d 2 x 1 2 b K m I c g dt 2 2 M x2 b b (3.6) At equilibrium point, all the time derivative terms are set to zero. 1 K 2 mic g 0 2 M x2 b b (3.7) From Equation (3.7), the coil current at equilibrium position, I c0, can be expressed as a function of x b and K 0 m.
53 I 2Mbg c0 x Km b0 (3.8) The electromagnet force constant, K m, as a function of the nominal pair ( xb0, I c0), can be obtained from Equation (3.7). 2M gx 2 K b b0 m I 2 c 0 (3.9) The nominal coil current I c0 for the electromagnet ball pair can be obtained at the static equilibrium point of the system. The static equilibrium at a nominal operating point ( xb0, Ic0) is characterized by the ball being x suspended in air at a stationary point b 0 due to a constant attractive force created by I c0. 3.3.2 Linearization of EOM In order to design a linear controller, the system must be linearized around equilibrium point where the suspension of ball takes place. The nonlinear system equations are linearized around the operating point using Equation (3.6), ( x, I ) to b0 c0 d 2 x 2 2 1 1 K I K I x b m c0 m 0 b1 K I 0I g c m c c1 dt 2 2 M 2 3 2 bx M x M x b0 b b0 b b 0 (3.10) Substituting Equation (3.9) into Equation (3.10) d 2 x b1 2gxb1 2gIc1 dt 2 xb0 Ic0 (3.11)
54 Applying Laplace transform to Equation (3.11) G ( s) b 2 Kb b s2 2 b (3.12) where K xb0 b I c 0 and 2g b xb 0 The open loop transfer function of a maglev system is a type zero, second order system. The two open loop poles of the system are located at s. Location of pole on the right half of the s-plane proves that the open b loop system is unstable in nature. Thus, the feedback controller is necessary for stabilizing the system. In this work, a PID controller combined with the feed forward component is designed to not only levitate the ball but also to make the ball follow the reference trajectory. 3.4 PID PLUS FEED FORWARD CONTROLLER DESIGN The objective of the control strategy is to regulate and track the ball position in mid-air. The control scheme should regulate the ball in such a way that in response to a desired 1mm square wave position set point, the ball position response should satisfy the following performance requirements. 1. Percentage overshoot 15% 2. Settling time 1s The proposed control scheme, as shown in Figure 3.4, consists of a PID controller with a feed forward component. The gain of the feed forward controller is determined based on the equilibrium point at which the ball
55 suspends in mid air. Three separate gains are used in PID controller design, which introduces two zeros and a pole at origin so that the entire system becomes a Type 1 system, allowing for zero steady state error. The objective of the feed forward control action is to compensate for the gravitational bias. When the PID controller compensates for dynamic disturbances around the linear operating point ( x, I c0 ), the feed forward control action eliminates the b0 changes in the force created due to gravitational bias. Figure 3.4 PID plus Feed forward control loop for ball position control The dynamics of the electromagnet is taken into account while obtaining the following open loop transfer function Gm ( s ), which relates the output variable (ball position) and the input variable (coil current). 2g x ( ) ( ) b s I G c0 m s Ic ( s) des 2 2g s xb0 (3.13) The current feed forward action is represented by I c _ ff K ff x b _ des (3.14)
56 and Ic I I c1 c_ ff (3.15) gain is given by At equilibrium point, x x b b0 and Ic I c 0. Thus, the feed forward I K c 0 ff x b 0 (3.16) The closed loop transfer function of the system is Gc ( s) x ( s) 2 g(( K K ) s K ) b ff p i x ( s) bdes 3 2gK 2 2g 2gK p 2gK I ( s d s s i ) c0 I x I I c0 b 0 c0 c0 (3.17) The normalized characteristic equation of electromechanical system is 3 2gK 2 2g 2gK p 2gK s d s s i 0 I x I I c0 b 0 c0 c0 (3.18) 3.5 LQR BASED PID TUNING Figure 3.5 LQR based PID tuning of second order magnetic levitation system
57 LQR design technique is well known in modern optimal control theory and has been widely used in many applications (Lewis & Syrmos 1995). It has a very nice stability and robustness properties. If the process is of single-input and single-output, then system controlled by LQR has a minimum phase margin of 60 o and an infinite gain margin, and this attractive property appeals to the practicing engineers. Thus, the LQR theory has received considerable attention since 1950s. Optimal control theory has been extended to PID tuning in the recent years. Saha et al (2012) have proposed a methodology for tuning PID controller via LQR for both over-damped and critically damped second order systems. They also suggested that one of the real poles can be cancelled out by placing one controller zero at the same position on the negative real axis in complex s-plane. So, the second order system which is to be controlled with a PID controller can be reduced to a first order system to be controlled by a PI controller. However, this approach is not valid for lightly damped processes because a single complex pole of the system cannot be removed with a single complex zero of controller, as they are in conjugate pairs. To address this issue, Das et al (2013) have given a formulation for tuning the PID controller gains via LQR approach with guaranteed pole placement. In this work, the idea has been extended to a magnetic levitation system which has two control schemes such as PID controller and feed forward controller. In this approach, the error, error rate and integral of error are chosen as state variables to obtain the optimal gains of the PID controller. Let the state variables be x 1 ( t) e( t) dt x 2 ( t) e( t) 3( ) d x t e ( t dt ) (3.19) From Figure 3.5, Y( s) K E( s) U( s) 2 2 o o n ( o 2 n ) U( s) s s (3.20)
58 In the state feedback regulator design, the external set point does not affect the controller design, so the reference input is zero (r(t)=0) in Figure 3.5. When there is no change in the set point, the relation y(t)=-e(t) is valid for standard regulator problem. Thus, Equation (3.20) becomes, s2 2 o o ( o) 2 ns n E( s) KU ( s) (3.21) Applying inverse Laplace transform, o o o 2 e 2 ne ( n ) e Ku (3.22) Thus the state space representation of the above system is of the form x1 0 1 0 x1 0 x2 0 0 1 x2 0 u x3 0 ( o 2 n ) ( 2 o o n ) x3 K (3.23) From Equation (3.23), the system matrices are A 0 1 0 0 0 1 0 ( o 2 n ) ( 2 o o n ) B 0 0 K (3.24) The following quadratic cost function which weighs both control input and state vector is minimized to obtain the optimal gains. J x ( t) Qx( t) u ( t) Ru( t) dt 0 T T (3.25) The minimization of above cost function gives the optimal control input as 1 T u( t) R B Px( t) Fx( t ) (3.26)
59 where 1 T F R B P and P is the symmetric positive definite solution of the following Continuous Algebraic Riccatti Equation (CARE). T 1 T A P PA PBR B P Q 0 (3.27) The weighting matrix Q is a symmetric positive definite and the weighting factor R is a positive constant. In general, the weighting matrix Q is varied, keeping R fixed, to obtain optimal control signal from the linear quadratic regulator. The corresponding state feedback gain matrix is P11 P12 P13 1 T 1 1 F R B P R 0 0 K P12 P22 P23 R K P 13 P 23 P 33 Ki K p K d P13 P23 P33 (3.28) The corresponding expression for the control signal is x 1 ( t) d u( t) Fx( t) Ki K p K d x 2 ( t ) Ki e( t) dt K pe( t ) K d e( t) dt x 3 ( t) (3.29) The third row of symmetric positive definite matrix P can be obtained in terms of PID controller gains as K P13 1 i R K K p P 23 1 R K K P d 33 1 R K (3.30) The closed loop system matrix for the system given in Equation (3.24) with state feedback gain matrix represented using Equation (3.28) is Ac 0 1 0 0 0 1 ( 1 2 R K P13) (( o 2 n ) 1 2 R K P23) ( 2 o o n 1 2 R K P33) (3.31)
60 The corresponding characteristic polynomial for the closed loop system is ( s) si A c 0 3 2 o o 1 2 o 2 1 2 1 2 s s (2 n R K P33 ) s(( n ) R K P23 ) R K P13 0 (3.32) The characteristic polynomial of closed loop system in terms of the desired damping ratio and natural frequency is given by, 3 2 c c c 2 c 2 c 2 c c 3 ( s s (2 m) n s(( n ) 2 m( ) ( n ) ) m ( n) ) 0 (3.33) On equating the coefficients of Equation (3.32) with Equation (3.33), (2 o o 1 2 c c n R K P 33 ) (2 m) n ( o 2 1 2 c 2 c 2 c 2 n ) R K P23 ) ( n ) 2 m( ) ( n) 1 2 R K P13 m( c 2 ) ( c 3 n ) (3.34) The elements of the third row of matrix P are determined by o o knowing the open loop process characteristics (, n, K ) and desired closed c c loop dynamics (, n, K ). c 2 c 3 m( ) ( ) P n 13 1 2 R K c 2 c 2 c 2 o 2 ( n ) 2 m( ) ( ) ( ) P n n 23 1 2 R K c c o o (2 m) n 2 P n 33 1 2 R K (3.35) by solving the ARE given in Equation (3.27). With the known third row elements of P matrix the other elements of P and Q matrices can be obtained as follows.
61 o 2 1 2 P11 ( n ) P13 R K P13 P23 o o 1 2 P12 2 n P13 R K P13 P23 o o 1 2 o 2 P 22 2 n P 23 R K P 23 P 33 ( n ) P 33 P 13 (3.36) 1 2 2 Q 1 R K P 13 1 2 2 o 2 Q 2 R K P 23 2( P 12 ( n ) P 23 ) 1 2 2 o o Q3 R K P33 2( P23 2 n P33 ) (3.37) 3.5.1 Design Steps o o Step 1: Specify both the open loop characteristics (, n, K ) and the c c desired closed loop system dynamics (, n, K ). Step 2: Choose the weighting factor R in LQR and determine the weighting matrix Q using Equation (3.37). Step 3: Obtain the transformation matrix P, solution of ARE, using Equation (3.35) and Equation (3.36). Step 4: Calculate the system matrices A and B as specified in Equation (3.24) Step 5: Determine the solution of state feedback control using Equation (3.28) and obtain the PID controller gains. 3.6 SIMULATION RESULTS Numerical simulations are carried out to evaluate the performance of the proposed LQR based PID tuning for magnetic levitation system using
62 MATLAB. The simulink block diagram of the overall closed loop system is shown in Figure 3.6. The open loop parameters of magnetic levitation system o are found to be K=7, n 1.8, and the desired parameters of the closed loop system which satisfy the controller specification given in section 3.4 are c 0.8 c, n 1.4, and m=9. Based on the closed loop requirements of the system given in terms damping ratio and natural frequency, the gains of the PID controller are determined using the LQR weighting matrices approach as presented in the above section. The corresponding system matrices are found to be 0 1 0 0 A 0 0 1 0 3.24 0 B 0 7 The resultant state feedback gain matrix obtained by solving the ARE is F 65.8 28.14 5.03 K i K p K d At the beginning of the simulation, the magnetic ball started in a certain arbitrary position and was controlled to track the desired trajectory. Figure 3.7 shows the simulation result of a set point change of the position from 6mm to 8mm, and it is observed that the ball position response has a settling time of 0.8s and an overshoot of 7%, which suggest that the design requirement of the system are met with the above controller gains.
63 Figure 3.6 Simulink block diagram of PID plus feed forward controller Figure 3.7 Simulated ball position response 3.7 EXPERIMENTAL RESULTS The experimental set up, as shown in Figure 3.8, consists of a control algorithm is realized in the PC using the real time algorithm, QUARC, which is similar to C like language. The sampling interval is chosen to be 0.002s, and in order to attenuate the high frequency noise current which
64 increaes the oscillation in steel ball beyond the 6mm range, a low pass filter of cut off frequency 80Hz is added to the ball position sensor output. Furthermore, by differentiating the ball position, the ball vertical velocity is estimated. Figure 3.8 Snap shot of magnetic levitation experimental set up 3.7.1 Trajectory Tracking Three signals namely square, sine and saw-tooth signals with a frequency of 1 Hz is chosen as reference signals to test the trajectory tracking performance of the controller. Figure 3.9, 3.10, and 3.11 show the results for trajectory following. Figure 3.12 shows the response of coil current, which tracks the specified command to make the ball follow the reference trajectory. Figure 3.13 depicts the coil input voltage V(t), and it can be observed that the amount of voltage supplied to the coil is comparatively high at the beginning because of the unstable nature of the system, and it is worth to note that the coil voltage is restricted to 8V during the stabilization phase. Figure 3.14 shows the tracking error, which is the difference between actual trajectory and reference trajectory. The performance indices namely IAE, ITAE, ISE and ITSE are considered to evaluate the performance of the controller, and they
65 are given in Table 3.2. Reduced tracking error suggests that the position of the magnetically levitated ball quite accurately tracks the desired trajectory. Figure 3.9 Square wave trajectory Figure 3.10 Sine wave trajectory
66 Figure 3.11 Saw tooth trajectory Figure 3.12 Coil current response
67 Figure 3.13 Coil voltage response Figure 3.14 Trajectory tracking error
68 Table 3.2 Performance indices of LQR based PID tuning method IAE ITAE ISE ITSE 0.0041 0.1252 0.000017 0.000015 3.8 CONCLUSION A combined design approach of PID tuning with LQR has been applied for a trajectory tracking application of magnetic levitation system. Conventional PID controller design has been formulated as a LQR problem for the control of second order oscillatory system. For levitating the ball, the conventional PID controller is combined with the feed forward controller in order to nullify the effect of gravitational bias existing in the magnetic levitation system. The non linear mathematical model of the plant from fundamental physical laws has been obtained and the non linear equation has been linearized around the equilibrium point using Taylor's series. Combining the tuning philosophy of PID controllers with the concept of LQR theory, the simple mathematical gain formulae has been formulated to obtain the satisfactory response. The experimental results demonstrated the effectiveness of the proposed approach not only in stabilizing the ball but also in tracking the various reference trajectories given as an input.