# NTNUJAVA Virtual Physics Laboratory

## Easy Java Simulations (2001- ) => Collaborative Community of EJS => Topic started by: lookang on October 15, 2008, 05:12:53 pm

Title: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on October 15, 2008, 05:12:53 pm
Ejs open source simple harmonic applet SHM for inquiry learning virtual lab updated April 2010 with slightly better GUI and color scheme.
google tag " simple hamonic motion simulation "
spring mass easy java simulation on simple harmonic physics applet with options for pre university A level physics made by lookang.

remixed From an EJS manual example from D:EasyJavaSimulationEjs3.46_070428EjsSimulations\_examplesManualSpring.xml and D:EasyJavaSimulationEjs3.46_070428EjsSimulations\_examplesManualSpringAdvanced.xml by Author : Francisco Esquembre
follow the tutorial on spring mass system allows this virtual lab to be created by lookang.
Thanks to Francisco Esquembre, Fu-Kwun Hwang and Wolfgang Christian for their guidance.
many options: simple harmonic motion forced oscillation of course, another best java physics applet, by teacher for teachers.
older versions
http://66.7.205.91/~lookangc/_apps/_examples/weelookangspring05.app/weelookangspring05_Simulation.html
Title: Re: easy java simulation video tutorial on simple harmonic applet made by lookang
Post by: lookang on November 05, 2008, 03:04:54 pm
Simple Harmonic Motion Model

The EJS simple harmonic motion Model shows a mass m situated at the end of 2 springs of length l = 2.0 m of negligible massThe motion is restricted to one dimension, the horizontal. (We choose a coordinate system in the plane with origin at centre of the mass-spring system and with the X axis along the direction of the spring). The floor is assumed to be frictionless.

Four Plots vs t shows
1 displacement (in m) versus time (in s).
2 velocity (in m/s) versus time (in s).
3 acceleration (in m/s^2) versus time (in s).
4 energies (in J) versus time (in s).

Three Plots vs X shows

5 velocity (in m/s) versus displacement (in m).
6 acceleration (in m/s^2) versus displacement (in m).
7 energies (in J) versusdisplacement (in m).

Users can examine and change the model if they have Ejs installed.

free oscillations

A simple harmonic oscillator is an oscillator that is neither driven nor damped. Its motion is periodic— repeating itself in a sinusoidal fashion with constant amplitude, A. Simple harmonic motion SHM can serve as a mathematical model of a variety of motions, such as a mass on a spring.

For simplicity, we assume that the reaction of the springs to a displacement dx from the equilibrium point follows Hooke's Law, F(dx) = -k dx , where k is a constant which depends on the physical characteristics of the spring.

This, applying Newton's Second Law, leads us to the second order differential equation

d2x / dt2 = -k/m (x-l),

where x is the horizontal position of the mass from the from the origin centre of the springs.
This is similar to what is commonly describe in SHM as
a = - ?2x
a acceleration
w omega is angular velocity of SHM
x displacement of object in SHM from the equilibrium position

Exercises: Designed for http://www.seab.gov.sg/aLevel/20102011Syllabus/9646_2011.pdf
Oscillations
Content
• Simple harmonic motion

1. Run the simulation with b = 0 (no damping) and X driver = 0 ( no driver amplitude). Explore the various sliders to make sense of the sliders. Describe the motion of these free oscillations with reference to acceleration and displacement. Describe and relate to other examples of simple free oscillations.
2. Investigate the relationship of the displacement, velocity and acceleration versus time by exploring the Plot vs t checkbox to reveal the graphical display of the experimental view of the setup. Describe, with graphical illustrations, the changes in displacement, velocity and acceleration during simple harmonic motion.
3. Explore the terms amplitude, period, frequency, angular frequency and phase difference in the virtual laboratory by looking for the hints in the virtual lab. Play with the sliders and make sense of these terms used commonly in SHM.
4. Explore and record the period, T in terms of both frequency, f and angular frequency, ?. Select the 'expert' checkbox and look for the values of f and ? in relations to T.
5. The equation a = –?2x is the defining equation of simple harmonic motion. Select the Plot vs X checkbox and record down the graph. Why is the equation is correct? Explain the negative sign and meaning of ? in terms of k and m.
6. The equation  v = vocos? t can be used to describe the graph of v versus t (select checkbox Plot vs t and check v) Why is the equation is correct? Under what conditions is the equation valid?
7. The equation  v = ±? Math.sqrt ( xo2 - x2 )  can be used to describe the graph of v versus x (select checkbox Plot vs x and check v) Why is the equation is correct? Under what conditions is the equation valid?
8. Explore degree of damping and the importance of critical damping by varying the slider of b. Design and record down how the values of b affects the graph of displacement vs time. Hint: The graph of energies vs time would be of interest in describing the effects of damping.
9. Explore the amplitude and frequency of the driving force (Fdriver) and it effects on the motion of the system.

recently change 07 June 2009
1. allow the mass to be drag and remember the x initial value.
2. resize the screen and the velocity vector and text to prevent the autoscale to cause the view to move to much.
April 2010
3 updated with slightly better GUI and color scheme.
4 remove plotperiod
5 added dots on all 7 graphs for better visualization of value of graphs.
6 update sliders and checkbox with associated background colors
09 February 2011
8 added motor plunger as the right wall now moves with the externalForce(t) = amplitude * Math.sin(frequency*time); for greater association to possible real life setup
9 move top check-boxes hints to bottom as well for standard menu control

source code
download the *.jar for using the applet on standalone without internet connection.
Title: Re: Ejs open source simple harmonic applet SHM for inquiry learning virtual lab
Post by: Rare on October 03, 2009, 03:47:03 pm
This simulation show The relations between acceleration, velocity and displacement in simple harmonic motion{(b. investigate the motion of an oscillator using experimental and graphical methods) and (g. describe with graphical illustrations, the changes in displacement, velocity and acceleration during simple harmonic motion)}, right ? ??? Thanks
Title: Re: Ejs open source simple harmonic applet SHM for inquiry learning virtual lab
Post by: lookang on October 03, 2009, 04:18:54 pm
This simulation show The relations between acceleration, velocity and displacement in simple harmonic motion{(b. investigate the motion of an oscillator using experimental and graphical methods) and (g. describe with graphical illustrations, the changes in displacement, velocity and acceleration during simple harmonic motion)}, right ? ??? Thanks

Yes! relations between acceleration, velocity and displacement in simple harmonic motion can be observe in the inquiry learning virtual lab.

experimental method is the oscillator moving in SHM
graphical corresponding graphs total there are 7 of them.

to describe can used the wiki explanation:
In physics, simple harmonic motion (SHM) is the motion experiences a single force that is directly proportional to the displacement x and points in the opposite direction.

the equation model is a = - w2x
a acceleration
w omega is angular velocity of SHM
x displacement of object in SHM from the equilibrium position

let me know what you need to understand in SHM, i think i will create an exercise to let u try with the applet ;D
Title: Re: Ejs open source simple harmonic applet SHM for inquiry learning virtual lab
Post by: lookang on October 03, 2009, 04:25:38 pm
Motion of a spring
This is the simulation of the motion of a mass m situated at the end of a spring of length l and negligible mass. The motion is restricted to one dimension, the horizontal. (We choose a coordinate system in the plane with origin at the fixed end of the spring and with the X axis along the direction of the spring).
We assume that the reaction of the spring to a displacement dx from the equilibrium point follows Hooke's Law, F(dx) = -k dx , where k is a constant which depends on the physical characteristics of the spring. This, applying Newton's Second Law, leads us to the second order differential equation
d2x / dt2 = -k/m (x-l),
where x is the horizontal position of the free end of the spring.
In the simulation we solve numerically this equation and visualize the results.
Title: Re: Ejs open source simple harmonic applet SHM for inquiry learning virtual lab
Post by: lookang on October 03, 2009, 10:18:53 pm
This simulation show The relations between acceleration, velocity and displacement in simple harmonic motion{(b. investigate the motion of an oscillator using experimental and graphical methods) and (g. describe with graphical illustrations, the changes in displacement, velocity and acceleration during simple harmonic motion)}, right ? ??? Thanks
Hi rare, do the Exercises. it will help u make sense:)
Exercises:
Oscillations
Content
• Simple harmonic motion

1. Run the simulation with b = 0 (no damping) and X driver = 0 ( no driver amplitude). Explore the various sliders to make sense of the sliders. Describe the motion of these free oscillations with reference to acceleration and displacement. Describe and relate to other examples of simple free oscillations.
2. Investigate the relationship of the displacement, velocity and acceleration versus time by exploring the Plot vs t checkbox to reveal the graphical display of the experimental view of the setup. Describe, with graphical illustrations, the changes in displacement, velocity and acceleration during simple harmonic motion.
3. Explore the terms amplitude, period, frequency, angular frequency and phase difference in the virtual laboratory by looking for the hints in the virtual lab. Play with the sliders and make sense of these terms used commonly in SHM.
4. Explore and record the period, T in terms of both frequency, f and angular frequency, ?. Select the 'expert' checkbox and look for the values of f and ? in relations to T.
5. The equation a = –?2x is the defining equation of simple harmonic motion. Select the Plot vs X checkbox and record down the graph. Why is the equation is correct? Explain the negative sign and meaning of ? in terms of k and m.
6. The equation  v = vocos? t can be used to describe the graph of v versus t (select checkbox Plot vs t and check v) Why is the equation is correct? Under what conditions is the equation valid?
7. The equation  v = ±? Math.sqrt ( xo2 - x2 )  can be used to describe the graph of v versus x (select checkbox Plot vs x and check v) Why is the equation is correct? Under what conditions is the equation valid?
8. Explore degree of damping and the importance of critical damping by varying the slider of b. Design and record down how the values of b affects the graph of displacement vs time. Hint: The graph of energies vs time would be of interest in describing the effects of damping.
9. Explore the amplitude and frequency of the driving force (Fdriver) and it effects on the motion of the system.

Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on December 02, 2009, 09:18:23 am
Got a question from Ahmed who i think is using this applet's source codes to remix.

his question is:
"I mean for example im developing into a project and im begin by tools 2D Drawingpanel so have a part on project
I must use tools from 3DDrawingpanel,, and im begin develop by 2D Drawingpanel so im try use for example
(3Dparticle:A 3D particle) on drawing panel 24 so when i make it appear this massage for me
(THIS ELEMENT CAN NOT BE ADDED TO THIS PARENT) and i'll insert picture and mark from problem begin
Im waiting answer thanks so much. "
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on December 02, 2009, 09:28:18 am
I must use tools from 3DDrawingpanel,, and im begin develop by 2D Drawingpanel so im try use for example
(3Dparticle:A 3D particle) on drawing panel 24 so when i make it appear this massage for me
(THIS ELEMENT CAN NOT BE ADDED TO THIS PARENT)

If you must use 3D particle, u need to start a new 3D frame(http://www.um.es/fem/EjsWiki/uploads/Main/ElementsDisplay3DPanel.gif), because this source has a 2D frame at the beginning.

are you trying to make a 3D simple spring mass system? if you are, then u need to start a new 3D frame, add the 3D objects one by one if they were previously made in 2D objects. If they are previously in 3D, then copy and paste it should work.(http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=758.0;attach=1511;image)
I have added it for u already and the source is in a zip attached below http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=758.0;attach=1513

is that what u want?

Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: Fu-Kwun Hwang on December 02, 2009, 10:35:08 am
In EJS 3.0 , there is no differentiation between 2D and 3D elements.
For example: particle,arrow elements can be added under 2D drawingPanel or 3D drawingPanel.
All those elements had properties for x,y,z even you only use it as 2D element.

It has been changed later, there are 3 parts under "elements for the view"
1. Interface: you can add the top drawing frame, drawing panel from here, and other control elements (button, slider...)
2. 2D drawables: all the elements has to be added under 2D drawingPanel or 2D plottingPanel.
3. 3D drawables: all the elements has to be added under 3D drawingPanel.
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on December 02, 2009, 07:09:12 pm
Hi Ahmed
is this what u want?
i added the 3D frame and a 3D particle to ensure it works like what u spoke of in the emails.
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on April 06, 2010, 09:13:08 pm
old picture.
now updated with slightly better GUI and color scheme.
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: ahmedelshfie on April 06, 2010, 09:26:13 pm
Hi Prof
Yes i see now simle harmonic motion with excellent interace  ;)
Excellent Prof I'm still now try learn way for post projects to become pages HTML in site
But no get succeed yet   :-[
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: Fu-Kwun Hwang on April 06, 2010, 09:37:10 pm
You did not moved your ejs source ahmed from ejsworkspace directory
to under users subdirectory.  That is the reason why your uploaded jar file did not work.
for more detail information.
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on June 16, 2010, 02:42:38 pm

1 this is the very first applet that i made, by following the Ejs tutorial since 2007 in yjc days while doing my MAIDT @ NIE. It was not the course that taught me this, but rather it was LEE TL that shared this tool with me during a teabreak or something, that i took it very seriously to explore Ejs. The main driving force was instructional design which was the focus of the masters program, but instructional design with the ability to change learning environment/objects myself is the game changer for me. I never looked back after i found the power of Ejs. This is going to change the physics education world and i am glad to be part of it.
16 june 2010
2 made some checkboxes Force and Energy into menu to save space to fit into width =600 for blog post http://sgeducation.blogspot.com/2010/06/ejs-open-source-simple-harmonic-motion.html
18 March 2011
added a slider to slow down sim for analyze from http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2149.0
added text drag mass and release to give hint on the interactivity possible
Title: Re: Ejs open source simple harmonic motion java applet SHM virtual lab
Post by: lookang on February 09, 2011, 09:09:13 am
a teacher recently shown me an exe file that can simulate SHM with a motor as driver.
it is should not be surprising (imperfect information flow) but i am always "surprise" (i thought google will surface this applet well and everyone searches the internet for applets) despite this applet being on the internet freely assessable, it is not widely known.
Information or innovative simulations like those made in Ejs is indeed difficult to diffuse and make it to teachers classroom use :)

anyway i improve this version of the SHM and concentrate on what are my interests/excites me.
09 February 2011
8 added motor plunger as the right wall now moves with the externalForce(t) = amplitude * Math.sin(frequency*time); for greater association to possible real life setup
9 move top check-boxes hints to bottom as well for standard menu control