Author Topic: Ejs open source java applet 1D collision carts Elastic and Inelastic Collision  (Read 107168 times)

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
virtual laboratory simulation for One Dimension collision of two carts allowing inquiry learning for elastic and inelastic studies.
Thanks To Professor Fu-Kwun Hwang for guidance and Professor Francisco Esquembre for EJS and the open source digital library source codes.
Ejs open source, the web applet is from C:EasyJavaSimulationEJS_4.1_090609EJS_4.1workspaceexportejs_Collision1Dwee15workingweb.jar
the refined Ejs copy is not deploying correctly in web applet but available as a direct download jar for classroom intervention.
License:
http://creativecommons.org/licenses/by-sa/3.0/sg/

Original code from by Prof. Paco
F:EasyJavaSimulationEJS_4.1_081216EJS_4.1workspacesourceusersmurciafemphysicsmechanicsCollision1D.xml

original worksheet by lookang
http://docs.google.com/Doc?id=dff7wgc7_137gthv2kjh&hl=en
Teacher worksheet here on the next page as attachments
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=831.30
Feedback on Intervention using this worksheets
http://spreadsheets.google.com/ccc?key=pSftDRbvVJyPVPNzwHHHUeA&hl=en

Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
  • Please feel free to post your ideas about how to use the simulation for better teaching and learning.
  • Post questions to be asked to help students to think, to explore.
  • Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!
« Last Edit: March 26, 2012, 05:06:23 pm by lookang »

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #1 on: December 30, 2008, 10:40:16 pm »
Momentum One Dimension Collision Model

The motion of a body of mass m and velocity v is described by a vector quantity known as momentum p where

p = m v

 When objects collide, whether trains, cars, billiard balls, shopping carts, or your foot and the sidewalk, the results can be complicated. Yet even in the most chaotic of collisions, as long as there are no net external forces acting on the colliding objects, one principle always holds and provides an excellent tool for understanding the collision. That principle is called the conservation of linear momentum which states that

 
The total momentum of a system remains constant provided that no external resultant force acts on the system

 
For two bodies colliding linearly, it is written mathematically as a vector equation

 
Total initial momentum = total final momentum

m1.u1 + m2.u2 = m1.v1 + m2.v2


If external forces (such as friction) are ignored, the total momentum of two carts prior to a collision (left side of equation) is the same as the total momentum of the carts after the collision (right side of equation).

Collisions are classified into elastic (or perfectly elastic), inelastic and completely inelastic.

 

There is also a concept of kinetic energy of a moving body is stated mathematically by the following equation:

KE1 = ½ m1.v12



Main Simulation View
The simulation has 2 collision carts on frictionless floor and wheels.
Sliders

Explore the sliders allows varying the variables .

   * mass of cart ONE, mass_1, m1 in kg
   * initial velocity of cart ONE, u1 in m/s
   * mass of cart TWO, mass_2, m2 in kg
   * initial velocity of cart TWO, u2 in m/s

Radio Buttons
Allows for selecting what kind of collision is simulated.

A Perfectly elastic collision is defined as one in which both conservation of momentum and conservation of kinetic energy are observed
A Perfectly Inelastic collision is defined as one in which conservation of momentum is observed but the colliding carts stick together after collision with kinetic energy loss

Checkboxes
show: velocity, for visualizing the velocity vector
plot momentum vs time graph, for different representation of data for momentum of cart 1, 2 and both.
plot kinetic energy vs time graph, for different representation of data for kinetic energy of cart 1, 2 and both.
paused when collide, for visualizing the change in the velocity u1 and u2 to v1 and v2
fast simulation, for cases where the velocity are low and repeat learners can spend time more usefully collecting and analysing data.
hint: COM, for the equation of conservation of momentum
hint: COKE, or the equation of conservation of kinetic energy

Buttons
Play
Step Back
Step Forward
Initialize
Reset
have their usual meaning.
known bug is the Step Back button implementation, please fix it if you can and email me the improved source XML.


Credits:
The Momentum 1D Collision model was created by created by lookang using the Easy Java Simulations (EJS) version 4.2 authoring and modeling tool. An applet version of this model is available on the NTNU website . Shout our thanks to the Ejs community namely, Francisco Esquembre , Fu-Kwun Hwang and Wolfgang Christian for their professional learning community support. You can examine and modify this compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select "Open EJS Model" from the pop-up menu. You must, of course, have EJS installed on your computer. Information about EJS is available at: http://www.um.es/fem/Ejs/ and in the OSP comPADRE collection http://www.compadre.org/OSP/.


Leveraging on Easy Java Simulation tool and Open Source computer simulation library to create interactive d...                                                                                                     



Leveraging on Easy Java Simulation tool and open source computer simulation library to create interactive d...                                                                                                  


virtual laboratory simulation for One Dimension collision of two carts allowing inquiry learning for elastic and inelastic studies.
Thanks To Professor Fu-Kwun Hwang for guidance and Professor Francisco Esquembre for EJS and the open source digital library source codes.

My java interactive digital media applet
http://home.phy.ntnu.edu.tw/~lookang/EJS_4.1_081216/Collision1Dwee.html
http://home.phy.ntnu.edu.tw/~lookang/EJS_4.1_090115/Collision1Dwee.html newer
http://home.phy.ntnu.edu.tw/~lookang/EJS_4.1_090208/Collision1Dwee01.html

Good applet model reference:
http://www.walter-fendt.de/ph14e/collision.htm

License:
http://creativecommons.org/licenses/by-sa/3.0/sg/

Original code from by Prof. Paco
F:EasyJavaSimulationEJS_4.1_081216EJS_4.1workspacesourceusersmurciafemphysicsmechanicsCollision1D.xml

1 D collision for analysis with Elastic and Inelastic Collision by lookang
Collision 1D
This is a simulation of a one-dimensional collision of two rigid disks.
 
It is a simple example of the event-handling features of the ODE solvers in Easy Java Simulations.
source code
download the *.jar for using the applet on standalone without internet connection.

if you want to recompile without errors with the worksheet graphics, download the 1.4MB jar, expand it, copy the folder Collision1Dwee01 into the source folder location, it should recompile nicely with all graphics available! :)

Modifications done are:
1. rigid rectangles
2. added wheels
3. added floor
4. added panel for inputs
5. added coefficient of restitution e, http://en.wikipedia.org/wiki/Inelastic_collision
6. added plot of KE vs t and Momentum vs t
7. change look for object 1 is RED and object 2 is blue
8. added checkbox for view of plot
9. added buttons of elastic and inelastic selection
10. change buttons to open-source physics.org default ones
11. added deterministic equations C.O.K.E. and C.O.M.
12. added view zoom slider
13. added color change easy
14. added enable buttons only at start of simulation
15. added slider for m1 m2 v1 v2 with closest ticker for inquiry learning
16. added calculation for tcollision and tmaxleft and tmaxright
17. added enable play button only if collision occurs in the view max
18. added stepback() function by using dt = -dt with if else statement
19. added stepforward() function to replace _step() as need a way to remember dt
20. added wheelAngle to rotate the wheel
21. added mass1 and mass2 stored values after reset through a work around after considering initialise method but i decide to do the reset method.
22. added bigger arrows and texts before and after tcollision to alert learners to difference in u1, u2 and v1 ,v2
23. added ??? before hint is shown for t < tcollision
24. added physical detection when press cart1 and cart2, to prevent overlap of carts
25. fix some bugs on enable play button for detecting collision in screen
26. known bug of u1 =0.5 and u2 = 0.5, the play button is still allow........ strange?
27. rearrange the codes for housekeeping less messy
March 11 2009
28. redesign to make look wheel more circle
29. remove hints to suit request to try without from school
30. rearrange bottom panel
31. make graphs to show by default
March 19 2009
32. added graphics of springs and velcro for elastic and inelastic collision
33. added checkbox for values of
m1u1=, m2u2= m1u1+ m2u2=,
m1v1=, m2v2= m1v1+ m2v2=,
0.5m1u12= and so on to aid data analysis in worksheet activity, for pattern recognition
March 20 2009
34. added magnets for elastic and velcro for inelastic now with tooltips!
March 21 2009
35. changed to spring for elastic
36. redesign the table for values
January 21 2010
37 fixed a bug of the velcro and springs not draggable and dislocate the carts, now it is activated by on press and on exit, sensitivity at 10 to make it easily to mouse over the velcro TT and spring
January 24 2010 only Available on the standalone jar file http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=831.0;attach=1628
38 modify the codes to show partial inelastic collision with an input field of e = 0
39 modify partial to Math.random()
40 remove the number of ticks and closest "false" in order to deploy as a web applet
41 added input field for velocity u1 and u2
42 the appears to be an issue of stability after using Ejs 4.2.7 to compile the source codes, i will investigate and try Ejs 4.2 to test out the codes
March 6 2010
43 made the text for graph click-able as the check-box
44 set x max to tmax as requested by leongster, improving the visual learning of interpretation of the graphs instead of auto-scale immediately
March10 2010
45 added centre of mass as inspired by tatlee08 and http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=5.msg5482;topicseen#msg5482
15 April 2010
46 Fixed an input field of e to be allow to take values from user to allow exploration of e, technique used is assign es to the field
47 made the bottom smaller to fit into the view of width = 750 when web deployed
realized guest accounts canot see attachment which makes my *.jar almost difficult to find by interested learners.
April23 2010
48 increased the sensitivity of cart1 and 2 for ease of drag of carts instead of the exact center
49 added codes to prevent the applet from jamming when the carts are placed at extreme left and right by inserting +0.001 and -0.001 into the x positions of the carts thanks to HY LEE for finding the bug.
50 fixed a calculation of tcollision, remove from evolution page, only in initialization page now because the calculation is deterministic.
18May2010
51 fixed a bug with the time due to the introduction of 49, added -0.001 and +0.001 to the left and right side of the extreme
if (x1>=(max-radius1-0.001) || x1<=(-max+radius1+0.001) || x2>=(max-radius2-0.001)|| x2<=(-max+radius1+0.001))
{
_pause();
}
52 added the worksheets and suggested answer key into the jar file for ease of scaling to other classrooms in the world
53 added portuguese language translated by ahmedelshfie, thanks!
26May2010
54 added game like assessment of learning input fields for students to check for understanding thanks to student feedback from rvhs http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=831.msg6291#msg6291
55 made color background of last column uniform
29May2010
56 finer customization of assessment for learning game feedback now recognize elastic and inelastic and partial
57 added sound effect for collision for partial and inelastic, elastic has no sound because real life use like poles of a magnet to repel simulate collision refer to http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=824.0 for sound adding
58 added data analysis tool for graphs data like tracker
59 worksheets and suggested answer all packed inside the jar, 1.6 mb file now.
15 June 2010
60 remove the "pause when collide" checkbox since it seems to not work anymore
61 width = 600 resized
31 March 2011
made all the vectors point to the right by adding Math.abs() for consistent pen paper discussion
made the table editable for clearer values though it cannot be edited, for journal paper graphics


i started doing html again in EJS4.1 16 dec 2008 version

this is another world class applet in my view, built on the strengths of open source, and contribution by great man like prof paco and prof hwang.

addition improved in next version:
a prediction of collision before showing the 2 equations of MOM and COKE ::) because it did not collide and the equations shown are for assumed the is a collision.

any help is appreciated
« Last Edit: March 31, 2011, 02:55:02 pm by lookang »

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #2 on: December 31, 2008, 10:58:28 am »
I just modified the code. Guest can view attachment file now.

You can add another variable show_equation (initial value: false) and set it's value to true when detect collision. :-)

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #3 on: December 31, 2008, 11:35:19 pm »
I just modified the code. Guest can view attachment file now.
Thanks!

You can add another variable show_equation (initial value: false) and set it's value to true when detect collision. :-)

I have a boolean variable for collision

now i fixing another issue with the display of u1, u2, v1, v2. still improving it with deterministic time to reach the edge of max view.
will post automatically when ready!


Made a Youtube



YouTube. Was stuck at Portland airport from 11pm to 4am, decided to use the time to make some promotional video on the applets shared during 2010 AAPT Summer Meeting in Portland, Oregon


Some demonstrations of various types of collsions along a low friction track.
« Last Edit: July 26, 2010, 10:29:18 pm by lookang »

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
i can't make the wheels rotate by using the rotate function as in the EJS 4.1. the object does not have a rotate option but a transform option that seems to only take constant value like

ro:45d

but not ro:wheelAngle


where wheelAngle is = x1/radius1 ; // formula for s = r*teta


after compiling, it does not seems to take the value of wheelAngle as x1 changes.

i suspect it could be a bug or area of improvement for future EJS version?

thanks for looking into this matter.

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
I just tried it. It seems to work fine.
Set the Transform property to wheelAngle should be fine.

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
can look at my xml, wheel01 and wheel02 have transformation but they do not rotate.

it is puzzling me ???

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
You did not change the transformation as I indicated above.
You set it to
ro:wheelAngled
However: no variable defined as wheelAngled available.
Change the above to
wheelAngle
(Yes. Without ro:)
And it should work (for wheel01 and wheel012).

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
(Yes. Without ro:)
And it should work (for wheel01 and wheel012).

Yes! thanks ! without any ro:

just wheelAngle in the transformation. got it to work now! cool

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #10 on: February 10, 2009, 02:09:21 pm »
I am starting a small study on using this EJS made virtual lab.

Outcome to aid learning:
Inquiry Learning Worksheet to complement this virtual lab.



i found a couple of interesting worksheets .
http://users.salineschools.com/~frederth/Physics/Unit9/LabConsMomentum.pdf
http://physicslabs.cwru.edu/MECH/Manual/Worksheets/COL.pdf
http://www.pasco.com/resources/labdownloads/word/glx/physics/14%20Momentum%20SV.doc



Do you have one that i can adapt to this virtual lab on elastic and inelastic collision momentum and kinetic energy?


trying to improve the usability of applet virtual lab
« Last Edit: February 16, 2009, 02:58:12 pm by lookang »

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #11 on: February 17, 2009, 05:02:37 pm »
first draft of the worksheet to complement the virtual lab.

hope to capture:

1. inquiry learning
2. allows self directed learning
3. has collaborative social group work learning
4. promote critical thinking.



changed to tatlee08@gmail.com , weelookang@gmail.com  for feedback
« Last Edit: February 24, 2009, 02:43:58 pm by lookang »

LeeTl

  • Newbie
  • *
  • Posts: 0
    • Lee Tat Leong's Physics Blog
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #12 on: February 19, 2009, 05:08:27 am »
Look thru your work sheet. It would be interesting if the students also have a hands-on to compare theory and practice. Can we:
1) Split class in half - one use the applet another using the collision carts but with similar worksheet. Then get them together to compare their solution.
2) Do the same task using applet and collision carts. However this will not generate much discussion

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #13 on: February 19, 2009, 08:55:05 am »
Look thru your work sheet. It would be interesting if the students also have a hands-on to compare theory and practice. Can we:
1) Split class in half - one use the applet another using the collision carts but with similar worksheet. Then get them together to compare their solution.
.


My thoughts:
Actually my previous school did the real lab in 2007, it is very difficult to setup with data loggers and can't vary mass easily, the range of space for collision also need about >0.5m for data logger to read distance of the carts. But if you sure you want a side by side intervention, just be ready for chaos in the real lab and lots of time for trouble shooting.

My position:
I am okay with both as long as you are :)
Let's discuss more what is our research question.

My take on EJS vs Real Data logger lab
My experience tells me both (real and virtual) will have advantages and disadvantages over the other method.

A great teacher (CHEE YS) once enlightened us:
It is not about which is better, black vs white paradigm, it is about bringing the best of both the virtual world and real world to achieve meaningful learning for students, the degree of both as to speak "blended learning"?

My original idea:
Let me go find the research that just record their journey, I hope it is more impactful & meaningful.
research less, students learn more & teach less, learn more.



2) Do the same task using applet and collision carts. However this will not generate much discussion

My thoughts:
I have my doubts about that being a fair comparison.
I doubt real lab allows the degree of self directed learning, provide by EJS virtual lab.
Virtual Lab are

1. safe inquiry
2. easy setup
3. 1 to 1 exploration of science
4. time
5. any time, any place

« Last Edit: January 21, 2010, 02:36:27 pm by lookang »

lookang

  • Moderator
  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: 1 D collision for analysis with Elastic and Inelastic Collision by lookang
« Reply #14 on: February 20, 2009, 02:05:48 pm »
found this cool flash of similar design and intent.

http://www.physics-lab.net/applets/one-dimensional-collisions
http://www.physics-lab.net/appletsold/1dcollisions/1dcollisions.swf

i didn't flash it here using flash codes for copyright
says gavin lobo



good flash there,

i got an improvement idea .
1. to show the equations of COM and COKE only after there is collision t > t collision
else show left side of the equation only with the usual ????

found some good applet on collision

http://www.walter-fendt.de/ph14e/collision.htm

https://www.msu.edu/~brechtjo/physics/airTrack/airTrack.html

http://dept.physics.upenn.edu/courses/gladney/phys1/lectures/lecture7/momentum_conservation.html

http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=5

http://66.7.205.91/~lookangc/index.php?topic=1009.0

http://webphysics.davidson.edu/physlet_resources/bu_semester1/c13_elasticity.html 
« Last Edit: September 29, 2010, 11:24:11 am by lookang »