5.2 Springs

The Physics of springs

In this chapter we will examine the conservation of energy within the harmonic motion of an oscillating spring. There will be two random inputs: the elasticity constant (k) of a spring and the mass (kg) that is oscillating on the spring. We also will be able to lower and raise the spring. When this happens we will see the conservation of energy in a bar graph.

When the given mass is hung on the spring it stretches down to a rest position. By using the following equation for the elasticity constant we can rearrange and solve for the distance the spring will be stretched. We will have to first convert the mass to weight (force).

This will be the half-way point if the mass was dropped. It will also be the location where the velocity of the falling mass will be a maximum. At this point the Gravitational Potential Energy (GPE) will be 1/2 as much as the total energy (TE) and the rest of the energy will be split evenly between Elastic Potential Energy (EPE) and the Kinetic Energy (KE). So according to the following derivation we will be able to calculate the maximum velocity and output it onto the GUI.

We also can very simply calculate the Period (T) of oscillation for the mass and output it onto the userform using the following equation:

To get the entire height that the mass will fall we will multiply the distance we calculated earlier by 2. When the mass is first dropped all of the energy is in the form of GPE. The spring has not been stretched at all and the mass is not moving. Once the mass starts falling, the GPE will decrease because it is losing height. The KE will increase because the mass is gaining velocity. The EPE will also increase because the spring is being stretched.

At the midpoint, the GPE will be 1/2 of what it was and the EPE and the KE will be equal. The KE will be at a maximum because at this point the mass will have its maximum velocity.

At the bottom, the GPE will now be zero. Since the mass is no longer moving the KE will also be zero. The EPE will be at its maximum since the spring is stretched the entire distance.

At any point along the oscillation of the mass, the total energy will not change according the following conservation law. At the top, the total energy is all GPE and at the bottom it is all EPE.

Program Criteria:

INPUTS:

  • A random mass from1-10 kg will be created.

  • A random elastic constant (k) of 1-100 N/m will also be created.

OUTPUTS:

  • Animated graphical output of Total Energy, GPE, EPE and KE.

  • Animated graphical output of the spring position.

CRITERIA & CONSTRAINTS:

  • Clicking the button will generate a new spring and begin the animation.

  • Your program should have an impressive interface. (colors and graphics)

  • Specify units.

pseudocode:

  • Create a random mass variable from 1-10.

  • Create a random k-variable from 1-100

  • Create a Weight (W) variable

  • Create a Distance (d) variable by dividing W/k

  • Create a Height (h) variable = d*2

  • Create an Increment (inc) variable = h/10

  • Create a Position (pos) variable = h

  • Add the mass and k-value to the GUI spreadsheet.

  • Store the pos variable on the spreadsheet. I stored it in "U6"

  • Create a line graph with points 0,0 and 0, -5

  • Make the max x-axis +1 and the min x-axis -1

  • Make the max y-axis 0.

  • Use the following code to set the min y-axis for the spring graph to be equal to -h:

Use [0] if your spring chart is the first one you made.

var chart = sheet.getCharts()[1];

chart = chart.modify()

.setOption('vAxes', {0: {viewWindow: {min: -h}}})

.build();

sheet.updateChart(chart);

  • Start a while loop like: while(pos<=h)

  • Create a pendulum variable and set it to -(h-pos)

  • Store the pendulum variable in the cell where we put the -5 for the line graph

  • Get the pos variable from the spreadsheet.

  • Subtract the inc variable from the pos variable: pos=pos-inc

  • Write an if statement that if pos<0, set pos=0 and multiply inc by -1.

  • Write another if statement that if pos>h, break, so that the while loop will end.

  • Update the pos variable on the spreadsheet.

  • Set a GPE variable to W*pos

  • Set an EPE variable to .5*k*Math.pow((h-pos),2)

  • Set a TPE variable to mass*9.81*h

  • Set a KE variable to TE-EPE-GPE

  • Store GPE, EPE, KE and TE on the spreadsheet. I used "U2","U3","U4" and "U5" respectively

  • End the while loop

  • End the function.

  • On the spreadsheet create a bar graph that reads the data from U2-U5