EECE 258 Lab Inverted Pendulum Control Spring 2011 OBJECTIVE: Students will use the Qnet ROTPEN Inverted Pendulum Control System and the NI ELVIS LabVIEW API to experiment balance control of the inverted pendulum. 1. PRELAB : Learn the basic components and operations of the ROTPEN Inverted Pendulum system and the NI ELVIS LabView. 1.1 Hardware The hardware of the Inverted Pendulum system consists of the pendulum arm, a DC motor and an arm encoder located on top of an NI Elvis Prototyping board. This board is connected to the NI Elvis System. 1.2 Software The software for this system consists of NI Elvis LAB VIEW software. This software contains the nonlinear inverted pendulum models for this lab. 1.3 Prelab Sessions There are sevarl prelabs that you need to go over before you are going to the inlab section 2.0. 1.3.1 Open-loop modeling of the pendulum This part represents the dynamic modeling of pendulum motion. Dynamic equations are complex and nonlinear. 1.3.2 Swing up the pendulum arm – Skip this part! We will not deal with the swing up control problem since the calculation is much more complicated. Also we want to avoid possibility of violent arm movement, i.e. unexpected reaction from the pendulum. 1.3.3 Balance Control The balance control is what balances the pendulum are in the inverted state. The POTPEN balance controller is a state feedback controller in the form of u(t)=-Kx(t). Once the pendulum is within the linear range of the balance controller, it kicks-in and balance the pendulum using linearlized state equations dx(t)/dt=Ax(t)+Bu(t) and y(t)=Cx(t) where A,B, and C are shown on the last page of the lab handout. 1.3.3 System Block Diagram Draw the feedback control system block diagram of the balance control. (If you use Simulink, print the Simulink diagram and include in your lab report.) 2. INLAB Students will use the Qnet ROTPEN Inverted Pendulum Control System and the NI ELVIS LabVIEW API to experiment and learn the inverted pendulum control system. 2.1 Check the Components of the System 2.1.1 Make sure that the Qnet Rotary Pendulum Control Trainer module is connected to the NI ELVIS system. 2.1.2 ELVIS Communication Switch is set to BYPASS 2.1.3 DC power supply is connected to the QNET Rotary Pendulum Control Trainer Module. 2.1.4 The 4 Leds +B, +15V, -15V, 5V on the QNET machine is all lit. 2.2 Lab Precaution Before starting the INLAB session, students should be aware of some precaution listed by the manufacturer. Precaution before using the QNET ROTPEN inverted pendulum system are: 2.2.1 Do not touch the circuit board while the machine is on. 2.2.2 Make sure that all the pendulum components are properly attached. 2.2.3 Check whether all the screws are properly fastened (especially the pendulum arm and the mass). 2.3 Lab Start Up i. Start Windows. ii. Log in as labuser. iii. Click on the start icon in task bar. iv. Click the Lab View icon. v. Click Open in the Lab View and select Inverted Pendulum folder. vi. Click on the Labs Folder and select the QNET_ROTPEN_Lab_04_Inv_Pendulum_Control. vii. Familiarize yourself with the open-loop and closed-loop systems as shown in figure 1 & 2. Figure 1: Open-Loop system Figure 2: Closed-Loop system In this experiment, we only deal with the Closed-Loop system since we are going to conduct the balance control, i.e. linearlized system, analysis. 2.4 Frequency of the pendulum. The frequency of the pendulum can be found from f ncyc t1 t 0 where, ncyc is the number of cycles within the time duration t1 - t0, t0 is the time when the first cycle begins, and t1 is the time of the last cycle. τpend(αup, u) = lp Fpend cos(αup) Parameter t0 t1 F Jp Value Unit s s Hz Kgm2 Table 1: Experimental Inertia Parameters 2.5 Closed-Loop Balance Control Analysis i. Insert all the Model Parameter into the blank input box. ii. You should determine the matrix values such that it satisfies these requirements. iii. The balance control specifications has to be as below: (1) Arm Regulation: |θ(t)| < 30.0° (2) Pendulum Regulation: |α(t)| < 1.5° (3) Control input limit: Vm < 10 V iv. Find the missing values in Table 2. Q is a 4x4 weighting matrix. You will need to determine the correct values for the lower part of the Q matrix. The values will be correct when the pendulum successfully balances. (Hint: Start with q24=q34=q44=0 with different q14.) Q q1 5 1 10 q2 0 0 0 q3 0 0 0 Max |α| (deg) q4 0 0 0 Max |θ | (deg) Table: 2 v. After done with the balance analysis, go to run button and implement the balance control. vi. You should lift the pendulum upward and slowly release it so that it can balance as desired. vii. The interface of the balance control is shown in figure 3 below. Figure 3: Balance Control system 3.0 POST LAB Refer the handouts from class, Classical Fuzzy Control Problem and Inverted Pendulum Control. 1. State the equation for the nonlinear version of the Inverted Pendulum control. 2. Using Simulink, design an appropriate block diagram for this system. 3. What was the range of the pendulum angle α at which the balance controller was activated? 4. Based on what you gained in the QNET inverted pendulum experiment, the class discussion of fuzzy control, discuss the main difference between the two approach in terms of mathematical approach of the problem. Appendix - Analytical Background: The linear equations of motion of the pendulum system are obtained by linearlizing the original fourth-order nonlinear equations of motion about the operation points α = π. These linearlized equations are similar to Equation (3.73) IN THE Example 3.4 in the textbook by Dorf and Bishop. Assumptions and General expression Figure A1: Rotary Pendulum System The pendulum angle, α, is defined to be positive when it rotates counter-clockwise while the arm angel, θ, is defined to be positive when it clockwise. In other words, the inverted pendulum moves clockwise (i.e. the suspended pendulum moves counterclockwise) and that is defined as α>0. The dynamic equations between the angle of the arm, θ; the angle of the pendulum, α, and torque at arm pivot are shown below:- The general expression and constants are shown in table A1 below, Symbol Description Mass of the pendulum assembly weight and link combined). Value Unit 0.027 kg lp Length of pendulum center of mass from pivot. 0.153 m Lp Total length of pendulum. 0.191 m R Length of arm pivot to pendulum pivot. 0.08260 m Jm Motor shaft moment of inertia. 3.00E-005 kg.m2 Mass of arm. 0.028 kg G Gravitational acceleration constant. 9.810 m/s2 Jeq Equivalent moment of inertia about motor shaft pivot axis. 1.23E-004 kg.m2 Jp Pendulum moment of inertia about its pivot axis. 1.10E-004 kg.m2 Beq Arm viscous damping. 0.000 N.m/(rad/s) Bp Pendulum viscous damping. 0.000 N.m/(rad/s) Rm Motor armature resistance. 3.30 Ω Kt Motor torque constant. 0.02797 N.m Km Motor back-electromotive force constant. 0.02797 N.m/(rad/s) Mp Marm Table A1: General Expression and constants From these equations, we can generate the state matrix based on the second-order polynomial.