SRV02 Exp7 Inverted Pendulum Solution
SRV02 Exp7 Inverted Pendulum Solution
SRV02 Exp7 Inverted Pendulum Solution
Rotary Experiment # 7
Inverted Pendulum
This document details the necessary laboratory setup required for the Inverted Pendulum
experiment.
Included are descriptions of all the files accompanying the experiment.
This document includes a solutions set for the accompanying laboratory experiment
designed by Quanser.
Instructor Manual
SRV02-Series
Rotary Experiment # 7
Inverted Pendulum
Instructor Manual
1. System Requirements
Note: The settings that you see above are the recommended configuration of this
experiment. It is up to you the instructor to ensure that these settings match the
configuration of your particular setup.
Page # 2 Revision: 01
Further along in the setup file, you will find a section that pertains to the actual Pendulum
Configuration:
Use this section to configure the setup to match your exact experimental setup. The
default settings shown above are recommend for this experiment. We recommend
switching this setting to the 'DOWN' start position only if you also intend to run the Self-
Erecting Pendulum controller as well.
The above 2 figures show the 2 different starting locations of the pendulum experiment.
You should also notice the location of the pendulum on the shaft. If the pendulum is in
the 'UP' configuration, make sure it starts with the pendulum lying flush to the stopper. In
the 'DOWN' position, the pendulum should be fastened at the end of the shaft.
If at any point you are unsure about your own configuration, please refer to the SRV02
User Manual and/or the SRV02 Rotary Pendulum User Manual. You may also contact
our technical support directly through www.Quanser.com.
Page # 3 Revision: 01
2.1 Configuring the Controller
Further in the script file (Setup_SRV02_Exp7.m), there is a section that will set whether
this script calls the controller design function. The controller design function
(d_SRV02_Inverted_Pendulum.m) calculates the optimal controller gains and sends
them to the MATLAB workspace. The user-defined controller specification section is as
follows:
% Student Configuration: Set to 'MANUAL' if you want the student to calculate gains
% or set to 'AUTO' if you would like this script to set the gains
% to meet the desired specifications
Student_Config = 'MANUAL';
In this section you can select if you would like this script to return the controller gains
(AUTO) or have the students themselves calculate and enter the gains (MANUAL). It
is suggested that the instructor run this script file in the AUTO mode as to have the
optimal controller gains that meet the requirements and have the students run this script
file in the MANUAL mode as part of the laboratory procedure is to mathematically
calculate the needed gains to achieve the system requirements.
Each controller provided by Quanser is supplied with a controller design function. For the
rotary Inverted Pendulum controller, the design file (d_SRV02_Inverted_Pendulum.m)
calculates the optimal state-feedback controller gains using the MATLAB LQR function.
Inside the controller design file, you will find the following user-defined controller
specifications:
The provided controller is the most optimal controller for meeting the required
specifications as mentioned in the Student Handout of this laboratory.
*Note: This design file should not be given to the students as they are intended to
determine the necessary gains required to place the closed-loop poles at the
desired locations.
Page # 4 Revision: 01
2.3 Experiment Files
The following table lists all the provided files that are supplied with this experiment:
Page # 5 Revision: 01
3. Solution Set to the Student Handout
i. In the pre-lab assignment, the students were asked to make some calculations
on the non-linear system model as to the range of alpha that the linear model will
be adequate. This problem can be solved in many ways. The answers the
students provide should be between 20 & 30.
ii. The first task of the laboratory was to vary 2 parameters of the Q matrix and
generate an Iteration Table. This table will have a wide range of entries as it
was left to the student's discretion to pick their own design values. The table
should follow the sample entries shown below:
The design values the students should have obtained will probably not be these
exact values but should be relatively similar. The students were also asked to
show that their final controller did meet all required specifications. This should be
done in a table similar to the Iteration Table.
iv. Once the students were satisfied with the simulated results, they were asked to
implement the controller on the experiment. They were also asked to provide a
Measurement Table similar to:
Page # 6 Revision: 01
The Measurement Table should be used to validate the controller and the
students are asked to show that the controller has met the required
specifications.
v. The students are asked to comment on the performance of their controller on the
actual system as opposed to the simulated results. It is in this analysis that the
student will examine the effects of the controller on physical systems. The
answers for this section are qualitative and it will be left to the instructor's
discretion with regards to the expected answers from the students.
vi. The students are asked to include their final implemented controller gains (this
should be displayed in the MATLAB command window). They should also
include all iterative controllers as was needed to meet the required specifications.
1) The students are asked for other control techniques they might have used in order to
control the inverted pendulum. Some methods are:
Pole-Placement
Frequency Method Control (Lead/Lag Compensation)
Non-Linear Control
PID Controllers
2) This question requires the students to submit a plot of Theta and show how the
system first will move in the opposite direction before correcting direction and moving
to its desired location. Some mention of Non-Minimum Phase systems should be
discussed in the classroom prior to this laboratory. The inverted pendulum example is
an easy to understand and intuitive example of Non-Minimum Phase systems as the
students can relate to allowing the pendulum to fall in a certain direction before moving
under it to 'Catch' it. A plot of theta like Figure 3 below should be included in the
report. The students should clearly label the Non-Minimum phase response to a step-
input.
Page # 7 Revision: 01
Figure 3 - Theta Plots: Notice the Non-Minimum Phase
3) This question asks the students again to elaborate on the response of the actual
system as compared to the response of the simulated system. The students should
give some quantitative answers and some factors leading to these errors would be:
4) The final question asks the student for ways of modifying the model in order to
incorporate the Limit Cycle phenomenon. The only way of simulating this non-linearity
is to model the static and viscous friction which will be non-linear and vary from plant
to plant. This might be project in non-linear modeling and system identification.
Page # 8 Revision: 01