You are on page 1of 11

COURSEWARE SAMPLE

INSTRUCTOR WORKBOOK

2 DOF Ball Balancer Experiment for MATLAB /Simulink Users


Standardized for ABET * Evaluation Criteria
Developed by:
Jacob Apkarian, Ph.D., Quanser
Paul Karam, B.A.Sc., Quanser
Michel Lvis, M.A.Sc., Quanser
Hakan Gurocak Ph.D., Washington State University

Quanser educational solutions


are powered by:

Course material
complies with:

CAPTIVATE. MOTIVATE. GRADUATE.


*ABET Inc., is the recognized accreditor for college and university programs in applied science, computing, engineering, and technology. ABET has provided leadership
and quality assurance in higher education for over 75 years.

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.

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 1 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

TABLE OF CONTENTS

PREFACE ...................................................................................................................... PAGE 1


INTRODUCTION TO QUANSER 2 DOF BALL BALANCER COURSEWARE SAMPLE ....... PAGE 3
INSTRUCTOR WORKBOOK TABLE OF CONTENTS ....................................................... PAGE 4
BACKGROUND SECTION SAMPLE ............................................................................ PAGE 5
PRE-LAB QUESTIONS SECTION SAMPLE ................................................................... PAGE 6
LAB EXPERIMENTS SECTION SAMPLE ...................................................................... PAGE 7

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 2 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

1. INTRODUCTION TO 2 DOF BALL BALANCER COURSE MATERIALS SAMPLE


Quanser course materials provide step-by-step pedagogy for a wide range of control challenges. Starting with
the basic principles, students can progress to more advanced applications and cultivate a deep understanding
of control theories. With the Quanser 2 DOF Ball Balancer courseware, you can teach students how to:
Model the dynamics of the ball from first principles,
Obtain a transfer function representation of the system,
Design a proportional-derivative (PD) control that positions the ball to a desired X-Y position on the
plate,
Simulate the control on a single-axis 2 DOF Ball Balancer system,
Implement the controller on the actual device.
Every laboratory chapter in the Instructors Manual is organized into four sections:
Background section provides all the necessary theoretical background for the experiments.
Students should read this section first to prepare for the Pre-Lab questions and for the actual lab
experiments.
Pre-Lab Questions section is not meant to be a comprehensive list of questions to examine
understanding of the entire background material. Rather, it provides targeted questions for
preliminary calculations that need to be done prior to the lab experiments. All or some of the
questions in the Pre-Lab section can be assigned to the students as homework.
Lab Experiments section provides step-by-step instructions to conduct the lab experiments and to
record the collected data.
System Requirements section describes all the details of how to configure the hardware and
software to conduct the experiments. It is assumed that the hardware and software configuration
have been completed by the instructor or the teaching assistant prior to the lab sessions. However,
if the instructor chooses to, the students can also configure the systems by following the
instructions given in this section.
Assessment of ABET outcomes is incorporated into the Instructors Manual look for indicators such
as A-1, A-2
These indicators correspond to specific performance criteria for an outcome. Appendix A of the Instructors
Workbook includes:
- details of the targeted ABET outcomes,
- list of performance criteria for each outcome,
- scoring rubrics and instructions on how to use them in assessment.
The outcomes targeted by the Pre-Lab questions can be assessed using the student work. The outcomes
targeted by the lab experiments can be assessed from the lab reports submitted by the students. These reports
should follow the specific template for content given at the end of each laboratory chapter. This will provide a
basis to assess the outcomes easily.

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 3 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

2.

INSTRUCTOR WORKBOOK TABLE OF CONTENTS

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

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 4 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

3. BACKGROUND SECTION - SAMPLE


Modeling
Since the 2 DOF Ball Balancer uses two Rotary Servo Base Unit (SRV02) devices and the table is symmetrical, it
is assumed that the dynamics of each axis is the same. The 2 DOF Ball Balancer is therefore modeled as two
de-coupled "ball and beam" systems where we assume the angle of the x-axis servo only affects the ball
movement in the x direction. Similarly for the y ball motion. The equation of motion representing the ball's
motion along the x axis relative to the plate angle is developed in Section 2.1.1. The servo angle is introduced
into the model in Section 2.1.2 and is then represented as a transfer function in Section 2.1.3.
Nonlinear Equation of Motion
The free body diagram of the Ball and Beam is illustrated in Figure 2.1. Using this diagram, the equation of
motion, or EOM for short, relating the motion of the ball, x, to the angle of the beam, , can be found. Based
on Newton's First Law of Motion, the sum of forces acting on the ball along the beam equals
() = = , ,

(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.

Figure 2.1: Modeling ball on plate in one dimension.

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 5 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

4. PRE-LAB EXERCISES SECTION - SAMPLE


Sensor Calibration
1.

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

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 6 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

5. LAB EXPERIMENTS SECTION - SAMPLE


Control Implementation
In this section, the control designed in Section 4.3 and tested in simulation in Section 4.4.1 is implemented on
the actual 2 DOF Ball Balancer device. Measurements will then be taken to ensure that the specifications are
satisfied.
Experimental Setup
The q_2dbb Simulink diagram shown in Figure 4.5 is used to run the state-feedback control on the Quanser
2 DOF Ball Balancer system. The SRV02-ET+2DBB subsystem contains QUARC blocks that interface with the
servo DC motors and servo encoders and overhead camera.

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).

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 7 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

(a) Ball Position X

(d) Ball Position Y

(b) Servo Angle X

(c) Voltage X

(e) Servo Angle Y

(f) Voltage Y

Figure 4.6: Running PD control on 2 DOF Ball Balancer

6. Stop the controller once you have obtained a representative response.


7. B-5, K-3 Plot the responses from the x (cm), theta_x (deg), and Vm_x (V) scopes in a Matlab figure.
Similarly as described in Section 4.4.1, the response data is saved in variables data_x, data_theta_x, and
data_vm_x.
Answer 4.6
Outcome
B-5

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

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 8 of 9

COURSE
MATERIALS
SAMPLE 2 DOF BALL BALANCER

Figure 4.7: 2 DOF Ball Balancer Closed-Loop Response

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).

2014 Intellectual property of Quanser. Do not reproduce without written permission.

QUANSER.COM +1-905-940-3575 INFO@QUANSER.COM

Page 9 of 9

Ten modules to teach controls from the basic to advanced level

Flexible Link

2 DOF Robot

Flexible Joint

Inverted Pendulum

2 DOF Inverted Pendulum

Gyro/Stable Platform

Ball and Beam

Multi-DOF Torsion

Double Inverted Pendulum

2 DOF Ball Balancer

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 info@quanser.com.
2012 Quanser Inc. All rights reserved. MATLAB and Simulink are registered trademarks of The MathWorks Inc.

INFO@QUANSER.COM

+1-905-940-3575

Solutions for teaching and research. Made in Canada.

QUANSER.COM

Instructor Workbook: SRV02 Base Unit Experiment for MATLAB /Simulink Users

SRV02 Base Unit

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

SRV02 educational solutions


are powered by:

Course material
complies with:

CAPTIVATE. MOTIVATE. GRADUATE.


*ABET Inc., is the recognized accreditor for college and university programs in applied science, computing, engineering, and technology. Among the most respected accreditation
organizations in the U.S., ABET has provided leadership and quality assurance in higher education for over 75 years.

You might also like