Youe can not help men permanently by doing for them what they could and should do for themselves.
..."Abraham Lincoln(1809-1865, US President 1861-1865"

on: December 23, 2008, 02:10:01 pm » posted from:SINGAPORE,SINGAPORE,SINGAPORE

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:\EasyJavaSimulation\EJS_4.1_090609\EJS_4.1\workspace\export\ejs_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:\EasyJavaSimulation\EJS_4.1_081216\EJS_4.1\workspace\source\users\murcia\fem\physics\mechanics\Collision1D.xml

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

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 = ½ m_{1}.v_{1}^{2}

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, m_{1} in kg * initial velocity of cart ONE, u_{1} in m/s * mass of cart TWO, mass_2, m_{2} in kg * initial velocity of cart TWO, u_{2} 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 u_{1} and u_{2} to v_{1} 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/.

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.

Original code from by Prof. Paco F:\EasyJavaSimulation\EJS_4.1_081216\EJS_4.1\workspace\source\users\murcia\fem\physics\mechanics\Collision1D.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 m_{1}u_{1}=, m_{2}u_{2}= m_{1}u_{1}+ m_{2}u_{2}=, m_{1}v_{1}=, m_{2}v_{2}= m_{1}v_{1}+ m_{2}v_{2}=, 0.5m_{1}u_{1}^{2}= 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

*** There are 8 more attached files. You need to login to acces it!

« Last Edit: March 31, 2011, 01:55:02 pm by lookang »

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, 09:29:18 pm by lookang »

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?

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

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

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, 01:36:27 pm by lookang »

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 ?

Reply #15 on: February 20, 2009, 02:12:29 pm » posted from:Taipei,T'ai-pei,Taiwan

The center of mass is not at the same position before/after the collision. It is fine, if you change the velocity to 2.6 and -2.6 But you will not be able to set velocity to 2.5 or -2.5 again if you have dragged the slider. It is a minus bug in the code. You can ask students: what is wrong in the simulation! May be they can find out more. This is another way of learning. (Could be fun,too!).

You are welcomed to find out if there is anything wrong in my simulations,too! We all make mistakes! At least, I do!

The center of mass is not at the same position before/after the collision. It is a minor bug in the code.It is fine, if you change the velocity to 2.6 and -2.6

agreed, i notice the flash did make that calculation error.

I just like to add that EJS open source codes approach path the way forward for human knowledge creation, the simulation takes on a life of it own and lives on.

I love open source

« Last Edit: February 20, 2009, 03:07:15 pm by lookang »

Reply #17 on: March 03, 2009, 09:27:59 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

i am trying to make the 2 carts not overlap each other.

i inserted this custom function:

"drag ();" inside the graphics of the body1 under the on drag field.

the codes are:

public void drag () { //double aaa =Math.abs(x1-x2); / x1 is position centre of cart1 //x2 is position of cart2 //radius1 is length centre to edge of cart1 //radius1 is length centre to edge of cart2

if ( Math.abs(x1-x2)<(radius2+radius1) ) / { x2 = x1+(radius2+radius1); // i used the idea of function to make cart1 on drag to make x2 some equal distance from x1 to give the appearance of push together due to physical constraint touching together if Math.abs(x1-x2)<(radius2+radius1)but it cannot work??

Reply #18 on: March 03, 2009, 10:08:22 am » posted from:Taipei,T'ai-pei,Taiwan

1. You can write code directly inside the action property field. I define custom function when it is used more than one places. 2. What you did seem to be correct. May be there are something wrong at other places. Please upload your xml file so that I can check it.

Reply #19 on: March 03, 2009, 10:58:33 am » posted from:SINGAPORE,SINGAPORE,SINGAPORE

i also thought i did it correctly.

sorry i got a lot of tabs in the xml, short codes so that i can follow myself, and do simple copy and paste if i need to remixed into other xml, it looks messy but i prefer this to a one tab with many sections of codes.

thanks!

*** There are 1 more attached files. You need to login to acces it!

Reply #20 on: March 03, 2009, 12:38:36 pm » posted from:Taipei,T'ai-pei,Taiwan

It works when I add the following code to the end of "Fixed relation" page.

Code:

if ( Math.abs(x1-x2)<(radius2+radius1) ) { x2 = x1+(radius2+radius1); }

It means you have a command set x2=0.0 in one of your tabbed pages (either _initialize pages or Fixed relation pages) or You have so many pages, I can not find it. (I would suggest you find a better way to organize your pages!

Check out the attached xml

*** There are 1 more attached files. You need to login to acces it!

Reply #22 on: March 18, 2009, 11:08:44 pm » posted from:Singapore,,Singapore

will do some real student learning on 23 25 26 / march 2009. thanks to LeeTl

it will be based on virtual laboratory type of worksheet.

i doubt the school education system encourage student construct and modify EJS codes constructionism type of learning. Maybe i can explore more along this direction when i go back to teach in class in 2010 July.

Reply #25 on: March 21, 2009, 04:45:12 pm » posted from:Taipei,T\'ai-pei,Taiwan

There are a lot of image files in your xml source. It will take time to read all the images into EJS and eat up memory quickly. If the image files are only needed in the intorduction page. You can write those information into a html file and include html into EJS. This might help (However, I have never tried it before. So I really do not know.).

i seem to be unable to load the applet here. i can load the others on other pages with no problem.

can anyone verify "unable to load the applet here"?

i suspect the "Modify EJS Simulation" function checkbox maybe does not allow too many uploads? or some how i uploaded jar files that mess up the "Modify EJS Simulation" function ?

i found the cause of the problem to load in the web deployment.

immediately after i delete the group 2d in the view, which i used to create the graphics of magnets, the applet loads again on the web here.

for those who are interested file Collision1Dwee07.xml has the group2D graphics which will cause a failed web applet though the jar works independently if launched as a jar standalone app.

Collision1Dwee08.xml has the has the group2D graphics deleted and all is wonderful again. web deployment works again!!!

Youe can not help men permanently by doing for them what they could and should do for themselves.
..."Abraham Lincoln(1809-1865, US President 1861-1865"