design, fabrication, and testing of a driven double...
TRANSCRIPT
Design, Fabrication, and Testing of a Driven Double Pendulum
________________________
A Project
Presented to
the Faculty of the Undergraduate College of
Science and Mathematics
James Madison University
________________________
In Partial Fulfillment
of the Requirements for the Degree
Bachelor of Science
________________________
by
Daniel Gibson Kelly
2008
Table of Contents
Table of Figures iii
Acknowledgments iv
Abstract v
Chapter 1: Introduction to Nonlinear Dynamics 1
Chapter 2: Materials and Methods 7
Chapter 3: Discussion and Results 19
Chapter 4: Conclusions 32
Appendix A: Pendulum Image Analysis Program Source Code 33
Appendix B: Experimental Setup Parts List 52
References 53
i
Table of Figures Figure 1 Driven single pendulum setup. ..............................................................................4 Figure 2 Fixed double pendulum setup................................................................................5 Figure 3 Driven double pendulum setup..............................................................................5 Figure 4 The experimental setup..........................................................................................7 Figure 5 A close up of the frame.. ........................................................................................8 Figure 6 Double pendulum apparatus. .................................................................................8 Figure 7 The driving mechanism. ......................................................................................10 Figure 8 The adjustable sheaves. .......................................................................................10 Figure 9 The setup for determining the center of mass of a pendulum arm. .....................12 Figure 10 The experiment for measuring the moment of inertia of a pendulum arm........13 Figure 11 A sequence of images from an actual moment of inertia data run. ..................14 Figure 12 A sequence of images demonstrating the data collection technique. ................15 Figure 13 A single pendulum image captured by the high-speed camera..........................16 Figure 14 The same image after the threshold operation...................................................16 Figure 15 The image after an erosion and dilation operation. ...........................................17 Figure 16 The image after a watershed operation..............................................................17 Figure 17 The original image.............................................................................................18 Figure 18 Energy versus total arc traveled for the upper pendulum arm ..........................20 Figure 19 Energy versus total arc traveled for the lower pendulum..................................20 Figure 20 The energy versus total arc traveled graph for the lower pendulum .. ..............21 Figure 21 The lower pendulum with the larger moment of inertia is on the left. ..............21 Figure 22 Theta versus time for a driven single pendulum. ..............................................22 Figure 23 Omega versus theta for a driven single pendulum. ...........................................22 Figure 24 Possible period four motion...............................................................................23 Figure 25 Transient solutions are easily visible in this graph............................................24 Figure 26 A close-up of the transients solutions in Figure 25............................................24 Figure 27 Another image depicting transient solutions. ....................................................25 Figure 28 A close-up of the transient solutions of figure 27..............................................25 Figure 29 The displacement of the top axle position versus time.....................................26 Figure 30 A Fourier transform of the data in figure 29......................................................26 Figure 31 Theta one versus time for three undriven double pendulum data runs..............27 Figure 32 A plot of the same data from Figure 31 over a longer time scale. ...................27 Figure 33 Theta two versus time for three undriven double pendulum data runs. ............28 Figure 34 The data from figure 33 on a longer time scale.................................................28 Figure 35 Theta one versus time and theta two versus time. .............................................29 Figure 36 Theta two versus theta one for steady state motion...........................................30 Figure 37 Theta one versus time for a driven double pendulum in steady state motion ...30 Figure 38 Theta two versus time for a driven double pendulum in steady state motion ...31
i
Acknowledgements
I would like to give special thanks to Dr. William Ingham for his constant
encouragement and great advice on every aspect of this project. I would also like to
thank Dr. Brian Utter for teaching me to use a high-speed camera and introducing me to
digital image analysis. Dr. Jim Sochacki provided many ideas on how to interpret and
present the results of the experiment. Art Fovargue allowed me to have continual access
to the machine shop. Dr. David Bernstein suggested placing LED arrays on the
pendulum apparatus to reduce error in the measurements. Dr. Steve Whisnant and Dr.
Chris Hughes provided several useful suggestions throughout the construction of the
experiment. Also, the Jeffrey E. Tickle College of Science and Mathematics Scholarship
funded my research during the summer of 2007.
Abstract
Chaos, as defined by a physicist or mathematician, is aperiodic behavior
exhibiting sensitivity to initial conditions. A driven single pendulum and a double
pendulum (free or driven) are examples of chaotic systems. These systems are
deterministic but small uncertainties in measured initial conditions quickly become
compounded by the nonlinear terms in the systems’ equations of motion. This
characteristic makes the detailed behavior of the setups difficult or impossible to predict.
This paper describes the design, fabrication, and testing of an apparatus that
accommodates several different pendulum designs. The experiment uses a 1hp motor to
drive a 0.9761kg single pendulum and 1.573kg double pendulum in a sinusoidal manner.
A high-speed camera records the motion and a digital image analysis program extracts
data. Initial tests show that a single pendulum driven at 1.79Hz at an amplitude of
5.40cm displays period doubling behavior. Period doubling is a route to aperiodic
behavior. Also, repeated experiments on the decay of an undriven double pendulum
demonstrate sensitivity to initial conditions: the trajectories quickly diverge from one
another even though the initial conditions are nearly the same. The apparatus performs
according to expectations and is ready for extensive data collection and comparison to
numerical simulations.
Chapter 1
Introduction to Nonlinear Dynamics
A driven single pendulum and a double pendulum are both examples of nonlinear
systems capable of exhibiting chaotic motion. Nonlinear dynamics, the field of physics
that studies such systems, blossomed in the latter part of the 20th century. Pioneer
physicists and mathematicians such as Edward Lorenz utilized digital computers to
simulate complex phenomenon such as atmospheric weather conditions and turbulent
fluid flows. These examples, along with the various pendulum designs studied in this
project, are a small portion of the systems revealed to display aperiodic behavior and
sensitivity to initial conditions.
The modern computer breathed new life into classical mechanics –a field defined
by Newton’s three laws of motion. The computer simplified numerically solving
Newton’s second law when it resulted in a nonlinear differential equation. Prior to the
computer, scientists applied clever methods to reduce nonlinear equations into
analytically solvable linear equations. In his book, Nonlinear Dynamics and Chaos,
Steven Strogatz asks the question “Why are nonlinear systems so much harder to analyze
than linear ones?” His response is,
“The essential difference is that linear systems can be broken down into parts. Then each part can be solved separately and finally recombined to get the answer. This idea allows a fantastic simplification of complex problems... But many things in nature don't act this way. Whenever parts of a system interfere, or cooperate, there are nonlinear interactions going on. Most of everyday life is nonlinear.[1]”
1
2
The computer is therefore a useful and necessary tool. It can quickly handle the iterative
techniques associated with numerical integration.
Chaos theory grew from the study of nonlinear systems. Henri Poincaré, a French
mathematician and theoretical physicist, was the first to discover the possibility of
chaotic motion with his work on the stability of planetary orbits in the late 19th century.
Poincaré developed graphical tools to analyze nonlinear equations that now bear his name
(such as a Poincare map) and are still utilized today. Edward Lorenz, a meteorologist,
simulated weather patterns on a digital computer. He found that slightly different initial
conditions would greatly affect the final outcome of his models. His solutions also never
settled to a stable state as most systems do. A decade or so later, Mitchell Feigenbaum
built upon Lorenz's work and discovered universality in chaos. Feigenbaum proved that
many systems transition from periodic motion to chaotic motion in the same fashion. He
found two constants in chaos that describe many dynamical systems' progression to
aperiodic behavior. Chaos theory is an unique implication of nonlinear systems and the
significant contributions to the field were only made within the last half century.
A laboratory study of various chaotic pendulums does contribute to the field of
nonlinear dynamics. Similar systems have been studied before but the “experiments” are
typically performed numerically. An experiment designed to physically justify these
numeric simulations presents a rigorous scientific treatment of the pendulum systems.
In the book The Pendulum: A Case Study in Physics [2], Gregory Baker and
James Blackburn present the physical concepts behind many incarnations of physical
pendulums. One chapter discusses a thorough study of an experimental driven single
pendulum and delves into topics not covered in this experiment, such as determining
3
Lyapunov exponents and inverting chaos to fit model equations to experimental data.
Baker and Blackburn found good agreement between the experimental data and
numerical simulations. Their model assumes a drag proportional to the pendulum’s
angular velocity. The experimental setup allows Baker and Blackburn to vary the
driving frequency and amplitude through a dismantled motor attached to the pendulum’s
axle [3].
Numerically determining the boundaries that separate the various motions of
chaotic pendulums is the concern of many recent papers. Xu and Wiercigroch [4]
translate the driven single pendulum’s equations of motion into a Mathieu equation to
understand the pendulum’s resonant structure with specific emphasis on rotational
motion. Their numerical simulation excites a pendulum subject to linear viscous drag in
a vertical manner. Nikitina [5] analyzes a fixed double simple pendulum to determine the
energy boundary between periodic and chaotic motions. His work neglects friction and
considers a double pendulum constructed of point like masses. Trueba, Baltanás, and
Sanjuán [6] numerically model a generalized perturbed pendulum. Their work creates an
equation that models many types of damping. They apply a perturbative Melnikov
method to analyze specific examples such as a horizontally driven pendulum, a vertically
driven pendulum, and a pendulum with a force acting at the center of mass.
A few experimental reports have also been published recently. Souza de Paula,
Savi, and Iunes Pereira-Pinto [7] drove a 1.47E-2kg single pendulum attached to a rotary
motion sensor. A magnetic device in the experiment provided adjustable dissipation of
energy. Their report compared experimental results to numerical simulations. Feeny and
Liang [8] excited a double pendulum in a vertical manner with the intention of extracting
4
parameter values from the pendulum’s chaotic motion. Their experiment placed optical
encoders in the pendulum axles to record data. Both experiments used a combination of
dry coulomb friction and linear viscous drag.
Unique pendulum designs are the topic of other recent reports. Bridges and
Georgiou [9] built a double pendulum where the individual arms rotate in perpendicular
planes relative to one another. Nagamine, Koseki, and Sato [10] study the dynamics of a
double pendulum with an electric motor connecting the lower pendulum to the upper
pendulum. The group may drive only the lower pendulum in this experiment.
The experiment presented here considers a massive pendulum subject only to
coulomb friction in the bearings. It studies a driven single pendulum, and a fixed double
pendulum similar to the reports above, but also studies a driven double pendulum. Below
are descriptions of these systems.
Figure 1 Driven single pendulum setup.
The figure above depicts a single driven pendulum. The system is free to rotate in the xy
plane and its pivot point is moved in a specified way along the horizontal axle. The
system has one degree of freedom. The time evolution of the driven pendulum, including
the varying constraint force required for the axle to execute its specified motion, can be
5
calculated using the linear and rotational forms of Newton’s second law (the form of the
retarding torque does not permit a Lagrangian analysis).
Figure 2 Fixed double pendulum setup.
This is a fixed-support double pendulum. This system has two degrees of freedom, θ1
and θ2. Both pendulums are free to rotate in the xy plane. The lower pendulum is shorter
than the upper pendulum so it may swing around without hitting the upper pivot the
point.
Figure 3 Driven double pendulum setup.
This is a driven double pendulum. Similar to the fixed double pendulum, both pendulum
arms are free to rotate. In addition though, the upper pivot is moved along the horizontal
6
support bar. This system has two degrees of freedom. For both of the double pendulum
problems, the time evolution, including the constraint forces at the axles, can be
calculated by careful application of the linear and rotational forms of Newton’s second
law to each arm.
Nonlinear Dynamics and Chaos theory are young fields revolutionalized by the
modern computer. Understandably, much of the pertinent research tends to be computer
simulations. Experimental studies of nonlinear systems such as the pendulum designs
presented in this paper complement numerical studies.
Chapter 2
Materials and Methods
Experimental Setup
Figure 4 The experimental setup. The image above shows the driving mechanism on the left and the pendulum assembly on the right. A driving arm connects the two. The image below shows the high-speed camera
The experimental setup is pictured above. Two 4’ x 8’ x 1/2” sheets of plywood
are mounted to a wall. These sheets minimize the pressure felt by the drywall and result
in an extremely rigid base to build the pendulum frame from. Attached to the sheets of
drywall are three 1.5m strips of u-channel strut. The front of the frame is built from two
horizontal struts and three vertical struts that mimic the locations of the struts attached to
the drywall. The front and back of the frame are bolted together using three smaller
7
8
pieces of strut. Positioned in front of the experimental setup is a high-speed camera. For
each data run, the camera records the motion of the pendulum. A computer program
analyzes the images and extracts pendulum’s position in each frame.
Attached to the frame are two horizontal axles which the pendulum assembly may
ride upon via two linear bearings.
Figure 5 A close up of the frame. The linear bearings connect the pendulum to the driving arm and to the support axles.
The 5/8” axles are welded to 1/8” steel bar. The linear bearings are an open style
and do not fully enclose the axle, so they easily slide around the support bar. This setup
provides a rigid support for the pendulum across the entire length of the axle.
Figure 6 Double pendulum apparatus. The single pendulum apparatus is simply the upper pendulum.
9
The pendulum assembly is pictured above. The bearings are rated ABEC-7 and
have a 20mm inner diameter. The bearing hubs are custom machined from 6061
aluminum. The threaded rods allow the potential to adjust the length and mass of each
arm. The total mass of the lower pendulum arm is 0.9761kg. The total mass of the upper
pendulum is 1.573kg. The LED arrays serve as the light source in the data acquisition
images.
1
Driving Mechanism
Figure 7 The driving mechanism.
The driving mechanism must provide a sinusoidal displacement of the upper axle.
A 1hp motor with a no-load speed of 1725rpm drives the pendulum assembly. This is a
low speed for a 1 hp motor, but it is appropriate for the low rpm values required to drive
the pendulum. The motor couples to a 10:1 gear reducer. A series of bicycle gears are
utilized to approximate the final driving frequency. The possible gear ratios (in teeth per
gear) are:
Motor Gear Idler Axle Gear34 3428 2821 2418 18
Any combination of these gears sets the idler axle frequency. The experimenter can then
adjust two sheaves to obtain a variety of driving frequencies.
Figure 8 The adjustable sheaves allow fine tuning of the driving frequency. The arm attached the drive axle adjusts the driving amplitude.
1
The driving arm is a simple setup with some important design considerations.
The length of the arm must be long compared to the amplitude in order to ensure a
sinusoidal displacement of the pendulum. Also the arm must not obstruct the pendulum’s
movement in any manner. The arm itself is a simple fork constructed out of 1/2” steel
conduit as seen in figure 5. The arm attaches to the driving mechanism through an
amplitude selection bar, which has several holes in it for adjusting the amplitude of the
pendulum’s displacement.
1
Measuring the Center of Mass
Determining the pendulum’s energy from the video images requires knowledge of
the pendulum’s center of mass. This method implements the law of the lever and a force
probe. The pendulum is affixed to a stationary axle and a force probe is attached to the
other end. When the pendulum is perfectly horizontal, the formula below gives the
distance from the bearing to the center of mass.
Figure 9 The setup for determining the center of mass of a pendulum arm.
In equilibrium, the sum of the torques on the pendulum arm is zero.
0
0
=×+×
=∑
grFLi
rrrrτ
Taking the magnitudes of the cross products and solving for r gives
mgLFr =
where m is the mass of the pendulum arm. The value of g for Harrisonburg, VA is
2800.9sm
. The centers of mass for the individual pendulum arms are
Upper Pendulum = 0.1828 ± 0.002m
Lower Pendulum = 0.1509 ± 0.003m
1
Measuring the Moment of Inertia
Determining a pendulum’s energy also requires a moment of inertia value. Due to
the complicated shapes involved in the construction of the pendulum’s arms, the value
was determined experimentally.
Figure 10 The experiment for measuring the moment of inertia of a pendulum arm.
The picture above is the experimental setup. The central axis of a plastic bar with
a known moment of inertia is clamped at a position to intersect the center of mass of the
pendulum. The entire setup rolls down a slight incline. The work done by gravity creates
translational and rotational kinetic energy. Conservation of energy determines the
pendulum’s moment of inertia.
2
22ω
mvymgIcm−Δ
=
plasticbarcmpendcm III −=
2mrII pendcmpend +=
where
m = mass of the pendulum g = acceleration from gravity Δy = change in height of the pendulum’s center of mass v = translational velocity of the pendulum’s center of mass ω = angular frequency Icm = moment of inertia of the pendulum and the plastic bar
1
Ipendcm = moment of inertia of the pendulum about the center of mass Ipend = moment of inertia of the pendulum about the bearing Iplasticbar = moment of inertia of the plastic bar r = distance to the center of mass from the pendulum’s bearing
The moments of inertia for both pendulum arms are
Iupper = 0.05689± 0.006 kgm2
Ilower = 0.02299± 0.002 kgm2
Figure 11 A sequence of images from an actual moment of inertia data run. These images are appropriate for the image analysis program.
1
Figure 12 A sequence of images demonstrating the data collection technique. Notice the rotation of the pendulum arm and the change in height of the pendulum assembly
1
Double Pendulum Image Analysis Program
The overall goal of the pendulum image analysis program is to recognize the
individual pendulum arms and to calculate their position within the image. A copy of the
program’s source code is in Appendix A.
Figure 13 A single pendulum image captured by the high-speed camera.
The figure above is an example of an image captured by the high-speed camera during a
data run. There are several basic digital image analysis processes used in the pendulum
tracking program to analyze this image.
Threshold- The high-speed camera captures greyscale images, which store each pixel's
color data in a byte. The pixel can have any value from 0 to 255. A threshold is a simple
operation that sets every pixel below a certain value to zero and every value above to
255. The image is now simply black and white, which simplifies the remaining
operations.
Figure 14 The same image after the threshold operation.
1
Erosion- This process uses a structuring element to remove objects equal to or less than
the size of the structuring element. The shape of the structuring element is arbitrary. The
pendulum tracking program uses a circular element to fit the LED arrays.
Dilation- This process is the opposite of erosion, but instead of removing objects, dilation
fills in objects less than the structuring element size. The program dilates each image
several times to obtain large white circles. This process ensures that subsequent
operations will not miss the LED arrays in the image.
Figure 15 The image after an erosion and dilation operation.
Watershed- This operation locates boundaries between distinct regions in an image. Each
pendulum image must be inverted before being passed to this operation. The watershed
treats the black regions of an image as valleys. It then takes the gradient of the image.
The high regions between the low regions are distinguished as the boundaries. The
various regions are assigned different colors.
Figure 16 The image after a watershed operation.
1
Center of mass- The program applies the formulas below to locate each LED array’s
center of mass.
∑=i
icm xarea
x 1 ∑=
iicm y
areay 1
where xi is the x-coordinate and yi is the y-coordinate of a white pixel within a region
defined by the watershed operation. The area is the total number of white pixels in each
region.
Figure 17 The original image with an outline surrounding the distinct pendulum axles. The black dots in the lights are the calculated center of mass locations.
Chapter 3
Discussion and Results
Damping Coefficient
The study of physical pendulums must include an experimental determination of
the nature of the damping acting on the systems (there are several common types of
damping and each result in a different equation of motion). The experiment involves
analysis of individual free decays of the upper and lower pendulums. In order to model
the experiment, assume coulombic friction, (i.e., a retarding torque of constant
magnitude), so that the change in energy is proportional to the angular speed.
dtdtdAEE
dtdA
dtdE
∫−=
−=
θ
θ
0
where dtdtd∫
θis the total arc traveled by the pendulum during a data run. This shows that
if the energy versus the total arc traveled graph is linear then the assumed coulombic
friction is correct. To obtain the graphs below, several data runs were taken in a range of
initial amplitudes
[0.5133,0.8534] radians for the upper pendulum
[0.3003,0.6097] radians for the lower pendulum
to ensure that the results are independent of amplitude.
19
20
Figure 18 Energy versus total arc traveled for the upper pendulum arm. The relationship is linear. We attribute the excursions of the energy values from the best-fit line to measurement error in the moment of inertia, center of mass, and theta values.
Figure 19 Energy versus total arc traveled for the lower pendulum. This relationship is also linear.
The above graphs show that a linear relationship does exist between the energy and the
total arc traveled for both the upper and lower pendulum arms. Fitting a line to several
data sets gives friction coefficients of
Aupper = 2.809E-3 ± 1.75E-4 J/rad
Alower = 4.238E-4 ± 7.32E-6 J/rad
The difference in the values is not significant.
21
These values are the end result of the damping coefficient experiment.
Preliminary studies showed more than one type of damping and provided the impetus for
building a massive lower pendulum. Initially, the graph of energy versus the total for the
lower pendulum did not fit the linear model.
Figure 20 The energy versus total arc traveled graph for the lower pendulum with a smaller moment of inertia..
This graph shows some curvature. A possible reason is air resistance. Increasing the
moment of inertia for the lower pendulum so that it became more comparable to the
upper pendulum’s created the graph shown in figure 19.
Figure 21 The lower pendulum with the larger moment of inertia is on the left.
22
Periodicity of a Driven Single Pendulum
In the state space for a sinusoidally driven single pendulum, we can expect that
some trajectories will exhibit chaotic behavior and some do not. The testing phase of this
experiment did not reveal any chaotic behavior. However, we did observe period
doubling for a driving frequency of 1.79Hz and a driving amplitude of 5.40cm. The
graphs are below.
Figure 22 Theta versus time for a driven single pendulum.
Figure 23 Omega versus theta for a driven single pendulum.
Figure 22 shows theta versus time for a driven single pendulum. This motion has a
single period which is twice the period of the driving. Figure 23 shows the entire
23
trajectory the pendulum sweeps out in phase space during one period of the driving.
Figure 23 contrasts period one motion, which would simply be a single ellipse in phase
space.
Experiments obtained other periods as well, but the data is less convincing.
Below is a possible period four graph. This type of motion may result from period two
motion bifurcating into period four motion. This is a period doubling bifurcation and is a
possible route to chaos. Results such as figure 24, while not compelling, do suggest that
more experimental work will yield chaotic behavior of the driven single pendulum.
Figure 24 Possible period four motion.
24
Transient Motion
The equation of motion for a driven single pendulum is not only nonlinear but
also inhomogeneous. Some terms in the equation will damp out over time due to the
friction in the system. The general solution thus has two different phases: a transient
solution that damps out over time and a steady state solution that persists through time.
The graphs below depict theta versus time for two separate driven single pendulum data
runs. The graphs show the transient solutions, which eventually dampen out, and the
steady state solutions, which dominate the motion after the transients.
Figure 25 Transient solutions are easily visible in this graph. The system settles to a steady state around 40 seconds.
Figure 26 A close-up of the transients solutions in Figure 25.
25
Figure 27 Another image depicting transient solutions. The system again settles to a steady state around 40 seconds.
Figure 28 A close-up of the transient solutions of figure 27.
26
Sinusoidal Nature of the Top Axle Displacement
By graphing the displacement of the top axle versus time, we have verified that
the design of the driving mechanism is robust enough to maintain a purely sinusoidal
motion of the top axle in spite of the reaction forces due to various motions of the
pendulum.
Figure 29 The displacement of the top axle position versus time. The motion is sinusoidal and uniform.
Figure 30 A Fourier transform of the data in figure 29. The single spike indicates that the time dependence of the position of the top axle is both periodic and sinusoidal.
27
Sensitivity to Initial Conditions
Aperiodic behavior is impossible to establish experimentally because it requires
an experiment of infinite duration. However, experiments can show sensitivity to initial
conditions. The images below depict three data runs of an undriven double pendulum.
Each time the double pendulum is starting from very nearly the same initial conditions,
but as time progresses, the behavior of the pendulums diverge.
Figure 31 Theta one versus time for three undriven double pendulum data runs. The individual motions differ from each other after only a few seconds.
Figure 32 A plot of the same data from Figure 31 over a longer time scale.
28
Figure 33 Theta two versus time for the same three undriven double pendulum data runs. The apparent discontinuities in the graph are where the lower pendulum flips over the axle. Again, the individual motions quickly differ from each other.
Figure 34 The data from figure 33 on a longer time scale to demonstrate the complete disagreement in the motion of the three experiments.
29
Driven Double Pendulum
Here we report on testing of the driven double pendulum, for which experimental time
was very limited. The system does present the possibility of desirable experiments, such
as determining the attractor of the driven double pendulum. The graphs below show
transient and steady state motion.
Figure 35 Theta one versus time and theta two versus time.
Figure 35 shows the transient solutions to a driven double pendulum with initial
conditions of zero radians for theta one and theta two and zero rad/s for omega one and
30
omega two. The amplitude of each angle steady increases until the lower pendulum
begins to flip about its axle. Eventually the double pendulum settled to a steady state,
which the graphs below depict.
Figure 36 Theta two versus theta one for steady state motion
Figure 36 is a state space diagram of theta one versus theta two. It shows that the motion
of the double pendulum in its steady state is a simple oscillation. Both arms reach their
maximum and minimum locations at the same time. Theta two does travel through a
larger arc than theta one though, as figures 37 and 38 show.
Figure 37 Theta one versus time for a driven double pendulum in steady state motion
Chapter 4
Conclusions
The design and fabrication of an apparatus capable of testing several pendulum
designs has been completed. Parameter values of the single and double pendulums
(moments of inertia, masses, center of mass locations, and damping coefficients) have
been determined. The data collection techniques and the pendulum image analysis
program are also complete. Initial experiments demonstrate that the pendulum designs
perform according to expectations.
The project is ready for extensive data collection. Also, the parameter values
from this experiment may be implemented in numerical simulations by others who will
continue this project.
32
Appendix A
Pendulum Image Analysis Program Source Code Language: IDL 6.4
pro ledTestMomentInertia ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Author: Daniel Kelly ; Date: 3.30.2008 ; ; This program analyzes images from a moment of inertia data run and ; outputs the center of mass locations for two white spots within a ; black image. A moment of inertia data run includes attaching two LED ; arrays to an object, one at the center of mass and another displaced ; from the center of mass. The object is then recorded as it is rolled ; down a slight incline. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Declare float variables disc = 0. ;The structure element r = 2. ;The radius of the structure element timeStep = 1/30. ;The time in between images from the data run. totaltime = 0. ;The total time elapsed in the data run ;String variables greeting='string' ;Gives user the program description folder = 'string' ;The folder containing the images to analyze ;Integer variables area0 = 0 ;Area of white space in region 0 area1 = 0 ;Area of white space in region 1 area2 = 0 ;Area of white space in region 2 area3 = 0 ;Area of white space in region 3 area4 = 0 ;Area of white space in region 4 region0x = 0 ;Tally of white space x-coordinates in region 0 region0y = 0 ;Tally of white space y-coordinates in region 0 region1x = 0 ;Tally of white space x-coordinates in region 1 region1y = 0 ;Tally of white space y-coordinates in region 1 region2x = 0 ;Tally of white space x-coordinates in region 2 region2y = 0 ;Tally of white space y-coordinates in region 2 region3x = 0 ;Tally of white space x-coordinates in region 3 region3y = 0 ;Tally of white space y-coordinates in region 3 region4x = 0 ;Tally of white space x-coordinates in region 4 region4y = 0 ;Tally of white space y-coordinates in region 4 index = 0 ;Value used in ensuring the correct output sequence numberRegions = 0 ;Stores the number of regions in the watershed ;Create a disc of radius r disc = SHIFT(DIST(2*r+1), r, r) LE r ;Greet the user
33
34 greeting=dialog_message("Welcome to the moment of inertia analyzer." $ + 'Please select the folder containing the'$ + ‘bitmap images to analyze', /information) ;User selects which folder of images to analyze folder = dialog_pickfile(/directory) ;Outpprint,folder
ut the folder name
;Create a file for position output writePos = folder + "positions.txt" ;Open heopenw, 3, writePos
t file for output
;Create a string containing all bitmap file names pics = file_search(folder + "\*.bmp") ;Get the amount of pictures in the array length = n_elements(pics) ;Fo p hrou h all for j = 0, length-1 do begin
r loo cycles t g the images
;Open the picture a = read_bmp(pics[j]) ;Create a copy of the image a1 = a ;Threshold the image a1 = threshold(a1,100) ;Create a copy of the thresholded image and dilate it many times a1 b = for k = 0, 13 do begin b = dilate(b, disc, /gray) endfor ;Invert the image c = MAX(b1) - b1 ;Remove any holes less than the size of the structuring element c = MORPH_CLOSE(c,disc, /GRAY) ;Create a watershed image d = WATERSHED(c,nregions = numberRegions, connectivity = 8) ;Merge original image with boundaries of watershed regions e = a > (MAX(a) * (d EQ 0b)) ;Display the image tvscl, e ;Reset new process variables region0x = 0
35 region0y = 0 region1x = 0 region1y = 0 region2x = 0 region2y = 0 region3x = 0 region3y = 0 region4x = 0 region4y 0 = area0 = 0 area1 = 0 area2 = 0 area3 = 0 area4 = 0 ;Create distinct regions from watershed image d region0 = where(d eq 0) region1 = where(d eq 1) region2 = where(d eq 2) region3 = where(d eq 3) region4 = where(d eq 4) ;Transform single arrays back into double arrays region0Column = region0 MOD getWidth(a) region0Row = region0 / getWidth(a) region1Column = region1 MOD getWidth(a) region1Row = region1/getWidth(a) region2Column = region2 MOD getWidth(a) region2Row = region2/getWidth(a) region3Column = region3 MOD getWidth(a) region3Row = region3/getWidth(a) region4Column = region4 MOD getWidth(a) region4Row = region4 / getWidth(a) ;C on 0 r whit spaceif region0[0] ne -1 then begin heck regi fo e s
for i=long(0),long(N_elements(region0Column)-1) do begin if a1[region0Column[i], region0Row[i]] eq 255 then begin region0x += region0Column[i] region0y += region0Row[i] area0++ endif endfor if area0 ne 0 then begin region0x = region0x/area0 region0y = region0y/area0
endif endif ;C on 1 r whit spaceif region1[0] ne -1 then begin heck regi fo e s
for i = long(0), long(N_elements(region1Column)-1) do begin if a1[region1Column[i], region1Row[i]] eq 255 then begin region1x += region1Column[i] region1y += region1Row[i] area1++
36 endif endfor if area1 ne 0 then begin region1x = region1x/area1 region1y = region1y/area1 endif endif ;C on 2 r whit spaceif region2[0] ne -1 then begin heck regi fo e s
for i = long(0), long(N_elements(region2Column)-1) do begin if a1[region2Column[i], region2Row[i]] eq 255 then begin region2x += region2Column[i] region2y += region2Row[i] area2++ endif endfor
if area2 ne 0 then begin region2x = region2x/area2 region2y = region2y/area2
endif endif ;C on 3 r whit spaceif region3[0] ne -1 then begin heck regi fo e s
for i = long(0), long(N_elements(region3Column)-1) do begin if a1[region3Column[i], region3Row[i]] eq 255 then begin region3x += region3Column[i] region3y += region3Row[i] area3++ endif
endfor if area3 ne 0 then begin
region3x = region3x/area3 region3y = region3y/area3
endif endif ;C on 4 r whit spaceif region4[0] ne -1 then begin heck regi fo e s
for i = long(0), long(N_elements(region4Column)-1) do begin if a1[region4Column[i], region4Row[i]] eq 255 then begin region4x += region4Column[i] region4y += region4Row[i] area4++ endif endfor if area4 ne 0 then begin region4x = region4x/area4 region4y = region4y/area4 endif endif ;Create an array containing all of the areas test = [area0, area1, area2, area3, area4] ;Reset index variable
37 index = 0 ;Sort the test array and locate the index of largest
;variable index variable is all that matters in this step, ;not the dummyResult
dummyResult = max(test,index) ;Effectively remove the largest value from the test area test[index] = -1 ;Test to see if the image has 3 distinct regions corresponding to ; two white spaces and the background. Skip the output step if
;the image fails this test condition if numberRegions eq 3 then begin ;Output largest area first case index OF 0 printf, 3 '(I5,I5,$)' : , region0x, region0y, format = 1:printf, 3, region1x, region1y, format = '(I5,I5,$)' 2:printf, 3, region2x, region2y, format = '(I5,I5,$)' 3 printf, 3 '(I5,I5,$)' : , region3x, region3y, format = 4:printf, 3, region4x, region4y, format = '(I5,I5,$)' endcase ;Sort the test array and locate the index of largest
;variable index variable is all that matters in this step, ;not the dummyResult
dummyResult = max(test,index) ;Effectively remove the largest value from the test area test[index] = -1 put nex argest area ;Out t l case index OF 0:printf, 3, region0x, region0y, format = '(I5,I5,$)' 1:printf, 3 '(I5,I5,$)' , region1x, region1y, format = 2:printf, 3, region2x, region2y, format = '(I5,I5,$)' 3:printf, 3, region3x, region3y, format = '(I5,I5,$)' 4 printf, 3, region4x, region4y, format = '(I5,I5,$)' : endcase t totaltime and proceed to the next output line ;Print he printf, 3, totaltime endif ;Increment totaltime totaltime = totaltime + timeStep ;End the main for loop endfor ;Close the output file after the main for loop terminates close,3 ;Signal the user that the program has finished executing print, "DONE" end
38 pro doublePendulum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Author: Daniel Kelly ; Date: 3.30.2008 ; ; This program analyzes images from a double pendulum data run and ; outputs the center of mass locations for three white spots within a ; black image. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Initialize variables timeStep = 1/30. ;The time step in between successive images totaltime = 0 ;The total time elapsed r = 2 ;Radius of disc skip = 0 ;Check condition for image analysis ;Create a disc of radius r disc = SHIFT(DIST(2*r+1), r, r) LE r ;Greet the user result=dialog_message("Welcome to the single pendulum image analyzer."$ +"Please select the folder containing the bitmap images" $ +"to analyze", /information) ;Prompt the user for input folder = dialog_pickfile(/directory) ;Output the selected folder print,folder ;Create a file for outputting center of mass locations writePos = folder + "positions.txt" ;create a string containing all files pics = file_search(folder + "\*.bmp") ;get the amount of pictures in the array length = n_elements(pics) ;open a file to output to openw, 3, writePos ;For loop cycles through all the images for j = 0, length-1 do begin ;Open the picture a = read_bmp(pics[j]) ;Create a copy of the image a1 = a ;Threshold the image a1 = threshold(a1,100) ;Create a copy of the thresholded image and dilate it many times b = a1 for k = 0, 13 do begin
39 b = dilate(b, disc, /gray) endfor ;Invert the image c = MAX(b1) - b1 ;Remove any holes less than the size of the structuring element c = MORPH_CLOSE(c,disc, /GRAY) ;Create a watershed image d = WATERSHED(c,nregions = numberRegions, connectivity = 8) ;Merge original image with boundaries of watershed regions e = a > (MAX(a) * (d EQ 0b)) ;Display the image tvscl, e if numberRegions eq 4 then begin ;Reset new process variables region0x = 0 region0y = 0 region1x = 0 region1y = 0 region2x = 0 region2y = 0 region3x = 0 region3y = 0 region4x = 0 region4y = 0 area0 = 0 area1 = 0 area2 = 0 area3 = 0 area4 = 0 ;Create distinct regions from watershed image d region0 = where(d eq 0) region1 = where(d eq 1) region2 = where(d eq 2) region3 = where(d eq 3) region4 = where(d eq 4) ;Transform single arrays back into double arrays region0Column = region0 MOD getWidth(a) region0Row = region0 / getWidth(a) region1Column = region1 MOD getWidth(a) region1Row = region1/getWidth(a) region2Column = region2 MOD getWidth(a) region2Row = region2/getWidth(a) region3Column = region3 MOD getWidth(a) region3Row = region3/getWidth(a) region4Column = region4 MOD getWidth(a) region4Row = region4 / getWidth(a) ;Check region 0 for white spaces
40 if region0[0] ne -1 then begin for i=long(0),long(N_elements(region0Column)-1) do begin if a1[region0Column[i], region0Row[i]] eq 255 then begin region0x += region0Column[i] region0y += region0Row[i] area0++ endif endfor if area0 ne 0 then begin region0x = region0x/area0 region0y = region0y/area0 endif endif ;Check region 1 for white spaces if region1[0] ne -1 then begin for i long(0), long(N_elements(region1Column)-1 do begin = ) if a1[region1Column[i], region1Row[i]] eq 255 then begin region1x += region1Column[i] region1y += region1Row[i] area1++ endif endfor if area1 ne 0 then begin region1x = region1x/area1 region1y = region1y/area1 endif endif ;Check region 2 for white spaces if region2[0] ne 1 then begin - for i = long(0), long(N_elements(region2Column)-1) do begin if a1[region2Column[i], region2Row[i]] eq 255 then begin region2x += region2Column[i] region2y += region2Row[i] area2++ endif endfor
if area2 ne 0 then begin region2x = region2x/area2 region2y = region2y/area2 endif endif ;C on 3 r whit spaceif region3[0] ne -1 then begin heck regi fo e s
for i = long(0), long(N_elements(region3Column)-1) do begin if a1[region3Column[i], region3Row[i]] eq 255 then begin region3x += region3Column[i] region3y += region3Row[i] area3++ endif
endfor
41
if area3 ne 0 then begin region3x = region3x/area3 region3y = region3y/area3 endif endif ;Check region 4 for white spaces if region4[0] ne -1 then begin for i long(0), long(N_elements(region4Column)-1 do begin = ) if a1[region4Column[i], region4Row[i]] eq 255 then begin region4x += region4Column[i] region4y += region4Row[i] area4++ endif endfor if area4 ne 0 then begin region4x = region4x/area4 region4y = region4y/area4 endif endif
;Create an array containing all of the arrays test = [area0,area1,area2,area3,area4]
;Create an array containing the center of mass locations locations = [region0x,region0y,region1x,region1y,region2x,$ region2y,region3x,region3y,region4x,region4y] ;Sort the array order = sort(test) ;Check to see if one of the pendulums is in proximity of the bar
;that obstructs the view of the pendulum if locations[2*order[2]+1] < locations[2*order[4]+1]-6 and $
tions[2*order[2]+1] gt locations[2*order[4]+1] – 82 $ loca then skip = 1 if locations[2*order[3]+1] < locations[2*order[4]+1]-6 and locations[2*order[2]+1] gt locations[2*order[4]+1] - 82 $ then skip = 1 ;Check to see if the current image is acceptable if skip eq 0 then begin ;Sort the test array and locate the index of largest
;variable index variable is all that matters in this step, ;not the dummyResult
dummyResult = max(test,index) ;Effectively remove the largest value from the test area test[index] = -1 put lar t area first ;Out ges case index OF 0:printf, 3, region0x, region0y, format = '(I5,I5,$)' 1:printf, 3, region1x, region1y, format = '(I5,I5,$)'
42 2:printf, 3, region2x, region2y, format = '(I5,I5,$)' 3:printf, 3, region3x, region3y, format = '(I5,I5,$)' 4:printf, 3, region4x, region4y, format = '(I5,I5,$)' endcase ;Sort the test array and locate the index of largest
;variable index variable is all that matters in this step, ;not the dummyResult
dummyResult = max(test,index) ;Effectively remove the largest value from the test area test[index] = -1 put nex argest area ;Out t l case i OF ndex 0:printf, 3, region0x, region0y, format = '(I5,I5,$)' 1:printf, 3, region1x, region1y, format = '(I5,I5,$)' 2 printf, 3 '(I5,I5,$)' : , region2x, region2y, format = 3:printf, 3, region3x, region3y, format = '(I5,I5,$)' 4:printf, 3, region4x, region4y, format = '(I5,I5,$)' endcase ;Sort the test array and locate the index of largest
;variable index variable is all that matters in this step, ;not the dummyResult
dummyResult = max(test,index) ;Effectively remove the largest value from the test area test[index] = -1 ;output smallest area case index OF 0 printf, 3 '(I5,I5,$)' : , region0x, region0y, format = 1:printf, 3, region1x, region1y, format = '(I5,I5,$)' 2:printf, 3, region2x, region2y, format = '(I5,I5,$)' 3 printf, 3 '(I5,I5,$)' : , region3x, region3y, format = 4:printf, 3, region4x, region4y, format = '(I5,I5,$)' endcase ;Output the total time elapsed and advance to the next line
;of the output file printf, 3, totaltime endif endif ;Reset the skip variable for analyzing the next image skip = 0 ;Increment the total time totaltime = totaltime + timeStep endfor ;Close the output file close,3 ;Signal the user that the program has finished print, "DONE" end
43 pro calculationsMomentInertia ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Author: Daniel Kelly ; Date: 3.30.2008 ; ; This program takes the position data from a moment of inertia data ; run and calculates the moment of inertia about the center of mass for ; the object in the data run. The program outputs all of the ; calculated values. Omega * r should be compared to the velocity of ; the center of mass to check rolling without ;slipping constraints. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Declare float variables timeStep = 1/30. ;The time between subsequent frames pixelsToMetersConversion = (523/12)*39.37 ;The conversion factor velocity = 0 ;The velocity of the center of mass omega = 0 ;The angular frequency of the pendulum gravity = 9.80 ;Local value of g height = 0 ;The change in height mass = 3.5/gravity ;Mass of the plastic bar mass = mass + .597228 ;Mass of plastic bar + pendulum ;Greet the user result=dialog_message("Welcome to the moment of inertia calculation” $
+ ” program”, /information) ;User selects the position.txt file to analyze data=dialog_pickfile(/read, path = "K:\Lab Assistant\doublePendulum",$ Title = "Please pick the file containing the data to analyze", $ GET_PATH = position) ;Output the selected file print,data ;Create two files for output dat writePos = position + "positionData.txt" frequencyData = position + "momentInertiaData.txt" ;Open heopenr, 3, data
t files
openw, 5, writePos openw, 7, frequencyData ;Count the number of lines in the data file nLines = file_lines(data) ;Create arrays to store data from file positions1 = intarr(2*nLines) ;Coordinates of the center of mass axle positions2 = intarr(2*nLines) ;Coordinates of the displace axle times = dblarr(nLines) ;Current time values theta1 = dblarr(nLines) ;Values of theta ;Fo p hrou h posifor i = 0, nLines-1 do begin
r loo cycles t g tions.txt file
;Read data from the file
44 readf, 3, x,y,x1,y1,thisTime,format ='(I5,I5,I5,I5,D13)' ;Store x corrdinate of center of mass axle positions1[2*i] = x ;Store y coordinate of center of mass axle positions1[(2*i+1)] = y ;Store x coordinate of displaced axle positions2[2*i] = x1 ;Store y coordinate of displace axle positions2[2*i+1] = y1 ;Store the time times[i] = thisTime endfor ;Calculate theta for i = long(0), long(countUpTo) do begin theta1[i] = getTheta2(positions2[2*i],positions2[2*i+1] $ ,positions1[2*i],positions1[2*i+1]) endfor ;Create arrays for holding calculated values omegas1 = dblarr(n_elements(theta1)-2) ;Calculate omega for i = 0, n_elements(omegas1) - 1 do begin oendfor
megas1[i] = (theta1[i+2] - theta1[i])/(2*timeStep)
;Remove values of theta1 and times that do not coincide with an omega1 ;value theta1 = theta1[1:N_ELEMENTS(theta1)-2] times = times[1:N_ELEMENTS(times)-2] ;Output the position data for i 0 n_elements(theta1)-1 do begin = , printf,5,times[i],omegas1[i],theta1[i] endfor ;Calculate the velocity lengthPositions = n_elements(positions1) ;The length of positions1 array lengthTime = n_elements(times) ;The length of times array lengthOmega = n_elements(omegas1) ;The length of omegas1 array ;Calculate the velocity of the center of mass through the formula ; sqrt(sqrt((xF - xI)^2 + (yF - yI)^2)/(tF-tI)) ; Also convert pixels to meters. velocity=sqrt((sqrt(((positions1[0] - positions1[lengthPositions-2]) $ /pixelsToMetersConversion)^2 + ((positions1[1] - $ positions1[lengthPositions-1]))/pixelsToMetersConversion)^2) $ /(times[lengthTime-1]-times[0])) ;Find the final value for omega. This program does not accomodate for
45
; the rotating axle spinning around. Occasional values of theta may be ; negative due to this. The while loop ensures a positive for omega is ; obtained omega = omegas1[lengthOmega-1] while omega gt 0 do begin lengthOmega -= 1 omega = omegas1[lengthOmega - 1] endwhile ;Calculate the center of mass's change in height and convert pixels to ; meters height = (positions1[1]-positions1[lengthPositions-1])/pixelsToMetersConversion ;Calculate the moment of inertia momentInertia = (2*mass*gravity*height-mass*velocity^2)/omega^2 ;Outpu tprintf,7, 'velocity = ', velocity
t he data
printf,7, 'omega = ', omega printf,7 'mass = ', mass , printf,7, 'height = ', height printf,7, 'omega*r = ', omega*.0142875 printf,7, 'moment of interia = ', momentInertia ;Clos the inclose, 3,5,7
e put and output files
;Signal that the program is finished print, "DONE" end
46 pro calculationsSinglePendFreeDecay ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Author: Daniel Kelly ; Date: 3.30.2008 ; ; This program accepts position data from a single pendulum data run ; and outputs the experimental data. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Initialize variables timeStep = 1/30. ;The time step between images rotation = 0.02 ;The value to rotate and correct images pi = 3.14159 ;Value of pi gravity = 9.800 ;Local value of g for Harrisonburg, VA ;mass = 0.9220017 ;Mass upper pendulum without battery ;mass = 0.9761 ;Mass upper pendulum with battery mass = 0.597228 ;Mass lower pendulum ;centerMass = 0.1577340001608 ;Center of Mass upper arm without battery ;centerMass = 0.1828 ;Center of mass upper arm with battery centerMass = 0.150913 ;Center of mass lower pendulum ;momentInertia = 0.056885 ;moment inertia upper pendulum momentInertia = 0.022988 ;moment inertia lower pendulum totalArc = 0 ;Total arc traveled by the pendulum ;Prompt the user for input result = dialog_message("Welcome to the single pendulum calculation” $
+ ” program”, /information) data=dialog_pickfile(/read, path = "K:\Lab Assistant\doublePendulum", $ Title = "Please pick the file containing the data to analyze",$ GET_PATH = position) ;Output the selected file name print,data ;Open file to write experimental data to writePos = position + "positionData.txt" ;Open the input and output files openr, 3, data openw, 5, writePos ;Count the number of lines in the data file nLines = file_lines(data) ;Create arrays to store data fsrom file positions1 = intarr(2*nLines) positions2 = intarr(2*nLines) position intarr(2*nLines) s3 = times = dblarr(nLines) theta1 = dblarr(nLines) theta2 = dblarr(nLines) periods1 = dblarr(nLines) periods2 = dblarr(nLines) topAxlePosition = intarr(nLines) ;Read data from file for i = 0, nLines-1 do begin
47 readf, 3, x,y,x1,y1,thisTime,format ='(I5,I5,I5,I5,D13)' positions1[2*i] = x positions1[(2*i+1)] = y positions2[2*i] = x1 positions2[2*i+1] = y1 times[i] = thisTime endfor ;Se e onen of thfor k = 0, nLines - 1 do begin
parat the x comp t e top axle position
topAxlePosition[k] = positions1[2*k] endfor ;Ca te t etfor i = long(0), long(countUpTo) do begin
lcula h a
theta1[i] = getTheta2(positions2[2*i],positions2[2*i+1],$ positions1[2*i],positions1[2*i+1])
endfor ;Rotate theta theta1 = theta1 - rotation ;Create arrays for holding calculated values omegas1 = dblarr n_elements theta1)-2( ( ) energies = dblarr(n_elements(theta1)-2) ;Calculate omega for i = 0, n_elements(theta1)-3 do begin omegas1[i] = (theta1[i+2] - theta1[i])/(2*timeStep) endfor ;Adjust the theta1 and times arrays to eliminate values that ; do not correspond to omegas1 and energies values theta1 = theta1[1:N_ELEMENTS(theta1)-2] times = times[1:N_ELEMENTS(times)-2] ;Calculate the energy for i = 0, n_elements(theta1)-1 do begin energies[i]= mass*gravity*centerMass*(1-cos theta1[i]))+ $ ( .5*momentInertia*omegas1[i]^2 endfor ;Output calculated data for i = 0, n_elements(theta1)-1 do begin ;Increment the total arc totalArc += abs(theta1[i]) ;Print data to file 5 printf,5,times[i],omegas1[i],theta1[i],energies[i],totalArc endfor ;Signal that the program is finished print, "DONE" ;Close the input and output files close, 3,5,7 end
48 pro calculationsDoublePendulum ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Author: Daniel Kelly ; Date: 3.30.2008 ; ; This program accepts the positions.txt file from a double pendulum ; data run and calculates the experimental values. It outputs these ; values to a positionsData.txt file in the same folder as the data run ; images. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Initialize variables timeStep = 1/30. ;The time step between images pi = 3.14159 ;Value of pi gravity = 9.800 ;Local value of g rotationTheta1 = 0;.021548389 ;Value to rotate theta1 by rotationTheta2 = -0;.02040533 ;Value to rotate theta2 by ;mass = 0.9220017 ;Mass upper arm without battery ;mass = 0.9761 ;Mass upper pendulum with battery mass = 0.597228 ;Mass lower pendulum ;centerMass = 0.1577340001608 ;Center of Mass arm without battery centerMassUpper = 0.1828 ;Center of mass upper arm with battery centerMassLower = 0.150913 ;Center of mass lower pendulum momentInertiaUpper = 0.056885 ;moment inertia upper pendulum momentInertiaLower = 0.022988 ;moment inertia lower pendulum totalArc = 0 ;Total arc traveled by the pendulum ;Greet the user result = dialog_message("Welcome to the double pendulum calculation” $
+ ” program”, /information) ;Prompt user for input data=dialog_pickfile(/read, path = "K:\Lab Assistant\doublePendulum", $ Title = "Please pick the file containing the data to analyze",$ GET_PATH = position) ;Output the selected file name print,data ;Create a file for outputting experimental values to writePos = position + "positionData.txt" ;Open the input and output files openr, 3, data openw, 5, writePos ;Count the number of lines in the data file nLines = file_lines(data) ;Create arrays to store data fsrom file positions1 = intarr(2*nLines) positions2 = intarr(2*nLines) positions3 = intarr(2*nLines) times = dblarr(nLines) theta1 = dblarr(nLines) theta2 = dblarr(nLines) periods1 = dblarr(nLines)
49 periods2 = dblarr(nLines) topAxlePosition = intarr(nLines) ;Read data from file for i = 0, nLines-1 do begin readf, 3, x,y,x1,y1,x2,y2,thisTime, $
format ='(I5,I5,I5,I5,I5,I5,D13)' positions1[2 ] x *i = positions1[(2*i+1)] = y positions2[2*i] = x1 positions2[2*i+1] = y1 positions3[2*i] = x2 positions3[2*i+1] = y2 tendfor
imes[i] = thisTime
;Se e onen of thfor k = 0, nLines - 1 do begin
parat the x comp t e top axle position
topAxlePosition[k] = positions1[2*k] endfor ;Ca te t etfor i = long(0), long(countUpTo) do begin
lcula h a
theta1[i] = getTheta2(positions2[2*i],positions2[2*i+1],$ positions1[2*i],positions1[2*i+1]) theta2[i] = getTheta2(positions3[2 2 1*i],positions3[ *i+ ],$ positions2[2*i],positions2[2*i+1]) endfor ;Rotate both angles by a predetermined amount theta1 = theta1 - rotationTheta1 theta2 = theta2 - rotationTheta2 ;Create arrays for holding calculated values omegas1 = dblarr(n_elements(theta1)-2) omegas2 = dblarr(n_elements(theta1)-2) energies = dblarr(n_elements(theta1)-2) ;Calculate omega and check to see if the pendulum flipped over during ;its motion for i = 0, countUpTo-2 do begin ;Check to see if an image has been skipped by checking the time
;lapsed timeDuration = times[i+2] - times[i] ;Check to see if the time duration is within the time step and
;account for floating ; point error
if timeDuration lt 2.1*timestep and timeDuration gt $ 1.9*timestep then begin
;Calculate omega if an image has not been skipped omegas1[i] = (theta1[i+2] - theta1[i])/(2*timestep) omegas2[i] = (theta2[i+2] - theta2[i])/(2*timestep)
50
;Check to see if the top pendulum flipped over if abs(omegas1[i]) gt pi then begin
if omegas1[i] lt 0 then omegas1[i] = pi + omegas1[i]$ else omegas1[i] = omegas1[i] - pi
endif ;Check to see if the bottom pendulum flipped over if abs(omegas2[i]) gt pi then begin
if omegas2[i] lt 0 then omegas2[i] = pi + omegas2[i]$ else omegas2[i] = omegas2[i] - pi
endif endif else begin ;If an image was skipped then set the omega value to
;something absurd so that it can be recognized and removed omegas1[i] = 1000. omegas2[i] = 1000. endelse endfor ;Adjust the arrays so that the values line up theta1 = theta1[1:N_ELEMENTS(theta1)-2] theta2 = theta2[1 N_ELEMENTS(theta2)-2] :times = times[1:N_ELEMENTS(times)-2] ;Remove values of omegas, theta, and times where an image was skipped valuesToKeep1 = where(omegas1 ne 1000) valuesToKeep2 = where(omegas2 ne 1000) omegas1 = omegas1[valuesToKeep1] omegas2 = omegas2[valuesToKeep2] theta1 = theta1[valuesToKeep1] theta2 = theta2[valuesToKeep2] ;Calculate the energy ;for i = 0, countUpTo-2 do begin ; energies[i] = mass*gravity*centerMass*(1-cos(theta1[i]))+ $ .5*omegas1[i]^2*ratio1*mass*gravity*centerMass ;endfor ;Output the data for i = 0, n_elements(theta1)-1 do begin ;Increment the total arc totalArc += abs(theta1[i]) t ata to file 5 ;Outpu d printf,5,times[i],theta1[i],theta2[i],omegas1[i],omegas2[i];,energies[i],totalArc endfor ;Close the input and output files close, 3,5,7 ;Signprint, "DONE"
al that the program is finished
end
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This function accepts an image and returns the height of the image. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; function getHeight, pic ;Use the size function to calculate the height s = size(pic,/dimensions) ;Returreturn, height = s[1]
n the height
end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; This function accepts an image and returns the width of the image. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; function getWidth, pic ;Use the size function to calculate the width s = size(pic, /dimensions) ;Returreturn, height = s[0]
n the height
end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This function accepts an image and a threshold limit value. It then ; thresholds the image based on the limit value. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; function threshold, pic, limit ;Set values above the limit to 255 pic[where(pic ge limit)] = 255 ;Set values below the limit to 0 pic[where(pic lt limit)] = 0 ;Return the thresholded image return, pic end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This function accepts two sets of points as arguments. It finds the ; angle of the first set of points relative to the second set of ; points. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; function getTheta2, x, y, centerx, centery ;Adjust the first set of points so that they are located relative to the second ;set. x = x - centerx y = y - centery ;Calculate the angle theta = atan(x,-y) ;Return the value of theta return,theta end
Appendix B
Experimental Setup Parts List
From McMaster-Carr Industrial Supply:
Part Description Part Number Quantity20mm ABEC7 Bearing 2385K34 31hp Electric Motor 5990K52 1A25 Rubber V-Belt 6186K123 1Open Linear Bearing 9338T15 25/8" Shaft Collar 9414T13 8Bearing Shaft 6061K123 2
From Grainger Industrial Supply:
Part Description Part Number QuantitiyLarge Adjustable Sheave 3LC30 1Small Adjustable Sheave 1X448 1
52
References
[1] S.H. Strogatz, Nonlinear Dynamics and Chaos, (Addison-Wesley, Reading, 1994), pp. 8-9. [2] G.L Baker, J.A. Blackburn, The Pendulum: A Case Study in Physics, (Oxford, New York, 2005) pp. 121-152. [3] J.A. Blackburn, S. Vik, B. Wu, “Driven Pendulum for Studying Chaos,” Rev. Sci. Instrum. 60, No. 3 422 (1988). [4] X. Xu, M. Wiercigroch, “Approximate Analytical Solutions for Oscillatory and Rotational Motion of a Parametric Pendulum,” Nonlinear Dyn 47, 311–320 (2007). [5] N. V. Nikitina, “Ultimate Energy of a Double Pendulum Undergoing Quasiperiodic Oscillations,” International Applied Mechanics, 43, No. 9 (2007). [6] J.L. Trueba, J.P. Baltanás, M.A.F. Sanjuán, “A generalized perturbed pendulum,” Chaos, Solitons and Fractals, 15, 911–924 (2003). [7] A. Souza de Paula, M. A. Savi, F. H. Iunes Pereira-Pinto, “Chaos and Transient Chaos in an Experimental Nonlinear Pendulum,” Journal of Sound and Vibration, 294, 585– 595 (2006). [8] Y. Liang, B.F. Feeny, “Parametric Identification of a Chaotic Base-Excited Double Pendulum Experiment,” Nonlinear Dyn, 52, 181–197 (2008). [9] T. J. Bridges, K.V. Georgiou, “A Transverse Spinning Double Pendulum,” Chaos, Solitons and Fractals, 12, 131-144 (2001). [10] T. Nagamine, Y. Sato, Y. Koseki, “Stable Rotation of Parametrically Excited Double Pendulum,” Journal of Vibration and Control, 13, No. 2 111-124 (2007).
53