Rose-Hulman ECE 320 - Modeling, Simulation and Control of a 2 Degree of Freedom Inverted Pendulum System

Unformatted text preview:

Lab 9: Modeling, Simulation, and Control of a 2 Degree of Freedom Inverted Pendulum System Overview In this lab you will model, simulate, and control both a regular pendulum on a cart and an inverted pendulum on a cart. Note that the system we are controlling is unstable! You will be given all of the files you need for this lab, except for the 2 dof files you created last week (and used in the prelab). I have the files you need on a memory stick, so ask for them when you are ready. For the two degree of freedom regular pendulum system configuration from the prelab, with , ,1qx=2qx=3qθ= , and 4qθ=, we get the following state equations 222 21111 11 1212 23 32222 2 24 41211101 0 0020000 0 120KqqqqqqqqKgggθθθθθωωωζω ωωωωω ζωω ω⎡⎤⎡⎤⎢⎥⎢⎥⎛⎞⎛⎞ ⎛ ⎞⎡⎤ ⎡⎤⎛⎞⎢⎥⎢−−⎜⎟⎜⎟ ⎜ ⎟⎜⎟⎢⎥ ⎢⎥⎢⎥⎢ΔΔ Δ Δ⎝⎠⎝⎠ ⎝ ⎠⎝⎠⎢⎥ ⎢⎥⎢⎥⎢=+⎢⎥ ⎢⎥⎢⎥⎢⎢⎥ ⎢⎥⎢⎥⎢⎛⎞⎛⎞⎛ ⎞⎛⎞⎣⎦ ⎣⎦⎢⎥⎢−−⎜⎟⎜⎟⎜ ⎟⎜⎟⎢⎥⎢ΔΔΔΔ⎝⎠⎝⎠⎝ ⎠⎝⎠⎣⎦⎣⎦FK⎥⎥⎥⎥⎥⎥⎥ We need to identify all of these quantities to get theAandBmatrices for the state variable description. For our system and C is determined by whatever we want the output to be. 0D = Step 1: Set Up the System. Only the first cart should be able to move. In addition: • There should be at least two masses on the first cart. • There should be at least one spring in the system. If there are two springs the stiffer spring should be between the cart and the motor. • The pendulum should be securely fastened to the first cart. It should rest on top of the masses and be securely tightened. • The mass on the pendulum should be within about 2 or three inches from the pivot. Remember that the cart must be able to get under the center of mass of the pendulum in order to right it, so if the center of mass of the pendulum is too far away the cart will never be able to get under it. The ECP system should be moved to the edge of the bench, so that the pendulum is completely free to swing without hitting the bench. • The wire to measure the position of the pendulum position encoder should be securely attached (with the screws) and the cart and pendulum should be free to move.Step2a) Estimate of θω From the equations of motion, if we assume the cart is fixed, then 0x= and we have 20θθωθ+= This is the equation for a simple pendulum. If the pendulum is deflected a small angle and released, it will oscillate with frequencyθω. To measure this: • Set the input in Model210_Openloop.mdl to 0 • Set the X-Y graph in Model210_Openloop.mdl to measure the position of the pendulum. You may want to change the y-min and y-max values in the X-Y graph. We are measuring angles in radians, not degrees. • Displace the pendulum and let it go. Since we are using a small angle assumption, the pendulum should not be displaced too far. • Using Matlab, plot the displacement of the pendulum versus time, and determine the period of the pendulum, and determineθω. Step 2b) Estimation of 1ωand 1ζ If we assume there is not input (0F=) and the pendulum does not move very much (0θ≈) then we have 1211210xxxζωω++=  Use the log-decrement method to get estimates of1ωand1ζ. Note this is an equation of motion in ()xt. Note also that we don't really have the case of 0θ≈, but this approximation is not too far off. You will need to include these log-decrement results in your memo. Step 2c) Estimation of 2K Applying a step input of amplitude A to the cart, estimate 2ssxKA=Step 2d) Fitting the Estimated Frequency Response to the Measured Frequency Response The transfer function between the input and the position of the first cart is given by ()22212224 3222 2211 11 1 11 1()()()12()(2)KsXsFsKs s s sgθθ2θθθωωωωζω ω ω ζωω ωω+=⎛⎞−+++++⎜⎟⎝⎠ We will use this expression to determine and get better estimates of 1K1ωand1ζ, then we will have all of the parameters we need for our state variable model. We will be constructing the magnitude portion of the Bode plot and fitting this measured frequency response to the frequency response of the expected transfer function to determine these parameters. For each frequency 2fωπ= we have as input () cos( )Ft A tω= where, for out systems,Ais measured in centimeters. After a transition period, the steady state output will be() cos( )xt B tωθ=+ for the position of the first cart Since we will be looking only at the magnitude portion of the Bode plot, we will ignore the phase angles.You will go through the following steps For frequencies Hz 0.5,1,1.5...7.5f = • Make sure the first cart is free to move. • Modify Model210_Openloop.mdl so the input is a sinusoid. To make any changes to Model210_Openloop.mdl, the mode must be Normal. • Set the frequency and amplitude of the sinusoid. Try a small amplitude to start, like 0.1 • Compile Model210_Openloop.mdl if necessary. This is usually not necessary so only do it when you have to (the program will let you know.) • Connect Model210_Openloop.mdl to the ECP system. (The mode should be External.) • Run Model210_Openloop.mdl. If the cart does not seem to move much, increase the amplitude of the input sinusoid. If the cart moves too much, decrease the amplitude of the input sinusoid. Note that if the cart hits the stops you will probably need to adjust the pendulum. Be sure the system reaches steady state before you measure the amplitude! • Record the input frequency (f), the amplitude of the input (A), and the amplitude of the output (B) when the system is in steady state. You will probably want to use the file get_A.m. You will probably notice that the output does not look quite as sinusoidal as usual. This is because we are not really giving the pendulum enough time to reach steady state. Enter the values off, A, and B into the program process_data_pendulum.m (you need to edit the file) At the Matlab prompt, type data = process_data_pendulum; Step 3a) Modeling the Regular Pendulum Run the program model_pendulum_full.m. There are 5 input arguments to this program: • data, the measured data as determined by process_data_pendulum.m • the estimated value of 2K• θω, the estimated frequency of the pendulum, in radians/sec • 1ζ, the estimated


View Full Document

Rose-Hulman ECE 320 - Modeling, Simulation and Control of a 2 Degree of Freedom Inverted Pendulum System

Documents in this Course
Load more
Download Modeling, Simulation and Control of a 2 Degree of Freedom Inverted Pendulum System
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Modeling, Simulation and Control of a 2 Degree of Freedom Inverted Pendulum System and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Modeling, Simulation and Control of a 2 Degree of Freedom Inverted Pendulum System 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?