2 DOF Ball Balancer Courseware Sample MATLAB Users
2 DOF Ball Balancer Courseware Sample MATLAB Users
INSTRUCTOR WORKBOOK
Course material
complies with:
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
PREFACE
Preparing laboratory experiments can be time-consuming. Quanser understands time constraints of teaching
and research professors. Thats why Quansers control laboratory solutions come with proven course materials.
The course materials are designed to save you time, give students a solid understanding of various control
concepts and provide maximum value for your investment.
The course materials are supplied in two formats:
1. Instructor Workbook provides solutions for the pre-lab assignments and contains typical experimental results
from the laboratory procedure. This version is not intended for the students.
2. Student Workbook contains pre-lab assignments and in-lab procedures for students.
This course material is prepared for users of The MathWorkss Matlab/Simulink software in
conjunction with Quansers QUARC real-time control software. A version of the course
materials for National Instruments LabVIEW users is also available.
The courseware for Quanser 2 DOF Ball Balancer is aligned with the requirements of the
Accreditation Board for Engineering and Technology (ABET), one of the most respected
organizations specializing in accreditation of educational programs in applied science,
computing, science and technology. The Instructor Workbook provides professors with a simple framework and
set of templates to measure and document students achievements of various performance criteria and their
ability to:
Apply knowledge of math, science and engineering
Design and conduct experiments, and analyze and interpret data
Communicate effectively
Use techniques, skills and modern engineering tools necessary for engineering practice
Quanser, Inc. would like to thank Dr. Hakan Gurocak from the Washington State University Vancouver, for
rewriting the original manual to include embedded outcomes assessment.
The following material provides an abbreviated example of pre-lab assignments and in-lab procedures for the
2DOF Ball Balancer. Please note that the examples are not complete as they are intended to give you a brief
overview of the structure and content of the course material you will receive with the plant.
Page 1 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
TABLE OF CONTENTS
Page 2 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
Page 3 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
2.
The full Table of Contents of the Quanser2 DOF Ball Balancer Instructor Workbook is shown here:
1. INTRODUCTION
2. MODELING
2.1. BACKGROUND
2.1.1. NONLINEAR EQUATION OF MOTION
2.1.2. RELATIVE TO SERVO ANGLE
2.1.3. OBTAINING THE TRANSFER FUNCTION
2.2. PRE-LAB EXERCISES
3. SENSOR CALIBRATION
3.1. BACKGROUND
3.2. PRE-LAB EXERCISES
3.3. LAB EXPERIMENTS
3.4. RESULTS
4. CONTROL DESIGN
4.1. SPECIFICATIONS
4.2. BACKGROUND
4.3. PRE-LAB QUESTIONS
4.4. LAB EXPERIMENTS
4.5. RESULTS
5. SYSTEM REQUIREMENTS
5.1. OVERVIEW OF FILES
5.2. SETUP FOR CAMERA CALIBRATION
5.3. SETUP FOR CONTROL SIMULATION
5.4. SETUP FOR CONTROL IMPLEMENTATION
APPENDIX A
INSTRUCTOR'S GUIDE
REFERENCES
Page 4 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
(2.1)
where mb is the mass of the ball and x is the ball displacement. Fx,r is the force from the ball's inertia, and Fx,t is
the translational force generated by gravity. friction and viscous damping are neglected.
Page 5 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
A-1 The ball is to be controlled relative to the coordinate axis [Xb, Yb] in metric units. Find functions
x = f (px, py) and y = f(px, py) that describe the position of the ball relative to the ball position coordinate
system [Xb, Yb] from the raw camera point measurement px and py (which are based on the camera
coordinate system [Xc, Yc]).
Answer 3.1
Outcome
A-1
Solution
From Figure 3.1, the x and y ball positions can be expressed as
and
1
2
1
2
Notice that the x and y axes can of the camera-based coordinate system, Oc and the ballbased coordinate system, Ob, are reverse.
2.
A-2 In 2 DOF Ball Balancer User Manual ([6]), the image viewed by the camera has to be customized in
order to view the entire plate. Assume the camera has been setup with a resolution of 440 pixels (i.e.,
width and height of image is 440). Calculate the position of the ball if the camera reads px = 160 and
py = 220.
Answer 3.2
Outcome
A-2
Solution
The table length given in 2 DOF Ball Balancer User Manual is Ltbl = 0.275 meter. Using this
and the equations developed in the previous exercise, the ball position is at
220 1
= 27.5
=0
440 2
and
160 1
= 3.75
= 27.5
440 2
Page 6 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
Figure 4.5: Simulink diagram that runs the control on 2DBB system
IMPORTANT: Before you can conduct this experiment, you need to make sure that the lab files are configured
according to your system setup. If they have not been configured already, then go to Section 5.4 to configure
the lab files first.
1. Place the ping pong ball in the middle of the table.
2. Go to QUARC|Build to build the controller.
3. Go to QUARC|Start to run the controller. Depending where the ball is initially located, the servos will
move to position the ball in the center (desired ball position initially set to (0,0)).
4. Go to the Setpoints subsystem and set the Amplitude X Slider Gain to 3cm. The ball should travel 3 cm
along the x-axis of the plate.
5. Figure 4.6 depicts a typical response (both the x and y axes scopes are shown).
Page 7 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
(c) Voltage X
(f) Voltage Y
Solution
If the experimental procedure was followed correctly, they should have generated a figure
similar to Figure 4.7.
K-3
Using the Matlab plot command, you can generate a figure similarly as shown in Figure
4.7. Run the meas_2dbb_specs.m script after running the q_2dbb.mdl with the gain found
in Section 4.3 to plot this response. Alternatively, this plot can be generated using the data
stored in the rsp_2dbb_x.mat, rsp_2dbb_theta_x.mat, and rsp_2dbb_vm_x.mat files
Page 8 of 9
COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER
8. K-1, B-9 Measure the settling time, percent overshoot, and steady-state error of the measured
response. Does the response satisfy the specifications given in Section 4.1?
Answer 4.7
Outcome
K-1
B-9
Solution
Looking at the step that occurs at the 50 second mark in Figure 4.7, the ball position settles
to a final value of about 2.41 cm. It is within 4% of this final value, 0.96x2.41 = 2.31 cm, at
the 50.9 sec mark. The response reaches a maximum value of 2.62 cm. The specifications in
Figure 4.7 are therefore
= 50.91 50 = 0.91 ,
2.622.41
= 100
= 3.9%,
3+2.41
= 3.0 2.41 = 0.59 ,
| = 10 |.
The settling time and overshoot specification listed in Section 4.1 are satisfied, but the
steady-state error does not. This, of course, can be an iterative design (i.e., go back to PD
control and design for more conservative specification or introduce an integrator to reduce
the steady-state error). Run meas_2dbb_specs.m script to find the specifications
automatically (after running q_2dbb or from saved data).
Page 9 of 9
Flexible Link
2 DOF Robot
Flexible Joint
Inverted Pendulum
Gyro/Stable Platform
Multi-DOF Torsion
With the SRV02 Base Unit, you can select from 10 add-on modules to create experiments of varying complexity across a
wide range of topics, disciplines and courses. All of the experiments/workstations are compatible with MATLAB/Simulink.
To request a demonstration or a quote, please email [email protected].
2012 Quanser Inc. All rights reserved. MATLAB and Simulink are registered trademarks of The MathWorks Inc.
+1-905-940-3575
QUANSER.COM
Instructor Workbook: SRV02 Base Unit Experiment for MATLAB /Simulink Users
INSTRUCTOR WORKBOOK
SRV02 Base Unit Experiment For MATLAB/Simulink Users
Standardized for ABET * Evaluation Criteria
Developed by:
Jacob Apkarian, Ph.D., Quanser
Michel Lvis, M.A.Sc., Quanser
Hakan Gurocak, Ph.D., Washington State University
Course material
complies with: